@blinkk/root-cms 2.2.9 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/ui.js CHANGED
@@ -8,7 +8,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),L=z,Y=H),G===void 0&&(
8
8
  overflow: hidden !important;
9
9
  position: relative !important;
10
10
  ${e?"padding-right: var(--removed-scroll-width) !important;":""}
11
- `};function DV(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function RV(t){(document.head||document.getElementsByTagName("head")[0]).appendChild(t)}function MV(){let t=document.createElement("style");return t.type="text/css",t.setAttribute("mantine-scroll-lock",""),t}function UN(t,e={disableBodyPadding:!1}){let[r,o]=M(t||!1),n=W(0),{disableBodyPadding:i}=e,a=W(null),s=()=>{n.current=window.scrollY;let c=AV({disableBodyPadding:i}),u=MV();DV(u,c),RV(u),a.current=u},l=()=>{a?.current&&(a.current.parentNode.removeChild(a.current),a.current=null)};return V(()=>(r?s():l(),l),[r]),V(()=>{t!==void 0&&o(t)},[t]),V(()=>{t===void 0&&typeof window<"u"&&window.document.body.style.overflow==="hidden"&&o(!0)},[o]),[r,o]}X();var vxe=Object.defineProperty,Ixe=Object.defineProperties,wxe=Object.getOwnPropertyDescriptors,LV=Object.getOwnPropertySymbols,Exe=Object.prototype.hasOwnProperty,Sxe=Object.prototype.propertyIsEnumerable,FV=(t,e,r)=>e in t?vxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cxe=(t,e)=>{for(var r in e||(e={}))Exe.call(e,r)&&FV(t,r,e[r]);if(LV)for(var r of LV(e))Sxe.call(e,r)&&FV(t,r,e[r]);return t},Txe=(t,e)=>Ixe(t,wxe(e));function kxe(t){let e=t.toLowerCase().split("+").map(i=>i.trim()),r={alt:e.includes("alt"),ctrl:e.includes("ctrl"),meta:e.includes("meta"),mod:e.includes("mod"),shift:e.includes("shift")},o=["alt","ctrl","meta","shift","mod"],n=e.find(i=>!o.includes(i));return Txe(Cxe({},r),{key:n})}function Nxe(t,e){let{alt:r,ctrl:o,meta:n,mod:i,shift:a,key:s}=t,{altKey:l,ctrlKey:c,metaKey:u,shiftKey:d,key:f}=e;if(r!==l)return!1;if(i){if(!c&&!u)return!1}else if(o!==c||n!==u)return!1;return a!==d?!1:!!(s&&(f.toLowerCase()===s.toLowerCase()||e.code.replace("Key","").toLowerCase()===s.toLowerCase()))}function BV(t){return e=>Nxe(kxe(t),e)}function Pxe(t){return t.target instanceof HTMLElement?!["INPUT","TEXTAREA","SELECT"].includes(t.target.tagName):!0}function VN(t){V(()=>{let e=r=>{t.forEach(([o,n])=>{BV(o)(r)&&Pxe(r)&&(r.preventDefault(),n(r))})};return document.documentElement.addEventListener("keydown",e),()=>document.documentElement.removeEventListener("keydown",e)},[t])}X();function lo(t){let[e,r]=M("");return A_(()=>{r(Ml())},[]),t||e}function Oxe(){let{userAgent:t}=window.navigator,e=/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i,r=/(Win32)|(Win64)|(Windows)|(WinCE)/i,o=/(iPhone)|(iPad)|(iPod)/i;return e.test(t)?"macos":o.test(t)?"ios":r.test(t)?"windows":/Android/i.test(t)?"android":/Linux/i.test(t)?"linux":"undetermined"}function HN(){return typeof window<"u"?Oxe():"undetermined"}var Axe=Object.defineProperty,Dxe=Object.defineProperties,Rxe=Object.getOwnPropertyDescriptors,$V=Object.getOwnPropertySymbols,Mxe=Object.prototype.hasOwnProperty,Lxe=Object.prototype.propertyIsEnumerable,zV=(t,e,r)=>e in t?Axe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fxe=(t,e)=>{for(var r in e||(e={}))Mxe.call(e,r)&&zV(t,r,e[r]);if($V)for(var r of $V(e))Lxe.call(e,r)&&zV(t,r,e[r]);return t},Bxe=(t,e)=>Dxe(t,Rxe(e));function UV(t,e=-1){return Array.from({length:t}).reduce((r,o,n)=>(r[n]=n===e,r),{})}function VV({initialState:t,total:e,initialItem:r=-1,state:o,onChange:n,multiple:i=!1}){let[a,s]=Cn({value:o,defaultValue:t||UV(e,r),finalValue:{},onChange:n,rule:c=>c!==null&&typeof c=="object"}),l=c=>{if(i)s(Bxe(Fxe({},a),{[c]:!a[c]}));else{let u=Array(e).fill(0).reduce((d,f,m)=>(d[m]=!1,d),{});u[c]=!a[c],s(u)}};return mr(()=>{i||s(UV(e))},[i]),[a,{toggle:l,setState:s}]}X();X();X();var $xe=Object.defineProperty,HV=Object.getOwnPropertySymbols,zxe=Object.prototype.hasOwnProperty,Uxe=Object.prototype.propertyIsEnumerable,jV=(t,e,r)=>e in t?$xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vxe=(t,e)=>{for(var r in e||(e={}))zxe.call(e,r)&&jV(t,r,e[r]);if(HV)for(var r of HV(e))Uxe.call(e,r)&&jV(t,r,e[r]);return t};function GV(t){return D.createElement("svg",Vxe({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16},t),D.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var Hxe=Object.defineProperty,jxe=Object.defineProperties,Gxe=Object.getOwnPropertyDescriptors,WV=Object.getOwnPropertySymbols,Wxe=Object.prototype.hasOwnProperty,qxe=Object.prototype.propertyIsEnumerable,qV=(t,e,r)=>e in t?Hxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DI=(t,e)=>{for(var r in e||(e={}))Wxe.call(e,r)&&qV(t,r,e[r]);if(WV)for(var r of WV(e))qxe.call(e,r)&&qV(t,r,e[r]);return t},KV=(t,e)=>jxe(t,Gxe(e)),Kxe=me((t,{transitionDuration:e,disableIconRotation:r,iconPosition:o,offsetIcon:n,iconSize:i},a)=>({icon:{ref:a("icon"),transition:`transform ${e}ms ease`,marginRight:o==="right"?0:t.spacing.sm,marginLeft:o==="right"?t.spacing.lg:0,width:i,minWidth:i},label:{color:"inherit",fontWeight:500,flex:1,overflow:"hidden",textOverflow:"ellipsis"},item:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},itemOpened:{[`& > .${a("itemTitle")} > .${a("control")} .${a("icon")}`]:{transform:r?"none":"rotate(180deg)"}},itemTitle:{ref:a("itemTitle"),margin:0,padding:0,fontWeight:"normal"},control:DI(KV(DI(DI({},t.fn.focusStyles()),t.fn.fontStyles()),{ref:a("control"),width:"100%",display:"flex",alignItems:"center",flexDirection:o==="right"?"row-reverse":"row",padding:`${t.spacing.md}px ${t.spacing.md/2}px`,paddingLeft:o==="right"?t.spacing.sm+4:null,fontWeight:500,textAlign:"left",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}),t.fn.hover({backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[0]})),content:KV(DI({},t.fn.fontStyles()),{wordBreak:"break-word",lineHeight:t.lineHeight,paddingLeft:o==="right"?0:n?i+t.spacing.xs/2:0}),contentInner:{padding:t.spacing.md,paddingTop:t.spacing.xs/2}})),YV=Kxe;X();var XV={mt:"marginTop",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",pt:"paddingTop",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight"},Yxe=["-xs","-sm","-md","-lg","-xl"];function Nd(t){return typeof t=="string"||typeof t=="number"}function Pd(t,e){return Yxe.includes(t)?e.fn.size({size:t.replace("-",""),sizes:e.spacing})*-1:e.fn.size({size:t,sizes:e.spacing})}function jN(t,e){let r={};if(Nd(t.p)){let o=Pd(t.p,e);r.padding=o}if(Nd(t.m)){let o=Pd(t.m,e);r.margin=o}if(Nd(t.py)){let o=Pd(t.py,e);r.paddingTop=o,r.paddingBottom=o}if(Nd(t.px)){let o=Pd(t.px,e);r.paddingLeft=o,r.paddingRight=o}if(Nd(t.my)){let o=Pd(t.my,e);r.marginTop=o,r.marginBottom=o}if(Nd(t.mx)){let o=Pd(t.mx,e);r.marginLeft=o,r.marginRight=o}return Object.keys(XV).forEach(o=>{Nd(t[o])&&(r[XV[o]]=e.fn.size({size:Pd(t[o],e),sizes:e.spacing}))}),r}function JV(t,e){return typeof t=="function"?t(e):t}function QV(t,e,r){let o=dr(),{css:n,cx:i}=T_();return Array.isArray(t)?i(r,n(jN(e,o)),t.map(a=>n(JV(a,o)))):i(r,n(JV(t,o)),n(jN(e,o)))}var Xxe=Object.defineProperty,RI=Object.getOwnPropertySymbols,e9=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,ZV=(t,e,r)=>e in t?Xxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jxe=(t,e)=>{for(var r in e||(e={}))e9.call(e,r)&&ZV(t,r,e[r]);if(RI)for(var r of RI(e))t9.call(e,r)&&ZV(t,r,e[r]);return t},Qxe=(t,e)=>{var r={};for(var o in t)e9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&RI)for(var o of RI(t))e.indexOf(o)<0&&t9.call(t,o)&&(r[o]=t[o]);return r},_e=ee((t,e)=>{var r=t,{className:o,component:n,style:i,sx:a}=r,s=Qxe(r,["className","component","style","sx"]);let{systemStyles:l,rest:c}=so(s),u=n||"div";return D.createElement(u,Jxe({ref:e,className:QV(a,l,o),style:i},c))});_e.displayName="@mantine/core/Box";X();var Zxe=Object.defineProperty,ebe=Object.defineProperties,tbe=Object.getOwnPropertyDescriptors,r9=Object.getOwnPropertySymbols,rbe=Object.prototype.hasOwnProperty,obe=Object.prototype.propertyIsEnumerable,o9=(t,e,r)=>e in t?Zxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n9=(t,e)=>{for(var r in e||(e={}))rbe.call(e,r)&&o9(t,r,e[r]);if(r9)for(var r of r9(e))obe.call(e,r)&&o9(t,r,e[r]);return t},nbe=(t,e)=>ebe(t,tbe(e)),ibe=me(t=>({root:nbe(n9(n9({},t.fn.focusStyles()),t.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:t.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,textDecoration:"none"})})),i9=ibe;var abe=Object.defineProperty,MI=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,l9=Object.prototype.propertyIsEnumerable,a9=(t,e,r)=>e in t?abe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sbe=(t,e)=>{for(var r in e||(e={}))s9.call(e,r)&&a9(t,r,e[r]);if(MI)for(var r of MI(e))l9.call(e,r)&&a9(t,r,e[r]);return t},lbe=(t,e)=>{var r={};for(var o in t)s9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&MI)for(var o of MI(t))e.indexOf(o)<0&&l9.call(t,o)&&(r[o]=t[o]);return r},GN=ee((t,e)=>{var r=t,{className:o,component:n="button"}=r,i=lbe(r,["className","component"]);let{classes:a,cx:s}=i9(null,{name:"UnstyledButton"});return D.createElement(_e,sbe({component:n,ref:e,className:s(a.root,o),type:n==="button"?"button":void 0},i))});GN.displayName="@mantine/core/UnstyledButton";X();var cbe=Object.defineProperty,LI=Object.getOwnPropertySymbols,u9=Object.prototype.hasOwnProperty,d9=Object.prototype.propertyIsEnumerable,c9=(t,e,r)=>e in t?cbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ube=(t,e)=>{for(var r in e||(e={}))u9.call(e,r)&&c9(t,r,e[r]);if(LI)for(var r of LI(e))d9.call(e,r)&&c9(t,r,e[r]);return t},dbe=(t,e)=>{var r={};for(var o in t)u9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&LI)for(var o of LI(t))e.indexOf(o)<0&&d9.call(t,o)&&(r[o]=t[o]);return r},L_=ee((t,e)=>{let r=Ie("Center",{},t),{inline:o,sx:n}=r,i=dbe(r,["inline","sx"]);return D.createElement(_e,ube({ref:e,sx:[{display:o?"inline-flex":"flex",alignItems:"center",justifyContent:"center"},...Array.isArray(n)?n:[n]]},i))});L_.displayName="@mantine/core/Center";X();X();X();var fbe=Object.defineProperty,pbe=Object.defineProperties,mbe=Object.getOwnPropertyDescriptors,BI=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,f9=(t,e,r)=>e in t?fbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Od=(t,e)=>{for(var r in e||(e={}))p9.call(e,r)&&f9(t,r,e[r]);if(BI)for(var r of BI(e))m9.call(e,r)&&f9(t,r,e[r]);return t},WN=(t,e)=>pbe(t,mbe(e)),hbe=(t,e)=>{var r={};for(var o in t)p9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&BI)for(var o of BI(t))e.indexOf(o)<0&&m9.call(t,o)&&(r[o]=t[o]);return r};function gbe(t){if(!t||typeof t=="string")return 0;let e=t/36;return Math.round((4+15*e**.25+e/5)*10)}function qN(t){return t?.current?t.current.scrollHeight:"auto"}var FI=typeof window<"u"&&window.requestAnimationFrame;function h9({transitionDuration:t,transitionTimingFunction:e="ease",onTransitionEnd:r=()=>{},opened:o}){let n=W(null),i="0px",a={display:"none",height:"0px",overflow:"hidden"},[s,l]=M(o?{}:a),c=h=>{Dl(()=>l(h))},u=h=>{c(g=>Od(Od({},g),h))};function d(h){return{transition:`height ${t||gbe(h)}ms ${e}`}}mr(()=>{FI(o?()=>{u({willChange:"height",display:"block",overflow:"hidden"}),FI(()=>{let h=qN(n);u(WN(Od({},d(h)),{height:h}))})}:()=>{let h=qN(n);u(WN(Od({},d(h)),{willChange:"height",height:h})),FI(()=>u({height:i,overflow:"hidden"}))})},[o]);let f=h=>{if(!(h.target!==n.current||h.propertyName!=="height"))if(o){let g=qN(n);g===s.height?c({}):u({height:g}),r()}else s.height===i&&(c(a),r())};function m(h={}){var g=h,{style:_={},refKey:b="ref"}=g,y=hbe(g,["style","refKey"]);let v=y[b];return WN(Od({"aria-hidden":!o},y),{[b]:Sn(n,v),onTransitionEnd:f,style:Od(Od({boxSizing:"border-box"},_),s)})}return m}var _be=Object.defineProperty,zI=Object.getOwnPropertySymbols,_9=Object.prototype.hasOwnProperty,x9=Object.prototype.propertyIsEnumerable,g9=(t,e,r)=>e in t?_be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$I=(t,e)=>{for(var r in e||(e={}))_9.call(e,r)&&g9(t,r,e[r]);if(zI)for(var r of zI(e))x9.call(e,r)&&g9(t,r,e[r]);return t},xbe=(t,e)=>{var r={};for(var o in t)_9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&zI)for(var o of zI(t))e.indexOf(o)<0&&x9.call(t,o)&&(r[o]=t[o]);return r},bbe={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0};function KN(t){let e=Ie("Collapse",bbe,t),{children:r,in:o,transitionDuration:n,transitionTimingFunction:i,style:a,onTransitionEnd:s,animateOpacity:l}=e,c=xbe(e,["children","in","transitionDuration","transitionTimingFunction","style","onTransitionEnd","animateOpacity"]),d=ts()?0:n,{systemStyles:f,rest:m}=so(c),h=h9({opened:o,transitionDuration:d,transitionTimingFunction:i,onTransitionEnd:s});return d===0?o?D.createElement(_e,$I({},m),r):null:D.createElement(_e,$I({},h($I($I({style:a},m),f))),D.createElement("div",{style:{opacity:o||!l?1:0,transition:l?`opacity ${d}ms ${i}`:"none"}},r))}KN.displayName="@mantine/core/Collapse";var ybe=Object.defineProperty,UI=Object.getOwnPropertySymbols,y9=Object.prototype.hasOwnProperty,v9=Object.prototype.propertyIsEnumerable,b9=(t,e,r)=>e in t?ybe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vbe=(t,e)=>{for(var r in e||(e={}))y9.call(e,r)&&b9(t,r,e[r]);if(UI)for(var r of UI(e))v9.call(e,r)&&b9(t,r,e[r]);return t},Ibe=(t,e)=>{var r={};for(var o in t)y9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&UI)for(var o of UI(t))e.indexOf(o)<0&&v9.call(t,o)&&(r[o]=t[o]);return r};function F_(t){var e=t,{opened:r,onToggle:o,label:n,children:i,className:a,classNames:s,styles:l,transitionDuration:c,icon:u=D.createElement(GV,null),disableIconRotation:d=!1,offsetIcon:f=!0,iconSize:m=24,iconPosition:h="left",order:g=3,id:_,controlRef:b,onControlKeyDown:y}=e,v=Ibe(e,["opened","onToggle","label","children","className","classNames","styles","transitionDuration","icon","disableIconRotation","offsetIcon","iconSize","iconPosition","order","id","controlRef","onControlKeyDown"]);let N=ts()?0:c,{classes:I,cx:E}=YV({transitionDuration:N,disableIconRotation:d,iconPosition:h,offsetIcon:f,iconSize:m},{classNames:s,styles:l,name:"Accordion"}),S=`h${Math.min(6,Math.max(2,g))}`;return D.createElement(_e,vbe({className:E(I.item,{[I.itemOpened]:r},a)},v),D.createElement(S,{className:I.itemTitle},D.createElement(GN,{className:I.control,onClick:o,type:"button","aria-expanded":r,"aria-controls":`${_}-body`,id:_,ref:b,onKeyDown:y},D.createElement(L_,{className:I.icon},u),D.createElement("div",{className:I.label},n))),D.createElement(KN,{in:r,transitionDuration:N},D.createElement("div",{className:I.content,role:"region",id:`${_}-body`,"aria-labelledby":_},D.createElement("div",{className:I.contentInner},i))))}F_.displayName="@mantine/core/AccordionItem";X();function I9(t){let e=W([]),r=n=>i=>{var a,s;if(i.code==="ArrowDown"){i.preventDefault();let l=e.current[n+1];l?l.focus():(a=e.current[0])==null||a.focus()}if(i.code==="ArrowUp"){i.preventDefault();let l=e.current[n-1];l?l.focus():(s=e.current[e.current.length-1])==null||s.focus()}},o=n=>i=>{e.current[n]=i};return mr(()=>{e.current=e.current.slice(0,t)},[t]),{handleItemKeydown:r,assignControlRef:o}}var wbe=Object.defineProperty,Ebe=Object.defineProperties,Sbe=Object.getOwnPropertyDescriptors,VI=Object.getOwnPropertySymbols,S9=Object.prototype.hasOwnProperty,C9=Object.prototype.propertyIsEnumerable,w9=(t,e,r)=>e in t?wbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E9=(t,e)=>{for(var r in e||(e={}))S9.call(e,r)&&w9(t,r,e[r]);if(VI)for(var r of VI(e))C9.call(e,r)&&w9(t,r,e[r]);return t},Cbe=(t,e)=>Ebe(t,Sbe(e)),Tbe=(t,e)=>{var r={};for(var o in t)S9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&VI)for(var o of VI(t))e.indexOf(o)<0&&C9.call(t,o)&&(r[o]=t[o]);return r},kbe={initialItem:-1,multiple:!1,disableIconRotation:!1,transitionDuration:200,iconPosition:"left",offsetIcon:!0,iconSize:24,order:3},Hc=ee((t,e)=>{let r=Ie("Accordion",kbe,t),{children:o,initialItem:n,initialState:i,state:a,onChange:s,multiple:l,disableIconRotation:c,transitionDuration:u,iconPosition:d,offsetIcon:f,iconSize:m,order:h,icon:g,classNames:_,styles:b,id:y}=r,v=Tbe(r,["children","initialItem","initialState","state","onChange","multiple","disableIconRotation","transitionDuration","iconPosition","offsetIcon","iconSize","order","icon","classNames","styles","id"]),C=lo(y),N=PI(o,F_),{handleItemKeydown:I,assignControlRef:E}=I9(N.length),[w,S]=VV({multiple:l,total:N.length,initialItem:n,state:a,initialState:i,onChange:s}),T=N.map((A,R)=>{var P,B,$;return D.createElement(F_,Cbe(E9({},A.props),{icon:A.props.icon||g,iconPosition:A.props.iconPosition||d,disableIconRotation:c,key:R,transitionDuration:u,opened:w[R],onToggle:()=>S.toggle(R),classNames:((P=A.props)==null?void 0:P.classNames)||_,styles:((B=A.props)==null?void 0:B.styles)||b,id:`${C}-${R}`,onControlKeyDown:I(R),controlRef:kd(E(R),($=A.props)==null?void 0:$.controlRef),offsetIcon:f,iconSize:m,order:h}))});return D.createElement(_e,E9({ref:e},v),T)});Hc.Item=F_;Hc.displayName="@mantine/core/Accordion";X();var Nbe=Object.defineProperty,Pbe=Object.defineProperties,Obe=Object.getOwnPropertyDescriptors,T9=Object.getOwnPropertySymbols,Abe=Object.prototype.hasOwnProperty,Dbe=Object.prototype.propertyIsEnumerable,k9=(t,e,r)=>e in t?Nbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HI=(t,e)=>{for(var r in e||(e={}))Abe.call(e,r)&&k9(t,r,e[r]);if(T9)for(var r of T9(e))Dbe.call(e,r)&&k9(t,r,e[r]);return t},Rbe=(t,e)=>Pbe(t,Obe(e)),mm={xs:18,sm:22,md:28,lg:34,xl:44};function pm({variant:t,theme:e,color:r}){if(t==="hover"||t==="transparent")return HI({border:"1px solid transparent",color:e.fn.themeColor(r,e.colorScheme==="dark"?4:7),backgroundColor:"transparent"},e.fn.hover(t==="transparent"?{}:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.fn.themeColor(r,0)}));let o=e.fn.variant({color:r,variant:t});return HI({backgroundColor:o.background,color:o.color,border:`1px solid ${o.border}`},e.fn.hover({backgroundColor:o.hover}))}var Mbe=me((t,{color:e,size:r,radius:o})=>({root:Rbe(HI(HI({},t.fn.focusStyles()),t.fn.fontStyles()),{position:"relative",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent",boxSizing:"border-box",height:t.fn.size({size:r,sizes:mm}),minHeight:t.fn.size({size:r,sizes:mm}),width:t.fn.size({size:r,sizes:mm}),minWidth:t.fn.size({size:r,sizes:mm}),borderRadius:t.fn.radius(o),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer","&:disabled":{color:t.colors.gray[t.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:t.fn.themeColor("gray",t.colorScheme==="dark"?8:1),borderColor:t.fn.themeColor("gray",t.colorScheme==="dark"?8:1)},"&:not(:disabled):active":{transform:"translateY(1px)"}}),outline:pm({theme:t,color:e,variant:"outline"}),filled:pm({theme:t,color:e,variant:"filled"}),default:pm({theme:t,color:e,variant:"default"}),light:pm({theme:t,color:e,variant:"light"}),hover:pm({theme:t,color:e,variant:"hover"}),transparent:pm({theme:t,color:e,variant:"transparent"}),loading:{"&::before":{content:'""',position:"absolute",top:-1,left:-1,right:-1,bottom:-1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:t.fn.radius(o),cursor:"not-allowed"}}})),N9=Mbe;X();X();var Lbe=Object.defineProperty,jI=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,A9=Object.prototype.propertyIsEnumerable,P9=(t,e,r)=>e in t?Lbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fbe=(t,e)=>{for(var r in e||(e={}))O9.call(e,r)&&P9(t,r,e[r]);if(jI)for(var r of jI(e))A9.call(e,r)&&P9(t,r,e[r]);return t},Bbe=(t,e)=>{var r={};for(var o in t)O9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&jI)for(var o of jI(t))e.indexOf(o)<0&&A9.call(t,o)&&(r[o]=t[o]);return r};function D9(t){var e=t,{size:r,color:o}=e,n=Bbe(e,["size","color"]);return D.createElement("svg",Fbe({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:o,width:`${r}px`},n),D.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}X();var $be=Object.defineProperty,GI=Object.getOwnPropertySymbols,M9=Object.prototype.hasOwnProperty,L9=Object.prototype.propertyIsEnumerable,R9=(t,e,r)=>e in t?$be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zbe=(t,e)=>{for(var r in e||(e={}))M9.call(e,r)&&R9(t,r,e[r]);if(GI)for(var r of GI(e))L9.call(e,r)&&R9(t,r,e[r]);return t},Ube=(t,e)=>{var r={};for(var o in t)M9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&GI)for(var o of GI(t))e.indexOf(o)<0&&L9.call(t,o)&&(r[o]=t[o]);return r};function F9(t){var e=t,{size:r,color:o}=e,n=Ube(e,["size","color"]);return D.createElement("svg",zbe({width:`${r}px`,height:`${r}px`,viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:o},n),D.createElement("g",{fill:"none",fillRule:"evenodd"},D.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},D.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),D.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},D.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}X();var Vbe=Object.defineProperty,WI=Object.getOwnPropertySymbols,$9=Object.prototype.hasOwnProperty,z9=Object.prototype.propertyIsEnumerable,B9=(t,e,r)=>e in t?Vbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hbe=(t,e)=>{for(var r in e||(e={}))$9.call(e,r)&&B9(t,r,e[r]);if(WI)for(var r of WI(e))z9.call(e,r)&&B9(t,r,e[r]);return t},jbe=(t,e)=>{var r={};for(var o in t)$9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&WI)for(var o of WI(t))e.indexOf(o)<0&&z9.call(t,o)&&(r[o]=t[o]);return r};function U9(t){var e=t,{size:r,color:o}=e,n=jbe(e,["size","color"]);return D.createElement("svg",Hbe({width:`${r}px`,height:`${r/4}px`,viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:o},n),D.createElement("circle",{cx:"15",cy:"15",r:"15"},D.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},D.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("circle",{cx:"105",cy:"15",r:"15"},D.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var Gbe=Object.defineProperty,qI=Object.getOwnPropertySymbols,H9=Object.prototype.hasOwnProperty,j9=Object.prototype.propertyIsEnumerable,V9=(t,e,r)=>e in t?Gbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wbe=(t,e)=>{for(var r in e||(e={}))H9.call(e,r)&&V9(t,r,e[r]);if(qI)for(var r of qI(e))j9.call(e,r)&&V9(t,r,e[r]);return t},qbe=(t,e)=>{var r={};for(var o in t)H9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&qI)for(var o of qI(t))e.indexOf(o)<0&&j9.call(t,o)&&(r[o]=t[o]);return r},YN={bars:D9,oval:F9,dots:U9},G9={xs:18,sm:22,md:36,lg:44,xl:58},Kbe={size:"md"};function Ze(t){let e=Ie("Loader",Kbe,t),{size:r="md",color:o,variant:n}=e,i=qbe(e,["size","color","variant"]),a=dr(),s=n in YN?n:a.loader,l=o||a.primaryColor;return D.createElement(_e,Wbe({role:"presentation",component:YN[s]||YN.bars,size:a.fn.size({size:r,sizes:G9}),color:l in a.colors?a.fn.themeColor(l,a.colorScheme==="dark"?4:a.fn.primaryShade("light")):o},i))}Ze.displayName="@mantine/core/Loader";var Ybe=Object.defineProperty,KI=Object.getOwnPropertySymbols,K9=Object.prototype.hasOwnProperty,Y9=Object.prototype.propertyIsEnumerable,W9=(t,e,r)=>e in t?Ybe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q9=(t,e)=>{for(var r in e||(e={}))K9.call(e,r)&&W9(t,r,e[r]);if(KI)for(var r of KI(e))Y9.call(e,r)&&W9(t,r,e[r]);return t},Xbe=(t,e)=>{var r={};for(var o in t)K9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&KI)for(var o of KI(t))e.indexOf(o)<0&&Y9.call(t,o)&&(r[o]=t[o]);return r},Jbe={color:"gray",size:"md",variant:"hover",disabled:!1,loading:!1},Je=ee((t,e)=>{let r=Ie("ActionIcon",Jbe,t),{className:o,color:n,children:i,radius:a,size:s,variant:l,disabled:c,loaderProps:u,loading:d,component:f,styles:m,classNames:h}=r,g=Xbe(r,["className","color","children","radius","size","variant","disabled","loaderProps","loading","component","styles","classNames"]),{classes:_,cx:b,theme:y}=N9({size:s,radius:a,color:n},{name:"ActionIcon",classNames:h,styles:m}),v=y.fn.variant({color:n,variant:"light"}),C=D.createElement(Ze,q9({color:v.color,size:y.fn.size({size:s,sizes:mm})-12},u));return D.createElement(_e,q9({component:f||"button",className:b(_[l],_.root,{[_.loading]:d},o),type:"button",ref:e,disabled:c||d},g),d?C:i)});Je.displayName="@mantine/core/ActionIcon";X();X();var Qbe=Object.defineProperty,X9=Object.getOwnPropertySymbols,Zbe=Object.prototype.hasOwnProperty,eye=Object.prototype.propertyIsEnumerable,J9=(t,e,r)=>e in t?Qbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tye=(t,e)=>{for(var r in e||(e={}))Zbe.call(e,r)&&J9(t,r,e[r]);if(X9)for(var r of X9(e))eye.call(e,r)&&J9(t,r,e[r]);return t};function XN(t){return D.createElement("svg",tye({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}XN.displayName="@mantine/core/CloseIcon";var rye=Object.defineProperty,YI=Object.getOwnPropertySymbols,Z9=Object.prototype.hasOwnProperty,eH=Object.prototype.propertyIsEnumerable,Q9=(t,e,r)=>e in t?rye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oye=(t,e)=>{for(var r in e||(e={}))Z9.call(e,r)&&Q9(t,r,e[r]);if(YI)for(var r of YI(e))eH.call(e,r)&&Q9(t,r,e[r]);return t},nye=(t,e)=>{var r={};for(var o in t)Z9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&YI)for(var o of YI(t))e.indexOf(o)<0&&eH.call(t,o)&&(r[o]=t[o]);return r},iye={xs:12,sm:14,md:16,lg:20,xl:24},Fl=ee((t,e)=>{var r=t,{iconSize:o,size:n="md"}=r,i=nye(r,["iconSize","size"]);let a=dr(),s=o||a.fn.size({size:n,sizes:iye});return D.createElement(Je,oye({size:n,ref:e},i),D.createElement(XN,{width:s,height:s}))});Fl.displayName="@mantine/core/CloseButton";X();X();var aye={zIndex:1,position:"relative"};function jc(t){let{children:e,zIndex:r,target:o,className:n,position:i}=Ie("Portal",aye,t),a=dr(),[s,l]=M(!1),c=W();return A_(()=>(l(!0),c.current=o?typeof o=="string"?document.querySelector(o):o:document.createElement("div"),o||document.body.appendChild(c.current),()=>{!o&&document.body.removeChild(c.current)}),[o]),s?Us(D.createElement("div",{className:n,dir:a.dir,style:{position:i,zIndex:r}},e),c.current):null}jc.displayName="@mantine/core/Portal";X();var sye=Object.defineProperty,lye=Object.defineProperties,cye=Object.getOwnPropertyDescriptors,tH=Object.getOwnPropertySymbols,uye=Object.prototype.hasOwnProperty,dye=Object.prototype.propertyIsEnumerable,rH=(t,e,r)=>e in t?sye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,XI=(t,e)=>{for(var r in e||(e={}))uye.call(e,r)&&rH(t,r,e[r]);if(tH)for(var r of tH(e))dye.call(e,r)&&rH(t,r,e[r]);return t},fye=(t,e)=>lye(t,cye(e));function pye({theme:t,color:e,variant:r}){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:e in t.colors?t.colors[e][t.colorScheme==="dark"?5:7]:r==="link"?t.colors[t.primaryColor][t.colorScheme==="dark"?4:7]:e||"inherit"}function mye(t){return typeof t=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical"}:null}var hye=me((t,{color:e,variant:r,size:o,lineClamp:n,inline:i,inherit:a,underline:s,gradientDeg:l,gradientTo:c,gradientFrom:u,weight:d,transform:f,align:m})=>{let h=t.fn.variant({variant:"gradient",gradient:{from:u,to:c,deg:l}});return{root:XI(fye(XI(XI(XI({},t.fn.fontStyles()),t.fn.focusStyles()),mye(n)),{color:pye({color:e,theme:t,variant:r}),fontFamily:a?"inherit":t.fontFamily,fontSize:a?"inherit":t.fontSizes[o],lineHeight:a?"inherit":i?1:t.lineHeight,textDecoration:s?"underline":"none",WebkitTapHighlightColor:"transparent",fontWeight:a?"inherit":d,textTransform:f,textAlign:m}),t.fn.hover(r==="link"&&s===void 0?{textDecoration:"underline"}:void 0)),gradient:{backgroundImage:h.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}}),oH=hye;var gye=Object.defineProperty,JI=Object.getOwnPropertySymbols,iH=Object.prototype.hasOwnProperty,aH=Object.prototype.propertyIsEnumerable,nH=(t,e,r)=>e in t?gye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_ye=(t,e)=>{for(var r in e||(e={}))iH.call(e,r)&&nH(t,r,e[r]);if(JI)for(var r of JI(e))aH.call(e,r)&&nH(t,r,e[r]);return t},xye=(t,e)=>{var r={};for(var o in t)iH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&JI)for(var o of JI(t))e.indexOf(o)<0&&aH.call(t,o)&&(r[o]=t[o]);return r},bye={size:"md",variant:"text",gradient:{from:"blue",to:"cyan",deg:45},inline:!1,inherit:!1},Gr=ee((t,e)=>{let r=Ie("Text",bye,t),{className:o,component:n,size:i="md",weight:a,transform:s,color:l,align:c,variant:u="text",lineClamp:d,gradient:f={from:"blue",to:"cyan",deg:45},inline:m=!1,inherit:h=!1,underline:g,classNames:_,styles:b}=r,y=xye(r,["className","component","size","weight","transform","color","align","variant","lineClamp","gradient","inline","inherit","underline","classNames","styles"]),{classes:v,cx:C}=oH({variant:u,color:l,size:i,lineClamp:d,inline:m,inherit:h,underline:g,weight:a,transform:s,align:c,gradientFrom:f.from,gradientTo:f.to,gradientDeg:f.deg},{classNames:_,styles:b,name:"Text"});return D.createElement(_e,_ye({ref:e,component:n||"div",className:C(v.root,{[v.gradient]:u==="gradient"},o)},y))});Gr.displayName="@mantine/core/Text";X();X();X();function Gc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}function sH(t,[e,r]){return Math.min(r,Math.max(e,t))}X();var B_=globalThis?.document?Ft:()=>{};X();function lH(t,e){let[r,o]=M("ltr"),[n,i]=M(),a=W(0);return V((()=>{if(e===void 0&&t!=null&&t.parentElement){let s=getComputedStyle(t.parentElement);i(s)}}),[t,e]),V((()=>(e===void 0&&(function s(){a.current=requestAnimationFrame((()=>{let l=n?.direction;l&&o(l),s()}))})(),()=>cancelAnimationFrame(a.current))),[n,e,o]),e||r}X();function Wc(t){let e=W(t);return V((()=>{e.current=t})),ve((()=>(...r)=>{var o;return(o=e.current)===null||o===void 0?void 0:o.call(e,...r)}),[])}X();function JN(...t){return e=>t.forEach((r=>(function(o,n){typeof o=="function"?o(n):o!=null&&(o.current=n)})(r,e)))}function Bl(...t){return qe(JN(...t),t)}X();function cH(t,e=[]){let r=[],o=()=>{let n=r.map((i=>ft(i)));return function(i){let a=i?.[t]||n;return ve((()=>({[`__scope${t}`]:{...i,[t]:a}})),[i,a])}};return o.scopeName=t,[function(n,i){let a=ft(i),s=r.length;function l(c){let{scope:u,children:d,...f}=c,m=u?.[t][s]||a,h=ve((()=>f),Object.values(f));return ce(m.Provider,{value:h},d)}return r=[...r,i],l.displayName=n+"Provider",[l,function(c,u){let d=u?.[t][s]||a,f=lt(d);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${c}\` must be used within \`${n}\``)}]},yye(o,...e)]}function yye(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let o=t.map((n=>({useScope:n(),scopeName:n.scopeName})));return function(n){let i=o.reduce(((a,{useScope:s,scopeName:l})=>({...a,...s(n)[`__scope${l}`]})),{});return ve((()=>({[`__scope${e.scopeName}`]:i})),[i])}};return r.scopeName=e.scopeName,r}X();var $_=t=>{let{present:e,children:r}=t,o=(function(a){let[s,l]=M(),c=W({}),u=W(a),d=W("none"),f=a?"mounted":"unmounted",[m,h]=(function(g,_){return Qn(((b,y)=>{let v=_[b][y];return v??b}),g)})(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V((()=>{let g=QI(c.current);d.current=m==="mounted"?g:"none"}),[m]),B_((()=>{let g=c.current,_=u.current;if(_!==a){let b=d.current,y=QI(g);a?h("MOUNT"):y==="none"||g?.display==="none"?h("UNMOUNT"):h(_&&b!==y?"ANIMATION_OUT":"UNMOUNT"),u.current=a}}),[a,h]),B_((()=>{if(s){let g=b=>{let y=QI(c.current).includes(b.animationName);b.target===s&&y&&h("ANIMATION_END")},_=b=>{b.target===s&&(d.current=QI(c.current))};return s.addEventListener("animationstart",_),s.addEventListener("animationcancel",g),s.addEventListener("animationend",g),()=>{s.removeEventListener("animationstart",_),s.removeEventListener("animationcancel",g),s.removeEventListener("animationend",g)}}h("ANIMATION_END")}),[s,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:qe((g=>{g&&(c.current=getComputedStyle(g)),l(g)}),[])}})(e),n=typeof r=="function"?r({present:o.isPresent}):vn.only(r),i=Bl(o.ref,n.ref);return typeof r=="function"||o.isPresent?Gi(n,{ref:i}):null};function QI(t){return t?.animationName||"none"}$_.displayName="Presence";X();function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)({}).hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},qc.apply(null,arguments)}var ZN=ee(((t,e)=>{let{children:r,...o}=t;return vn.toArray(r).some(uH)?ce(Te,null,vn.map(r,(n=>uH(n)?ce(QN,qc({},o,{ref:e}),n.props.children):n))):ce(QN,qc({},o,{ref:e}),r)}));ZN.displayName="Slot";var QN=ee(((t,e)=>{let{children:r,...o}=t;return Zn(r)?Gi(r,{...Iye(o,r.props),ref:JN(e,r.ref)}):vn.count(r)>1?vn.only(null):null}));QN.displayName="SlotClone";var vye=({children:t})=>ce(Te,null,t);function uH(t){return Zn(t)&&t.type===vye}function Iye(t,e){let r={...e};for(let o in e){let n=t[o],i=e[o];/^on[A-Z]/.test(o)?r[o]=(...a)=>{i?.(...a),n?.(...a)}:o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...t,...r}}X();var hm=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((t,e)=>({...t,[e]:ee(((r,o)=>{let{asChild:n,...i}=r,a=n?ZN:e;return V((()=>{window[Symbol.for("radix-ui")]=!0}),[]),ce(a,pr({},i,{ref:o}))}))})),{});X();var[fH,Mlt]=cH("ScrollArea");var[wye,va]=fH("ScrollArea"),Eye=ee(((t,e)=>{let{__scopeScrollArea:r,type:o="hover",scrollHideDelay:n=600,...i}=t,[a,s]=M(null),[l,c]=M(null),[u,d]=M(null),[f,m]=M(null),[h,g]=M(null),[_,b]=M(0),[y,v]=M(0),[C,N]=M(!1),[I,E]=M(!1),w=Bl(e,(T=>s(T))),S=lH(a,i.dir);return ce(wye,{scope:r,type:o,dir:S,scrollHideDelay:n,scrollArea:a,viewport:l,onViewportChange:c,content:u,onContentChange:d,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:N,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:I,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:v},ce(hm.div,pr({},i,{ref:w,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})))})),Sye=ee(((t,e)=>{let{__scopeScrollArea:r,children:o,...n}=t,i=va("ScrollAreaViewport",r),a=W(null),s=Bl(e,a,i.onViewportChange);return ce(Te,null,ce("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),ce(hm.div,pr({"data-radix-scroll-area-viewport":""},n,{ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style}}),ce("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},o)))})),Cye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=n,s=t.orientation==="horizontal";return V((()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)})),[s,i,a]),n.type==="hover"?ce(Tye,pr({},o,{ref:e,forceMount:r})):n.type==="scroll"?ce(kye,pr({},o,{ref:e,forceMount:r})):n.type==="auto"?ce(pH,pr({},o,{ref:e,forceMount:r})):n.type==="always"?ce(eP,pr({},o,{ref:e})):null})),Tye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),[i,a]=M(!1);return V((()=>{let s=n.scrollArea,l=0;if(s){let c=()=>{window.clearTimeout(l),a(!0)},u=()=>{l=window.setTimeout((()=>a(!1)),n.scrollHideDelay)};return s.addEventListener("pointerenter",c),s.addEventListener("pointerleave",u),()=>{s.removeEventListener("pointerenter",c),s.removeEventListener("pointerleave",u)}}}),[n.scrollArea,n.scrollHideDelay]),ce($_,{present:r||i},ce(pH,pr({"data-state":i?"visible":"hidden"},o,{ref:e})))})),kye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),i=t.orientation==="horizontal",a=tw((()=>l("SCROLL_END")),100),[s,l]=(c="hidden",u={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},Qn(((d,f)=>{let m=u[d][f];return m??d}),c));var c,u;return V((()=>{if(s==="idle"){let d=window.setTimeout((()=>l("HIDE")),n.scrollHideDelay);return()=>window.clearTimeout(d)}}),[s,n.scrollHideDelay,l]),V((()=>{let d=n.viewport,f=i?"scrollLeft":"scrollTop";if(d){let m=d[f],h=()=>{let g=d[f];m!==g&&(l("SCROLL"),a()),m=g};return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}}),[n.viewport,i,l,a]),ce($_,{present:r||s!=="hidden"},ce(eP,pr({"data-state":s==="hidden"?"hidden":"visible"},o,{ref:e,onPointerEnter:Gc(t.onPointerEnter,(()=>l("POINTER_ENTER"))),onPointerLeave:Gc(t.onPointerLeave,(()=>l("POINTER_LEAVE")))})))})),pH=ee(((t,e)=>{let r=va("ScrollAreaScrollbar",t.__scopeScrollArea),{forceMount:o,...n}=t,[i,a]=M(!1),s=t.orientation==="horizontal",l=tw((()=>{if(r.viewport){let c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?c:u)}}),10);return gm(r.viewport,l),gm(r.content,l),ce($_,{present:o||i},ce(eP,pr({"data-state":i?"visible":"hidden"},n,{ref:e})))})),eP=ee(((t,e)=>{let{orientation:r="vertical",...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),i=W(null),a=W(0),[s,l]=M({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=hH(s.viewport,s.content),u={...o,sizes:s,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function d(f,m){return(function(h,g,_,b="ltr"){let y=ew(_),v=y/2,C=g||v,N=y-C,I=_.scrollbar.paddingStart+C,E=_.scrollbar.size-_.scrollbar.paddingEnd-N,w=_.content-_.viewport;return gH([I,E],b==="ltr"?[0,w]:[-1*w,0])(h)})(f,a.current,s,m)}return r==="horizontal"?ce(Nye,pr({},u,{ref:e,onThumbPositionChange:()=>{if(n.viewport&&i.current){let f=dH(n.viewport.scrollLeft,s,n.dir);i.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{n.viewport&&(n.viewport.scrollLeft=f)},onDragScroll:f=>{n.viewport&&(n.viewport.scrollLeft=d(f,n.dir))}})):r==="vertical"?ce(Pye,pr({},u,{ref:e,onThumbPositionChange:()=>{if(n.viewport&&i.current){let f=dH(n.viewport.scrollTop,s);i.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{n.viewport&&(n.viewport.scrollTop=f)},onDragScroll:f=>{n.viewport&&(n.viewport.scrollTop=d(f))}})):null})),Nye=ee(((t,e)=>{let{sizes:r,onSizesChange:o,...n}=t,i=va("ScrollAreaScrollbar",t.__scopeScrollArea),[a,s]=M(),l=W(null),c=Bl(e,l,i.onScrollbarXChange);return V((()=>{l.current&&s(getComputedStyle(l.current))}),[l]),ce(mH,pr({"data-orientation":"horizontal"},n,{ref:c,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ew(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(i.viewport){let f=i.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),_H(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ZI(a.paddingLeft),paddingEnd:ZI(a.paddingRight)}})}}))})),Pye=ee(((t,e)=>{let{sizes:r,onSizesChange:o,...n}=t,i=va("ScrollAreaScrollbar",t.__scopeScrollArea),[a,s]=M(),l=W(null),c=Bl(e,l,i.onScrollbarYChange);return V((()=>{l.current&&s(getComputedStyle(l.current))}),[l]),ce(mH,pr({"data-orientation":"vertical"},n,{ref:c,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ew(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(i.viewport){let f=i.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),_H(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ZI(a.paddingTop),paddingEnd:ZI(a.paddingBottom)}})}}))})),[Oye,Aye]=fH("ScrollAreaScrollbar"),mH=ee(((t,e)=>{let{__scopeScrollArea:r,sizes:o,hasThumb:n,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=t,m=va("ScrollAreaScrollbar",r),[h,g]=M(null),_=Bl(e,(S=>g(S))),b=W(null),y=W(""),v=m.viewport,C=o.content-o.viewport,N=Wc(u),I=Wc(l),E=tw(d,10);function w(S){if(b.current){let T=S.clientX-b.current.left,A=S.clientY-b.current.top;c({x:T,y:A})}}return V((()=>{let S=T=>{let A=T.target;h?.contains(A)&&N(T,C)};return document.addEventListener("wheel",S,{passive:!1}),()=>document.removeEventListener("wheel",S,{passive:!1})}),[v,h,C,N]),V(I,[o,I]),gm(h,E),gm(m.content,E),ce(Oye,{scope:r,scrollbar:h,hasThumb:n,onThumbChange:Wc(i),onThumbPointerUp:Wc(a),onThumbPositionChange:I,onThumbPointerDown:Wc(s)},ce(hm.div,pr({},f,{ref:_,style:{position:"absolute",...f.style},onPointerDown:Gc(t.onPointerDown,(S=>{S.button===0&&(S.target.setPointerCapture(S.pointerId),b.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w(S))})),onPointerMove:Gc(t.onPointerMove,w),onPointerUp:Gc(t.onPointerUp,(S=>{S.target.releasePointerCapture(S.pointerId),document.body.style.webkitUserSelect=y.current,b.current=null}))})))})),Dye=ee(((t,e)=>{let{__scopeScrollArea:r,style:o,...n}=t,i=va("ScrollbarThumb",r),a=Aye("ScrollbarThumb",r),{onThumbPositionChange:s}=a,l=Bl(e,(d=>a.onThumbChange(d))),c=W(),u=tw((()=>{c.current&&(c.current(),c.current=void 0)}),100);return V((()=>{let d=i.viewport;if(d){let f=()=>{if(u(),!c.current){let m=Lye(d,s);c.current=m,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}}),[i.viewport,u,s]),a.hasThumb?ce(hm.div,pr({},n,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Gc(t.onPointerDownCapture,(d=>{let f=d.target.getBoundingClientRect(),m=d.clientX-f.left,h=d.clientY-f.top;a.onThumbPointerDown({x:m,y:h})})),onPointerUp:Gc(t.onPointerUp,a.onThumbPointerUp)})):null})),Rye=ee(((t,e)=>{let r=va("ScrollAreaCorner",t.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?ce(Mye,pr({},t,{ref:e})):null})),Mye=ee(((t,e)=>{let{__scopeScrollArea:r,...o}=t,n=va("ScrollAreaCorner",r),[i,a]=M(0),[s,l]=M(0),c=!!(i&&s);return gm(n.scrollbarX,(()=>{var u;let d=((u=n.scrollbarX)===null||u===void 0?void 0:u.offsetHeight)||0;n.onCornerHeightChange(d),l(d)})),gm(n.scrollbarY,(()=>{var u;let d=((u=n.scrollbarY)===null||u===void 0?void 0:u.offsetWidth)||0;n.onCornerWidthChange(d),a(d)})),c?ce(hm.div,pr({},o,{ref:e,style:{width:i,height:s,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...t.style}})):null}));function ZI(t){return t?parseInt(t,10):0}function hH(t,e){let r=t/e;return isNaN(r)?0:r}function ew(t){let e=hH(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-r)*e;return Math.max(o,18)}function dH(t,e,r="ltr"){let o=ew(e),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-n,a=e.content-e.viewport,s=i-o,l=sH(t,r==="ltr"?[0,a]:[-1*a,0]);return gH([0,a],[0,s])(l)}function gH(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(r-t[0])}}function _H(t,e){return t>0&&t<e}var Lye=(t,e=(()=>{}))=>{let r={left:t.scrollLeft,top:t.scrollTop},o=0;return(function n(){let i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,s=r.top!==i.top;(a||s)&&e(),r=i,o=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(o)};function tw(t,e){let r=Wc(t),o=W(0);return V((()=>()=>window.clearTimeout(o.current)),[]),qe((()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,e)}),[r,e])}function gm(t,e){let r=Wc(e);B_((()=>{let o=0;if(t){let n=new ResizeObserver((()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)}));return n.observe(t),()=>{window.cancelAnimationFrame(o),n.unobserve(t)}}}),[t,r])}var xH=Eye,bH=Sye,tP=Cye,rP=Dye,yH=Rye;var Bye=me((t,{scrollbarSize:e,offsetScrollbars:r,scrollbarHovered:o},n)=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:r?e:void 0},scrollbar:{display:"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:e/5,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.colors.gray[0],[`& .${n("thumb")}`]:{backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.white,.5):t.fn.rgba(t.black,.5)}},'&[data-orientation="vertical"]':{width:e},'&[data-orientation="horizontal"]':{flexDirection:"column",height:e},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:n("thumb"),flex:1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.white,.4):t.fn.rgba(t.black,.4),borderRadius:e,position:"relative",transition:"background-color 150ms ease","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:44,minHeight:44}},corner:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0],transition:"opacity 150ms ease",opacity:o?1:0}})),vH=Bye;var $ye=Object.defineProperty,rw=Object.getOwnPropertySymbols,wH=Object.prototype.hasOwnProperty,EH=Object.prototype.propertyIsEnumerable,IH=(t,e,r)=>e in t?$ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zye=(t,e)=>{for(var r in e||(e={}))wH.call(e,r)&&IH(t,r,e[r]);if(rw)for(var r of rw(e))EH.call(e,r)&&IH(t,r,e[r]);return t},Uye=(t,e)=>{var r={};for(var o in t)wH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&rw)for(var o of rw(t))e.indexOf(o)<0&&EH.call(t,o)&&(r[o]=t[o]);return r},Vye={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},oP=ee((t,e)=>{let r=Ie("ScrollArea",Vye,t),{children:o,className:n,classNames:i,styles:a,scrollbarSize:s,scrollHideDelay:l,type:c,dir:u,offsetScrollbars:d,viewportRef:f,onScrollPositionChange:m}=r,h=Uye(r,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange"]),[g,_]=M(!1),b=dr(),{classes:y,cx:v}=vH({scrollbarSize:s,offsetScrollbars:d,scrollbarHovered:g},{name:"ScrollArea",classNames:i,styles:a});return D.createElement(xH,{type:c,scrollHideDelay:l,dir:u||b.dir,ref:e,asChild:!0},D.createElement(_e,zye({className:v(y.root,n)},h),D.createElement(bH,{className:y.viewport,ref:f,onScroll:typeof m=="function"?({currentTarget:C})=>m({x:C.scrollLeft,y:C.scrollTop}):void 0},o),D.createElement(tP,{orientation:"horizontal",className:y.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},D.createElement(rP,{className:y.thumb})),D.createElement(tP,{orientation:"vertical",className:y.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},D.createElement(rP,{className:y.thumb})),D.createElement(yH,{className:y.corner})))});oP.displayName="@mantine/core/ScrollArea";var Hye=Object.defineProperty,jye=Object.defineProperties,Gye=Object.getOwnPropertyDescriptors,ow=Object.getOwnPropertySymbols,TH=Object.prototype.hasOwnProperty,kH=Object.prototype.propertyIsEnumerable,SH=(t,e,r)=>e in t?Hye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CH=(t,e)=>{for(var r in e||(e={}))TH.call(e,r)&&SH(t,r,e[r]);if(ow)for(var r of ow(e))kH.call(e,r)&&SH(t,r,e[r]);return t},Wye=(t,e)=>jye(t,Gye(e)),qye=(t,e)=>{var r={};for(var o in t)TH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&ow)for(var o of ow(t))e.indexOf(o)<0&&kH.call(t,o)&&(r[o]=t[o]);return r},Ad=ee((t,e)=>{var r=t,{style:o}=r,n=qye(r,["style"]);return D.createElement(oP,Wye(CH({},n),{style:CH({width:"100%"},o),viewportRef:e}),n.children)});Ad.displayName="@mantine/core/SelectScrollArea";var Kye=Object.defineProperty,Yye=Object.defineProperties,Xye=Object.getOwnPropertyDescriptors,NH=Object.getOwnPropertySymbols,Jye=Object.prototype.hasOwnProperty,Qye=Object.prototype.propertyIsEnumerable,PH=(t,e,r)=>e in t?Kye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zye=(t,e)=>{for(var r in e||(e={}))Jye.call(e,r)&&PH(t,r,e[r]);if(NH)for(var r of NH(e))Qye.call(e,r)&&PH(t,r,e[r]);return t},eve=(t,e)=>Yye(t,Xye(e)),tve=me((t,{native:e})=>({dropdown:eve(Zye({},t.fn.fontStyles()),{boxSizing:"border-box",pointerEvents:"auto",backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,padding:4,overflowY:e?"auto":"hidden",overscrollBehaviorY:"contain",width:"100%"})})),OH=tve;X();X();var nP=function(e){return e.reduce(function(r,o){var n=o[0],i=o[1];return r[n]=i,r},{})},iP=typeof window<"u"&&window.document&&window.document.createElement?Ft:V;X();var Qr="top",Fo="bottom",vo="right",co="left",nw="auto",Kc=[Qr,Fo,vo,co],$l="start",Dd="end",AH="clippingParents",iw="viewport",_m="popper",DH="reference",aP=Kc.reduce(function(t,e){return t.concat([e+"-"+$l,e+"-"+Dd])},[]),aw=[].concat(Kc,[nw]).reduce(function(t,e){return t.concat([e,e+"-"+$l,e+"-"+Dd])},[]),rve="beforeRead",ove="read",nve="afterRead",ive="beforeMain",ave="main",sve="afterMain",lve="beforeWrite",cve="write",uve="afterWrite",RH=[rve,ove,nve,ive,ave,sve,lve,cve,uve];function qo(t){return t?(t.nodeName||"").toLowerCase():null}function uo(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function js(t){var e=uo(t).Element;return t instanceof e||t instanceof Element}function Bo(t){var e=uo(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function xm(t){if(typeof ShadowRoot>"u")return!1;var e=uo(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function dve(t){var e=t.state;Object.keys(e.elements).forEach(function(r){var o=e.styles[r]||{},n=e.attributes[r]||{},i=e.elements[r];!Bo(i)||!qo(i)||(Object.assign(i.style,o),Object.keys(n).forEach(function(a){var s=n[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s)}))})}function fve(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach(function(o){var n=e.elements[o],i=e.attributes[o]||{},a=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:r[o]),s=a.reduce(function(l,c){return l[c]="",l},{});!Bo(n)||!qo(n)||(Object.assign(n.style,s),Object.keys(i).forEach(function(l){n.removeAttribute(l)}))})}}var MH={name:"applyStyles",enabled:!0,phase:"write",fn:dve,effect:fve,requires:["computeStyles"]};function Ko(t){return t.split("-")[0]}var rs=Math.max,Rd=Math.min,zl=Math.round;function Ia(t,e){e===void 0&&(e=!1);var r=t.getBoundingClientRect(),o=1,n=1;if(Bo(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(o=zl(r.width)/a||1),i>0&&(n=zl(r.height)/i||1)}return{width:r.width/o,height:r.height/n,top:r.top/n,right:r.right/o,bottom:r.bottom/n,left:r.left/o,x:r.left/o,y:r.top/n}}function Md(t){var e=Ia(t),r=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:o}}function z_(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&xm(r)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function ai(t){return uo(t).getComputedStyle(t)}function sP(t){return["table","td","th"].indexOf(qo(t))>=0}function Tn(t){return((js(t)?t.ownerDocument:t.document)||window.document).documentElement}function Ul(t){return qo(t)==="html"?t:t.assignedSlot||t.parentNode||(xm(t)?t.host:null)||Tn(t)}function LH(t){return!Bo(t)||ai(t).position==="fixed"?null:t.offsetParent}function pve(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,r=navigator.userAgent.indexOf("Trident")!==-1;if(r&&Bo(t)){var o=ai(t);if(o.position==="fixed")return null}var n=Ul(t);for(xm(n)&&(n=n.host);Bo(n)&&["html","body"].indexOf(qo(n))<0;){var i=ai(n);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return n;n=n.parentNode}return null}function os(t){for(var e=uo(t),r=LH(t);r&&sP(r)&&ai(r).position==="static";)r=LH(r);return r&&(qo(r)==="html"||qo(r)==="body"&&ai(r).position==="static")?e:r||pve(t)||e}function Ld(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Fd(t,e,r){return rs(t,Rd(e,r))}function FH(t,e,r){var o=Fd(t,e,r);return o>r?r:o}function U_(){return{top:0,right:0,bottom:0,left:0}}function V_(t){return Object.assign({},U_(),t)}function H_(t,e){return e.reduce(function(r,o){return r[o]=t,r},{})}var mve=function(e,r){return e=typeof e=="function"?e(Object.assign({},r.rects,{placement:r.placement})):e,V_(typeof e!="number"?e:H_(e,Kc))};function hve(t){var e,r=t.state,o=t.name,n=t.options,i=r.elements.arrow,a=r.modifiersData.popperOffsets,s=Ko(r.placement),l=Ld(s),c=[co,vo].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var d=mve(n.padding,r),f=Md(i),m=l==="y"?Qr:co,h=l==="y"?Fo:vo,g=r.rects.reference[u]+r.rects.reference[l]-a[l]-r.rects.popper[u],_=a[l]-r.rects.reference[l],b=os(i),y=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,v=g/2-_/2,C=d[m],N=y-f[u]-d[h],I=y/2-f[u]/2+v,E=Fd(C,I,N),w=l;r.modifiersData[o]=(e={},e[w]=E,e.centerOffset=E-I,e)}}function gve(t){var e=t.state,r=t.options,o=r.element,n=o===void 0?"[data-popper-arrow]":o;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||z_(e.elements.popper,n)&&(e.elements.arrow=n))}var BH={name:"arrow",enabled:!0,phase:"main",fn:hve,effect:gve,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wa(t){return t.split("-")[1]}var _ve={top:"auto",right:"auto",bottom:"auto",left:"auto"};function xve(t){var e=t.x,r=t.y,o=window,n=o.devicePixelRatio||1;return{x:zl(e*n)/n||0,y:zl(r*n)/n||0}}function $H(t){var e,r=t.popper,o=t.popperRect,n=t.placement,i=t.variation,a=t.offsets,s=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=a.x,m=f===void 0?0:f,h=a.y,g=h===void 0?0:h,_=typeof u=="function"?u({x:m,y:g}):{x:m,y:g};m=_.x,g=_.y;var b=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),v=co,C=Qr,N=window;if(c){var I=os(r),E="clientHeight",w="clientWidth";if(I===uo(r)&&(I=Tn(r),ai(I).position!=="static"&&s==="absolute"&&(E="scrollHeight",w="scrollWidth")),I=I,n===Qr||(n===co||n===vo)&&i===Dd){C=Fo;var S=d&&I===N&&N.visualViewport?N.visualViewport.height:I[E];g-=S-o.height,g*=l?1:-1}if(n===co||(n===Qr||n===Fo)&&i===Dd){v=vo;var T=d&&I===N&&N.visualViewport?N.visualViewport.width:I[w];m-=T-o.width,m*=l?1:-1}}var A=Object.assign({position:s},c&&_ve),R=u===!0?xve({x:m,y:g}):{x:m,y:g};if(m=R.x,g=R.y,l){var P;return Object.assign({},A,(P={},P[C]=y?"0":"",P[v]=b?"0":"",P.transform=(N.devicePixelRatio||1)<=1?"translate("+m+"px, "+g+"px)":"translate3d("+m+"px, "+g+"px, 0)",P))}return Object.assign({},A,(e={},e[C]=y?g+"px":"",e[v]=b?m+"px":"",e.transform="",e))}function bve(t){var e=t.state,r=t.options,o=r.gpuAcceleration,n=o===void 0?!0:o,i=r.adaptive,a=i===void 0?!0:i,s=r.roundOffsets,l=s===void 0?!0:s;if(0)var c;var u={placement:Ko(e.placement),variation:wa(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,$H(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,$H(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var zH={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:bve,data:{}};var sw={passive:!0};function yve(t){var e=t.state,r=t.instance,o=t.options,n=o.scroll,i=n===void 0?!0:n,a=o.resize,s=a===void 0?!0:a,l=uo(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",r.update,sw)}),s&&l.addEventListener("resize",r.update,sw),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",r.update,sw)}),s&&l.removeEventListener("resize",r.update,sw)}}var UH={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yve,data:{}};var vve={left:"right",right:"left",bottom:"top",top:"bottom"};function bm(t){return t.replace(/left|right|bottom|top/g,function(e){return vve[e]})}var Ive={start:"end",end:"start"};function lw(t){return t.replace(/start|end/g,function(e){return Ive[e]})}function Bd(t){var e=uo(t),r=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:r,scrollTop:o}}function $d(t){return Ia(Tn(t)).left+Bd(t).scrollLeft}function lP(t){var e=uo(t),r=Tn(t),o=e.visualViewport,n=r.clientWidth,i=r.clientHeight,a=0,s=0;return o&&(n=o.width,i=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=o.offsetLeft,s=o.offsetTop)),{width:n,height:i,x:a+$d(t),y:s}}function cP(t){var e,r=Tn(t),o=Bd(t),n=(e=t.ownerDocument)==null?void 0:e.body,i=rs(r.scrollWidth,r.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=rs(r.scrollHeight,r.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),s=-o.scrollLeft+$d(t),l=-o.scrollTop;return ai(n||r).direction==="rtl"&&(s+=rs(r.clientWidth,n?n.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}function zd(t){var e=ai(t),r=e.overflow,o=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(r+n+o)}function cw(t){return["html","body","#document"].indexOf(qo(t))>=0?t.ownerDocument.body:Bo(t)&&zd(t)?t:cw(Ul(t))}function Yc(t,e){var r;e===void 0&&(e=[]);var o=cw(t),n=o===((r=t.ownerDocument)==null?void 0:r.body),i=uo(o),a=n?[i].concat(i.visualViewport||[],zd(o)?o:[]):o,s=e.concat(a);return n?s:s.concat(Yc(Ul(a)))}function ym(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function wve(t){var e=Ia(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function VH(t,e){return e===iw?ym(lP(t)):js(e)?wve(e):ym(cP(Tn(t)))}function Eve(t){var e=Yc(Ul(t)),r=["absolute","fixed"].indexOf(ai(t).position)>=0,o=r&&Bo(t)?os(t):t;return js(o)?e.filter(function(n){return js(n)&&z_(n,o)&&qo(n)!=="body"}):[]}function uP(t,e,r){var o=e==="clippingParents"?Eve(t):[].concat(e),n=[].concat(o,[r]),i=n[0],a=n.reduce(function(s,l){var c=VH(t,l);return s.top=rs(c.top,s.top),s.right=Rd(c.right,s.right),s.bottom=Rd(c.bottom,s.bottom),s.left=rs(c.left,s.left),s},VH(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function j_(t){var e=t.reference,r=t.element,o=t.placement,n=o?Ko(o):null,i=o?wa(o):null,a=e.x+e.width/2-r.width/2,s=e.y+e.height/2-r.height/2,l;switch(n){case Qr:l={x:a,y:e.y-r.height};break;case Fo:l={x:a,y:e.y+e.height};break;case vo:l={x:e.x+e.width,y:s};break;case co:l={x:e.x-r.width,y:s};break;default:l={x:e.x,y:e.y}}var c=n?Ld(n):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case $l:l[c]=l[c]-(e[u]/2-r[u]/2);break;case Dd:l[c]=l[c]+(e[u]/2-r[u]/2);break;default:}}return l}function ns(t,e){e===void 0&&(e={});var r=e,o=r.placement,n=o===void 0?t.placement:o,i=r.boundary,a=i===void 0?AH:i,s=r.rootBoundary,l=s===void 0?iw:s,c=r.elementContext,u=c===void 0?_m:c,d=r.altBoundary,f=d===void 0?!1:d,m=r.padding,h=m===void 0?0:m,g=V_(typeof h!="number"?h:H_(h,Kc)),_=u===_m?DH:_m,b=t.rects.popper,y=t.elements[f?_:u],v=uP(js(y)?y:y.contextElement||Tn(t.elements.popper),a,l),C=Ia(t.elements.reference),N=j_({reference:C,element:b,strategy:"absolute",placement:n}),I=ym(Object.assign({},b,N)),E=u===_m?I:C,w={top:v.top-E.top+g.top,bottom:E.bottom-v.bottom+g.bottom,left:v.left-E.left+g.left,right:E.right-v.right+g.right},S=t.modifiersData.offset;if(u===_m&&S){var T=S[n];Object.keys(w).forEach(function(A){var R=[vo,Fo].indexOf(A)>=0?1:-1,P=[Qr,Fo].indexOf(A)>=0?"y":"x";w[A]+=T[P]*R})}return w}function dP(t,e){e===void 0&&(e={});var r=e,o=r.placement,n=r.boundary,i=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=l===void 0?aw:l,u=wa(o),d=u?s?aP:aP.filter(function(h){return wa(h)===u}):Kc,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var m=f.reduce(function(h,g){return h[g]=ns(t,{placement:g,boundary:n,rootBoundary:i,padding:a})[Ko(g)],h},{});return Object.keys(m).sort(function(h,g){return m[h]-m[g]})}function Sve(t){if(Ko(t)===nw)return[];var e=bm(t);return[lw(t),e,lw(e)]}function Cve(t){var e=t.state,r=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var n=r.mainAxis,i=n===void 0?!0:n,a=r.altAxis,s=a===void 0?!0:a,l=r.fallbackPlacements,c=r.padding,u=r.boundary,d=r.rootBoundary,f=r.altBoundary,m=r.flipVariations,h=m===void 0?!0:m,g=r.allowedAutoPlacements,_=e.options.placement,b=Ko(_),y=b===_,v=l||(y||!h?[bm(_)]:Sve(_)),C=[_].concat(v).reduce(function(ge,Ce){return ge.concat(Ko(Ce)===nw?dP(e,{placement:Ce,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:g}):Ce)},[]),N=e.rects.reference,I=e.rects.popper,E=new Map,w=!0,S=C[0],T=0;T<C.length;T++){var A=C[T],R=Ko(A),P=wa(A)===$l,B=[Qr,Fo].indexOf(R)>=0,$=B?"width":"height",z=ns(e,{placement:A,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),H=B?P?vo:co:P?Fo:Qr;N[$]>I[$]&&(H=bm(H));var G=bm(H),Y=[];if(i&&Y.push(z[R]<=0),s&&Y.push(z[H]<=0,z[G]<=0),Y.every(function(ge){return ge})){S=A,w=!1;break}E.set(A,Y)}if(w)for(var L=h?3:1,ne=function(Ce){var He=C.find(function(Qe){var Me=E.get(Qe);if(Me)return Me.slice(0,Ce).every(function(ke){return ke})});if(He)return S=He,"break"},ae=L;ae>0;ae--){var U=ne(ae);if(U==="break")break}e.placement!==S&&(e.modifiersData[o]._skip=!0,e.placement=S,e.reset=!0)}}var HH={name:"flip",enabled:!0,phase:"main",fn:Cve,requiresIfExists:["offset"],data:{_skip:!1}};function jH(t,e,r){return r===void 0&&(r={x:0,y:0}),{top:t.top-e.height-r.y,right:t.right-e.width+r.x,bottom:t.bottom-e.height+r.y,left:t.left-e.width-r.x}}function GH(t){return[Qr,vo,Fo,co].some(function(e){return t[e]>=0})}function Tve(t){var e=t.state,r=t.name,o=e.rects.reference,n=e.rects.popper,i=e.modifiersData.preventOverflow,a=ns(e,{elementContext:"reference"}),s=ns(e,{altBoundary:!0}),l=jH(a,o),c=jH(s,n,i),u=GH(l),d=GH(c);e.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var WH={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Tve};function kve(t,e,r){var o=Ko(t),n=[co,Qr].indexOf(o)>=0?-1:1,i=typeof r=="function"?r(Object.assign({},e,{placement:t})):r,a=i[0],s=i[1];return a=a||0,s=(s||0)*n,[co,vo].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}function Nve(t){var e=t.state,r=t.options,o=t.name,n=r.offset,i=n===void 0?[0,0]:n,a=aw.reduce(function(u,d){return u[d]=kve(d,e.rects,i),u},{}),s=a[e.placement],l=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[o]=a}var qH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Nve};function Pve(t){var e=t.state,r=t.name;e.modifiersData[r]=j_({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var KH={name:"popperOffsets",enabled:!0,phase:"read",fn:Pve,data:{}};function fP(t){return t==="x"?"y":"x"}function Ove(t){var e=t.state,r=t.options,o=t.name,n=r.mainAxis,i=n===void 0?!0:n,a=r.altAxis,s=a===void 0?!1:a,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,d=r.padding,f=r.tether,m=f===void 0?!0:f,h=r.tetherOffset,g=h===void 0?0:h,_=ns(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=Ko(e.placement),y=wa(e.placement),v=!y,C=Ld(b),N=fP(C),I=e.modifiersData.popperOffsets,E=e.rects.reference,w=e.rects.popper,S=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,T=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),A=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,R={x:0,y:0};if(I){if(i){var P,B=C==="y"?Qr:co,$=C==="y"?Fo:vo,z=C==="y"?"height":"width",H=I[C],G=H+_[B],Y=H-_[$],L=m?-w[z]/2:0,ne=y===$l?E[z]:w[z],ae=y===$l?-w[z]:-E[z],U=e.elements.arrow,ge=m&&U?Md(U):{width:0,height:0},Ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:U_(),He=Ce[B],Qe=Ce[$],Me=Fd(0,E[z],ge[z]),ke=v?E[z]/2-L-Me-He-T.mainAxis:ne-Me-He-T.mainAxis,at=v?-E[z]/2+L+Me+Qe+T.mainAxis:ae+Me+Qe+T.mainAxis,Rt=e.elements.arrow&&os(e.elements.arrow),ut=Rt?C==="y"?Rt.clientTop||0:Rt.clientLeft||0:0,ht=(P=A?.[C])!=null?P:0,bt=H+ke-ht-ut,Xr=H+at-ht,Mt=Fd(m?Rd(G,bt):G,H,m?rs(Y,Xr):Y);I[C]=Mt,R[C]=Mt-H}if(s){var ye,dn=C==="x"?Qr:co,Ut=C==="x"?Fo:vo,pt=I[N],Ur=N==="y"?"height":"width",Vr=pt+_[dn],Do=pt-_[Ut],Be=[Qr,co].indexOf(b)!==-1,ie=(ye=A?.[N])!=null?ye:0,j=Be?Vr:pt-E[Ur]-w[Ur]-ie+T.altAxis,Q=Be?pt+E[Ur]+w[Ur]-ie-T.altAxis:Do,se=m&&Be?FH(j,pt,Q):Fd(m?j:Vr,pt,m?Q:Do);I[N]=se,R[N]=se-pt}e.modifiersData[o]=R}}var YH={name:"preventOverflow",enabled:!0,phase:"main",fn:Ove,requiresIfExists:["offset"]};function pP(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function mP(t){return t===uo(t)||!Bo(t)?Bd(t):pP(t)}function Ave(t){var e=t.getBoundingClientRect(),r=zl(e.width)/t.offsetWidth||1,o=zl(e.height)/t.offsetHeight||1;return r!==1||o!==1}function hP(t,e,r){r===void 0&&(r=!1);var o=Bo(e),n=Bo(e)&&Ave(e),i=Tn(e),a=Ia(t,n),s={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!r)&&((qo(e)!=="body"||zd(i))&&(s=mP(e)),Bo(e)?(l=Ia(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):i&&(l.x=$d(i))),{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Dve(t){var e=new Map,r=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function n(i){r.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!r.has(s)){var l=e.get(s);l&&n(l)}}),o.push(i)}return t.forEach(function(i){r.has(i.name)||n(i)}),o}function gP(t){var e=Dve(t);return RH.reduce(function(r,o){return r.concat(e.filter(function(n){return n.phase===o}))},[])}function _P(t){var e;return function(){return e||(e=new Promise(function(r){Promise.resolve().then(function(){e=void 0,r(t())})})),e}}function xP(t){var e=t.reduce(function(r,o){var n=r[o.name];return r[o.name]=n?Object.assign({},n,o,{options:Object.assign({},n.options,o.options),data:Object.assign({},n.data,o.data)}):o,r},{});return Object.keys(e).map(function(r){return e[r]})}var XH={placement:"bottom",modifiers:[],strategy:"absolute"};function JH(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function QH(t){t===void 0&&(t={});var e=t,r=e.defaultModifiers,o=r===void 0?[]:r,n=e.defaultOptions,i=n===void 0?XH:n;return function(s,l,c){c===void 0&&(c=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},XH,i),modifiersData:{},elements:{reference:s,popper:l},attributes:{},styles:{}},d=[],f=!1,m={state:u,setOptions:function(b){var y=typeof b=="function"?b(u.options):b;g(),u.options=Object.assign({},i,u.options,y),u.scrollParents={reference:js(s)?Yc(s):s.contextElement?Yc(s.contextElement):[],popper:Yc(l)};var v=gP(xP([].concat(o,u.options.modifiers)));if(u.orderedModifiers=v.filter(function(A){return A.enabled}),0){var C;if(getBasePlacement(u.options.placement)===auto)var N;var I,E,w,S,T}return h(),m.update()},forceUpdate:function(){if(!f){var b=u.elements,y=b.reference,v=b.popper;if(JH(y,v)){u.rects={reference:hP(y,os(v),u.options.strategy==="fixed"),popper:Md(v)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(A){return u.modifiersData[A.name]=Object.assign({},A.data)});for(var C=0,N=0;N<u.orderedModifiers.length;N++){if(u.reset===!0){u.reset=!1,N=-1;continue}var I=u.orderedModifiers[N],E=I.fn,w=I.options,S=w===void 0?{}:w,T=I.name;typeof E=="function"&&(u=E({state:u,options:S,name:T,instance:m})||u)}}}},update:_P(function(){return new Promise(function(_){m.forceUpdate(),_(u)})}),destroy:function(){g(),f=!0}};if(!JH(s,l))return m;m.setOptions(c).then(function(_){!f&&c.onFirstUpdate&&c.onFirstUpdate(_)});function h(){u.orderedModifiers.forEach(function(_){var b=_.name,y=_.options,v=y===void 0?{}:y,C=_.effect;if(typeof C=="function"){var N=C({state:u,name:b,instance:m,options:v}),I=function(){};d.push(N||I)}})}function g(){d.forEach(function(_){return _()}),d=[]}return m}}var Rve=[UH,KH,zH,MH,qH,HH,YH,BH,WH],bP=QH({defaultModifiers:Rve});var t8=Fp(e8());var $ve=[],yP=function(e,r,o){o===void 0&&(o={});var n=W(null),i={onFirstUpdate:o.onFirstUpdate,placement:o.placement||"bottom",strategy:o.strategy||"absolute",modifiers:o.modifiers||$ve},a=M({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),s=a[0],l=a[1],c=ve(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(m){var h=m.state,g=Object.keys(h.elements);l({styles:nP(g.map(function(_){return[_,h.styles[_]||{}]})),attributes:nP(g.map(function(_){return[_,h.attributes[_]]}))})},requires:["computeStyles"]}},[]),u=ve(function(){var f={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return(0,t8.default)(n.current,f)?n.current||f:(n.current=f,f)},[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),d=W();return iP(function(){d.current&&d.current.setOptions(u)},[u]),iP(function(){if(!(e==null||r==null)){var f=o.createPopper||bP,m=f(e,r,u);return d.current=m,function(){m.destroy(),d.current=null}}},[e,r,o.createPopper]),{state:d.current?d.current.state:null,styles:s.styles,attributes:s.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}};function r8(t){if(typeof t!="string")return{position:"top",placement:"center"};let e=t.split("-");return e.length===1?{position:t,placement:"center"}:{position:e[0],placement:e[1]}}X();function vP({children:t,zIndex:e=Ar("popover"),className:r,withinPortal:o=!0}){return o?D.createElement(jc,{className:r,zIndex:e},t):D.createElement("div",{className:r,style:{position:"relative",zIndex:e}},t)}vP.displayName="@mantine/core/PopperContainer";var zve=Object.defineProperty,Uve=Object.defineProperties,Vve=Object.getOwnPropertyDescriptors,o8=Object.getOwnPropertySymbols,Hve=Object.prototype.hasOwnProperty,jve=Object.prototype.propertyIsEnumerable,n8=(t,e,r)=>e in t?zve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dw=(t,e)=>{for(var r in e||(e={}))Hve.call(e,r)&&n8(t,r,e[r]);if(o8)for(var r of o8(e))jve.call(e,r)&&n8(t,r,e[r]);return t},fw=(t,e)=>Uve(t,Vve(e)),i8=(t,e,r)=>({[`&.${r.center}`]:{top:`calc(50% - ${t}px)`},[`&.${r.end}`]:{bottom:t*e},[`&.${r.start}`]:{top:t*e}}),a8=(t,e,r,o)=>({[`&.${r.center}`]:{left:`calc(50% - ${t}px)`},[`&.${r.end}`]:{right:o.dir==="ltr"?t*e:void 0,left:o.dir==="rtl"?t*e:void 0},[`&.${r.start}`]:{left:o.dir==="ltr"?t*e:void 0,right:o.dir==="rtl"?t*e:void 0}}),Gve=me((t,{arrowSize:e,arrowDistance:r},o)=>{let n={ref:o("center")},i={ref:o("start")},a={ref:o("end")},s={center:n.ref,start:i.ref,end:a.ref};return{center:n,start:i,end:a,arrow:{width:e*2,height:e*2,position:"absolute",transform:"rotate(45deg)",border:"1px solid transparent",zIndex:1},left:fw(dw({},i8(e,r,s)),{right:t.dir==="ltr"?-e:"unset",left:t.dir==="rtl"?-e:"unset",borderLeft:t.dir==="ltr"?0:void 0,borderRight:t.dir==="rtl"?0:void 0,borderBottom:0}),right:fw(dw({},i8(e,r,s)),{left:t.dir==="ltr"?-e:"unset",right:t.dir==="rtl"?-e:"unset",borderRight:t.dir==="ltr"?0:void 0,borderLeft:t.dir==="rtl"?0:void 0,borderTop:0}),top:fw(dw({},a8(e,r,s,t)),{bottom:-e,borderLeft:t.dir==="ltr"?0:void 0,borderRight:t.dir==="rtl"?0:void 0,borderTop:0}),bottom:fw(dw({},a8(e,r,s,t)),{top:-e,borderRight:t.dir==="ltr"?0:void 0,borderLeft:t.dir==="rtl"?0:void 0,borderBottom:0})}}),s8=Gve;X();var Wve=Object.defineProperty,l8=Object.getOwnPropertySymbols,qve=Object.prototype.hasOwnProperty,Kve=Object.prototype.propertyIsEnumerable,c8=(t,e,r)=>e in t?Wve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vm=(t,e)=>{for(var r in e||(e={}))qve.call(e,r)&&c8(t,r,e[r]);if(l8)for(var r of l8(e))Kve.call(e,r)&&c8(t,r,e[r]);return t},u8={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function pw({transition:t,state:e,duration:r,timingFunction:o}){let n={transitionDuration:`${r}ms`,transitionTimingFunction:o};return typeof t=="string"?t in O_?vm(vm(vm({transitionProperty:O_[t].transitionProperty},n),O_[t].common),O_[t][u8[e]]):null:vm(vm(vm({transitionProperty:t.transitionProperty},n),t.common),t[u8[e]])}X();function mw({duration:t,exitDuration:e,timingFunction:r,mounted:o,onEnter:n,onExit:i,onEntered:a,onExited:s}){let l=dr(),c=ts(),[u,d]=M(o?"entered":"exited"),[f,m]=M(c?0:t),h=W(-1),g=_=>{let b=_?n:i,y=_?a:s;d(_?"pre-entering":"pre-exiting"),window.clearTimeout(h.current);let v=c?0:_?t:e;if(m(v),v===0)typeof b=="function"&&b(),typeof y=="function"&&y(),d(_?"entered":"exited");else{let C=window.setTimeout(()=>{typeof b=="function"&&b(),d(_?"entering":"exiting")},10);h.current=window.setTimeout(()=>{window.clearTimeout(C),typeof y=="function"&&y(),d(_?"entered":"exited")},v)}};return mr(()=>{g(o)},[o]),V(()=>()=>window.clearTimeout(h.current),[]),{transitionDuration:f,transitionStatus:u,transitionTimingFunction:r||l.transitionTimingFunction}}function G_({transition:t,duration:e=250,exitDuration:r=e,mounted:o,children:n,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c}){let{transitionDuration:u,transitionStatus:d,transitionTimingFunction:f}=mw({mounted:o,exitDuration:r,duration:e,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c});return u===0?o?D.createElement(D.Fragment,null,n({})):null:d==="exited"?null:D.createElement(D.Fragment,null,n(pw({transition:t,duration:u,state:d,timingFunction:f})))}G_.displayName="@mantine/core/Transition";var Yve=Object.defineProperty,Xve=Object.defineProperties,Jve=Object.getOwnPropertyDescriptors,d8=Object.getOwnPropertySymbols,Qve=Object.prototype.hasOwnProperty,Zve=Object.prototype.propertyIsEnumerable,f8=(t,e,r)=>e in t?Yve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p8=(t,e)=>{for(var r in e||(e={}))Qve.call(e,r)&&f8(t,r,e[r]);if(d8)for(var r of d8(e))Zve.call(e,r)&&f8(t,r,e[r]);return t},eIe=(t,e)=>Xve(t,Jve(e));function tIe(t,e){return t==="center"?t:e==="rtl"?t==="end"?"start":"end":t}function rIe(t,e){return t==="top"||t==="bottom"?t:e==="rtl"?t==="left"?"right":"left":t}function Vl({position:t="top",placement:e="center",gutter:r=5,arrowSize:o=2,arrowDistance:n=2,withArrow:i=!1,referenceElement:a,children:s,mounted:l,transition:c="pop-top-left",transitionDuration:u,exitTransitionDuration:d=u,transitionTimingFunction:f,arrowClassName:m,arrowStyle:h,zIndex:g=Ar("popover"),forceUpdateDependencies:_=[],modifiers:b=[],onTransitionEnd:y,withinPortal:v=!0}){var C;let N=i?r+o:r,{classes:I,cx:E,theme:w}=s8({arrowSize:o,arrowDistance:n},{name:"Popper"}),[S,T]=M(null),A=tIe(e,w.dir),R=rIe(t,w.dir),P=A==="center"?R:`${R}-${A}`,{styles:B,attributes:$,forceUpdate:z}=yP(a,S,{placement:P,modifiers:[{name:"offset",options:{offset:[0,N]}},...b]}),H=r8((C=$.popper)==null?void 0:C["data-popper-placement"]);return mr(()=>{typeof z=="function"&&z()},_),D.createElement(G_,{mounted:l&&!!a,duration:u,exitDuration:d,transition:c,timingFunction:f,onExited:y},G=>D.createElement("div",null,D.createElement(vP,{withinPortal:v,zIndex:g},D.createElement("div",p8({ref:T,style:eIe(p8({},B.popper),{pointerEvents:"none"})},$.popper),D.createElement("div",{style:G},s,i&&D.createElement("div",{style:h,className:E(I.arrow,I[H.placement],I[H.position],m)}))))))}Vl.displayName="@mantine/core/Popper";X();var oIe=me((t,{radius:e,shadow:r,withBorder:o})=>({root:{outline:0,WebkitTapHighlightColor:"transparent",display:"block",textDecoration:"none",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.white,boxSizing:"border-box",borderRadius:t.fn.radius(e),boxShadow:t.shadows[r]||r||"none",border:o?`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`:void 0}})),m8=oIe;var nIe=Object.defineProperty,hw=Object.getOwnPropertySymbols,g8=Object.prototype.hasOwnProperty,_8=Object.prototype.propertyIsEnumerable,h8=(t,e,r)=>e in t?nIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,iIe=(t,e)=>{for(var r in e||(e={}))g8.call(e,r)&&h8(t,r,e[r]);if(hw)for(var r of hw(e))_8.call(e,r)&&h8(t,r,e[r]);return t},aIe=(t,e)=>{var r={};for(var o in t)g8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&hw)for(var o of hw(t))e.indexOf(o)<0&&_8.call(t,o)&&(r[o]=t[o]);return r},sIe={},Hl=ee((t,e)=>{let r=Ie("Paper",sIe,t),{component:o,className:n,children:i,radius:a,withBorder:s,shadow:l}=r,c=aIe(r,["component","className","children","radius","withBorder","shadow"]),{classes:u,cx:d}=m8({radius:a,shadow:l,withBorder:s},{name:"Paper"});return D.createElement(_e,iIe({component:o||"div",className:d(u.root,n),ref:e},c),i)});Hl.displayName="@mantine/core/Paper";var W_=ee(({mounted:t,transition:e,transitionDuration:r,transitionTimingFunction:o,uuid:n,shadow:i,maxDropdownHeight:a,withinPortal:s=!0,children:l,classNames:c,styles:u,dropdownComponent:d,referenceElement:f,direction:m="column",onDirectionChange:h,switchDirectionOnFlip:g=!1,zIndex:_=Ar("popover"),dropdownPosition:b="flip",__staticSelector:y,positionDependencies:v=[]},C)=>{let{classes:N}=OH({native:d!==Ad},{classNames:c,styles:u,name:y}),I=W("bottom");return D.createElement(Vl,{referenceElement:f,mounted:t,transition:e,transitionDuration:r,exitTransitionDuration:0,transitionTimingFunction:o,position:b==="flip"?"bottom":b,withinPortal:s,forceUpdateDependencies:v,zIndex:_,modifiers:[{name:"preventOverflow",enabled:!1},{name:"flip",enabled:b==="flip"},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:E})=>{E.styles.popper.width=`${E.rects.reference.width}px`},effect:({state:E})=>{E.elements.popper.style.width=`${E.elements.reference.offsetWidth}px`}},{name:"directionControl",enabled:!0,phase:"main",fn:({state:E})=>{if(I.current!==E.placement){I.current=E.placement;let w=E.placement==="top"?"column-reverse":"column";m!==w&&g&&h&&h(w)}}}]},D.createElement("div",{style:{maxHeight:a,display:"flex"}},D.createElement(Hl,{radius:"sm",component:d||"div",id:`${n}-items`,"aria-labelledby":`${n}-label`,role:"listbox",className:N.dropdown,shadow:i,ref:C,onMouseDown:E=>E.preventDefault()},D.createElement("div",{style:{display:"flex",flexDirection:m,width:"100%"}},l))))});W_.displayName="@mantine/core/SelectDropdown";X();X();var gw={xs:1,sm:2,md:3,lg:4,xl:5},lIe=me((t,{size:e,variant:r,color:o})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:1,borderTop:`${t.fn.size({size:e,sizes:gw})}px ${r} ${t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1)}`,marginRight:t.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${t.fn.size({size:e,sizes:gw})}px ${r} ${t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1)}`,marginLeft:t.spacing.xs}},labelDefaultStyles:{color:o==="dark"?t.colors.dark[1]:t.fn.themeColor(o,t.colorScheme==="dark"?5:t.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:t.fn.size({size:e,sizes:gw}),borderTopColor:t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"100%",borderLeftWidth:t.fn.size({size:e,sizes:gw}),borderLeftColor:t.fn.themeColor(o,4,!1),borderLeftStyle:r}})),x8=lIe;var cIe=Object.defineProperty,uIe=Object.defineProperties,dIe=Object.getOwnPropertyDescriptors,_w=Object.getOwnPropertySymbols,v8=Object.prototype.hasOwnProperty,I8=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?cIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y8=(t,e)=>{for(var r in e||(e={}))v8.call(e,r)&&b8(t,r,e[r]);if(_w)for(var r of _w(e))I8.call(e,r)&&b8(t,r,e[r]);return t},fIe=(t,e)=>uIe(t,dIe(e)),pIe=(t,e)=>{var r={};for(var o in t)v8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&_w)for(var o of _w(t))e.indexOf(o)<0&&I8.call(t,o)&&(r[o]=t[o]);return r},mIe={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Ea=ee((t,e)=>{let r=Ie("Divider",mIe,t),{className:o,color:n,orientation:i,size:a,label:s,labelPosition:l,labelProps:c,variant:u,styles:d,classNames:f}=r,m=pIe(r,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames"]),h=dr(),g=n||(h.colorScheme==="dark"?"dark":"gray"),{classes:_,cx:b}=x8({color:g,size:a,variant:u},{classNames:f,styles:d,name:"Divider"}),y=i==="vertical",v=i==="horizontal",C=!!s&&v,N=!c?.color;return D.createElement(_e,y8({ref:e,className:b(_.root,{[_.vertical]:y,[_.horizontal]:v,[_.withLabel]:C},o)},m),C&&D.createElement(Gr,fIe(y8({},c),{size:c?.size||"xs",sx:{marginTop:2},className:b(_.label,_[l],{[_.labelDefaultStyles]:N})}),s))});Ea.displayName="@mantine/core/Divider";var hIe=me((t,{size:e})=>({item:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`${t.fn.size({size:e,sizes:t.spacing})/1.5}px ${t.fn.size({size:e,sizes:t.spacing})}px`,cursor:"pointer",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderRadius:t.radius.sm},selected:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.colors[t.primaryColor][0],color:t.colorScheme==="dark"?t.white:t.colors[t.primaryColor][9]},hovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},nothingFound:{boxSizing:"border-box",color:t.colors.gray[6],paddingTop:t.fn.size({size:e,sizes:t.spacing})/2,paddingBottom:t.fn.size({size:e,sizes:t.spacing})/2,textAlign:"center"},disabled:{cursor:"default",color:t.colors.dark[2]},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`${t.fn.size({size:e,sizes:t.spacing})/1.5}px ${t.fn.size({size:e,sizes:t.spacing})}px`},separatorLabel:{color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]}})),w8=hIe;var gIe=Object.defineProperty,E8=Object.getOwnPropertySymbols,_Ie=Object.prototype.hasOwnProperty,xIe=Object.prototype.propertyIsEnumerable,S8=(t,e,r)=>e in t?gIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bIe=(t,e)=>{for(var r in e||(e={}))_Ie.call(e,r)&&S8(t,r,e[r]);if(E8)for(var r of E8(e))xIe.call(e,r)&&S8(t,r,e[r]);return t};function q_({data:t,hovered:e,classNames:r,styles:o,isItemSelected:n,uuid:i,__staticSelector:a,onItemHover:s,onItemSelect:l,itemsRefs:c,itemComponent:u,size:d,nothingFound:f,creatable:m,createLabel:h}){let{classes:g,cx:_}=w8({size:d},{classNames:r,styles:o,name:a}),b=[],y=[],v=null,C=(I,E)=>{let w=typeof n=="function"?n(I.value):!1;return D.createElement(u,bIe({key:I.value,className:_(g.item,{[g.hovered]:!I.disabled&&e===E,[g.selected]:!I.disabled&&w,[g.disabled]:I.disabled}),onMouseEnter:()=>s(E),id:`${i}-${E}`,role:"option","data-ignore-outside-clicks":!0,tabIndex:-1,"aria-selected":e===E,ref:S=>{c&&c.current&&(c.current[I.value]=S)},onMouseDown:I.disabled?null:S=>{S.preventDefault(),l(I)},disabled:I.disabled},I))},N=null;if(t.forEach((I,E)=>{I.creatable?v=E:I.group?(N!==I.group&&(N=I.group,y.push(D.createElement("div",{className:g.separator,key:`__mantine-divider-${E}`},D.createElement(Ea,{classNames:{label:g.separatorLabel},label:I.group})))),y.push(C(I,E))):b.push(C(I,E))}),m){let I=t[v],E=typeof n=="function"?n(t[v].value):!1;b.push(D.createElement("div",{key:I.value,className:_(g.item,{[g.hovered]:e===v,[g.selected]:E}),onMouseEnter:()=>s(v),onMouseDown:w=>{w.preventDefault(),l(I)},tabIndex:-1,ref:w=>{c&&c.current&&(c.current[I.value]=w)}},h))}return y.length>0&&b.length>0&&b.unshift(D.createElement("div",{className:g.separator},D.createElement(Ea,null))),y.length>0||b.length>0?D.createElement(D.Fragment,null,y,b):D.createElement(Gr,{size:d,className:g.nothingFound},f)}q_.displayName="@mantine/core/SelectItems";X();var yIe=Object.defineProperty,xw=Object.getOwnPropertySymbols,T8=Object.prototype.hasOwnProperty,k8=Object.prototype.propertyIsEnumerable,C8=(t,e,r)=>e in t?yIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vIe=(t,e)=>{for(var r in e||(e={}))T8.call(e,r)&&C8(t,r,e[r]);if(xw)for(var r of xw(e))k8.call(e,r)&&C8(t,r,e[r]);return t},IIe=(t,e)=>{var r={};for(var o in t)T8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&xw)for(var o of xw(t))e.indexOf(o)<0&&k8.call(t,o)&&(r[o]=t[o]);return r},K_=ee((t,e)=>{var r=t,{label:o,value:n}=r,i=IIe(r,["label","value"]);return D.createElement("div",vIe({ref:e},i),o||n)});K_.displayName="@mantine/core/DefaultItem";X();var wIe=Object.defineProperty,EIe=Object.defineProperties,SIe=Object.getOwnPropertyDescriptors,N8=Object.getOwnPropertySymbols,CIe=Object.prototype.hasOwnProperty,TIe=Object.prototype.propertyIsEnumerable,P8=(t,e,r)=>e in t?wIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kIe=(t,e)=>{for(var r in e||(e={}))CIe.call(e,r)&&P8(t,r,e[r]);if(N8)for(var r of N8(e))TIe.call(e,r)&&P8(t,r,e[r]);return t},NIe=(t,e)=>EIe(t,SIe(e)),PIe=me((t,{size:e})=>({root:NIe(kIe({},t.fn.fontStyles()),{lineHeight:t.lineHeight}),label:{display:"inline-block",marginBottom:4,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),fontWeight:500,color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},error:{marginTop:t.spacing.xs/2,wordBreak:"break-word",color:t.colors.red[t.colorScheme==="dark"?6:7]},description:{marginTop:-3,marginBottom:7,wordBreak:"break-word",color:`${t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]} !important`,fontSize:t.fn.size({size:e,sizes:t.fontSizes})-2,lineHeight:1.2},required:{color:t.colorScheme==="dark"?t.colors.red[5]:t.colors.red[7]}})),O8=PIe;var OIe=Object.defineProperty,AIe=Object.defineProperties,DIe=Object.getOwnPropertyDescriptors,bw=Object.getOwnPropertySymbols,D8=Object.prototype.hasOwnProperty,R8=Object.prototype.propertyIsEnumerable,A8=(t,e,r)=>e in t?OIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y_=(t,e)=>{for(var r in e||(e={}))D8.call(e,r)&&A8(t,r,e[r]);if(bw)for(var r of bw(e))R8.call(e,r)&&A8(t,r,e[r]);return t},IP=(t,e)=>AIe(t,DIe(e)),RIe=(t,e)=>{var r={};for(var o in t)D8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&bw)for(var o of bw(t))e.indexOf(o)<0&&R8.call(t,o)&&(r[o]=t[o]);return r},MIe={labelElement:"label",size:"sm",__staticSelector:"InputWrapper"},kn=ee((t,e)=>{let r=Ie("InputWrapper",MIe,t),{className:o,label:n,children:i,required:a,id:s,error:l,description:c,labelElement:u,labelProps:d,descriptionProps:f,errorProps:m,classNames:h,styles:g,size:_,__staticSelector:b}=r,y=RIe(r,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","__staticSelector"]),{classes:v,cx:C}=O8({size:_},{classNames:h,styles:g,name:b}),I=ce(u,IP(Y_(Y_({},u==="label"?{htmlFor:s}:{}),d),{id:s?`${s}-label`:void 0,className:v.label}),D.createElement(D.Fragment,null,n,a&&D.createElement("span",{className:v.required,"aria-hidden":!0}," *")));return D.createElement(_e,Y_({className:C(v.root,o),ref:e},y),n&&I,c&&D.createElement(Gr,IP(Y_({},f),{color:"gray",className:v.description}),c),i,typeof l!="boolean"&&l&&D.createElement(Gr,IP(Y_({},m),{size:_,className:v.error}),l))});kn.displayName="@mantine/core/InputWrapper";X();var LIe=Object.defineProperty,FIe=Object.defineProperties,BIe=Object.getOwnPropertyDescriptors,M8=Object.getOwnPropertySymbols,$Ie=Object.prototype.hasOwnProperty,zIe=Object.prototype.propertyIsEnumerable,L8=(t,e,r)=>e in t?LIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F8=(t,e)=>{for(var r in e||(e={}))$Ie.call(e,r)&&L8(t,r,e[r]);if(M8)for(var r of M8(e))zIe.call(e,r)&&L8(t,r,e[r]);return t},B8=(t,e)=>FIe(t,BIe(e)),si={xs:30,sm:36,md:42,lg:50,xl:60},UIe=me((t,{size:e,multiline:r,radius:o,variant:n,invalid:i,rightSectionWidth:a,withRightSection:s,iconWidth:l})=>{let c=t.colors.red[t.colorScheme==="dark"?6:7],u=n==="default"||n==="filled"?{minHeight:t.fn.size({size:e,sizes:si}),paddingLeft:t.fn.size({size:e,sizes:si})/3,paddingRight:s?a:t.fn.size({size:e,sizes:si})/3,borderRadius:t.fn.radius(o)}:null;return{wrapper:{position:"relative"},input:n==="headless"?{}:B8(F8(B8(F8({},t.fn.fontStyles()),{height:r?n==="unstyled"?void 0:"auto":t.fn.size({size:e,sizes:si}),WebkitTapHighlightColor:"transparent",lineHeight:r?t.lineHeight:`${t.fn.size({size:e,sizes:si})-2}px`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),width:"100%",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,display:"block",textAlign:"left"}),u),{"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[1],color:t.colors.dark[2],opacity:.6,cursor:"not-allowed","&::placeholder":{color:t.colors.dark[2]}},"&::placeholder":{opacity:1,userSelect:"none",color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]},"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),defaultVariant:{border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[4]}`,backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.white,transition:"border-color 100ms ease","&:focus, &:focus-within":{outline:"none",borderColor:t.colors[t.primaryColor][t.colorScheme==="dark"?8:5]}},filledVariant:{border:"1px solid transparent",backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[1],"&:focus, &:focus-within":{outline:"none",borderColor:`${t.colors[t.primaryColor][t.colorScheme==="dark"?8:5]} !important`}},unstyledVariant:{borderWidth:0,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,backgroundColor:"transparent",minHeight:28,outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}},withIcon:{paddingLeft:typeof l=="number"?l:t.fn.size({size:e,sizes:si})},invalid:{color:c,borderColor:c,"&::placeholder":{opacity:1,color:c}},disabled:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[1],color:t.colors.dark[2],opacity:.6,cursor:"not-allowed","&::placeholder":{color:t.colors.dark[2]}},icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:typeof l=="number"?l:t.fn.size({size:e,sizes:si}),color:i?t.colors.red[t.colorScheme==="dark"?6:7]:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:a}}}),$8=UIe;var VIe=Object.defineProperty,HIe=Object.defineProperties,jIe=Object.getOwnPropertyDescriptors,vw=Object.getOwnPropertySymbols,V8=Object.prototype.hasOwnProperty,H8=Object.prototype.propertyIsEnumerable,z8=(t,e,r)=>e in t?VIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yw=(t,e)=>{for(var r in e||(e={}))V8.call(e,r)&&z8(t,r,e[r]);if(vw)for(var r of vw(e))H8.call(e,r)&&z8(t,r,e[r]);return t},U8=(t,e)=>HIe(t,jIe(e)),GIe=(t,e)=>{var r={};for(var o in t)V8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&vw)for(var o of vw(t))e.indexOf(o)<0&&H8.call(t,o)&&(r[o]=t[o]);return r},WIe={rightSectionWidth:36,size:"sm",__staticSelector:"Input"},Sa=ee((t,e)=>{let r=Ie("Input",WIe,t),{component:o,className:n,invalid:i,required:a,disabled:s,variant:l,icon:c,style:u,rightSectionWidth:d,iconWidth:f,rightSection:m,rightSectionProps:h,radius:g,size:_,wrapperProps:b,classNames:y,styles:v,__staticSelector:C,multiline:N,sx:I}=r,E=GIe(r,["component","className","invalid","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx"]),w=dr(),S=l||(w.colorScheme==="dark"?"filled":"default"),{classes:T,cx:A}=$8({radius:g,size:_,multiline:N,variant:S,invalid:i,rightSectionWidth:d,iconWidth:f,withRightSection:!!m},{classNames:y,styles:v,name:C}),{systemStyles:R,rest:P}=so(E),B=o||"input";return D.createElement(_e,yw(yw({className:A(T.wrapper,n),sx:I,style:u},R),b),c&&D.createElement("div",{className:T.icon},c),D.createElement(B,U8(yw({},P),{ref:e,required:a,"aria-invalid":i,disabled:s,className:A(T[`${S}Variant`],T.input,{[T.withIcon]:c,[T.invalid]:i,[T.disabled]:s})})),m&&D.createElement("div",U8(yw({},h),{className:T.rightSection}),m))});Sa.displayName="@mantine/core/Input";var qIe=Object.defineProperty,KIe=Object.defineProperties,YIe=Object.getOwnPropertyDescriptors,j8=Object.getOwnPropertySymbols,XIe=Object.prototype.hasOwnProperty,JIe=Object.prototype.propertyIsEnumerable,G8=(t,e,r)=>e in t?qIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W8=(t,e)=>{for(var r in e||(e={}))XIe.call(e,r)&&G8(t,r,e[r]);if(j8)for(var r of j8(e))JIe.call(e,r)&&G8(t,r,e[r]);return t},q8=(t,e)=>KIe(t,YIe(e)),Iw={xs:16,sm:26,md:38,lg:56,xl:84},QIe=me((t,{size:e,radius:r,color:o})=>{let n=t.fn.variant({variant:"light",color:o});return{root:q8(W8({},t.fn.focusStyles()),{WebkitTapHighlightColor:"transparent",boxSizing:"border-box",position:"relative",display:"block",userSelect:"none",overflow:"hidden",width:t.fn.size({size:e,sizes:Iw}),minWidth:t.fn.size({size:e,sizes:Iw}),height:t.fn.size({size:e,sizes:Iw}),borderRadius:t.fn.radius(r)}),image:{objectFit:"cover",width:"100%",height:"100%",display:"block"},placeholder:q8(W8({},t.fn.fontStyles()),{fontSize:t.fn.size({size:e,sizes:Iw})/2.5,color:n.color,fontWeight:700,backgroundColor:n.background,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",userSelect:"none"}),placeholderIcon:{width:"70%",height:"70%",color:n.color}}}),K8=QIe;X();X();var ZIe=Object.defineProperty,ewe=Object.defineProperties,twe=Object.getOwnPropertyDescriptors,Y8=Object.getOwnPropertySymbols,rwe=Object.prototype.hasOwnProperty,owe=Object.prototype.propertyIsEnumerable,X8=(t,e,r)=>e in t?ZIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nwe=(t,e)=>{for(var r in e||(e={}))rwe.call(e,r)&&X8(t,r,e[r]);if(Y8)for(var r of Y8(e))owe.call(e,r)&&X8(t,r,e[r]);return t},iwe=(t,e)=>ewe(t,twe(e));function J8(t){return D.createElement("svg",iwe(nwe({},t),{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),D.createElement("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var awe=Object.defineProperty,swe=Object.defineProperties,lwe=Object.getOwnPropertyDescriptors,ww=Object.getOwnPropertySymbols,e7=Object.prototype.hasOwnProperty,t7=Object.prototype.propertyIsEnumerable,Q8=(t,e,r)=>e in t?awe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Z8=(t,e)=>{for(var r in e||(e={}))e7.call(e,r)&&Q8(t,r,e[r]);if(ww)for(var r of ww(e))t7.call(e,r)&&Q8(t,r,e[r]);return t},cwe=(t,e)=>swe(t,lwe(e)),uwe=(t,e)=>{var r={};for(var o in t)e7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&ww)for(var o of ww(t))e.indexOf(o)<0&&t7.call(t,o)&&(r[o]=t[o]);return r},dwe={size:"md",color:"gray"},Ca=ee((t,e)=>{let r=Ie("Avatar",dwe,t),{component:o,className:n,size:i,src:a,alt:s,radius:l,children:c,color:u,classNames:d,styles:f,imageProps:m}=r,h=uwe(r,["component","className","size","src","alt","radius","children","color","classNames","styles","imageProps"]),{classes:g,cx:_}=K8({color:u,radius:l,size:i},{classNames:d,styles:f,name:"Avatar"}),[b,y]=M(!a);return V(()=>{y(!a)},[a]),D.createElement(_e,Z8({component:o||"div",className:_(g.root,n),ref:e},h),b?D.createElement("div",{className:g.placeholder,title:s},c||D.createElement(J8,{className:g.placeholderIcon})):D.createElement("img",cwe(Z8({},m),{className:g.image,src:a,alt:s,onError:()=>y(!0)})))});Ca.displayName="@mantine/core/Avatar";X();var fwe=Object.defineProperty,pwe=Object.defineProperties,mwe=Object.getOwnPropertyDescriptors,r7=Object.getOwnPropertySymbols,hwe=Object.prototype.hasOwnProperty,gwe=Object.prototype.propertyIsEnumerable,o7=(t,e,r)=>e in t?fwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_we=(t,e)=>{for(var r in e||(e={}))hwe.call(e,r)&&o7(t,r,e[r]);if(r7)for(var r of r7(e))gwe.call(e,r)&&o7(t,r,e[r]);return t},xwe=(t,e)=>pwe(t,mwe(e)),bwe=me((t,{spacing:e})=>({root:{display:"flex",paddingLeft:t.fn.size({size:e,sizes:t.spacing})/2},child:{marginLeft:-t.fn.size({size:e,sizes:t.spacing})/2,background:`${t.colorScheme==="dark"?t.colors.dark[7]:t.white}`,border:`2px solid ${t.colorScheme==="dark"?t.colors.dark[7]:t.white}`},truncated:xwe(_we({},t.fn.fontStyles()),{lineHeight:1,fontSize:`${t.fontSizes.sm}px !important`,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,width:"100%",height:"100%",backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[0]})})),n7=bwe;var ywe=Object.defineProperty,vwe=Object.defineProperties,Iwe=Object.getOwnPropertyDescriptors,Ew=Object.getOwnPropertySymbols,s7=Object.prototype.hasOwnProperty,l7=Object.prototype.propertyIsEnumerable,i7=(t,e,r)=>e in t?ywe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a7=(t,e)=>{for(var r in e||(e={}))s7.call(e,r)&&i7(t,r,e[r]);if(Ew)for(var r of Ew(e))l7.call(e,r)&&i7(t,r,e[r]);return t},wwe=(t,e)=>vwe(t,Iwe(e)),Ewe=(t,e)=>{var r={};for(var o in t)s7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ew)for(var o of Ew(t))e.indexOf(o)<0&&l7.call(t,o)&&(r[o]=t[o]);return r},Swe={size:"md",radius:"xl",limit:2,spacing:"lg"},Sw=ee((t,e)=>{let r=Ie("AvatarsGroup",Swe,t),{className:o,children:n,size:i="md",radius:a="xl",limit:s=2,classNames:l,styles:c,spacing:u="lg",total:d}=r,f=Ewe(r,["className","children","size","radius","limit","classNames","styles","spacing","total"]),{classes:m,cx:h}=n7({spacing:u},{classNames:l,styles:c,name:"AvatarsGroup"}),g=PI(n,Ca).map((v,C)=>D.cloneElement(v,{size:i,radius:a,key:C,className:h(m.child,v.props.className),style:wwe(a7({},v.props.style),{zIndex:C+1})})),_=s<2?2:s,b=g.length>_?g.length-_:0,y=d?d-Math.min(g.length,_):b;return D.createElement(_e,a7({className:h(o,m.root),ref:e},f),g.slice(0,g.length-b),y?D.createElement(Ca,{size:i,radius:a,className:m.child,style:{zIndex:s+1}},D.createElement(L_,{className:m.truncated},"+",y)):null)});Sw.displayName="@mantine/core/AvatarsGroup";X();var Cwe=Object.defineProperty,Twe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,c7=Object.getOwnPropertySymbols,Nwe=Object.prototype.hasOwnProperty,Pwe=Object.prototype.propertyIsEnumerable,u7=(t,e,r)=>e in t?Cwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d7=(t,e)=>{for(var r in e||(e={}))Nwe.call(e,r)&&u7(t,r,e[r]);if(c7)for(var r of c7(e))Pwe.call(e,r)&&u7(t,r,e[r]);return t},Owe=(t,e)=>Twe(t,kwe(e)),X_={xs:{fontSize:9,height:16},sm:{fontSize:10,height:18},md:{fontSize:11,height:20},lg:{fontSize:13,height:26},xl:{fontSize:16,height:32}},Awe={xs:4,sm:4,md:6,lg:8,xl:10},Cmt=Object.keys(X_).reduce((t,e)=>(t[e]=X_[e].height,t),{}),Dwe=me((t,{color:e,size:r,radius:o,gradientFrom:n,gradientTo:i,gradientDeg:a,fullWidth:s})=>{let l=t.fn.size({size:r,sizes:Awe}),{fontSize:c,height:u}=r in X_?X_[r]:X_.md,d=t.fn.variant({color:e,variant:"light"}),f=t.fn.variant({color:e,variant:"filled"}),m=t.fn.variant({color:e,variant:"outline"}),h=t.fn.variant({variant:"gradient",gradient:{from:n,to:i,deg:a}});return{leftSection:{marginRight:t.spacing.xs/2},rightSection:{marginLeft:t.spacing.xs/2},inner:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},root:Owe(d7(d7({},t.fn.focusStyles()),t.fn.fontStyles()),{fontSize:c,height:u,WebkitTapHighlightColor:"transparent",lineHeight:`${u-2}px`,textDecoration:"none",padding:`0 ${t.fn.size({size:r,sizes:t.spacing})/1.5}px`,boxSizing:"border-box",display:s?"flex":"inline-flex",alignItems:"center",justifyContent:"center",width:s?"100%":"auto",textTransform:"uppercase",borderRadius:t.fn.radius(o),fontWeight:700,letterSpacing:.25,cursor:"default",textOverflow:"ellipsis",overflow:"hidden"}),light:{backgroundColor:d.background,color:d.color,border:"1px solid transparent"},filled:{backgroundColor:f.background,color:f.color,border:"1px solid transparent"},outline:{backgroundColor:m.background,color:m.color,border:`1px solid ${m.border}`},gradient:{backgroundImage:h.background,color:h.color,border:0},dot:{backgroundColor:"transparent",color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[3]}`,paddingLeft:t.fn.size({size:r,sizes:t.spacing})/1.5-l/2,"&::before":{content:'""',display:"block",width:l,height:l,borderRadius:l,backgroundColor:t.fn.themeColor(e,t.colorScheme==="dark"?4:t.fn.primaryShade("light")),marginRight:l}}}}),f7=Dwe;var Rwe=Object.defineProperty,Cw=Object.getOwnPropertySymbols,m7=Object.prototype.hasOwnProperty,h7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?Rwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mwe=(t,e)=>{for(var r in e||(e={}))m7.call(e,r)&&p7(t,r,e[r]);if(Cw)for(var r of Cw(e))h7.call(e,r)&&p7(t,r,e[r]);return t},Lwe=(t,e)=>{var r={};for(var o in t)m7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Cw)for(var o of Cw(t))e.indexOf(o)<0&&h7.call(t,o)&&(r[o]=t[o]);return r},Fwe={variant:"light",size:"md",radius:"xl",gradient:{from:"blue",to:"cyan",deg:45}},is=ee((t,e)=>{let r=Ie("Badge",Fwe,t),{component:o,className:n,color:i,variant:a,fullWidth:s,children:l,size:c,leftSection:u,rightSection:d,radius:f,gradient:m,classNames:h,styles:g}=r,_=Lwe(r,["component","className","color","variant","fullWidth","children","size","leftSection","rightSection","radius","gradient","classNames","styles"]),{classes:b,cx:y}=f7({size:c,fullWidth:s,color:i,radius:f,gradientFrom:m.from,gradientTo:m.to,gradientDeg:m.deg},{classNames:h,styles:g,name:"Badge"});return D.createElement(_e,Mwe({component:o||"div",className:y(b[a],b.root,n),ref:e},_),u&&D.createElement("span",{className:b.leftSection},u),D.createElement("span",{className:b.inner},l),d&&D.createElement("span",{className:b.rightSection},d))});is.displayName="@mantine/core/Badge";X();var Bwe=me(t=>({root:{display:"flex"},breadcrumb:{lineHeight:1,whiteSpace:"nowrap",WebkitTapHighlightColor:"transparent"},separator:{marginLeft:t.spacing.xs,marginRight:t.spacing.xs,color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[7],lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"}})),g7=Bwe;var $we=Object.defineProperty,Tw=Object.getOwnPropertySymbols,x7=Object.prototype.hasOwnProperty,b7=Object.prototype.propertyIsEnumerable,_7=(t,e,r)=>e in t?$we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zwe=(t,e)=>{for(var r in e||(e={}))x7.call(e,r)&&_7(t,r,e[r]);if(Tw)for(var r of Tw(e))b7.call(e,r)&&_7(t,r,e[r]);return t},Uwe=(t,e)=>{var r={};for(var o in t)x7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Tw)for(var o of Tw(t))e.indexOf(o)<0&&b7.call(t,o)&&(r[o]=t[o]);return r},Vwe={separator:"/"},Io=ee((t,e)=>{let r=Ie("Breadcrumbs",Vwe,t),{className:o,children:n,separator:i,classNames:a,styles:s}=r,l=Uwe(r,["className","children","separator","classNames","styles"]),{classes:c,cx:u}=g7(null,{classNames:a,styles:s,name:"Breadcrumbs"}),d=D.Children.toArray(n).reduce((f,m,h,g)=>(f.push(D.cloneElement(m,{className:c.breadcrumb,key:h})),h!==g.length-1&&f.push(D.createElement(Gr,{size:"sm",className:c.separator,key:`separator-${h}`},i)),f),[]);return D.createElement(_e,zwe({className:u(c.root,o),ref:e},l),d)});Io.displayName="@mantine/core/Breadcrumbs";X();var Hwe=Object.defineProperty,jwe=Object.defineProperties,Gwe=Object.getOwnPropertyDescriptors,y7=Object.getOwnPropertySymbols,Wwe=Object.prototype.hasOwnProperty,qwe=Object.prototype.propertyIsEnumerable,v7=(t,e,r)=>e in t?Hwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J_=(t,e)=>{for(var r in e||(e={}))Wwe.call(e,r)&&v7(t,r,e[r]);if(y7)for(var r of y7(e))qwe.call(e,r)&&v7(t,r,e[r]);return t},Kwe=(t,e)=>jwe(t,Gwe(e)),kw={xs:{height:si.xs,padding:"0 14px"},sm:{height:si.sm,padding:"0 18px"},md:{height:si.md,padding:"0 22px"},lg:{height:si.lg,padding:"0 26px"},xl:{height:si.xl,padding:"0 32px"},"compact-xs":{height:22,padding:"0 7px"},"compact-sm":{height:26,padding:"0 8px"},"compact-md":{height:30,padding:"0 10px"},"compact-lg":{height:34,padding:"0 12px"},"compact-xl":{height:40,padding:"0 14px"}},I7=Object.keys(kw).reduce((t,e)=>(t[e]=kw[e].height,t),{}),Ywe=({compact:t,size:e})=>t?kw[`compact-${e}`]:kw[e],Xwe=t=>({display:t?"block":"inline-block",width:t?"100%":"auto"});function Im({variant:t,theme:e,color:r}){let o=e.fn.variant({color:r,variant:t});return J_({border:`1px solid ${o.border}`,backgroundColor:o.background,backgroundImage:o.background,color:o.color},e.fn.hover({backgroundColor:o.hover}))}var Jwe=me((t,{color:e,size:r,radius:o,fullWidth:n,compact:i,gradientFrom:a,gradientTo:s,gradientDeg:l},c)=>{let u=t.fn.variant({color:e,variant:"gradient",gradient:{from:a,to:s,deg:l}});return{loading:{ref:c("loading"),pointerEvents:"none","&::before":{content:'""',position:"absolute",top:-1,left:-1,right:-1,bottom:-1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:t.fn.radius(o),cursor:"not-allowed"}},outline:Im({variant:"outline",theme:t,color:e}),filled:Im({variant:"filled",theme:t,color:e}),light:Im({variant:"light",theme:t,color:e}),default:Im({variant:"default",theme:t,color:e}),white:Im({variant:"white",theme:t,color:e}),subtle:Im({variant:"subtle",theme:t,color:e}),gradient:{border:0,backgroundImage:u.background,color:u.color,"&:hover":t.fn.hover({backgroundSize:"200%"})},root:Kwe(J_(J_(J_(J_({},Ywe({compact:i,size:r})),t.fn.fontStyles()),t.fn.focusStyles()),Xwe(n)),{borderRadius:t.fn.radius(o),fontWeight:600,position:"relative",lineHeight:1,fontSize:t.fn.size({size:r,sizes:t.fontSizes}),WebkitTapHighlightColor:"transparent",userSelect:"none",boxSizing:"border-box",textDecoration:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none","&:not(:disabled):active":{transform:"translateY(1px)"},[`&:not(.${c("loading")}):disabled`]:{borderColor:"transparent",backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],color:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[5],cursor:"not-allowed"}}),icon:{display:"flex",alignItems:"center"},leftIcon:{marginRight:10},rightIcon:{marginLeft:10},inner:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",overflow:"visible"},label:{whiteSpace:"nowrap",height:"100%",overflow:"hidden",display:"flex",alignItems:"center"}}}),w7=Jwe;var Qwe=Object.defineProperty,Nw=Object.getOwnPropertySymbols,C7=Object.prototype.hasOwnProperty,T7=Object.prototype.propertyIsEnumerable,E7=(t,e,r)=>e in t?Qwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S7=(t,e)=>{for(var r in e||(e={}))C7.call(e,r)&&E7(t,r,e[r]);if(Nw)for(var r of Nw(e))T7.call(e,r)&&E7(t,r,e[r]);return t},Zwe=(t,e)=>{var r={};for(var o in t)C7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Nw)for(var o of Nw(t))e.indexOf(o)<0&&T7.call(t,o)&&(r[o]=t[o]);return r},e0e={size:"sm",type:"button",variant:"filled",loaderPosition:"left",gradient:{from:"blue",to:"cyan",deg:45}},re=ee((t,e)=>{let r=Ie("Button",e0e,t),{className:o,size:n,color:i,type:a,disabled:s,children:l,leftIcon:c,rightIcon:u,fullWidth:d,variant:f,radius:m,component:h,uppercase:g,compact:_,loading:b,loaderPosition:y,loaderProps:v,gradient:C,classNames:N,styles:I}=r,E=Zwe(r,["className","size","color","type","disabled","children","leftIcon","rightIcon","fullWidth","variant","radius","component","uppercase","compact","loading","loaderPosition","loaderProps","gradient","classNames","styles"]),{classes:w,cx:S,theme:T}=w7({radius:m,color:i,size:n,fullWidth:d,compact:_,gradientFrom:C.from,gradientTo:C.to,gradientDeg:C.deg},{classNames:N,styles:I,name:"Button"}),A=T.fn.variant({color:i,variant:f}),R=D.createElement(Ze,S7({color:A.color,size:T.fn.size({size:n,sizes:I7})/2},v));return D.createElement(_e,S7({component:h||"button",className:S(w[f],{[w.loading]:b},w.root,o),type:a,disabled:s||b,ref:e,onTouchStart:()=>{}},E),D.createElement("div",{className:w.inner},(c||b&&y==="left")&&D.createElement("span",{className:S(w.icon,w.leftIcon)},b&&y==="left"?R:c),D.createElement("span",{className:w.label,style:{textTransform:g?"uppercase":void 0}},l),(u||b&&y==="right")&&D.createElement("span",{className:S(w.icon,w.rightIcon)},b&&y==="right"?R:u)))});re.displayName="@mantine/core/Button";X();X();var t0e=Object.defineProperty,Pw=Object.getOwnPropertySymbols,P7=Object.prototype.hasOwnProperty,O7=Object.prototype.propertyIsEnumerable,k7=(t,e,r)=>e in t?t0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N7=(t,e)=>{for(var r in e||(e={}))P7.call(e,r)&&k7(t,r,e[r]);if(Pw)for(var r of Pw(e))O7.call(e,r)&&k7(t,r,e[r]);return t},r0e=(t,e)=>{var r={};for(var o in t)P7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Pw)for(var o of Pw(t))e.indexOf(o)<0&&O7.call(t,o)&&(r[o]=t[o]);return r};function A7(t){var e=t,{indeterminate:r}=e,o=r0e(e,["indeterminate"]);return r?D.createElement("svg",N7({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6"},o),D.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):D.createElement("svg",N7({viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o),D.createElement("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var o0e=Object.defineProperty,n0e=Object.defineProperties,i0e=Object.getOwnPropertyDescriptors,D7=Object.getOwnPropertySymbols,a0e=Object.prototype.hasOwnProperty,s0e=Object.prototype.propertyIsEnumerable,R7=(t,e,r)=>e in t?o0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M7=(t,e)=>{for(var r in e||(e={}))a0e.call(e,r)&&R7(t,r,e[r]);if(D7)for(var r of D7(e))s0e.call(e,r)&&R7(t,r,e[r]);return t},L7=(t,e)=>n0e(t,i0e(e)),l0e={xs:16,sm:20,md:24,lg:30,xl:36},c0e={xs:8,sm:10,md:14,lg:16,xl:20},u0e=me((t,{size:e,radius:r,color:o,transitionDuration:n},i)=>{let a=t.fn.size({size:e,sizes:l0e}),s=t.fn.variant({variant:"filled",color:o});return{icon:{ref:i("icon"),color:t.white,transform:"translateY(5px) scale(0.5)",opacity:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${n}ms`,pointerEvents:"none",width:t.fn.size({size:e,sizes:c0e}),position:"absolute",zIndex:1,top:0,bottom:0,left:0,right:0,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:"0ms"}},root:{display:"flex",alignItems:"center"},inner:{position:"relative",width:a,height:a},label:L7(M7({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",paddingLeft:t.spacing.sm,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),lineHeight:`${a}px`,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}),input:L7(M7({},t.fn.focusStyles()),{appearance:"none",backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,width:a,height:a,borderRadius:t.fn.radius(r),padding:0,display:"block",margin:0,transition:`border-color ${n}ms ease, background-color ${n}ms ease`,"&:checked":{backgroundColor:s.background,borderColor:s.background,[`& + .${i("icon")}`]:{opacity:1,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],borderColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[3],cursor:"not-allowed",[`& + .${i("icon")}`]:{color:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[5]}}})}}),F7=u0e;var d0e=Object.defineProperty,Ow=Object.getOwnPropertySymbols,$7=Object.prototype.hasOwnProperty,z7=Object.prototype.propertyIsEnumerable,B7=(t,e,r)=>e in t?d0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wP=(t,e)=>{for(var r in e||(e={}))$7.call(e,r)&&B7(t,r,e[r]);if(Ow)for(var r of Ow(e))z7.call(e,r)&&B7(t,r,e[r]);return t},f0e=(t,e)=>{var r={};for(var o in t)$7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ow)for(var o of Ow(t))e.indexOf(o)<0&&z7.call(t,o)&&(r[o]=t[o]);return r},p0e={size:"sm",__staticSelector:"Checkbox",transitionDuration:100,icon:A7},Xc=ee((t,e)=>{let r=Ie("Checkbox",p0e,t),{className:o,style:n,sx:i,checked:a,color:s,label:l,indeterminate:c,id:u,size:d,radius:f,wrapperProps:m,children:h,classNames:g,styles:_,transitionDuration:b,icon:y,__staticSelector:v}=r,C=f0e(r,["className","style","sx","checked","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","__staticSelector"]),N=lo(u),{systemStyles:I,rest:E}=so(C),{classes:w,cx:S}=F7({size:d,radius:f,color:s,transitionDuration:b},{classNames:g,styles:_,name:v});return D.createElement(_e,wP(wP({className:S(w.root,o),style:n,sx:i},I),m),D.createElement("div",{className:w.inner},D.createElement("input",wP({id:N,ref:e,type:"checkbox",className:w.input,checked:c||a},E)),D.createElement(y,{indeterminate:c,className:w.icon})),l&&D.createElement("label",{className:w.label,htmlFor:N},l))});Xc.displayName="@mantine/core/Checkbox";X();var U7={left:"flex-start",center:"center",right:"flex-end",apart:"space-between"},m0e=me((t,{spacing:e,position:r,noWrap:o,direction:n,grow:i,align:a,count:s})=>({root:{boxSizing:"border-box",display:"flex",flexDirection:n,alignItems:a||(n==="row"?"center":i?"stretch":r==="apart"?"flex-start":U7[r]),flexWrap:o?"nowrap":"wrap",justifyContent:n==="row"?U7[r]:void 0,gap:t.fn.size({size:e,sizes:t.spacing})},child:{boxSizing:"border-box",maxWidth:i&&n==="row"?`calc(${100/s}% - ${t.fn.size({size:e,sizes:t.spacing})-t.fn.size({size:e,sizes:t.spacing})/s}px)`:void 0,flexGrow:i?1:0}})),V7=m0e;var h0e=Object.defineProperty,Aw=Object.getOwnPropertySymbols,j7=Object.prototype.hasOwnProperty,G7=Object.prototype.propertyIsEnumerable,H7=(t,e,r)=>e in t?h0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g0e=(t,e)=>{for(var r in e||(e={}))j7.call(e,r)&&H7(t,r,e[r]);if(Aw)for(var r of Aw(e))G7.call(e,r)&&H7(t,r,e[r]);return t},_0e=(t,e)=>{var r={};for(var o in t)j7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Aw)for(var o of Aw(t))e.indexOf(o)<0&&G7.call(t,o)&&(r[o]=t[o]);return r},x0e={position:"left",spacing:"md",direction:"row"},as=ee((t,e)=>{let r=Ie("Group",x0e,t),{className:o,position:n,align:i,children:a,noWrap:s,grow:l,spacing:c,direction:u,classNames:d,styles:f}=r,m=_0e(r,["className","position","align","children","noWrap","grow","spacing","direction","classNames","styles"]),h=_V(a),{classes:g,cx:_}=V7({align:i,grow:l,noWrap:s,spacing:c,position:n,direction:u,count:h.length},{classNames:d,styles:f,name:"Group"}),b=h.map(y=>{var v;return typeof y=="object"&&y!==null&&"props"in y?D.cloneElement(y,{className:_(g.child,(v=y.props)==null?void 0:v.className)}):y});return D.createElement(_e,g0e({className:_(g.root,o),ref:e},m),b)});as.displayName="@mantine/core/Group";X();X();X();var b0e=Object.defineProperty,y0e=Object.defineProperties,v0e=Object.getOwnPropertyDescriptors,W7=Object.getOwnPropertySymbols,I0e=Object.prototype.hasOwnProperty,w0e=Object.prototype.propertyIsEnumerable,q7=(t,e,r)=>e in t?b0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E0e=(t,e)=>{for(var r in e||(e={}))I0e.call(e,r)&&q7(t,r,e[r]);if(W7)for(var r of W7(e))w0e.call(e,r)&&q7(t,r,e[r]);return t},S0e=(t,e)=>y0e(t,v0e(e)),C0e=me((t,{size:e,radius:r})=>{let o=t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3];return{root:S0e(E0e({},t.fn.focusStyles()),{width:e,height:e,WebkitTapHighlightColor:"transparent",border:0,borderRadius:t.fn.size({size:r,sizes:t.radius}),appearance:"none",WebkitAppearance:"none",padding:0,position:"relative",overflow:"hidden"}),overlay:{position:"absolute",borderRadius:t.fn.size({size:r,sizes:t.radius}),top:0,left:0,right:0,bottom:0},children:{display:"inline-flex",justifyContent:"center",alignItems:"center"},shadowOverlay:{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset",zIndex:1},alphaOverlay:{backgroundImage:`linear-gradient(45deg, ${o} 25%, transparent 25%), linear-gradient(-45deg, ${o} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${o} 75%), linear-gradient(-45deg, ${t.colorScheme==="dark"?t.colors.dark[7]:t.white} 75%, ${o} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"}}}),K7=C0e;var T0e=Object.defineProperty,Dw=Object.getOwnPropertySymbols,X7=Object.prototype.hasOwnProperty,J7=Object.prototype.propertyIsEnumerable,Y7=(t,e,r)=>e in t?T0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k0e=(t,e)=>{for(var r in e||(e={}))X7.call(e,r)&&Y7(t,r,e[r]);if(Dw)for(var r of Dw(e))J7.call(e,r)&&Y7(t,r,e[r]);return t},N0e=(t,e)=>{var r={};for(var o in t)X7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Dw)for(var o of Dw(t))e.indexOf(o)<0&&J7.call(t,o)&&(r[o]=t[o]);return r},P0e={size:25,radius:25},Ud=ee((t,e)=>{let r=Ie("ColorSwatch",P0e,t),{component:o,color:n,size:i,radius:a,className:s,children:l,classNames:c,styles:u}=r,d=N0e(r,["component","color","size","radius","className","children","classNames","styles"]),{classes:f,cx:m}=K7({radius:a,size:i},{classNames:c,styles:u,name:"ColorSwatch"});return D.createElement(_e,k0e({component:o||"div",className:m(f.root,s),ref:e},d),D.createElement("div",{className:m(f.alphaOverlay,f.overlay)}),D.createElement("div",{className:m(f.shadowOverlay,f.overlay)}),D.createElement("div",{className:f.overlay,style:{backgroundColor:n}}),D.createElement("div",{className:m(f.children,f.overlay)},l))});Ud.displayName="@mantine/core/ColorSwatch";X();X();X();var Ki={xs:8,sm:12,md:16,lg:20,xl:22},O0e=me((t,{size:e})=>{let r=t.fn.size({size:e,sizes:Ki});return{thumb:{overflow:"hidden",boxSizing:"border-box",position:"absolute",boxShadow:"0 0 1px rgba(0, 0, 0, .6)",border:`2px solid ${t.white}`,backgroundColor:"transparent",width:r,height:r,borderRadius:r}}}),Q7=O0e;var A0e=Object.defineProperty,Z7=Object.getOwnPropertySymbols,D0e=Object.prototype.hasOwnProperty,R0e=Object.prototype.propertyIsEnumerable,ej=(t,e,r)=>e in t?A0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M0e=(t,e)=>{for(var r in e||(e={}))D0e.call(e,r)&&ej(t,r,e[r]);if(Z7)for(var r of Z7(e))R0e.call(e,r)&&ej(t,r,e[r]);return t};function Q_({position:t,className:e,styles:r,classNames:o,style:n,size:i,__staticSelector:a}){let{classes:s,cx:l}=Q7({size:i},{classNames:o,styles:r,name:a});return D.createElement("div",{className:l(s.thumb,e),style:M0e({left:`calc(${t.x*100}% - ${Ki[i]/2}px)`,top:`calc(${t.y*100}% - ${Ki[i]/2}px)`},n)})}Q_.displayName="@mantine/core/Thumb";var L0e=me((t,{size:e},r)=>{let o={ref:r("sliderThumb")};return{sliderThumb:o,slider:{position:"relative",height:t.fn.size({size:e,sizes:Ki})+2,boxSizing:"border-box",marginLeft:t.fn.size({size:e,sizes:Ki})/2,marginRight:t.fn.size({size:e,sizes:Ki})/2,outline:0,[`&:focus .${o.ref}`]:{outline:"none",boxShadow:t.focusRing==="always"||t.focusRing==="auto"?`0 0 0 2px ${t.colorScheme==="dark"?t.colors.dark[9]:t.white}, 0 0 0 4px ${t.colors[t.primaryColor][t.colorScheme==="dark"?7:5]}`:void 0},[`&:focus:not(:focus-visible) .${o.ref}`]:{boxShadow:t.focusRing==="auto"||t.focusRing==="never"?"none":void 0}},sliderOverlay:{position:"absolute",boxSizing:"border-box",top:0,bottom:0,left:-t.fn.size({size:e,sizes:Ki})/2-1,right:-t.fn.size({size:e,sizes:Ki})/2-1,borderRadius:1e3}}}),tj=L0e;var F0e=Object.defineProperty,B0e=Object.defineProperties,$0e=Object.getOwnPropertyDescriptors,Rw=Object.getOwnPropertySymbols,oj=Object.prototype.hasOwnProperty,nj=Object.prototype.propertyIsEnumerable,rj=(t,e,r)=>e in t?F0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z0e=(t,e)=>{for(var r in e||(e={}))oj.call(e,r)&&rj(t,r,e[r]);if(Rw)for(var r of Rw(e))nj.call(e,r)&&rj(t,r,e[r]);return t},U0e=(t,e)=>B0e(t,$0e(e)),V0e=(t,e)=>{var r={};for(var o in t)oj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Rw)for(var o of Rw(t))e.indexOf(o)<0&&nj.call(t,o)&&(r[o]=t[o]);return r},Z_=ee((t,e)=>{var r=t,{value:o,onChange:n,maxValue:i,round:a,size:s="md",thumbColor:l="transparent",__staticSelector:c="ColorSlider",focusable:u=!0,overlays:d,classNames:f,styles:m,className:h}=r,g=V0e(r,["value","onChange","maxValue","round","size","thumbColor","__staticSelector","focusable","overlays","classNames","styles","className"]);let{classes:_,cx:b}=tj({size:s},{classNames:f,styles:m,name:c}),[y,v]=M({y:0,x:o/i}),C=S=>a?Math.round(S*i):S*i,{ref:N}=R_(({x:S})=>n(C(S)));mr(()=>{v({y:0,x:o/i})},[o]);let I=(S,T)=>{S.preventDefault();let A=D_(T);n(C(A.x))},E=S=>{switch(S.nativeEvent.code){case"ArrowRight":{I(S,{x:y.x+.05,y:y.y});break}case"ArrowLeft":{I(S,{x:y.x-.05,y:y.y});break}}},w=d.map((S,T)=>D.createElement("div",{className:_.sliderOverlay,style:S,key:T}));return D.createElement(_e,U0e(z0e({},g),{ref:Sn(N,e),className:b(_.slider,h),role:"slider","aria-valuenow":o,"aria-valuemax":i,"aria-valuemin":0,tabIndex:u?0:-1,onKeyDown:E}),w,D.createElement(Q_,{__staticSelector:c,classNames:f,styles:m,position:y,style:{top:1,backgroundColor:l},className:_.sliderThumb,size:s}))});Z_.displayName="@mantine/core/ColorSlider";var H0e=Object.defineProperty,j0e=Object.defineProperties,G0e=Object.getOwnPropertyDescriptors,Mw=Object.getOwnPropertySymbols,aj=Object.prototype.hasOwnProperty,sj=Object.prototype.propertyIsEnumerable,ij=(t,e,r)=>e in t?H0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W0e=(t,e)=>{for(var r in e||(e={}))aj.call(e,r)&&ij(t,r,e[r]);if(Mw)for(var r of Mw(e))sj.call(e,r)&&ij(t,r,e[r]);return t},q0e=(t,e)=>j0e(t,G0e(e)),K0e=(t,e)=>{var r={};for(var o in t)aj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Mw)for(var o of Mw(t))e.indexOf(o)<0&&sj.call(t,o)&&(r[o]=t[o]);return r},EP=ee((t,e)=>{var r=t,{value:o,onChange:n}=r,i=K0e(r,["value","onChange"]);return D.createElement(Z_,q0e(W0e({},i),{ref:e,value:o,onChange:n,maxValue:360,thumbColor:`hsl(${o}, 100%, 50%)`,round:!0,overlays:[{backgroundImage:"linear-gradient(to right,hsl(0,100%,50%),hsl(60,100%,50%),hsl(120,100%,50%),hsl(170,100%,50%),hsl(240,100%,50%),hsl(300,100%,50%),hsl(360,100%,50%))"},{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset"}]}))});EP.displayName="@mantine/core/HueSlider";X();function Ta(t,e=0,r=10**e){return Math.round(r*t)/r}function Y0e({h:t,s:e,l:r,a:o}){let n=e*((r<50?r:100-r)/100);return{h:t,s:n>0?2*n/(r+n)*100:0,v:r+n,a:o}}var X0e={grad:360/400,turn:360,rad:360/(Math.PI*2)};function J0e(t,e="deg"){return Number(t)*(X0e[e]||1)}var Q0e=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function lj(t){let e=Q0e.exec(t);return e?Y0e({h:J0e(e[1],e[2]),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)}):{h:0,s:0,v:0,a:1}}function SP({r:t,g:e,b:r,a:o}){let n=Math.max(t,e,r),i=n-Math.min(t,e,r),a=i?n===t?(e-r)/i:n===e?2+(r-t)/i:4+(t-e)/i:0;return{h:Ta(60*(a<0?a+6:a)),s:Ta(n?i/n*100:0),v:Ta(n/255*100),a:o}}function Z0e(t){let e=t[0]==="#"?t.slice(1):t;return e.length===3?SP({r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:1}):SP({r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16),a:1})}var eEe=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function cj(t){let e=eEe.exec(t);return e?SP({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):{h:0,s:0,v:0,a:1}}var uj={hex:/^#?([0-9A-F]{3}){1,2}$/i,rgb:/^rgb\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,rgba:/^rgba\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,hsl:/hsl\(\s*(\d+)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\)/i,hsla:/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(\d*(?:\.\d+)?)\)$/i},tEe={hex:Z0e,rgb:cj,rgba:cj,hsl:lj,hsla:lj};function Vd(t){for(let[,e]of Object.entries(uj))if(e.test(t))return!0;return!1}function Hd(t){if(typeof t!="string")return{h:0,s:0,v:0,a:1};if(t==="transparent")return{h:0,s:0,v:0,a:0};let e=t.trim();for(let[r,o]of Object.entries(uj))if(o.test(e))return tEe[r](e);return{h:0,s:0,v:0,a:1}}var rEe=Object.defineProperty,oEe=Object.defineProperties,nEe=Object.getOwnPropertyDescriptors,Lw=Object.getOwnPropertySymbols,fj=Object.prototype.hasOwnProperty,pj=Object.prototype.propertyIsEnumerable,dj=(t,e,r)=>e in t?rEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,iEe=(t,e)=>{for(var r in e||(e={}))fj.call(e,r)&&dj(t,r,e[r]);if(Lw)for(var r of Lw(e))pj.call(e,r)&&dj(t,r,e[r]);return t},aEe=(t,e)=>oEe(t,nEe(e)),sEe=(t,e)=>{var r={};for(var o in t)fj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Lw)for(var o of Lw(t))e.indexOf(o)<0&&pj.call(t,o)&&(r[o]=t[o]);return r},CP=ee((t,e)=>{var r=t,{value:o,onChange:n,color:i}=r,a=sEe(r,["value","onChange","color"]);let s=dr(),l=s.colorScheme==="dark"?s.colors.dark[4]:s.colors.gray[3];return D.createElement(Z_,aEe(iEe({},a),{ref:e,value:o,onChange:c=>n(Ta(c,2)),maxValue:1,round:!1,overlays:[{backgroundImage:`linear-gradient(45deg, ${l} 25%, transparent 25%), linear-gradient(-45deg, ${l} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${l} 75%), linear-gradient(-45deg, ${s.colorScheme==="dark"?s.colors.dark[7]:s.white} 75%, ${l} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},{backgroundImage:`linear-gradient(90deg, transparent, ${i})`},{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset"}]}))});CP.displayName="@mantine/core/AlphaSlider";X();var lEe={xs:100,sm:110,md:120,lg:140,xl:160},cEe=me((t,{size:e},r)=>{let o=-t.fn.size({size:e,sizes:Ki})/2-1,n={ref:r("saturationThumb")};return{saturationThumb:n,saturation:{boxSizing:"border-box",position:"relative",height:t.fn.size({size:e,sizes:lEe}),borderRadius:t.radius.sm,margin:t.fn.size({size:e,sizes:Ki})/2,WebkitTapHighlightColor:"transparent",[`&:focus .${n.ref}`]:{outline:"none",boxShadow:`0 0 0 1px ${t.colorScheme==="dark"?t.colors.dark[9]:t.white}, 0 0 0 3px ${t.colors[t.primaryColor][t.colorScheme==="dark"?7:5]}`},[`&:focus:not(:focus-visible) .${n.ref}`]:{boxShadow:t.focusRing==="auto"||t.focusRing==="never"?"none":void 0}},saturationOverlay:{position:"absolute",boxSizing:"border-box",borderRadius:t.radius.sm,top:o,left:o,right:o,bottom:o}}}),mj=cEe;function _j({h:t,s:e,v:r,a:o}){let n=t/360*6,i=e/100,a=r/100,s=Math.floor(n),l=a*(1-i),c=a*(1-(n-s)*i),u=a*(1-(1-n+s)*i),d=s%6;return{r:Ta([a,c,l,l,u,a][d]*255),g:Ta([u,a,a,c,l,l][d]*255),b:Ta([l,l,u,a,a,c][d]*255),a:Ta(o,2)}}function hj(t,e){let{r,g:o,b:n,a:i}=_j(t);return e?`rgba(${r}, ${o}, ${n}, ${Ta(i,2)})`:`rgb(${r}, ${o}, ${n})`}function gj({h:t,s:e,v:r,a:o},n){let i=(200-e)*r/100,a={h:Math.round(t),s:Math.round(i>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0),l:Math.round(i/2)};return n?`hsla(${a.h}, ${a.s}%, ${a.l}%, ${Ta(o,2)})`:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}function TP(t){let e=t.toString(16);return e.length<2?`0${e}`:e}function uEe(t){let{r:e,g:r,b:o}=_j(t);return`#${TP(e)}${TP(r)}${TP(o)}`}var kP={hex:uEe,rgb:t=>hj(t,!1),rgba:t=>hj(t,!0),hsl:t=>gj(t,!1),hsla:t=>gj(t,!0)};function Jc(t,e){return e?t in kP?kP[t](e):kP.hex(e):"#000000"}function NP({value:t,onChange:e,focusable:r=!0,__staticSelector:o="saturation",size:n,color:i,saturationLabel:a,classNames:s,styles:l}){let{classes:c}=mj({size:n},{classNames:s,styles:l,name:o}),[u,d]=M({x:t.s/100,y:1-t.v/100}),{ref:f}=R_(({x:g,y:_})=>{e({s:Math.round(g*100),v:Math.round((1-_)*100)})});V(()=>{d({x:t.s/100,y:1-t.v/100})},[t.s,t.v]);let m=(g,_)=>{g.preventDefault();let b=D_(_);e({s:Math.round(b.x*100),v:Math.round((1-b.y)*100)})},h=g=>{switch(g.nativeEvent.code){case"ArrowUp":{m(g,{y:u.y-.05,x:u.x});break}case"ArrowDown":{m(g,{y:u.y+.05,x:u.x});break}case"ArrowRight":{m(g,{x:u.x+.05,y:u.y});break}case"ArrowLeft":{m(g,{x:u.x-.05,y:u.y});break}}};return D.createElement("div",{className:c.saturation,ref:f,role:"slider","aria-label":a,"aria-valuenow":u.x,"aria-valuetext":Jc("rgba",t),tabIndex:r?0:-1,onKeyDown:h},D.createElement("div",{className:c.saturationOverlay,style:{backgroundColor:`hsl(${t.h}, 100%, 50%)`}}),D.createElement("div",{className:c.saturationOverlay,style:{backgroundImage:"linear-gradient(90deg, #fff, transparent)"}}),D.createElement("div",{className:c.saturationOverlay,style:{backgroundImage:"linear-gradient(0deg, #000, transparent)"}}),D.createElement(Q_,{__staticSelector:o,classNames:s,styles:l,position:u,className:c.saturationThumb,style:{backgroundColor:i},size:n}))}NP.displayName="@mantine/core/Saturation";X();var dEe=me((t,{swatchesPerRow:e})=>({swatch:{width:`calc(${100/e}% - 4px)`,height:0,paddingBottom:`calc(${100/e}% - 4px)`,margin:2,boxSizing:"content-box"},swatches:{boxSizing:"border-box",marginLeft:-2,marginRight:-2,display:"flex",flexWrap:"wrap"}})),xj=dEe;var fEe=Object.defineProperty,Fw=Object.getOwnPropertySymbols,yj=Object.prototype.hasOwnProperty,vj=Object.prototype.propertyIsEnumerable,bj=(t,e,r)=>e in t?fEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pEe=(t,e)=>{for(var r in e||(e={}))yj.call(e,r)&&bj(t,r,e[r]);if(Fw)for(var r of Fw(e))vj.call(e,r)&&bj(t,r,e[r]);return t},mEe=(t,e)=>{var r={};for(var o in t)yj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Fw)for(var o of Fw(t))e.indexOf(o)<0&&vj.call(t,o)&&(r[o]=t[o]);return r};function PP(t){var e=t,{data:r,onSelect:o,swatchesPerRow:n=10,focusable:i=!0,classNames:a,styles:s,__staticSelector:l="color-picker"}=e,c=mEe(e,["data","onSelect","swatchesPerRow","focusable","classNames","styles","__staticSelector"]);let{classes:u}=xj({swatchesPerRow:n},{classNames:a,styles:s,name:l}),d=r.map((f,m)=>D.createElement(Ud,{className:u.swatch,component:"button",type:"button",color:f,key:m,radius:"sm",onClick:()=>o(Hd(f)),style:{cursor:"pointer"},"aria-label":f,tabIndex:i?0:-1}));return D.createElement("div",pEe({className:u.swatches},c),d)}PP.displayName="@mantine/core/Swatches";var hEe={xs:180,sm:200,md:240,lg:280,xl:320},gEe=me((t,{size:e,fullWidth:r})=>({preview:{},wrapper:{boxSizing:"border-box",width:r?"100%":t.fn.size({size:e,sizes:hEe}),padding:1},body:{display:"flex",boxSizing:"border-box",paddingTop:t.fn.size({size:e,sizes:t.spacing})/2},sliders:{flex:1,boxSizing:"border-box","&:not(:only-child)":{marginRight:t.spacing.xs}},slider:{boxSizing:"border-box","& + &":{marginTop:5}},swatch:{cursor:"pointer"}})),Ij=gEe;var _Ee=Object.defineProperty,Bw=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Sj=Object.prototype.propertyIsEnumerable,wj=(t,e,r)=>e in t?_Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,OP=(t,e)=>{for(var r in e||(e={}))Ej.call(e,r)&&wj(t,r,e[r]);if(Bw)for(var r of Bw(e))Sj.call(e,r)&&wj(t,r,e[r]);return t},xEe=(t,e)=>{var r={};for(var o in t)Ej.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Bw)for(var o of Bw(t))e.indexOf(o)<0&&Sj.call(t,o)&&(r[o]=t[o]);return r},bEe={xs:26,sm:34,md:42,lg:50,xl:54},yEe={swatchesPerRow:10,size:"sm",withPicker:!0,focusable:!0,__staticSelector:"ColorPicker"},AP=ee((t,e)=>{let r=Ie("ColorPicker",yEe,t),{value:o,defaultValue:n,onChange:i,format:a,swatches:s,swatchesPerRow:l,size:c,withPicker:u,fullWidth:d,focusable:f,__staticSelector:m,saturationLabel:h,hueLabel:g,alphaLabel:_,className:b,styles:y,classNames:v}=r,C=xEe(r,["value","defaultValue","onChange","format","swatches","swatchesPerRow","size","withPicker","fullWidth","focusable","__staticSelector","saturationLabel","hueLabel","alphaLabel","className","styles","classNames"]),{classes:N,cx:I,theme:E}=Ij({size:c,fullWidth:d},{classNames:v,styles:y,name:m}),w=W(a),S=W(null),T=a==="rgba"||a==="hsla",[A,R]=M(!1),[P,B]=Cn({value:o,defaultValue:n,finalValue:"#FFFFFF",rule:G=>Vd(G),onChange:i}),[$,z]=M(Hd(P)),H=G=>{R(!0),z(Y=>{let L=OP(OP({},Y),G);return S.current=Jc(w.current,L),L}),Promise.resolve().then(()=>B(S.current)).then(()=>R(!1))};return V(()=>{Vd(o)&&!A&&z(Hd(o))},[o]),mr(()=>{w.current=a,B(Jc(a,$))},[a]),D.createElement(_e,OP({className:I(N.wrapper,b),ref:e},C),u&&D.createElement(D.Fragment,null,D.createElement(NP,{value:$,onChange:H,color:P,styles:y,classNames:v,size:c,focusable:f,saturationLabel:h,__staticSelector:m}),D.createElement("div",{className:N.body},D.createElement("div",{className:N.sliders},D.createElement(EP,{value:$.h,onChange:G=>H({h:G}),size:c,styles:y,classNames:v,focusable:f,"aria-label":g,__staticSelector:m}),T&&D.createElement(CP,{value:$.a,onChange:G=>H({a:G}),size:c,color:Jc("hex",$),style:{marginTop:6},styles:y,classNames:v,focusable:f,"aria-label":_,__staticSelector:m})),T&&D.createElement(Ud,{color:P,radius:"sm",size:E.fn.size({size:c,sizes:bEe}),className:N.preview}))),Array.isArray(s)&&D.createElement(PP,{data:s,onSelect:H,style:{marginTop:5},swatchesPerRow:l,focusable:f,classNames:v,styles:y,__staticSelector:m}))});AP.displayName="@mantine/core/ColorPicker";var vEe=me((t,{disallowInput:e})=>({dropdownBody:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`},input:{cursor:e?"pointer":void 0}})),Cj=vEe;var IEe=Object.defineProperty,wEe=Object.defineProperties,EEe=Object.getOwnPropertyDescriptors,zw=Object.getOwnPropertySymbols,Nj=Object.prototype.hasOwnProperty,Pj=Object.prototype.propertyIsEnumerable,Tj=(t,e,r)=>e in t?IEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$w=(t,e)=>{for(var r in e||(e={}))Nj.call(e,r)&&Tj(t,r,e[r]);if(zw)for(var r of zw(e))Pj.call(e,r)&&Tj(t,r,e[r]);return t},kj=(t,e)=>wEe(t,EEe(e)),SEe=(t,e)=>{var r={};for(var o in t)Nj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&zw)for(var o of zw(t))e.indexOf(o)<0&&Pj.call(t,o)&&(r[o]=t[o]);return r},CEe={xs:16,sm:18,md:22,lg:28,xl:36},TEe={xs:12,sm:15,md:17,lg:21,xl:25},kEe={size:"sm",format:"hex",fixOnBlur:!0,withPreview:!0,swatchesPerRow:10,withPicker:!0,transition:"pop-top-left",dropdownZIndex:Ar("popover"),transitionDuration:0,withinPortal:!0},Uw=ee((t,e)=>{let r=Ie("ColorInput",kEe,t),{label:o,description:n,error:i,required:a,wrapperProps:s,size:l,format:c,onChange:u,onFocus:d,onBlur:f,value:m,defaultValue:h,classNames:g,styles:_,disallowInput:b,fixOnBlur:y,withPreview:v,swatchesPerRow:C,withPicker:N,icon:I,transition:E,id:w,dropdownZIndex:S,transitionDuration:T,transitionTimingFunction:A,withinPortal:R,className:P,style:B,swatches:$,sx:z,errorProps:H,labelProps:G,descriptionProps:Y}=r,L=SEe(r,["label","description","error","required","wrapperProps","size","format","onChange","onFocus","onBlur","value","defaultValue","classNames","styles","disallowInput","fixOnBlur","withPreview","swatchesPerRow","withPicker","icon","transition","id","dropdownZIndex","transitionDuration","transitionTimingFunction","withinPortal","className","style","swatches","sx","errorProps","labelProps","descriptionProps"]),{classes:ne,cx:ae,theme:U}=Cj({disallowInput:b},{classNames:g,styles:_,name:"ColorInput"}),{systemStyles:ge,rest:Ce}=so(L),He=lo(w),[Qe,Me]=M(null),[ke,at]=M(!1),[Rt,ut]=M(""),[ht,bt]=Cn({value:m,defaultValue:h,finalValue:"",rule:ye=>typeof ye=="string",onChange:u}),Xr=ye=>{typeof d=="function"&&d(ye),at(!0)},Mt=ye=>{typeof f=="function"&&f(ye),at(!1),y&&bt(Rt)};return V(()=>{(Vd(ht)||ht.trim()==="")&&ut(ht)},[ht]),mr(()=>{Vd(ht)&&bt(Jc(c,Hd(ht)))},[c]),D.createElement(kn,$w($w({label:o,description:n,error:i,required:a,classNames:g,styles:_,size:l,id:He,className:P,style:B,__staticSelector:"ColorInput",sx:z,errorProps:H,descriptionProps:Y,labelProps:G},ge),s),D.createElement("div",{ref:Me},D.createElement(Sa,kj($w({},Ce),{ref:e,__staticSelector:"ColorInput",id:He,onFocus:Xr,onBlur:Mt,spellCheck:!1,size:l,value:ht,onChange:ye=>bt(ye.currentTarget.value),invalid:!!i,required:a,autoComplete:"nope",icon:I||(v?D.createElement(Ud,{color:Vd(ht)?ht:"#fff",size:U.fn.size({size:l,sizes:CEe})}):null),readOnly:b,classNames:kj($w({},g),{input:ae(ne.input,g?.input)}),styles:_}))),D.createElement(Vl,{referenceElement:Qe,transitionDuration:T,transitionTimingFunction:A,transition:E,mounted:ke,position:"bottom",placement:"start",gutter:5,arrowSize:3,zIndex:S,arrowStyle:{left:U.fn.size({size:l,sizes:TEe})},withinPortal:R},D.createElement("div",{style:{pointerEvents:"all"}},D.createElement(Hl,{shadow:"sm",p:l,className:ne.dropdownBody,onMouseDown:ye=>ye.preventDefault()},D.createElement(AP,{__staticSelector:"ColorInput",value:ht,onChange:bt,format:c,swatches:$,swatchesPerRow:C,withPicker:N,size:l,focusable:!1,styles:_,classNames:g})))))});Uw.displayName="@mantine/core/ColorInput";X();var NEe=Object.defineProperty,Vw=Object.getOwnPropertySymbols,Aj=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,Oj=(t,e,r)=>e in t?NEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PEe=(t,e)=>{for(var r in e||(e={}))Aj.call(e,r)&&Oj(t,r,e[r]);if(Vw)for(var r of Vw(e))Dj.call(e,r)&&Oj(t,r,e[r]);return t},OEe=(t,e)=>{var r={};for(var o in t)Aj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Vw)for(var o of Vw(t))e.indexOf(o)<0&&Dj.call(t,o)&&(r[o]=t[o]);return r};function DP(t){var e=t,{withinPortal:r=!0,children:o}=e,n=OEe(e,["withinPortal","children"]);return r?D.createElement(jc,PEe({},n),o):D.createElement(D.Fragment,null,o)}DP.displayName="@mantine/core/OptionalPortal";X();function RP({transitions:t,duration:e=250,exitDuration:r=e,mounted:o,children:n,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c}){let{transitionDuration:u,transitionStatus:d,transitionTimingFunction:f}=mw({mounted:o,duration:e,exitDuration:r,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c});if(u===0)return o?D.createElement(D.Fragment,null,n({})):null;if(d==="exited")return null;let m=Object.keys(t).reduce((h,g)=>(h[g]=pw({duration:t[g].duration,transition:t[g].transition,timingFunction:t[g].timingFunction||f,state:d}),h),{});return D.createElement(D.Fragment,null,n(m))}RP.displayName="@mantine/core/GroupedTransition";X();var AEe=Object.defineProperty,DEe=Object.defineProperties,REe=Object.getOwnPropertyDescriptors,Hw=Object.getOwnPropertySymbols,Lj=Object.prototype.hasOwnProperty,Fj=Object.prototype.propertyIsEnumerable,Rj=(t,e,r)=>e in t?AEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ex=(t,e)=>{for(var r in e||(e={}))Lj.call(e,r)&&Rj(t,r,e[r]);if(Hw)for(var r of Hw(e))Fj.call(e,r)&&Rj(t,r,e[r]);return t},Mj=(t,e)=>DEe(t,REe(e)),MEe=(t,e)=>{var r={};for(var o in t)Lj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Hw)for(var o of Hw(t))e.indexOf(o)<0&&Fj.call(t,o)&&(r[o]=t[o]);return r},LEe={opacity:.6,color:"#fff",zIndex:Ar("modal"),radius:0,blur:0},tx=ee((t,e)=>{let r=Ie("Overlay",LEe,t),{opacity:o,blur:n,color:i,gradient:a,zIndex:s,component:l,radius:c,sx:u}=r,d=MEe(r,["opacity","blur","color","gradient","zIndex","component","radius","sx"]),f=a?{backgroundImage:a}:{backgroundColor:i},m={position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:s},h=g=>D.createElement(_e,ex({component:l||"div",ref:e,sx:[_=>Mj(ex(ex({},f),m),{opacity:o,borderRadius:_.fn.size({size:c,sizes:_.radius})}),...Array.isArray(u)?u:[u]]},g));return n?D.createElement(_e,ex({sx:[()=>Mj(ex({},m),{backdropFilter:`blur(${n}px)`}),...Array.isArray(u)?u:[u]]},d),h()):h(d)});tx.displayName="@mantine/core/Overlay";X();X();var FEe=Object.defineProperty,Bj=Object.getOwnPropertySymbols,BEe=Object.prototype.hasOwnProperty,$Ee=Object.prototype.propertyIsEnumerable,$j=(t,e,r)=>e in t?FEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zEe=(t,e)=>{for(var r in e||(e={}))BEe.call(e,r)&&$j(t,r,e[r]);if(Bj)for(var r of Bj(e))$Ee.call(e,r)&&$j(t,r,e[r]);return t};function zj(t){return D.createElement("svg",zEe({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var UEe=Object.defineProperty,VEe=Object.defineProperties,HEe=Object.getOwnPropertyDescriptors,Uj=Object.getOwnPropertySymbols,jEe=Object.prototype.hasOwnProperty,GEe=Object.prototype.propertyIsEnumerable,Vj=(t,e,r)=>e in t?UEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hj=(t,e)=>{for(var r in e||(e={}))jEe.call(e,r)&&Vj(t,r,e[r]);if(Uj)for(var r of Uj(e))GEe.call(e,r)&&Vj(t,r,e[r]);return t},jj=(t,e)=>VEe(t,HEe(e)),WEe=me((t,{radius:e})=>({root:{},imageWrapper:{position:"relative"},figure:{margin:0},image:jj(Hj({},t.fn.fontStyles()),{display:"block",width:"100%",height:"100%",border:0,borderRadius:t.fn.size({size:e,sizes:t.radius})}),caption:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[7],marginTop:t.spacing.xs},placeholder:jj(Hj({},t.fn.cover()),{display:"flex",alignItems:"center",justifyContent:"center",color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.colors.gray[0],borderRadius:t.fn.size({size:e,sizes:t.radius})})})),Gj=WEe;var qEe=Object.defineProperty,jw=Object.getOwnPropertySymbols,Kj=Object.prototype.hasOwnProperty,Yj=Object.prototype.propertyIsEnumerable,Wj=(t,e,r)=>e in t?qEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qj=(t,e)=>{for(var r in e||(e={}))Kj.call(e,r)&&Wj(t,r,e[r]);if(jw)for(var r of jw(e))Yj.call(e,r)&&Wj(t,r,e[r]);return t},KEe=(t,e)=>{var r={};for(var o in t)Kj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&jw)for(var o of jw(t))e.indexOf(o)<0&&Yj.call(t,o)&&(r[o]=t[o]);return r},YEe={fit:"cover",width:"100%",height:"auto",radius:0},Qc=ee((t,e)=>{let r=Ie("Image",YEe,t),{className:o,alt:n,src:i,fit:a,width:s,height:l,radius:c,imageProps:u,withPlaceholder:d,placeholder:f,imageRef:m,classNames:h,styles:g,caption:_}=r,b=KEe(r,["className","alt","src","fit","width","height","radius","imageProps","withPlaceholder","placeholder","imageRef","classNames","styles","caption"]),{classes:y,cx:v}=Gj({radius:c},{classNames:h,styles:g,name:"Image"}),[C,N]=M(!1),[I,E]=M(!i),w=d&&(!C||I);return mr(()=>{N(!1),E(!1)},[i]),D.createElement(_e,qj({className:v(y.root,o),ref:e},b),D.createElement("figure",{className:y.figure},D.createElement("div",{className:y.imageWrapper},D.createElement("img",qj({className:y.image,src:i,alt:n,style:{objectFit:a,width:s,height:l},ref:m,onLoad:S=>{N(!0),typeof u?.onLoad=="function"&&u.onLoad(S)},onError:S=>{E(!0),typeof u?.onError=="function"&&u.onError(S)}},u)),w&&D.createElement("div",{className:y.placeholder,title:n},f||D.createElement(zj,{style:{width:40,height:40}}))),!!_&&D.createElement(Gr,{component:"figcaption",size:"sm",align:"center",className:y.caption},_)))});Qc.displayName="@mantine/core/Image";function MP(t){if(typeof t=="string"&&t.trim().length===0)return!0;try{return JSON.parse(t),!0}catch{return!1}}X();var XEe=me((t,{size:e})=>({input:{fontFamily:t.fontFamilyMonospace,fontSize:t.fn.size({size:e,sizes:t.fontSizes})-2}})),Xj=XEe;X();function jd(t,e){if(t==null)return{};var r={},o=Object.keys(t),n,i;for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&(r[n]=t[n]);return r}X();X();X();var JEe=Ft,Jj=JEe;var Qj=function(e){var r=W(e);return Jj(function(){r.current=e}),r};X();var Zj=function(e,r){if(typeof e=="function"){e(r);return}e.current=r},QEe=function(e,r){var o=W();return qe(function(n){e.current=n,o.current&&Zj(o.current,null),o.current=r,r&&Zj(r,n)},[r])},eG=QEe;var tG={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},rG=function(e){Object.keys(tG).forEach(function(r){e.style.setProperty(r,tG[r],"important")})},Yi=null,ZEe=function(e,r){var o=e.scrollHeight;return r.sizingStyle.boxSizing==="border-box"?o+r.borderSize:o-r.paddingSize};function eSe(t,e,r,o){r===void 0&&(r=1),o===void 0&&(o=1/0),Yi||(Yi=document.createElement("textarea"),Yi.setAttribute("tabindex","-1"),Yi.setAttribute("aria-hidden","true"),rG(Yi)),Yi.parentNode===null&&document.body.appendChild(Yi);var n=t.paddingSize,i=t.borderSize,a=t.sizingStyle,s=a.boxSizing;Object.keys(a).forEach(function(f){var m=f;Yi.style[m]=a[m]}),rG(Yi),Yi.value=e;var l=ZEe(Yi,t);Yi.value="x";var c=Yi.scrollHeight-n,u=c*r;s==="border-box"&&(u=u+n+i),l=Math.max(u,l);var d=c*o;return s==="border-box"&&(d=d+n+i),l=Math.min(d,l),[l,c]}var oG=function(){},tSe=function(e,r){return e.reduce(function(o,n){return o[n]=r[n],o},{})},rSe=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],oSe=!!document.documentElement.currentStyle,nSe=function(e){var r=window.getComputedStyle(e);if(r===null)return null;var o=tSe(rSe,r),n=o.boxSizing;if(n==="")return null;oSe&&n==="border-box"&&(o.width=parseFloat(o.width)+parseFloat(o.borderRightWidth)+parseFloat(o.borderLeftWidth)+parseFloat(o.paddingRight)+parseFloat(o.paddingLeft)+"px");var i=parseFloat(o.paddingBottom)+parseFloat(o.paddingTop),a=parseFloat(o.borderBottomWidth)+parseFloat(o.borderTopWidth);return{sizingStyle:o,paddingSize:i,borderSize:a}},iSe=function(e){var r=Qj(e);Ft(function(){var o=function(i){r.current(i)};return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}},[])},aSe=function(e,r){var o=e.cacheMeasurements,n=e.maxRows,i=e.minRows,a=e.onChange,s=a===void 0?oG:a,l=e.onHeightChange,c=l===void 0?oG:l,u=jd(e,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),d=u.value!==void 0,f=W(null),m=eG(f,r),h=W(0),g=W(),_=function(){var v=f.current,C=o&&g.current?g.current:nSe(v);if(C){g.current=C;var N=eSe(C,v.value||v.placeholder||"x",i,n),I=N[0],E=N[1];h.current!==I&&(h.current=I,v.style.setProperty("height",I+"px","important"),c(I,{rowHeight:E}))}},b=function(v){d||_(),s(v)};return Ft(_),iSe(_),ce("textarea",pr({},u,{onChange:b,ref:m}))},sSe=ee(aSe),nG=sSe;var lSe=me(t=>({input:{paddingTop:t.spacing.xs,paddingBottom:t.spacing.xs}})),iG=lSe;var cSe=Object.defineProperty,uSe=Object.defineProperties,dSe=Object.getOwnPropertyDescriptors,Gw=Object.getOwnPropertySymbols,sG=Object.prototype.hasOwnProperty,lG=Object.prototype.propertyIsEnumerable,aG=(t,e,r)=>e in t?cSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wm=(t,e)=>{for(var r in e||(e={}))sG.call(e,r)&&aG(t,r,e[r]);if(Gw)for(var r of Gw(e))lG.call(e,r)&&aG(t,r,e[r]);return t},LP=(t,e)=>uSe(t,dSe(e)),fSe=(t,e)=>{var r={};for(var o in t)sG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Gw)for(var o of Gw(t))e.indexOf(o)<0&&lG.call(t,o)&&(r[o]=t[o]);return r},pSe={autosize:!1,size:"sm",__staticSelector:"Textarea"},yr=ee((t,e)=>{let r=Ie("Textarea",pSe,t),{autosize:o,maxRows:n,minRows:i,label:a,error:s,description:l,id:c,className:u,required:d,style:f,wrapperProps:m,classNames:h,styles:g,size:_,__staticSelector:b,sx:y,errorProps:v,descriptionProps:C,labelProps:N}=r,I=fSe(r,["autosize","maxRows","minRows","label","error","description","id","className","required","style","wrapperProps","classNames","styles","size","__staticSelector","sx","errorProps","descriptionProps","labelProps"]),E=lo(c),{classes:w,cx:S}=iG(),{systemStyles:T,rest:A}=so(I),R=wm({required:d,ref:e,invalid:!!s,id:E,classNames:LP(wm({},h),{input:S(w.input,h?.input)}),styles:g,__staticSelector:b,size:_,multiline:!0},A);return D.createElement(kn,wm(wm({label:a,error:s,id:E,description:l,required:d,style:f,className:u,classNames:h,styles:g,size:_,__staticSelector:b,sx:y,errorProps:v,labelProps:N,descriptionProps:C},T),m),o?D.createElement(Sa,LP(wm({},R),{component:nG,maxRows:n,minRows:i})):D.createElement(Sa,LP(wm({},R),{component:"textarea",rows:i})))});yr.displayName="@mantine/core/Textarea";var mSe=Object.defineProperty,hSe=Object.defineProperties,gSe=Object.getOwnPropertyDescriptors,Ww=Object.getOwnPropertySymbols,dG=Object.prototype.hasOwnProperty,fG=Object.prototype.propertyIsEnumerable,cG=(t,e,r)=>e in t?mSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uG=(t,e)=>{for(var r in e||(e={}))dG.call(e,r)&&cG(t,r,e[r]);if(Ww)for(var r of Ww(e))fG.call(e,r)&&cG(t,r,e[r]);return t},_Se=(t,e)=>hSe(t,gSe(e)),xSe=(t,e)=>{var r={};for(var o in t)dG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ww)for(var o of Ww(t))e.indexOf(o)<0&&fG.call(t,o)&&(r[o]=t[o]);return r},bSe={formatOnBlur:!1,size:"sm"},Zc=ee((t,e)=>{let r=Ie("JsonInput",bSe,t),{value:o,defaultValue:n,onChange:i,onFocus:a,onBlur:s,error:l,formatOnBlur:c,size:u,validationError:d,classNames:f}=r,m=xSe(r,["value","defaultValue","onChange","onFocus","onBlur","error","formatOnBlur","size","validationError","classNames"]),{classes:h,cx:g}=Xj({size:u},{name:"JsonInput"}),[_,b]=Cn({value:o,defaultValue:n,finalValue:"",rule:I=>typeof I=="string",onChange:i}),[y,v]=M(MP(_)),C=I=>{typeof a=="function"&&a(I),v(!0)},N=I=>{typeof s=="function"&&s(I);let E=MP(I.currentTarget.value);c&&E&&I.currentTarget.value.trim()!==""&&b(JSON.stringify(JSON.parse(I.currentTarget.value),null,2)),v(E)};return D.createElement(yr,uG({value:_,onChange:I=>b(I.currentTarget.value),onFocus:C,onBlur:N,error:y?l:d||!0,__staticSelector:"JsonInput",classNames:_Se(uG({},f),{input:g(h.input,f?.input)}),autoComplete:"nope",ref:e},m))});Zc.displayName="@mantine/core/JsonInput";X();var ySe=me({root:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}}),pG=ySe;var vSe=Object.defineProperty,ISe=Object.defineProperties,wSe=Object.getOwnPropertyDescriptors,Kw=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,gG=Object.prototype.propertyIsEnumerable,mG=(t,e,r)=>e in t?vSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qw=(t,e)=>{for(var r in e||(e={}))hG.call(e,r)&&mG(t,r,e[r]);if(Kw)for(var r of Kw(e))gG.call(e,r)&&mG(t,r,e[r]);return t},ESe=(t,e)=>ISe(t,wSe(e)),SSe=(t,e)=>{var r={};for(var o in t)hG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Kw)for(var o of Kw(t))e.indexOf(o)<0&&gG.call(t,o)&&(r[o]=t[o]);return r},CSe={overlayOpacity:.75,transitionDuration:200,zIndex:Ar("overlay")},ka=ee((t,e)=>{let r=Ie("LoadingOverlay",CSe,t),{className:o,visible:n,loaderProps:i,overlayOpacity:a,overlayColor:s,transitionDuration:l,exitTransitionDuration:c,zIndex:u,style:d,loader:f,radius:m,classNames:h,styles:g}=r,_=SSe(r,["className","visible","loaderProps","overlayOpacity","overlayColor","transitionDuration","exitTransitionDuration","zIndex","style","loader","radius","classNames","styles"]),{classes:b,cx:y,theme:v}=pG(null,{name:"LoadingOverlay",classNames:h,styles:g});return D.createElement(G_,{duration:l,exitDuration:c,mounted:n,transition:"fade"},C=>D.createElement(_e,qw({className:y(b.root,o),style:ESe(qw(qw({},C),d),{zIndex:u}),ref:e},_),f?D.createElement("div",{style:{zIndex:u+1}},f):D.createElement(Ze,qw({style:{zIndex:u+1}},i)),D.createElement(tx,{opacity:a,zIndex:u,radius:m,color:s||(v.colorScheme==="dark"?v.colors.dark[5]:v.white)})))});ka.displayName="@mantine/core/LoadingOverlay";X();X();var TSe=Object.defineProperty,_G=Object.getOwnPropertySymbols,kSe=Object.prototype.hasOwnProperty,NSe=Object.prototype.propertyIsEnumerable,xG=(t,e,r)=>e in t?TSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PSe=(t,e)=>{for(var r in e||(e={}))kSe.call(e,r)&&xG(t,r,e[r]);if(_G)for(var r of _G(e))NSe.call(e,r)&&xG(t,r,e[r]);return t};function bG(t){return D.createElement("svg",PSe({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}X();var[yG,Yw]=bV(null);var OSe=Object.defineProperty,ASe=Object.defineProperties,DSe=Object.getOwnPropertyDescriptors,vG=Object.getOwnPropertySymbols,RSe=Object.prototype.hasOwnProperty,MSe=Object.prototype.propertyIsEnumerable,IG=(t,e,r)=>e in t?OSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,LSe=(t,e)=>{for(var r in e||(e={}))RSe.call(e,r)&&IG(t,r,e[r]);if(vG)for(var r of vG(e))MSe.call(e,r)&&IG(t,r,e[r]);return t},FSe=(t,e)=>ASe(t,DSe(e)),BSe=me((t,{radius:e,color:r})=>({item:FSe(LSe({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:t.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",display:"inline-block",textDecoration:"none",boxSizing:"border-box",padding:`${t.spacing.xs}px ${t.spacing.sm}px`,cursor:"pointer",borderRadius:t.fn.size({size:e,sizes:t.radius}),color:r?t.fn.themeColor(r,t.colorScheme==="dark"?5:7):t.colorScheme==="dark"?t.colors.dark[0]:t.black,"&:disabled":{color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5],pointerEvents:"none"}}),itemHovered:{backgroundColor:r?t.fn.variant({variant:"light",color:r}).background:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[3],.35):t.colors.gray[0]},itemInner:{display:"flex",alignItems:"center",height:"100%"},itemBody:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},itemIcon:{marginRight:t.spacing.xs,"& *":{display:"block"}},itemLabel:{lineHeight:1}})),wG=BSe;var $Se=Object.defineProperty,Xw=Object.getOwnPropertySymbols,SG=Object.prototype.hasOwnProperty,CG=Object.prototype.propertyIsEnumerable,EG=(t,e,r)=>e in t?$Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zSe=(t,e)=>{for(var r in e||(e={}))SG.call(e,r)&&EG(t,r,e[r]);if(Xw)for(var r of Xw(e))CG.call(e,r)&&EG(t,r,e[r]);return t},USe=(t,e)=>{var r={};for(var o in t)SG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Xw)for(var o of Xw(t))e.indexOf(o)<0&&CG.call(t,o)&&(r[o]=t[o]);return r},VSe=ee((t,e)=>{var r=t,{className:o,children:n,icon:i,color:a,disabled:s,rightSection:l,component:c,onClick:u}=r,d=USe(r,["className","children","icon","color","disabled","rightSection","component","onClick"]);let f=W(),{hovered:m,onItemHover:h,radius:g,onItemKeyDown:_,classNames:b,styles:y,onItemClick:v}=Yw("Menu.Item"),{classes:C,cx:N}=wG({color:a,radius:g},{classNames:b,styles:y,name:"Menu"}),I=xV({elementSelector:".mantine-Menu-item",parentClassName:"mantine-Menu-body"},f.current);return D.createElement(_e,zSe({component:c||"button",type:"button",role:"menuitem",className:N(C.item,{[C.itemHovered]:m===I},o),onMouseEnter:()=>!s&&h(I),onMouseLeave:()=>h(-1),onKeyDown:_,ref:kd(e,f),disabled:s,onClick:E=>{typeof u=="function"&&u(E),v()}},d),D.createElement("div",{className:C.itemInner},i&&D.createElement("div",{className:C.itemIcon},i),D.createElement("div",{className:C.itemBody},D.createElement("div",{className:C.itemLabel},n),l)))}),FP=VSe;FP.displayName="@mantine/core/MenuItem";X();var HSe=me(t=>({label:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],fontWeight:500,fontSize:t.fontSizes.xs,padding:`${t.spacing.xs/2}px ${t.spacing.sm}px`,cursor:"default"}})),TG=HSe;var jSe=Object.defineProperty,kG=Object.getOwnPropertySymbols,GSe=Object.prototype.hasOwnProperty,WSe=Object.prototype.propertyIsEnumerable,NG=(t,e,r)=>e in t?jSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qSe=(t,e)=>{for(var r in e||(e={}))GSe.call(e,r)&&NG(t,r,e[r]);if(kG)for(var r of kG(e))WSe.call(e,r)&&NG(t,r,e[r]);return t};function BP(t){let{classNames:e,styles:r}=Yw("Menu.Label"),{classes:o}=TG(null,{name:"Menu",classNames:e,styles:r});return D.createElement(Gr,qSe({className:o.label},t))}BP.displayName="@mantine/core/MenuLabel";var KSe={xs:120,sm:160,md:200,lg:240,xl:300},PG=4,YSe=me((t,{size:e})=>({root:{display:"inline-block",position:"relative"},arrow:{borderColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2],background:t.colorScheme==="dark"?t.colors.dark[6]:t.white},body:{width:t.fn.size({size:e,sizes:KSe}),overflow:"hidden",pointerEvents:"all",border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,padding:PG,"& .mantine-Divider-horizontal":{margin:`${t.spacing.xs/2}px -${PG}px`,borderTopColor:t.colorScheme==="dark"?t.colors.dark[7]:t.colors.gray[2]}},label:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],fontWeight:500,fontSize:t.fontSizes.xs,padding:`${t.spacing.xs/2}px ${t.spacing.sm}px`,cursor:"default"}})),OG=YSe;var XSe=Object.defineProperty,JSe=Object.defineProperties,QSe=Object.getOwnPropertyDescriptors,Jw=Object.getOwnPropertySymbols,DG=Object.prototype.hasOwnProperty,RG=Object.prototype.propertyIsEnumerable,AG=(t,e,r)=>e in t?XSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$P=(t,e)=>{for(var r in e||(e={}))DG.call(e,r)&&AG(t,r,e[r]);if(Jw)for(var r of Jw(e))RG.call(e,r)&&AG(t,r,e[r]);return t},ZSe=(t,e)=>JSe(t,QSe(e)),eCe=(t,e)=>{var r={};for(var o in t)DG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Jw)for(var o of Jw(t))e.indexOf(o)<0&&RG.call(t,o)&&(r[o]=t[o]);return r},tCe=D.createElement(Je,null,D.createElement(bG,null));function rCe(t,e){for(let r=t+1;r<e.length;r+=1)if(!e[r].disabled)return r;return t}function oCe(t){for(let e=0;e<t.length;e+=1)if(!t[e].disabled)return e;return-1}function nCe(t,e){for(let r=t-1;r>=0;r-=1)if(!e[r].disabled)return r;return e[t]?t:oCe(e)}var iCe={control:tCe,closeOnItemClick:!0,transitionDuration:150,size:"md",shadow:"md",position:"bottom",placement:"start",gutter:5,withArrow:!1,transition:"pop-top-left",controlRefProp:"ref",trigger:"click",radius:"sm",delay:100,zIndex:Ar("popover"),withinPortal:!0,trapFocus:!0,closeOnScroll:!1,clickOutsideEvents:["mousedown","touchstart"]},je=ee((t,e)=>{let r=Ie("Menu",iCe,t),{control:o,children:n,onClose:i,onOpen:a,opened:s,menuId:l,closeOnItemClick:c,transitionDuration:u,size:d,shadow:f,position:m,placement:h,gutter:g,withArrow:_,transition:b,transitionTimingFunction:y,menuButtonLabel:v,controlRefProp:C,trigger:N,radius:I,delay:E,zIndex:w,withinPortal:S,trapFocus:T,classNames:A,styles:R,closeOnScroll:P,onMouseLeave:B,onMouseEnter:$,onChange:z,className:H,sx:G,clickOutsideEvents:Y}=r,L=eCe(r,["control","children","onClose","onOpen","opened","menuId","closeOnItemClick","transitionDuration","size","shadow","position","placement","gutter","withArrow","transition","transitionTimingFunction","menuButtonLabel","controlRefProp","trigger","radius","delay","zIndex","withinPortal","trapFocus","classNames","styles","closeOnScroll","onMouseLeave","onMouseEnter","onChange","className","sx","clickOutsideEvents"]),[ne,ae]=M(-1),{classes:U,cx:ge}=OG({size:d},{classNames:A,styles:R,name:"Menu"}),Ce=W(),[He,Qe]=M(null),[Me,ke]=M(null),[at,Rt]=M(null),ut=lo(l),ht=()=>window.setTimeout(()=>He?.focus(),0),[bt,Xr]=Cn({value:s,defaultValue:!1,finalValue:!1,rule:j=>typeof j=="boolean",onChange:j=>j?typeof a=="function"&&a():typeof i=="function"&&i()}),Mt=W(bt),ye=()=>{Mt.current&&(Mt.current=!1,Xr(!1))},dn=()=>{Mt.current=!0,Xr(!0)};Ll("scroll",()=>P&&ye()),DN(()=>bt&&ye(),Y,[at,Me]);let Ut=()=>{bt?ye():dn()},pt=N==="click"?{onClick:Ut}:{onMouseEnter:dn,onClick:Ut},Ur=j=>{typeof B=="function"&&B(j),N==="hover"&&(E>0?Ce.current=window.setTimeout(()=>ye(),E):ye())},Vr=j=>{typeof $=="function"&&$(j),window.clearTimeout(Ce.current)},Do=j=>{if(bt){let Q=Array.from(at.querySelectorAll(".mantine-Menu-item"));if(j.nativeEvent.code==="Tab"&&T&&j.preventDefault(),j.nativeEvent.code==="ArrowDown"){j.preventDefault();let se=rCe(ne,Q);ae(se),Q[se].focus()}if(j.nativeEvent.code==="ArrowUp"){j.preventDefault();let se=nCe(ne,Q);ae(se),Q[se].focus()}j.nativeEvent.code==="Escape"&&(ye(),ht())}},Be=Gi(o,ZSe($P({},pt),{onClick:j=>{pt.onClick(),typeof o.props.onClick=="function"&&o.props.onClick(j)},role:"button","aria-haspopup":"menu","aria-expanded":bt,"aria-controls":ut,"aria-label":v,title:v,[C]:Sn(Qe,e),onKeyDown:Do})),ie=()=>{c&&(ye(),N==="click"&&ht())};return D.createElement(yG,{value:{hovered:ne,radius:I,styles:R,classNames:A,onItemHover:ae,onItemKeyDown:Do,onItemClick:ie}},D.createElement(_e,$P({ref:ke,onMouseLeave:Ur,onMouseEnter:Vr,className:ge(U.root,H),sx:G},L),Be,D.createElement(Vl,{referenceElement:He,transitionDuration:u,transitionTimingFunction:y,transition:b,mounted:bt,position:m,placement:h,gutter:g,withArrow:_,arrowSize:3,zIndex:w,arrowClassName:U.arrow,withinPortal:S},D.createElement(Hl,$P({shadow:f,className:U.body,role:"menu","aria-orientation":"vertical",radius:I,onMouseLeave:()=>ae(-1),ref:Rt,id:ut},L),n))))});je.Item=FP;je.Label=BP;je.displayName="@mantine/core/Menu";var aCe={xs:320,sm:380,md:440,lg:620,xl:780,full:"100%"},sCe=me((t,{overflow:e,size:r,centered:o,zIndex:n})=>({close:{},overlay:{},root:{position:"fixed",zIndex:n,top:0,left:0,right:0,bottom:0},inner:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto",padding:`${t.spacing.xl*2}px ${t.spacing.md}px`,display:"flex",justifyContent:"center",alignItems:o?"center":"flex-start"},title:{marginRight:t.spacing.md,textOverflow:"ellipsis",display:"block",wordBreak:"break-word"},modal:{position:"relative",width:t.fn.size({sizes:aCe,size:r}),outline:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.white,marginTop:o?"auto":void 0,marginBottom:o?"auto":void 0,zIndex:1,marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:t.spacing.md,marginRight:-9},body:{maxHeight:e==="inside"?"calc(100vh - 185px)":null,overflowY:e==="inside"?"auto":null,wordBreak:"break-word"}})),MG=sCe;X();var lCe=Object.defineProperty,Qw=Object.getOwnPropertySymbols,FG=Object.prototype.hasOwnProperty,BG=Object.prototype.propertyIsEnumerable,LG=(t,e,r)=>e in t?lCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cCe=(t,e)=>{for(var r in e||(e={}))FG.call(e,r)&&LG(t,r,e[r]);if(Qw)for(var r of Qw(e))BG.call(e,r)&&LG(t,r,e[r]);return t},uCe=(t,e)=>{var r={};for(var o in t)FG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Qw)for(var o of Qw(t))e.indexOf(o)<0&&BG.call(t,o)&&(r[o]=t[o]);return r},dCe={size:"md",transitionDuration:250,overflow:"outside",transition:"pop",padding:"lg",shadow:"lg",closeOnClickOutside:!0,closeOnEscape:!0,trapFocus:!0,withCloseButton:!0,withinPortal:!0,overlayBlur:0,zIndex:Ar("modal")};function eu(t){let e=Ie("Modal",dCe,t),{className:r,opened:o,title:n,onClose:i,children:a,withCloseButton:s,overlayOpacity:l,size:c,transitionDuration:u,closeButtonLabel:d,overlayColor:f,overflow:m,transition:h,padding:g,shadow:_,radius:b,id:y,classNames:v,styles:C,closeOnClickOutside:N,trapFocus:I,closeOnEscape:E,centered:w,target:S,withinPortal:T,zIndex:A,overlayBlur:R,transitionTimingFunction:P}=e,B=uCe(e,["className","opened","title","onClose","children","withCloseButton","overlayOpacity","size","transitionDuration","closeButtonLabel","overlayColor","overflow","transition","padding","shadow","radius","id","classNames","styles","closeOnClickOutside","trapFocus","closeOnEscape","centered","target","withinPortal","zIndex","overlayBlur","transitionTimingFunction"]),$=lo(y),z=`${$}-title`,H=`${$}-body`,{classes:G,cx:Y,theme:L}=MG({size:c,overflow:m,centered:w,zIndex:A},{classNames:v,styles:C,name:"Modal"}),ne=FN(I&&o),ae=typeof l=="number"?l:L.colorScheme==="dark"?.85:.75,[,U]=UN(),ge=Ce=>{!I&&Ce.code==="Escape"&&E&&i()};return V(()=>{if(!I)return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[I]),RN({opened:o,transitionDuration:0,shouldReturnFocus:I}),D.createElement(DP,{withinPortal:T,zIndex:A,target:S},D.createElement(RP,{onExited:()=>U(!1),onEntered:()=>U(!0),mounted:o,duration:u,exitDuration:u,timingFunction:P,transitions:{modal:{duration:u,transition:h},overlay:{duration:u/2,transition:"fade",timingFunction:"ease"}}},Ce=>D.createElement(_e,cCe({id:$,className:Y(G.root,r)},B),D.createElement("div",{className:G.inner,onKeyDownCapture:He=>{var Qe;((Qe=He.target)==null?void 0:Qe.getAttribute("data-mantine-stop-propagation"))!=="true"&&He.nativeEvent.code==="Escape"&&E&&i()},ref:ne},D.createElement(Hl,{className:G.modal,shadow:_,p:g,radius:b,role:"dialog","aria-labelledby":z,"aria-describedby":H,"aria-modal":!0,tabIndex:-1,style:Ce.modal},(n||s)&&D.createElement("div",{className:G.header},D.createElement(Gr,{id:z,className:G.title},n),s&&D.createElement(Fl,{iconSize:16,onClick:i,"aria-label":d,className:G.close})),D.createElement("div",{id:H,className:G.body},a)),D.createElement("div",{style:Ce.overlay},D.createElement(tx,{className:G.overlay,sx:{position:"fixed"},zIndex:0,onMouseDown:()=>N&&i(),blur:R,color:f||(L.colorScheme==="dark"?L.colors.dark[9]:L.black),opacity:ae}))))))}eu.displayName="@mantine/core/Modal";X();X();var fCe={xs:16,sm:22,md:26,lg:30,xl:36},pCe={xs:10,sm:12,md:14,lg:16,xl:18},mCe=me((t,{size:e,disabled:r,radius:o})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:r?t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[3]:t.colorScheme==="dark"?t.colors.dark[7]:t.colors.gray[1],color:r?t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7]:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],height:t.fn.size({size:e,sizes:fCe}),paddingLeft:t.fn.size({size:e,sizes:t.spacing}),paddingRight:r?t.fn.size({size:e,sizes:t.spacing}):0,fontWeight:500,fontSize:t.fn.size({size:e,sizes:pCe}),borderRadius:t.fn.size({size:o,sizes:t.radius}),cursor:r?"not-allowed":"default",userSelect:"none",maxWidth:"calc(100% - 20px)"},defaultValueRemove:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],marginLeft:t.fn.size({size:e,sizes:t.spacing})/6},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}})),$G=mCe;var hCe=Object.defineProperty,Zw=Object.getOwnPropertySymbols,VG=Object.prototype.hasOwnProperty,HG=Object.prototype.propertyIsEnumerable,zG=(t,e,r)=>e in t?hCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gCe=(t,e)=>{for(var r in e||(e={}))VG.call(e,r)&&zG(t,r,e[r]);if(Zw)for(var r of Zw(e))HG.call(e,r)&&zG(t,r,e[r]);return t},_Ce=(t,e)=>{var r={};for(var o in t)VG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Zw)for(var o of Zw(t))e.indexOf(o)<0&&HG.call(t,o)&&(r[o]=t[o]);return r},UG={xs:16,sm:22,md:24,lg:26,xl:30};function zP(t){var e=t,{label:r,classNames:o,styles:n,className:i,onRemove:a,disabled:s,size:l,radius:c}=e,u=_Ce(e,["label","classNames","styles","className","onRemove","disabled","size","radius"]);let{classes:d,cx:f}=$G({size:l,disabled:s,radius:c},{classNames:o,styles:n,name:"MultiSelect"});return D.createElement("div",gCe({className:f(d.defaultValue,i)},u),D.createElement("span",{className:d.defaultValueLabel},r),!s&&D.createElement(Fl,{"aria-hidden":!0,onMouseDown:a,size:UG[l],radius:2,color:"blue",variant:"transparent",iconSize:UG[l]/2,className:d.defaultValueRemove,tabIndex:-1}))}zP.displayName="@mantine/core/MultiSelect/DefaultValue";function jG({data:t,searchable:e,limit:r,searchValue:o,filter:n,value:i}){if(!e&&i.length===0)return t;if(!e){let s=[];for(let l=0;l<t.length;l+=1)i.some(c=>c===t[l].value&&!t[l].disabled)||s.push(t[l]);return s}let a=[];for(let s=0;s<t.length&&(n(o,i.some(l=>l===t[s].value&&!t[s].disabled),t[s])&&a.push(t[s]),!(a.length>=r));s+=1);return a}X();X();X();var xCe=Object.defineProperty,e0=Object.getOwnPropertySymbols,qG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,GG=(t,e,r)=>e in t?xCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WG=(t,e)=>{for(var r in e||(e={}))qG.call(e,r)&&GG(t,r,e[r]);if(e0)for(var r of e0(e))KG.call(e,r)&&GG(t,r,e[r]);return t},bCe=(t,e)=>{var r={};for(var o in t)qG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&e0)for(var o of e0(t))e.indexOf(o)<0&&KG.call(t,o)&&(r[o]=t[o]);return r},yCe={xs:14,sm:18,md:20,lg:24,xl:28};function YG(t){var e=t,{size:r,error:o,style:n}=e,i=bCe(e,["size","error","style"]);let a=dr(),s=a.fn.size({size:r,sizes:yCe});return D.createElement("svg",WG({width:s,height:s,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:WG({color:o?a.colors.red[6]:a.colors.gray[6]},n),"data-chevron":!0},i),D.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function UP({shouldClear:t,clearButtonLabel:e,onClear:r,size:o,error:n,clearButtonTabIndex:i}){return t?D.createElement(Fl,{variant:"transparent","aria-label":e,onClick:r,size:o,tabIndex:i}):D.createElement(YG,{error:n,size:o})}UP.displayName="@mantine/core/SelectRightSection";var vCe=Object.defineProperty,ICe=Object.defineProperties,wCe=Object.getOwnPropertyDescriptors,t0=Object.getOwnPropertySymbols,QG=Object.prototype.hasOwnProperty,ZG=Object.prototype.propertyIsEnumerable,XG=(t,e,r)=>e in t?vCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VP=(t,e)=>{for(var r in e||(e={}))QG.call(e,r)&&XG(t,r,e[r]);if(t0)for(var r of t0(e))ZG.call(e,r)&&XG(t,r,e[r]);return t},JG=(t,e)=>ICe(t,wCe(e)),ECe=(t,e)=>{var r={};for(var o in t)QG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&t0)for(var o of t0(t))e.indexOf(o)<0&&ZG.call(t,o)&&(r[o]=t[o]);return r},SCe={xs:24,sm:30,md:34,lg:44,xl:54};function r0(t){var e=t,{styles:r,rightSection:o,rightSectionWidth:n,theme:i}=e,a=ECe(e,["styles","rightSection","rightSectionWidth","theme"]);if(o)return{rightSection:o,rightSectionWidth:n,styles:r};let s=typeof r=="function"?r(i):r;return{rightSectionWidth:i.fn.size({size:a.size,sizes:SCe}),rightSection:!(a.disabled&&a.shouldClear)&&D.createElement(UP,VP({},a)),styles:JG(VP({},s),{rightSection:JG(VP({},s?.rightSection),{pointerEvents:a.shouldClear?void 0:"none"})})}}var CCe=me((t,{size:e,invalid:r})=>({wrapper:{position:"relative"},values:{minHeight:t.fn.size({size:e,sizes:si})-2,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:-t.spacing.xs/2,paddingTop:t.spacing.xs/2-2,paddingBottom:t.spacing.xs/2-2,boxSizing:"border-box"},value:{margin:`${t.spacing.xs/2-2}px ${t.spacing.xs/2}px`},searchInput:{flex:1,minWidth:60,backgroundColor:"transparent",border:0,outline:0,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),padding:0,margin:t.spacing.xs/2,appearance:"none",color:"inherit","&::placeholder":{color:r?t.colors.red[t.colorScheme==="dark"?6:7]:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]},"&:disabled":{cursor:"not-allowed"}},searchInputEmpty:{width:"100%"},searchInputInputHidden:{width:0,height:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed"}}})),eW=CCe;var TCe=Object.defineProperty,kCe=Object.defineProperties,NCe=Object.getOwnPropertyDescriptors,o0=Object.getOwnPropertySymbols,oW=Object.prototype.hasOwnProperty,nW=Object.prototype.propertyIsEnumerable,tW=(t,e,r)=>e in t?TCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Em=(t,e)=>{for(var r in e||(e={}))oW.call(e,r)&&tW(t,r,e[r]);if(o0)for(var r of o0(e))nW.call(e,r)&&tW(t,r,e[r]);return t},rW=(t,e)=>kCe(t,NCe(e)),PCe=(t,e)=>{var r={};for(var o in t)oW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&o0)for(var o of o0(t))e.indexOf(o)<0&&nW.call(t,o)&&(r[o]=t[o]);return r};function OCe(t,e,r){return e?!1:r.label.toLowerCase().trim().includes(t.toLowerCase().trim())}function ACe(t,e){return!!t&&!e.some(r=>r.value.toLowerCase()===t.toLowerCase())}var DCe={size:"sm",valueComponent:zP,itemComponent:K_,transition:"pop-top-left",transitionDuration:0,maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:OCe,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:ACe,switchDirectionOnFlip:!1,zIndex:Ar("popover"),selectOnBlur:!1,clearButtonTabIndex:0,positionDependencies:[]},n0=ee((t,e)=>{let r=Ie("MultiSelect",DCe,t),{className:o,style:n,required:i,label:a,description:s,size:l,error:c,classNames:u,styles:d,wrapperProps:f,value:m,defaultValue:h,data:g,onChange:_,valueComponent:b,itemComponent:y,id:v,transition:C,transitionDuration:N,transitionTimingFunction:I,maxDropdownHeight:E,shadow:w,nothingFound:S,onFocus:T,onBlur:A,searchable:R,placeholder:P,filter:B,limit:$,clearSearchOnChange:z,clearable:H,clearSearchOnBlur:G,clearButtonLabel:Y,variant:L,onSearchChange:ne,disabled:ae,initiallyOpened:U,radius:ge,icon:Ce,rightSection:He,rightSectionWidth:Qe,creatable:Me,getCreateLabel:ke,shouldCreate:at,onCreate:Rt,sx:ut,dropdownComponent:ht,onDropdownClose:bt,onDropdownOpen:Xr,maxSelectedValues:Mt,withinPortal:ye,switchDirectionOnFlip:dn,zIndex:Ut,selectOnBlur:pt,name:Ur,dropdownPosition:Vr,errorProps:Do,labelProps:Be,descriptionProps:ie,clearButtonTabIndex:j,form:Q,positionDependencies:se,onKeyDown:Ve}=r,yt=PCe(r,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transition","transitionDuration","transitionTimingFunction","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","clearButtonLabel","variant","onSearchChange","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","clearButtonTabIndex","form","positionDependencies","onKeyDown"]),{classes:Nt,cx:Mn,theme:_r}=eW({size:l,invalid:!!c},{classNames:u,styles:d,name:"MultiSelect"}),{systemStyles:Nr,rest:Xn}=so(yt),io=W(),fn=W(),pn=W(),Sl=W({}),mn=lo(v),[fr,Ui]=M(U),[Ln,bi]=M(-1),[ha,hn]=M("column"),[gn,Rc]=M(""),[Cl,As]=M(!1),{scrollIntoView:Xt,targetRef:Ds,scrollableRef:Rs}=M_({duration:0,offset:5,cancelable:!1,isList:!0}),jo=Me&&typeof ke=="function",Vi=null,Ro=we=>{Ui(we);let It=we?Xr:bt;typeof It=="function"&&It()},Mo=we=>{typeof ne=="function"&&ne(we),Rc(we)},r_=g.map(we=>typeof we=="string"?{label:we,value:we}:we),Ms=OI({data:r_}),[vt,Za]=Cn({value:m,defaultValue:h,finalValue:[],rule:we=>Array.isArray(we),onChange:_}),Lo=W(!!Mt&&Mt<vt.length),Ls=we=>{let It=vt.filter(_n=>_n!==we);Za(It),Mt&&It.length<Mt&&(Lo.current=!1)},Hi=we=>{Mo(we.currentTarget.value),Ro(!0)},Fs=we=>{typeof T=="function"&&T(we)},Hr=jG({data:Ms,searchable:R,searchValue:gn,limit:$,filter:B,value:vt}),Tl=(we,It,_n)=>{let ga=we;for(;_n(ga);)if(ga=It(ga),!Hr[ga].disabled)return ga;return we};mr(()=>{bi(Tl(-1,we=>we+1,we=>we<Hr.length-1))},[gn]),mr(()=>{!ae&&vt.length>=g.length&&Ro(!1),Mt&&vt.length<Mt&&(Lo.current=!1),Mt&&vt.length>=Mt&&(Lo.current=!0,Ro(!1))},[vt]);let Bs=we=>{z&&Mo(""),vt.includes(we.value)?Ls(we.value):(Za([...vt,we.value]),vt.length===Mt-1&&(Lo.current=!0,Ro(!1)),Ln===Hr.length-1&&bi(Hr.length-2)),we.creatable&&typeof Rt=="function"&&Rt(we.value)},Ap=we=>{typeof A=="function"&&A(we),pt&&Hr[Ln]&&fr&&Bs(Hr[Ln]),G&&Mo(""),Ro(!1)},Dp=we=>{if(Cl||(Ve?.(we),we.nativeEvent.code!=="Backspace"&&Mt&&Lo.current))return;let It=ha==="column",_n=()=>{bi(Nl=>{var _a;let Mc=Tl(Nl,$s=>$s+1,$s=>$s<Hr.length-1);return fr&&(Ds.current=Sl.current[(_a=Hr[Mc])==null?void 0:_a.value],Xt({alignment:It?"end":"start"})),Mc})},ga=()=>{bi(Nl=>{var _a;let Mc=Tl(Nl,$s=>$s-1,$s=>$s>0);return fr&&(Ds.current=Sl.current[(_a=Hr[Mc])==null?void 0:_a.value],Xt({alignment:It?"start":"end"})),Mc})};switch(we.nativeEvent.code){case"ArrowUp":{we.preventDefault(),Ro(!0),It?ga():_n();break}case"ArrowDown":{we.preventDefault(),Ro(!0),It?_n():ga();break}case"Enter":{we.preventDefault(),Hr[Ln]&&fr?Bs(Hr[Ln]):Ro(!0);break}case"Space":{R||(we.preventDefault(),Hr[Ln]&&fr?Bs(Hr[Ln]):Ro(!0));break}case"Backspace":{vt.length>0&&gn.length===0&&(Za(vt.slice(0,-1)),Ro(!0),Mt&&(Lo.current=!1));break}case"Home":{if(!R){we.preventDefault(),fr||Ro(!0);let Nl=Hr.findIndex(_a=>!_a.disabled);bi(Nl),Xt({alignment:It?"end":"start"})}break}case"End":{if(!R){we.preventDefault(),fr||Ro(!0);let Nl=Hr.map(_a=>!!_a.disabled).lastIndexOf(!1);bi(Nl),Xt({alignment:It?"end":"start"})}break}case"Escape":Ro(!1)}},kl=vt.map(we=>{let It=Ms.find(_n=>_n.value===we&&!_n.disabled);return!It&&jo&&(It={value:we,label:we}),It}).filter(we=>!!we).map(we=>D.createElement(b,rW(Em({},we),{disabled:ae,className:Nt.value,onRemove:It=>{fr&&(It.preventDefault(),It.stopPropagation()),Ls(we.value),Ro(!0)},key:we.value,size:l,styles:d,classNames:u,radius:ge}))),Ee=()=>{var we;Mo(""),Za([]),(we=fn.current)==null||we.focus(),Mt&&(Lo.current=!1)};jo&&at(gn,Ms)&&(Vi=ke(gn),Hr.push({label:gn,value:gn,creatable:!0}));let Pr=Hr.length>0?fr:fr&&!!S;return D.createElement(kn,Em(Em({required:i,id:mn,label:a,error:c,description:s,size:l,className:o,style:n,classNames:u,styles:d,__staticSelector:"MultiSelect",sx:ut,errorProps:Do,descriptionProps:ie,labelProps:Be},Nr),f),D.createElement("div",{className:Nt.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":fr&&Pr?`${mn}-items`:null,"aria-controls":mn,"aria-expanded":fr,onMouseLeave:()=>bi(-1),tabIndex:-1,ref:pn},D.createElement("input",{type:"hidden",name:Ur,value:vt.join(","),form:Q}),D.createElement(Sa,Em({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:l,variant:L,disabled:ae,invalid:!!c,required:i,radius:ge,icon:Ce,onMouseDown:we=>{var It;we.preventDefault(),!ae&&!Lo.current&&Ro(!fr),(It=fn.current)==null||It.focus()},classNames:rW(Em({},u),{input:Mn({[Nt.input]:!R},u?.input)})},r0({theme:_r,rightSection:He,rightSectionWidth:Qe,styles:d,size:l,shouldClear:H&&vt.length>0,clearButtonLabel:Y,onClear:Ee,error:c,disabled:ae,clearButtonTabIndex:j})),D.createElement("div",{className:Nt.values},kl,D.createElement("input",Em({ref:Sn(e,fn),type:"search",autoComplete:"off",id:mn,className:Mn(Nt.searchInput,{[Nt.searchInputPointer]:!R,[Nt.searchInputInputHidden]:!fr&&vt.length>0||!R&&vt.length>0,[Nt.searchInputEmpty]:vt.length===0}),onKeyDown:Dp,value:gn,onChange:Hi,onFocus:Fs,onCompositionStart:()=>As(!0),onCompositionEnd:()=>As(!1),onBlur:Ap,readOnly:!R||Lo.current,placeholder:vt.length===0?P:void 0,disabled:ae,"data-mantine-stop-propagation":fr},Xn)))),D.createElement(W_,{mounted:fr&&Pr,transition:C,transitionDuration:N,transitionTimingFunction:I,uuid:mn,shadow:w,maxDropdownHeight:E,classNames:u,styles:d,ref:Sn(io,Rs),__staticSelector:"MultiSelect",dropdownComponent:ht||Ad,referenceElement:pn.current,direction:ha,onDirectionChange:hn,switchDirectionOnFlip:dn,withinPortal:ye,zIndex:Ut,dropdownPosition:Vr,positionDependencies:se},D.createElement(q_,{data:Hr,hovered:Ln,classNames:u,styles:d,uuid:mn,__staticSelector:"MultiSelect",onItemHover:bi,onItemSelect:Bs,itemsRefs:Sl,itemComponent:y,size:l,nothingFound:S,creatable:Me&&!!Vi,createLabel:Vi}))))});n0.displayName="@mantine/core/MultiSelect";X();var RCe=me((t,{color:e,radius:r},o)=>{let n=t.fn.radius(r),i=Math.min(Math.max(n/1.2,4),30),a=t.fn.variant({variant:"filled",color:e});return{closeButton:{},icon:{ref:o("icon"),boxSizing:"border-box",marginRight:t.spacing.md,width:28,height:28,borderRadius:28,display:"flex",flex:"none",alignItems:"center",justifyContent:"center",color:t.white},withIcon:{paddingLeft:t.spacing.xs,"&::before":{display:"none"}},root:{boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",paddingLeft:22,paddingRight:5,paddingTop:t.spacing.xs,paddingBottom:t.spacing.xs,borderRadius:n,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,boxShadow:t.shadows.lg,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,"&::before":{content:"''",display:"block",position:"absolute",width:6,top:i,bottom:i,left:4,borderRadius:n,backgroundColor:a.background},[`& .${o("icon")}`]:{backgroundColor:a.background,color:t.white}},body:{flex:1,overflow:"hidden",marginRight:10},loader:{marginRight:t.spacing.md},title:{lineHeight:1.4,marginBottom:2,overflow:"hidden",textOverflow:"ellipsis",color:t.colorScheme==="dark"?t.white:t.colors.gray[9]},description:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis","&:only-child":{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}}}}),iW=RCe;var MCe=Object.defineProperty,LCe=Object.defineProperties,FCe=Object.getOwnPropertyDescriptors,i0=Object.getOwnPropertySymbols,lW=Object.prototype.hasOwnProperty,cW=Object.prototype.propertyIsEnumerable,aW=(t,e,r)=>e in t?MCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sW=(t,e)=>{for(var r in e||(e={}))lW.call(e,r)&&aW(t,r,e[r]);if(i0)for(var r of i0(e))cW.call(e,r)&&aW(t,r,e[r]);return t},BCe=(t,e)=>LCe(t,FCe(e)),$Ce=(t,e)=>{var r={};for(var o in t)lW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&i0)for(var o of i0(t))e.indexOf(o)<0&&cW.call(t,o)&&(r[o]=t[o]);return r},a0=ee((t,e)=>{let r=Ie("Notification",{},t),{className:o,color:n,radius:i,loading:a,disallowClose:s,title:l,icon:c,children:u,onClose:d,closeButtonProps:f,classNames:m,styles:h}=r,g=$Ce(r,["className","color","radius","loading","disallowClose","title","icon","children","onClose","closeButtonProps","classNames","styles"]),{classes:_,cx:b}=iW({color:n,radius:i},{classNames:m,styles:h,name:"Notification"}),y=c||a;return D.createElement(_e,sW({className:b(_.root,{[_.withIcon]:y},o),role:"alert",ref:e},g),c&&!a&&D.createElement("div",{className:_.icon},c),a&&D.createElement(Ze,{size:28,color:n,className:_.loader}),D.createElement("div",{className:_.body},l&&D.createElement(Gr,{className:_.title,size:"sm",weight:500},l),D.createElement(Gr,{color:"dimmed",className:_.description,size:"sm"},u)),!s&&D.createElement(Fl,BCe(sW({},f),{iconSize:16,color:"gray",onClick:d,variant:"hover",className:_.closeButton})))});a0.displayName="@mantine/core/Notification";X();X();var zCe=Object.defineProperty,UCe=Object.defineProperties,VCe=Object.getOwnPropertyDescriptors,s0=Object.getOwnPropertySymbols,dW=Object.prototype.hasOwnProperty,fW=Object.prototype.propertyIsEnumerable,uW=(t,e,r)=>e in t?zCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HP=(t,e)=>{for(var r in e||(e={}))dW.call(e,r)&&uW(t,r,e[r]);if(s0)for(var r of s0(e))fW.call(e,r)&&uW(t,r,e[r]);return t},HCe=(t,e)=>UCe(t,VCe(e)),jCe=(t,e)=>{var r={};for(var o in t)dW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&s0)for(var o of s0(t))e.indexOf(o)<0&&fW.call(t,o)&&(r[o]=t[o]);return r},GCe={type:"text",size:"sm",__staticSelector:"TextInput"},ir=ee((t,e)=>{let r=Ie("TextInput",GCe,t),{className:o,id:n,label:i,error:a,required:s,type:l,style:c,icon:u,description:d,wrapperProps:f,size:m,classNames:h,styles:g,errorProps:_,labelProps:b,descriptionProps:y,__staticSelector:v,sx:C}=r,N=jCe(r,["className","id","label","error","required","type","style","icon","description","wrapperProps","size","classNames","styles","errorProps","labelProps","descriptionProps","__staticSelector","sx"]),I=lo(n),{systemStyles:E,rest:w}=so(N);return D.createElement(kn,HP(HP({required:s,id:I,label:i,error:a,description:d,size:m,className:o,style:c,classNames:h,styles:g,__staticSelector:v,sx:C,errorProps:_,labelProps:b,descriptionProps:y},E),f),D.createElement(Sa,HCe(HP({},w),{required:s,ref:e,id:I,type:l,invalid:!!a,icon:u,size:m,classNames:h,styles:g,__staticSelector:v})))});ir.displayName="@mantine/core/TextInput";var jP={xs:20,sm:24,md:30,lg:34,xl:36},WCe=me((t,{radius:e,size:r})=>({rightSection:{display:"flex",flexDirection:"column",height:"calc(100% - 2px)",margin:1,marginRight:1},control:{margin:0,position:"relative",flex:"0 0 50%",boxSizing:"border-box",width:t.fn.size({size:r,sizes:jP}),padding:0,WebkitTapHighlightColor:"transparent",borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,borderLeft:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,borderTop:0,borderRight:0,backgroundColor:"transparent",marginRight:1,"&:not(:disabled):hover":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},"&::after":{position:"absolute",top:"calc(50% - 2.5px)",left:"calc(50% - 4.5px)",content:'""',display:"block",width:0,height:0,borderStyle:"solid"}},controlUp:{borderTopRightRadius:t.fn.size({size:e,sizes:t.radius})-1,"&::after":{borderWidth:"0 5px 5px 5px",borderColor:`transparent transparent ${t.colorScheme==="dark"?t.colors.dark[0]:t.black} transparent`},"&:disabled::after":{borderBottomColor:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]}},controlDown:{borderBottomRightRadius:t.fn.size({size:e,sizes:t.radius})-1,borderBottom:0,"&::after":{borderWidth:"5px 5px 0 5px",borderColor:`${t.colorScheme==="dark"?t.colors.dark[0]:t.black} transparent transparent transparent`},"&:disabled::after":{borderTopColor:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]}}})),pW=WCe;var qCe=Object.defineProperty,KCe=Object.defineProperties,YCe=Object.getOwnPropertyDescriptors,l0=Object.getOwnPropertySymbols,hW=Object.prototype.hasOwnProperty,gW=Object.prototype.propertyIsEnumerable,mW=(t,e,r)=>e in t?qCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,XCe=(t,e)=>{for(var r in e||(e={}))hW.call(e,r)&&mW(t,r,e[r]);if(l0)for(var r of l0(e))gW.call(e,r)&&mW(t,r,e[r]);return t},JCe=(t,e)=>KCe(t,YCe(e)),QCe=(t,e)=>{var r={};for(var o in t)hW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&l0)for(var o of l0(t))e.indexOf(o)<0&&gW.call(t,o)&&(r[o]=t[o]);return r},ZCe=t=>t||"",eTe=t=>{if(t==="-")return t;let e=t;e[0]==="."&&(e=`0${t}`);let r=parseFloat(e);if(!Number.isNaN(r))return t},tTe={step:1,hideControls:!1,size:"sm",precision:0,noClampOnBlur:!1,formatter:ZCe,parser:eTe},c0=ee((t,e)=>{let r=Ie("NumberInput",tTe,t),{disabled:o,value:n,onChange:i,decimalSeparator:a,min:s,max:l,step:c,stepHoldInterval:u,stepHoldDelay:d,onBlur:f,onFocus:m,hideControls:h,radius:g,variant:_,precision:b,defaultValue:y,noClampOnBlur:v,handlersRef:C,classNames:N,styles:I,size:E,rightSection:w,rightSectionWidth:S,formatter:T,parser:A}=r,R=QCe(r,["disabled","value","onChange","decimalSeparator","min","max","step","stepHoldInterval","stepHoldDelay","onBlur","onFocus","hideControls","radius","variant","precision","defaultValue","noClampOnBlur","handlersRef","classNames","styles","size","rightSection","rightSectionWidth","formatter","parser"]),{classes:P,cx:B,theme:$}=pW({radius:g,size:E},{classNames:N,styles:I,name:"NumberInput"}),[z,H]=M(!1),[G,Y]=M(typeof n=="number"?n:typeof y=="number"?y:void 0),L=typeof n=="number"?n:G,[ne,ae]=M(typeof L=="number"?L.toFixed(b):""),U=W(),ge=Be=>{typeof i=="function"&&i(Be),Y(Be)},Ce=(Be="")=>{let ie=typeof Be=="number"?String(Be):Be;return a&&(ie=ie.replace(/\./g,a)),T(ie)},He=Be=>{let ie=Be;return a&&(ie=ie.replace(new RegExp(`\\${a}`,"g"),".")),A(ie)},Qe=typeof s=="number"?s:-1/0,Me=typeof l=="number"?l:1/0,ke=W();ke.current=()=>{var Be;if(G===void 0)ge(s??0),ae((Be=s?.toFixed(b))!=null?Be:"0");else{let ie=ya({value:G+c,min:Qe,max:Me}).toFixed(b);ge(parseFloat(ie)),ae(ie)}};let at=W();at.current=()=>{var Be;if(G===void 0)ge(s??0),ae((Be=s?.toFixed(b))!=null?Be:"0");else{let ie=ya({value:G-c,min:Qe,max:Me}).toFixed(b);ge(parseFloat(ie)),ae(ie)}},fm(C,{increment:ke.current,decrement:at.current}),V(()=>{typeof n=="number"&&!z&&(Y(n),ae(n.toFixed(b))),y===void 0&&n===void 0&&!z&&(Y(n),ae(""))},[n]);let Rt=d!==void 0&&u!==void 0,ut=W(null),ht=W(0),bt=()=>{ut.current&&window.clearTimeout(ut.current),ut.current=null,ht.current=0},Xr=Be=>{Be?ke.current():at.current(),ht.current+=1},Mt=Be=>{if(Xr(Be),Rt){let ie=typeof u=="number"?u:u(ht.current);ut.current=window.setTimeout(()=>Mt(Be),ie)}},ye=(Be,ie)=>{Be.preventDefault(),U.current.focus(),Xr(ie),Rt&&(ut.current=window.setTimeout(()=>Mt(ie),d))};V(()=>(bt(),bt),[]);let dn=D.createElement("div",{className:P.rightSection},D.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,disabled:L>=l,className:B(P.control,P.controlUp),onMouseDown:Be=>{ye(Be,!0)},onMouseUp:bt,onMouseLeave:bt}),D.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,disabled:L<=s,className:B(P.control,P.controlDown),onMouseDown:Be=>{ye(Be,!1)},onMouseUp:bt,onMouseLeave:bt})),Ut=Be=>{let ie=Be.target.value,j=He(ie);ae(j),ie===""||ie==="-"?ge(void 0):ie.trim()!==""&&!Number.isNaN(j)&&ge(parseFloat(j))},pt=Be=>{var ie;if(Be.target.value==="")ae(""),ge(void 0);else{let j=Be.target.value;(j[0]===`${a}`||j[0]===".")&&(j=`0${j}`);let Q=He(j),se=ya({value:parseFloat(Q),min:Qe,max:Me});Number.isNaN(se)?ae((ie=L?.toFixed(b))!=null?ie:""):v||(ae(se.toFixed(b)),ge(parseFloat(se.toFixed(b))))}H(!1),typeof f=="function"&&f(Be)},Ur=Be=>{H(!0),typeof m=="function"&&m(Be)},Vr=Be=>{if(Be.repeat&&Rt&&(Be.key==="ArrowUp"||Be.key==="ArrowDown")){Be.preventDefault();return}Be.key==="ArrowUp"?ye(Be,!0):Be.key==="ArrowDown"&&ye(Be,!1)},Do=Be=>{(Be.key==="ArrowUp"||Be.key==="ArrowDown")&&bt()};return D.createElement(ir,JCe(XCe({},R),{variant:_,value:Ce(ne),disabled:o,ref:Sn(U,e),type:"text",onChange:Ut,onBlur:pt,onFocus:Ur,onKeyDown:Vr,onKeyUp:Do,rightSection:w||(o||h||_==="unstyled"?null:dn),rightSectionWidth:S||$.fn.size({size:E,sizes:jP})+1,radius:g,max:l,min:s,step:c,size:E,styles:I,classNames:N,inputMode:yV(c,b,HN()),__staticSelector:"NumberInput"}))});c0.displayName="@mantine/core/NumberInput";X();function _W({data:t,searchable:e,limit:r,searchValue:o,filter:n,value:i,filterDataOnExactSearchMatch:a}){if(!e)return t;let s=i!=null&&t.find(c=>c.value===i)||null;if(s&&!a&&s?.label===o)return t;let l=[];for(let c=0;c<t.length&&(n(o,t[c])&&l.push(t[c]),!(l.length>=r));c+=1);return l}var rTe=me(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}})),xW=rTe;var oTe=Object.defineProperty,nTe=Object.defineProperties,iTe=Object.getOwnPropertyDescriptors,u0=Object.getOwnPropertySymbols,vW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,bW=(t,e,r)=>e in t?oTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rx=(t,e)=>{for(var r in e||(e={}))vW.call(e,r)&&bW(t,r,e[r]);if(u0)for(var r of u0(e))IW.call(e,r)&&bW(t,r,e[r]);return t},yW=(t,e)=>nTe(t,iTe(e)),aTe=(t,e)=>{var r={};for(var o in t)vW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&u0)for(var o of u0(t))e.indexOf(o)<0&&IW.call(t,o)&&(r[o]=t[o]);return r};function sTe(t,e){return e.label.toLowerCase().trim().includes(t.toLowerCase().trim())}function lTe(t,e){return!!t&&!e.some(r=>r.label.toLowerCase()===t.toLowerCase())}var cTe={required:!1,size:"sm",shadow:"sm",itemComponent:K_,transition:"fade",transitionDuration:0,initiallyOpened:!1,filter:sTe,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:lTe,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ar("popover"),clearButtonTabIndex:0,positionDependencies:[]},Er=ee((t,e)=>{let r=Ie("Select",cTe,t),{className:o,style:n,required:i,label:a,id:s,error:l,description:c,size:u,shadow:d,data:f,value:m,defaultValue:h,onChange:g,itemComponent:_,onKeyDown:b,onBlur:y,onFocus:v,transition:C,transitionDuration:N,initiallyOpened:I,transitionTimingFunction:E,wrapperProps:w,classNames:S,styles:T,filter:A,maxDropdownHeight:R,searchable:P,clearable:B,nothingFound:$,clearButtonLabel:z,limit:H,disabled:G,onSearchChange:Y,rightSection:L,rightSectionWidth:ne,creatable:ae,getCreateLabel:U,shouldCreate:ge,selectOnBlur:Ce,onCreate:He,sx:Qe,dropdownComponent:Me,onDropdownClose:ke,onDropdownOpen:at,withinPortal:Rt,switchDirectionOnFlip:ut,zIndex:ht,name:bt,dropdownPosition:Xr,allowDeselect:Mt,errorProps:ye,descriptionProps:dn,labelProps:Ut,placeholder:pt,filterDataOnExactSearchMatch:Ur,clearButtonTabIndex:Vr,form:Do,positionDependencies:Be}=r,ie=aTe(r,["className","style","required","label","id","error","description","size","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transition","transitionDuration","initiallyOpened","transitionTimingFunction","wrapperProps","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","clearButtonLabel","limit","disabled","onSearchChange","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","errorProps","descriptionProps","labelProps","placeholder","filterDataOnExactSearchMatch","clearButtonTabIndex","form","positionDependencies"]),{classes:j,cx:Q,theme:se}=xW(),{systemStyles:Ve,rest:yt}=so(ie),[Nt,Mn]=M(I),[_r,Nr]=M(-1),Xn=W(),io=W(),fn=W({}),[pn,Sl]=M("column"),mn=pn==="column",fr=lo(s),{scrollIntoView:Ui,targetRef:Ln,scrollableRef:bi}=M_({duration:0,offset:5,cancelable:!1,isList:!0}),ha=Mt===void 0?B:Mt,hn=Ee=>{if(Nt!==Ee){Mn(Ee);let Pr=Ee?at:ke;typeof Pr=="function"&&Pr()}},gn=ae&&typeof U=="function",Rc=null,Cl=f.map(Ee=>typeof Ee=="string"?{label:Ee,value:Ee}:Ee),As=OI({data:Cl}),[Xt,Ds,Rs]=Cn({value:m,defaultValue:h,finalValue:null,onChange:g,rule:Ee=>typeof Ee=="string"||Ee===null}),jo=As.find(Ee=>Ee.value===Xt),[Vi,Ro]=M(jo?.label||""),Mo=Ee=>{Ro(Ee),P&&typeof Y=="function"&&Y(Ee)},r_=()=>{var Ee;Ds(null),Rs==="uncontrolled"&&Mo(""),(Ee=Xn.current)==null||Ee.focus()};V(()=>{let Ee=As.find(Pr=>Pr.value===Xt);Ee?Mo(Ee.label):(!gn||!Xt)&&Mo("")},[Xt]),V(()=>{jo&&(!P||!Nt)&&Mo(jo.label)},[jo?.label]);let Ms=Ee=>{ha&&jo?.value===Ee.value?(Ds(null),hn(!1)):(Ds(Ee.value),Ee.creatable&&typeof He=="function"&&He(Ee.value),Rs==="uncontrolled"&&Mo(Ee.label),Nr(-1),hn(!1),Xn.current.focus())},vt=_W({data:As,searchable:P,limit:H,searchValue:Vi,filter:A,filterDataOnExactSearchMatch:Ur,value:Xt});gn&&ge(Vi,vt)&&(Rc=U(Vi),vt.push({label:Vi,value:Vi,creatable:!0}));let Za=(Ee,Pr,we)=>{let It=Ee;for(;we(It);)if(It=Pr(It),!vt[It].disabled)return It;return Ee};mr(()=>{Nr(Za(-1,Ee=>Ee+1,Ee=>Ee<vt.length-1))},[Vi]);let Lo=Xt?vt.findIndex(Ee=>Ee.value===Xt):0,Ls=()=>{Nr(Ee=>{var Pr;let we=Za(Ee,It=>It-1,It=>It>0);return Ln.current=fn.current[(Pr=vt[we])==null?void 0:Pr.value],Ui({alignment:mn?"start":"end"}),we})},Hi=()=>{Nr(Ee=>{var Pr;let we=Za(Ee,It=>It+1,It=>It<vt.length-1);return Ln.current=fn.current[(Pr=vt[we])==null?void 0:Pr.value],Ui({alignment:mn?"end":"start"}),we})},Fs=()=>window.setTimeout(()=>{var Ee;Ln.current=fn.current[(Ee=vt[Lo])==null?void 0:Ee.value],Ui({alignment:mn?"end":"start"})},0),Hr=Ee=>{switch(typeof b=="function"&&b(Ee),Ee.nativeEvent.code){case"ArrowUp":{Ee.preventDefault(),Nt?mn?Ls():Hi():(Nr(Lo),hn(!0),Fs());break}case"ArrowDown":{Ee.preventDefault(),Nt?mn?Hi():Ls():(Nr(Lo),hn(!0),Fs());break}case"Home":{if(!P){Ee.preventDefault(),Nt||hn(!0);let Pr=vt.findIndex(we=>!we.disabled);Nr(Pr),Ui({alignment:mn?"end":"start"})}break}case"End":{if(!P){Ee.preventDefault(),Nt||hn(!0);let Pr=vt.map(we=>!!we.disabled).lastIndexOf(!1);Nr(Pr),Ui({alignment:mn?"end":"start"})}break}case"Escape":{Ee.preventDefault(),hn(!1),Nr(-1);break}case"Space":{P||(vt[_r]&&Nt?(Ee.preventDefault(),Ms(vt[_r])):(hn(!0),Nr(Lo),Fs()));break}case"Enter":P||Ee.preventDefault(),vt[_r]&&Nt&&(Ee.preventDefault(),Ms(vt[_r]))}},Tl=Ee=>{typeof y=="function"&&y(Ee);let Pr=As.find(we=>we.value===Xt);Ce&&vt[_r]&&Nt&&Ms(vt[_r]),Mo(Pr?.label||""),hn(!1)},Bs=Ee=>{typeof v=="function"&&v(Ee),P&&(hn(!0),Fs())},Ap=Ee=>{Mo(Ee.currentTarget.value),B&&Ee.currentTarget.value===""&&Ds(null),Nr(0),hn(!0)},Dp=()=>{let Ee=!0;P||(Ee=!Nt),hn(Ee),Xt&&Ee&&(Nr(Lo),Fs())},kl=vt.length>0?Nt:Nt&&!!$;return D.createElement(kn,rx(rx({required:i,id:fr,label:a,error:l,description:c,size:u,className:o,style:n,classNames:S,styles:T,__staticSelector:"Select",sx:Qe,errorProps:ye,descriptionProps:dn,labelProps:Ut},Ve),w),D.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":kl?`${fr}-items`:null,"aria-controls":fr,"aria-expanded":kl,onMouseLeave:()=>Nr(-1),tabIndex:-1},D.createElement("input",{type:"hidden",name:bt,value:Xt||"",form:Do}),D.createElement(Sa,rx(yW(rx({autoComplete:"off",type:"search"},yt),{required:i,ref:Sn(e,Xn),id:fr,invalid:!!l,size:u,onKeyDown:Hr,__staticSelector:"Select",value:Vi,placeholder:pt,onChange:Ap,"aria-autocomplete":"list","aria-controls":kl?`${fr}-items`:null,"aria-activedescendant":_r>=0?`${fr}-${_r}`:null,onClick:Dp,onBlur:Tl,onFocus:Bs,readOnly:!P,disabled:G,"data-mantine-stop-propagation":kl,name:null,classNames:yW(rx({},S),{input:Q({[j.input]:!P},S?.input)})}),r0({theme:se,rightSection:L,rightSectionWidth:ne,styles:T,size:u,shouldClear:B&&!!jo,clearButtonLabel:z,onClear:r_,error:l,clearButtonTabIndex:Vr}))),D.createElement(W_,{referenceElement:Xn.current,mounted:kl,transition:C,transitionDuration:N,transitionTimingFunction:E,uuid:fr,shadow:d,maxDropdownHeight:R,classNames:S,styles:T,ref:Sn(io,bi),__staticSelector:"Select",dropdownComponent:Me||Ad,direction:pn,onDirectionChange:Sl,switchDirectionOnFlip:ut,withinPortal:Rt,zIndex:ht,dropdownPosition:Xr,positionDependencies:Be},D.createElement(q_,{data:vt,hovered:_r,classNames:S,styles:T,isItemSelected:Ee=>Ee===Xt,uuid:fr,__staticSelector:"Select",onItemHover:Nr,onItemSelect:Ms,itemsRefs:fn,itemComponent:_,size:u,nothingFound:$,creatable:gn&&!!Rc,createLabel:Rc,"aria-label":a}))))});Er.displayName="@mantine/core/Select";X();var uTe=me((t,{spacing:e,align:r,justify:o})=>({root:{display:"flex",flexDirection:"column",alignItems:r,justifyContent:o,gap:t.fn.size({size:e,sizes:t.spacing})}})),wW=uTe;var dTe=Object.defineProperty,d0=Object.getOwnPropertySymbols,SW=Object.prototype.hasOwnProperty,CW=Object.prototype.propertyIsEnumerable,EW=(t,e,r)=>e in t?dTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fTe=(t,e)=>{for(var r in e||(e={}))SW.call(e,r)&&EW(t,r,e[r]);if(d0)for(var r of d0(e))CW.call(e,r)&&EW(t,r,e[r]);return t},pTe=(t,e)=>{var r={};for(var o in t)SW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&d0)for(var o of d0(t))e.indexOf(o)<0&&CW.call(t,o)&&(r[o]=t[o]);return r},mTe={spacing:"md",align:"stretch",justify:"top"},tu=ee((t,e)=>{let r=Ie("Stack",mTe,t),{spacing:o,className:n,classNames:i,styles:a,align:s,justify:l}=r,c=pTe(r,["spacing","className","classNames","styles","align","justify"]),{classes:u,cx:d}=wW({spacing:o,align:s,justify:l},{name:"Stack",classNames:i,styles:a});return D.createElement(_e,fTe({className:d(u.root,n),ref:e},c))});tu.displayName="@mantine/core/Stack";X();var hTe=Object.defineProperty,gTe=Object.defineProperties,_Te=Object.getOwnPropertyDescriptors,TW=Object.getOwnPropertySymbols,xTe=Object.prototype.hasOwnProperty,bTe=Object.prototype.propertyIsEnumerable,kW=(t,e,r)=>e in t?hTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NW=(t,e)=>{for(var r in e||(e={}))xTe.call(e,r)&&kW(t,r,e[r]);if(TW)for(var r of TW(e))bTe.call(e,r)&&kW(t,r,e[r]);return t},PW=(t,e)=>gTe(t,_Te(e)),GP={xs:16,sm:20,md:24,lg:30,xl:36},f0={xs:30,sm:38,md:46,lg:56,xl:68},OW={xs:12,sm:14,md:18,lg:22,xl:28},yTe={xs:5,sm:6,md:7,lg:9,xl:11},wyt=Object.keys(GP).reduce((t,e)=>(t[e]={width:f0[e],height:GP[e]},t),{}),vTe=me((t,{size:e,radius:r,color:o,offLabel:n,onLabel:i})=>{let a=t.fn.size({size:e,sizes:OW}),s=t.fn.size({size:r,sizes:t.radius}),l=t.fn.variant({variant:"filled",color:o});return{root:{display:"flex",alignItems:"center"},input:PW(NW({},t.fn.focusStyles()),{overflow:"hidden",WebkitTapHighlightColor:"transparent",position:"relative",borderRadius:s,backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`,height:t.fn.size({size:e,sizes:GP}),width:t.fn.size({size:e,sizes:f0}),minWidth:t.fn.size({size:e,sizes:f0}),margin:0,transitionProperty:"background-color, border-color",transitionTimingFunction:t.transitionTimingFunction,transitionDuration:"150ms",boxSizing:"border-box",appearance:"none",display:"flex",alignItems:"center",fontSize:t.fn.size({size:e,sizes:yTe}),fontWeight:600,"&::before":{zIndex:1,borderRadius:s,boxSizing:"border-box",content:"''",display:"block",backgroundColor:t.white,height:a,width:a,border:`1px solid ${t.colorScheme==="dark"?t.white:t.colors.gray[3]}`,transition:`transform 150ms ${t.transitionTimingFunction}`,transform:`translateX(${e==="xs"?1:2}px)`,"@media (prefers-reduced-motion)":{transitionDuration:"0ms"}},"&::after":{position:"absolute",zIndex:0,display:"flex",height:"100%",alignItems:"center",lineHeight:0,right:"10%",transform:"translateX(0)",content:n?`'${n}'`:"''",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[6],transition:`color 150ms ${t.transitionTimingFunction}`},"&:checked":{backgroundColor:l.background,borderColor:l.background,"&::before":{transform:`translateX(${t.fn.size({size:e,sizes:f0})-t.fn.size({size:e,sizes:OW})-(e==="xs"?3:4)}px)`,borderColor:t.white},"&::after":{position:"absolute",zIndex:0,display:"flex",height:"100%",alignItems:"center",lineHeight:0,left:"10%",transform:"translateX(0)",content:i?`'${i}'`:"''",color:t.white,transition:`color 150ms ${t.transitionTimingFunction}`}},"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],cursor:"not-allowed","&::before":{borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],backgroundColor:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[0]}}}),label:PW(NW({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),fontFamily:t.fontFamily,paddingLeft:t.spacing.sm,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black})}}),AW=vTe;var ITe=Object.defineProperty,wTe=Object.defineProperties,ETe=Object.getOwnPropertyDescriptors,p0=Object.getOwnPropertySymbols,RW=Object.prototype.hasOwnProperty,MW=Object.prototype.propertyIsEnumerable,DW=(t,e,r)=>e in t?ITe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WP=(t,e)=>{for(var r in e||(e={}))RW.call(e,r)&&DW(t,r,e[r]);if(p0)for(var r of p0(e))MW.call(e,r)&&DW(t,r,e[r]);return t},STe=(t,e)=>wTe(t,ETe(e)),CTe=(t,e)=>{var r={};for(var o in t)RW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&p0)for(var o of p0(t))e.indexOf(o)<0&&MW.call(t,o)&&(r[o]=t[o]);return r},TTe={offLabel:"",onLabel:"",size:"sm",radius:"xl"},m0=ee((t,e)=>{let r=Ie("Switch",TTe,t),{className:o,color:n,label:i,offLabel:a,onLabel:s,id:l,style:c,size:u,radius:d,wrapperProps:f,children:m,classNames:h,styles:g,sx:_}=r,b=CTe(r,["className","color","label","offLabel","onLabel","id","style","size","radius","wrapperProps","children","classNames","styles","sx"]),{classes:y,cx:v}=AW({size:u,color:n,radius:d,offLabel:a,onLabel:s},{classNames:h,styles:g,name:"Switch"}),{systemStyles:C,rest:N}=so(b),I=lo(l);return D.createElement(_e,WP(WP({className:v(y.root,o),style:c,sx:_},C),f),D.createElement("input",STe(WP({},N),{id:I,ref:e,type:"checkbox",className:y.input})),i&&D.createElement("label",{className:y.label,htmlFor:I},i))});m0.displayName="@mantine/core/Switch";X();var kTe=Object.defineProperty,NTe=Object.defineProperties,PTe=Object.getOwnPropertyDescriptors,LW=Object.getOwnPropertySymbols,OTe=Object.prototype.hasOwnProperty,ATe=Object.prototype.propertyIsEnumerable,FW=(t,e,r)=>e in t?kTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DTe=(t,e)=>{for(var r in e||(e={}))OTe.call(e,r)&&FW(t,r,e[r]);if(LW)for(var r of LW(e))ATe.call(e,r)&&FW(t,r,e[r]);return t},RTe=(t,e)=>NTe(t,PTe(e)),MTe=me((t,{captionSide:e,horizontalSpacing:r,verticalSpacing:o,fontSize:n},i)=>{let a={ref:i("striped")},s={ref:i("hover")};return{striped:a,hover:s,root:RTe(DTe({},t.fn.fontStyles()),{width:"100%",borderCollapse:"collapse",captionSide:e,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,lineHeight:t.lineHeight,"& caption":{marginTop:e==="top"?0:t.spacing.xs,marginBottom:e==="bottom"?0:t.spacing.xs,fontSize:t.fontSizes.sm,color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},"& thead tr th, & tfoot tr th":{textAlign:"left",fontWeight:"bold",color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],fontSize:t.fn.size({size:n,sizes:t.fontSizes}),padding:`${t.fn.size({size:o,sizes:t.spacing})}px ${t.fn.size({size:r,sizes:t.spacing})}px`},"& thead tr th":{borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},"& tfoot tr th":{borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},"& tbody tr td":{padding:`${t.fn.size({size:o,sizes:t.spacing})}px ${t.fn.size({size:r,sizes:t.spacing})}px`,borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`,fontSize:t.fn.size({size:n,sizes:t.fontSizes})},"& tbody tr:last-of-type td":{borderBottom:"none"},[`&.${a.ref} tbody tr:nth-of-type(odd)`]:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},[`&.${s.ref} tbody tr:hover`]:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[1]}})}}),BW=MTe;var LTe=Object.defineProperty,FTe=Object.defineProperties,BTe=Object.getOwnPropertyDescriptors,h0=Object.getOwnPropertySymbols,zW=Object.prototype.hasOwnProperty,UW=Object.prototype.propertyIsEnumerable,$W=(t,e,r)=>e in t?LTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$Te=(t,e)=>{for(var r in e||(e={}))zW.call(e,r)&&$W(t,r,e[r]);if(h0)for(var r of h0(e))UW.call(e,r)&&$W(t,r,e[r]);return t},zTe=(t,e)=>FTe(t,BTe(e)),UTe=(t,e)=>{var r={};for(var o in t)zW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&h0)for(var o of h0(t))e.indexOf(o)<0&&UW.call(t,o)&&(r[o]=t[o]);return r},VTe={striped:!1,highlightOnHover:!1,captionSide:"top",horizontalSpacing:"xs",fontSize:"sm",verticalSpacing:7},fo=ee((t,e)=>{let r=Ie("Table",VTe,t),{className:o,children:n,striped:i,highlightOnHover:a,captionSide:s,horizontalSpacing:l,verticalSpacing:c,fontSize:u}=r,d=UTe(r,["className","children","striped","highlightOnHover","captionSide","horizontalSpacing","verticalSpacing","fontSize"]),{classes:f,cx:m}=BW({captionSide:s,verticalSpacing:c,horizontalSpacing:l,fontSize:u},{name:"Table"});return D.createElement(_e,zTe($Te({},d),{component:"table",ref:e,className:m(f.root,{[f.striped]:i,[f.hover]:a},o)}),n)});fo.displayName="@mantine/core/Table";X();var HTe=Object.defineProperty,jTe=Object.defineProperties,GTe=Object.getOwnPropertyDescriptors,VW=Object.getOwnPropertySymbols,WTe=Object.prototype.hasOwnProperty,qTe=Object.prototype.propertyIsEnumerable,HW=(t,e,r)=>e in t?HTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e)=>{for(var r in e||(e={}))WTe.call(e,r)&&HW(t,r,e[r]);if(VW)for(var r of VW(e))qTe.call(e,r)&&HW(t,r,e[r]);return t},KTe=(t,e)=>jTe(t,GTe(e)),YTe=me((t,{color:e,orientation:r},o)=>{let n={ref:o("tabActive")};return{tabActive:n,tabLabel:{},tabControl:KTe(jW(jW({},t.fn.fontStyles()),t.fn.focusStyles()),{WebkitTapHighlightColor:"transparent",boxSizing:"border-box",display:"block",height:40,backgroundColor:"transparent",border:0,padding:`0 ${t.spacing.md}px`,fontSize:t.fontSizes.sm,cursor:"pointer",width:r==="vertical"?"100%":"auto","&:disabled":{cursor:"not-allowed",color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]}}),default:{transition:"border-color 150ms ease, color 150ms ease",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,[r==="horizontal"?"borderBottom":"borderRight"]:"2px solid transparent",[`&.${n.ref}`]:{color:t.fn.themeColor(e,t.colorScheme==="dark"?4:7),[r==="horizontal"?"borderBottomColor":"borderRightColor"]:t.fn.themeColor(e,t.colorScheme==="dark"?4:7)}},outline:{borderBottomLeftRadius:r==="vertical"?t.radius.sm:0,borderTopRightRadius:r==="horizontal"?t.radius.sm:0,borderTopLeftRadius:t.radius.sm,border:"1px solid transparent",borderBottom:r==="horizontal"?0:"1px solid transparent",borderRight:r==="vertical"?0:"1px solid transparent",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7],[`&.${n.ref}`]:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],background:t.colorScheme==="dark"?t.colors.dark[7]:t.white}},pills:{borderRadius:t.radius.sm,backgroundColor:"transparent",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7],fontSize:t.fontSizes.sm,height:"auto",padding:`${t.spacing.xs}px ${t.spacing.lg}px`,fontWeight:500,"&:hover":{background:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},[`&.${n.ref}`]:{color:t.colorScheme==="dark"?t.white:t.black,background:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]}},tabInner:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:r==="horizontal"?"center":"flex-start",lineHeight:1,height:"100%"},tabIcon:{"&:not(:only-child)":{marginRight:t.spacing.xs},"& *":{display:"block"}}}}),GW=YTe;var XTe=Object.defineProperty,JTe=Object.defineProperties,QTe=Object.getOwnPropertyDescriptors,g0=Object.getOwnPropertySymbols,qW=Object.prototype.hasOwnProperty,KW=Object.prototype.propertyIsEnumerable,WW=(t,e,r)=>e in t?XTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZTe=(t,e)=>{for(var r in e||(e={}))qW.call(e,r)&&WW(t,r,e[r]);if(g0)for(var r of g0(e))KW.call(e,r)&&WW(t,r,e[r]);return t},e1e=(t,e)=>JTe(t,QTe(e)),t1e=(t,e)=>{var r={};for(var o in t)qW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&g0)for(var o of g0(t))e.indexOf(o)<0&&KW.call(t,o)&&(r[o]=t[o]);return r},qP=ee((t,e)=>{var r=t,{className:o,active:n,color:i,variant:a="default",classNames:s,styles:l,orientation:c="horizontal",icon:u,label:d,icon:f,tabKey:m,color:h,elementRef:g}=r,_=t1e(r,["className","active","color","variant","classNames","styles","orientation","icon","label","icon","tabKey","color","elementRef"]);let{classes:b,cx:y}=GW({color:h||i,orientation:c},{classNames:s,styles:l,name:"Tabs"});return D.createElement(_e,e1e(ZTe({},_),{component:"button",tabIndex:n?0:-1,className:y(b.tabControl,b[a],{[b.tabActive]:n},o),type:"button",role:"tab","aria-selected":n,ref:kd(e,g)}),D.createElement("div",{className:b.tabInner},f&&D.createElement("div",{className:b.tabIcon},f),d&&D.createElement("div",{className:b.tabLabel},d)))});qP.displayName="@mantine/core/TabControl";X();var r1e=me((t,{tabPadding:e,orientation:r},o)=>{let n={ref:o("tabsList")};return{tabsListWrapper:{},tabsList:n,root:{display:r==="vertical"?"flex":"block"},pills:{marginRight:r==="vertical"?20:0},body:{[r==="horizontal"?"paddingTop":"paddingLeft"]:t.fn.size({size:e,sizes:t.spacing})},default:{[r==="horizontal"?"borderBottom":"borderRight"]:`2px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`,[`& .${n.ref}`]:{[r==="horizontal"?"marginBottom":"marginRight"]:-2}},outline:{[r==="horizontal"?"borderBottom":"borderRight"]:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`,[`& .${n.ref}`]:{[r==="horizontal"?"marginBottom":"marginRight"]:-1}}}}),YW=r1e;var o1e=Object.defineProperty,_0=Object.getOwnPropertySymbols,JW=Object.prototype.hasOwnProperty,QW=Object.prototype.propertyIsEnumerable,XW=(t,e,r)=>e in t?o1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n1e=(t,e)=>{for(var r in e||(e={}))JW.call(e,r)&&XW(t,r,e[r]);if(_0)for(var r of _0(e))QW.call(e,r)&&XW(t,r,e[r]);return t},i1e=(t,e)=>{var r={};for(var o in t)JW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&_0)for(var o of _0(t))e.indexOf(o)<0&&QW.call(t,o)&&(r[o]=t[o]);return r};function a1e(t,e){for(let r=t-1;r>=0;r-=1)if(!e[r].props.disabled)return r;return t}function s1e(t,e){for(let r=t+1;r<e.length;r+=1)if(!e[r].props.disabled)return r;return t}function l1e(t){for(let e=0;e<t.length;e+=1)if(!t[e].props.disabled)return e;return-1}var c1e={position:"left",grow:!1,variant:"default",tabPadding:"xs",orientation:"horizontal"},Gs=ee((t,e)=>{let r=Ie("Tabs",c1e,t),{className:o,children:n,initialTab:i,active:a,position:s,grow:l,onTabChange:c,color:u,variant:d,classNames:f,styles:m,tabPadding:h,orientation:g}=r,_=i1e(r,["className","children","initialTab","active","position","grow","onTabChange","color","variant","classNames","styles","tabPadding","orientation"]),{classes:b,cx:y,theme:v}=YW({tabPadding:h,orientation:g},{classNames:f,styles:m,name:"Tabs"}),C=W({}),N=vn.toArray(n),[I,E]=Cn({value:a,defaultValue:i,finalValue:l1e(N),rule:B=>typeof B=="number",onChange:B=>{c&&(N.some($=>$.props.tabKey)?c(B,N[B].props.tabKey):c(B))}}),w=ya({value:I,min:0,max:N.length-1}),S=g==="horizontal"?v.dir==="ltr"?"ArrowRight":"ArrowLeft":"ArrowDown",T=g==="horizontal"?v.dir==="ltr"?"ArrowLeft":"ArrowRight":"ArrowUp",A=B=>{if(B.nativeEvent.code===S){B.preventDefault();let $=s1e(w,N);E($),C.current[$].focus()}if(B.nativeEvent.code===T){B.preventDefault();let $=a1e(w,N);E($),C.current[$].focus()}},R=N.map((B,$)=>D.cloneElement(B,{key:$,active:w===$,onKeyDown:A,color:B.props.color||u,variant:d,orientation:g,elementRef:z=>{C.current[$]=z},onClick:()=>w!==$&&E($),classNames:f,styles:m})),P=N[w].props.children;return D.createElement(_e,n1e({ref:e,className:y(b.root,o)},_),D.createElement("div",{className:y(b.tabsListWrapper,b[d])},D.createElement(as,{className:b.tabsList,role:"tablist",direction:g==="horizontal"?"row":"column","aria-orientation":g,spacing:d==="pills"?5:0,position:s,grow:l},R)),P&&D.createElement("div",{role:"tabpanel",className:b.body,key:w},P))});Gs.displayName="@mantine/core/Tabs";Gs.Tab=qP;X();var u1e=Object.defineProperty,d1e=Object.defineProperties,f1e=Object.getOwnPropertyDescriptors,ZW=Object.getOwnPropertySymbols,p1e=Object.prototype.hasOwnProperty,m1e=Object.prototype.propertyIsEnumerable,eq=(t,e,r)=>e in t?u1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,h1e=(t,e)=>{for(var r in e||(e={}))p1e.call(e,r)&&eq(t,r,e[r]);if(ZW)for(var r of ZW(e))m1e.call(e,r)&&eq(t,r,e[r]);return t},g1e=(t,e)=>d1e(t,f1e(e)),_1e=me((t,{color:e,radius:r})=>({root:{position:"relative",display:"inline-block"},body:g1e(h1e({},t.fn.fontStyles()),{backgroundColor:t.fn.themeColor(e,t.colorScheme==="dark"?3:9),lineHeight:t.lineHeight,fontSize:t.fontSizes.sm,borderRadius:t.fn.radius(r),padding:`${t.spacing.xs/2}px ${t.spacing.xs}px`,color:t.colorScheme==="dark"?t.colors.dark[9]:t.white,position:"relative",overflow:"hidden",textOverflow:"ellipsis"}),arrow:{border:0,background:t.fn.themeColor(e,t.colorScheme==="dark"?3:9),zIndex:1}})),tq=_1e;var x1e=Object.defineProperty,x0=Object.getOwnPropertySymbols,oq=Object.prototype.hasOwnProperty,nq=Object.prototype.propertyIsEnumerable,rq=(t,e,r)=>e in t?x1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b1e=(t,e)=>{for(var r in e||(e={}))oq.call(e,r)&&rq(t,r,e[r]);if(x0)for(var r of x0(e))nq.call(e,r)&&rq(t,r,e[r]);return t},y1e=(t,e)=>{var r={};for(var o in t)oq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&x0)for(var o of x0(t))e.indexOf(o)<0&&nq.call(t,o)&&(r[o]=t[o]);return r},v1e={openDelay:0,closeDelay:0,gutter:5,color:"gray",disabled:!1,withArrow:!1,arrowSize:2,position:"top",placement:"center",transition:"pop-top-left",transitionDuration:100,zIndex:Ar("popover"),width:"auto",wrapLines:!1,allowPointerEvents:!1,positionDependencies:[],withinPortal:!0},Se=ee((t,e)=>{let r=Ie("Tooltip",v1e,t),{className:o,label:n,children:i,opened:a,openDelay:s,closeDelay:l,gutter:c,color:u,radius:d,disabled:f,withArrow:m,arrowSize:h,position:g,placement:_,transition:b,transitionDuration:y,zIndex:v,transitionTimingFunction:C,width:N,wrapLines:I,allowPointerEvents:E,positionDependencies:w,withinPortal:S,tooltipRef:T,tooltipId:A,classNames:R,styles:P,onMouseLeave:B,onMouseEnter:$}=r,z=y1e(r,["className","label","children","opened","openDelay","closeDelay","gutter","color","radius","disabled","withArrow","arrowSize","position","placement","transition","transitionDuration","zIndex","transitionTimingFunction","width","wrapLines","allowPointerEvents","positionDependencies","withinPortal","tooltipRef","tooltipId","classNames","styles","onMouseLeave","onMouseEnter"]),{classes:H,cx:G,theme:Y}=tq({color:u,radius:d},{classNames:R,styles:P,name:"Tooltip"}),L=W(),ne=W(),[ae,U]=M(!1),ge=(typeof a=="boolean"?a:ae)&&!f,[Ce,He]=M(null),Qe=Sn(e,He),Me=()=>{window.clearTimeout(ne.current),s!==0?L.current=window.setTimeout(()=>{U(!0)},s):U(!0)},ke=()=>{window.clearTimeout(L.current),l!==0?ne.current=window.setTimeout(()=>{U(!1)},l):U(!1)};return V(()=>()=>{window.clearTimeout(L.current),window.clearTimeout(ne.current)},[]),D.createElement(_e,b1e({className:G(H.root,o),onPointerEnter:at=>{Me(),typeof $=="function"&&$(at)},onPointerLeave:at=>{ke(),typeof B=="function"&&B(at)},onFocusCapture:Me,onBlurCapture:ke,ref:Qe},z),D.createElement(Vl,{referenceElement:Ce,transitionDuration:y,transition:b,mounted:ge,position:g,placement:_,gutter:c,withArrow:m,arrowSize:h,arrowDistance:Y.fn.radius(d)>10?7:3,zIndex:v,arrowClassName:H.arrow,forceUpdateDependencies:[u,d,...w],withinPortal:S},D.createElement(_e,{className:H.body,ref:T,sx:{pointerEvents:E?"all":"none",whiteSpace:I?"normal":"nowrap",width:N}},n)),i)});Se.displayName="@mantine/core/Tooltip";X();X();var ox=ft(null);ox.displayName="@mantine/modals/ModalsContext";X();X();function Ct(){let t=lt(ox);if(!t)throw new Error("[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component");return t}var I1e=Object.defineProperty,w1e=Object.defineProperties,E1e=Object.getOwnPropertyDescriptors,iq=Object.getOwnPropertySymbols,S1e=Object.prototype.hasOwnProperty,C1e=Object.prototype.propertyIsEnumerable,aq=(t,e,r)=>e in t?I1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KP=(t,e)=>{for(var r in e||(e={}))S1e.call(e,r)&&aq(t,r,e[r]);if(iq)for(var r of iq(e))C1e.call(e,r)&&aq(t,r,e[r]);return t},sq=(t,e)=>w1e(t,E1e(e));function lq({id:t,cancelProps:e,confirmProps:r,labels:o={cancel:"",confirm:""},closeOnConfirm:n=!0,closeOnCancel:i=!0,groupProps:a,onCancel:s,onConfirm:l,children:c}){let{cancel:u,confirm:d}=o,f=Ct(),m=g=>{typeof e?.onClick=="function"&&e?.onClick(g),typeof s=="function"&&s(),i&&f.closeModal(t)},h=g=>{typeof r?.onClick=="function"&&r?.onClick(g),typeof l=="function"&&l(),n&&f.closeModal(t)};return D.createElement(D.Fragment,null,c&&D.createElement(_e,{mb:"md"},c),D.createElement(as,KP({position:"right"},a),D.createElement(re,sq(KP({variant:"default"},e),{onClick:m}),e?.children||u),D.createElement(re,sq(KP({},r),{onClick:h}),r?.children||d)))}function cq(t,e){switch(e.type){case"OPEN":return{current:e.payload,modals:[...t.modals,e.payload]};case"CLOSE":return{current:t.modals[t.modals.length-2]||null,modals:t.modals.filter(r=>r.id!==e.payload)};case"CLOSE_ALL":return{current:t.current,modals:[]};default:return t}}var T1e=Object.defineProperty,k1e=Object.defineProperties,N1e=Object.getOwnPropertyDescriptors,y0=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,pq=Object.prototype.propertyIsEnumerable,uq=(t,e,r)=>e in t?T1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b0=(t,e)=>{for(var r in e||(e={}))fq.call(e,r)&&uq(t,r,e[r]);if(y0)for(var r of y0(e))pq.call(e,r)&&uq(t,r,e[r]);return t},dq=(t,e)=>k1e(t,N1e(e)),YP=(t,e)=>{var r={};for(var o in t)fq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&y0)for(var o of y0(t))e.indexOf(o)<0&&pq.call(t,o)&&(r[o]=t[o]);return r};function P1e(t){if(!t)return{confirmProps:{},modalProps:{}};let e=t,{id:r,children:o,onCancel:n,onConfirm:i,closeOnConfirm:a,closeOnCancel:s,cancelProps:l,confirmProps:c,groupProps:u,labels:d}=e,f=YP(e,["id","children","onCancel","onConfirm","closeOnConfirm","closeOnCancel","cancelProps","confirmProps","groupProps","labels"]);return{confirmProps:{id:r,children:o,onCancel:n,onConfirm:i,closeOnConfirm:a,closeOnCancel:s,cancelProps:l,confirmProps:c,groupProps:u,labels:d},modalProps:b0({id:r},f)}}function XP({children:t,modalProps:e,labels:r,modals:o}){let[n,i]=Qn(cq,{modals:[],current:null}),a=g=>{n.modals.forEach(_=>{var b,y,v,C;_.type==="confirm"&&g&&((y=(b=_.props)==null?void 0:b.onCancel)==null||y.call(b)),(C=(v=_.props)==null?void 0:v.onClose)==null||C.call(v)}),i({type:"CLOSE_ALL"})},s=g=>{let _=g.id||Ml();return i({type:"OPEN",payload:{id:_,type:"content",props:g}}),_},l=g=>{let _=g.id||Ml();return i({type:"OPEN",payload:{id:_,type:"confirm",props:g}}),_},c=(g,_)=>{let b=_.id||Ml();return i({type:"OPEN",payload:{id:b,type:"context",props:_,ctx:g}}),b},u=(g,_)=>{var b,y,v,C;if(n.modals.length<=1){a(_);return}let N=n.modals.find(I=>I.id===g);N?.type==="confirm"&&_&&((y=(b=N.props)==null?void 0:b.onCancel)==null||y.call(b)),(C=(v=N?.props)==null?void 0:v.onClose)==null||C.call(v),i({type:"CLOSE",payload:N.id})},d={modals:n.modals,openModal:s,openConfirmModal:l,openContextModal:c,closeModal:u,closeAll:a},f=()=>{var g;switch((g=n.current)==null?void 0:g.type){case"context":{let _=n.current.props,{innerProps:b}=_,y=YP(_,["innerProps"]),v=o[n.current.ctx];return{modalProps:y,content:D.createElement(v,{innerProps:b,context:d,id:n.current.id})}}case"confirm":{let{modalProps:_,confirmProps:b}=P1e(n.current.props);return{modalProps:_,content:D.createElement(lq,dq(b0({},b),{id:n.current.id,labels:n.current.props.labels||r}))}}case"content":{let _=n.current.props,{children:b}=_;return{modalProps:YP(_,["children"]),content:D.createElement(D.Fragment,null,b)}}default:return{modalProps:{},content:null}}},{modalProps:m,content:h}=f();return D.createElement(ox.Provider,{value:d},D.createElement(eu,dq(b0(b0({},e),m),{opened:n.modals.length>0,onClose:()=>u(n.current.id)}),h),t)}X();var JP=ft(null);JP.displayName="@mantine/notifications/NotificationsContext";X();function nx(t,e){return nx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,n){return o.__proto__=n,o},nx(t,e)}function ix(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,nx(t,e)}X();X();var QP={disabled:!1};X();var Sm=D.createContext(null);var mq=function(e){return e.scrollTop};var ax="unmounted",Gd="exited",Wd="entering",Tm="entered",ZP="exiting",jl=(function(t){ix(e,t);function e(o,n){var i;i=t.call(this,o,n)||this;var a=n,s=a&&!a.isMounting?o.enter:o.appear,l;return i.appearStatus=null,o.in?s?(l=Gd,i.appearStatus=Wd):l=Tm:o.unmountOnExit||o.mountOnEnter?l=ax:l=Gd,i.state={status:l},i.nextCallback=null,i}e.getDerivedStateFromProps=function(n,i){var a=n.in;return a&&i.status===ax?{status:Gd}:null};var r=e.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(n){var i=null;if(n!==this.props){var a=this.state.status;this.props.in?a!==Wd&&a!==Tm&&(i=Wd):(a===Wd||a===Tm)&&(i=ZP)}this.updateStatus(!1,i)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var n=this.props.timeout,i,a,s;return i=a=s=n,n!=null&&typeof n!="number"&&(i=n.exit,a=n.enter,s=n.appear!==void 0?n.appear:a),{exit:i,enter:a,appear:s}},r.updateStatus=function(n,i){if(n===void 0&&(n=!1),i!==null)if(this.cancelNextCallback(),i===Wd){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:D.findDOMNode(this);a&&mq(a)}this.performEnter(n)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Gd&&this.setState({status:ax})},r.performEnter=function(n){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:n,l=this.props.nodeRef?[s]:[D.findDOMNode(this),s],c=l[0],u=l[1],d=this.getTimeouts(),f=s?d.appear:d.enter;if(!n&&!a||QP.disabled){this.safeSetState({status:Tm},function(){i.props.onEntered(c)});return}this.props.onEnter(c,u),this.safeSetState({status:Wd},function(){i.props.onEntering(c,u),i.onTransitionEnd(f,function(){i.safeSetState({status:Tm},function(){i.props.onEntered(c,u)})})})},r.performExit=function(){var n=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:D.findDOMNode(this);if(!i||QP.disabled){this.safeSetState({status:Gd},function(){n.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:ZP},function(){n.props.onExiting(s),n.onTransitionEnd(a.exit,function(){n.safeSetState({status:Gd},function(){n.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(n,i){i=this.setNextCallback(i),this.setState(n,i)},r.setNextCallback=function(n){var i=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,n(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(n,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:D.findDOMNode(this),s=n==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u)}n!=null&&setTimeout(this.nextCallback,n)},r.render=function(){var n=this.state.status;if(n===ax)return null;var i=this.props,a=i.children,s=i.in,l=i.mountOnEnter,c=i.unmountOnExit,u=i.appear,d=i.enter,f=i.exit,m=i.timeout,h=i.addEndListener,g=i.onEnter,_=i.onEntering,b=i.onEntered,y=i.onExit,v=i.onExiting,C=i.onExited,N=i.nodeRef,I=jd(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return D.createElement(Sm.Provider,{value:null},typeof a=="function"?a(n,I):D.cloneElement(D.Children.only(a),I))},e})(D.Component);jl.contextType=Sm;jl.propTypes={};function Cm(){}jl.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Cm,onEntering:Cm,onEntered:Cm,onExit:Cm,onExiting:Cm,onExited:Cm};jl.UNMOUNTED=ax;jl.EXITED=Gd;jl.ENTERING=Wd;jl.ENTERED=Tm;jl.EXITING=ZP;var eO=jl;function tO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}X();X();function v0(t,e){var r=function(i){return e&&Zn(i)?e(i):i},o=Object.create(null);return t&&vn.map(t,function(n){return n}).forEach(function(n){o[n.key]=r(n)}),o}function O1e(t,e){t=t||{},e=e||{};function r(u){return u in e?e[u]:t[u]}var o=Object.create(null),n=[];for(var i in t)i in e?n.length&&(o[i]=n,n=[]):n.push(i);var a,s={};for(var l in e){if(o[l])for(a=0;a<o[l].length;a++){var c=o[l][a];s[o[l][a]]=r(c)}s[l]=r(l)}for(a=0;a<n.length;a++)s[n[a]]=r(n[a]);return s}function qd(t,e,r){return r[e]!=null?r[e]:t.props[e]}function hq(t,e){return v0(t.children,function(r){return Gi(r,{onExited:e.bind(null,r),in:!0,appear:qd(r,"appear",t),enter:qd(r,"enter",t),exit:qd(r,"exit",t)})})}function gq(t,e,r){var o=v0(t.children),n=O1e(e,o);return Object.keys(n).forEach(function(i){var a=n[i];if(Zn(a)){var s=i in e,l=i in o,c=e[i],u=Zn(c)&&!c.props.in;l&&(!s||u)?n[i]=Gi(a,{onExited:r.bind(null,a),in:!0,exit:qd(a,"exit",t),enter:qd(a,"enter",t)}):!l&&s&&!u?n[i]=Gi(a,{in:!1}):l&&s&&Zn(c)&&(n[i]=Gi(a,{onExited:r.bind(null,a),in:c.props.in,exit:qd(a,"exit",t),enter:qd(a,"enter",t)}))}}),n}var A1e=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},D1e={component:"div",childFactory:function(e){return e}},rO=(function(t){ix(e,t);function e(o,n){var i;i=t.call(this,o,n)||this;var a=i.handleExited.bind(tO(i));return i.state={contextValue:{isMounting:!0},handleExited:a,firstRender:!0},i}var r=e.prototype;return r.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},r.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(n,i){var a=i.children,s=i.handleExited,l=i.firstRender;return{children:l?hq(n,s):gq(n,a,s),firstRender:!1}},r.handleExited=function(n,i){var a=v0(this.props.children);n.key in a||(n.props.onExited&&n.props.onExited(i),this.mounted&&this.setState(function(s){var l=pr({},s.children);return delete l[n.key],{children:l}}))},r.render=function(){var n=this.props,i=n.component,a=n.childFactory,s=jd(n,["component","childFactory"]),l=this.state.contextValue,c=A1e(this.state.children).map(a);return delete s.appear,delete s.enter,delete s.exit,i===null?D.createElement(Sm.Provider,{value:l},c):D.createElement(Sm.Provider,{value:l},D.createElement(i,s,c))},e})(D.Component);rO.propTypes={};rO.defaultProps=D1e;var oO=rO;X();var I0={show:"mantine:show-notification",hide:"mantine:hide-notification",update:"mantine:update-notification",clean:"mantine:clean-notifications",cleanQueue:"mantine:clean-notifications-queue"};function _q(t,e){return new CustomEvent(t,{detail:e})}function Ae(t){window.dispatchEvent(_q(I0.show,t))}function Ht(t){window.dispatchEvent(_q(I0.update,t))}function xq(t){let e={show:r=>t.showNotification(r.detail),hide:r=>t.hideNotification(r.detail),update:r=>t.updateNotification(r.detail.id,r.detail),clean:t.clean,cleanQueue:t.cleanQueue};V(()=>(Object.keys(e).forEach(r=>{window.addEventListener(I0[r],e[r])}),()=>{Object.keys(e).forEach(r=>{window.removeEventListener(I0[r],e[r])})}),[])}function R1e([t,e],r,o){let n={};return t==="top"&&(n.top=o),t==="bottom"&&(n.bottom=o),e==="left"&&(n.left=o),e==="right"&&(n.right=o),e==="center"&&(n.left="50%",n.transform="translateX(-50%)"),n}var bq=R1e;var M1e=Object.defineProperty,yq=Object.getOwnPropertySymbols,L1e=Object.prototype.hasOwnProperty,F1e=Object.prototype.propertyIsEnumerable,vq=(t,e,r)=>e in t?M1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Iq=(t,e)=>{for(var r in e||(e={}))L1e.call(e,r)&&vq(t,r,e[r]);if(yq)for(var r of yq(e))F1e.call(e,r)&&vq(t,r,e[r]);return t},wq={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},B1e={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function $1e({state:t,maxHeight:e,positioning:r,transitionDuration:o}){let[n,i]=r,a=i==="center"?`${n}-center`:i,s={opacity:0,maxHeight:e,transform:wq[a],transitionDuration:`${o}ms, ${o}ms, ${o}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},l={opacity:1,transform:B1e[a]},c={opacity:0,maxHeight:0,transform:wq[a]},u={entering:l,entered:l,exiting:c,exited:c};return Iq(Iq({},s),u[t])}var Eq=$1e;X();function z1e(t,e){return typeof e=="number"?e:e===!1||t===!1?!1:t}var Sq=z1e;var U1e=Object.defineProperty,V1e=Object.defineProperties,H1e=Object.getOwnPropertyDescriptors,w0=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,Pq=Object.prototype.propertyIsEnumerable,Cq=(t,e,r)=>e in t?U1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tq=(t,e)=>{for(var r in e||(e={}))Nq.call(e,r)&&Cq(t,r,e[r]);if(w0)for(var r of w0(e))Pq.call(e,r)&&Cq(t,r,e[r]);return t},j1e=(t,e)=>V1e(t,H1e(e)),kq=(t,e)=>{var r={};for(var o in t)Nq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&w0)for(var o of w0(t))e.indexOf(o)<0&&Pq.call(t,o)&&(r[o]=t[o]);return r};function Oq(t){var e=t,{notification:r,autoClose:o,onHide:n,innerRef:i}=e,a=kq(e,["notification","autoClose","onHide","innerRef"]);let s=r,{autoClose:l}=s,c=kq(s,["autoClose"]),u=Sq(o,l),d=W(),f=()=>{n(r.id),window.clearTimeout(d.current)},m=()=>{clearTimeout(d.current)},h=()=>{typeof u=="number"&&(d.current=window.setTimeout(f,u))};return V(()=>{typeof r.onOpen=="function"&&r.onOpen(r)},[]),V(()=>(h(),m),[o,r.autoClose]),D.createElement(a0,j1e(Tq(Tq({},c),a),{onClose:f,onMouseEnter:m,onMouseLeave:h,ref:i}),r.message)}Oq.displayName="@mantine/notifications/NotificationContainer";var Aq=Oq;var G1e=me(t=>({notifications:{width:`calc(100% - ${t.spacing.md*2}px)`,boxSizing:"border-box",position:"fixed",zIndex:1e3},notification:{"&:not(:first-of-type)":{marginTop:t.spacing.sm}}})),Dq=G1e;var W1e=Object.defineProperty,q1e=Object.defineProperties,K1e=Object.getOwnPropertyDescriptors,Rq=Object.getOwnPropertySymbols,Y1e=Object.prototype.hasOwnProperty,X1e=Object.prototype.propertyIsEnumerable,Mq=(t,e,r)=>e in t?W1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J1e=(t,e)=>{for(var r in e||(e={}))Y1e.call(e,r)&&Mq(t,r,e[r]);if(Rq)for(var r of Rq(e))X1e.call(e,r)&&Mq(t,r,e[r]);return t},Q1e=(t,e)=>q1e(t,K1e(e));function Z1e({limit:t}){let{state:e,queue:r,update:o,cleanQueue:n}=zN({initialValues:[],limit:t});return{notifications:e,queue:r,showNotification:c=>{let u=c.id||Ml();return o(d=>c.id&&d.some(f=>f.id===c.id)?d:[...d,Q1e(J1e({},c),{id:u})]),u},updateNotification:(c,u)=>o(d=>{let f=d.findIndex(h=>h.id===c);if(f===-1)return d;let m=[...d];return m[f]=u,m}),hideNotification:c=>o(u=>u.filter(d=>d.id===c?(typeof d.onClose=="function"&&d.onClose(d),!1):!0)),cleanQueue:n,clean:()=>o(()=>[])}}var Lq=Z1e;var eke=Object.defineProperty,E0=Object.getOwnPropertySymbols,Bq=Object.prototype.hasOwnProperty,$q=Object.prototype.propertyIsEnumerable,Fq=(t,e,r)=>e in t?eke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nO=(t,e)=>{for(var r in e||(e={}))Bq.call(e,r)&&Fq(t,r,e[r]);if(E0)for(var r of E0(e))$q.call(e,r)&&Fq(t,r,e[r]);return t},tke=(t,e)=>{var r={};for(var o in t)Bq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&E0)for(var o of E0(t))e.indexOf(o)<0&&$q.call(t,o)&&(r[o]=t[o]);return r},rke=["top-left","top-right","top-center","bottom-left","bottom-right","bottom-center"];function S0(t){var e=t,{className:r,position:o="bottom-right",autoClose:n=4e3,transitionDuration:i=250,containerWidth:a=440,notificationMaxHeight:s=200,limit:l=5,zIndex:c=Ar("overlay"),style:u,children:d}=e,f=tke(e,["className","position","autoClose","transitionDuration","containerWidth","notificationMaxHeight","limit","zIndex","style","children"]);let m=BN(),h=W({}),g=W(0),{notifications:_,queue:b,showNotification:y,updateNotification:v,hideNotification:C,clean:N,cleanQueue:I}=Lq({limit:l}),w=ts()?1:i,{classes:S,cx:T,theme:A}=Dq(),R=(rke.includes(o)?o:"bottom-right").split("-"),P={notifications:_,queue:b,showNotification:y,hideNotification:C,updateNotification:v,clean:N,cleanQueue:I};mr(()=>{_.length>g.current&&setTimeout(()=>m(),0),g.current=_.length},[_]),xq(P);let B=_.map($=>D.createElement(eO,{key:$.id,timeout:w,onEnter:()=>h.current[$.id].offsetHeight,nodeRef:{current:h.current[$.id]}},z=>D.createElement(Aq,{innerRef:H=>{h.current[$.id]=H},notification:$,onHide:C,className:S.notification,autoClose:n,sx:[nO({},Eq({state:z,positioning:R,transitionDuration:w,maxHeight:s})),...Array.isArray($.sx)?$.sx:[$.sx]]})));return D.createElement(JP.Provider,{value:P},D.createElement(jc,{zIndex:c},D.createElement(_e,nO({className:T(S.notifications,r),style:u,sx:nO({maxWidth:a},bq(R,a,A.spacing.md))},f),D.createElement(oO,null,B))),d)}S0.displayName="@mantine/notifications/NotificationsProvider";var zq=()=>{};var Hq=function(t){let e=[],r=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);n<128?e[r++]=n:n<2048?(e[r++]=n>>6|192,e[r++]=n&63|128):(n&64512)===55296&&o+1<t.length&&(t.charCodeAt(o+1)&64512)===56320?(n=65536+((n&1023)<<10)+(t.charCodeAt(++o)&1023),e[r++]=n>>18|240,e[r++]=n>>12&63|128,e[r++]=n>>6&63|128,e[r++]=n&63|128):(e[r++]=n>>12|224,e[r++]=n>>6&63|128,e[r++]=n&63|128)}return e},oke=function(t){let e=[],r=0,o=0;for(;r<t.length;){let n=t[r++];if(n<128)e[o++]=String.fromCharCode(n);else if(n>191&&n<224){let i=t[r++];e[o++]=String.fromCharCode((n&31)<<6|i&63)}else if(n>239&&n<365){let i=t[r++],a=t[r++],s=t[r++],l=((n&7)<<18|(i&63)<<12|(a&63)<<6|s&63)-65536;e[o++]=String.fromCharCode(55296+(l>>10)),e[o++]=String.fromCharCode(56320+(l&1023))}else{let i=t[r++],a=t[r++];e[o++]=String.fromCharCode((n&15)<<12|(i&63)<<6|a&63)}}return e.join("")},jq={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let n=0;n<t.length;n+=3){let i=t[n],a=n+1<t.length,s=a?t[n+1]:0,l=n+2<t.length,c=l?t[n+2]:0,u=i>>2,d=(i&3)<<4|s>>4,f=(s&15)<<2|c>>6,m=c&63;l||(m=64,a||(f=64)),o.push(r[u],r[d],r[f],r[m])}return o.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Hq(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):oke(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let r=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let n=0;n<t.length;){let i=r[t.charAt(n++)],s=n<t.length?r[t.charAt(n)]:0;++n;let c=n<t.length?r[t.charAt(n)]:64;++n;let d=n<t.length?r[t.charAt(n)]:64;if(++n,i==null||s==null||c==null||d==null)throw new aO;let f=i<<2|s>>4;if(o.push(f),c!==64){let m=s<<4&240|c>>2;if(o.push(m),d!==64){let h=c<<6&192|d;o.push(h)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},aO=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},nke=function(t){let e=Hq(t);return jq.encodeByteArray(e,!0)},lx=function(t){return nke(t).replace(/\./g,"")},T0=function(t){try{return jq.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Gq(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var ike=()=>Gq().__FIREBASE_DEFAULTS__,ake=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},ske=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&T0(t[1]);return e&&JSON.parse(e)},k0=()=>{try{return zq()||ike()||ake()||ske()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},lO=t=>k0()?.emulatorHosts?.[t],cO=t=>{let e=lO(t);if(!e)return;let r=e.lastIndexOf(":");if(r<=0||r+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let o=parseInt(e.substring(r+1),10);return e[0]==="["?[e.substring(1,r-1),o]:[e.substring(0,r),o]},uO=()=>k0()?.config,dO=t=>k0()?.[`_${t}`];var C0=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}wrapCallback(e){return(r,o)=>{r?this.reject(r):this.resolve(o),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(r):e(r,o))}}};function ss(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function km(t){return(await fetch(t,{credentials:"include"})).ok}function fO(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let r={alg:"none",type:"JWT"},o=e||"demo-project",n=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let a={iss:`https://securetoken.google.com/${o}`,aud:o,iat:n,exp:n+3600,auth_time:n,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[lx(JSON.stringify(r)),lx(JSON.stringify(a)),""].join(".")}var sx={};function lke(){let t={prod:[],emulator:[]};for(let e of Object.keys(sx))sx[e]?t.emulator.push(e):t.prod.push(e);return t}function cke(t){let e=document.getElementById(t),r=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),r=!0),{created:r,element:e}}var Uq=!1;function cx(t,e){if(typeof window>"u"||typeof document>"u"||!ss(window.location.host)||sx[t]===e||sx[t]||Uq)return;sx[t]=e;function r(f){return`__firebase__banner__${f}`}let o="__firebase__banner",i=lke().prod.length>0;function a(){let f=document.getElementById(o);f&&f.remove()}function s(f){f.style.display="flex",f.style.background="#7faaf0",f.style.position="fixed",f.style.bottom="5px",f.style.left="5px",f.style.padding=".5em",f.style.borderRadius="5px",f.style.alignItems="center"}function l(f,m){f.setAttribute("width","24"),f.setAttribute("id",m),f.setAttribute("height","24"),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("fill","none"),f.style.marginLeft="-6px"}function c(){let f=document.createElement("span");return f.style.cursor="pointer",f.style.marginLeft="16px",f.style.fontSize="24px",f.innerHTML=" &times;",f.onclick=()=>{Uq=!0,a()},f}function u(f,m){f.setAttribute("id",m),f.innerText="Learn more",f.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",f.setAttribute("target","__blank"),f.style.paddingLeft="5px",f.style.textDecoration="underline"}function d(){let f=cke(o),m=r("text"),h=document.getElementById(m)||document.createElement("span"),g=r("learnmore"),_=document.getElementById(g)||document.createElement("a"),b=r("preprendIcon"),y=document.getElementById(b)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(f.created){let v=f.element;s(v),u(_,g);let C=c();l(y,b),v.append(y,h,_,C),document.body.appendChild(v)}i?(h.innerText="Preview backend disconnected.",y.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
11
+ `};function DV(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function RV(t){(document.head||document.getElementsByTagName("head")[0]).appendChild(t)}function MV(){let t=document.createElement("style");return t.type="text/css",t.setAttribute("mantine-scroll-lock",""),t}function UN(t,e={disableBodyPadding:!1}){let[r,o]=M(t||!1),n=W(0),{disableBodyPadding:i}=e,a=W(null),s=()=>{n.current=window.scrollY;let c=AV({disableBodyPadding:i}),u=MV();DV(u,c),RV(u),a.current=u},l=()=>{a?.current&&(a.current.parentNode.removeChild(a.current),a.current=null)};return V(()=>(r?s():l(),l),[r]),V(()=>{t!==void 0&&o(t)},[t]),V(()=>{t===void 0&&typeof window<"u"&&window.document.body.style.overflow==="hidden"&&o(!0)},[o]),[r,o]}X();var vxe=Object.defineProperty,Ixe=Object.defineProperties,wxe=Object.getOwnPropertyDescriptors,LV=Object.getOwnPropertySymbols,Exe=Object.prototype.hasOwnProperty,Sxe=Object.prototype.propertyIsEnumerable,FV=(t,e,r)=>e in t?vxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cxe=(t,e)=>{for(var r in e||(e={}))Exe.call(e,r)&&FV(t,r,e[r]);if(LV)for(var r of LV(e))Sxe.call(e,r)&&FV(t,r,e[r]);return t},Txe=(t,e)=>Ixe(t,wxe(e));function kxe(t){let e=t.toLowerCase().split("+").map(i=>i.trim()),r={alt:e.includes("alt"),ctrl:e.includes("ctrl"),meta:e.includes("meta"),mod:e.includes("mod"),shift:e.includes("shift")},o=["alt","ctrl","meta","shift","mod"],n=e.find(i=>!o.includes(i));return Txe(Cxe({},r),{key:n})}function Nxe(t,e){let{alt:r,ctrl:o,meta:n,mod:i,shift:a,key:s}=t,{altKey:l,ctrlKey:c,metaKey:u,shiftKey:d,key:f}=e;if(r!==l)return!1;if(i){if(!c&&!u)return!1}else if(o!==c||n!==u)return!1;return a!==d?!1:!!(s&&(f.toLowerCase()===s.toLowerCase()||e.code.replace("Key","").toLowerCase()===s.toLowerCase()))}function BV(t){return e=>Nxe(kxe(t),e)}function Pxe(t){return t.target instanceof HTMLElement?!["INPUT","TEXTAREA","SELECT"].includes(t.target.tagName):!0}function VN(t){V(()=>{let e=r=>{t.forEach(([o,n])=>{BV(o)(r)&&Pxe(r)&&(r.preventDefault(),n(r))})};return document.documentElement.addEventListener("keydown",e),()=>document.documentElement.removeEventListener("keydown",e)},[t])}X();function lo(t){let[e,r]=M("");return A_(()=>{r(Ml())},[]),t||e}function Oxe(){let{userAgent:t}=window.navigator,e=/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i,r=/(Win32)|(Win64)|(Windows)|(WinCE)/i,o=/(iPhone)|(iPad)|(iPod)/i;return e.test(t)?"macos":o.test(t)?"ios":r.test(t)?"windows":/Android/i.test(t)?"android":/Linux/i.test(t)?"linux":"undetermined"}function HN(){return typeof window<"u"?Oxe():"undetermined"}var Axe=Object.defineProperty,Dxe=Object.defineProperties,Rxe=Object.getOwnPropertyDescriptors,$V=Object.getOwnPropertySymbols,Mxe=Object.prototype.hasOwnProperty,Lxe=Object.prototype.propertyIsEnumerable,zV=(t,e,r)=>e in t?Axe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fxe=(t,e)=>{for(var r in e||(e={}))Mxe.call(e,r)&&zV(t,r,e[r]);if($V)for(var r of $V(e))Lxe.call(e,r)&&zV(t,r,e[r]);return t},Bxe=(t,e)=>Dxe(t,Rxe(e));function UV(t,e=-1){return Array.from({length:t}).reduce((r,o,n)=>(r[n]=n===e,r),{})}function VV({initialState:t,total:e,initialItem:r=-1,state:o,onChange:n,multiple:i=!1}){let[a,s]=Cn({value:o,defaultValue:t||UV(e,r),finalValue:{},onChange:n,rule:c=>c!==null&&typeof c=="object"}),l=c=>{if(i)s(Bxe(Fxe({},a),{[c]:!a[c]}));else{let u=Array(e).fill(0).reduce((d,f,m)=>(d[m]=!1,d),{});u[c]=!a[c],s(u)}};return mr(()=>{i||s(UV(e))},[i]),[a,{toggle:l,setState:s}]}X();X();X();var $xe=Object.defineProperty,HV=Object.getOwnPropertySymbols,zxe=Object.prototype.hasOwnProperty,Uxe=Object.prototype.propertyIsEnumerable,jV=(t,e,r)=>e in t?$xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vxe=(t,e)=>{for(var r in e||(e={}))zxe.call(e,r)&&jV(t,r,e[r]);if(HV)for(var r of HV(e))Uxe.call(e,r)&&jV(t,r,e[r]);return t};function GV(t){return D.createElement("svg",Vxe({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16},t),D.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var Hxe=Object.defineProperty,jxe=Object.defineProperties,Gxe=Object.getOwnPropertyDescriptors,WV=Object.getOwnPropertySymbols,Wxe=Object.prototype.hasOwnProperty,qxe=Object.prototype.propertyIsEnumerable,qV=(t,e,r)=>e in t?Hxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DI=(t,e)=>{for(var r in e||(e={}))Wxe.call(e,r)&&qV(t,r,e[r]);if(WV)for(var r of WV(e))qxe.call(e,r)&&qV(t,r,e[r]);return t},KV=(t,e)=>jxe(t,Gxe(e)),Kxe=me((t,{transitionDuration:e,disableIconRotation:r,iconPosition:o,offsetIcon:n,iconSize:i},a)=>({icon:{ref:a("icon"),transition:`transform ${e}ms ease`,marginRight:o==="right"?0:t.spacing.sm,marginLeft:o==="right"?t.spacing.lg:0,width:i,minWidth:i},label:{color:"inherit",fontWeight:500,flex:1,overflow:"hidden",textOverflow:"ellipsis"},item:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},itemOpened:{[`& > .${a("itemTitle")} > .${a("control")} .${a("icon")}`]:{transform:r?"none":"rotate(180deg)"}},itemTitle:{ref:a("itemTitle"),margin:0,padding:0,fontWeight:"normal"},control:DI(KV(DI(DI({},t.fn.focusStyles()),t.fn.fontStyles()),{ref:a("control"),width:"100%",display:"flex",alignItems:"center",flexDirection:o==="right"?"row-reverse":"row",padding:`${t.spacing.md}px ${t.spacing.md/2}px`,paddingLeft:o==="right"?t.spacing.sm+4:null,fontWeight:500,textAlign:"left",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}),t.fn.hover({backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[0]})),content:KV(DI({},t.fn.fontStyles()),{wordBreak:"break-word",lineHeight:t.lineHeight,paddingLeft:o==="right"?0:n?i+t.spacing.xs/2:0}),contentInner:{padding:t.spacing.md,paddingTop:t.spacing.xs/2}})),YV=Kxe;X();var XV={mt:"marginTop",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",pt:"paddingTop",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight"},Yxe=["-xs","-sm","-md","-lg","-xl"];function Nd(t){return typeof t=="string"||typeof t=="number"}function Pd(t,e){return Yxe.includes(t)?e.fn.size({size:t.replace("-",""),sizes:e.spacing})*-1:e.fn.size({size:t,sizes:e.spacing})}function jN(t,e){let r={};if(Nd(t.p)){let o=Pd(t.p,e);r.padding=o}if(Nd(t.m)){let o=Pd(t.m,e);r.margin=o}if(Nd(t.py)){let o=Pd(t.py,e);r.paddingTop=o,r.paddingBottom=o}if(Nd(t.px)){let o=Pd(t.px,e);r.paddingLeft=o,r.paddingRight=o}if(Nd(t.my)){let o=Pd(t.my,e);r.marginTop=o,r.marginBottom=o}if(Nd(t.mx)){let o=Pd(t.mx,e);r.marginLeft=o,r.marginRight=o}return Object.keys(XV).forEach(o=>{Nd(t[o])&&(r[XV[o]]=e.fn.size({size:Pd(t[o],e),sizes:e.spacing}))}),r}function JV(t,e){return typeof t=="function"?t(e):t}function QV(t,e,r){let o=dr(),{css:n,cx:i}=T_();return Array.isArray(t)?i(r,n(jN(e,o)),t.map(a=>n(JV(a,o)))):i(r,n(JV(t,o)),n(jN(e,o)))}var Xxe=Object.defineProperty,RI=Object.getOwnPropertySymbols,e9=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,ZV=(t,e,r)=>e in t?Xxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jxe=(t,e)=>{for(var r in e||(e={}))e9.call(e,r)&&ZV(t,r,e[r]);if(RI)for(var r of RI(e))t9.call(e,r)&&ZV(t,r,e[r]);return t},Qxe=(t,e)=>{var r={};for(var o in t)e9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&RI)for(var o of RI(t))e.indexOf(o)<0&&t9.call(t,o)&&(r[o]=t[o]);return r},_e=ee((t,e)=>{var r=t,{className:o,component:n,style:i,sx:a}=r,s=Qxe(r,["className","component","style","sx"]);let{systemStyles:l,rest:c}=so(s),u=n||"div";return D.createElement(u,Jxe({ref:e,className:QV(a,l,o),style:i},c))});_e.displayName="@mantine/core/Box";X();var Zxe=Object.defineProperty,ebe=Object.defineProperties,tbe=Object.getOwnPropertyDescriptors,r9=Object.getOwnPropertySymbols,rbe=Object.prototype.hasOwnProperty,obe=Object.prototype.propertyIsEnumerable,o9=(t,e,r)=>e in t?Zxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n9=(t,e)=>{for(var r in e||(e={}))rbe.call(e,r)&&o9(t,r,e[r]);if(r9)for(var r of r9(e))obe.call(e,r)&&o9(t,r,e[r]);return t},nbe=(t,e)=>ebe(t,tbe(e)),ibe=me(t=>({root:nbe(n9(n9({},t.fn.focusStyles()),t.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:t.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,textDecoration:"none"})})),i9=ibe;var abe=Object.defineProperty,MI=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,l9=Object.prototype.propertyIsEnumerable,a9=(t,e,r)=>e in t?abe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sbe=(t,e)=>{for(var r in e||(e={}))s9.call(e,r)&&a9(t,r,e[r]);if(MI)for(var r of MI(e))l9.call(e,r)&&a9(t,r,e[r]);return t},lbe=(t,e)=>{var r={};for(var o in t)s9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&MI)for(var o of MI(t))e.indexOf(o)<0&&l9.call(t,o)&&(r[o]=t[o]);return r},GN=ee((t,e)=>{var r=t,{className:o,component:n="button"}=r,i=lbe(r,["className","component"]);let{classes:a,cx:s}=i9(null,{name:"UnstyledButton"});return D.createElement(_e,sbe({component:n,ref:e,className:s(a.root,o),type:n==="button"?"button":void 0},i))});GN.displayName="@mantine/core/UnstyledButton";X();var cbe=Object.defineProperty,LI=Object.getOwnPropertySymbols,u9=Object.prototype.hasOwnProperty,d9=Object.prototype.propertyIsEnumerable,c9=(t,e,r)=>e in t?cbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ube=(t,e)=>{for(var r in e||(e={}))u9.call(e,r)&&c9(t,r,e[r]);if(LI)for(var r of LI(e))d9.call(e,r)&&c9(t,r,e[r]);return t},dbe=(t,e)=>{var r={};for(var o in t)u9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&LI)for(var o of LI(t))e.indexOf(o)<0&&d9.call(t,o)&&(r[o]=t[o]);return r},L_=ee((t,e)=>{let r=Ie("Center",{},t),{inline:o,sx:n}=r,i=dbe(r,["inline","sx"]);return D.createElement(_e,ube({ref:e,sx:[{display:o?"inline-flex":"flex",alignItems:"center",justifyContent:"center"},...Array.isArray(n)?n:[n]]},i))});L_.displayName="@mantine/core/Center";X();X();X();var fbe=Object.defineProperty,pbe=Object.defineProperties,mbe=Object.getOwnPropertyDescriptors,BI=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,f9=(t,e,r)=>e in t?fbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Od=(t,e)=>{for(var r in e||(e={}))p9.call(e,r)&&f9(t,r,e[r]);if(BI)for(var r of BI(e))m9.call(e,r)&&f9(t,r,e[r]);return t},WN=(t,e)=>pbe(t,mbe(e)),hbe=(t,e)=>{var r={};for(var o in t)p9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&BI)for(var o of BI(t))e.indexOf(o)<0&&m9.call(t,o)&&(r[o]=t[o]);return r};function gbe(t){if(!t||typeof t=="string")return 0;let e=t/36;return Math.round((4+15*e**.25+e/5)*10)}function qN(t){return t?.current?t.current.scrollHeight:"auto"}var FI=typeof window<"u"&&window.requestAnimationFrame;function h9({transitionDuration:t,transitionTimingFunction:e="ease",onTransitionEnd:r=()=>{},opened:o}){let n=W(null),i="0px",a={display:"none",height:"0px",overflow:"hidden"},[s,l]=M(o?{}:a),c=h=>{Dl(()=>l(h))},u=h=>{c(g=>Od(Od({},g),h))};function d(h){return{transition:`height ${t||gbe(h)}ms ${e}`}}mr(()=>{FI(o?()=>{u({willChange:"height",display:"block",overflow:"hidden"}),FI(()=>{let h=qN(n);u(WN(Od({},d(h)),{height:h}))})}:()=>{let h=qN(n);u(WN(Od({},d(h)),{willChange:"height",height:h})),FI(()=>u({height:i,overflow:"hidden"}))})},[o]);let f=h=>{if(!(h.target!==n.current||h.propertyName!=="height"))if(o){let g=qN(n);g===s.height?c({}):u({height:g}),r()}else s.height===i&&(c(a),r())};function m(h={}){var g=h,{style:_={},refKey:b="ref"}=g,y=hbe(g,["style","refKey"]);let v=y[b];return WN(Od({"aria-hidden":!o},y),{[b]:Sn(n,v),onTransitionEnd:f,style:Od(Od({boxSizing:"border-box"},_),s)})}return m}var _be=Object.defineProperty,zI=Object.getOwnPropertySymbols,_9=Object.prototype.hasOwnProperty,x9=Object.prototype.propertyIsEnumerable,g9=(t,e,r)=>e in t?_be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$I=(t,e)=>{for(var r in e||(e={}))_9.call(e,r)&&g9(t,r,e[r]);if(zI)for(var r of zI(e))x9.call(e,r)&&g9(t,r,e[r]);return t},xbe=(t,e)=>{var r={};for(var o in t)_9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&zI)for(var o of zI(t))e.indexOf(o)<0&&x9.call(t,o)&&(r[o]=t[o]);return r},bbe={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0};function KN(t){let e=Ie("Collapse",bbe,t),{children:r,in:o,transitionDuration:n,transitionTimingFunction:i,style:a,onTransitionEnd:s,animateOpacity:l}=e,c=xbe(e,["children","in","transitionDuration","transitionTimingFunction","style","onTransitionEnd","animateOpacity"]),d=ts()?0:n,{systemStyles:f,rest:m}=so(c),h=h9({opened:o,transitionDuration:d,transitionTimingFunction:i,onTransitionEnd:s});return d===0?o?D.createElement(_e,$I({},m),r):null:D.createElement(_e,$I({},h($I($I({style:a},m),f))),D.createElement("div",{style:{opacity:o||!l?1:0,transition:l?`opacity ${d}ms ${i}`:"none"}},r))}KN.displayName="@mantine/core/Collapse";var ybe=Object.defineProperty,UI=Object.getOwnPropertySymbols,y9=Object.prototype.hasOwnProperty,v9=Object.prototype.propertyIsEnumerable,b9=(t,e,r)=>e in t?ybe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vbe=(t,e)=>{for(var r in e||(e={}))y9.call(e,r)&&b9(t,r,e[r]);if(UI)for(var r of UI(e))v9.call(e,r)&&b9(t,r,e[r]);return t},Ibe=(t,e)=>{var r={};for(var o in t)y9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&UI)for(var o of UI(t))e.indexOf(o)<0&&v9.call(t,o)&&(r[o]=t[o]);return r};function F_(t){var e=t,{opened:r,onToggle:o,label:n,children:i,className:a,classNames:s,styles:l,transitionDuration:c,icon:u=D.createElement(GV,null),disableIconRotation:d=!1,offsetIcon:f=!0,iconSize:m=24,iconPosition:h="left",order:g=3,id:_,controlRef:b,onControlKeyDown:y}=e,v=Ibe(e,["opened","onToggle","label","children","className","classNames","styles","transitionDuration","icon","disableIconRotation","offsetIcon","iconSize","iconPosition","order","id","controlRef","onControlKeyDown"]);let N=ts()?0:c,{classes:I,cx:E}=YV({transitionDuration:N,disableIconRotation:d,iconPosition:h,offsetIcon:f,iconSize:m},{classNames:s,styles:l,name:"Accordion"}),S=`h${Math.min(6,Math.max(2,g))}`;return D.createElement(_e,vbe({className:E(I.item,{[I.itemOpened]:r},a)},v),D.createElement(S,{className:I.itemTitle},D.createElement(GN,{className:I.control,onClick:o,type:"button","aria-expanded":r,"aria-controls":`${_}-body`,id:_,ref:b,onKeyDown:y},D.createElement(L_,{className:I.icon},u),D.createElement("div",{className:I.label},n))),D.createElement(KN,{in:r,transitionDuration:N},D.createElement("div",{className:I.content,role:"region",id:`${_}-body`,"aria-labelledby":_},D.createElement("div",{className:I.contentInner},i))))}F_.displayName="@mantine/core/AccordionItem";X();function I9(t){let e=W([]),r=n=>i=>{var a,s;if(i.code==="ArrowDown"){i.preventDefault();let l=e.current[n+1];l?l.focus():(a=e.current[0])==null||a.focus()}if(i.code==="ArrowUp"){i.preventDefault();let l=e.current[n-1];l?l.focus():(s=e.current[e.current.length-1])==null||s.focus()}},o=n=>i=>{e.current[n]=i};return mr(()=>{e.current=e.current.slice(0,t)},[t]),{handleItemKeydown:r,assignControlRef:o}}var wbe=Object.defineProperty,Ebe=Object.defineProperties,Sbe=Object.getOwnPropertyDescriptors,VI=Object.getOwnPropertySymbols,S9=Object.prototype.hasOwnProperty,C9=Object.prototype.propertyIsEnumerable,w9=(t,e,r)=>e in t?wbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E9=(t,e)=>{for(var r in e||(e={}))S9.call(e,r)&&w9(t,r,e[r]);if(VI)for(var r of VI(e))C9.call(e,r)&&w9(t,r,e[r]);return t},Cbe=(t,e)=>Ebe(t,Sbe(e)),Tbe=(t,e)=>{var r={};for(var o in t)S9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&VI)for(var o of VI(t))e.indexOf(o)<0&&C9.call(t,o)&&(r[o]=t[o]);return r},kbe={initialItem:-1,multiple:!1,disableIconRotation:!1,transitionDuration:200,iconPosition:"left",offsetIcon:!0,iconSize:24,order:3},Hc=ee((t,e)=>{let r=Ie("Accordion",kbe,t),{children:o,initialItem:n,initialState:i,state:a,onChange:s,multiple:l,disableIconRotation:c,transitionDuration:u,iconPosition:d,offsetIcon:f,iconSize:m,order:h,icon:g,classNames:_,styles:b,id:y}=r,v=Tbe(r,["children","initialItem","initialState","state","onChange","multiple","disableIconRotation","transitionDuration","iconPosition","offsetIcon","iconSize","order","icon","classNames","styles","id"]),C=lo(y),N=PI(o,F_),{handleItemKeydown:I,assignControlRef:E}=I9(N.length),[w,S]=VV({multiple:l,total:N.length,initialItem:n,state:a,initialState:i,onChange:s}),T=N.map((A,R)=>{var P,B,$;return D.createElement(F_,Cbe(E9({},A.props),{icon:A.props.icon||g,iconPosition:A.props.iconPosition||d,disableIconRotation:c,key:R,transitionDuration:u,opened:w[R],onToggle:()=>S.toggle(R),classNames:((P=A.props)==null?void 0:P.classNames)||_,styles:((B=A.props)==null?void 0:B.styles)||b,id:`${C}-${R}`,onControlKeyDown:I(R),controlRef:kd(E(R),($=A.props)==null?void 0:$.controlRef),offsetIcon:f,iconSize:m,order:h}))});return D.createElement(_e,E9({ref:e},v),T)});Hc.Item=F_;Hc.displayName="@mantine/core/Accordion";X();var Nbe=Object.defineProperty,Pbe=Object.defineProperties,Obe=Object.getOwnPropertyDescriptors,T9=Object.getOwnPropertySymbols,Abe=Object.prototype.hasOwnProperty,Dbe=Object.prototype.propertyIsEnumerable,k9=(t,e,r)=>e in t?Nbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HI=(t,e)=>{for(var r in e||(e={}))Abe.call(e,r)&&k9(t,r,e[r]);if(T9)for(var r of T9(e))Dbe.call(e,r)&&k9(t,r,e[r]);return t},Rbe=(t,e)=>Pbe(t,Obe(e)),mm={xs:18,sm:22,md:28,lg:34,xl:44};function pm({variant:t,theme:e,color:r}){if(t==="hover"||t==="transparent")return HI({border:"1px solid transparent",color:e.fn.themeColor(r,e.colorScheme==="dark"?4:7),backgroundColor:"transparent"},e.fn.hover(t==="transparent"?{}:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.fn.themeColor(r,0)}));let o=e.fn.variant({color:r,variant:t});return HI({backgroundColor:o.background,color:o.color,border:`1px solid ${o.border}`},e.fn.hover({backgroundColor:o.hover}))}var Mbe=me((t,{color:e,size:r,radius:o})=>({root:Rbe(HI(HI({},t.fn.focusStyles()),t.fn.fontStyles()),{position:"relative",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent",boxSizing:"border-box",height:t.fn.size({size:r,sizes:mm}),minHeight:t.fn.size({size:r,sizes:mm}),width:t.fn.size({size:r,sizes:mm}),minWidth:t.fn.size({size:r,sizes:mm}),borderRadius:t.fn.radius(o),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer","&:disabled":{color:t.colors.gray[t.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:t.fn.themeColor("gray",t.colorScheme==="dark"?8:1),borderColor:t.fn.themeColor("gray",t.colorScheme==="dark"?8:1)},"&:not(:disabled):active":{transform:"translateY(1px)"}}),outline:pm({theme:t,color:e,variant:"outline"}),filled:pm({theme:t,color:e,variant:"filled"}),default:pm({theme:t,color:e,variant:"default"}),light:pm({theme:t,color:e,variant:"light"}),hover:pm({theme:t,color:e,variant:"hover"}),transparent:pm({theme:t,color:e,variant:"transparent"}),loading:{"&::before":{content:'""',position:"absolute",top:-1,left:-1,right:-1,bottom:-1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:t.fn.radius(o),cursor:"not-allowed"}}})),N9=Mbe;X();X();var Lbe=Object.defineProperty,jI=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,A9=Object.prototype.propertyIsEnumerable,P9=(t,e,r)=>e in t?Lbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fbe=(t,e)=>{for(var r in e||(e={}))O9.call(e,r)&&P9(t,r,e[r]);if(jI)for(var r of jI(e))A9.call(e,r)&&P9(t,r,e[r]);return t},Bbe=(t,e)=>{var r={};for(var o in t)O9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&jI)for(var o of jI(t))e.indexOf(o)<0&&A9.call(t,o)&&(r[o]=t[o]);return r};function D9(t){var e=t,{size:r,color:o}=e,n=Bbe(e,["size","color"]);return D.createElement("svg",Fbe({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:o,width:`${r}px`},n),D.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},D.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}X();var $be=Object.defineProperty,GI=Object.getOwnPropertySymbols,M9=Object.prototype.hasOwnProperty,L9=Object.prototype.propertyIsEnumerable,R9=(t,e,r)=>e in t?$be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zbe=(t,e)=>{for(var r in e||(e={}))M9.call(e,r)&&R9(t,r,e[r]);if(GI)for(var r of GI(e))L9.call(e,r)&&R9(t,r,e[r]);return t},Ube=(t,e)=>{var r={};for(var o in t)M9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&GI)for(var o of GI(t))e.indexOf(o)<0&&L9.call(t,o)&&(r[o]=t[o]);return r};function F9(t){var e=t,{size:r,color:o}=e,n=Ube(e,["size","color"]);return D.createElement("svg",zbe({width:`${r}px`,height:`${r}px`,viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:o},n),D.createElement("g",{fill:"none",fillRule:"evenodd"},D.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},D.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),D.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},D.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}X();var Vbe=Object.defineProperty,WI=Object.getOwnPropertySymbols,$9=Object.prototype.hasOwnProperty,z9=Object.prototype.propertyIsEnumerable,B9=(t,e,r)=>e in t?Vbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hbe=(t,e)=>{for(var r in e||(e={}))$9.call(e,r)&&B9(t,r,e[r]);if(WI)for(var r of WI(e))z9.call(e,r)&&B9(t,r,e[r]);return t},jbe=(t,e)=>{var r={};for(var o in t)$9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&WI)for(var o of WI(t))e.indexOf(o)<0&&z9.call(t,o)&&(r[o]=t[o]);return r};function U9(t){var e=t,{size:r,color:o}=e,n=jbe(e,["size","color"]);return D.createElement("svg",Hbe({width:`${r}px`,height:`${r/4}px`,viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:o},n),D.createElement("circle",{cx:"15",cy:"15",r:"15"},D.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},D.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),D.createElement("circle",{cx:"105",cy:"15",r:"15"},D.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),D.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var Gbe=Object.defineProperty,qI=Object.getOwnPropertySymbols,H9=Object.prototype.hasOwnProperty,j9=Object.prototype.propertyIsEnumerable,V9=(t,e,r)=>e in t?Gbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wbe=(t,e)=>{for(var r in e||(e={}))H9.call(e,r)&&V9(t,r,e[r]);if(qI)for(var r of qI(e))j9.call(e,r)&&V9(t,r,e[r]);return t},qbe=(t,e)=>{var r={};for(var o in t)H9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&qI)for(var o of qI(t))e.indexOf(o)<0&&j9.call(t,o)&&(r[o]=t[o]);return r},YN={bars:D9,oval:F9,dots:U9},G9={xs:18,sm:22,md:36,lg:44,xl:58},Kbe={size:"md"};function Ze(t){let e=Ie("Loader",Kbe,t),{size:r="md",color:o,variant:n}=e,i=qbe(e,["size","color","variant"]),a=dr(),s=n in YN?n:a.loader,l=o||a.primaryColor;return D.createElement(_e,Wbe({role:"presentation",component:YN[s]||YN.bars,size:a.fn.size({size:r,sizes:G9}),color:l in a.colors?a.fn.themeColor(l,a.colorScheme==="dark"?4:a.fn.primaryShade("light")):o},i))}Ze.displayName="@mantine/core/Loader";var Ybe=Object.defineProperty,KI=Object.getOwnPropertySymbols,K9=Object.prototype.hasOwnProperty,Y9=Object.prototype.propertyIsEnumerable,W9=(t,e,r)=>e in t?Ybe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q9=(t,e)=>{for(var r in e||(e={}))K9.call(e,r)&&W9(t,r,e[r]);if(KI)for(var r of KI(e))Y9.call(e,r)&&W9(t,r,e[r]);return t},Xbe=(t,e)=>{var r={};for(var o in t)K9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&KI)for(var o of KI(t))e.indexOf(o)<0&&Y9.call(t,o)&&(r[o]=t[o]);return r},Jbe={color:"gray",size:"md",variant:"hover",disabled:!1,loading:!1},Je=ee((t,e)=>{let r=Ie("ActionIcon",Jbe,t),{className:o,color:n,children:i,radius:a,size:s,variant:l,disabled:c,loaderProps:u,loading:d,component:f,styles:m,classNames:h}=r,g=Xbe(r,["className","color","children","radius","size","variant","disabled","loaderProps","loading","component","styles","classNames"]),{classes:_,cx:b,theme:y}=N9({size:s,radius:a,color:n},{name:"ActionIcon",classNames:h,styles:m}),v=y.fn.variant({color:n,variant:"light"}),C=D.createElement(Ze,q9({color:v.color,size:y.fn.size({size:s,sizes:mm})-12},u));return D.createElement(_e,q9({component:f||"button",className:b(_[l],_.root,{[_.loading]:d},o),type:"button",ref:e,disabled:c||d},g),d?C:i)});Je.displayName="@mantine/core/ActionIcon";X();X();var Qbe=Object.defineProperty,X9=Object.getOwnPropertySymbols,Zbe=Object.prototype.hasOwnProperty,eye=Object.prototype.propertyIsEnumerable,J9=(t,e,r)=>e in t?Qbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tye=(t,e)=>{for(var r in e||(e={}))Zbe.call(e,r)&&J9(t,r,e[r]);if(X9)for(var r of X9(e))eye.call(e,r)&&J9(t,r,e[r]);return t};function XN(t){return D.createElement("svg",tye({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}XN.displayName="@mantine/core/CloseIcon";var rye=Object.defineProperty,YI=Object.getOwnPropertySymbols,Z9=Object.prototype.hasOwnProperty,eH=Object.prototype.propertyIsEnumerable,Q9=(t,e,r)=>e in t?rye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oye=(t,e)=>{for(var r in e||(e={}))Z9.call(e,r)&&Q9(t,r,e[r]);if(YI)for(var r of YI(e))eH.call(e,r)&&Q9(t,r,e[r]);return t},nye=(t,e)=>{var r={};for(var o in t)Z9.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&YI)for(var o of YI(t))e.indexOf(o)<0&&eH.call(t,o)&&(r[o]=t[o]);return r},iye={xs:12,sm:14,md:16,lg:20,xl:24},Fl=ee((t,e)=>{var r=t,{iconSize:o,size:n="md"}=r,i=nye(r,["iconSize","size"]);let a=dr(),s=o||a.fn.size({size:n,sizes:iye});return D.createElement(Je,oye({size:n,ref:e},i),D.createElement(XN,{width:s,height:s}))});Fl.displayName="@mantine/core/CloseButton";X();X();var aye={zIndex:1,position:"relative"};function jc(t){let{children:e,zIndex:r,target:o,className:n,position:i}=Ie("Portal",aye,t),a=dr(),[s,l]=M(!1),c=W();return A_(()=>(l(!0),c.current=o?typeof o=="string"?document.querySelector(o):o:document.createElement("div"),o||document.body.appendChild(c.current),()=>{!o&&document.body.removeChild(c.current)}),[o]),s?Us(D.createElement("div",{className:n,dir:a.dir,style:{position:i,zIndex:r}},e),c.current):null}jc.displayName="@mantine/core/Portal";X();var sye=Object.defineProperty,lye=Object.defineProperties,cye=Object.getOwnPropertyDescriptors,tH=Object.getOwnPropertySymbols,uye=Object.prototype.hasOwnProperty,dye=Object.prototype.propertyIsEnumerable,rH=(t,e,r)=>e in t?sye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,XI=(t,e)=>{for(var r in e||(e={}))uye.call(e,r)&&rH(t,r,e[r]);if(tH)for(var r of tH(e))dye.call(e,r)&&rH(t,r,e[r]);return t},fye=(t,e)=>lye(t,cye(e));function pye({theme:t,color:e,variant:r}){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:e in t.colors?t.colors[e][t.colorScheme==="dark"?5:7]:r==="link"?t.colors[t.primaryColor][t.colorScheme==="dark"?4:7]:e||"inherit"}function mye(t){return typeof t=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical"}:null}var hye=me((t,{color:e,variant:r,size:o,lineClamp:n,inline:i,inherit:a,underline:s,gradientDeg:l,gradientTo:c,gradientFrom:u,weight:d,transform:f,align:m})=>{let h=t.fn.variant({variant:"gradient",gradient:{from:u,to:c,deg:l}});return{root:XI(fye(XI(XI(XI({},t.fn.fontStyles()),t.fn.focusStyles()),mye(n)),{color:pye({color:e,theme:t,variant:r}),fontFamily:a?"inherit":t.fontFamily,fontSize:a?"inherit":t.fontSizes[o],lineHeight:a?"inherit":i?1:t.lineHeight,textDecoration:s?"underline":"none",WebkitTapHighlightColor:"transparent",fontWeight:a?"inherit":d,textTransform:f,textAlign:m}),t.fn.hover(r==="link"&&s===void 0?{textDecoration:"underline"}:void 0)),gradient:{backgroundImage:h.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}}),oH=hye;var gye=Object.defineProperty,JI=Object.getOwnPropertySymbols,iH=Object.prototype.hasOwnProperty,aH=Object.prototype.propertyIsEnumerable,nH=(t,e,r)=>e in t?gye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_ye=(t,e)=>{for(var r in e||(e={}))iH.call(e,r)&&nH(t,r,e[r]);if(JI)for(var r of JI(e))aH.call(e,r)&&nH(t,r,e[r]);return t},xye=(t,e)=>{var r={};for(var o in t)iH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&JI)for(var o of JI(t))e.indexOf(o)<0&&aH.call(t,o)&&(r[o]=t[o]);return r},bye={size:"md",variant:"text",gradient:{from:"blue",to:"cyan",deg:45},inline:!1,inherit:!1},Gr=ee((t,e)=>{let r=Ie("Text",bye,t),{className:o,component:n,size:i="md",weight:a,transform:s,color:l,align:c,variant:u="text",lineClamp:d,gradient:f={from:"blue",to:"cyan",deg:45},inline:m=!1,inherit:h=!1,underline:g,classNames:_,styles:b}=r,y=xye(r,["className","component","size","weight","transform","color","align","variant","lineClamp","gradient","inline","inherit","underline","classNames","styles"]),{classes:v,cx:C}=oH({variant:u,color:l,size:i,lineClamp:d,inline:m,inherit:h,underline:g,weight:a,transform:s,align:c,gradientFrom:f.from,gradientTo:f.to,gradientDeg:f.deg},{classNames:_,styles:b,name:"Text"});return D.createElement(_e,_ye({ref:e,component:n||"div",className:C(v.root,{[v.gradient]:u==="gradient"},o)},y))});Gr.displayName="@mantine/core/Text";X();X();X();function Gc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}function sH(t,[e,r]){return Math.min(r,Math.max(e,t))}X();var B_=globalThis?.document?Ft:()=>{};X();function lH(t,e){let[r,o]=M("ltr"),[n,i]=M(),a=W(0);return V((()=>{if(e===void 0&&t!=null&&t.parentElement){let s=getComputedStyle(t.parentElement);i(s)}}),[t,e]),V((()=>(e===void 0&&(function s(){a.current=requestAnimationFrame((()=>{let l=n?.direction;l&&o(l),s()}))})(),()=>cancelAnimationFrame(a.current))),[n,e,o]),e||r}X();function Wc(t){let e=W(t);return V((()=>{e.current=t})),ve((()=>(...r)=>{var o;return(o=e.current)===null||o===void 0?void 0:o.call(e,...r)}),[])}X();function JN(...t){return e=>t.forEach((r=>(function(o,n){typeof o=="function"?o(n):o!=null&&(o.current=n)})(r,e)))}function Bl(...t){return qe(JN(...t),t)}X();function cH(t,e=[]){let r=[],o=()=>{let n=r.map((i=>ft(i)));return function(i){let a=i?.[t]||n;return ve((()=>({[`__scope${t}`]:{...i,[t]:a}})),[i,a])}};return o.scopeName=t,[function(n,i){let a=ft(i),s=r.length;function l(c){let{scope:u,children:d,...f}=c,m=u?.[t][s]||a,h=ve((()=>f),Object.values(f));return ce(m.Provider,{value:h},d)}return r=[...r,i],l.displayName=n+"Provider",[l,function(c,u){let d=u?.[t][s]||a,f=lt(d);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${c}\` must be used within \`${n}\``)}]},yye(o,...e)]}function yye(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let o=t.map((n=>({useScope:n(),scopeName:n.scopeName})));return function(n){let i=o.reduce(((a,{useScope:s,scopeName:l})=>({...a,...s(n)[`__scope${l}`]})),{});return ve((()=>({[`__scope${e.scopeName}`]:i})),[i])}};return r.scopeName=e.scopeName,r}X();var $_=t=>{let{present:e,children:r}=t,o=(function(a){let[s,l]=M(),c=W({}),u=W(a),d=W("none"),f=a?"mounted":"unmounted",[m,h]=(function(g,_){return Qn(((b,y)=>{let v=_[b][y];return v??b}),g)})(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V((()=>{let g=QI(c.current);d.current=m==="mounted"?g:"none"}),[m]),B_((()=>{let g=c.current,_=u.current;if(_!==a){let b=d.current,y=QI(g);a?h("MOUNT"):y==="none"||g?.display==="none"?h("UNMOUNT"):h(_&&b!==y?"ANIMATION_OUT":"UNMOUNT"),u.current=a}}),[a,h]),B_((()=>{if(s){let g=b=>{let y=QI(c.current).includes(b.animationName);b.target===s&&y&&h("ANIMATION_END")},_=b=>{b.target===s&&(d.current=QI(c.current))};return s.addEventListener("animationstart",_),s.addEventListener("animationcancel",g),s.addEventListener("animationend",g),()=>{s.removeEventListener("animationstart",_),s.removeEventListener("animationcancel",g),s.removeEventListener("animationend",g)}}h("ANIMATION_END")}),[s,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:qe((g=>{g&&(c.current=getComputedStyle(g)),l(g)}),[])}})(e),n=typeof r=="function"?r({present:o.isPresent}):vn.only(r),i=Bl(o.ref,n.ref);return typeof r=="function"||o.isPresent?Gi(n,{ref:i}):null};function QI(t){return t?.animationName||"none"}$_.displayName="Presence";X();function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)({}).hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},qc.apply(null,arguments)}var ZN=ee(((t,e)=>{let{children:r,...o}=t;return vn.toArray(r).some(uH)?ce(Te,null,vn.map(r,(n=>uH(n)?ce(QN,qc({},o,{ref:e}),n.props.children):n))):ce(QN,qc({},o,{ref:e}),r)}));ZN.displayName="Slot";var QN=ee(((t,e)=>{let{children:r,...o}=t;return Zn(r)?Gi(r,{...Iye(o,r.props),ref:JN(e,r.ref)}):vn.count(r)>1?vn.only(null):null}));QN.displayName="SlotClone";var vye=({children:t})=>ce(Te,null,t);function uH(t){return Zn(t)&&t.type===vye}function Iye(t,e){let r={...e};for(let o in e){let n=t[o],i=e[o];/^on[A-Z]/.test(o)?r[o]=(...a)=>{i?.(...a),n?.(...a)}:o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...t,...r}}X();var hm=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((t,e)=>({...t,[e]:ee(((r,o)=>{let{asChild:n,...i}=r,a=n?ZN:e;return V((()=>{window[Symbol.for("radix-ui")]=!0}),[]),ce(a,pr({},i,{ref:o}))}))})),{});X();var[fH,Mlt]=cH("ScrollArea");var[wye,va]=fH("ScrollArea"),Eye=ee(((t,e)=>{let{__scopeScrollArea:r,type:o="hover",scrollHideDelay:n=600,...i}=t,[a,s]=M(null),[l,c]=M(null),[u,d]=M(null),[f,m]=M(null),[h,g]=M(null),[_,b]=M(0),[y,v]=M(0),[C,N]=M(!1),[I,E]=M(!1),w=Bl(e,(T=>s(T))),S=lH(a,i.dir);return ce(wye,{scope:r,type:o,dir:S,scrollHideDelay:n,scrollArea:a,viewport:l,onViewportChange:c,content:u,onContentChange:d,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:N,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:I,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:v},ce(hm.div,pr({},i,{ref:w,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})))})),Sye=ee(((t,e)=>{let{__scopeScrollArea:r,children:o,...n}=t,i=va("ScrollAreaViewport",r),a=W(null),s=Bl(e,a,i.onViewportChange);return ce(Te,null,ce("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),ce(hm.div,pr({"data-radix-scroll-area-viewport":""},n,{ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style}}),ce("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},o)))})),Cye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=n,s=t.orientation==="horizontal";return V((()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)})),[s,i,a]),n.type==="hover"?ce(Tye,pr({},o,{ref:e,forceMount:r})):n.type==="scroll"?ce(kye,pr({},o,{ref:e,forceMount:r})):n.type==="auto"?ce(pH,pr({},o,{ref:e,forceMount:r})):n.type==="always"?ce(eP,pr({},o,{ref:e})):null})),Tye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),[i,a]=M(!1);return V((()=>{let s=n.scrollArea,l=0;if(s){let c=()=>{window.clearTimeout(l),a(!0)},u=()=>{l=window.setTimeout((()=>a(!1)),n.scrollHideDelay)};return s.addEventListener("pointerenter",c),s.addEventListener("pointerleave",u),()=>{s.removeEventListener("pointerenter",c),s.removeEventListener("pointerleave",u)}}}),[n.scrollArea,n.scrollHideDelay]),ce($_,{present:r||i},ce(pH,pr({"data-state":i?"visible":"hidden"},o,{ref:e})))})),kye=ee(((t,e)=>{let{forceMount:r,...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),i=t.orientation==="horizontal",a=tw((()=>l("SCROLL_END")),100),[s,l]=(c="hidden",u={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},Qn(((d,f)=>{let m=u[d][f];return m??d}),c));var c,u;return V((()=>{if(s==="idle"){let d=window.setTimeout((()=>l("HIDE")),n.scrollHideDelay);return()=>window.clearTimeout(d)}}),[s,n.scrollHideDelay,l]),V((()=>{let d=n.viewport,f=i?"scrollLeft":"scrollTop";if(d){let m=d[f],h=()=>{let g=d[f];m!==g&&(l("SCROLL"),a()),m=g};return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}}),[n.viewport,i,l,a]),ce($_,{present:r||s!=="hidden"},ce(eP,pr({"data-state":s==="hidden"?"hidden":"visible"},o,{ref:e,onPointerEnter:Gc(t.onPointerEnter,(()=>l("POINTER_ENTER"))),onPointerLeave:Gc(t.onPointerLeave,(()=>l("POINTER_LEAVE")))})))})),pH=ee(((t,e)=>{let r=va("ScrollAreaScrollbar",t.__scopeScrollArea),{forceMount:o,...n}=t,[i,a]=M(!1),s=t.orientation==="horizontal",l=tw((()=>{if(r.viewport){let c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?c:u)}}),10);return gm(r.viewport,l),gm(r.content,l),ce($_,{present:o||i},ce(eP,pr({"data-state":i?"visible":"hidden"},n,{ref:e})))})),eP=ee(((t,e)=>{let{orientation:r="vertical",...o}=t,n=va("ScrollAreaScrollbar",t.__scopeScrollArea),i=W(null),a=W(0),[s,l]=M({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=hH(s.viewport,s.content),u={...o,sizes:s,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function d(f,m){return(function(h,g,_,b="ltr"){let y=ew(_),v=y/2,C=g||v,N=y-C,I=_.scrollbar.paddingStart+C,E=_.scrollbar.size-_.scrollbar.paddingEnd-N,w=_.content-_.viewport;return gH([I,E],b==="ltr"?[0,w]:[-1*w,0])(h)})(f,a.current,s,m)}return r==="horizontal"?ce(Nye,pr({},u,{ref:e,onThumbPositionChange:()=>{if(n.viewport&&i.current){let f=dH(n.viewport.scrollLeft,s,n.dir);i.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{n.viewport&&(n.viewport.scrollLeft=f)},onDragScroll:f=>{n.viewport&&(n.viewport.scrollLeft=d(f,n.dir))}})):r==="vertical"?ce(Pye,pr({},u,{ref:e,onThumbPositionChange:()=>{if(n.viewport&&i.current){let f=dH(n.viewport.scrollTop,s);i.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{n.viewport&&(n.viewport.scrollTop=f)},onDragScroll:f=>{n.viewport&&(n.viewport.scrollTop=d(f))}})):null})),Nye=ee(((t,e)=>{let{sizes:r,onSizesChange:o,...n}=t,i=va("ScrollAreaScrollbar",t.__scopeScrollArea),[a,s]=M(),l=W(null),c=Bl(e,l,i.onScrollbarXChange);return V((()=>{l.current&&s(getComputedStyle(l.current))}),[l]),ce(mH,pr({"data-orientation":"horizontal"},n,{ref:c,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ew(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(i.viewport){let f=i.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),_H(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ZI(a.paddingLeft),paddingEnd:ZI(a.paddingRight)}})}}))})),Pye=ee(((t,e)=>{let{sizes:r,onSizesChange:o,...n}=t,i=va("ScrollAreaScrollbar",t.__scopeScrollArea),[a,s]=M(),l=W(null),c=Bl(e,l,i.onScrollbarYChange);return V((()=>{l.current&&s(getComputedStyle(l.current))}),[l]),ce(mH,pr({"data-orientation":"vertical"},n,{ref:c,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ew(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(i.viewport){let f=i.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),_H(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ZI(a.paddingTop),paddingEnd:ZI(a.paddingBottom)}})}}))})),[Oye,Aye]=fH("ScrollAreaScrollbar"),mH=ee(((t,e)=>{let{__scopeScrollArea:r,sizes:o,hasThumb:n,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=t,m=va("ScrollAreaScrollbar",r),[h,g]=M(null),_=Bl(e,(S=>g(S))),b=W(null),y=W(""),v=m.viewport,C=o.content-o.viewport,N=Wc(u),I=Wc(l),E=tw(d,10);function w(S){if(b.current){let T=S.clientX-b.current.left,A=S.clientY-b.current.top;c({x:T,y:A})}}return V((()=>{let S=T=>{let A=T.target;h?.contains(A)&&N(T,C)};return document.addEventListener("wheel",S,{passive:!1}),()=>document.removeEventListener("wheel",S,{passive:!1})}),[v,h,C,N]),V(I,[o,I]),gm(h,E),gm(m.content,E),ce(Oye,{scope:r,scrollbar:h,hasThumb:n,onThumbChange:Wc(i),onThumbPointerUp:Wc(a),onThumbPositionChange:I,onThumbPointerDown:Wc(s)},ce(hm.div,pr({},f,{ref:_,style:{position:"absolute",...f.style},onPointerDown:Gc(t.onPointerDown,(S=>{S.button===0&&(S.target.setPointerCapture(S.pointerId),b.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w(S))})),onPointerMove:Gc(t.onPointerMove,w),onPointerUp:Gc(t.onPointerUp,(S=>{S.target.releasePointerCapture(S.pointerId),document.body.style.webkitUserSelect=y.current,b.current=null}))})))})),Dye=ee(((t,e)=>{let{__scopeScrollArea:r,style:o,...n}=t,i=va("ScrollbarThumb",r),a=Aye("ScrollbarThumb",r),{onThumbPositionChange:s}=a,l=Bl(e,(d=>a.onThumbChange(d))),c=W(),u=tw((()=>{c.current&&(c.current(),c.current=void 0)}),100);return V((()=>{let d=i.viewport;if(d){let f=()=>{if(u(),!c.current){let m=Lye(d,s);c.current=m,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}}),[i.viewport,u,s]),a.hasThumb?ce(hm.div,pr({},n,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Gc(t.onPointerDownCapture,(d=>{let f=d.target.getBoundingClientRect(),m=d.clientX-f.left,h=d.clientY-f.top;a.onThumbPointerDown({x:m,y:h})})),onPointerUp:Gc(t.onPointerUp,a.onThumbPointerUp)})):null})),Rye=ee(((t,e)=>{let r=va("ScrollAreaCorner",t.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?ce(Mye,pr({},t,{ref:e})):null})),Mye=ee(((t,e)=>{let{__scopeScrollArea:r,...o}=t,n=va("ScrollAreaCorner",r),[i,a]=M(0),[s,l]=M(0),c=!!(i&&s);return gm(n.scrollbarX,(()=>{var u;let d=((u=n.scrollbarX)===null||u===void 0?void 0:u.offsetHeight)||0;n.onCornerHeightChange(d),l(d)})),gm(n.scrollbarY,(()=>{var u;let d=((u=n.scrollbarY)===null||u===void 0?void 0:u.offsetWidth)||0;n.onCornerWidthChange(d),a(d)})),c?ce(hm.div,pr({},o,{ref:e,style:{width:i,height:s,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...t.style}})):null}));function ZI(t){return t?parseInt(t,10):0}function hH(t,e){let r=t/e;return isNaN(r)?0:r}function ew(t){let e=hH(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-r)*e;return Math.max(o,18)}function dH(t,e,r="ltr"){let o=ew(e),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-n,a=e.content-e.viewport,s=i-o,l=sH(t,r==="ltr"?[0,a]:[-1*a,0]);return gH([0,a],[0,s])(l)}function gH(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(r-t[0])}}function _H(t,e){return t>0&&t<e}var Lye=(t,e=(()=>{}))=>{let r={left:t.scrollLeft,top:t.scrollTop},o=0;return(function n(){let i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,s=r.top!==i.top;(a||s)&&e(),r=i,o=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(o)};function tw(t,e){let r=Wc(t),o=W(0);return V((()=>()=>window.clearTimeout(o.current)),[]),qe((()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,e)}),[r,e])}function gm(t,e){let r=Wc(e);B_((()=>{let o=0;if(t){let n=new ResizeObserver((()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)}));return n.observe(t),()=>{window.cancelAnimationFrame(o),n.unobserve(t)}}}),[t,r])}var xH=Eye,bH=Sye,tP=Cye,rP=Dye,yH=Rye;var Bye=me((t,{scrollbarSize:e,offsetScrollbars:r,scrollbarHovered:o},n)=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:r?e:void 0},scrollbar:{display:"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:e/5,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.colors.gray[0],[`& .${n("thumb")}`]:{backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.white,.5):t.fn.rgba(t.black,.5)}},'&[data-orientation="vertical"]':{width:e},'&[data-orientation="horizontal"]':{flexDirection:"column",height:e},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:n("thumb"),flex:1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.white,.4):t.fn.rgba(t.black,.4),borderRadius:e,position:"relative",transition:"background-color 150ms ease","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:44,minHeight:44}},corner:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0],transition:"opacity 150ms ease",opacity:o?1:0}})),vH=Bye;var $ye=Object.defineProperty,rw=Object.getOwnPropertySymbols,wH=Object.prototype.hasOwnProperty,EH=Object.prototype.propertyIsEnumerable,IH=(t,e,r)=>e in t?$ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zye=(t,e)=>{for(var r in e||(e={}))wH.call(e,r)&&IH(t,r,e[r]);if(rw)for(var r of rw(e))EH.call(e,r)&&IH(t,r,e[r]);return t},Uye=(t,e)=>{var r={};for(var o in t)wH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&rw)for(var o of rw(t))e.indexOf(o)<0&&EH.call(t,o)&&(r[o]=t[o]);return r},Vye={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},oP=ee((t,e)=>{let r=Ie("ScrollArea",Vye,t),{children:o,className:n,classNames:i,styles:a,scrollbarSize:s,scrollHideDelay:l,type:c,dir:u,offsetScrollbars:d,viewportRef:f,onScrollPositionChange:m}=r,h=Uye(r,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange"]),[g,_]=M(!1),b=dr(),{classes:y,cx:v}=vH({scrollbarSize:s,offsetScrollbars:d,scrollbarHovered:g},{name:"ScrollArea",classNames:i,styles:a});return D.createElement(xH,{type:c,scrollHideDelay:l,dir:u||b.dir,ref:e,asChild:!0},D.createElement(_e,zye({className:v(y.root,n)},h),D.createElement(bH,{className:y.viewport,ref:f,onScroll:typeof m=="function"?({currentTarget:C})=>m({x:C.scrollLeft,y:C.scrollTop}):void 0},o),D.createElement(tP,{orientation:"horizontal",className:y.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},D.createElement(rP,{className:y.thumb})),D.createElement(tP,{orientation:"vertical",className:y.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},D.createElement(rP,{className:y.thumb})),D.createElement(yH,{className:y.corner})))});oP.displayName="@mantine/core/ScrollArea";var Hye=Object.defineProperty,jye=Object.defineProperties,Gye=Object.getOwnPropertyDescriptors,ow=Object.getOwnPropertySymbols,TH=Object.prototype.hasOwnProperty,kH=Object.prototype.propertyIsEnumerable,SH=(t,e,r)=>e in t?Hye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CH=(t,e)=>{for(var r in e||(e={}))TH.call(e,r)&&SH(t,r,e[r]);if(ow)for(var r of ow(e))kH.call(e,r)&&SH(t,r,e[r]);return t},Wye=(t,e)=>jye(t,Gye(e)),qye=(t,e)=>{var r={};for(var o in t)TH.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&ow)for(var o of ow(t))e.indexOf(o)<0&&kH.call(t,o)&&(r[o]=t[o]);return r},Ad=ee((t,e)=>{var r=t,{style:o}=r,n=qye(r,["style"]);return D.createElement(oP,Wye(CH({},n),{style:CH({width:"100%"},o),viewportRef:e}),n.children)});Ad.displayName="@mantine/core/SelectScrollArea";var Kye=Object.defineProperty,Yye=Object.defineProperties,Xye=Object.getOwnPropertyDescriptors,NH=Object.getOwnPropertySymbols,Jye=Object.prototype.hasOwnProperty,Qye=Object.prototype.propertyIsEnumerable,PH=(t,e,r)=>e in t?Kye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zye=(t,e)=>{for(var r in e||(e={}))Jye.call(e,r)&&PH(t,r,e[r]);if(NH)for(var r of NH(e))Qye.call(e,r)&&PH(t,r,e[r]);return t},eve=(t,e)=>Yye(t,Xye(e)),tve=me((t,{native:e})=>({dropdown:eve(Zye({},t.fn.fontStyles()),{boxSizing:"border-box",pointerEvents:"auto",backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,padding:4,overflowY:e?"auto":"hidden",overscrollBehaviorY:"contain",width:"100%"})})),OH=tve;X();X();var nP=function(e){return e.reduce(function(r,o){var n=o[0],i=o[1];return r[n]=i,r},{})},iP=typeof window<"u"&&window.document&&window.document.createElement?Ft:V;X();var Qr="top",Fo="bottom",vo="right",co="left",nw="auto",Kc=[Qr,Fo,vo,co],$l="start",Dd="end",AH="clippingParents",iw="viewport",_m="popper",DH="reference",aP=Kc.reduce(function(t,e){return t.concat([e+"-"+$l,e+"-"+Dd])},[]),aw=[].concat(Kc,[nw]).reduce(function(t,e){return t.concat([e,e+"-"+$l,e+"-"+Dd])},[]),rve="beforeRead",ove="read",nve="afterRead",ive="beforeMain",ave="main",sve="afterMain",lve="beforeWrite",cve="write",uve="afterWrite",RH=[rve,ove,nve,ive,ave,sve,lve,cve,uve];function qo(t){return t?(t.nodeName||"").toLowerCase():null}function uo(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function js(t){var e=uo(t).Element;return t instanceof e||t instanceof Element}function Bo(t){var e=uo(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function xm(t){if(typeof ShadowRoot>"u")return!1;var e=uo(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function dve(t){var e=t.state;Object.keys(e.elements).forEach(function(r){var o=e.styles[r]||{},n=e.attributes[r]||{},i=e.elements[r];!Bo(i)||!qo(i)||(Object.assign(i.style,o),Object.keys(n).forEach(function(a){var s=n[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s)}))})}function fve(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach(function(o){var n=e.elements[o],i=e.attributes[o]||{},a=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:r[o]),s=a.reduce(function(l,c){return l[c]="",l},{});!Bo(n)||!qo(n)||(Object.assign(n.style,s),Object.keys(i).forEach(function(l){n.removeAttribute(l)}))})}}var MH={name:"applyStyles",enabled:!0,phase:"write",fn:dve,effect:fve,requires:["computeStyles"]};function Ko(t){return t.split("-")[0]}var rs=Math.max,Rd=Math.min,zl=Math.round;function Ia(t,e){e===void 0&&(e=!1);var r=t.getBoundingClientRect(),o=1,n=1;if(Bo(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(o=zl(r.width)/a||1),i>0&&(n=zl(r.height)/i||1)}return{width:r.width/o,height:r.height/n,top:r.top/n,right:r.right/o,bottom:r.bottom/n,left:r.left/o,x:r.left/o,y:r.top/n}}function Md(t){var e=Ia(t),r=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:o}}function z_(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&xm(r)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function ai(t){return uo(t).getComputedStyle(t)}function sP(t){return["table","td","th"].indexOf(qo(t))>=0}function Tn(t){return((js(t)?t.ownerDocument:t.document)||window.document).documentElement}function Ul(t){return qo(t)==="html"?t:t.assignedSlot||t.parentNode||(xm(t)?t.host:null)||Tn(t)}function LH(t){return!Bo(t)||ai(t).position==="fixed"?null:t.offsetParent}function pve(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,r=navigator.userAgent.indexOf("Trident")!==-1;if(r&&Bo(t)){var o=ai(t);if(o.position==="fixed")return null}var n=Ul(t);for(xm(n)&&(n=n.host);Bo(n)&&["html","body"].indexOf(qo(n))<0;){var i=ai(n);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return n;n=n.parentNode}return null}function os(t){for(var e=uo(t),r=LH(t);r&&sP(r)&&ai(r).position==="static";)r=LH(r);return r&&(qo(r)==="html"||qo(r)==="body"&&ai(r).position==="static")?e:r||pve(t)||e}function Ld(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Fd(t,e,r){return rs(t,Rd(e,r))}function FH(t,e,r){var o=Fd(t,e,r);return o>r?r:o}function U_(){return{top:0,right:0,bottom:0,left:0}}function V_(t){return Object.assign({},U_(),t)}function H_(t,e){return e.reduce(function(r,o){return r[o]=t,r},{})}var mve=function(e,r){return e=typeof e=="function"?e(Object.assign({},r.rects,{placement:r.placement})):e,V_(typeof e!="number"?e:H_(e,Kc))};function hve(t){var e,r=t.state,o=t.name,n=t.options,i=r.elements.arrow,a=r.modifiersData.popperOffsets,s=Ko(r.placement),l=Ld(s),c=[co,vo].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var d=mve(n.padding,r),f=Md(i),m=l==="y"?Qr:co,h=l==="y"?Fo:vo,g=r.rects.reference[u]+r.rects.reference[l]-a[l]-r.rects.popper[u],_=a[l]-r.rects.reference[l],b=os(i),y=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,v=g/2-_/2,C=d[m],N=y-f[u]-d[h],I=y/2-f[u]/2+v,E=Fd(C,I,N),w=l;r.modifiersData[o]=(e={},e[w]=E,e.centerOffset=E-I,e)}}function gve(t){var e=t.state,r=t.options,o=r.element,n=o===void 0?"[data-popper-arrow]":o;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||z_(e.elements.popper,n)&&(e.elements.arrow=n))}var BH={name:"arrow",enabled:!0,phase:"main",fn:hve,effect:gve,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wa(t){return t.split("-")[1]}var _ve={top:"auto",right:"auto",bottom:"auto",left:"auto"};function xve(t){var e=t.x,r=t.y,o=window,n=o.devicePixelRatio||1;return{x:zl(e*n)/n||0,y:zl(r*n)/n||0}}function $H(t){var e,r=t.popper,o=t.popperRect,n=t.placement,i=t.variation,a=t.offsets,s=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=a.x,m=f===void 0?0:f,h=a.y,g=h===void 0?0:h,_=typeof u=="function"?u({x:m,y:g}):{x:m,y:g};m=_.x,g=_.y;var b=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),v=co,C=Qr,N=window;if(c){var I=os(r),E="clientHeight",w="clientWidth";if(I===uo(r)&&(I=Tn(r),ai(I).position!=="static"&&s==="absolute"&&(E="scrollHeight",w="scrollWidth")),I=I,n===Qr||(n===co||n===vo)&&i===Dd){C=Fo;var S=d&&I===N&&N.visualViewport?N.visualViewport.height:I[E];g-=S-o.height,g*=l?1:-1}if(n===co||(n===Qr||n===Fo)&&i===Dd){v=vo;var T=d&&I===N&&N.visualViewport?N.visualViewport.width:I[w];m-=T-o.width,m*=l?1:-1}}var A=Object.assign({position:s},c&&_ve),R=u===!0?xve({x:m,y:g}):{x:m,y:g};if(m=R.x,g=R.y,l){var P;return Object.assign({},A,(P={},P[C]=y?"0":"",P[v]=b?"0":"",P.transform=(N.devicePixelRatio||1)<=1?"translate("+m+"px, "+g+"px)":"translate3d("+m+"px, "+g+"px, 0)",P))}return Object.assign({},A,(e={},e[C]=y?g+"px":"",e[v]=b?m+"px":"",e.transform="",e))}function bve(t){var e=t.state,r=t.options,o=r.gpuAcceleration,n=o===void 0?!0:o,i=r.adaptive,a=i===void 0?!0:i,s=r.roundOffsets,l=s===void 0?!0:s;if(0)var c;var u={placement:Ko(e.placement),variation:wa(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,$H(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,$H(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var zH={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:bve,data:{}};var sw={passive:!0};function yve(t){var e=t.state,r=t.instance,o=t.options,n=o.scroll,i=n===void 0?!0:n,a=o.resize,s=a===void 0?!0:a,l=uo(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",r.update,sw)}),s&&l.addEventListener("resize",r.update,sw),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",r.update,sw)}),s&&l.removeEventListener("resize",r.update,sw)}}var UH={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yve,data:{}};var vve={left:"right",right:"left",bottom:"top",top:"bottom"};function bm(t){return t.replace(/left|right|bottom|top/g,function(e){return vve[e]})}var Ive={start:"end",end:"start"};function lw(t){return t.replace(/start|end/g,function(e){return Ive[e]})}function Bd(t){var e=uo(t),r=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:r,scrollTop:o}}function $d(t){return Ia(Tn(t)).left+Bd(t).scrollLeft}function lP(t){var e=uo(t),r=Tn(t),o=e.visualViewport,n=r.clientWidth,i=r.clientHeight,a=0,s=0;return o&&(n=o.width,i=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=o.offsetLeft,s=o.offsetTop)),{width:n,height:i,x:a+$d(t),y:s}}function cP(t){var e,r=Tn(t),o=Bd(t),n=(e=t.ownerDocument)==null?void 0:e.body,i=rs(r.scrollWidth,r.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=rs(r.scrollHeight,r.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),s=-o.scrollLeft+$d(t),l=-o.scrollTop;return ai(n||r).direction==="rtl"&&(s+=rs(r.clientWidth,n?n.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}function zd(t){var e=ai(t),r=e.overflow,o=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(r+n+o)}function cw(t){return["html","body","#document"].indexOf(qo(t))>=0?t.ownerDocument.body:Bo(t)&&zd(t)?t:cw(Ul(t))}function Yc(t,e){var r;e===void 0&&(e=[]);var o=cw(t),n=o===((r=t.ownerDocument)==null?void 0:r.body),i=uo(o),a=n?[i].concat(i.visualViewport||[],zd(o)?o:[]):o,s=e.concat(a);return n?s:s.concat(Yc(Ul(a)))}function ym(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function wve(t){var e=Ia(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function VH(t,e){return e===iw?ym(lP(t)):js(e)?wve(e):ym(cP(Tn(t)))}function Eve(t){var e=Yc(Ul(t)),r=["absolute","fixed"].indexOf(ai(t).position)>=0,o=r&&Bo(t)?os(t):t;return js(o)?e.filter(function(n){return js(n)&&z_(n,o)&&qo(n)!=="body"}):[]}function uP(t,e,r){var o=e==="clippingParents"?Eve(t):[].concat(e),n=[].concat(o,[r]),i=n[0],a=n.reduce(function(s,l){var c=VH(t,l);return s.top=rs(c.top,s.top),s.right=Rd(c.right,s.right),s.bottom=Rd(c.bottom,s.bottom),s.left=rs(c.left,s.left),s},VH(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function j_(t){var e=t.reference,r=t.element,o=t.placement,n=o?Ko(o):null,i=o?wa(o):null,a=e.x+e.width/2-r.width/2,s=e.y+e.height/2-r.height/2,l;switch(n){case Qr:l={x:a,y:e.y-r.height};break;case Fo:l={x:a,y:e.y+e.height};break;case vo:l={x:e.x+e.width,y:s};break;case co:l={x:e.x-r.width,y:s};break;default:l={x:e.x,y:e.y}}var c=n?Ld(n):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case $l:l[c]=l[c]-(e[u]/2-r[u]/2);break;case Dd:l[c]=l[c]+(e[u]/2-r[u]/2);break;default:}}return l}function ns(t,e){e===void 0&&(e={});var r=e,o=r.placement,n=o===void 0?t.placement:o,i=r.boundary,a=i===void 0?AH:i,s=r.rootBoundary,l=s===void 0?iw:s,c=r.elementContext,u=c===void 0?_m:c,d=r.altBoundary,f=d===void 0?!1:d,m=r.padding,h=m===void 0?0:m,g=V_(typeof h!="number"?h:H_(h,Kc)),_=u===_m?DH:_m,b=t.rects.popper,y=t.elements[f?_:u],v=uP(js(y)?y:y.contextElement||Tn(t.elements.popper),a,l),C=Ia(t.elements.reference),N=j_({reference:C,element:b,strategy:"absolute",placement:n}),I=ym(Object.assign({},b,N)),E=u===_m?I:C,w={top:v.top-E.top+g.top,bottom:E.bottom-v.bottom+g.bottom,left:v.left-E.left+g.left,right:E.right-v.right+g.right},S=t.modifiersData.offset;if(u===_m&&S){var T=S[n];Object.keys(w).forEach(function(A){var R=[vo,Fo].indexOf(A)>=0?1:-1,P=[Qr,Fo].indexOf(A)>=0?"y":"x";w[A]+=T[P]*R})}return w}function dP(t,e){e===void 0&&(e={});var r=e,o=r.placement,n=r.boundary,i=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=l===void 0?aw:l,u=wa(o),d=u?s?aP:aP.filter(function(h){return wa(h)===u}):Kc,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var m=f.reduce(function(h,g){return h[g]=ns(t,{placement:g,boundary:n,rootBoundary:i,padding:a})[Ko(g)],h},{});return Object.keys(m).sort(function(h,g){return m[h]-m[g]})}function Sve(t){if(Ko(t)===nw)return[];var e=bm(t);return[lw(t),e,lw(e)]}function Cve(t){var e=t.state,r=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var n=r.mainAxis,i=n===void 0?!0:n,a=r.altAxis,s=a===void 0?!0:a,l=r.fallbackPlacements,c=r.padding,u=r.boundary,d=r.rootBoundary,f=r.altBoundary,m=r.flipVariations,h=m===void 0?!0:m,g=r.allowedAutoPlacements,_=e.options.placement,b=Ko(_),y=b===_,v=l||(y||!h?[bm(_)]:Sve(_)),C=[_].concat(v).reduce(function(ge,Ce){return ge.concat(Ko(Ce)===nw?dP(e,{placement:Ce,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:g}):Ce)},[]),N=e.rects.reference,I=e.rects.popper,E=new Map,w=!0,S=C[0],T=0;T<C.length;T++){var A=C[T],R=Ko(A),P=wa(A)===$l,B=[Qr,Fo].indexOf(R)>=0,$=B?"width":"height",z=ns(e,{placement:A,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),H=B?P?vo:co:P?Fo:Qr;N[$]>I[$]&&(H=bm(H));var G=bm(H),Y=[];if(i&&Y.push(z[R]<=0),s&&Y.push(z[H]<=0,z[G]<=0),Y.every(function(ge){return ge})){S=A,w=!1;break}E.set(A,Y)}if(w)for(var L=h?3:1,ne=function(Ce){var He=C.find(function(Qe){var Me=E.get(Qe);if(Me)return Me.slice(0,Ce).every(function(ke){return ke})});if(He)return S=He,"break"},ae=L;ae>0;ae--){var U=ne(ae);if(U==="break")break}e.placement!==S&&(e.modifiersData[o]._skip=!0,e.placement=S,e.reset=!0)}}var HH={name:"flip",enabled:!0,phase:"main",fn:Cve,requiresIfExists:["offset"],data:{_skip:!1}};function jH(t,e,r){return r===void 0&&(r={x:0,y:0}),{top:t.top-e.height-r.y,right:t.right-e.width+r.x,bottom:t.bottom-e.height+r.y,left:t.left-e.width-r.x}}function GH(t){return[Qr,vo,Fo,co].some(function(e){return t[e]>=0})}function Tve(t){var e=t.state,r=t.name,o=e.rects.reference,n=e.rects.popper,i=e.modifiersData.preventOverflow,a=ns(e,{elementContext:"reference"}),s=ns(e,{altBoundary:!0}),l=jH(a,o),c=jH(s,n,i),u=GH(l),d=GH(c);e.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var WH={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Tve};function kve(t,e,r){var o=Ko(t),n=[co,Qr].indexOf(o)>=0?-1:1,i=typeof r=="function"?r(Object.assign({},e,{placement:t})):r,a=i[0],s=i[1];return a=a||0,s=(s||0)*n,[co,vo].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}function Nve(t){var e=t.state,r=t.options,o=t.name,n=r.offset,i=n===void 0?[0,0]:n,a=aw.reduce(function(u,d){return u[d]=kve(d,e.rects,i),u},{}),s=a[e.placement],l=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[o]=a}var qH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Nve};function Pve(t){var e=t.state,r=t.name;e.modifiersData[r]=j_({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var KH={name:"popperOffsets",enabled:!0,phase:"read",fn:Pve,data:{}};function fP(t){return t==="x"?"y":"x"}function Ove(t){var e=t.state,r=t.options,o=t.name,n=r.mainAxis,i=n===void 0?!0:n,a=r.altAxis,s=a===void 0?!1:a,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,d=r.padding,f=r.tether,m=f===void 0?!0:f,h=r.tetherOffset,g=h===void 0?0:h,_=ns(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=Ko(e.placement),y=wa(e.placement),v=!y,C=Ld(b),N=fP(C),I=e.modifiersData.popperOffsets,E=e.rects.reference,w=e.rects.popper,S=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,T=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),A=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,R={x:0,y:0};if(I){if(i){var P,B=C==="y"?Qr:co,$=C==="y"?Fo:vo,z=C==="y"?"height":"width",H=I[C],G=H+_[B],Y=H-_[$],L=m?-w[z]/2:0,ne=y===$l?E[z]:w[z],ae=y===$l?-w[z]:-E[z],U=e.elements.arrow,ge=m&&U?Md(U):{width:0,height:0},Ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:U_(),He=Ce[B],Qe=Ce[$],Me=Fd(0,E[z],ge[z]),ke=v?E[z]/2-L-Me-He-T.mainAxis:ne-Me-He-T.mainAxis,at=v?-E[z]/2+L+Me+Qe+T.mainAxis:ae+Me+Qe+T.mainAxis,Rt=e.elements.arrow&&os(e.elements.arrow),ut=Rt?C==="y"?Rt.clientTop||0:Rt.clientLeft||0:0,ht=(P=A?.[C])!=null?P:0,bt=H+ke-ht-ut,Xr=H+at-ht,Mt=Fd(m?Rd(G,bt):G,H,m?rs(Y,Xr):Y);I[C]=Mt,R[C]=Mt-H}if(s){var ye,dn=C==="x"?Qr:co,Ut=C==="x"?Fo:vo,pt=I[N],Ur=N==="y"?"height":"width",Vr=pt+_[dn],Do=pt-_[Ut],Be=[Qr,co].indexOf(b)!==-1,ie=(ye=A?.[N])!=null?ye:0,j=Be?Vr:pt-E[Ur]-w[Ur]-ie+T.altAxis,Q=Be?pt+E[Ur]+w[Ur]-ie-T.altAxis:Do,se=m&&Be?FH(j,pt,Q):Fd(m?j:Vr,pt,m?Q:Do);I[N]=se,R[N]=se-pt}e.modifiersData[o]=R}}var YH={name:"preventOverflow",enabled:!0,phase:"main",fn:Ove,requiresIfExists:["offset"]};function pP(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function mP(t){return t===uo(t)||!Bo(t)?Bd(t):pP(t)}function Ave(t){var e=t.getBoundingClientRect(),r=zl(e.width)/t.offsetWidth||1,o=zl(e.height)/t.offsetHeight||1;return r!==1||o!==1}function hP(t,e,r){r===void 0&&(r=!1);var o=Bo(e),n=Bo(e)&&Ave(e),i=Tn(e),a=Ia(t,n),s={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!r)&&((qo(e)!=="body"||zd(i))&&(s=mP(e)),Bo(e)?(l=Ia(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):i&&(l.x=$d(i))),{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Dve(t){var e=new Map,r=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function n(i){r.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!r.has(s)){var l=e.get(s);l&&n(l)}}),o.push(i)}return t.forEach(function(i){r.has(i.name)||n(i)}),o}function gP(t){var e=Dve(t);return RH.reduce(function(r,o){return r.concat(e.filter(function(n){return n.phase===o}))},[])}function _P(t){var e;return function(){return e||(e=new Promise(function(r){Promise.resolve().then(function(){e=void 0,r(t())})})),e}}function xP(t){var e=t.reduce(function(r,o){var n=r[o.name];return r[o.name]=n?Object.assign({},n,o,{options:Object.assign({},n.options,o.options),data:Object.assign({},n.data,o.data)}):o,r},{});return Object.keys(e).map(function(r){return e[r]})}var XH={placement:"bottom",modifiers:[],strategy:"absolute"};function JH(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function QH(t){t===void 0&&(t={});var e=t,r=e.defaultModifiers,o=r===void 0?[]:r,n=e.defaultOptions,i=n===void 0?XH:n;return function(s,l,c){c===void 0&&(c=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},XH,i),modifiersData:{},elements:{reference:s,popper:l},attributes:{},styles:{}},d=[],f=!1,m={state:u,setOptions:function(b){var y=typeof b=="function"?b(u.options):b;g(),u.options=Object.assign({},i,u.options,y),u.scrollParents={reference:js(s)?Yc(s):s.contextElement?Yc(s.contextElement):[],popper:Yc(l)};var v=gP(xP([].concat(o,u.options.modifiers)));if(u.orderedModifiers=v.filter(function(A){return A.enabled}),0){var C;if(getBasePlacement(u.options.placement)===auto)var N;var I,E,w,S,T}return h(),m.update()},forceUpdate:function(){if(!f){var b=u.elements,y=b.reference,v=b.popper;if(JH(y,v)){u.rects={reference:hP(y,os(v),u.options.strategy==="fixed"),popper:Md(v)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(A){return u.modifiersData[A.name]=Object.assign({},A.data)});for(var C=0,N=0;N<u.orderedModifiers.length;N++){if(u.reset===!0){u.reset=!1,N=-1;continue}var I=u.orderedModifiers[N],E=I.fn,w=I.options,S=w===void 0?{}:w,T=I.name;typeof E=="function"&&(u=E({state:u,options:S,name:T,instance:m})||u)}}}},update:_P(function(){return new Promise(function(_){m.forceUpdate(),_(u)})}),destroy:function(){g(),f=!0}};if(!JH(s,l))return m;m.setOptions(c).then(function(_){!f&&c.onFirstUpdate&&c.onFirstUpdate(_)});function h(){u.orderedModifiers.forEach(function(_){var b=_.name,y=_.options,v=y===void 0?{}:y,C=_.effect;if(typeof C=="function"){var N=C({state:u,name:b,instance:m,options:v}),I=function(){};d.push(N||I)}})}function g(){d.forEach(function(_){return _()}),d=[]}return m}}var Rve=[UH,KH,zH,MH,qH,HH,YH,BH,WH],bP=QH({defaultModifiers:Rve});var t8=Fp(e8());var $ve=[],yP=function(e,r,o){o===void 0&&(o={});var n=W(null),i={onFirstUpdate:o.onFirstUpdate,placement:o.placement||"bottom",strategy:o.strategy||"absolute",modifiers:o.modifiers||$ve},a=M({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),s=a[0],l=a[1],c=ve(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(m){var h=m.state,g=Object.keys(h.elements);l({styles:nP(g.map(function(_){return[_,h.styles[_]||{}]})),attributes:nP(g.map(function(_){return[_,h.attributes[_]]}))})},requires:["computeStyles"]}},[]),u=ve(function(){var f={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return(0,t8.default)(n.current,f)?n.current||f:(n.current=f,f)},[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),d=W();return iP(function(){d.current&&d.current.setOptions(u)},[u]),iP(function(){if(!(e==null||r==null)){var f=o.createPopper||bP,m=f(e,r,u);return d.current=m,function(){m.destroy(),d.current=null}}},[e,r,o.createPopper]),{state:d.current?d.current.state:null,styles:s.styles,attributes:s.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}};function r8(t){if(typeof t!="string")return{position:"top",placement:"center"};let e=t.split("-");return e.length===1?{position:t,placement:"center"}:{position:e[0],placement:e[1]}}X();function vP({children:t,zIndex:e=Ar("popover"),className:r,withinPortal:o=!0}){return o?D.createElement(jc,{className:r,zIndex:e},t):D.createElement("div",{className:r,style:{position:"relative",zIndex:e}},t)}vP.displayName="@mantine/core/PopperContainer";var zve=Object.defineProperty,Uve=Object.defineProperties,Vve=Object.getOwnPropertyDescriptors,o8=Object.getOwnPropertySymbols,Hve=Object.prototype.hasOwnProperty,jve=Object.prototype.propertyIsEnumerable,n8=(t,e,r)=>e in t?zve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dw=(t,e)=>{for(var r in e||(e={}))Hve.call(e,r)&&n8(t,r,e[r]);if(o8)for(var r of o8(e))jve.call(e,r)&&n8(t,r,e[r]);return t},fw=(t,e)=>Uve(t,Vve(e)),i8=(t,e,r)=>({[`&.${r.center}`]:{top:`calc(50% - ${t}px)`},[`&.${r.end}`]:{bottom:t*e},[`&.${r.start}`]:{top:t*e}}),a8=(t,e,r,o)=>({[`&.${r.center}`]:{left:`calc(50% - ${t}px)`},[`&.${r.end}`]:{right:o.dir==="ltr"?t*e:void 0,left:o.dir==="rtl"?t*e:void 0},[`&.${r.start}`]:{left:o.dir==="ltr"?t*e:void 0,right:o.dir==="rtl"?t*e:void 0}}),Gve=me((t,{arrowSize:e,arrowDistance:r},o)=>{let n={ref:o("center")},i={ref:o("start")},a={ref:o("end")},s={center:n.ref,start:i.ref,end:a.ref};return{center:n,start:i,end:a,arrow:{width:e*2,height:e*2,position:"absolute",transform:"rotate(45deg)",border:"1px solid transparent",zIndex:1},left:fw(dw({},i8(e,r,s)),{right:t.dir==="ltr"?-e:"unset",left:t.dir==="rtl"?-e:"unset",borderLeft:t.dir==="ltr"?0:void 0,borderRight:t.dir==="rtl"?0:void 0,borderBottom:0}),right:fw(dw({},i8(e,r,s)),{left:t.dir==="ltr"?-e:"unset",right:t.dir==="rtl"?-e:"unset",borderRight:t.dir==="ltr"?0:void 0,borderLeft:t.dir==="rtl"?0:void 0,borderTop:0}),top:fw(dw({},a8(e,r,s,t)),{bottom:-e,borderLeft:t.dir==="ltr"?0:void 0,borderRight:t.dir==="rtl"?0:void 0,borderTop:0}),bottom:fw(dw({},a8(e,r,s,t)),{top:-e,borderRight:t.dir==="ltr"?0:void 0,borderLeft:t.dir==="rtl"?0:void 0,borderBottom:0})}}),s8=Gve;X();var Wve=Object.defineProperty,l8=Object.getOwnPropertySymbols,qve=Object.prototype.hasOwnProperty,Kve=Object.prototype.propertyIsEnumerable,c8=(t,e,r)=>e in t?Wve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vm=(t,e)=>{for(var r in e||(e={}))qve.call(e,r)&&c8(t,r,e[r]);if(l8)for(var r of l8(e))Kve.call(e,r)&&c8(t,r,e[r]);return t},u8={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function pw({transition:t,state:e,duration:r,timingFunction:o}){let n={transitionDuration:`${r}ms`,transitionTimingFunction:o};return typeof t=="string"?t in O_?vm(vm(vm({transitionProperty:O_[t].transitionProperty},n),O_[t].common),O_[t][u8[e]]):null:vm(vm(vm({transitionProperty:t.transitionProperty},n),t.common),t[u8[e]])}X();function mw({duration:t,exitDuration:e,timingFunction:r,mounted:o,onEnter:n,onExit:i,onEntered:a,onExited:s}){let l=dr(),c=ts(),[u,d]=M(o?"entered":"exited"),[f,m]=M(c?0:t),h=W(-1),g=_=>{let b=_?n:i,y=_?a:s;d(_?"pre-entering":"pre-exiting"),window.clearTimeout(h.current);let v=c?0:_?t:e;if(m(v),v===0)typeof b=="function"&&b(),typeof y=="function"&&y(),d(_?"entered":"exited");else{let C=window.setTimeout(()=>{typeof b=="function"&&b(),d(_?"entering":"exiting")},10);h.current=window.setTimeout(()=>{window.clearTimeout(C),typeof y=="function"&&y(),d(_?"entered":"exited")},v)}};return mr(()=>{g(o)},[o]),V(()=>()=>window.clearTimeout(h.current),[]),{transitionDuration:f,transitionStatus:u,transitionTimingFunction:r||l.transitionTimingFunction}}function G_({transition:t,duration:e=250,exitDuration:r=e,mounted:o,children:n,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c}){let{transitionDuration:u,transitionStatus:d,transitionTimingFunction:f}=mw({mounted:o,exitDuration:r,duration:e,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c});return u===0?o?D.createElement(D.Fragment,null,n({})):null:d==="exited"?null:D.createElement(D.Fragment,null,n(pw({transition:t,duration:u,state:d,timingFunction:f})))}G_.displayName="@mantine/core/Transition";var Yve=Object.defineProperty,Xve=Object.defineProperties,Jve=Object.getOwnPropertyDescriptors,d8=Object.getOwnPropertySymbols,Qve=Object.prototype.hasOwnProperty,Zve=Object.prototype.propertyIsEnumerable,f8=(t,e,r)=>e in t?Yve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p8=(t,e)=>{for(var r in e||(e={}))Qve.call(e,r)&&f8(t,r,e[r]);if(d8)for(var r of d8(e))Zve.call(e,r)&&f8(t,r,e[r]);return t},eIe=(t,e)=>Xve(t,Jve(e));function tIe(t,e){return t==="center"?t:e==="rtl"?t==="end"?"start":"end":t}function rIe(t,e){return t==="top"||t==="bottom"?t:e==="rtl"?t==="left"?"right":"left":t}function Vl({position:t="top",placement:e="center",gutter:r=5,arrowSize:o=2,arrowDistance:n=2,withArrow:i=!1,referenceElement:a,children:s,mounted:l,transition:c="pop-top-left",transitionDuration:u,exitTransitionDuration:d=u,transitionTimingFunction:f,arrowClassName:m,arrowStyle:h,zIndex:g=Ar("popover"),forceUpdateDependencies:_=[],modifiers:b=[],onTransitionEnd:y,withinPortal:v=!0}){var C;let N=i?r+o:r,{classes:I,cx:E,theme:w}=s8({arrowSize:o,arrowDistance:n},{name:"Popper"}),[S,T]=M(null),A=tIe(e,w.dir),R=rIe(t,w.dir),P=A==="center"?R:`${R}-${A}`,{styles:B,attributes:$,forceUpdate:z}=yP(a,S,{placement:P,modifiers:[{name:"offset",options:{offset:[0,N]}},...b]}),H=r8((C=$.popper)==null?void 0:C["data-popper-placement"]);return mr(()=>{typeof z=="function"&&z()},_),D.createElement(G_,{mounted:l&&!!a,duration:u,exitDuration:d,transition:c,timingFunction:f,onExited:y},G=>D.createElement("div",null,D.createElement(vP,{withinPortal:v,zIndex:g},D.createElement("div",p8({ref:T,style:eIe(p8({},B.popper),{pointerEvents:"none"})},$.popper),D.createElement("div",{style:G},s,i&&D.createElement("div",{style:h,className:E(I.arrow,I[H.placement],I[H.position],m)}))))))}Vl.displayName="@mantine/core/Popper";X();var oIe=me((t,{radius:e,shadow:r,withBorder:o})=>({root:{outline:0,WebkitTapHighlightColor:"transparent",display:"block",textDecoration:"none",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.white,boxSizing:"border-box",borderRadius:t.fn.radius(e),boxShadow:t.shadows[r]||r||"none",border:o?`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`:void 0}})),m8=oIe;var nIe=Object.defineProperty,hw=Object.getOwnPropertySymbols,g8=Object.prototype.hasOwnProperty,_8=Object.prototype.propertyIsEnumerable,h8=(t,e,r)=>e in t?nIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,iIe=(t,e)=>{for(var r in e||(e={}))g8.call(e,r)&&h8(t,r,e[r]);if(hw)for(var r of hw(e))_8.call(e,r)&&h8(t,r,e[r]);return t},aIe=(t,e)=>{var r={};for(var o in t)g8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&hw)for(var o of hw(t))e.indexOf(o)<0&&_8.call(t,o)&&(r[o]=t[o]);return r},sIe={},Hl=ee((t,e)=>{let r=Ie("Paper",sIe,t),{component:o,className:n,children:i,radius:a,withBorder:s,shadow:l}=r,c=aIe(r,["component","className","children","radius","withBorder","shadow"]),{classes:u,cx:d}=m8({radius:a,shadow:l,withBorder:s},{name:"Paper"});return D.createElement(_e,iIe({component:o||"div",className:d(u.root,n),ref:e},c),i)});Hl.displayName="@mantine/core/Paper";var W_=ee(({mounted:t,transition:e,transitionDuration:r,transitionTimingFunction:o,uuid:n,shadow:i,maxDropdownHeight:a,withinPortal:s=!0,children:l,classNames:c,styles:u,dropdownComponent:d,referenceElement:f,direction:m="column",onDirectionChange:h,switchDirectionOnFlip:g=!1,zIndex:_=Ar("popover"),dropdownPosition:b="flip",__staticSelector:y,positionDependencies:v=[]},C)=>{let{classes:N}=OH({native:d!==Ad},{classNames:c,styles:u,name:y}),I=W("bottom");return D.createElement(Vl,{referenceElement:f,mounted:t,transition:e,transitionDuration:r,exitTransitionDuration:0,transitionTimingFunction:o,position:b==="flip"?"bottom":b,withinPortal:s,forceUpdateDependencies:v,zIndex:_,modifiers:[{name:"preventOverflow",enabled:!1},{name:"flip",enabled:b==="flip"},{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:E})=>{E.styles.popper.width=`${E.rects.reference.width}px`},effect:({state:E})=>{E.elements.popper.style.width=`${E.elements.reference.offsetWidth}px`}},{name:"directionControl",enabled:!0,phase:"main",fn:({state:E})=>{if(I.current!==E.placement){I.current=E.placement;let w=E.placement==="top"?"column-reverse":"column";m!==w&&g&&h&&h(w)}}}]},D.createElement("div",{style:{maxHeight:a,display:"flex"}},D.createElement(Hl,{radius:"sm",component:d||"div",id:`${n}-items`,"aria-labelledby":`${n}-label`,role:"listbox",className:N.dropdown,shadow:i,ref:C,onMouseDown:E=>E.preventDefault()},D.createElement("div",{style:{display:"flex",flexDirection:m,width:"100%"}},l))))});W_.displayName="@mantine/core/SelectDropdown";X();X();var gw={xs:1,sm:2,md:3,lg:4,xl:5},lIe=me((t,{size:e,variant:r,color:o})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:1,borderTop:`${t.fn.size({size:e,sizes:gw})}px ${r} ${t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1)}`,marginRight:t.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${t.fn.size({size:e,sizes:gw})}px ${r} ${t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1)}`,marginLeft:t.spacing.xs}},labelDefaultStyles:{color:o==="dark"?t.colors.dark[1]:t.fn.themeColor(o,t.colorScheme==="dark"?5:t.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:t.fn.size({size:e,sizes:gw}),borderTopColor:t.fn.themeColor(o,t.colorScheme==="dark"?3:4,!1),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"100%",borderLeftWidth:t.fn.size({size:e,sizes:gw}),borderLeftColor:t.fn.themeColor(o,4,!1),borderLeftStyle:r}})),x8=lIe;var cIe=Object.defineProperty,uIe=Object.defineProperties,dIe=Object.getOwnPropertyDescriptors,_w=Object.getOwnPropertySymbols,v8=Object.prototype.hasOwnProperty,I8=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?cIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y8=(t,e)=>{for(var r in e||(e={}))v8.call(e,r)&&b8(t,r,e[r]);if(_w)for(var r of _w(e))I8.call(e,r)&&b8(t,r,e[r]);return t},fIe=(t,e)=>uIe(t,dIe(e)),pIe=(t,e)=>{var r={};for(var o in t)v8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&_w)for(var o of _w(t))e.indexOf(o)<0&&I8.call(t,o)&&(r[o]=t[o]);return r},mIe={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Ea=ee((t,e)=>{let r=Ie("Divider",mIe,t),{className:o,color:n,orientation:i,size:a,label:s,labelPosition:l,labelProps:c,variant:u,styles:d,classNames:f}=r,m=pIe(r,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames"]),h=dr(),g=n||(h.colorScheme==="dark"?"dark":"gray"),{classes:_,cx:b}=x8({color:g,size:a,variant:u},{classNames:f,styles:d,name:"Divider"}),y=i==="vertical",v=i==="horizontal",C=!!s&&v,N=!c?.color;return D.createElement(_e,y8({ref:e,className:b(_.root,{[_.vertical]:y,[_.horizontal]:v,[_.withLabel]:C},o)},m),C&&D.createElement(Gr,fIe(y8({},c),{size:c?.size||"xs",sx:{marginTop:2},className:b(_.label,_[l],{[_.labelDefaultStyles]:N})}),s))});Ea.displayName="@mantine/core/Divider";var hIe=me((t,{size:e})=>({item:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`${t.fn.size({size:e,sizes:t.spacing})/1.5}px ${t.fn.size({size:e,sizes:t.spacing})}px`,cursor:"pointer",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderRadius:t.radius.sm},selected:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.colors[t.primaryColor][0],color:t.colorScheme==="dark"?t.white:t.colors[t.primaryColor][9]},hovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},nothingFound:{boxSizing:"border-box",color:t.colors.gray[6],paddingTop:t.fn.size({size:e,sizes:t.spacing})/2,paddingBottom:t.fn.size({size:e,sizes:t.spacing})/2,textAlign:"center"},disabled:{cursor:"default",color:t.colors.dark[2]},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`${t.fn.size({size:e,sizes:t.spacing})/1.5}px ${t.fn.size({size:e,sizes:t.spacing})}px`},separatorLabel:{color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]}})),w8=hIe;var gIe=Object.defineProperty,E8=Object.getOwnPropertySymbols,_Ie=Object.prototype.hasOwnProperty,xIe=Object.prototype.propertyIsEnumerable,S8=(t,e,r)=>e in t?gIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bIe=(t,e)=>{for(var r in e||(e={}))_Ie.call(e,r)&&S8(t,r,e[r]);if(E8)for(var r of E8(e))xIe.call(e,r)&&S8(t,r,e[r]);return t};function q_({data:t,hovered:e,classNames:r,styles:o,isItemSelected:n,uuid:i,__staticSelector:a,onItemHover:s,onItemSelect:l,itemsRefs:c,itemComponent:u,size:d,nothingFound:f,creatable:m,createLabel:h}){let{classes:g,cx:_}=w8({size:d},{classNames:r,styles:o,name:a}),b=[],y=[],v=null,C=(I,E)=>{let w=typeof n=="function"?n(I.value):!1;return D.createElement(u,bIe({key:I.value,className:_(g.item,{[g.hovered]:!I.disabled&&e===E,[g.selected]:!I.disabled&&w,[g.disabled]:I.disabled}),onMouseEnter:()=>s(E),id:`${i}-${E}`,role:"option","data-ignore-outside-clicks":!0,tabIndex:-1,"aria-selected":e===E,ref:S=>{c&&c.current&&(c.current[I.value]=S)},onMouseDown:I.disabled?null:S=>{S.preventDefault(),l(I)},disabled:I.disabled},I))},N=null;if(t.forEach((I,E)=>{I.creatable?v=E:I.group?(N!==I.group&&(N=I.group,y.push(D.createElement("div",{className:g.separator,key:`__mantine-divider-${E}`},D.createElement(Ea,{classNames:{label:g.separatorLabel},label:I.group})))),y.push(C(I,E))):b.push(C(I,E))}),m){let I=t[v],E=typeof n=="function"?n(t[v].value):!1;b.push(D.createElement("div",{key:I.value,className:_(g.item,{[g.hovered]:e===v,[g.selected]:E}),onMouseEnter:()=>s(v),onMouseDown:w=>{w.preventDefault(),l(I)},tabIndex:-1,ref:w=>{c&&c.current&&(c.current[I.value]=w)}},h))}return y.length>0&&b.length>0&&b.unshift(D.createElement("div",{className:g.separator},D.createElement(Ea,null))),y.length>0||b.length>0?D.createElement(D.Fragment,null,y,b):D.createElement(Gr,{size:d,className:g.nothingFound},f)}q_.displayName="@mantine/core/SelectItems";X();var yIe=Object.defineProperty,xw=Object.getOwnPropertySymbols,T8=Object.prototype.hasOwnProperty,k8=Object.prototype.propertyIsEnumerable,C8=(t,e,r)=>e in t?yIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vIe=(t,e)=>{for(var r in e||(e={}))T8.call(e,r)&&C8(t,r,e[r]);if(xw)for(var r of xw(e))k8.call(e,r)&&C8(t,r,e[r]);return t},IIe=(t,e)=>{var r={};for(var o in t)T8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&xw)for(var o of xw(t))e.indexOf(o)<0&&k8.call(t,o)&&(r[o]=t[o]);return r},K_=ee((t,e)=>{var r=t,{label:o,value:n}=r,i=IIe(r,["label","value"]);return D.createElement("div",vIe({ref:e},i),o||n)});K_.displayName="@mantine/core/DefaultItem";X();var wIe=Object.defineProperty,EIe=Object.defineProperties,SIe=Object.getOwnPropertyDescriptors,N8=Object.getOwnPropertySymbols,CIe=Object.prototype.hasOwnProperty,TIe=Object.prototype.propertyIsEnumerable,P8=(t,e,r)=>e in t?wIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kIe=(t,e)=>{for(var r in e||(e={}))CIe.call(e,r)&&P8(t,r,e[r]);if(N8)for(var r of N8(e))TIe.call(e,r)&&P8(t,r,e[r]);return t},NIe=(t,e)=>EIe(t,SIe(e)),PIe=me((t,{size:e})=>({root:NIe(kIe({},t.fn.fontStyles()),{lineHeight:t.lineHeight}),label:{display:"inline-block",marginBottom:4,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),fontWeight:500,color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},error:{marginTop:t.spacing.xs/2,wordBreak:"break-word",color:t.colors.red[t.colorScheme==="dark"?6:7]},description:{marginTop:-3,marginBottom:7,wordBreak:"break-word",color:`${t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]} !important`,fontSize:t.fn.size({size:e,sizes:t.fontSizes})-2,lineHeight:1.2},required:{color:t.colorScheme==="dark"?t.colors.red[5]:t.colors.red[7]}})),O8=PIe;var OIe=Object.defineProperty,AIe=Object.defineProperties,DIe=Object.getOwnPropertyDescriptors,bw=Object.getOwnPropertySymbols,D8=Object.prototype.hasOwnProperty,R8=Object.prototype.propertyIsEnumerable,A8=(t,e,r)=>e in t?OIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y_=(t,e)=>{for(var r in e||(e={}))D8.call(e,r)&&A8(t,r,e[r]);if(bw)for(var r of bw(e))R8.call(e,r)&&A8(t,r,e[r]);return t},IP=(t,e)=>AIe(t,DIe(e)),RIe=(t,e)=>{var r={};for(var o in t)D8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&bw)for(var o of bw(t))e.indexOf(o)<0&&R8.call(t,o)&&(r[o]=t[o]);return r},MIe={labelElement:"label",size:"sm",__staticSelector:"InputWrapper"},kn=ee((t,e)=>{let r=Ie("InputWrapper",MIe,t),{className:o,label:n,children:i,required:a,id:s,error:l,description:c,labelElement:u,labelProps:d,descriptionProps:f,errorProps:m,classNames:h,styles:g,size:_,__staticSelector:b}=r,y=RIe(r,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","__staticSelector"]),{classes:v,cx:C}=O8({size:_},{classNames:h,styles:g,name:b}),I=ce(u,IP(Y_(Y_({},u==="label"?{htmlFor:s}:{}),d),{id:s?`${s}-label`:void 0,className:v.label}),D.createElement(D.Fragment,null,n,a&&D.createElement("span",{className:v.required,"aria-hidden":!0}," *")));return D.createElement(_e,Y_({className:C(v.root,o),ref:e},y),n&&I,c&&D.createElement(Gr,IP(Y_({},f),{color:"gray",className:v.description}),c),i,typeof l!="boolean"&&l&&D.createElement(Gr,IP(Y_({},m),{size:_,className:v.error}),l))});kn.displayName="@mantine/core/InputWrapper";X();var LIe=Object.defineProperty,FIe=Object.defineProperties,BIe=Object.getOwnPropertyDescriptors,M8=Object.getOwnPropertySymbols,$Ie=Object.prototype.hasOwnProperty,zIe=Object.prototype.propertyIsEnumerable,L8=(t,e,r)=>e in t?LIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F8=(t,e)=>{for(var r in e||(e={}))$Ie.call(e,r)&&L8(t,r,e[r]);if(M8)for(var r of M8(e))zIe.call(e,r)&&L8(t,r,e[r]);return t},B8=(t,e)=>FIe(t,BIe(e)),si={xs:30,sm:36,md:42,lg:50,xl:60},UIe=me((t,{size:e,multiline:r,radius:o,variant:n,invalid:i,rightSectionWidth:a,withRightSection:s,iconWidth:l})=>{let c=t.colors.red[t.colorScheme==="dark"?6:7],u=n==="default"||n==="filled"?{minHeight:t.fn.size({size:e,sizes:si}),paddingLeft:t.fn.size({size:e,sizes:si})/3,paddingRight:s?a:t.fn.size({size:e,sizes:si})/3,borderRadius:t.fn.radius(o)}:null;return{wrapper:{position:"relative"},input:n==="headless"?{}:B8(F8(B8(F8({},t.fn.fontStyles()),{height:r?n==="unstyled"?void 0:"auto":t.fn.size({size:e,sizes:si}),WebkitTapHighlightColor:"transparent",lineHeight:r?t.lineHeight:`${t.fn.size({size:e,sizes:si})-2}px`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),width:"100%",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,display:"block",textAlign:"left"}),u),{"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[1],color:t.colors.dark[2],opacity:.6,cursor:"not-allowed","&::placeholder":{color:t.colors.dark[2]}},"&::placeholder":{opacity:1,userSelect:"none",color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]},"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),defaultVariant:{border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[4]}`,backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.white,transition:"border-color 100ms ease","&:focus, &:focus-within":{outline:"none",borderColor:t.colors[t.primaryColor][t.colorScheme==="dark"?8:5]}},filledVariant:{border:"1px solid transparent",backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[1],"&:focus, &:focus-within":{outline:"none",borderColor:`${t.colors[t.primaryColor][t.colorScheme==="dark"?8:5]} !important`}},unstyledVariant:{borderWidth:0,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,backgroundColor:"transparent",minHeight:28,outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}},withIcon:{paddingLeft:typeof l=="number"?l:t.fn.size({size:e,sizes:si})},invalid:{color:c,borderColor:c,"&::placeholder":{opacity:1,color:c}},disabled:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[1],color:t.colors.dark[2],opacity:.6,cursor:"not-allowed","&::placeholder":{color:t.colors.dark[2]}},icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:typeof l=="number"?l:t.fn.size({size:e,sizes:si}),color:i?t.colors.red[t.colorScheme==="dark"?6:7]:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:a}}}),$8=UIe;var VIe=Object.defineProperty,HIe=Object.defineProperties,jIe=Object.getOwnPropertyDescriptors,vw=Object.getOwnPropertySymbols,V8=Object.prototype.hasOwnProperty,H8=Object.prototype.propertyIsEnumerable,z8=(t,e,r)=>e in t?VIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yw=(t,e)=>{for(var r in e||(e={}))V8.call(e,r)&&z8(t,r,e[r]);if(vw)for(var r of vw(e))H8.call(e,r)&&z8(t,r,e[r]);return t},U8=(t,e)=>HIe(t,jIe(e)),GIe=(t,e)=>{var r={};for(var o in t)V8.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&vw)for(var o of vw(t))e.indexOf(o)<0&&H8.call(t,o)&&(r[o]=t[o]);return r},WIe={rightSectionWidth:36,size:"sm",__staticSelector:"Input"},Sa=ee((t,e)=>{let r=Ie("Input",WIe,t),{component:o,className:n,invalid:i,required:a,disabled:s,variant:l,icon:c,style:u,rightSectionWidth:d,iconWidth:f,rightSection:m,rightSectionProps:h,radius:g,size:_,wrapperProps:b,classNames:y,styles:v,__staticSelector:C,multiline:N,sx:I}=r,E=GIe(r,["component","className","invalid","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx"]),w=dr(),S=l||(w.colorScheme==="dark"?"filled":"default"),{classes:T,cx:A}=$8({radius:g,size:_,multiline:N,variant:S,invalid:i,rightSectionWidth:d,iconWidth:f,withRightSection:!!m},{classNames:y,styles:v,name:C}),{systemStyles:R,rest:P}=so(E),B=o||"input";return D.createElement(_e,yw(yw({className:A(T.wrapper,n),sx:I,style:u},R),b),c&&D.createElement("div",{className:T.icon},c),D.createElement(B,U8(yw({},P),{ref:e,required:a,"aria-invalid":i,disabled:s,className:A(T[`${S}Variant`],T.input,{[T.withIcon]:c,[T.invalid]:i,[T.disabled]:s})})),m&&D.createElement("div",U8(yw({},h),{className:T.rightSection}),m))});Sa.displayName="@mantine/core/Input";var qIe=Object.defineProperty,KIe=Object.defineProperties,YIe=Object.getOwnPropertyDescriptors,j8=Object.getOwnPropertySymbols,XIe=Object.prototype.hasOwnProperty,JIe=Object.prototype.propertyIsEnumerable,G8=(t,e,r)=>e in t?qIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W8=(t,e)=>{for(var r in e||(e={}))XIe.call(e,r)&&G8(t,r,e[r]);if(j8)for(var r of j8(e))JIe.call(e,r)&&G8(t,r,e[r]);return t},q8=(t,e)=>KIe(t,YIe(e)),Iw={xs:16,sm:26,md:38,lg:56,xl:84},QIe=me((t,{size:e,radius:r,color:o})=>{let n=t.fn.variant({variant:"light",color:o});return{root:q8(W8({},t.fn.focusStyles()),{WebkitTapHighlightColor:"transparent",boxSizing:"border-box",position:"relative",display:"block",userSelect:"none",overflow:"hidden",width:t.fn.size({size:e,sizes:Iw}),minWidth:t.fn.size({size:e,sizes:Iw}),height:t.fn.size({size:e,sizes:Iw}),borderRadius:t.fn.radius(r)}),image:{objectFit:"cover",width:"100%",height:"100%",display:"block"},placeholder:q8(W8({},t.fn.fontStyles()),{fontSize:t.fn.size({size:e,sizes:Iw})/2.5,color:n.color,fontWeight:700,backgroundColor:n.background,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",userSelect:"none"}),placeholderIcon:{width:"70%",height:"70%",color:n.color}}}),K8=QIe;X();X();var ZIe=Object.defineProperty,ewe=Object.defineProperties,twe=Object.getOwnPropertyDescriptors,Y8=Object.getOwnPropertySymbols,rwe=Object.prototype.hasOwnProperty,owe=Object.prototype.propertyIsEnumerable,X8=(t,e,r)=>e in t?ZIe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nwe=(t,e)=>{for(var r in e||(e={}))rwe.call(e,r)&&X8(t,r,e[r]);if(Y8)for(var r of Y8(e))owe.call(e,r)&&X8(t,r,e[r]);return t},iwe=(t,e)=>ewe(t,twe(e));function J8(t){return D.createElement("svg",iwe(nwe({},t),{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),D.createElement("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var awe=Object.defineProperty,swe=Object.defineProperties,lwe=Object.getOwnPropertyDescriptors,ww=Object.getOwnPropertySymbols,e7=Object.prototype.hasOwnProperty,t7=Object.prototype.propertyIsEnumerable,Q8=(t,e,r)=>e in t?awe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Z8=(t,e)=>{for(var r in e||(e={}))e7.call(e,r)&&Q8(t,r,e[r]);if(ww)for(var r of ww(e))t7.call(e,r)&&Q8(t,r,e[r]);return t},cwe=(t,e)=>swe(t,lwe(e)),uwe=(t,e)=>{var r={};for(var o in t)e7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&ww)for(var o of ww(t))e.indexOf(o)<0&&t7.call(t,o)&&(r[o]=t[o]);return r},dwe={size:"md",color:"gray"},Ca=ee((t,e)=>{let r=Ie("Avatar",dwe,t),{component:o,className:n,size:i,src:a,alt:s,radius:l,children:c,color:u,classNames:d,styles:f,imageProps:m}=r,h=uwe(r,["component","className","size","src","alt","radius","children","color","classNames","styles","imageProps"]),{classes:g,cx:_}=K8({color:u,radius:l,size:i},{classNames:d,styles:f,name:"Avatar"}),[b,y]=M(!a);return V(()=>{y(!a)},[a]),D.createElement(_e,Z8({component:o||"div",className:_(g.root,n),ref:e},h),b?D.createElement("div",{className:g.placeholder,title:s},c||D.createElement(J8,{className:g.placeholderIcon})):D.createElement("img",cwe(Z8({},m),{className:g.image,src:a,alt:s,onError:()=>y(!0)})))});Ca.displayName="@mantine/core/Avatar";X();var fwe=Object.defineProperty,pwe=Object.defineProperties,mwe=Object.getOwnPropertyDescriptors,r7=Object.getOwnPropertySymbols,hwe=Object.prototype.hasOwnProperty,gwe=Object.prototype.propertyIsEnumerable,o7=(t,e,r)=>e in t?fwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_we=(t,e)=>{for(var r in e||(e={}))hwe.call(e,r)&&o7(t,r,e[r]);if(r7)for(var r of r7(e))gwe.call(e,r)&&o7(t,r,e[r]);return t},xwe=(t,e)=>pwe(t,mwe(e)),bwe=me((t,{spacing:e})=>({root:{display:"flex",paddingLeft:t.fn.size({size:e,sizes:t.spacing})/2},child:{marginLeft:-t.fn.size({size:e,sizes:t.spacing})/2,background:`${t.colorScheme==="dark"?t.colors.dark[7]:t.white}`,border:`2px solid ${t.colorScheme==="dark"?t.colors.dark[7]:t.white}`},truncated:xwe(_we({},t.fn.fontStyles()),{lineHeight:1,fontSize:`${t.fontSizes.sm}px !important`,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,width:"100%",height:"100%",backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[0]})})),n7=bwe;var ywe=Object.defineProperty,vwe=Object.defineProperties,Iwe=Object.getOwnPropertyDescriptors,Ew=Object.getOwnPropertySymbols,s7=Object.prototype.hasOwnProperty,l7=Object.prototype.propertyIsEnumerable,i7=(t,e,r)=>e in t?ywe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a7=(t,e)=>{for(var r in e||(e={}))s7.call(e,r)&&i7(t,r,e[r]);if(Ew)for(var r of Ew(e))l7.call(e,r)&&i7(t,r,e[r]);return t},wwe=(t,e)=>vwe(t,Iwe(e)),Ewe=(t,e)=>{var r={};for(var o in t)s7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ew)for(var o of Ew(t))e.indexOf(o)<0&&l7.call(t,o)&&(r[o]=t[o]);return r},Swe={size:"md",radius:"xl",limit:2,spacing:"lg"},Sw=ee((t,e)=>{let r=Ie("AvatarsGroup",Swe,t),{className:o,children:n,size:i="md",radius:a="xl",limit:s=2,classNames:l,styles:c,spacing:u="lg",total:d}=r,f=Ewe(r,["className","children","size","radius","limit","classNames","styles","spacing","total"]),{classes:m,cx:h}=n7({spacing:u},{classNames:l,styles:c,name:"AvatarsGroup"}),g=PI(n,Ca).map((v,C)=>D.cloneElement(v,{size:i,radius:a,key:C,className:h(m.child,v.props.className),style:wwe(a7({},v.props.style),{zIndex:C+1})})),_=s<2?2:s,b=g.length>_?g.length-_:0,y=d?d-Math.min(g.length,_):b;return D.createElement(_e,a7({className:h(o,m.root),ref:e},f),g.slice(0,g.length-b),y?D.createElement(Ca,{size:i,radius:a,className:m.child,style:{zIndex:s+1}},D.createElement(L_,{className:m.truncated},"+",y)):null)});Sw.displayName="@mantine/core/AvatarsGroup";X();var Cwe=Object.defineProperty,Twe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,c7=Object.getOwnPropertySymbols,Nwe=Object.prototype.hasOwnProperty,Pwe=Object.prototype.propertyIsEnumerable,u7=(t,e,r)=>e in t?Cwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d7=(t,e)=>{for(var r in e||(e={}))Nwe.call(e,r)&&u7(t,r,e[r]);if(c7)for(var r of c7(e))Pwe.call(e,r)&&u7(t,r,e[r]);return t},Owe=(t,e)=>Twe(t,kwe(e)),X_={xs:{fontSize:9,height:16},sm:{fontSize:10,height:18},md:{fontSize:11,height:20},lg:{fontSize:13,height:26},xl:{fontSize:16,height:32}},Awe={xs:4,sm:4,md:6,lg:8,xl:10},Cmt=Object.keys(X_).reduce((t,e)=>(t[e]=X_[e].height,t),{}),Dwe=me((t,{color:e,size:r,radius:o,gradientFrom:n,gradientTo:i,gradientDeg:a,fullWidth:s})=>{let l=t.fn.size({size:r,sizes:Awe}),{fontSize:c,height:u}=r in X_?X_[r]:X_.md,d=t.fn.variant({color:e,variant:"light"}),f=t.fn.variant({color:e,variant:"filled"}),m=t.fn.variant({color:e,variant:"outline"}),h=t.fn.variant({variant:"gradient",gradient:{from:n,to:i,deg:a}});return{leftSection:{marginRight:t.spacing.xs/2},rightSection:{marginLeft:t.spacing.xs/2},inner:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},root:Owe(d7(d7({},t.fn.focusStyles()),t.fn.fontStyles()),{fontSize:c,height:u,WebkitTapHighlightColor:"transparent",lineHeight:`${u-2}px`,textDecoration:"none",padding:`0 ${t.fn.size({size:r,sizes:t.spacing})/1.5}px`,boxSizing:"border-box",display:s?"flex":"inline-flex",alignItems:"center",justifyContent:"center",width:s?"100%":"auto",textTransform:"uppercase",borderRadius:t.fn.radius(o),fontWeight:700,letterSpacing:.25,cursor:"default",textOverflow:"ellipsis",overflow:"hidden"}),light:{backgroundColor:d.background,color:d.color,border:"1px solid transparent"},filled:{backgroundColor:f.background,color:f.color,border:"1px solid transparent"},outline:{backgroundColor:m.background,color:m.color,border:`1px solid ${m.border}`},gradient:{backgroundImage:h.background,color:h.color,border:0},dot:{backgroundColor:"transparent",color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[3]}`,paddingLeft:t.fn.size({size:r,sizes:t.spacing})/1.5-l/2,"&::before":{content:'""',display:"block",width:l,height:l,borderRadius:l,backgroundColor:t.fn.themeColor(e,t.colorScheme==="dark"?4:t.fn.primaryShade("light")),marginRight:l}}}}),f7=Dwe;var Rwe=Object.defineProperty,Cw=Object.getOwnPropertySymbols,m7=Object.prototype.hasOwnProperty,h7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?Rwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mwe=(t,e)=>{for(var r in e||(e={}))m7.call(e,r)&&p7(t,r,e[r]);if(Cw)for(var r of Cw(e))h7.call(e,r)&&p7(t,r,e[r]);return t},Lwe=(t,e)=>{var r={};for(var o in t)m7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Cw)for(var o of Cw(t))e.indexOf(o)<0&&h7.call(t,o)&&(r[o]=t[o]);return r},Fwe={variant:"light",size:"md",radius:"xl",gradient:{from:"blue",to:"cyan",deg:45}},is=ee((t,e)=>{let r=Ie("Badge",Fwe,t),{component:o,className:n,color:i,variant:a,fullWidth:s,children:l,size:c,leftSection:u,rightSection:d,radius:f,gradient:m,classNames:h,styles:g}=r,_=Lwe(r,["component","className","color","variant","fullWidth","children","size","leftSection","rightSection","radius","gradient","classNames","styles"]),{classes:b,cx:y}=f7({size:c,fullWidth:s,color:i,radius:f,gradientFrom:m.from,gradientTo:m.to,gradientDeg:m.deg},{classNames:h,styles:g,name:"Badge"});return D.createElement(_e,Mwe({component:o||"div",className:y(b[a],b.root,n),ref:e},_),u&&D.createElement("span",{className:b.leftSection},u),D.createElement("span",{className:b.inner},l),d&&D.createElement("span",{className:b.rightSection},d))});is.displayName="@mantine/core/Badge";X();var Bwe=me(t=>({root:{display:"flex"},breadcrumb:{lineHeight:1,whiteSpace:"nowrap",WebkitTapHighlightColor:"transparent"},separator:{marginLeft:t.spacing.xs,marginRight:t.spacing.xs,color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[7],lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"}})),g7=Bwe;var $we=Object.defineProperty,Tw=Object.getOwnPropertySymbols,x7=Object.prototype.hasOwnProperty,b7=Object.prototype.propertyIsEnumerable,_7=(t,e,r)=>e in t?$we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zwe=(t,e)=>{for(var r in e||(e={}))x7.call(e,r)&&_7(t,r,e[r]);if(Tw)for(var r of Tw(e))b7.call(e,r)&&_7(t,r,e[r]);return t},Uwe=(t,e)=>{var r={};for(var o in t)x7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Tw)for(var o of Tw(t))e.indexOf(o)<0&&b7.call(t,o)&&(r[o]=t[o]);return r},Vwe={separator:"/"},Io=ee((t,e)=>{let r=Ie("Breadcrumbs",Vwe,t),{className:o,children:n,separator:i,classNames:a,styles:s}=r,l=Uwe(r,["className","children","separator","classNames","styles"]),{classes:c,cx:u}=g7(null,{classNames:a,styles:s,name:"Breadcrumbs"}),d=D.Children.toArray(n).reduce((f,m,h,g)=>(f.push(D.cloneElement(m,{className:c.breadcrumb,key:h})),h!==g.length-1&&f.push(D.createElement(Gr,{size:"sm",className:c.separator,key:`separator-${h}`},i)),f),[]);return D.createElement(_e,zwe({className:u(c.root,o),ref:e},l),d)});Io.displayName="@mantine/core/Breadcrumbs";X();var Hwe=Object.defineProperty,jwe=Object.defineProperties,Gwe=Object.getOwnPropertyDescriptors,y7=Object.getOwnPropertySymbols,Wwe=Object.prototype.hasOwnProperty,qwe=Object.prototype.propertyIsEnumerable,v7=(t,e,r)=>e in t?Hwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J_=(t,e)=>{for(var r in e||(e={}))Wwe.call(e,r)&&v7(t,r,e[r]);if(y7)for(var r of y7(e))qwe.call(e,r)&&v7(t,r,e[r]);return t},Kwe=(t,e)=>jwe(t,Gwe(e)),kw={xs:{height:si.xs,padding:"0 14px"},sm:{height:si.sm,padding:"0 18px"},md:{height:si.md,padding:"0 22px"},lg:{height:si.lg,padding:"0 26px"},xl:{height:si.xl,padding:"0 32px"},"compact-xs":{height:22,padding:"0 7px"},"compact-sm":{height:26,padding:"0 8px"},"compact-md":{height:30,padding:"0 10px"},"compact-lg":{height:34,padding:"0 12px"},"compact-xl":{height:40,padding:"0 14px"}},I7=Object.keys(kw).reduce((t,e)=>(t[e]=kw[e].height,t),{}),Ywe=({compact:t,size:e})=>t?kw[`compact-${e}`]:kw[e],Xwe=t=>({display:t?"block":"inline-block",width:t?"100%":"auto"});function Im({variant:t,theme:e,color:r}){let o=e.fn.variant({color:r,variant:t});return J_({border:`1px solid ${o.border}`,backgroundColor:o.background,backgroundImage:o.background,color:o.color},e.fn.hover({backgroundColor:o.hover}))}var Jwe=me((t,{color:e,size:r,radius:o,fullWidth:n,compact:i,gradientFrom:a,gradientTo:s,gradientDeg:l},c)=>{let u=t.fn.variant({color:e,variant:"gradient",gradient:{from:a,to:s,deg:l}});return{loading:{ref:c("loading"),pointerEvents:"none","&::before":{content:'""',position:"absolute",top:-1,left:-1,right:-1,bottom:-1,backgroundColor:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:t.fn.radius(o),cursor:"not-allowed"}},outline:Im({variant:"outline",theme:t,color:e}),filled:Im({variant:"filled",theme:t,color:e}),light:Im({variant:"light",theme:t,color:e}),default:Im({variant:"default",theme:t,color:e}),white:Im({variant:"white",theme:t,color:e}),subtle:Im({variant:"subtle",theme:t,color:e}),gradient:{border:0,backgroundImage:u.background,color:u.color,"&:hover":t.fn.hover({backgroundSize:"200%"})},root:Kwe(J_(J_(J_(J_({},Ywe({compact:i,size:r})),t.fn.fontStyles()),t.fn.focusStyles()),Xwe(n)),{borderRadius:t.fn.radius(o),fontWeight:600,position:"relative",lineHeight:1,fontSize:t.fn.size({size:r,sizes:t.fontSizes}),WebkitTapHighlightColor:"transparent",userSelect:"none",boxSizing:"border-box",textDecoration:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none","&:not(:disabled):active":{transform:"translateY(1px)"},[`&:not(.${c("loading")}):disabled`]:{borderColor:"transparent",backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],color:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[5],cursor:"not-allowed"}}),icon:{display:"flex",alignItems:"center"},leftIcon:{marginRight:10},rightIcon:{marginLeft:10},inner:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",overflow:"visible"},label:{whiteSpace:"nowrap",height:"100%",overflow:"hidden",display:"flex",alignItems:"center"}}}),w7=Jwe;var Qwe=Object.defineProperty,Nw=Object.getOwnPropertySymbols,C7=Object.prototype.hasOwnProperty,T7=Object.prototype.propertyIsEnumerable,E7=(t,e,r)=>e in t?Qwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S7=(t,e)=>{for(var r in e||(e={}))C7.call(e,r)&&E7(t,r,e[r]);if(Nw)for(var r of Nw(e))T7.call(e,r)&&E7(t,r,e[r]);return t},Zwe=(t,e)=>{var r={};for(var o in t)C7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Nw)for(var o of Nw(t))e.indexOf(o)<0&&T7.call(t,o)&&(r[o]=t[o]);return r},eEe={size:"sm",type:"button",variant:"filled",loaderPosition:"left",gradient:{from:"blue",to:"cyan",deg:45}},re=ee((t,e)=>{let r=Ie("Button",eEe,t),{className:o,size:n,color:i,type:a,disabled:s,children:l,leftIcon:c,rightIcon:u,fullWidth:d,variant:f,radius:m,component:h,uppercase:g,compact:_,loading:b,loaderPosition:y,loaderProps:v,gradient:C,classNames:N,styles:I}=r,E=Zwe(r,["className","size","color","type","disabled","children","leftIcon","rightIcon","fullWidth","variant","radius","component","uppercase","compact","loading","loaderPosition","loaderProps","gradient","classNames","styles"]),{classes:w,cx:S,theme:T}=w7({radius:m,color:i,size:n,fullWidth:d,compact:_,gradientFrom:C.from,gradientTo:C.to,gradientDeg:C.deg},{classNames:N,styles:I,name:"Button"}),A=T.fn.variant({color:i,variant:f}),R=D.createElement(Ze,S7({color:A.color,size:T.fn.size({size:n,sizes:I7})/2},v));return D.createElement(_e,S7({component:h||"button",className:S(w[f],{[w.loading]:b},w.root,o),type:a,disabled:s||b,ref:e,onTouchStart:()=>{}},E),D.createElement("div",{className:w.inner},(c||b&&y==="left")&&D.createElement("span",{className:S(w.icon,w.leftIcon)},b&&y==="left"?R:c),D.createElement("span",{className:w.label,style:{textTransform:g?"uppercase":void 0}},l),(u||b&&y==="right")&&D.createElement("span",{className:S(w.icon,w.rightIcon)},b&&y==="right"?R:u)))});re.displayName="@mantine/core/Button";X();X();var tEe=Object.defineProperty,Pw=Object.getOwnPropertySymbols,P7=Object.prototype.hasOwnProperty,O7=Object.prototype.propertyIsEnumerable,k7=(t,e,r)=>e in t?tEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N7=(t,e)=>{for(var r in e||(e={}))P7.call(e,r)&&k7(t,r,e[r]);if(Pw)for(var r of Pw(e))O7.call(e,r)&&k7(t,r,e[r]);return t},rEe=(t,e)=>{var r={};for(var o in t)P7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Pw)for(var o of Pw(t))e.indexOf(o)<0&&O7.call(t,o)&&(r[o]=t[o]);return r};function A7(t){var e=t,{indeterminate:r}=e,o=rEe(e,["indeterminate"]);return r?D.createElement("svg",N7({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6"},o),D.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):D.createElement("svg",N7({viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o),D.createElement("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var oEe=Object.defineProperty,nEe=Object.defineProperties,iEe=Object.getOwnPropertyDescriptors,D7=Object.getOwnPropertySymbols,aEe=Object.prototype.hasOwnProperty,sEe=Object.prototype.propertyIsEnumerable,R7=(t,e,r)=>e in t?oEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M7=(t,e)=>{for(var r in e||(e={}))aEe.call(e,r)&&R7(t,r,e[r]);if(D7)for(var r of D7(e))sEe.call(e,r)&&R7(t,r,e[r]);return t},L7=(t,e)=>nEe(t,iEe(e)),lEe={xs:16,sm:20,md:24,lg:30,xl:36},cEe={xs:8,sm:10,md:14,lg:16,xl:20},uEe=me((t,{size:e,radius:r,color:o,transitionDuration:n},i)=>{let a=t.fn.size({size:e,sizes:lEe}),s=t.fn.variant({variant:"filled",color:o});return{icon:{ref:i("icon"),color:t.white,transform:"translateY(5px) scale(0.5)",opacity:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${n}ms`,pointerEvents:"none",width:t.fn.size({size:e,sizes:cEe}),position:"absolute",zIndex:1,top:0,bottom:0,left:0,right:0,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:"0ms"}},root:{display:"flex",alignItems:"center"},inner:{position:"relative",width:a,height:a},label:L7(M7({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",paddingLeft:t.spacing.sm,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),lineHeight:`${a}px`,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}),input:L7(M7({},t.fn.focusStyles()),{appearance:"none",backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,width:a,height:a,borderRadius:t.fn.radius(r),padding:0,display:"block",margin:0,transition:`border-color ${n}ms ease, background-color ${n}ms ease`,"&:checked":{backgroundColor:s.background,borderColor:s.background,[`& + .${i("icon")}`]:{opacity:1,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],borderColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[3],cursor:"not-allowed",[`& + .${i("icon")}`]:{color:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[5]}}})}}),F7=uEe;var dEe=Object.defineProperty,Ow=Object.getOwnPropertySymbols,$7=Object.prototype.hasOwnProperty,z7=Object.prototype.propertyIsEnumerable,B7=(t,e,r)=>e in t?dEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wP=(t,e)=>{for(var r in e||(e={}))$7.call(e,r)&&B7(t,r,e[r]);if(Ow)for(var r of Ow(e))z7.call(e,r)&&B7(t,r,e[r]);return t},fEe=(t,e)=>{var r={};for(var o in t)$7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ow)for(var o of Ow(t))e.indexOf(o)<0&&z7.call(t,o)&&(r[o]=t[o]);return r},pEe={size:"sm",__staticSelector:"Checkbox",transitionDuration:100,icon:A7},Xc=ee((t,e)=>{let r=Ie("Checkbox",pEe,t),{className:o,style:n,sx:i,checked:a,color:s,label:l,indeterminate:c,id:u,size:d,radius:f,wrapperProps:m,children:h,classNames:g,styles:_,transitionDuration:b,icon:y,__staticSelector:v}=r,C=fEe(r,["className","style","sx","checked","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","__staticSelector"]),N=lo(u),{systemStyles:I,rest:E}=so(C),{classes:w,cx:S}=F7({size:d,radius:f,color:s,transitionDuration:b},{classNames:g,styles:_,name:v});return D.createElement(_e,wP(wP({className:S(w.root,o),style:n,sx:i},I),m),D.createElement("div",{className:w.inner},D.createElement("input",wP({id:N,ref:e,type:"checkbox",className:w.input,checked:c||a},E)),D.createElement(y,{indeterminate:c,className:w.icon})),l&&D.createElement("label",{className:w.label,htmlFor:N},l))});Xc.displayName="@mantine/core/Checkbox";X();var U7={left:"flex-start",center:"center",right:"flex-end",apart:"space-between"},mEe=me((t,{spacing:e,position:r,noWrap:o,direction:n,grow:i,align:a,count:s})=>({root:{boxSizing:"border-box",display:"flex",flexDirection:n,alignItems:a||(n==="row"?"center":i?"stretch":r==="apart"?"flex-start":U7[r]),flexWrap:o?"nowrap":"wrap",justifyContent:n==="row"?U7[r]:void 0,gap:t.fn.size({size:e,sizes:t.spacing})},child:{boxSizing:"border-box",maxWidth:i&&n==="row"?`calc(${100/s}% - ${t.fn.size({size:e,sizes:t.spacing})-t.fn.size({size:e,sizes:t.spacing})/s}px)`:void 0,flexGrow:i?1:0}})),V7=mEe;var hEe=Object.defineProperty,Aw=Object.getOwnPropertySymbols,j7=Object.prototype.hasOwnProperty,G7=Object.prototype.propertyIsEnumerable,H7=(t,e,r)=>e in t?hEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gEe=(t,e)=>{for(var r in e||(e={}))j7.call(e,r)&&H7(t,r,e[r]);if(Aw)for(var r of Aw(e))G7.call(e,r)&&H7(t,r,e[r]);return t},_Ee=(t,e)=>{var r={};for(var o in t)j7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Aw)for(var o of Aw(t))e.indexOf(o)<0&&G7.call(t,o)&&(r[o]=t[o]);return r},xEe={position:"left",spacing:"md",direction:"row"},as=ee((t,e)=>{let r=Ie("Group",xEe,t),{className:o,position:n,align:i,children:a,noWrap:s,grow:l,spacing:c,direction:u,classNames:d,styles:f}=r,m=_Ee(r,["className","position","align","children","noWrap","grow","spacing","direction","classNames","styles"]),h=_V(a),{classes:g,cx:_}=V7({align:i,grow:l,noWrap:s,spacing:c,position:n,direction:u,count:h.length},{classNames:d,styles:f,name:"Group"}),b=h.map(y=>{var v;return typeof y=="object"&&y!==null&&"props"in y?D.cloneElement(y,{className:_(g.child,(v=y.props)==null?void 0:v.className)}):y});return D.createElement(_e,gEe({className:_(g.root,o),ref:e},m),b)});as.displayName="@mantine/core/Group";X();X();X();var bEe=Object.defineProperty,yEe=Object.defineProperties,vEe=Object.getOwnPropertyDescriptors,W7=Object.getOwnPropertySymbols,IEe=Object.prototype.hasOwnProperty,wEe=Object.prototype.propertyIsEnumerable,q7=(t,e,r)=>e in t?bEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,EEe=(t,e)=>{for(var r in e||(e={}))IEe.call(e,r)&&q7(t,r,e[r]);if(W7)for(var r of W7(e))wEe.call(e,r)&&q7(t,r,e[r]);return t},SEe=(t,e)=>yEe(t,vEe(e)),CEe=me((t,{size:e,radius:r})=>{let o=t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3];return{root:SEe(EEe({},t.fn.focusStyles()),{width:e,height:e,WebkitTapHighlightColor:"transparent",border:0,borderRadius:t.fn.size({size:r,sizes:t.radius}),appearance:"none",WebkitAppearance:"none",padding:0,position:"relative",overflow:"hidden"}),overlay:{position:"absolute",borderRadius:t.fn.size({size:r,sizes:t.radius}),top:0,left:0,right:0,bottom:0},children:{display:"inline-flex",justifyContent:"center",alignItems:"center"},shadowOverlay:{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset",zIndex:1},alphaOverlay:{backgroundImage:`linear-gradient(45deg, ${o} 25%, transparent 25%), linear-gradient(-45deg, ${o} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${o} 75%), linear-gradient(-45deg, ${t.colorScheme==="dark"?t.colors.dark[7]:t.white} 75%, ${o} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"}}}),K7=CEe;var TEe=Object.defineProperty,Dw=Object.getOwnPropertySymbols,X7=Object.prototype.hasOwnProperty,J7=Object.prototype.propertyIsEnumerable,Y7=(t,e,r)=>e in t?TEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kEe=(t,e)=>{for(var r in e||(e={}))X7.call(e,r)&&Y7(t,r,e[r]);if(Dw)for(var r of Dw(e))J7.call(e,r)&&Y7(t,r,e[r]);return t},NEe=(t,e)=>{var r={};for(var o in t)X7.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Dw)for(var o of Dw(t))e.indexOf(o)<0&&J7.call(t,o)&&(r[o]=t[o]);return r},PEe={size:25,radius:25},Ud=ee((t,e)=>{let r=Ie("ColorSwatch",PEe,t),{component:o,color:n,size:i,radius:a,className:s,children:l,classNames:c,styles:u}=r,d=NEe(r,["component","color","size","radius","className","children","classNames","styles"]),{classes:f,cx:m}=K7({radius:a,size:i},{classNames:c,styles:u,name:"ColorSwatch"});return D.createElement(_e,kEe({component:o||"div",className:m(f.root,s),ref:e},d),D.createElement("div",{className:m(f.alphaOverlay,f.overlay)}),D.createElement("div",{className:m(f.shadowOverlay,f.overlay)}),D.createElement("div",{className:f.overlay,style:{backgroundColor:n}}),D.createElement("div",{className:m(f.children,f.overlay)},l))});Ud.displayName="@mantine/core/ColorSwatch";X();X();X();var Ki={xs:8,sm:12,md:16,lg:20,xl:22},OEe=me((t,{size:e})=>{let r=t.fn.size({size:e,sizes:Ki});return{thumb:{overflow:"hidden",boxSizing:"border-box",position:"absolute",boxShadow:"0 0 1px rgba(0, 0, 0, .6)",border:`2px solid ${t.white}`,backgroundColor:"transparent",width:r,height:r,borderRadius:r}}}),Q7=OEe;var AEe=Object.defineProperty,Z7=Object.getOwnPropertySymbols,DEe=Object.prototype.hasOwnProperty,REe=Object.prototype.propertyIsEnumerable,ej=(t,e,r)=>e in t?AEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,MEe=(t,e)=>{for(var r in e||(e={}))DEe.call(e,r)&&ej(t,r,e[r]);if(Z7)for(var r of Z7(e))REe.call(e,r)&&ej(t,r,e[r]);return t};function Q_({position:t,className:e,styles:r,classNames:o,style:n,size:i,__staticSelector:a}){let{classes:s,cx:l}=Q7({size:i},{classNames:o,styles:r,name:a});return D.createElement("div",{className:l(s.thumb,e),style:MEe({left:`calc(${t.x*100}% - ${Ki[i]/2}px)`,top:`calc(${t.y*100}% - ${Ki[i]/2}px)`},n)})}Q_.displayName="@mantine/core/Thumb";var LEe=me((t,{size:e},r)=>{let o={ref:r("sliderThumb")};return{sliderThumb:o,slider:{position:"relative",height:t.fn.size({size:e,sizes:Ki})+2,boxSizing:"border-box",marginLeft:t.fn.size({size:e,sizes:Ki})/2,marginRight:t.fn.size({size:e,sizes:Ki})/2,outline:0,[`&:focus .${o.ref}`]:{outline:"none",boxShadow:t.focusRing==="always"||t.focusRing==="auto"?`0 0 0 2px ${t.colorScheme==="dark"?t.colors.dark[9]:t.white}, 0 0 0 4px ${t.colors[t.primaryColor][t.colorScheme==="dark"?7:5]}`:void 0},[`&:focus:not(:focus-visible) .${o.ref}`]:{boxShadow:t.focusRing==="auto"||t.focusRing==="never"?"none":void 0}},sliderOverlay:{position:"absolute",boxSizing:"border-box",top:0,bottom:0,left:-t.fn.size({size:e,sizes:Ki})/2-1,right:-t.fn.size({size:e,sizes:Ki})/2-1,borderRadius:1e3}}}),tj=LEe;var FEe=Object.defineProperty,BEe=Object.defineProperties,$Ee=Object.getOwnPropertyDescriptors,Rw=Object.getOwnPropertySymbols,oj=Object.prototype.hasOwnProperty,nj=Object.prototype.propertyIsEnumerable,rj=(t,e,r)=>e in t?FEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zEe=(t,e)=>{for(var r in e||(e={}))oj.call(e,r)&&rj(t,r,e[r]);if(Rw)for(var r of Rw(e))nj.call(e,r)&&rj(t,r,e[r]);return t},UEe=(t,e)=>BEe(t,$Ee(e)),VEe=(t,e)=>{var r={};for(var o in t)oj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Rw)for(var o of Rw(t))e.indexOf(o)<0&&nj.call(t,o)&&(r[o]=t[o]);return r},Z_=ee((t,e)=>{var r=t,{value:o,onChange:n,maxValue:i,round:a,size:s="md",thumbColor:l="transparent",__staticSelector:c="ColorSlider",focusable:u=!0,overlays:d,classNames:f,styles:m,className:h}=r,g=VEe(r,["value","onChange","maxValue","round","size","thumbColor","__staticSelector","focusable","overlays","classNames","styles","className"]);let{classes:_,cx:b}=tj({size:s},{classNames:f,styles:m,name:c}),[y,v]=M({y:0,x:o/i}),C=S=>a?Math.round(S*i):S*i,{ref:N}=R_(({x:S})=>n(C(S)));mr(()=>{v({y:0,x:o/i})},[o]);let I=(S,T)=>{S.preventDefault();let A=D_(T);n(C(A.x))},E=S=>{switch(S.nativeEvent.code){case"ArrowRight":{I(S,{x:y.x+.05,y:y.y});break}case"ArrowLeft":{I(S,{x:y.x-.05,y:y.y});break}}},w=d.map((S,T)=>D.createElement("div",{className:_.sliderOverlay,style:S,key:T}));return D.createElement(_e,UEe(zEe({},g),{ref:Sn(N,e),className:b(_.slider,h),role:"slider","aria-valuenow":o,"aria-valuemax":i,"aria-valuemin":0,tabIndex:u?0:-1,onKeyDown:E}),w,D.createElement(Q_,{__staticSelector:c,classNames:f,styles:m,position:y,style:{top:1,backgroundColor:l},className:_.sliderThumb,size:s}))});Z_.displayName="@mantine/core/ColorSlider";var HEe=Object.defineProperty,jEe=Object.defineProperties,GEe=Object.getOwnPropertyDescriptors,Mw=Object.getOwnPropertySymbols,aj=Object.prototype.hasOwnProperty,sj=Object.prototype.propertyIsEnumerable,ij=(t,e,r)=>e in t?HEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WEe=(t,e)=>{for(var r in e||(e={}))aj.call(e,r)&&ij(t,r,e[r]);if(Mw)for(var r of Mw(e))sj.call(e,r)&&ij(t,r,e[r]);return t},qEe=(t,e)=>jEe(t,GEe(e)),KEe=(t,e)=>{var r={};for(var o in t)aj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Mw)for(var o of Mw(t))e.indexOf(o)<0&&sj.call(t,o)&&(r[o]=t[o]);return r},EP=ee((t,e)=>{var r=t,{value:o,onChange:n}=r,i=KEe(r,["value","onChange"]);return D.createElement(Z_,qEe(WEe({},i),{ref:e,value:o,onChange:n,maxValue:360,thumbColor:`hsl(${o}, 100%, 50%)`,round:!0,overlays:[{backgroundImage:"linear-gradient(to right,hsl(0,100%,50%),hsl(60,100%,50%),hsl(120,100%,50%),hsl(170,100%,50%),hsl(240,100%,50%),hsl(300,100%,50%),hsl(360,100%,50%))"},{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset"}]}))});EP.displayName="@mantine/core/HueSlider";X();function Ta(t,e=0,r=10**e){return Math.round(r*t)/r}function YEe({h:t,s:e,l:r,a:o}){let n=e*((r<50?r:100-r)/100);return{h:t,s:n>0?2*n/(r+n)*100:0,v:r+n,a:o}}var XEe={grad:360/400,turn:360,rad:360/(Math.PI*2)};function JEe(t,e="deg"){return Number(t)*(XEe[e]||1)}var QEe=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function lj(t){let e=QEe.exec(t);return e?YEe({h:JEe(e[1],e[2]),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)}):{h:0,s:0,v:0,a:1}}function SP({r:t,g:e,b:r,a:o}){let n=Math.max(t,e,r),i=n-Math.min(t,e,r),a=i?n===t?(e-r)/i:n===e?2+(r-t)/i:4+(t-e)/i:0;return{h:Ta(60*(a<0?a+6:a)),s:Ta(n?i/n*100:0),v:Ta(n/255*100),a:o}}function ZEe(t){let e=t[0]==="#"?t.slice(1):t;return e.length===3?SP({r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:1}):SP({r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16),a:1})}var e0e=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function cj(t){let e=e0e.exec(t);return e?SP({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):{h:0,s:0,v:0,a:1}}var uj={hex:/^#?([0-9A-F]{3}){1,2}$/i,rgb:/^rgb\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,rgba:/^rgba\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,hsl:/hsl\(\s*(\d+)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\)/i,hsla:/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(\d*(?:\.\d+)?)\)$/i},t0e={hex:ZEe,rgb:cj,rgba:cj,hsl:lj,hsla:lj};function Vd(t){for(let[,e]of Object.entries(uj))if(e.test(t))return!0;return!1}function Hd(t){if(typeof t!="string")return{h:0,s:0,v:0,a:1};if(t==="transparent")return{h:0,s:0,v:0,a:0};let e=t.trim();for(let[r,o]of Object.entries(uj))if(o.test(e))return t0e[r](e);return{h:0,s:0,v:0,a:1}}var r0e=Object.defineProperty,o0e=Object.defineProperties,n0e=Object.getOwnPropertyDescriptors,Lw=Object.getOwnPropertySymbols,fj=Object.prototype.hasOwnProperty,pj=Object.prototype.propertyIsEnumerable,dj=(t,e,r)=>e in t?r0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,i0e=(t,e)=>{for(var r in e||(e={}))fj.call(e,r)&&dj(t,r,e[r]);if(Lw)for(var r of Lw(e))pj.call(e,r)&&dj(t,r,e[r]);return t},a0e=(t,e)=>o0e(t,n0e(e)),s0e=(t,e)=>{var r={};for(var o in t)fj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Lw)for(var o of Lw(t))e.indexOf(o)<0&&pj.call(t,o)&&(r[o]=t[o]);return r},CP=ee((t,e)=>{var r=t,{value:o,onChange:n,color:i}=r,a=s0e(r,["value","onChange","color"]);let s=dr(),l=s.colorScheme==="dark"?s.colors.dark[4]:s.colors.gray[3];return D.createElement(Z_,a0e(i0e({},a),{ref:e,value:o,onChange:c=>n(Ta(c,2)),maxValue:1,round:!1,overlays:[{backgroundImage:`linear-gradient(45deg, ${l} 25%, transparent 25%), linear-gradient(-45deg, ${l} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${l} 75%), linear-gradient(-45deg, ${s.colorScheme==="dark"?s.colors.dark[7]:s.white} 75%, ${l} 75%)`,backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},{backgroundImage:`linear-gradient(90deg, transparent, ${i})`},{boxShadow:"rgba(0, 0, 0, .1) 0px 0px 0px 1px inset, rgb(0, 0, 0, .15) 0px 0px 4px inset"}]}))});CP.displayName="@mantine/core/AlphaSlider";X();var l0e={xs:100,sm:110,md:120,lg:140,xl:160},c0e=me((t,{size:e},r)=>{let o=-t.fn.size({size:e,sizes:Ki})/2-1,n={ref:r("saturationThumb")};return{saturationThumb:n,saturation:{boxSizing:"border-box",position:"relative",height:t.fn.size({size:e,sizes:l0e}),borderRadius:t.radius.sm,margin:t.fn.size({size:e,sizes:Ki})/2,WebkitTapHighlightColor:"transparent",[`&:focus .${n.ref}`]:{outline:"none",boxShadow:`0 0 0 1px ${t.colorScheme==="dark"?t.colors.dark[9]:t.white}, 0 0 0 3px ${t.colors[t.primaryColor][t.colorScheme==="dark"?7:5]}`},[`&:focus:not(:focus-visible) .${n.ref}`]:{boxShadow:t.focusRing==="auto"||t.focusRing==="never"?"none":void 0}},saturationOverlay:{position:"absolute",boxSizing:"border-box",borderRadius:t.radius.sm,top:o,left:o,right:o,bottom:o}}}),mj=c0e;function _j({h:t,s:e,v:r,a:o}){let n=t/360*6,i=e/100,a=r/100,s=Math.floor(n),l=a*(1-i),c=a*(1-(n-s)*i),u=a*(1-(1-n+s)*i),d=s%6;return{r:Ta([a,c,l,l,u,a][d]*255),g:Ta([u,a,a,c,l,l][d]*255),b:Ta([l,l,u,a,a,c][d]*255),a:Ta(o,2)}}function hj(t,e){let{r,g:o,b:n,a:i}=_j(t);return e?`rgba(${r}, ${o}, ${n}, ${Ta(i,2)})`:`rgb(${r}, ${o}, ${n})`}function gj({h:t,s:e,v:r,a:o},n){let i=(200-e)*r/100,a={h:Math.round(t),s:Math.round(i>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0),l:Math.round(i/2)};return n?`hsla(${a.h}, ${a.s}%, ${a.l}%, ${Ta(o,2)})`:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}function TP(t){let e=t.toString(16);return e.length<2?`0${e}`:e}function u0e(t){let{r:e,g:r,b:o}=_j(t);return`#${TP(e)}${TP(r)}${TP(o)}`}var kP={hex:u0e,rgb:t=>hj(t,!1),rgba:t=>hj(t,!0),hsl:t=>gj(t,!1),hsla:t=>gj(t,!0)};function Jc(t,e){return e?t in kP?kP[t](e):kP.hex(e):"#000000"}function NP({value:t,onChange:e,focusable:r=!0,__staticSelector:o="saturation",size:n,color:i,saturationLabel:a,classNames:s,styles:l}){let{classes:c}=mj({size:n},{classNames:s,styles:l,name:o}),[u,d]=M({x:t.s/100,y:1-t.v/100}),{ref:f}=R_(({x:g,y:_})=>{e({s:Math.round(g*100),v:Math.round((1-_)*100)})});V(()=>{d({x:t.s/100,y:1-t.v/100})},[t.s,t.v]);let m=(g,_)=>{g.preventDefault();let b=D_(_);e({s:Math.round(b.x*100),v:Math.round((1-b.y)*100)})},h=g=>{switch(g.nativeEvent.code){case"ArrowUp":{m(g,{y:u.y-.05,x:u.x});break}case"ArrowDown":{m(g,{y:u.y+.05,x:u.x});break}case"ArrowRight":{m(g,{x:u.x+.05,y:u.y});break}case"ArrowLeft":{m(g,{x:u.x-.05,y:u.y});break}}};return D.createElement("div",{className:c.saturation,ref:f,role:"slider","aria-label":a,"aria-valuenow":u.x,"aria-valuetext":Jc("rgba",t),tabIndex:r?0:-1,onKeyDown:h},D.createElement("div",{className:c.saturationOverlay,style:{backgroundColor:`hsl(${t.h}, 100%, 50%)`}}),D.createElement("div",{className:c.saturationOverlay,style:{backgroundImage:"linear-gradient(90deg, #fff, transparent)"}}),D.createElement("div",{className:c.saturationOverlay,style:{backgroundImage:"linear-gradient(0deg, #000, transparent)"}}),D.createElement(Q_,{__staticSelector:o,classNames:s,styles:l,position:u,className:c.saturationThumb,style:{backgroundColor:i},size:n}))}NP.displayName="@mantine/core/Saturation";X();var d0e=me((t,{swatchesPerRow:e})=>({swatch:{width:`calc(${100/e}% - 4px)`,height:0,paddingBottom:`calc(${100/e}% - 4px)`,margin:2,boxSizing:"content-box"},swatches:{boxSizing:"border-box",marginLeft:-2,marginRight:-2,display:"flex",flexWrap:"wrap"}})),xj=d0e;var f0e=Object.defineProperty,Fw=Object.getOwnPropertySymbols,yj=Object.prototype.hasOwnProperty,vj=Object.prototype.propertyIsEnumerable,bj=(t,e,r)=>e in t?f0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p0e=(t,e)=>{for(var r in e||(e={}))yj.call(e,r)&&bj(t,r,e[r]);if(Fw)for(var r of Fw(e))vj.call(e,r)&&bj(t,r,e[r]);return t},m0e=(t,e)=>{var r={};for(var o in t)yj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Fw)for(var o of Fw(t))e.indexOf(o)<0&&vj.call(t,o)&&(r[o]=t[o]);return r};function PP(t){var e=t,{data:r,onSelect:o,swatchesPerRow:n=10,focusable:i=!0,classNames:a,styles:s,__staticSelector:l="color-picker"}=e,c=m0e(e,["data","onSelect","swatchesPerRow","focusable","classNames","styles","__staticSelector"]);let{classes:u}=xj({swatchesPerRow:n},{classNames:a,styles:s,name:l}),d=r.map((f,m)=>D.createElement(Ud,{className:u.swatch,component:"button",type:"button",color:f,key:m,radius:"sm",onClick:()=>o(Hd(f)),style:{cursor:"pointer"},"aria-label":f,tabIndex:i?0:-1}));return D.createElement("div",p0e({className:u.swatches},c),d)}PP.displayName="@mantine/core/Swatches";var h0e={xs:180,sm:200,md:240,lg:280,xl:320},g0e=me((t,{size:e,fullWidth:r})=>({preview:{},wrapper:{boxSizing:"border-box",width:r?"100%":t.fn.size({size:e,sizes:h0e}),padding:1},body:{display:"flex",boxSizing:"border-box",paddingTop:t.fn.size({size:e,sizes:t.spacing})/2},sliders:{flex:1,boxSizing:"border-box","&:not(:only-child)":{marginRight:t.spacing.xs}},slider:{boxSizing:"border-box","& + &":{marginTop:5}},swatch:{cursor:"pointer"}})),Ij=g0e;var _0e=Object.defineProperty,Bw=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Sj=Object.prototype.propertyIsEnumerable,wj=(t,e,r)=>e in t?_0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,OP=(t,e)=>{for(var r in e||(e={}))Ej.call(e,r)&&wj(t,r,e[r]);if(Bw)for(var r of Bw(e))Sj.call(e,r)&&wj(t,r,e[r]);return t},x0e=(t,e)=>{var r={};for(var o in t)Ej.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Bw)for(var o of Bw(t))e.indexOf(o)<0&&Sj.call(t,o)&&(r[o]=t[o]);return r},b0e={xs:26,sm:34,md:42,lg:50,xl:54},y0e={swatchesPerRow:10,size:"sm",withPicker:!0,focusable:!0,__staticSelector:"ColorPicker"},AP=ee((t,e)=>{let r=Ie("ColorPicker",y0e,t),{value:o,defaultValue:n,onChange:i,format:a,swatches:s,swatchesPerRow:l,size:c,withPicker:u,fullWidth:d,focusable:f,__staticSelector:m,saturationLabel:h,hueLabel:g,alphaLabel:_,className:b,styles:y,classNames:v}=r,C=x0e(r,["value","defaultValue","onChange","format","swatches","swatchesPerRow","size","withPicker","fullWidth","focusable","__staticSelector","saturationLabel","hueLabel","alphaLabel","className","styles","classNames"]),{classes:N,cx:I,theme:E}=Ij({size:c,fullWidth:d},{classNames:v,styles:y,name:m}),w=W(a),S=W(null),T=a==="rgba"||a==="hsla",[A,R]=M(!1),[P,B]=Cn({value:o,defaultValue:n,finalValue:"#FFFFFF",rule:G=>Vd(G),onChange:i}),[$,z]=M(Hd(P)),H=G=>{R(!0),z(Y=>{let L=OP(OP({},Y),G);return S.current=Jc(w.current,L),L}),Promise.resolve().then(()=>B(S.current)).then(()=>R(!1))};return V(()=>{Vd(o)&&!A&&z(Hd(o))},[o]),mr(()=>{w.current=a,B(Jc(a,$))},[a]),D.createElement(_e,OP({className:I(N.wrapper,b),ref:e},C),u&&D.createElement(D.Fragment,null,D.createElement(NP,{value:$,onChange:H,color:P,styles:y,classNames:v,size:c,focusable:f,saturationLabel:h,__staticSelector:m}),D.createElement("div",{className:N.body},D.createElement("div",{className:N.sliders},D.createElement(EP,{value:$.h,onChange:G=>H({h:G}),size:c,styles:y,classNames:v,focusable:f,"aria-label":g,__staticSelector:m}),T&&D.createElement(CP,{value:$.a,onChange:G=>H({a:G}),size:c,color:Jc("hex",$),style:{marginTop:6},styles:y,classNames:v,focusable:f,"aria-label":_,__staticSelector:m})),T&&D.createElement(Ud,{color:P,radius:"sm",size:E.fn.size({size:c,sizes:b0e}),className:N.preview}))),Array.isArray(s)&&D.createElement(PP,{data:s,onSelect:H,style:{marginTop:5},swatchesPerRow:l,focusable:f,classNames:v,styles:y,__staticSelector:m}))});AP.displayName="@mantine/core/ColorPicker";var v0e=me((t,{disallowInput:e})=>({dropdownBody:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`},input:{cursor:e?"pointer":void 0}})),Cj=v0e;var I0e=Object.defineProperty,w0e=Object.defineProperties,E0e=Object.getOwnPropertyDescriptors,zw=Object.getOwnPropertySymbols,Nj=Object.prototype.hasOwnProperty,Pj=Object.prototype.propertyIsEnumerable,Tj=(t,e,r)=>e in t?I0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$w=(t,e)=>{for(var r in e||(e={}))Nj.call(e,r)&&Tj(t,r,e[r]);if(zw)for(var r of zw(e))Pj.call(e,r)&&Tj(t,r,e[r]);return t},kj=(t,e)=>w0e(t,E0e(e)),S0e=(t,e)=>{var r={};for(var o in t)Nj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&zw)for(var o of zw(t))e.indexOf(o)<0&&Pj.call(t,o)&&(r[o]=t[o]);return r},C0e={xs:16,sm:18,md:22,lg:28,xl:36},T0e={xs:12,sm:15,md:17,lg:21,xl:25},k0e={size:"sm",format:"hex",fixOnBlur:!0,withPreview:!0,swatchesPerRow:10,withPicker:!0,transition:"pop-top-left",dropdownZIndex:Ar("popover"),transitionDuration:0,withinPortal:!0},Uw=ee((t,e)=>{let r=Ie("ColorInput",k0e,t),{label:o,description:n,error:i,required:a,wrapperProps:s,size:l,format:c,onChange:u,onFocus:d,onBlur:f,value:m,defaultValue:h,classNames:g,styles:_,disallowInput:b,fixOnBlur:y,withPreview:v,swatchesPerRow:C,withPicker:N,icon:I,transition:E,id:w,dropdownZIndex:S,transitionDuration:T,transitionTimingFunction:A,withinPortal:R,className:P,style:B,swatches:$,sx:z,errorProps:H,labelProps:G,descriptionProps:Y}=r,L=S0e(r,["label","description","error","required","wrapperProps","size","format","onChange","onFocus","onBlur","value","defaultValue","classNames","styles","disallowInput","fixOnBlur","withPreview","swatchesPerRow","withPicker","icon","transition","id","dropdownZIndex","transitionDuration","transitionTimingFunction","withinPortal","className","style","swatches","sx","errorProps","labelProps","descriptionProps"]),{classes:ne,cx:ae,theme:U}=Cj({disallowInput:b},{classNames:g,styles:_,name:"ColorInput"}),{systemStyles:ge,rest:Ce}=so(L),He=lo(w),[Qe,Me]=M(null),[ke,at]=M(!1),[Rt,ut]=M(""),[ht,bt]=Cn({value:m,defaultValue:h,finalValue:"",rule:ye=>typeof ye=="string",onChange:u}),Xr=ye=>{typeof d=="function"&&d(ye),at(!0)},Mt=ye=>{typeof f=="function"&&f(ye),at(!1),y&&bt(Rt)};return V(()=>{(Vd(ht)||ht.trim()==="")&&ut(ht)},[ht]),mr(()=>{Vd(ht)&&bt(Jc(c,Hd(ht)))},[c]),D.createElement(kn,$w($w({label:o,description:n,error:i,required:a,classNames:g,styles:_,size:l,id:He,className:P,style:B,__staticSelector:"ColorInput",sx:z,errorProps:H,descriptionProps:Y,labelProps:G},ge),s),D.createElement("div",{ref:Me},D.createElement(Sa,kj($w({},Ce),{ref:e,__staticSelector:"ColorInput",id:He,onFocus:Xr,onBlur:Mt,spellCheck:!1,size:l,value:ht,onChange:ye=>bt(ye.currentTarget.value),invalid:!!i,required:a,autoComplete:"nope",icon:I||(v?D.createElement(Ud,{color:Vd(ht)?ht:"#fff",size:U.fn.size({size:l,sizes:C0e})}):null),readOnly:b,classNames:kj($w({},g),{input:ae(ne.input,g?.input)}),styles:_}))),D.createElement(Vl,{referenceElement:Qe,transitionDuration:T,transitionTimingFunction:A,transition:E,mounted:ke,position:"bottom",placement:"start",gutter:5,arrowSize:3,zIndex:S,arrowStyle:{left:U.fn.size({size:l,sizes:T0e})},withinPortal:R},D.createElement("div",{style:{pointerEvents:"all"}},D.createElement(Hl,{shadow:"sm",p:l,className:ne.dropdownBody,onMouseDown:ye=>ye.preventDefault()},D.createElement(AP,{__staticSelector:"ColorInput",value:ht,onChange:bt,format:c,swatches:$,swatchesPerRow:C,withPicker:N,size:l,focusable:!1,styles:_,classNames:g})))))});Uw.displayName="@mantine/core/ColorInput";X();var N0e=Object.defineProperty,Vw=Object.getOwnPropertySymbols,Aj=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,Oj=(t,e,r)=>e in t?N0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,P0e=(t,e)=>{for(var r in e||(e={}))Aj.call(e,r)&&Oj(t,r,e[r]);if(Vw)for(var r of Vw(e))Dj.call(e,r)&&Oj(t,r,e[r]);return t},O0e=(t,e)=>{var r={};for(var o in t)Aj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Vw)for(var o of Vw(t))e.indexOf(o)<0&&Dj.call(t,o)&&(r[o]=t[o]);return r};function DP(t){var e=t,{withinPortal:r=!0,children:o}=e,n=O0e(e,["withinPortal","children"]);return r?D.createElement(jc,P0e({},n),o):D.createElement(D.Fragment,null,o)}DP.displayName="@mantine/core/OptionalPortal";X();function RP({transitions:t,duration:e=250,exitDuration:r=e,mounted:o,children:n,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c}){let{transitionDuration:u,transitionStatus:d,transitionTimingFunction:f}=mw({mounted:o,duration:e,exitDuration:r,timingFunction:i,onExit:a,onEntered:s,onEnter:l,onExited:c});if(u===0)return o?D.createElement(D.Fragment,null,n({})):null;if(d==="exited")return null;let m=Object.keys(t).reduce((h,g)=>(h[g]=pw({duration:t[g].duration,transition:t[g].transition,timingFunction:t[g].timingFunction||f,state:d}),h),{});return D.createElement(D.Fragment,null,n(m))}RP.displayName="@mantine/core/GroupedTransition";X();var A0e=Object.defineProperty,D0e=Object.defineProperties,R0e=Object.getOwnPropertyDescriptors,Hw=Object.getOwnPropertySymbols,Lj=Object.prototype.hasOwnProperty,Fj=Object.prototype.propertyIsEnumerable,Rj=(t,e,r)=>e in t?A0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ex=(t,e)=>{for(var r in e||(e={}))Lj.call(e,r)&&Rj(t,r,e[r]);if(Hw)for(var r of Hw(e))Fj.call(e,r)&&Rj(t,r,e[r]);return t},Mj=(t,e)=>D0e(t,R0e(e)),M0e=(t,e)=>{var r={};for(var o in t)Lj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Hw)for(var o of Hw(t))e.indexOf(o)<0&&Fj.call(t,o)&&(r[o]=t[o]);return r},L0e={opacity:.6,color:"#fff",zIndex:Ar("modal"),radius:0,blur:0},tx=ee((t,e)=>{let r=Ie("Overlay",L0e,t),{opacity:o,blur:n,color:i,gradient:a,zIndex:s,component:l,radius:c,sx:u}=r,d=M0e(r,["opacity","blur","color","gradient","zIndex","component","radius","sx"]),f=a?{backgroundImage:a}:{backgroundColor:i},m={position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:s},h=g=>D.createElement(_e,ex({component:l||"div",ref:e,sx:[_=>Mj(ex(ex({},f),m),{opacity:o,borderRadius:_.fn.size({size:c,sizes:_.radius})}),...Array.isArray(u)?u:[u]]},g));return n?D.createElement(_e,ex({sx:[()=>Mj(ex({},m),{backdropFilter:`blur(${n}px)`}),...Array.isArray(u)?u:[u]]},d),h()):h(d)});tx.displayName="@mantine/core/Overlay";X();X();var F0e=Object.defineProperty,Bj=Object.getOwnPropertySymbols,B0e=Object.prototype.hasOwnProperty,$0e=Object.prototype.propertyIsEnumerable,$j=(t,e,r)=>e in t?F0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z0e=(t,e)=>{for(var r in e||(e={}))B0e.call(e,r)&&$j(t,r,e[r]);if(Bj)for(var r of Bj(e))$0e.call(e,r)&&$j(t,r,e[r]);return t};function zj(t){return D.createElement("svg",z0e({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var U0e=Object.defineProperty,V0e=Object.defineProperties,H0e=Object.getOwnPropertyDescriptors,Uj=Object.getOwnPropertySymbols,j0e=Object.prototype.hasOwnProperty,G0e=Object.prototype.propertyIsEnumerable,Vj=(t,e,r)=>e in t?U0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hj=(t,e)=>{for(var r in e||(e={}))j0e.call(e,r)&&Vj(t,r,e[r]);if(Uj)for(var r of Uj(e))G0e.call(e,r)&&Vj(t,r,e[r]);return t},jj=(t,e)=>V0e(t,H0e(e)),W0e=me((t,{radius:e})=>({root:{},imageWrapper:{position:"relative"},figure:{margin:0},image:jj(Hj({},t.fn.fontStyles()),{display:"block",width:"100%",height:"100%",border:0,borderRadius:t.fn.size({size:e,sizes:t.radius})}),caption:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[7],marginTop:t.spacing.xs},placeholder:jj(Hj({},t.fn.cover()),{display:"flex",alignItems:"center",justifyContent:"center",color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],backgroundColor:t.colorScheme==="dark"?t.colors.dark[8]:t.colors.gray[0],borderRadius:t.fn.size({size:e,sizes:t.radius})})})),Gj=W0e;var q0e=Object.defineProperty,jw=Object.getOwnPropertySymbols,Kj=Object.prototype.hasOwnProperty,Yj=Object.prototype.propertyIsEnumerable,Wj=(t,e,r)=>e in t?q0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qj=(t,e)=>{for(var r in e||(e={}))Kj.call(e,r)&&Wj(t,r,e[r]);if(jw)for(var r of jw(e))Yj.call(e,r)&&Wj(t,r,e[r]);return t},K0e=(t,e)=>{var r={};for(var o in t)Kj.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&jw)for(var o of jw(t))e.indexOf(o)<0&&Yj.call(t,o)&&(r[o]=t[o]);return r},Y0e={fit:"cover",width:"100%",height:"auto",radius:0},Qc=ee((t,e)=>{let r=Ie("Image",Y0e,t),{className:o,alt:n,src:i,fit:a,width:s,height:l,radius:c,imageProps:u,withPlaceholder:d,placeholder:f,imageRef:m,classNames:h,styles:g,caption:_}=r,b=K0e(r,["className","alt","src","fit","width","height","radius","imageProps","withPlaceholder","placeholder","imageRef","classNames","styles","caption"]),{classes:y,cx:v}=Gj({radius:c},{classNames:h,styles:g,name:"Image"}),[C,N]=M(!1),[I,E]=M(!i),w=d&&(!C||I);return mr(()=>{N(!1),E(!1)},[i]),D.createElement(_e,qj({className:v(y.root,o),ref:e},b),D.createElement("figure",{className:y.figure},D.createElement("div",{className:y.imageWrapper},D.createElement("img",qj({className:y.image,src:i,alt:n,style:{objectFit:a,width:s,height:l},ref:m,onLoad:S=>{N(!0),typeof u?.onLoad=="function"&&u.onLoad(S)},onError:S=>{E(!0),typeof u?.onError=="function"&&u.onError(S)}},u)),w&&D.createElement("div",{className:y.placeholder,title:n},f||D.createElement(zj,{style:{width:40,height:40}}))),!!_&&D.createElement(Gr,{component:"figcaption",size:"sm",align:"center",className:y.caption},_)))});Qc.displayName="@mantine/core/Image";function MP(t){if(typeof t=="string"&&t.trim().length===0)return!0;try{return JSON.parse(t),!0}catch{return!1}}X();var X0e=me((t,{size:e})=>({input:{fontFamily:t.fontFamilyMonospace,fontSize:t.fn.size({size:e,sizes:t.fontSizes})-2}})),Xj=X0e;X();function jd(t,e){if(t==null)return{};var r={},o=Object.keys(t),n,i;for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&(r[n]=t[n]);return r}X();X();X();var J0e=Ft,Jj=J0e;var Qj=function(e){var r=W(e);return Jj(function(){r.current=e}),r};X();var Zj=function(e,r){if(typeof e=="function"){e(r);return}e.current=r},Q0e=function(e,r){var o=W();return qe(function(n){e.current=n,o.current&&Zj(o.current,null),o.current=r,r&&Zj(r,n)},[r])},eG=Q0e;var tG={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},rG=function(e){Object.keys(tG).forEach(function(r){e.style.setProperty(r,tG[r],"important")})},Yi=null,Z0e=function(e,r){var o=e.scrollHeight;return r.sizingStyle.boxSizing==="border-box"?o+r.borderSize:o-r.paddingSize};function eSe(t,e,r,o){r===void 0&&(r=1),o===void 0&&(o=1/0),Yi||(Yi=document.createElement("textarea"),Yi.setAttribute("tabindex","-1"),Yi.setAttribute("aria-hidden","true"),rG(Yi)),Yi.parentNode===null&&document.body.appendChild(Yi);var n=t.paddingSize,i=t.borderSize,a=t.sizingStyle,s=a.boxSizing;Object.keys(a).forEach(function(f){var m=f;Yi.style[m]=a[m]}),rG(Yi),Yi.value=e;var l=Z0e(Yi,t);Yi.value="x";var c=Yi.scrollHeight-n,u=c*r;s==="border-box"&&(u=u+n+i),l=Math.max(u,l);var d=c*o;return s==="border-box"&&(d=d+n+i),l=Math.min(d,l),[l,c]}var oG=function(){},tSe=function(e,r){return e.reduce(function(o,n){return o[n]=r[n],o},{})},rSe=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],oSe=!!document.documentElement.currentStyle,nSe=function(e){var r=window.getComputedStyle(e);if(r===null)return null;var o=tSe(rSe,r),n=o.boxSizing;if(n==="")return null;oSe&&n==="border-box"&&(o.width=parseFloat(o.width)+parseFloat(o.borderRightWidth)+parseFloat(o.borderLeftWidth)+parseFloat(o.paddingRight)+parseFloat(o.paddingLeft)+"px");var i=parseFloat(o.paddingBottom)+parseFloat(o.paddingTop),a=parseFloat(o.borderBottomWidth)+parseFloat(o.borderTopWidth);return{sizingStyle:o,paddingSize:i,borderSize:a}},iSe=function(e){var r=Qj(e);Ft(function(){var o=function(i){r.current(i)};return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}},[])},aSe=function(e,r){var o=e.cacheMeasurements,n=e.maxRows,i=e.minRows,a=e.onChange,s=a===void 0?oG:a,l=e.onHeightChange,c=l===void 0?oG:l,u=jd(e,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),d=u.value!==void 0,f=W(null),m=eG(f,r),h=W(0),g=W(),_=function(){var v=f.current,C=o&&g.current?g.current:nSe(v);if(C){g.current=C;var N=eSe(C,v.value||v.placeholder||"x",i,n),I=N[0],E=N[1];h.current!==I&&(h.current=I,v.style.setProperty("height",I+"px","important"),c(I,{rowHeight:E}))}},b=function(v){d||_(),s(v)};return Ft(_),iSe(_),ce("textarea",pr({},u,{onChange:b,ref:m}))},sSe=ee(aSe),nG=sSe;var lSe=me(t=>({input:{paddingTop:t.spacing.xs,paddingBottom:t.spacing.xs}})),iG=lSe;var cSe=Object.defineProperty,uSe=Object.defineProperties,dSe=Object.getOwnPropertyDescriptors,Gw=Object.getOwnPropertySymbols,sG=Object.prototype.hasOwnProperty,lG=Object.prototype.propertyIsEnumerable,aG=(t,e,r)=>e in t?cSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wm=(t,e)=>{for(var r in e||(e={}))sG.call(e,r)&&aG(t,r,e[r]);if(Gw)for(var r of Gw(e))lG.call(e,r)&&aG(t,r,e[r]);return t},LP=(t,e)=>uSe(t,dSe(e)),fSe=(t,e)=>{var r={};for(var o in t)sG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Gw)for(var o of Gw(t))e.indexOf(o)<0&&lG.call(t,o)&&(r[o]=t[o]);return r},pSe={autosize:!1,size:"sm",__staticSelector:"Textarea"},yr=ee((t,e)=>{let r=Ie("Textarea",pSe,t),{autosize:o,maxRows:n,minRows:i,label:a,error:s,description:l,id:c,className:u,required:d,style:f,wrapperProps:m,classNames:h,styles:g,size:_,__staticSelector:b,sx:y,errorProps:v,descriptionProps:C,labelProps:N}=r,I=fSe(r,["autosize","maxRows","minRows","label","error","description","id","className","required","style","wrapperProps","classNames","styles","size","__staticSelector","sx","errorProps","descriptionProps","labelProps"]),E=lo(c),{classes:w,cx:S}=iG(),{systemStyles:T,rest:A}=so(I),R=wm({required:d,ref:e,invalid:!!s,id:E,classNames:LP(wm({},h),{input:S(w.input,h?.input)}),styles:g,__staticSelector:b,size:_,multiline:!0},A);return D.createElement(kn,wm(wm({label:a,error:s,id:E,description:l,required:d,style:f,className:u,classNames:h,styles:g,size:_,__staticSelector:b,sx:y,errorProps:v,labelProps:N,descriptionProps:C},T),m),o?D.createElement(Sa,LP(wm({},R),{component:nG,maxRows:n,minRows:i})):D.createElement(Sa,LP(wm({},R),{component:"textarea",rows:i})))});yr.displayName="@mantine/core/Textarea";var mSe=Object.defineProperty,hSe=Object.defineProperties,gSe=Object.getOwnPropertyDescriptors,Ww=Object.getOwnPropertySymbols,dG=Object.prototype.hasOwnProperty,fG=Object.prototype.propertyIsEnumerable,cG=(t,e,r)=>e in t?mSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uG=(t,e)=>{for(var r in e||(e={}))dG.call(e,r)&&cG(t,r,e[r]);if(Ww)for(var r of Ww(e))fG.call(e,r)&&cG(t,r,e[r]);return t},_Se=(t,e)=>hSe(t,gSe(e)),xSe=(t,e)=>{var r={};for(var o in t)dG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Ww)for(var o of Ww(t))e.indexOf(o)<0&&fG.call(t,o)&&(r[o]=t[o]);return r},bSe={formatOnBlur:!1,size:"sm"},Zc=ee((t,e)=>{let r=Ie("JsonInput",bSe,t),{value:o,defaultValue:n,onChange:i,onFocus:a,onBlur:s,error:l,formatOnBlur:c,size:u,validationError:d,classNames:f}=r,m=xSe(r,["value","defaultValue","onChange","onFocus","onBlur","error","formatOnBlur","size","validationError","classNames"]),{classes:h,cx:g}=Xj({size:u},{name:"JsonInput"}),[_,b]=Cn({value:o,defaultValue:n,finalValue:"",rule:I=>typeof I=="string",onChange:i}),[y,v]=M(MP(_)),C=I=>{typeof a=="function"&&a(I),v(!0)},N=I=>{typeof s=="function"&&s(I);let E=MP(I.currentTarget.value);c&&E&&I.currentTarget.value.trim()!==""&&b(JSON.stringify(JSON.parse(I.currentTarget.value),null,2)),v(E)};return D.createElement(yr,uG({value:_,onChange:I=>b(I.currentTarget.value),onFocus:C,onBlur:N,error:y?l:d||!0,__staticSelector:"JsonInput",classNames:_Se(uG({},f),{input:g(h.input,f?.input)}),autoComplete:"nope",ref:e},m))});Zc.displayName="@mantine/core/JsonInput";X();var ySe=me({root:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}}),pG=ySe;var vSe=Object.defineProperty,ISe=Object.defineProperties,wSe=Object.getOwnPropertyDescriptors,Kw=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,gG=Object.prototype.propertyIsEnumerable,mG=(t,e,r)=>e in t?vSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qw=(t,e)=>{for(var r in e||(e={}))hG.call(e,r)&&mG(t,r,e[r]);if(Kw)for(var r of Kw(e))gG.call(e,r)&&mG(t,r,e[r]);return t},ESe=(t,e)=>ISe(t,wSe(e)),SSe=(t,e)=>{var r={};for(var o in t)hG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Kw)for(var o of Kw(t))e.indexOf(o)<0&&gG.call(t,o)&&(r[o]=t[o]);return r},CSe={overlayOpacity:.75,transitionDuration:200,zIndex:Ar("overlay")},ka=ee((t,e)=>{let r=Ie("LoadingOverlay",CSe,t),{className:o,visible:n,loaderProps:i,overlayOpacity:a,overlayColor:s,transitionDuration:l,exitTransitionDuration:c,zIndex:u,style:d,loader:f,radius:m,classNames:h,styles:g}=r,_=SSe(r,["className","visible","loaderProps","overlayOpacity","overlayColor","transitionDuration","exitTransitionDuration","zIndex","style","loader","radius","classNames","styles"]),{classes:b,cx:y,theme:v}=pG(null,{name:"LoadingOverlay",classNames:h,styles:g});return D.createElement(G_,{duration:l,exitDuration:c,mounted:n,transition:"fade"},C=>D.createElement(_e,qw({className:y(b.root,o),style:ESe(qw(qw({},C),d),{zIndex:u}),ref:e},_),f?D.createElement("div",{style:{zIndex:u+1}},f):D.createElement(Ze,qw({style:{zIndex:u+1}},i)),D.createElement(tx,{opacity:a,zIndex:u,radius:m,color:s||(v.colorScheme==="dark"?v.colors.dark[5]:v.white)})))});ka.displayName="@mantine/core/LoadingOverlay";X();X();var TSe=Object.defineProperty,_G=Object.getOwnPropertySymbols,kSe=Object.prototype.hasOwnProperty,NSe=Object.prototype.propertyIsEnumerable,xG=(t,e,r)=>e in t?TSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PSe=(t,e)=>{for(var r in e||(e={}))kSe.call(e,r)&&xG(t,r,e[r]);if(_G)for(var r of _G(e))NSe.call(e,r)&&xG(t,r,e[r]);return t};function bG(t){return D.createElement("svg",PSe({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),D.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}X();var[yG,Yw]=bV(null);var OSe=Object.defineProperty,ASe=Object.defineProperties,DSe=Object.getOwnPropertyDescriptors,vG=Object.getOwnPropertySymbols,RSe=Object.prototype.hasOwnProperty,MSe=Object.prototype.propertyIsEnumerable,IG=(t,e,r)=>e in t?OSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,LSe=(t,e)=>{for(var r in e||(e={}))RSe.call(e,r)&&IG(t,r,e[r]);if(vG)for(var r of vG(e))MSe.call(e,r)&&IG(t,r,e[r]);return t},FSe=(t,e)=>ASe(t,DSe(e)),BSe=me((t,{radius:e,color:r})=>({item:FSe(LSe({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:t.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",display:"inline-block",textDecoration:"none",boxSizing:"border-box",padding:`${t.spacing.xs}px ${t.spacing.sm}px`,cursor:"pointer",borderRadius:t.fn.size({size:e,sizes:t.radius}),color:r?t.fn.themeColor(r,t.colorScheme==="dark"?5:7):t.colorScheme==="dark"?t.colors.dark[0]:t.black,"&:disabled":{color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5],pointerEvents:"none"}}),itemHovered:{backgroundColor:r?t.fn.variant({variant:"light",color:r}).background:t.colorScheme==="dark"?t.fn.rgba(t.colors.dark[3],.35):t.colors.gray[0]},itemInner:{display:"flex",alignItems:"center",height:"100%"},itemBody:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},itemIcon:{marginRight:t.spacing.xs,"& *":{display:"block"}},itemLabel:{lineHeight:1}})),wG=BSe;var $Se=Object.defineProperty,Xw=Object.getOwnPropertySymbols,SG=Object.prototype.hasOwnProperty,CG=Object.prototype.propertyIsEnumerable,EG=(t,e,r)=>e in t?$Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zSe=(t,e)=>{for(var r in e||(e={}))SG.call(e,r)&&EG(t,r,e[r]);if(Xw)for(var r of Xw(e))CG.call(e,r)&&EG(t,r,e[r]);return t},USe=(t,e)=>{var r={};for(var o in t)SG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Xw)for(var o of Xw(t))e.indexOf(o)<0&&CG.call(t,o)&&(r[o]=t[o]);return r},VSe=ee((t,e)=>{var r=t,{className:o,children:n,icon:i,color:a,disabled:s,rightSection:l,component:c,onClick:u}=r,d=USe(r,["className","children","icon","color","disabled","rightSection","component","onClick"]);let f=W(),{hovered:m,onItemHover:h,radius:g,onItemKeyDown:_,classNames:b,styles:y,onItemClick:v}=Yw("Menu.Item"),{classes:C,cx:N}=wG({color:a,radius:g},{classNames:b,styles:y,name:"Menu"}),I=xV({elementSelector:".mantine-Menu-item",parentClassName:"mantine-Menu-body"},f.current);return D.createElement(_e,zSe({component:c||"button",type:"button",role:"menuitem",className:N(C.item,{[C.itemHovered]:m===I},o),onMouseEnter:()=>!s&&h(I),onMouseLeave:()=>h(-1),onKeyDown:_,ref:kd(e,f),disabled:s,onClick:E=>{typeof u=="function"&&u(E),v()}},d),D.createElement("div",{className:C.itemInner},i&&D.createElement("div",{className:C.itemIcon},i),D.createElement("div",{className:C.itemBody},D.createElement("div",{className:C.itemLabel},n),l)))}),FP=VSe;FP.displayName="@mantine/core/MenuItem";X();var HSe=me(t=>({label:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],fontWeight:500,fontSize:t.fontSizes.xs,padding:`${t.spacing.xs/2}px ${t.spacing.sm}px`,cursor:"default"}})),TG=HSe;var jSe=Object.defineProperty,kG=Object.getOwnPropertySymbols,GSe=Object.prototype.hasOwnProperty,WSe=Object.prototype.propertyIsEnumerable,NG=(t,e,r)=>e in t?jSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qSe=(t,e)=>{for(var r in e||(e={}))GSe.call(e,r)&&NG(t,r,e[r]);if(kG)for(var r of kG(e))WSe.call(e,r)&&NG(t,r,e[r]);return t};function BP(t){let{classNames:e,styles:r}=Yw("Menu.Label"),{classes:o}=TG(null,{name:"Menu",classNames:e,styles:r});return D.createElement(Gr,qSe({className:o.label},t))}BP.displayName="@mantine/core/MenuLabel";var KSe={xs:120,sm:160,md:200,lg:240,xl:300},PG=4,YSe=me((t,{size:e})=>({root:{display:"inline-block",position:"relative"},arrow:{borderColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2],background:t.colorScheme==="dark"?t.colors.dark[6]:t.white},body:{width:t.fn.size({size:e,sizes:KSe}),overflow:"hidden",pointerEvents:"all",border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,padding:PG,"& .mantine-Divider-horizontal":{margin:`${t.spacing.xs/2}px -${PG}px`,borderTopColor:t.colorScheme==="dark"?t.colors.dark[7]:t.colors.gray[2]}},label:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],fontWeight:500,fontSize:t.fontSizes.xs,padding:`${t.spacing.xs/2}px ${t.spacing.sm}px`,cursor:"default"}})),OG=YSe;var XSe=Object.defineProperty,JSe=Object.defineProperties,QSe=Object.getOwnPropertyDescriptors,Jw=Object.getOwnPropertySymbols,DG=Object.prototype.hasOwnProperty,RG=Object.prototype.propertyIsEnumerable,AG=(t,e,r)=>e in t?XSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$P=(t,e)=>{for(var r in e||(e={}))DG.call(e,r)&&AG(t,r,e[r]);if(Jw)for(var r of Jw(e))RG.call(e,r)&&AG(t,r,e[r]);return t},ZSe=(t,e)=>JSe(t,QSe(e)),eCe=(t,e)=>{var r={};for(var o in t)DG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Jw)for(var o of Jw(t))e.indexOf(o)<0&&RG.call(t,o)&&(r[o]=t[o]);return r},tCe=D.createElement(Je,null,D.createElement(bG,null));function rCe(t,e){for(let r=t+1;r<e.length;r+=1)if(!e[r].disabled)return r;return t}function oCe(t){for(let e=0;e<t.length;e+=1)if(!t[e].disabled)return e;return-1}function nCe(t,e){for(let r=t-1;r>=0;r-=1)if(!e[r].disabled)return r;return e[t]?t:oCe(e)}var iCe={control:tCe,closeOnItemClick:!0,transitionDuration:150,size:"md",shadow:"md",position:"bottom",placement:"start",gutter:5,withArrow:!1,transition:"pop-top-left",controlRefProp:"ref",trigger:"click",radius:"sm",delay:100,zIndex:Ar("popover"),withinPortal:!0,trapFocus:!0,closeOnScroll:!1,clickOutsideEvents:["mousedown","touchstart"]},je=ee((t,e)=>{let r=Ie("Menu",iCe,t),{control:o,children:n,onClose:i,onOpen:a,opened:s,menuId:l,closeOnItemClick:c,transitionDuration:u,size:d,shadow:f,position:m,placement:h,gutter:g,withArrow:_,transition:b,transitionTimingFunction:y,menuButtonLabel:v,controlRefProp:C,trigger:N,radius:I,delay:E,zIndex:w,withinPortal:S,trapFocus:T,classNames:A,styles:R,closeOnScroll:P,onMouseLeave:B,onMouseEnter:$,onChange:z,className:H,sx:G,clickOutsideEvents:Y}=r,L=eCe(r,["control","children","onClose","onOpen","opened","menuId","closeOnItemClick","transitionDuration","size","shadow","position","placement","gutter","withArrow","transition","transitionTimingFunction","menuButtonLabel","controlRefProp","trigger","radius","delay","zIndex","withinPortal","trapFocus","classNames","styles","closeOnScroll","onMouseLeave","onMouseEnter","onChange","className","sx","clickOutsideEvents"]),[ne,ae]=M(-1),{classes:U,cx:ge}=OG({size:d},{classNames:A,styles:R,name:"Menu"}),Ce=W(),[He,Qe]=M(null),[Me,ke]=M(null),[at,Rt]=M(null),ut=lo(l),ht=()=>window.setTimeout(()=>He?.focus(),0),[bt,Xr]=Cn({value:s,defaultValue:!1,finalValue:!1,rule:j=>typeof j=="boolean",onChange:j=>j?typeof a=="function"&&a():typeof i=="function"&&i()}),Mt=W(bt),ye=()=>{Mt.current&&(Mt.current=!1,Xr(!1))},dn=()=>{Mt.current=!0,Xr(!0)};Ll("scroll",()=>P&&ye()),DN(()=>bt&&ye(),Y,[at,Me]);let Ut=()=>{bt?ye():dn()},pt=N==="click"?{onClick:Ut}:{onMouseEnter:dn,onClick:Ut},Ur=j=>{typeof B=="function"&&B(j),N==="hover"&&(E>0?Ce.current=window.setTimeout(()=>ye(),E):ye())},Vr=j=>{typeof $=="function"&&$(j),window.clearTimeout(Ce.current)},Do=j=>{if(bt){let Q=Array.from(at.querySelectorAll(".mantine-Menu-item"));if(j.nativeEvent.code==="Tab"&&T&&j.preventDefault(),j.nativeEvent.code==="ArrowDown"){j.preventDefault();let se=rCe(ne,Q);ae(se),Q[se].focus()}if(j.nativeEvent.code==="ArrowUp"){j.preventDefault();let se=nCe(ne,Q);ae(se),Q[se].focus()}j.nativeEvent.code==="Escape"&&(ye(),ht())}},Be=Gi(o,ZSe($P({},pt),{onClick:j=>{pt.onClick(),typeof o.props.onClick=="function"&&o.props.onClick(j)},role:"button","aria-haspopup":"menu","aria-expanded":bt,"aria-controls":ut,"aria-label":v,title:v,[C]:Sn(Qe,e),onKeyDown:Do})),ie=()=>{c&&(ye(),N==="click"&&ht())};return D.createElement(yG,{value:{hovered:ne,radius:I,styles:R,classNames:A,onItemHover:ae,onItemKeyDown:Do,onItemClick:ie}},D.createElement(_e,$P({ref:ke,onMouseLeave:Ur,onMouseEnter:Vr,className:ge(U.root,H),sx:G},L),Be,D.createElement(Vl,{referenceElement:He,transitionDuration:u,transitionTimingFunction:y,transition:b,mounted:bt,position:m,placement:h,gutter:g,withArrow:_,arrowSize:3,zIndex:w,arrowClassName:U.arrow,withinPortal:S},D.createElement(Hl,$P({shadow:f,className:U.body,role:"menu","aria-orientation":"vertical",radius:I,onMouseLeave:()=>ae(-1),ref:Rt,id:ut},L),n))))});je.Item=FP;je.Label=BP;je.displayName="@mantine/core/Menu";var aCe={xs:320,sm:380,md:440,lg:620,xl:780,full:"100%"},sCe=me((t,{overflow:e,size:r,centered:o,zIndex:n})=>({close:{},overlay:{},root:{position:"fixed",zIndex:n,top:0,left:0,right:0,bottom:0},inner:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto",padding:`${t.spacing.xl*2}px ${t.spacing.md}px`,display:"flex",justifyContent:"center",alignItems:o?"center":"flex-start"},title:{marginRight:t.spacing.md,textOverflow:"ellipsis",display:"block",wordBreak:"break-word"},modal:{position:"relative",width:t.fn.size({sizes:aCe,size:r}),outline:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[7]:t.white,marginTop:o?"auto":void 0,marginBottom:o?"auto":void 0,zIndex:1,marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:t.spacing.md,marginRight:-9},body:{maxHeight:e==="inside"?"calc(100vh - 185px)":null,overflowY:e==="inside"?"auto":null,wordBreak:"break-word"}})),MG=sCe;X();var lCe=Object.defineProperty,Qw=Object.getOwnPropertySymbols,FG=Object.prototype.hasOwnProperty,BG=Object.prototype.propertyIsEnumerable,LG=(t,e,r)=>e in t?lCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cCe=(t,e)=>{for(var r in e||(e={}))FG.call(e,r)&&LG(t,r,e[r]);if(Qw)for(var r of Qw(e))BG.call(e,r)&&LG(t,r,e[r]);return t},uCe=(t,e)=>{var r={};for(var o in t)FG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Qw)for(var o of Qw(t))e.indexOf(o)<0&&BG.call(t,o)&&(r[o]=t[o]);return r},dCe={size:"md",transitionDuration:250,overflow:"outside",transition:"pop",padding:"lg",shadow:"lg",closeOnClickOutside:!0,closeOnEscape:!0,trapFocus:!0,withCloseButton:!0,withinPortal:!0,overlayBlur:0,zIndex:Ar("modal")};function eu(t){let e=Ie("Modal",dCe,t),{className:r,opened:o,title:n,onClose:i,children:a,withCloseButton:s,overlayOpacity:l,size:c,transitionDuration:u,closeButtonLabel:d,overlayColor:f,overflow:m,transition:h,padding:g,shadow:_,radius:b,id:y,classNames:v,styles:C,closeOnClickOutside:N,trapFocus:I,closeOnEscape:E,centered:w,target:S,withinPortal:T,zIndex:A,overlayBlur:R,transitionTimingFunction:P}=e,B=uCe(e,["className","opened","title","onClose","children","withCloseButton","overlayOpacity","size","transitionDuration","closeButtonLabel","overlayColor","overflow","transition","padding","shadow","radius","id","classNames","styles","closeOnClickOutside","trapFocus","closeOnEscape","centered","target","withinPortal","zIndex","overlayBlur","transitionTimingFunction"]),$=lo(y),z=`${$}-title`,H=`${$}-body`,{classes:G,cx:Y,theme:L}=MG({size:c,overflow:m,centered:w,zIndex:A},{classNames:v,styles:C,name:"Modal"}),ne=FN(I&&o),ae=typeof l=="number"?l:L.colorScheme==="dark"?.85:.75,[,U]=UN(),ge=Ce=>{!I&&Ce.code==="Escape"&&E&&i()};return V(()=>{if(!I)return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[I]),RN({opened:o,transitionDuration:0,shouldReturnFocus:I}),D.createElement(DP,{withinPortal:T,zIndex:A,target:S},D.createElement(RP,{onExited:()=>U(!1),onEntered:()=>U(!0),mounted:o,duration:u,exitDuration:u,timingFunction:P,transitions:{modal:{duration:u,transition:h},overlay:{duration:u/2,transition:"fade",timingFunction:"ease"}}},Ce=>D.createElement(_e,cCe({id:$,className:Y(G.root,r)},B),D.createElement("div",{className:G.inner,onKeyDownCapture:He=>{var Qe;((Qe=He.target)==null?void 0:Qe.getAttribute("data-mantine-stop-propagation"))!=="true"&&He.nativeEvent.code==="Escape"&&E&&i()},ref:ne},D.createElement(Hl,{className:G.modal,shadow:_,p:g,radius:b,role:"dialog","aria-labelledby":z,"aria-describedby":H,"aria-modal":!0,tabIndex:-1,style:Ce.modal},(n||s)&&D.createElement("div",{className:G.header},D.createElement(Gr,{id:z,className:G.title},n),s&&D.createElement(Fl,{iconSize:16,onClick:i,"aria-label":d,className:G.close})),D.createElement("div",{id:H,className:G.body},a)),D.createElement("div",{style:Ce.overlay},D.createElement(tx,{className:G.overlay,sx:{position:"fixed"},zIndex:0,onMouseDown:()=>N&&i(),blur:R,color:f||(L.colorScheme==="dark"?L.colors.dark[9]:L.black),opacity:ae}))))))}eu.displayName="@mantine/core/Modal";X();X();var fCe={xs:16,sm:22,md:26,lg:30,xl:36},pCe={xs:10,sm:12,md:14,lg:16,xl:18},mCe=me((t,{size:e,disabled:r,radius:o})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:r?t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[3]:t.colorScheme==="dark"?t.colors.dark[7]:t.colors.gray[1],color:r?t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7]:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],height:t.fn.size({size:e,sizes:fCe}),paddingLeft:t.fn.size({size:e,sizes:t.spacing}),paddingRight:r?t.fn.size({size:e,sizes:t.spacing}):0,fontWeight:500,fontSize:t.fn.size({size:e,sizes:pCe}),borderRadius:t.fn.size({size:o,sizes:t.radius}),cursor:r?"not-allowed":"default",userSelect:"none",maxWidth:"calc(100% - 20px)"},defaultValueRemove:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],marginLeft:t.fn.size({size:e,sizes:t.spacing})/6},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}})),$G=mCe;var hCe=Object.defineProperty,Zw=Object.getOwnPropertySymbols,VG=Object.prototype.hasOwnProperty,HG=Object.prototype.propertyIsEnumerable,zG=(t,e,r)=>e in t?hCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gCe=(t,e)=>{for(var r in e||(e={}))VG.call(e,r)&&zG(t,r,e[r]);if(Zw)for(var r of Zw(e))HG.call(e,r)&&zG(t,r,e[r]);return t},_Ce=(t,e)=>{var r={};for(var o in t)VG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&Zw)for(var o of Zw(t))e.indexOf(o)<0&&HG.call(t,o)&&(r[o]=t[o]);return r},UG={xs:16,sm:22,md:24,lg:26,xl:30};function zP(t){var e=t,{label:r,classNames:o,styles:n,className:i,onRemove:a,disabled:s,size:l,radius:c}=e,u=_Ce(e,["label","classNames","styles","className","onRemove","disabled","size","radius"]);let{classes:d,cx:f}=$G({size:l,disabled:s,radius:c},{classNames:o,styles:n,name:"MultiSelect"});return D.createElement("div",gCe({className:f(d.defaultValue,i)},u),D.createElement("span",{className:d.defaultValueLabel},r),!s&&D.createElement(Fl,{"aria-hidden":!0,onMouseDown:a,size:UG[l],radius:2,color:"blue",variant:"transparent",iconSize:UG[l]/2,className:d.defaultValueRemove,tabIndex:-1}))}zP.displayName="@mantine/core/MultiSelect/DefaultValue";function jG({data:t,searchable:e,limit:r,searchValue:o,filter:n,value:i}){if(!e&&i.length===0)return t;if(!e){let s=[];for(let l=0;l<t.length;l+=1)i.some(c=>c===t[l].value&&!t[l].disabled)||s.push(t[l]);return s}let a=[];for(let s=0;s<t.length&&(n(o,i.some(l=>l===t[s].value&&!t[s].disabled),t[s])&&a.push(t[s]),!(a.length>=r));s+=1);return a}X();X();X();var xCe=Object.defineProperty,eE=Object.getOwnPropertySymbols,qG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,GG=(t,e,r)=>e in t?xCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WG=(t,e)=>{for(var r in e||(e={}))qG.call(e,r)&&GG(t,r,e[r]);if(eE)for(var r of eE(e))KG.call(e,r)&&GG(t,r,e[r]);return t},bCe=(t,e)=>{var r={};for(var o in t)qG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&eE)for(var o of eE(t))e.indexOf(o)<0&&KG.call(t,o)&&(r[o]=t[o]);return r},yCe={xs:14,sm:18,md:20,lg:24,xl:28};function YG(t){var e=t,{size:r,error:o,style:n}=e,i=bCe(e,["size","error","style"]);let a=dr(),s=a.fn.size({size:r,sizes:yCe});return D.createElement("svg",WG({width:s,height:s,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:WG({color:o?a.colors.red[6]:a.colors.gray[6]},n),"data-chevron":!0},i),D.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function UP({shouldClear:t,clearButtonLabel:e,onClear:r,size:o,error:n,clearButtonTabIndex:i}){return t?D.createElement(Fl,{variant:"transparent","aria-label":e,onClick:r,size:o,tabIndex:i}):D.createElement(YG,{error:n,size:o})}UP.displayName="@mantine/core/SelectRightSection";var vCe=Object.defineProperty,ICe=Object.defineProperties,wCe=Object.getOwnPropertyDescriptors,tE=Object.getOwnPropertySymbols,QG=Object.prototype.hasOwnProperty,ZG=Object.prototype.propertyIsEnumerable,XG=(t,e,r)=>e in t?vCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VP=(t,e)=>{for(var r in e||(e={}))QG.call(e,r)&&XG(t,r,e[r]);if(tE)for(var r of tE(e))ZG.call(e,r)&&XG(t,r,e[r]);return t},JG=(t,e)=>ICe(t,wCe(e)),ECe=(t,e)=>{var r={};for(var o in t)QG.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&tE)for(var o of tE(t))e.indexOf(o)<0&&ZG.call(t,o)&&(r[o]=t[o]);return r},SCe={xs:24,sm:30,md:34,lg:44,xl:54};function rE(t){var e=t,{styles:r,rightSection:o,rightSectionWidth:n,theme:i}=e,a=ECe(e,["styles","rightSection","rightSectionWidth","theme"]);if(o)return{rightSection:o,rightSectionWidth:n,styles:r};let s=typeof r=="function"?r(i):r;return{rightSectionWidth:i.fn.size({size:a.size,sizes:SCe}),rightSection:!(a.disabled&&a.shouldClear)&&D.createElement(UP,VP({},a)),styles:JG(VP({},s),{rightSection:JG(VP({},s?.rightSection),{pointerEvents:a.shouldClear?void 0:"none"})})}}var CCe=me((t,{size:e,invalid:r})=>({wrapper:{position:"relative"},values:{minHeight:t.fn.size({size:e,sizes:si})-2,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:-t.spacing.xs/2,paddingTop:t.spacing.xs/2-2,paddingBottom:t.spacing.xs/2-2,boxSizing:"border-box"},value:{margin:`${t.spacing.xs/2-2}px ${t.spacing.xs/2}px`},searchInput:{flex:1,minWidth:60,backgroundColor:"transparent",border:0,outline:0,fontSize:t.fn.size({size:e,sizes:t.fontSizes}),padding:0,margin:t.spacing.xs/2,appearance:"none",color:"inherit","&::placeholder":{color:r?t.colors.red[t.colorScheme==="dark"?6:7]:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]},"&:disabled":{cursor:"not-allowed"}},searchInputEmpty:{width:"100%"},searchInputInputHidden:{width:0,height:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed"}}})),eW=CCe;var TCe=Object.defineProperty,kCe=Object.defineProperties,NCe=Object.getOwnPropertyDescriptors,oE=Object.getOwnPropertySymbols,oW=Object.prototype.hasOwnProperty,nW=Object.prototype.propertyIsEnumerable,tW=(t,e,r)=>e in t?TCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Em=(t,e)=>{for(var r in e||(e={}))oW.call(e,r)&&tW(t,r,e[r]);if(oE)for(var r of oE(e))nW.call(e,r)&&tW(t,r,e[r]);return t},rW=(t,e)=>kCe(t,NCe(e)),PCe=(t,e)=>{var r={};for(var o in t)oW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&oE)for(var o of oE(t))e.indexOf(o)<0&&nW.call(t,o)&&(r[o]=t[o]);return r};function OCe(t,e,r){return e?!1:r.label.toLowerCase().trim().includes(t.toLowerCase().trim())}function ACe(t,e){return!!t&&!e.some(r=>r.value.toLowerCase()===t.toLowerCase())}var DCe={size:"sm",valueComponent:zP,itemComponent:K_,transition:"pop-top-left",transitionDuration:0,maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:OCe,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:ACe,switchDirectionOnFlip:!1,zIndex:Ar("popover"),selectOnBlur:!1,clearButtonTabIndex:0,positionDependencies:[]},nE=ee((t,e)=>{let r=Ie("MultiSelect",DCe,t),{className:o,style:n,required:i,label:a,description:s,size:l,error:c,classNames:u,styles:d,wrapperProps:f,value:m,defaultValue:h,data:g,onChange:_,valueComponent:b,itemComponent:y,id:v,transition:C,transitionDuration:N,transitionTimingFunction:I,maxDropdownHeight:E,shadow:w,nothingFound:S,onFocus:T,onBlur:A,searchable:R,placeholder:P,filter:B,limit:$,clearSearchOnChange:z,clearable:H,clearSearchOnBlur:G,clearButtonLabel:Y,variant:L,onSearchChange:ne,disabled:ae,initiallyOpened:U,radius:ge,icon:Ce,rightSection:He,rightSectionWidth:Qe,creatable:Me,getCreateLabel:ke,shouldCreate:at,onCreate:Rt,sx:ut,dropdownComponent:ht,onDropdownClose:bt,onDropdownOpen:Xr,maxSelectedValues:Mt,withinPortal:ye,switchDirectionOnFlip:dn,zIndex:Ut,selectOnBlur:pt,name:Ur,dropdownPosition:Vr,errorProps:Do,labelProps:Be,descriptionProps:ie,clearButtonTabIndex:j,form:Q,positionDependencies:se,onKeyDown:Ve}=r,yt=PCe(r,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transition","transitionDuration","transitionTimingFunction","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","clearButtonLabel","variant","onSearchChange","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","clearButtonTabIndex","form","positionDependencies","onKeyDown"]),{classes:Nt,cx:Mn,theme:_r}=eW({size:l,invalid:!!c},{classNames:u,styles:d,name:"MultiSelect"}),{systemStyles:Nr,rest:Xn}=so(yt),io=W(),fn=W(),pn=W(),Sl=W({}),mn=lo(v),[fr,Ui]=M(U),[Ln,bi]=M(-1),[ha,hn]=M("column"),[gn,Rc]=M(""),[Cl,As]=M(!1),{scrollIntoView:Xt,targetRef:Ds,scrollableRef:Rs}=M_({duration:0,offset:5,cancelable:!1,isList:!0}),jo=Me&&typeof ke=="function",Vi=null,Ro=we=>{Ui(we);let It=we?Xr:bt;typeof It=="function"&&It()},Mo=we=>{typeof ne=="function"&&ne(we),Rc(we)},r_=g.map(we=>typeof we=="string"?{label:we,value:we}:we),Ms=OI({data:r_}),[vt,Za]=Cn({value:m,defaultValue:h,finalValue:[],rule:we=>Array.isArray(we),onChange:_}),Lo=W(!!Mt&&Mt<vt.length),Ls=we=>{let It=vt.filter(_n=>_n!==we);Za(It),Mt&&It.length<Mt&&(Lo.current=!1)},Hi=we=>{Mo(we.currentTarget.value),Ro(!0)},Fs=we=>{typeof T=="function"&&T(we)},Hr=jG({data:Ms,searchable:R,searchValue:gn,limit:$,filter:B,value:vt}),Tl=(we,It,_n)=>{let ga=we;for(;_n(ga);)if(ga=It(ga),!Hr[ga].disabled)return ga;return we};mr(()=>{bi(Tl(-1,we=>we+1,we=>we<Hr.length-1))},[gn]),mr(()=>{!ae&&vt.length>=g.length&&Ro(!1),Mt&&vt.length<Mt&&(Lo.current=!1),Mt&&vt.length>=Mt&&(Lo.current=!0,Ro(!1))},[vt]);let Bs=we=>{z&&Mo(""),vt.includes(we.value)?Ls(we.value):(Za([...vt,we.value]),vt.length===Mt-1&&(Lo.current=!0,Ro(!1)),Ln===Hr.length-1&&bi(Hr.length-2)),we.creatable&&typeof Rt=="function"&&Rt(we.value)},Ap=we=>{typeof A=="function"&&A(we),pt&&Hr[Ln]&&fr&&Bs(Hr[Ln]),G&&Mo(""),Ro(!1)},Dp=we=>{if(Cl||(Ve?.(we),we.nativeEvent.code!=="Backspace"&&Mt&&Lo.current))return;let It=ha==="column",_n=()=>{bi(Nl=>{var _a;let Mc=Tl(Nl,$s=>$s+1,$s=>$s<Hr.length-1);return fr&&(Ds.current=Sl.current[(_a=Hr[Mc])==null?void 0:_a.value],Xt({alignment:It?"end":"start"})),Mc})},ga=()=>{bi(Nl=>{var _a;let Mc=Tl(Nl,$s=>$s-1,$s=>$s>0);return fr&&(Ds.current=Sl.current[(_a=Hr[Mc])==null?void 0:_a.value],Xt({alignment:It?"start":"end"})),Mc})};switch(we.nativeEvent.code){case"ArrowUp":{we.preventDefault(),Ro(!0),It?ga():_n();break}case"ArrowDown":{we.preventDefault(),Ro(!0),It?_n():ga();break}case"Enter":{we.preventDefault(),Hr[Ln]&&fr?Bs(Hr[Ln]):Ro(!0);break}case"Space":{R||(we.preventDefault(),Hr[Ln]&&fr?Bs(Hr[Ln]):Ro(!0));break}case"Backspace":{vt.length>0&&gn.length===0&&(Za(vt.slice(0,-1)),Ro(!0),Mt&&(Lo.current=!1));break}case"Home":{if(!R){we.preventDefault(),fr||Ro(!0);let Nl=Hr.findIndex(_a=>!_a.disabled);bi(Nl),Xt({alignment:It?"end":"start"})}break}case"End":{if(!R){we.preventDefault(),fr||Ro(!0);let Nl=Hr.map(_a=>!!_a.disabled).lastIndexOf(!1);bi(Nl),Xt({alignment:It?"end":"start"})}break}case"Escape":Ro(!1)}},kl=vt.map(we=>{let It=Ms.find(_n=>_n.value===we&&!_n.disabled);return!It&&jo&&(It={value:we,label:we}),It}).filter(we=>!!we).map(we=>D.createElement(b,rW(Em({},we),{disabled:ae,className:Nt.value,onRemove:It=>{fr&&(It.preventDefault(),It.stopPropagation()),Ls(we.value),Ro(!0)},key:we.value,size:l,styles:d,classNames:u,radius:ge}))),Ee=()=>{var we;Mo(""),Za([]),(we=fn.current)==null||we.focus(),Mt&&(Lo.current=!1)};jo&&at(gn,Ms)&&(Vi=ke(gn),Hr.push({label:gn,value:gn,creatable:!0}));let Pr=Hr.length>0?fr:fr&&!!S;return D.createElement(kn,Em(Em({required:i,id:mn,label:a,error:c,description:s,size:l,className:o,style:n,classNames:u,styles:d,__staticSelector:"MultiSelect",sx:ut,errorProps:Do,descriptionProps:ie,labelProps:Be},Nr),f),D.createElement("div",{className:Nt.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":fr&&Pr?`${mn}-items`:null,"aria-controls":mn,"aria-expanded":fr,onMouseLeave:()=>bi(-1),tabIndex:-1,ref:pn},D.createElement("input",{type:"hidden",name:Ur,value:vt.join(","),form:Q}),D.createElement(Sa,Em({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:l,variant:L,disabled:ae,invalid:!!c,required:i,radius:ge,icon:Ce,onMouseDown:we=>{var It;we.preventDefault(),!ae&&!Lo.current&&Ro(!fr),(It=fn.current)==null||It.focus()},classNames:rW(Em({},u),{input:Mn({[Nt.input]:!R},u?.input)})},rE({theme:_r,rightSection:He,rightSectionWidth:Qe,styles:d,size:l,shouldClear:H&&vt.length>0,clearButtonLabel:Y,onClear:Ee,error:c,disabled:ae,clearButtonTabIndex:j})),D.createElement("div",{className:Nt.values},kl,D.createElement("input",Em({ref:Sn(e,fn),type:"search",autoComplete:"off",id:mn,className:Mn(Nt.searchInput,{[Nt.searchInputPointer]:!R,[Nt.searchInputInputHidden]:!fr&&vt.length>0||!R&&vt.length>0,[Nt.searchInputEmpty]:vt.length===0}),onKeyDown:Dp,value:gn,onChange:Hi,onFocus:Fs,onCompositionStart:()=>As(!0),onCompositionEnd:()=>As(!1),onBlur:Ap,readOnly:!R||Lo.current,placeholder:vt.length===0?P:void 0,disabled:ae,"data-mantine-stop-propagation":fr},Xn)))),D.createElement(W_,{mounted:fr&&Pr,transition:C,transitionDuration:N,transitionTimingFunction:I,uuid:mn,shadow:w,maxDropdownHeight:E,classNames:u,styles:d,ref:Sn(io,Rs),__staticSelector:"MultiSelect",dropdownComponent:ht||Ad,referenceElement:pn.current,direction:ha,onDirectionChange:hn,switchDirectionOnFlip:dn,withinPortal:ye,zIndex:Ut,dropdownPosition:Vr,positionDependencies:se},D.createElement(q_,{data:Hr,hovered:Ln,classNames:u,styles:d,uuid:mn,__staticSelector:"MultiSelect",onItemHover:bi,onItemSelect:Bs,itemsRefs:Sl,itemComponent:y,size:l,nothingFound:S,creatable:Me&&!!Vi,createLabel:Vi}))))});nE.displayName="@mantine/core/MultiSelect";X();var RCe=me((t,{color:e,radius:r},o)=>{let n=t.fn.radius(r),i=Math.min(Math.max(n/1.2,4),30),a=t.fn.variant({variant:"filled",color:e});return{closeButton:{},icon:{ref:o("icon"),boxSizing:"border-box",marginRight:t.spacing.md,width:28,height:28,borderRadius:28,display:"flex",flex:"none",alignItems:"center",justifyContent:"center",color:t.white},withIcon:{paddingLeft:t.spacing.xs,"&::before":{display:"none"}},root:{boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",paddingLeft:22,paddingRight:5,paddingTop:t.spacing.xs,paddingBottom:t.spacing.xs,borderRadius:n,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,boxShadow:t.shadows.lg,border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[2]}`,"&::before":{content:"''",display:"block",position:"absolute",width:6,top:i,bottom:i,left:4,borderRadius:n,backgroundColor:a.background},[`& .${o("icon")}`]:{backgroundColor:a.background,color:t.white}},body:{flex:1,overflow:"hidden",marginRight:10},loader:{marginRight:t.spacing.md},title:{lineHeight:1.4,marginBottom:2,overflow:"hidden",textOverflow:"ellipsis",color:t.colorScheme==="dark"?t.white:t.colors.gray[9]},description:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6],lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis","&:only-child":{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black}}}}),iW=RCe;var MCe=Object.defineProperty,LCe=Object.defineProperties,FCe=Object.getOwnPropertyDescriptors,iE=Object.getOwnPropertySymbols,lW=Object.prototype.hasOwnProperty,cW=Object.prototype.propertyIsEnumerable,aW=(t,e,r)=>e in t?MCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sW=(t,e)=>{for(var r in e||(e={}))lW.call(e,r)&&aW(t,r,e[r]);if(iE)for(var r of iE(e))cW.call(e,r)&&aW(t,r,e[r]);return t},BCe=(t,e)=>LCe(t,FCe(e)),$Ce=(t,e)=>{var r={};for(var o in t)lW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&iE)for(var o of iE(t))e.indexOf(o)<0&&cW.call(t,o)&&(r[o]=t[o]);return r},aE=ee((t,e)=>{let r=Ie("Notification",{},t),{className:o,color:n,radius:i,loading:a,disallowClose:s,title:l,icon:c,children:u,onClose:d,closeButtonProps:f,classNames:m,styles:h}=r,g=$Ce(r,["className","color","radius","loading","disallowClose","title","icon","children","onClose","closeButtonProps","classNames","styles"]),{classes:_,cx:b}=iW({color:n,radius:i},{classNames:m,styles:h,name:"Notification"}),y=c||a;return D.createElement(_e,sW({className:b(_.root,{[_.withIcon]:y},o),role:"alert",ref:e},g),c&&!a&&D.createElement("div",{className:_.icon},c),a&&D.createElement(Ze,{size:28,color:n,className:_.loader}),D.createElement("div",{className:_.body},l&&D.createElement(Gr,{className:_.title,size:"sm",weight:500},l),D.createElement(Gr,{color:"dimmed",className:_.description,size:"sm"},u)),!s&&D.createElement(Fl,BCe(sW({},f),{iconSize:16,color:"gray",onClick:d,variant:"hover",className:_.closeButton})))});aE.displayName="@mantine/core/Notification";X();X();var zCe=Object.defineProperty,UCe=Object.defineProperties,VCe=Object.getOwnPropertyDescriptors,sE=Object.getOwnPropertySymbols,dW=Object.prototype.hasOwnProperty,fW=Object.prototype.propertyIsEnumerable,uW=(t,e,r)=>e in t?zCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HP=(t,e)=>{for(var r in e||(e={}))dW.call(e,r)&&uW(t,r,e[r]);if(sE)for(var r of sE(e))fW.call(e,r)&&uW(t,r,e[r]);return t},HCe=(t,e)=>UCe(t,VCe(e)),jCe=(t,e)=>{var r={};for(var o in t)dW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&sE)for(var o of sE(t))e.indexOf(o)<0&&fW.call(t,o)&&(r[o]=t[o]);return r},GCe={type:"text",size:"sm",__staticSelector:"TextInput"},ir=ee((t,e)=>{let r=Ie("TextInput",GCe,t),{className:o,id:n,label:i,error:a,required:s,type:l,style:c,icon:u,description:d,wrapperProps:f,size:m,classNames:h,styles:g,errorProps:_,labelProps:b,descriptionProps:y,__staticSelector:v,sx:C}=r,N=jCe(r,["className","id","label","error","required","type","style","icon","description","wrapperProps","size","classNames","styles","errorProps","labelProps","descriptionProps","__staticSelector","sx"]),I=lo(n),{systemStyles:E,rest:w}=so(N);return D.createElement(kn,HP(HP({required:s,id:I,label:i,error:a,description:d,size:m,className:o,style:c,classNames:h,styles:g,__staticSelector:v,sx:C,errorProps:_,labelProps:b,descriptionProps:y},E),f),D.createElement(Sa,HCe(HP({},w),{required:s,ref:e,id:I,type:l,invalid:!!a,icon:u,size:m,classNames:h,styles:g,__staticSelector:v})))});ir.displayName="@mantine/core/TextInput";var jP={xs:20,sm:24,md:30,lg:34,xl:36},WCe=me((t,{radius:e,size:r})=>({rightSection:{display:"flex",flexDirection:"column",height:"calc(100% - 2px)",margin:1,marginRight:1},control:{margin:0,position:"relative",flex:"0 0 50%",boxSizing:"border-box",width:t.fn.size({size:r,sizes:jP}),padding:0,WebkitTapHighlightColor:"transparent",borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,borderLeft:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[4]}`,borderTop:0,borderRight:0,backgroundColor:"transparent",marginRight:1,"&:not(:disabled):hover":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},"&::after":{position:"absolute",top:"calc(50% - 2.5px)",left:"calc(50% - 4.5px)",content:'""',display:"block",width:0,height:0,borderStyle:"solid"}},controlUp:{borderTopRightRadius:t.fn.size({size:e,sizes:t.radius})-1,"&::after":{borderWidth:"0 5px 5px 5px",borderColor:`transparent transparent ${t.colorScheme==="dark"?t.colors.dark[0]:t.black} transparent`},"&:disabled::after":{borderBottomColor:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]}},controlDown:{borderBottomRightRadius:t.fn.size({size:e,sizes:t.radius})-1,borderBottom:0,"&::after":{borderWidth:"5px 5px 0 5px",borderColor:`${t.colorScheme==="dark"?t.colors.dark[0]:t.black} transparent transparent transparent`},"&:disabled::after":{borderTopColor:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[5]}}})),pW=WCe;var qCe=Object.defineProperty,KCe=Object.defineProperties,YCe=Object.getOwnPropertyDescriptors,lE=Object.getOwnPropertySymbols,hW=Object.prototype.hasOwnProperty,gW=Object.prototype.propertyIsEnumerable,mW=(t,e,r)=>e in t?qCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,XCe=(t,e)=>{for(var r in e||(e={}))hW.call(e,r)&&mW(t,r,e[r]);if(lE)for(var r of lE(e))gW.call(e,r)&&mW(t,r,e[r]);return t},JCe=(t,e)=>KCe(t,YCe(e)),QCe=(t,e)=>{var r={};for(var o in t)hW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&lE)for(var o of lE(t))e.indexOf(o)<0&&gW.call(t,o)&&(r[o]=t[o]);return r},ZCe=t=>t||"",eTe=t=>{if(t==="-")return t;let e=t;e[0]==="."&&(e=`0${t}`);let r=parseFloat(e);if(!Number.isNaN(r))return t},tTe={step:1,hideControls:!1,size:"sm",precision:0,noClampOnBlur:!1,formatter:ZCe,parser:eTe},cE=ee((t,e)=>{let r=Ie("NumberInput",tTe,t),{disabled:o,value:n,onChange:i,decimalSeparator:a,min:s,max:l,step:c,stepHoldInterval:u,stepHoldDelay:d,onBlur:f,onFocus:m,hideControls:h,radius:g,variant:_,precision:b,defaultValue:y,noClampOnBlur:v,handlersRef:C,classNames:N,styles:I,size:E,rightSection:w,rightSectionWidth:S,formatter:T,parser:A}=r,R=QCe(r,["disabled","value","onChange","decimalSeparator","min","max","step","stepHoldInterval","stepHoldDelay","onBlur","onFocus","hideControls","radius","variant","precision","defaultValue","noClampOnBlur","handlersRef","classNames","styles","size","rightSection","rightSectionWidth","formatter","parser"]),{classes:P,cx:B,theme:$}=pW({radius:g,size:E},{classNames:N,styles:I,name:"NumberInput"}),[z,H]=M(!1),[G,Y]=M(typeof n=="number"?n:typeof y=="number"?y:void 0),L=typeof n=="number"?n:G,[ne,ae]=M(typeof L=="number"?L.toFixed(b):""),U=W(),ge=Be=>{typeof i=="function"&&i(Be),Y(Be)},Ce=(Be="")=>{let ie=typeof Be=="number"?String(Be):Be;return a&&(ie=ie.replace(/\./g,a)),T(ie)},He=Be=>{let ie=Be;return a&&(ie=ie.replace(new RegExp(`\\${a}`,"g"),".")),A(ie)},Qe=typeof s=="number"?s:-1/0,Me=typeof l=="number"?l:1/0,ke=W();ke.current=()=>{var Be;if(G===void 0)ge(s??0),ae((Be=s?.toFixed(b))!=null?Be:"0");else{let ie=ya({value:G+c,min:Qe,max:Me}).toFixed(b);ge(parseFloat(ie)),ae(ie)}};let at=W();at.current=()=>{var Be;if(G===void 0)ge(s??0),ae((Be=s?.toFixed(b))!=null?Be:"0");else{let ie=ya({value:G-c,min:Qe,max:Me}).toFixed(b);ge(parseFloat(ie)),ae(ie)}},fm(C,{increment:ke.current,decrement:at.current}),V(()=>{typeof n=="number"&&!z&&(Y(n),ae(n.toFixed(b))),y===void 0&&n===void 0&&!z&&(Y(n),ae(""))},[n]);let Rt=d!==void 0&&u!==void 0,ut=W(null),ht=W(0),bt=()=>{ut.current&&window.clearTimeout(ut.current),ut.current=null,ht.current=0},Xr=Be=>{Be?ke.current():at.current(),ht.current+=1},Mt=Be=>{if(Xr(Be),Rt){let ie=typeof u=="number"?u:u(ht.current);ut.current=window.setTimeout(()=>Mt(Be),ie)}},ye=(Be,ie)=>{Be.preventDefault(),U.current.focus(),Xr(ie),Rt&&(ut.current=window.setTimeout(()=>Mt(ie),d))};V(()=>(bt(),bt),[]);let dn=D.createElement("div",{className:P.rightSection},D.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,disabled:L>=l,className:B(P.control,P.controlUp),onMouseDown:Be=>{ye(Be,!0)},onMouseUp:bt,onMouseLeave:bt}),D.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,disabled:L<=s,className:B(P.control,P.controlDown),onMouseDown:Be=>{ye(Be,!1)},onMouseUp:bt,onMouseLeave:bt})),Ut=Be=>{let ie=Be.target.value,j=He(ie);ae(j),ie===""||ie==="-"?ge(void 0):ie.trim()!==""&&!Number.isNaN(j)&&ge(parseFloat(j))},pt=Be=>{var ie;if(Be.target.value==="")ae(""),ge(void 0);else{let j=Be.target.value;(j[0]===`${a}`||j[0]===".")&&(j=`0${j}`);let Q=He(j),se=ya({value:parseFloat(Q),min:Qe,max:Me});Number.isNaN(se)?ae((ie=L?.toFixed(b))!=null?ie:""):v||(ae(se.toFixed(b)),ge(parseFloat(se.toFixed(b))))}H(!1),typeof f=="function"&&f(Be)},Ur=Be=>{H(!0),typeof m=="function"&&m(Be)},Vr=Be=>{if(Be.repeat&&Rt&&(Be.key==="ArrowUp"||Be.key==="ArrowDown")){Be.preventDefault();return}Be.key==="ArrowUp"?ye(Be,!0):Be.key==="ArrowDown"&&ye(Be,!1)},Do=Be=>{(Be.key==="ArrowUp"||Be.key==="ArrowDown")&&bt()};return D.createElement(ir,JCe(XCe({},R),{variant:_,value:Ce(ne),disabled:o,ref:Sn(U,e),type:"text",onChange:Ut,onBlur:pt,onFocus:Ur,onKeyDown:Vr,onKeyUp:Do,rightSection:w||(o||h||_==="unstyled"?null:dn),rightSectionWidth:S||$.fn.size({size:E,sizes:jP})+1,radius:g,max:l,min:s,step:c,size:E,styles:I,classNames:N,inputMode:yV(c,b,HN()),__staticSelector:"NumberInput"}))});cE.displayName="@mantine/core/NumberInput";X();function _W({data:t,searchable:e,limit:r,searchValue:o,filter:n,value:i,filterDataOnExactSearchMatch:a}){if(!e)return t;let s=i!=null&&t.find(c=>c.value===i)||null;if(s&&!a&&s?.label===o)return t;let l=[];for(let c=0;c<t.length&&(n(o,t[c])&&l.push(t[c]),!(l.length>=r));c+=1);return l}var rTe=me(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}})),xW=rTe;var oTe=Object.defineProperty,nTe=Object.defineProperties,iTe=Object.getOwnPropertyDescriptors,uE=Object.getOwnPropertySymbols,vW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,bW=(t,e,r)=>e in t?oTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rx=(t,e)=>{for(var r in e||(e={}))vW.call(e,r)&&bW(t,r,e[r]);if(uE)for(var r of uE(e))IW.call(e,r)&&bW(t,r,e[r]);return t},yW=(t,e)=>nTe(t,iTe(e)),aTe=(t,e)=>{var r={};for(var o in t)vW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&uE)for(var o of uE(t))e.indexOf(o)<0&&IW.call(t,o)&&(r[o]=t[o]);return r};function sTe(t,e){return e.label.toLowerCase().trim().includes(t.toLowerCase().trim())}function lTe(t,e){return!!t&&!e.some(r=>r.label.toLowerCase()===t.toLowerCase())}var cTe={required:!1,size:"sm",shadow:"sm",itemComponent:K_,transition:"fade",transitionDuration:0,initiallyOpened:!1,filter:sTe,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:lTe,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ar("popover"),clearButtonTabIndex:0,positionDependencies:[]},Er=ee((t,e)=>{let r=Ie("Select",cTe,t),{className:o,style:n,required:i,label:a,id:s,error:l,description:c,size:u,shadow:d,data:f,value:m,defaultValue:h,onChange:g,itemComponent:_,onKeyDown:b,onBlur:y,onFocus:v,transition:C,transitionDuration:N,initiallyOpened:I,transitionTimingFunction:E,wrapperProps:w,classNames:S,styles:T,filter:A,maxDropdownHeight:R,searchable:P,clearable:B,nothingFound:$,clearButtonLabel:z,limit:H,disabled:G,onSearchChange:Y,rightSection:L,rightSectionWidth:ne,creatable:ae,getCreateLabel:U,shouldCreate:ge,selectOnBlur:Ce,onCreate:He,sx:Qe,dropdownComponent:Me,onDropdownClose:ke,onDropdownOpen:at,withinPortal:Rt,switchDirectionOnFlip:ut,zIndex:ht,name:bt,dropdownPosition:Xr,allowDeselect:Mt,errorProps:ye,descriptionProps:dn,labelProps:Ut,placeholder:pt,filterDataOnExactSearchMatch:Ur,clearButtonTabIndex:Vr,form:Do,positionDependencies:Be}=r,ie=aTe(r,["className","style","required","label","id","error","description","size","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transition","transitionDuration","initiallyOpened","transitionTimingFunction","wrapperProps","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","clearButtonLabel","limit","disabled","onSearchChange","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","errorProps","descriptionProps","labelProps","placeholder","filterDataOnExactSearchMatch","clearButtonTabIndex","form","positionDependencies"]),{classes:j,cx:Q,theme:se}=xW(),{systemStyles:Ve,rest:yt}=so(ie),[Nt,Mn]=M(I),[_r,Nr]=M(-1),Xn=W(),io=W(),fn=W({}),[pn,Sl]=M("column"),mn=pn==="column",fr=lo(s),{scrollIntoView:Ui,targetRef:Ln,scrollableRef:bi}=M_({duration:0,offset:5,cancelable:!1,isList:!0}),ha=Mt===void 0?B:Mt,hn=Ee=>{if(Nt!==Ee){Mn(Ee);let Pr=Ee?at:ke;typeof Pr=="function"&&Pr()}},gn=ae&&typeof U=="function",Rc=null,Cl=f.map(Ee=>typeof Ee=="string"?{label:Ee,value:Ee}:Ee),As=OI({data:Cl}),[Xt,Ds,Rs]=Cn({value:m,defaultValue:h,finalValue:null,onChange:g,rule:Ee=>typeof Ee=="string"||Ee===null}),jo=As.find(Ee=>Ee.value===Xt),[Vi,Ro]=M(jo?.label||""),Mo=Ee=>{Ro(Ee),P&&typeof Y=="function"&&Y(Ee)},r_=()=>{var Ee;Ds(null),Rs==="uncontrolled"&&Mo(""),(Ee=Xn.current)==null||Ee.focus()};V(()=>{let Ee=As.find(Pr=>Pr.value===Xt);Ee?Mo(Ee.label):(!gn||!Xt)&&Mo("")},[Xt]),V(()=>{jo&&(!P||!Nt)&&Mo(jo.label)},[jo?.label]);let Ms=Ee=>{ha&&jo?.value===Ee.value?(Ds(null),hn(!1)):(Ds(Ee.value),Ee.creatable&&typeof He=="function"&&He(Ee.value),Rs==="uncontrolled"&&Mo(Ee.label),Nr(-1),hn(!1),Xn.current.focus())},vt=_W({data:As,searchable:P,limit:H,searchValue:Vi,filter:A,filterDataOnExactSearchMatch:Ur,value:Xt});gn&&ge(Vi,vt)&&(Rc=U(Vi),vt.push({label:Vi,value:Vi,creatable:!0}));let Za=(Ee,Pr,we)=>{let It=Ee;for(;we(It);)if(It=Pr(It),!vt[It].disabled)return It;return Ee};mr(()=>{Nr(Za(-1,Ee=>Ee+1,Ee=>Ee<vt.length-1))},[Vi]);let Lo=Xt?vt.findIndex(Ee=>Ee.value===Xt):0,Ls=()=>{Nr(Ee=>{var Pr;let we=Za(Ee,It=>It-1,It=>It>0);return Ln.current=fn.current[(Pr=vt[we])==null?void 0:Pr.value],Ui({alignment:mn?"start":"end"}),we})},Hi=()=>{Nr(Ee=>{var Pr;let we=Za(Ee,It=>It+1,It=>It<vt.length-1);return Ln.current=fn.current[(Pr=vt[we])==null?void 0:Pr.value],Ui({alignment:mn?"end":"start"}),we})},Fs=()=>window.setTimeout(()=>{var Ee;Ln.current=fn.current[(Ee=vt[Lo])==null?void 0:Ee.value],Ui({alignment:mn?"end":"start"})},0),Hr=Ee=>{switch(typeof b=="function"&&b(Ee),Ee.nativeEvent.code){case"ArrowUp":{Ee.preventDefault(),Nt?mn?Ls():Hi():(Nr(Lo),hn(!0),Fs());break}case"ArrowDown":{Ee.preventDefault(),Nt?mn?Hi():Ls():(Nr(Lo),hn(!0),Fs());break}case"Home":{if(!P){Ee.preventDefault(),Nt||hn(!0);let Pr=vt.findIndex(we=>!we.disabled);Nr(Pr),Ui({alignment:mn?"end":"start"})}break}case"End":{if(!P){Ee.preventDefault(),Nt||hn(!0);let Pr=vt.map(we=>!!we.disabled).lastIndexOf(!1);Nr(Pr),Ui({alignment:mn?"end":"start"})}break}case"Escape":{Ee.preventDefault(),hn(!1),Nr(-1);break}case"Space":{P||(vt[_r]&&Nt?(Ee.preventDefault(),Ms(vt[_r])):(hn(!0),Nr(Lo),Fs()));break}case"Enter":P||Ee.preventDefault(),vt[_r]&&Nt&&(Ee.preventDefault(),Ms(vt[_r]))}},Tl=Ee=>{typeof y=="function"&&y(Ee);let Pr=As.find(we=>we.value===Xt);Ce&&vt[_r]&&Nt&&Ms(vt[_r]),Mo(Pr?.label||""),hn(!1)},Bs=Ee=>{typeof v=="function"&&v(Ee),P&&(hn(!0),Fs())},Ap=Ee=>{Mo(Ee.currentTarget.value),B&&Ee.currentTarget.value===""&&Ds(null),Nr(0),hn(!0)},Dp=()=>{let Ee=!0;P||(Ee=!Nt),hn(Ee),Xt&&Ee&&(Nr(Lo),Fs())},kl=vt.length>0?Nt:Nt&&!!$;return D.createElement(kn,rx(rx({required:i,id:fr,label:a,error:l,description:c,size:u,className:o,style:n,classNames:S,styles:T,__staticSelector:"Select",sx:Qe,errorProps:ye,descriptionProps:dn,labelProps:Ut},Ve),w),D.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":kl?`${fr}-items`:null,"aria-controls":fr,"aria-expanded":kl,onMouseLeave:()=>Nr(-1),tabIndex:-1},D.createElement("input",{type:"hidden",name:bt,value:Xt||"",form:Do}),D.createElement(Sa,rx(yW(rx({autoComplete:"off",type:"search"},yt),{required:i,ref:Sn(e,Xn),id:fr,invalid:!!l,size:u,onKeyDown:Hr,__staticSelector:"Select",value:Vi,placeholder:pt,onChange:Ap,"aria-autocomplete":"list","aria-controls":kl?`${fr}-items`:null,"aria-activedescendant":_r>=0?`${fr}-${_r}`:null,onClick:Dp,onBlur:Tl,onFocus:Bs,readOnly:!P,disabled:G,"data-mantine-stop-propagation":kl,name:null,classNames:yW(rx({},S),{input:Q({[j.input]:!P},S?.input)})}),rE({theme:se,rightSection:L,rightSectionWidth:ne,styles:T,size:u,shouldClear:B&&!!jo,clearButtonLabel:z,onClear:r_,error:l,clearButtonTabIndex:Vr}))),D.createElement(W_,{referenceElement:Xn.current,mounted:kl,transition:C,transitionDuration:N,transitionTimingFunction:E,uuid:fr,shadow:d,maxDropdownHeight:R,classNames:S,styles:T,ref:Sn(io,bi),__staticSelector:"Select",dropdownComponent:Me||Ad,direction:pn,onDirectionChange:Sl,switchDirectionOnFlip:ut,withinPortal:Rt,zIndex:ht,dropdownPosition:Xr,positionDependencies:Be},D.createElement(q_,{data:vt,hovered:_r,classNames:S,styles:T,isItemSelected:Ee=>Ee===Xt,uuid:fr,__staticSelector:"Select",onItemHover:Nr,onItemSelect:Ms,itemsRefs:fn,itemComponent:_,size:u,nothingFound:$,creatable:gn&&!!Rc,createLabel:Rc,"aria-label":a}))))});Er.displayName="@mantine/core/Select";X();var uTe=me((t,{spacing:e,align:r,justify:o})=>({root:{display:"flex",flexDirection:"column",alignItems:r,justifyContent:o,gap:t.fn.size({size:e,sizes:t.spacing})}})),wW=uTe;var dTe=Object.defineProperty,dE=Object.getOwnPropertySymbols,SW=Object.prototype.hasOwnProperty,CW=Object.prototype.propertyIsEnumerable,EW=(t,e,r)=>e in t?dTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fTe=(t,e)=>{for(var r in e||(e={}))SW.call(e,r)&&EW(t,r,e[r]);if(dE)for(var r of dE(e))CW.call(e,r)&&EW(t,r,e[r]);return t},pTe=(t,e)=>{var r={};for(var o in t)SW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&dE)for(var o of dE(t))e.indexOf(o)<0&&CW.call(t,o)&&(r[o]=t[o]);return r},mTe={spacing:"md",align:"stretch",justify:"top"},tu=ee((t,e)=>{let r=Ie("Stack",mTe,t),{spacing:o,className:n,classNames:i,styles:a,align:s,justify:l}=r,c=pTe(r,["spacing","className","classNames","styles","align","justify"]),{classes:u,cx:d}=wW({spacing:o,align:s,justify:l},{name:"Stack",classNames:i,styles:a});return D.createElement(_e,fTe({className:d(u.root,n),ref:e},c))});tu.displayName="@mantine/core/Stack";X();var hTe=Object.defineProperty,gTe=Object.defineProperties,_Te=Object.getOwnPropertyDescriptors,TW=Object.getOwnPropertySymbols,xTe=Object.prototype.hasOwnProperty,bTe=Object.prototype.propertyIsEnumerable,kW=(t,e,r)=>e in t?hTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NW=(t,e)=>{for(var r in e||(e={}))xTe.call(e,r)&&kW(t,r,e[r]);if(TW)for(var r of TW(e))bTe.call(e,r)&&kW(t,r,e[r]);return t},PW=(t,e)=>gTe(t,_Te(e)),GP={xs:16,sm:20,md:24,lg:30,xl:36},fE={xs:30,sm:38,md:46,lg:56,xl:68},OW={xs:12,sm:14,md:18,lg:22,xl:28},yTe={xs:5,sm:6,md:7,lg:9,xl:11},wyt=Object.keys(GP).reduce((t,e)=>(t[e]={width:fE[e],height:GP[e]},t),{}),vTe=me((t,{size:e,radius:r,color:o,offLabel:n,onLabel:i})=>{let a=t.fn.size({size:e,sizes:OW}),s=t.fn.size({size:r,sizes:t.radius}),l=t.fn.variant({variant:"filled",color:o});return{root:{display:"flex",alignItems:"center"},input:PW(NW({},t.fn.focusStyles()),{overflow:"hidden",WebkitTapHighlightColor:"transparent",position:"relative",borderRadius:s,backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],border:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`,height:t.fn.size({size:e,sizes:GP}),width:t.fn.size({size:e,sizes:fE}),minWidth:t.fn.size({size:e,sizes:fE}),margin:0,transitionProperty:"background-color, border-color",transitionTimingFunction:t.transitionTimingFunction,transitionDuration:"150ms",boxSizing:"border-box",appearance:"none",display:"flex",alignItems:"center",fontSize:t.fn.size({size:e,sizes:yTe}),fontWeight:600,"&::before":{zIndex:1,borderRadius:s,boxSizing:"border-box",content:"''",display:"block",backgroundColor:t.white,height:a,width:a,border:`1px solid ${t.colorScheme==="dark"?t.white:t.colors.gray[3]}`,transition:`transform 150ms ${t.transitionTimingFunction}`,transform:`translateX(${e==="xs"?1:2}px)`,"@media (prefers-reduced-motion)":{transitionDuration:"0ms"}},"&::after":{position:"absolute",zIndex:0,display:"flex",height:"100%",alignItems:"center",lineHeight:0,right:"10%",transform:"translateX(0)",content:n?`'${n}'`:"''",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[6],transition:`color 150ms ${t.transitionTimingFunction}`},"&:checked":{backgroundColor:l.background,borderColor:l.background,"&::before":{transform:`translateX(${t.fn.size({size:e,sizes:fE})-t.fn.size({size:e,sizes:OW})-(e==="xs"?3:4)}px)`,borderColor:t.white},"&::after":{position:"absolute",zIndex:0,display:"flex",height:"100%",alignItems:"center",lineHeight:0,left:"10%",transform:"translateX(0)",content:i?`'${i}'`:"''",color:t.white,transition:`color 150ms ${t.transitionTimingFunction}`}},"&:disabled":{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],cursor:"not-allowed","&::before":{borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],backgroundColor:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[0]}}}),label:PW(NW({},t.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:t.fn.size({size:e,sizes:t.fontSizes}),fontFamily:t.fontFamily,paddingLeft:t.spacing.sm,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black})}}),AW=vTe;var ITe=Object.defineProperty,wTe=Object.defineProperties,ETe=Object.getOwnPropertyDescriptors,pE=Object.getOwnPropertySymbols,RW=Object.prototype.hasOwnProperty,MW=Object.prototype.propertyIsEnumerable,DW=(t,e,r)=>e in t?ITe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WP=(t,e)=>{for(var r in e||(e={}))RW.call(e,r)&&DW(t,r,e[r]);if(pE)for(var r of pE(e))MW.call(e,r)&&DW(t,r,e[r]);return t},STe=(t,e)=>wTe(t,ETe(e)),CTe=(t,e)=>{var r={};for(var o in t)RW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&pE)for(var o of pE(t))e.indexOf(o)<0&&MW.call(t,o)&&(r[o]=t[o]);return r},TTe={offLabel:"",onLabel:"",size:"sm",radius:"xl"},mE=ee((t,e)=>{let r=Ie("Switch",TTe,t),{className:o,color:n,label:i,offLabel:a,onLabel:s,id:l,style:c,size:u,radius:d,wrapperProps:f,children:m,classNames:h,styles:g,sx:_}=r,b=CTe(r,["className","color","label","offLabel","onLabel","id","style","size","radius","wrapperProps","children","classNames","styles","sx"]),{classes:y,cx:v}=AW({size:u,color:n,radius:d,offLabel:a,onLabel:s},{classNames:h,styles:g,name:"Switch"}),{systemStyles:C,rest:N}=so(b),I=lo(l);return D.createElement(_e,WP(WP({className:v(y.root,o),style:c,sx:_},C),f),D.createElement("input",STe(WP({},N),{id:I,ref:e,type:"checkbox",className:y.input})),i&&D.createElement("label",{className:y.label,htmlFor:I},i))});mE.displayName="@mantine/core/Switch";X();var kTe=Object.defineProperty,NTe=Object.defineProperties,PTe=Object.getOwnPropertyDescriptors,LW=Object.getOwnPropertySymbols,OTe=Object.prototype.hasOwnProperty,ATe=Object.prototype.propertyIsEnumerable,FW=(t,e,r)=>e in t?kTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DTe=(t,e)=>{for(var r in e||(e={}))OTe.call(e,r)&&FW(t,r,e[r]);if(LW)for(var r of LW(e))ATe.call(e,r)&&FW(t,r,e[r]);return t},RTe=(t,e)=>NTe(t,PTe(e)),MTe=me((t,{captionSide:e,horizontalSpacing:r,verticalSpacing:o,fontSize:n},i)=>{let a={ref:i("striped")},s={ref:i("hover")};return{striped:a,hover:s,root:RTe(DTe({},t.fn.fontStyles()),{width:"100%",borderCollapse:"collapse",captionSide:e,color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,lineHeight:t.lineHeight,"& caption":{marginTop:e==="top"?0:t.spacing.xs,marginBottom:e==="bottom"?0:t.spacing.xs,fontSize:t.fontSizes.sm,color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},"& thead tr th, & tfoot tr th":{textAlign:"left",fontWeight:"bold",color:t.colorScheme==="dark"?t.colors.dark[0]:t.colors.gray[7],fontSize:t.fn.size({size:n,sizes:t.fontSizes}),padding:`${t.fn.size({size:o,sizes:t.spacing})}px ${t.fn.size({size:r,sizes:t.spacing})}px`},"& thead tr th":{borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},"& tfoot tr th":{borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`},"& tbody tr td":{padding:`${t.fn.size({size:o,sizes:t.spacing})}px ${t.fn.size({size:r,sizes:t.spacing})}px`,borderBottom:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[3]}`,fontSize:t.fn.size({size:n,sizes:t.fontSizes})},"& tbody tr:last-of-type td":{borderBottom:"none"},[`&.${a.ref} tbody tr:nth-of-type(odd)`]:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},[`&.${s.ref} tbody tr:hover`]:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[5]:t.colors.gray[1]}})}}),BW=MTe;var LTe=Object.defineProperty,FTe=Object.defineProperties,BTe=Object.getOwnPropertyDescriptors,hE=Object.getOwnPropertySymbols,zW=Object.prototype.hasOwnProperty,UW=Object.prototype.propertyIsEnumerable,$W=(t,e,r)=>e in t?LTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$Te=(t,e)=>{for(var r in e||(e={}))zW.call(e,r)&&$W(t,r,e[r]);if(hE)for(var r of hE(e))UW.call(e,r)&&$W(t,r,e[r]);return t},zTe=(t,e)=>FTe(t,BTe(e)),UTe=(t,e)=>{var r={};for(var o in t)zW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&hE)for(var o of hE(t))e.indexOf(o)<0&&UW.call(t,o)&&(r[o]=t[o]);return r},VTe={striped:!1,highlightOnHover:!1,captionSide:"top",horizontalSpacing:"xs",fontSize:"sm",verticalSpacing:7},fo=ee((t,e)=>{let r=Ie("Table",VTe,t),{className:o,children:n,striped:i,highlightOnHover:a,captionSide:s,horizontalSpacing:l,verticalSpacing:c,fontSize:u}=r,d=UTe(r,["className","children","striped","highlightOnHover","captionSide","horizontalSpacing","verticalSpacing","fontSize"]),{classes:f,cx:m}=BW({captionSide:s,verticalSpacing:c,horizontalSpacing:l,fontSize:u},{name:"Table"});return D.createElement(_e,zTe($Te({},d),{component:"table",ref:e,className:m(f.root,{[f.striped]:i,[f.hover]:a},o)}),n)});fo.displayName="@mantine/core/Table";X();var HTe=Object.defineProperty,jTe=Object.defineProperties,GTe=Object.getOwnPropertyDescriptors,VW=Object.getOwnPropertySymbols,WTe=Object.prototype.hasOwnProperty,qTe=Object.prototype.propertyIsEnumerable,HW=(t,e,r)=>e in t?HTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jW=(t,e)=>{for(var r in e||(e={}))WTe.call(e,r)&&HW(t,r,e[r]);if(VW)for(var r of VW(e))qTe.call(e,r)&&HW(t,r,e[r]);return t},KTe=(t,e)=>jTe(t,GTe(e)),YTe=me((t,{color:e,orientation:r},o)=>{let n={ref:o("tabActive")};return{tabActive:n,tabLabel:{},tabControl:KTe(jW(jW({},t.fn.fontStyles()),t.fn.focusStyles()),{WebkitTapHighlightColor:"transparent",boxSizing:"border-box",display:"block",height:40,backgroundColor:"transparent",border:0,padding:`0 ${t.spacing.md}px`,fontSize:t.fontSizes.sm,cursor:"pointer",width:r==="vertical"?"100%":"auto","&:disabled":{cursor:"not-allowed",color:t.colorScheme==="dark"?t.colors.dark[3]:t.colors.gray[5]}}),default:{transition:"border-color 150ms ease, color 150ms ease",color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,[r==="horizontal"?"borderBottom":"borderRight"]:"2px solid transparent",[`&.${n.ref}`]:{color:t.fn.themeColor(e,t.colorScheme==="dark"?4:7),[r==="horizontal"?"borderBottomColor":"borderRightColor"]:t.fn.themeColor(e,t.colorScheme==="dark"?4:7)}},outline:{borderBottomLeftRadius:r==="vertical"?t.radius.sm:0,borderTopRightRadius:r==="horizontal"?t.radius.sm:0,borderTopLeftRadius:t.radius.sm,border:"1px solid transparent",borderBottom:r==="horizontal"?0:"1px solid transparent",borderRight:r==="vertical"?0:"1px solid transparent",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7],[`&.${n.ref}`]:{color:t.colorScheme==="dark"?t.colors.dark[0]:t.black,borderColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2],background:t.colorScheme==="dark"?t.colors.dark[7]:t.white}},pills:{borderRadius:t.radius.sm,backgroundColor:"transparent",color:t.colorScheme==="dark"?t.colors.dark[1]:t.colors.gray[7],fontSize:t.fontSizes.sm,height:"auto",padding:`${t.spacing.xs}px ${t.spacing.lg}px`,fontWeight:500,"&:hover":{background:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]},[`&.${n.ref}`]:{color:t.colorScheme==="dark"?t.white:t.black,background:t.colorScheme==="dark"?t.colors.dark[6]:t.colors.gray[0]}},tabInner:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:r==="horizontal"?"center":"flex-start",lineHeight:1,height:"100%"},tabIcon:{"&:not(:only-child)":{marginRight:t.spacing.xs},"& *":{display:"block"}}}}),GW=YTe;var XTe=Object.defineProperty,JTe=Object.defineProperties,QTe=Object.getOwnPropertyDescriptors,gE=Object.getOwnPropertySymbols,qW=Object.prototype.hasOwnProperty,KW=Object.prototype.propertyIsEnumerable,WW=(t,e,r)=>e in t?XTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZTe=(t,e)=>{for(var r in e||(e={}))qW.call(e,r)&&WW(t,r,e[r]);if(gE)for(var r of gE(e))KW.call(e,r)&&WW(t,r,e[r]);return t},e1e=(t,e)=>JTe(t,QTe(e)),t1e=(t,e)=>{var r={};for(var o in t)qW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&gE)for(var o of gE(t))e.indexOf(o)<0&&KW.call(t,o)&&(r[o]=t[o]);return r},qP=ee((t,e)=>{var r=t,{className:o,active:n,color:i,variant:a="default",classNames:s,styles:l,orientation:c="horizontal",icon:u,label:d,icon:f,tabKey:m,color:h,elementRef:g}=r,_=t1e(r,["className","active","color","variant","classNames","styles","orientation","icon","label","icon","tabKey","color","elementRef"]);let{classes:b,cx:y}=GW({color:h||i,orientation:c},{classNames:s,styles:l,name:"Tabs"});return D.createElement(_e,e1e(ZTe({},_),{component:"button",tabIndex:n?0:-1,className:y(b.tabControl,b[a],{[b.tabActive]:n},o),type:"button",role:"tab","aria-selected":n,ref:kd(e,g)}),D.createElement("div",{className:b.tabInner},f&&D.createElement("div",{className:b.tabIcon},f),d&&D.createElement("div",{className:b.tabLabel},d)))});qP.displayName="@mantine/core/TabControl";X();var r1e=me((t,{tabPadding:e,orientation:r},o)=>{let n={ref:o("tabsList")};return{tabsListWrapper:{},tabsList:n,root:{display:r==="vertical"?"flex":"block"},pills:{marginRight:r==="vertical"?20:0},body:{[r==="horizontal"?"paddingTop":"paddingLeft"]:t.fn.size({size:e,sizes:t.spacing})},default:{[r==="horizontal"?"borderBottom":"borderRight"]:`2px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`,[`& .${n.ref}`]:{[r==="horizontal"?"marginBottom":"marginRight"]:-2}},outline:{[r==="horizontal"?"borderBottom":"borderRight"]:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`,[`& .${n.ref}`]:{[r==="horizontal"?"marginBottom":"marginRight"]:-1}}}}),YW=r1e;var o1e=Object.defineProperty,_E=Object.getOwnPropertySymbols,JW=Object.prototype.hasOwnProperty,QW=Object.prototype.propertyIsEnumerable,XW=(t,e,r)=>e in t?o1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n1e=(t,e)=>{for(var r in e||(e={}))JW.call(e,r)&&XW(t,r,e[r]);if(_E)for(var r of _E(e))QW.call(e,r)&&XW(t,r,e[r]);return t},i1e=(t,e)=>{var r={};for(var o in t)JW.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&_E)for(var o of _E(t))e.indexOf(o)<0&&QW.call(t,o)&&(r[o]=t[o]);return r};function a1e(t,e){for(let r=t-1;r>=0;r-=1)if(!e[r].props.disabled)return r;return t}function s1e(t,e){for(let r=t+1;r<e.length;r+=1)if(!e[r].props.disabled)return r;return t}function l1e(t){for(let e=0;e<t.length;e+=1)if(!t[e].props.disabled)return e;return-1}var c1e={position:"left",grow:!1,variant:"default",tabPadding:"xs",orientation:"horizontal"},Gs=ee((t,e)=>{let r=Ie("Tabs",c1e,t),{className:o,children:n,initialTab:i,active:a,position:s,grow:l,onTabChange:c,color:u,variant:d,classNames:f,styles:m,tabPadding:h,orientation:g}=r,_=i1e(r,["className","children","initialTab","active","position","grow","onTabChange","color","variant","classNames","styles","tabPadding","orientation"]),{classes:b,cx:y,theme:v}=YW({tabPadding:h,orientation:g},{classNames:f,styles:m,name:"Tabs"}),C=W({}),N=vn.toArray(n),[I,E]=Cn({value:a,defaultValue:i,finalValue:l1e(N),rule:B=>typeof B=="number",onChange:B=>{c&&(N.some($=>$.props.tabKey)?c(B,N[B].props.tabKey):c(B))}}),w=ya({value:I,min:0,max:N.length-1}),S=g==="horizontal"?v.dir==="ltr"?"ArrowRight":"ArrowLeft":"ArrowDown",T=g==="horizontal"?v.dir==="ltr"?"ArrowLeft":"ArrowRight":"ArrowUp",A=B=>{if(B.nativeEvent.code===S){B.preventDefault();let $=s1e(w,N);E($),C.current[$].focus()}if(B.nativeEvent.code===T){B.preventDefault();let $=a1e(w,N);E($),C.current[$].focus()}},R=N.map((B,$)=>D.cloneElement(B,{key:$,active:w===$,onKeyDown:A,color:B.props.color||u,variant:d,orientation:g,elementRef:z=>{C.current[$]=z},onClick:()=>w!==$&&E($),classNames:f,styles:m})),P=N[w].props.children;return D.createElement(_e,n1e({ref:e,className:y(b.root,o)},_),D.createElement("div",{className:y(b.tabsListWrapper,b[d])},D.createElement(as,{className:b.tabsList,role:"tablist",direction:g==="horizontal"?"row":"column","aria-orientation":g,spacing:d==="pills"?5:0,position:s,grow:l},R)),P&&D.createElement("div",{role:"tabpanel",className:b.body,key:w},P))});Gs.displayName="@mantine/core/Tabs";Gs.Tab=qP;X();var u1e=Object.defineProperty,d1e=Object.defineProperties,f1e=Object.getOwnPropertyDescriptors,ZW=Object.getOwnPropertySymbols,p1e=Object.prototype.hasOwnProperty,m1e=Object.prototype.propertyIsEnumerable,eq=(t,e,r)=>e in t?u1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,h1e=(t,e)=>{for(var r in e||(e={}))p1e.call(e,r)&&eq(t,r,e[r]);if(ZW)for(var r of ZW(e))m1e.call(e,r)&&eq(t,r,e[r]);return t},g1e=(t,e)=>d1e(t,f1e(e)),_1e=me((t,{color:e,radius:r})=>({root:{position:"relative",display:"inline-block"},body:g1e(h1e({},t.fn.fontStyles()),{backgroundColor:t.fn.themeColor(e,t.colorScheme==="dark"?3:9),lineHeight:t.lineHeight,fontSize:t.fontSizes.sm,borderRadius:t.fn.radius(r),padding:`${t.spacing.xs/2}px ${t.spacing.xs}px`,color:t.colorScheme==="dark"?t.colors.dark[9]:t.white,position:"relative",overflow:"hidden",textOverflow:"ellipsis"}),arrow:{border:0,background:t.fn.themeColor(e,t.colorScheme==="dark"?3:9),zIndex:1}})),tq=_1e;var x1e=Object.defineProperty,xE=Object.getOwnPropertySymbols,oq=Object.prototype.hasOwnProperty,nq=Object.prototype.propertyIsEnumerable,rq=(t,e,r)=>e in t?x1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b1e=(t,e)=>{for(var r in e||(e={}))oq.call(e,r)&&rq(t,r,e[r]);if(xE)for(var r of xE(e))nq.call(e,r)&&rq(t,r,e[r]);return t},y1e=(t,e)=>{var r={};for(var o in t)oq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&xE)for(var o of xE(t))e.indexOf(o)<0&&nq.call(t,o)&&(r[o]=t[o]);return r},v1e={openDelay:0,closeDelay:0,gutter:5,color:"gray",disabled:!1,withArrow:!1,arrowSize:2,position:"top",placement:"center",transition:"pop-top-left",transitionDuration:100,zIndex:Ar("popover"),width:"auto",wrapLines:!1,allowPointerEvents:!1,positionDependencies:[],withinPortal:!0},Se=ee((t,e)=>{let r=Ie("Tooltip",v1e,t),{className:o,label:n,children:i,opened:a,openDelay:s,closeDelay:l,gutter:c,color:u,radius:d,disabled:f,withArrow:m,arrowSize:h,position:g,placement:_,transition:b,transitionDuration:y,zIndex:v,transitionTimingFunction:C,width:N,wrapLines:I,allowPointerEvents:E,positionDependencies:w,withinPortal:S,tooltipRef:T,tooltipId:A,classNames:R,styles:P,onMouseLeave:B,onMouseEnter:$}=r,z=y1e(r,["className","label","children","opened","openDelay","closeDelay","gutter","color","radius","disabled","withArrow","arrowSize","position","placement","transition","transitionDuration","zIndex","transitionTimingFunction","width","wrapLines","allowPointerEvents","positionDependencies","withinPortal","tooltipRef","tooltipId","classNames","styles","onMouseLeave","onMouseEnter"]),{classes:H,cx:G,theme:Y}=tq({color:u,radius:d},{classNames:R,styles:P,name:"Tooltip"}),L=W(),ne=W(),[ae,U]=M(!1),ge=(typeof a=="boolean"?a:ae)&&!f,[Ce,He]=M(null),Qe=Sn(e,He),Me=()=>{window.clearTimeout(ne.current),s!==0?L.current=window.setTimeout(()=>{U(!0)},s):U(!0)},ke=()=>{window.clearTimeout(L.current),l!==0?ne.current=window.setTimeout(()=>{U(!1)},l):U(!1)};return V(()=>()=>{window.clearTimeout(L.current),window.clearTimeout(ne.current)},[]),D.createElement(_e,b1e({className:G(H.root,o),onPointerEnter:at=>{Me(),typeof $=="function"&&$(at)},onPointerLeave:at=>{ke(),typeof B=="function"&&B(at)},onFocusCapture:Me,onBlurCapture:ke,ref:Qe},z),D.createElement(Vl,{referenceElement:Ce,transitionDuration:y,transition:b,mounted:ge,position:g,placement:_,gutter:c,withArrow:m,arrowSize:h,arrowDistance:Y.fn.radius(d)>10?7:3,zIndex:v,arrowClassName:H.arrow,forceUpdateDependencies:[u,d,...w],withinPortal:S},D.createElement(_e,{className:H.body,ref:T,sx:{pointerEvents:E?"all":"none",whiteSpace:I?"normal":"nowrap",width:N}},n)),i)});Se.displayName="@mantine/core/Tooltip";X();X();var ox=ft(null);ox.displayName="@mantine/modals/ModalsContext";X();X();function Ct(){let t=lt(ox);if(!t)throw new Error("[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component");return t}var I1e=Object.defineProperty,w1e=Object.defineProperties,E1e=Object.getOwnPropertyDescriptors,iq=Object.getOwnPropertySymbols,S1e=Object.prototype.hasOwnProperty,C1e=Object.prototype.propertyIsEnumerable,aq=(t,e,r)=>e in t?I1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KP=(t,e)=>{for(var r in e||(e={}))S1e.call(e,r)&&aq(t,r,e[r]);if(iq)for(var r of iq(e))C1e.call(e,r)&&aq(t,r,e[r]);return t},sq=(t,e)=>w1e(t,E1e(e));function lq({id:t,cancelProps:e,confirmProps:r,labels:o={cancel:"",confirm:""},closeOnConfirm:n=!0,closeOnCancel:i=!0,groupProps:a,onCancel:s,onConfirm:l,children:c}){let{cancel:u,confirm:d}=o,f=Ct(),m=g=>{typeof e?.onClick=="function"&&e?.onClick(g),typeof s=="function"&&s(),i&&f.closeModal(t)},h=g=>{typeof r?.onClick=="function"&&r?.onClick(g),typeof l=="function"&&l(),n&&f.closeModal(t)};return D.createElement(D.Fragment,null,c&&D.createElement(_e,{mb:"md"},c),D.createElement(as,KP({position:"right"},a),D.createElement(re,sq(KP({variant:"default"},e),{onClick:m}),e?.children||u),D.createElement(re,sq(KP({},r),{onClick:h}),r?.children||d)))}function cq(t,e){switch(e.type){case"OPEN":return{current:e.payload,modals:[...t.modals,e.payload]};case"CLOSE":return{current:t.modals[t.modals.length-2]||null,modals:t.modals.filter(r=>r.id!==e.payload)};case"CLOSE_ALL":return{current:t.current,modals:[]};default:return t}}var T1e=Object.defineProperty,k1e=Object.defineProperties,N1e=Object.getOwnPropertyDescriptors,yE=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,pq=Object.prototype.propertyIsEnumerable,uq=(t,e,r)=>e in t?T1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bE=(t,e)=>{for(var r in e||(e={}))fq.call(e,r)&&uq(t,r,e[r]);if(yE)for(var r of yE(e))pq.call(e,r)&&uq(t,r,e[r]);return t},dq=(t,e)=>k1e(t,N1e(e)),YP=(t,e)=>{var r={};for(var o in t)fq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&yE)for(var o of yE(t))e.indexOf(o)<0&&pq.call(t,o)&&(r[o]=t[o]);return r};function P1e(t){if(!t)return{confirmProps:{},modalProps:{}};let e=t,{id:r,children:o,onCancel:n,onConfirm:i,closeOnConfirm:a,closeOnCancel:s,cancelProps:l,confirmProps:c,groupProps:u,labels:d}=e,f=YP(e,["id","children","onCancel","onConfirm","closeOnConfirm","closeOnCancel","cancelProps","confirmProps","groupProps","labels"]);return{confirmProps:{id:r,children:o,onCancel:n,onConfirm:i,closeOnConfirm:a,closeOnCancel:s,cancelProps:l,confirmProps:c,groupProps:u,labels:d},modalProps:bE({id:r},f)}}function XP({children:t,modalProps:e,labels:r,modals:o}){let[n,i]=Qn(cq,{modals:[],current:null}),a=g=>{n.modals.forEach(_=>{var b,y,v,C;_.type==="confirm"&&g&&((y=(b=_.props)==null?void 0:b.onCancel)==null||y.call(b)),(C=(v=_.props)==null?void 0:v.onClose)==null||C.call(v)}),i({type:"CLOSE_ALL"})},s=g=>{let _=g.id||Ml();return i({type:"OPEN",payload:{id:_,type:"content",props:g}}),_},l=g=>{let _=g.id||Ml();return i({type:"OPEN",payload:{id:_,type:"confirm",props:g}}),_},c=(g,_)=>{let b=_.id||Ml();return i({type:"OPEN",payload:{id:b,type:"context",props:_,ctx:g}}),b},u=(g,_)=>{var b,y,v,C;if(n.modals.length<=1){a(_);return}let N=n.modals.find(I=>I.id===g);N?.type==="confirm"&&_&&((y=(b=N.props)==null?void 0:b.onCancel)==null||y.call(b)),(C=(v=N?.props)==null?void 0:v.onClose)==null||C.call(v),i({type:"CLOSE",payload:N.id})},d={modals:n.modals,openModal:s,openConfirmModal:l,openContextModal:c,closeModal:u,closeAll:a},f=()=>{var g;switch((g=n.current)==null?void 0:g.type){case"context":{let _=n.current.props,{innerProps:b}=_,y=YP(_,["innerProps"]),v=o[n.current.ctx];return{modalProps:y,content:D.createElement(v,{innerProps:b,context:d,id:n.current.id})}}case"confirm":{let{modalProps:_,confirmProps:b}=P1e(n.current.props);return{modalProps:_,content:D.createElement(lq,dq(bE({},b),{id:n.current.id,labels:n.current.props.labels||r}))}}case"content":{let _=n.current.props,{children:b}=_;return{modalProps:YP(_,["children"]),content:D.createElement(D.Fragment,null,b)}}default:return{modalProps:{},content:null}}},{modalProps:m,content:h}=f();return D.createElement(ox.Provider,{value:d},D.createElement(eu,dq(bE(bE({},e),m),{opened:n.modals.length>0,onClose:()=>u(n.current.id)}),h),t)}X();var JP=ft(null);JP.displayName="@mantine/notifications/NotificationsContext";X();function nx(t,e){return nx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,n){return o.__proto__=n,o},nx(t,e)}function ix(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,nx(t,e)}X();X();var QP={disabled:!1};X();var Sm=D.createContext(null);var mq=function(e){return e.scrollTop};var ax="unmounted",Gd="exited",Wd="entering",Tm="entered",ZP="exiting",jl=(function(t){ix(e,t);function e(o,n){var i;i=t.call(this,o,n)||this;var a=n,s=a&&!a.isMounting?o.enter:o.appear,l;return i.appearStatus=null,o.in?s?(l=Gd,i.appearStatus=Wd):l=Tm:o.unmountOnExit||o.mountOnEnter?l=ax:l=Gd,i.state={status:l},i.nextCallback=null,i}e.getDerivedStateFromProps=function(n,i){var a=n.in;return a&&i.status===ax?{status:Gd}:null};var r=e.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(n){var i=null;if(n!==this.props){var a=this.state.status;this.props.in?a!==Wd&&a!==Tm&&(i=Wd):(a===Wd||a===Tm)&&(i=ZP)}this.updateStatus(!1,i)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var n=this.props.timeout,i,a,s;return i=a=s=n,n!=null&&typeof n!="number"&&(i=n.exit,a=n.enter,s=n.appear!==void 0?n.appear:a),{exit:i,enter:a,appear:s}},r.updateStatus=function(n,i){if(n===void 0&&(n=!1),i!==null)if(this.cancelNextCallback(),i===Wd){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:D.findDOMNode(this);a&&mq(a)}this.performEnter(n)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Gd&&this.setState({status:ax})},r.performEnter=function(n){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:n,l=this.props.nodeRef?[s]:[D.findDOMNode(this),s],c=l[0],u=l[1],d=this.getTimeouts(),f=s?d.appear:d.enter;if(!n&&!a||QP.disabled){this.safeSetState({status:Tm},function(){i.props.onEntered(c)});return}this.props.onEnter(c,u),this.safeSetState({status:Wd},function(){i.props.onEntering(c,u),i.onTransitionEnd(f,function(){i.safeSetState({status:Tm},function(){i.props.onEntered(c,u)})})})},r.performExit=function(){var n=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:D.findDOMNode(this);if(!i||QP.disabled){this.safeSetState({status:Gd},function(){n.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:ZP},function(){n.props.onExiting(s),n.onTransitionEnd(a.exit,function(){n.safeSetState({status:Gd},function(){n.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(n,i){i=this.setNextCallback(i),this.setState(n,i)},r.setNextCallback=function(n){var i=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,n(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(n,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:D.findDOMNode(this),s=n==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u)}n!=null&&setTimeout(this.nextCallback,n)},r.render=function(){var n=this.state.status;if(n===ax)return null;var i=this.props,a=i.children,s=i.in,l=i.mountOnEnter,c=i.unmountOnExit,u=i.appear,d=i.enter,f=i.exit,m=i.timeout,h=i.addEndListener,g=i.onEnter,_=i.onEntering,b=i.onEntered,y=i.onExit,v=i.onExiting,C=i.onExited,N=i.nodeRef,I=jd(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return D.createElement(Sm.Provider,{value:null},typeof a=="function"?a(n,I):D.cloneElement(D.Children.only(a),I))},e})(D.Component);jl.contextType=Sm;jl.propTypes={};function Cm(){}jl.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Cm,onEntering:Cm,onEntered:Cm,onExit:Cm,onExiting:Cm,onExited:Cm};jl.UNMOUNTED=ax;jl.EXITED=Gd;jl.ENTERING=Wd;jl.ENTERED=Tm;jl.EXITING=ZP;var eO=jl;function tO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}X();X();function vE(t,e){var r=function(i){return e&&Zn(i)?e(i):i},o=Object.create(null);return t&&vn.map(t,function(n){return n}).forEach(function(n){o[n.key]=r(n)}),o}function O1e(t,e){t=t||{},e=e||{};function r(u){return u in e?e[u]:t[u]}var o=Object.create(null),n=[];for(var i in t)i in e?n.length&&(o[i]=n,n=[]):n.push(i);var a,s={};for(var l in e){if(o[l])for(a=0;a<o[l].length;a++){var c=o[l][a];s[o[l][a]]=r(c)}s[l]=r(l)}for(a=0;a<n.length;a++)s[n[a]]=r(n[a]);return s}function qd(t,e,r){return r[e]!=null?r[e]:t.props[e]}function hq(t,e){return vE(t.children,function(r){return Gi(r,{onExited:e.bind(null,r),in:!0,appear:qd(r,"appear",t),enter:qd(r,"enter",t),exit:qd(r,"exit",t)})})}function gq(t,e,r){var o=vE(t.children),n=O1e(e,o);return Object.keys(n).forEach(function(i){var a=n[i];if(Zn(a)){var s=i in e,l=i in o,c=e[i],u=Zn(c)&&!c.props.in;l&&(!s||u)?n[i]=Gi(a,{onExited:r.bind(null,a),in:!0,exit:qd(a,"exit",t),enter:qd(a,"enter",t)}):!l&&s&&!u?n[i]=Gi(a,{in:!1}):l&&s&&Zn(c)&&(n[i]=Gi(a,{onExited:r.bind(null,a),in:c.props.in,exit:qd(a,"exit",t),enter:qd(a,"enter",t)}))}}),n}var A1e=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},D1e={component:"div",childFactory:function(e){return e}},rO=(function(t){ix(e,t);function e(o,n){var i;i=t.call(this,o,n)||this;var a=i.handleExited.bind(tO(i));return i.state={contextValue:{isMounting:!0},handleExited:a,firstRender:!0},i}var r=e.prototype;return r.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},r.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(n,i){var a=i.children,s=i.handleExited,l=i.firstRender;return{children:l?hq(n,s):gq(n,a,s),firstRender:!1}},r.handleExited=function(n,i){var a=vE(this.props.children);n.key in a||(n.props.onExited&&n.props.onExited(i),this.mounted&&this.setState(function(s){var l=pr({},s.children);return delete l[n.key],{children:l}}))},r.render=function(){var n=this.props,i=n.component,a=n.childFactory,s=jd(n,["component","childFactory"]),l=this.state.contextValue,c=A1e(this.state.children).map(a);return delete s.appear,delete s.enter,delete s.exit,i===null?D.createElement(Sm.Provider,{value:l},c):D.createElement(Sm.Provider,{value:l},D.createElement(i,s,c))},e})(D.Component);rO.propTypes={};rO.defaultProps=D1e;var oO=rO;X();var IE={show:"mantine:show-notification",hide:"mantine:hide-notification",update:"mantine:update-notification",clean:"mantine:clean-notifications",cleanQueue:"mantine:clean-notifications-queue"};function _q(t,e){return new CustomEvent(t,{detail:e})}function Ae(t){window.dispatchEvent(_q(IE.show,t))}function Ht(t){window.dispatchEvent(_q(IE.update,t))}function xq(t){let e={show:r=>t.showNotification(r.detail),hide:r=>t.hideNotification(r.detail),update:r=>t.updateNotification(r.detail.id,r.detail),clean:t.clean,cleanQueue:t.cleanQueue};V(()=>(Object.keys(e).forEach(r=>{window.addEventListener(IE[r],e[r])}),()=>{Object.keys(e).forEach(r=>{window.removeEventListener(IE[r],e[r])})}),[])}function R1e([t,e],r,o){let n={};return t==="top"&&(n.top=o),t==="bottom"&&(n.bottom=o),e==="left"&&(n.left=o),e==="right"&&(n.right=o),e==="center"&&(n.left="50%",n.transform="translateX(-50%)"),n}var bq=R1e;var M1e=Object.defineProperty,yq=Object.getOwnPropertySymbols,L1e=Object.prototype.hasOwnProperty,F1e=Object.prototype.propertyIsEnumerable,vq=(t,e,r)=>e in t?M1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Iq=(t,e)=>{for(var r in e||(e={}))L1e.call(e,r)&&vq(t,r,e[r]);if(yq)for(var r of yq(e))F1e.call(e,r)&&vq(t,r,e[r]);return t},wq={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},B1e={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function $1e({state:t,maxHeight:e,positioning:r,transitionDuration:o}){let[n,i]=r,a=i==="center"?`${n}-center`:i,s={opacity:0,maxHeight:e,transform:wq[a],transitionDuration:`${o}ms, ${o}ms, ${o}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},l={opacity:1,transform:B1e[a]},c={opacity:0,maxHeight:0,transform:wq[a]},u={entering:l,entered:l,exiting:c,exited:c};return Iq(Iq({},s),u[t])}var Eq=$1e;X();function z1e(t,e){return typeof e=="number"?e:e===!1||t===!1?!1:t}var Sq=z1e;var U1e=Object.defineProperty,V1e=Object.defineProperties,H1e=Object.getOwnPropertyDescriptors,wE=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,Pq=Object.prototype.propertyIsEnumerable,Cq=(t,e,r)=>e in t?U1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tq=(t,e)=>{for(var r in e||(e={}))Nq.call(e,r)&&Cq(t,r,e[r]);if(wE)for(var r of wE(e))Pq.call(e,r)&&Cq(t,r,e[r]);return t},j1e=(t,e)=>V1e(t,H1e(e)),kq=(t,e)=>{var r={};for(var o in t)Nq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&wE)for(var o of wE(t))e.indexOf(o)<0&&Pq.call(t,o)&&(r[o]=t[o]);return r};function Oq(t){var e=t,{notification:r,autoClose:o,onHide:n,innerRef:i}=e,a=kq(e,["notification","autoClose","onHide","innerRef"]);let s=r,{autoClose:l}=s,c=kq(s,["autoClose"]),u=Sq(o,l),d=W(),f=()=>{n(r.id),window.clearTimeout(d.current)},m=()=>{clearTimeout(d.current)},h=()=>{typeof u=="number"&&(d.current=window.setTimeout(f,u))};return V(()=>{typeof r.onOpen=="function"&&r.onOpen(r)},[]),V(()=>(h(),m),[o,r.autoClose]),D.createElement(aE,j1e(Tq(Tq({},c),a),{onClose:f,onMouseEnter:m,onMouseLeave:h,ref:i}),r.message)}Oq.displayName="@mantine/notifications/NotificationContainer";var Aq=Oq;var G1e=me(t=>({notifications:{width:`calc(100% - ${t.spacing.md*2}px)`,boxSizing:"border-box",position:"fixed",zIndex:1e3},notification:{"&:not(:first-of-type)":{marginTop:t.spacing.sm}}})),Dq=G1e;var W1e=Object.defineProperty,q1e=Object.defineProperties,K1e=Object.getOwnPropertyDescriptors,Rq=Object.getOwnPropertySymbols,Y1e=Object.prototype.hasOwnProperty,X1e=Object.prototype.propertyIsEnumerable,Mq=(t,e,r)=>e in t?W1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J1e=(t,e)=>{for(var r in e||(e={}))Y1e.call(e,r)&&Mq(t,r,e[r]);if(Rq)for(var r of Rq(e))X1e.call(e,r)&&Mq(t,r,e[r]);return t},Q1e=(t,e)=>q1e(t,K1e(e));function Z1e({limit:t}){let{state:e,queue:r,update:o,cleanQueue:n}=zN({initialValues:[],limit:t});return{notifications:e,queue:r,showNotification:c=>{let u=c.id||Ml();return o(d=>c.id&&d.some(f=>f.id===c.id)?d:[...d,Q1e(J1e({},c),{id:u})]),u},updateNotification:(c,u)=>o(d=>{let f=d.findIndex(h=>h.id===c);if(f===-1)return d;let m=[...d];return m[f]=u,m}),hideNotification:c=>o(u=>u.filter(d=>d.id===c?(typeof d.onClose=="function"&&d.onClose(d),!1):!0)),cleanQueue:n,clean:()=>o(()=>[])}}var Lq=Z1e;var eke=Object.defineProperty,EE=Object.getOwnPropertySymbols,Bq=Object.prototype.hasOwnProperty,$q=Object.prototype.propertyIsEnumerable,Fq=(t,e,r)=>e in t?eke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nO=(t,e)=>{for(var r in e||(e={}))Bq.call(e,r)&&Fq(t,r,e[r]);if(EE)for(var r of EE(e))$q.call(e,r)&&Fq(t,r,e[r]);return t},tke=(t,e)=>{var r={};for(var o in t)Bq.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&EE)for(var o of EE(t))e.indexOf(o)<0&&$q.call(t,o)&&(r[o]=t[o]);return r},rke=["top-left","top-right","top-center","bottom-left","bottom-right","bottom-center"];function SE(t){var e=t,{className:r,position:o="bottom-right",autoClose:n=4e3,transitionDuration:i=250,containerWidth:a=440,notificationMaxHeight:s=200,limit:l=5,zIndex:c=Ar("overlay"),style:u,children:d}=e,f=tke(e,["className","position","autoClose","transitionDuration","containerWidth","notificationMaxHeight","limit","zIndex","style","children"]);let m=BN(),h=W({}),g=W(0),{notifications:_,queue:b,showNotification:y,updateNotification:v,hideNotification:C,clean:N,cleanQueue:I}=Lq({limit:l}),w=ts()?1:i,{classes:S,cx:T,theme:A}=Dq(),R=(rke.includes(o)?o:"bottom-right").split("-"),P={notifications:_,queue:b,showNotification:y,hideNotification:C,updateNotification:v,clean:N,cleanQueue:I};mr(()=>{_.length>g.current&&setTimeout(()=>m(),0),g.current=_.length},[_]),xq(P);let B=_.map($=>D.createElement(eO,{key:$.id,timeout:w,onEnter:()=>h.current[$.id].offsetHeight,nodeRef:{current:h.current[$.id]}},z=>D.createElement(Aq,{innerRef:H=>{h.current[$.id]=H},notification:$,onHide:C,className:S.notification,autoClose:n,sx:[nO({},Eq({state:z,positioning:R,transitionDuration:w,maxHeight:s})),...Array.isArray($.sx)?$.sx:[$.sx]]})));return D.createElement(JP.Provider,{value:P},D.createElement(jc,{zIndex:c},D.createElement(_e,nO({className:T(S.notifications,r),style:u,sx:nO({maxWidth:a},bq(R,a,A.spacing.md))},f),D.createElement(oO,null,B))),d)}SE.displayName="@mantine/notifications/NotificationsProvider";var zq=()=>{};var Hq=function(t){let e=[],r=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);n<128?e[r++]=n:n<2048?(e[r++]=n>>6|192,e[r++]=n&63|128):(n&64512)===55296&&o+1<t.length&&(t.charCodeAt(o+1)&64512)===56320?(n=65536+((n&1023)<<10)+(t.charCodeAt(++o)&1023),e[r++]=n>>18|240,e[r++]=n>>12&63|128,e[r++]=n>>6&63|128,e[r++]=n&63|128):(e[r++]=n>>12|224,e[r++]=n>>6&63|128,e[r++]=n&63|128)}return e},oke=function(t){let e=[],r=0,o=0;for(;r<t.length;){let n=t[r++];if(n<128)e[o++]=String.fromCharCode(n);else if(n>191&&n<224){let i=t[r++];e[o++]=String.fromCharCode((n&31)<<6|i&63)}else if(n>239&&n<365){let i=t[r++],a=t[r++],s=t[r++],l=((n&7)<<18|(i&63)<<12|(a&63)<<6|s&63)-65536;e[o++]=String.fromCharCode(55296+(l>>10)),e[o++]=String.fromCharCode(56320+(l&1023))}else{let i=t[r++],a=t[r++];e[o++]=String.fromCharCode((n&15)<<12|(i&63)<<6|a&63)}}return e.join("")},jq={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let n=0;n<t.length;n+=3){let i=t[n],a=n+1<t.length,s=a?t[n+1]:0,l=n+2<t.length,c=l?t[n+2]:0,u=i>>2,d=(i&3)<<4|s>>4,f=(s&15)<<2|c>>6,m=c&63;l||(m=64,a||(f=64)),o.push(r[u],r[d],r[f],r[m])}return o.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Hq(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):oke(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let r=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let n=0;n<t.length;){let i=r[t.charAt(n++)],s=n<t.length?r[t.charAt(n)]:0;++n;let c=n<t.length?r[t.charAt(n)]:64;++n;let d=n<t.length?r[t.charAt(n)]:64;if(++n,i==null||s==null||c==null||d==null)throw new aO;let f=i<<2|s>>4;if(o.push(f),c!==64){let m=s<<4&240|c>>2;if(o.push(m),d!==64){let h=c<<6&192|d;o.push(h)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},aO=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},nke=function(t){let e=Hq(t);return jq.encodeByteArray(e,!0)},lx=function(t){return nke(t).replace(/\./g,"")},TE=function(t){try{return jq.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Gq(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var ike=()=>Gq().__FIREBASE_DEFAULTS__,ake=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},ske=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&TE(t[1]);return e&&JSON.parse(e)},kE=()=>{try{return zq()||ike()||ake()||ske()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},lO=t=>kE()?.emulatorHosts?.[t],cO=t=>{let e=lO(t);if(!e)return;let r=e.lastIndexOf(":");if(r<=0||r+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let o=parseInt(e.substring(r+1),10);return e[0]==="["?[e.substring(1,r-1),o]:[e.substring(0,r),o]},uO=()=>kE()?.config,dO=t=>kE()?.[`_${t}`];var CE=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}wrapCallback(e){return(r,o)=>{r?this.reject(r):this.resolve(o),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(r):e(r,o))}}};function ss(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function km(t){return(await fetch(t,{credentials:"include"})).ok}function fO(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let r={alg:"none",type:"JWT"},o=e||"demo-project",n=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let a={iss:`https://securetoken.google.com/${o}`,aud:o,iat:n,exp:n+3600,auth_time:n,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[lx(JSON.stringify(r)),lx(JSON.stringify(a)),""].join(".")}var sx={};function lke(){let t={prod:[],emulator:[]};for(let e of Object.keys(sx))sx[e]?t.emulator.push(e):t.prod.push(e);return t}function cke(t){let e=document.getElementById(t),r=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),r=!0),{created:r,element:e}}var Uq=!1;function cx(t,e){if(typeof window>"u"||typeof document>"u"||!ss(window.location.host)||sx[t]===e||sx[t]||Uq)return;sx[t]=e;function r(f){return`__firebase__banner__${f}`}let o="__firebase__banner",i=lke().prod.length>0;function a(){let f=document.getElementById(o);f&&f.remove()}function s(f){f.style.display="flex",f.style.background="#7faaf0",f.style.position="fixed",f.style.bottom="5px",f.style.left="5px",f.style.padding=".5em",f.style.borderRadius="5px",f.style.alignItems="center"}function l(f,m){f.setAttribute("width","24"),f.setAttribute("id",m),f.setAttribute("height","24"),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("fill","none"),f.style.marginLeft="-6px"}function c(){let f=document.createElement("span");return f.style.cursor="pointer",f.style.marginLeft="16px",f.style.fontSize="24px",f.innerHTML=" &times;",f.onclick=()=>{Uq=!0,a()},f}function u(f,m){f.setAttribute("id",m),f.innerText="Learn more",f.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",f.setAttribute("target","__blank"),f.style.paddingLeft="5px",f.style.textDecoration="underline"}function d(){let f=cke(o),m=r("text"),h=document.getElementById(m)||document.createElement("span"),g=r("learnmore"),_=document.getElementById(g)||document.createElement("a"),b=r("preprendIcon"),y=document.getElementById(b)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(f.created){let v=f.element;s(v),u(_,g);let C=c();l(y,b),v.append(y,h,_,C),document.body.appendChild(v)}i?(h.innerText="Preview backend disconnected.",y.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
12
12
  <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
13
13
  </g>
14
14
  <defs>
@@ -22,7 +22,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),L=z,Y=H),G===void 0&&(
22
22
  <clipPath id="clip0_6083_34804">
23
23
  <rect width="24" height="24" fill="white"/>
24
24
  </clipPath>
25
- </defs>`,h.innerText="Preview backend running in this workspace."),h.setAttribute("id",m)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",d):d()}function Yo(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Wq(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Yo())}function uke(){let t=k0()?.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function qq(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Kq(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Yq(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Xq(){let t=Yo();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Jq(){return!uke()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function pO(){try{return typeof indexedDB=="object"}catch{return!1}}function Qq(){return new Promise((t,e)=>{try{let r=!0,o="validate-browser-context-for-indexeddb-analytics-module",n=self.indexedDB.open(o);n.onsuccess=()=>{n.result.close(),r||self.indexedDB.deleteDatabase(o),t(!0)},n.onupgradeneeded=()=>{r=!1},n.onerror=()=>{e(n.error?.message||"")}}catch(r){e(r)}})}var dke="FirebaseError",li=class t extends Error{constructor(e,r,o){super(r),this.code=e,this.customData=o,this.name=dke,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Gl.prototype.create)}},Gl=class{constructor(e,r,o){this.service=e,this.serviceName=r,this.errors=o}create(e,...r){let o=r[0]||{},n=`${this.service}/${e}`,i=this.errors[e],a=i?fke(i,o):"Error",s=`${this.serviceName}: ${a} (${n}).`;return new li(n,s,o)}};function fke(t,e){return t.replace(pke,(r,o)=>{let n=e[o];return n!=null?String(n):`<${o}?>`})}var pke=/\{\$([^}]+)}/g;function Zq(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ls(t,e){if(t===e)return!0;let r=Object.keys(t),o=Object.keys(e);for(let n of r){if(!o.includes(n))return!1;let i=t[n],a=e[n];if(Vq(i)&&Vq(a)){if(!ls(i,a))return!1}else if(i!==a)return!1}for(let n of o)if(!r.includes(n))return!1;return!0}function Vq(t){return t!==null&&typeof t=="object"}function Nm(t){let e=[];for(let[r,o]of Object.entries(t))Array.isArray(o)?o.forEach(n=>{e.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(r)+"="+encodeURIComponent(o));return e.length?"&"+e.join("&"):""}function Pm(t){let e={};return t.replace(/^\?/,"").split("&").forEach(o=>{if(o){let[n,i]=o.split("=");e[decodeURIComponent(n)]=decodeURIComponent(i)}}),e}function Om(t){let e=t.indexOf("?");if(!e)return"";let r=t.indexOf("#",e);return t.substring(e,r>0?r:void 0)}function eK(t,e){let r=new sO(t,e);return r.subscribe.bind(r)}var sO=class{constructor(e,r){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=r,this.task.then(()=>{e(this)}).catch(o=>{this.error(o)})}next(e){this.forEachObserver(r=>{r.next(e)})}error(e){this.forEachObserver(r=>{r.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,r,o){let n;if(e===void 0&&r===void 0&&o===void 0)throw new Error("Missing Observer.");mke(e,["next","error","complete"])?n=e:n={next:e,error:r,complete:o},n.next===void 0&&(n.next=iO),n.error===void 0&&(n.error=iO),n.complete===void 0&&(n.complete=iO);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{}}),this.observers.push(n),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let r=0;r<this.observers.length;r++)this.sendOne(r,e)}sendOne(e,r){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{r(this.observers[e])}catch(o){typeof console<"u"&&console.error&&console.error(o)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function mke(t,e){if(typeof t!="object"||t===null)return!1;for(let r of e)if(r in t&&typeof t[r]=="function")return!0;return!1}function iO(){}var ywt=14400*1e3;function vr(t){return t&&t._delegate?t._delegate:t}var yi=class{constructor(e,r,o){this.name=e,this.instanceFactory=r,this.type=o,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}};var Kd="[DEFAULT]";var mO=class{constructor(e,r){this.name=e,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let r=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(r)){let o=new C0;if(this.instancesDeferred.set(r,o),this.isInitialized(r)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:r});n&&o.resolve(n)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(e){let r=this.normalizeInstanceIdentifier(e?.identifier),o=e?.optional??!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(n){if(o)return null;throw n}else{if(o)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(gke(e))try{this.getOrInitializeService({instanceIdentifier:Kd})}catch{}for(let[r,o]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(r);try{let i=this.getOrInitializeService({instanceIdentifier:n});o.resolve(i)}catch{}}}}clearInstance(e=Kd){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(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...e.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Kd){return this.instances.has(e)}getOptions(e=Kd){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:r={}}=e,o=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(o))throw Error(`${this.name}(${o}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let n=this.getOrInitializeService({instanceIdentifier:o,options:r});for(let[i,a]of this.instancesDeferred.entries()){let s=this.normalizeInstanceIdentifier(i);o===s&&a.resolve(n)}return n}onInit(e,r){let o=this.normalizeInstanceIdentifier(r),n=this.onInitCallbacks.get(o)??new Set;n.add(e),this.onInitCallbacks.set(o,n);let i=this.instances.get(o);return i&&e(i,o),()=>{n.delete(e)}}invokeOnInitCallbacks(e,r){let o=this.onInitCallbacks.get(r);if(o)for(let n of o)try{n(e,r)}catch{}}getOrInitializeService({instanceIdentifier:e,options:r={}}){let o=this.instances.get(e);if(!o&&this.component&&(o=this.component.instanceFactory(this.container,{instanceIdentifier:hke(e),options:r}),this.instances.set(e,o),this.instancesOptions.set(e,r),this.invokeOnInitCallbacks(o,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,o)}catch{}return o||null}normalizeInstanceIdentifier(e=Kd){return this.component?this.component.multipleInstances?e:Kd:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function hke(t){return t===Kd?void 0:t}function gke(t){return t.instantiationMode==="EAGER"}var N0=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let r=this.getProvider(e.name);if(r.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);r.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 r=new mO(e,this);return this.providers.set(e,r),r}getProviders(){return Array.from(this.providers.values())}};var _ke=[],Pt;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Pt||(Pt={}));var xke={debug:Pt.DEBUG,verbose:Pt.VERBOSE,info:Pt.INFO,warn:Pt.WARN,error:Pt.ERROR,silent:Pt.SILENT},bke=Pt.INFO,yke={[Pt.DEBUG]:"log",[Pt.VERBOSE]:"log",[Pt.INFO]:"info",[Pt.WARN]:"warn",[Pt.ERROR]:"error"},vke=(t,e,...r)=>{if(e<t.logLevel)return;let o=new Date().toISOString(),n=yke[e];if(n)console[n](`[${o}] ${t.name}:`,...r);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},ru=class{constructor(e){this.name=e,this._logLevel=bke,this._logHandler=vke,this._userLogHandler=null,_ke.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Pt))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?xke[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Pt.DEBUG,...e),this._logHandler(this,Pt.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Pt.VERBOSE,...e),this._logHandler(this,Pt.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Pt.INFO,...e),this._logHandler(this,Pt.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Pt.WARN,...e),this._logHandler(this,Pt.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Pt.ERROR,...e),this._logHandler(this,Pt.ERROR,...e)}};var Ike=(t,e)=>e.some(r=>t instanceof r),tK,rK;function wke(){return tK||(tK=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Eke(){return rK||(rK=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var oK=new WeakMap,gO=new WeakMap,nK=new WeakMap,hO=new WeakMap,xO=new WeakMap;function Ske(t){let e=new Promise((r,o)=>{let n=()=>{t.removeEventListener("success",i),t.removeEventListener("error",a)},i=()=>{r(Ws(t.result)),n()},a=()=>{o(t.error),n()};t.addEventListener("success",i),t.addEventListener("error",a)});return e.then(r=>{r instanceof IDBCursor&&oK.set(r,t)}).catch(()=>{}),xO.set(e,t),e}function Cke(t){if(gO.has(t))return;let e=new Promise((r,o)=>{let n=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",a),t.removeEventListener("abort",a)},i=()=>{r(),n()},a=()=>{o(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",i),t.addEventListener("error",a),t.addEventListener("abort",a)});gO.set(t,e)}var _O={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return gO.get(t);if(e==="objectStoreNames")return t.objectStoreNames||nK.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ws(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function iK(t){_O=t(_O)}function Tke(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let o=t.call(P0(this),e,...r);return nK.set(o,e.sort?e.sort():[e]),Ws(o)}:Eke().includes(t)?function(...e){return t.apply(P0(this),e),Ws(oK.get(this))}:function(...e){return Ws(t.apply(P0(this),e))}}function kke(t){return typeof t=="function"?Tke(t):(t instanceof IDBTransaction&&Cke(t),Ike(t,wke())?new Proxy(t,_O):t)}function Ws(t){if(t instanceof IDBRequest)return Ske(t);if(hO.has(t))return hO.get(t);let e=kke(t);return e!==t&&(hO.set(t,e),xO.set(e,t)),e}var P0=t=>xO.get(t);function sK(t,e,{blocked:r,upgrade:o,blocking:n,terminated:i}={}){let a=indexedDB.open(t,e),s=Ws(a);return o&&a.addEventListener("upgradeneeded",l=>{o(Ws(a.result),l.oldVersion,l.newVersion,Ws(a.transaction),l)}),r&&a.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),n&&l.addEventListener("versionchange",c=>n(c.oldVersion,c.newVersion,c))}).catch(()=>{}),s}var Nke=["get","getKey","getAll","getAllKeys","count"],Pke=["put","add","delete","clear"],bO=new Map;function aK(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(bO.get(e))return bO.get(e);let r=e.replace(/FromIndex$/,""),o=e!==r,n=Pke.includes(r);if(!(r in(o?IDBIndex:IDBObjectStore).prototype)||!(n||Nke.includes(r)))return;let i=async function(a,...s){let l=this.transaction(a,n?"readwrite":"readonly"),c=l.store;return o&&(c=c.index(s.shift())),(await Promise.all([c[r](...s),n&&l.done]))[0]};return bO.set(e,i),i}iK(t=>({...t,get:(e,r,o)=>aK(e,r)||t.get(e,r,o),has:(e,r)=>!!aK(e,r)||t.has(e,r)}));var vO=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(Oke(r)){let o=r.getImmediate();return`${o.library}/${o.version}`}else return null}).filter(r=>r).join(" ")}};function Oke(t){return t.getComponent()?.type==="VERSION"}var IO="@firebase/app",lK="0.14.2";var Wl=new ru("@firebase/app"),Ake="@firebase/app-compat",Dke="@firebase/analytics-compat",Rke="@firebase/analytics",Mke="@firebase/app-check-compat",Lke="@firebase/app-check",Fke="@firebase/auth",Bke="@firebase/auth-compat",$ke="@firebase/database",zke="@firebase/data-connect",Uke="@firebase/database-compat",Vke="@firebase/functions",Hke="@firebase/functions-compat",jke="@firebase/installations",Gke="@firebase/installations-compat",Wke="@firebase/messaging",qke="@firebase/messaging-compat",Kke="@firebase/performance",Yke="@firebase/performance-compat",Xke="@firebase/remote-config",Jke="@firebase/remote-config-compat",Qke="@firebase/storage",Zke="@firebase/storage-compat",eNe="@firebase/firestore",tNe="@firebase/ai",rNe="@firebase/firestore-compat",oNe="firebase",nNe="12.2.0";var wO="[DEFAULT]",iNe={[IO]:"fire-core",[Ake]:"fire-core-compat",[Rke]:"fire-analytics",[Dke]:"fire-analytics-compat",[Lke]:"fire-app-check",[Mke]:"fire-app-check-compat",[Fke]:"fire-auth",[Bke]:"fire-auth-compat",[$ke]:"fire-rtdb",[zke]:"fire-data-connect",[Uke]:"fire-rtdb-compat",[Vke]:"fire-fn",[Hke]:"fire-fn-compat",[jke]:"fire-iid",[Gke]:"fire-iid-compat",[Wke]:"fire-fcm",[qke]:"fire-fcm-compat",[Kke]:"fire-perf",[Yke]:"fire-perf-compat",[Xke]:"fire-rc",[Jke]:"fire-rc-compat",[Qke]:"fire-gcs",[Zke]:"fire-gcs-compat",[eNe]:"fire-fst",[rNe]:"fire-fst-compat",[tNe]:"fire-vertex","fire-js":"fire-js",[oNe]:"fire-js-all"};var O0=new Map,aNe=new Map,EO=new Map;function cK(t,e){try{t.container.addComponent(e)}catch(r){Wl.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,r)}}function qs(t){let e=t.name;if(EO.has(e))return Wl.debug(`There were multiple attempts to register component ${e}.`),!1;EO.set(e,t);for(let r of O0.values())cK(r,t);for(let r of aNe.values())cK(r,t);return!0}function Yd(t,e){let r=t.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),t.container.getProvider(e)}function Ii(t){return t==null?!1:t.settings!==void 0}var sNe={"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."},ou=new Gl("app","Firebase",sNe);var SO=class{constructor(e,r,o){this._isDeleted=!1,this._options={...e},this._config={...r},this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=o,this.container.addComponent(new yi("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 ou.create("app-deleted",{appName:this._name})}};var Ks=nNe;function kO(t,e={}){let r=t;typeof e!="object"&&(e={name:e});let o={name:wO,automaticDataCollectionEnabled:!0,...e},n=o.name;if(typeof n!="string"||!n)throw ou.create("bad-app-name",{appName:String(n)});if(r||(r=uO()),!r)throw ou.create("no-options");let i=O0.get(n);if(i){if(ls(r,i.options)&&ls(o,i.config))return i;throw ou.create("duplicate-app",{appName:n})}let a=new N0(n);for(let l of EO.values())a.addComponent(l);let s=new SO(r,o,a);return O0.set(n,s),s}function dx(t=wO){let e=O0.get(t);if(!e&&t===wO&&uO())return kO();if(!e)throw ou.create("no-app",{appName:t});return e}function vi(t,e,r){let o=iNe[t]??t;r&&(o+=`-${r}`);let n=o.match(/\s|\//),i=e.match(/\s|\//);if(n||i){let a=[`Unable to register library "${o}" with version "${e}":`];n&&a.push(`library name "${o}" contains illegal characters (whitespace or "/")`),n&&i&&a.push("and"),i&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Wl.warn(a.join(" "));return}qs(new yi(`${o}-version`,()=>({library:o,version:e}),"VERSION"))}var lNe="firebase-heartbeat-database",cNe=1,ux="firebase-heartbeat-store",yO=null;function pK(){return yO||(yO=sK(lNe,cNe,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(ux)}catch(r){console.warn(r)}}}}).catch(t=>{throw ou.create("idb-open",{originalErrorMessage:t.message})})),yO}async function uNe(t){try{let r=(await pK()).transaction(ux),o=await r.objectStore(ux).get(mK(t));return await r.done,o}catch(e){if(e instanceof li)Wl.warn(e.message);else{let r=ou.create("idb-get",{originalErrorMessage:e?.message});Wl.warn(r.message)}}}async function uK(t,e){try{let o=(await pK()).transaction(ux,"readwrite");await o.objectStore(ux).put(e,mK(t)),await o.done}catch(r){if(r instanceof li)Wl.warn(r.message);else{let o=ou.create("idb-set",{originalErrorMessage:r?.message});Wl.warn(o.message)}}}function mK(t){return`${t.name}!${t.options.appId}`}var dNe=1024,fNe=30,CO=class{constructor(e){this.container=e,this._heartbeatsCache=null;let r=this.container.getProvider("app").getImmediate();this._storage=new TO(r),this._heartbeatsCachePromise=this._storage.read().then(o=>(this._heartbeatsCache=o,o))}async triggerHeartbeat(){try{let r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=dK();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(n=>n.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:r}),this._heartbeatsCache.heartbeats.length>fNe){let n=mNe(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(n,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Wl.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=dK(),{heartbeatsToSend:r,unsentEntries:o}=pNe(this._heartbeatsCache.heartbeats),n=lx(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=e,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return Wl.warn(e),""}}};function dK(){return new Date().toISOString().substring(0,10)}function pNe(t,e=dNe){let r=[],o=t.slice();for(let n of t){let i=r.find(a=>a.agent===n.agent);if(i){if(i.dates.push(n.date),fK(r)>e){i.dates.pop();break}}else if(r.push({agent:n.agent,dates:[n.date]}),fK(r)>e){r.pop();break}o=o.slice(1)}return{heartbeatsToSend:r,unsentEntries:o}}var TO=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return pO()?Qq().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let r=await uNe(this.app);return r?.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let o=await this.read();return uK(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let o=await this.read();return uK(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...e.heartbeats]})}else return}};function fK(t){return lx(JSON.stringify({version:2,heartbeats:t})).length}function mNe(t){if(t.length===0)return-1;let e=0,r=t[0].date;for(let o=1;o<t.length;o++)t[o].date<r&&(r=t[o].date,e=o);return e}function hNe(t){qs(new yi("platform-logger",e=>new vO(e),"PRIVATE")),qs(new yi("heartbeat",e=>new CO(e),"PRIVATE")),vi(IO,lK,t),vi(IO,lK,"esm2020"),vi("fire-js","")}hNe("");var gNe="firebase",_Ne="12.2.1";vi(gNe,_Ne,"app");function DK(){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."}}var RK=DK,MK=new Gl("auth","Firebase",DK());var B0=new ru("@firebase/auth");function xNe(t,...e){B0.logLevel<=Pt.WARN&&B0.warn(`Auth (${Ks}): ${t}`,...e)}function D0(t,...e){B0.logLevel<=Pt.ERROR&&B0.error(`Auth (${Ks}): ${t}`,...e)}function cs(t,...e){throw ZO(t,...e)}function Xs(t,...e){return ZO(t,...e)}function LK(t,e,r){let o={...RK(),[e]:r};return new Gl("auth","Firebase",o).create(e,{appName:t.name})}function Xd(t){return LK(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ZO(t,...e){if(typeof t!="string"){let r=e[0],o=[...e.slice(1)];return o[0]&&(o[0].appName=t.name),t._errorFactory.create(r,...o)}return MK.create(t,...e)}function Ge(t,e,...r){if(!t)throw ZO(e,...r)}function Ys(t){let e="INTERNAL ASSERTION FAILED: "+t;throw D0(e),new Error(e)}function Kl(t,e){t||Ys(e)}function RO(){return typeof self<"u"&&self.location?.href||""}function bNe(){return hK()==="http:"||hK()==="https:"}function hK(){return typeof self<"u"&&self.location?.protocol||null}function yNe(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(bNe()||Kq()||"connection"in navigator)?navigator.onLine:!0}function vNe(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}var Jd=class{constructor(e,r){this.shortDelay=e,this.longDelay=r,Kl(r>e,"Short delay should be less than long delay!"),this.isMobile=Wq()||Yq()}get(){return yNe()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function eA(t,e){Kl(t.emulator,"Emulator should always be set here");let{url:r}=t.emulator;return e?`${r}${e.startsWith("/")?e.slice(1):e}`:r}var $0=class{static initialize(e,r,o){this.fetchImpl=e,r&&(this.headersImpl=r),o&&(this.responseImpl=o)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ys("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ys("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ys("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var INe={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"};var wNe=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ENe=new Jd(3e4,6e4);function Xo(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function $n(t,e,r,o,n={}){return FK(t,n,async()=>{let i={},a={};o&&(e==="GET"?a=o:i={body:JSON.stringify(o)});let s=Nm({key:t.config.apiKey,...a}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let c={method:e,headers:l,...i};return qq()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&ss(t.emulatorConfig.host)&&(c.credentials="include"),$0.fetch()(await BK(t,t.config.apiHost,r,s),c)})}async function FK(t,e,r){t._canInitEmulator=!1;let o={...INe,...e};try{let n=new MO(t),i=await Promise.race([r(),n.promise]);n.clearNetworkTimeout();let a=await i.json();if("needConfirmation"in a)throw px(t,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{let s=i.ok?a.errorMessage:a.error.message,[l,c]=s.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw px(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw px(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw px(t,"user-disabled",a);let u=o[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw LK(t,u,c);cs(t,u)}}catch(n){if(n instanceof li)throw n;cs(t,"network-request-failed",{message:String(n)})}}async function rf(t,e,r,o,n={}){let i=await $n(t,e,r,o,n);return"mfaPendingCredential"in i&&cs(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function BK(t,e,r,o){let n=`${e}${r}?${o}`,i=t,a=i.config.emulator?eA(t.config,n):`${t.config.apiScheme}://${n}`;return wNe.includes(r)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}function SNe(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var MO=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((r,o)=>{this.timer=setTimeout(()=>o(Xs(this.auth,"network-request-failed")),ENe.get())})}};function px(t,e,r){let o={appName:t.name};r.email&&(o.email=r.email),r.phoneNumber&&(o.phoneNumber=r.phoneNumber);let n=Xs(t,e,o);return n.customData._tokenResponse=r,n}function gK(t){return t!==void 0&&t.enterprise!==void 0}var z0=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let r of this.recaptchaEnforcementState)if(r.provider&&r.provider===e)return SNe(r.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};async function $K(t,e){return $n(t,"GET","/v2/recaptchaConfig",Xo(t,e))}async function CNe(t,e){return $n(t,"POST","/v1/accounts:delete",e)}async function U0(t,e){return $n(t,"POST","/v1/accounts:lookup",e)}function mx(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function zK(t,e=!1){let r=vr(t),o=await r.getIdToken(e),n=tA(o);Ge(n&&n.exp&&n.auth_time&&n.iat,r.auth,"internal-error");let i=typeof n.firebase=="object"?n.firebase:void 0,a=i?.sign_in_provider;return{claims:n,token:o,authTime:mx(NO(n.auth_time)),issuedAtTime:mx(NO(n.iat)),expirationTime:mx(NO(n.exp)),signInProvider:a||null,signInSecondFactor:i?.sign_in_second_factor||null}}function NO(t){return Number(t)*1e3}function tA(t){let[e,r,o]=t.split(".");if(e===void 0||r===void 0||o===void 0)return D0("JWT malformed, contained fewer than 3 sections"),null;try{let n=T0(r);return n?JSON.parse(n):(D0("Failed to decode base64 JWT payload"),null)}catch(n){return D0("Caught error parsing JWT payload as JSON",n?.toString()),null}}function _K(t){let e=tA(t);return Ge(e,"internal-error"),Ge(typeof e.exp<"u","internal-error"),Ge(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function xx(t,e,r=!1){if(r)return e;try{return await e}catch(o){throw o instanceof li&&TNe(o)&&t.auth.currentUser===t&&await t.auth.signOut(),o}}function TNe({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}var LO=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;let o=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,o)}}schedule(e=!1){if(!this.isRunning)return;let r=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},r)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var bx=class{constructor(e,r){this.createdAt=e,this.lastLoginAt=r,this._initializeTime()}_initializeTime(){this.lastSignInTime=mx(this.lastLoginAt),this.creationTime=mx(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function V0(t){let e=t.auth,r=await t.getIdToken(),o=await xx(t,U0(e,{idToken:r}));Ge(o?.users.length,e,"internal-error");let n=o.users[0];t._notifyReloadListener(n);let i=n.providerUserInfo?.length?VK(n.providerUserInfo):[],a=kNe(t.providerData,i),s=t.isAnonymous,l=!(t.email&&n.passwordHash)&&!a?.length,c=s?l:!1,u={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:a,metadata:new bx(n.createdAt,n.lastLoginAt),isAnonymous:c};Object.assign(t,u)}async function UK(t){let e=vr(t);await V0(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function kNe(t,e){return[...t.filter(o=>!e.some(n=>n.providerId===o.providerId)),...e]}function VK(t){return t.map(({providerId:e,...r})=>({providerId:e,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}))}async function NNe(t,e){let r=await FK(t,{},async()=>{let o=Nm({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:n,apiKey:i}=t.config,a=await BK(t,n,"/v1/token",`key=${i}`),s=await t._getAdditionalHeaders();s["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:s,body:o};return t.emulatorConfig&&ss(t.emulatorConfig.host)&&(l.credentials="include"),$0.fetch()(a,l)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function PNe(t,e){return $n(t,"POST","/v2/accounts:revokeToken",Xo(t,e))}var hx=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ge(e.idToken,"internal-error"),Ge(typeof e.idToken<"u","internal-error"),Ge(typeof e.refreshToken<"u","internal-error");let r="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):_K(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,r)}updateFromIdToken(e){Ge(e.length!==0,"internal-error");let r=_K(e);this.updateTokensAndExpiration(e,null,r)}async getToken(e,r=!1){return!r&&this.accessToken&&!this.isExpired?this.accessToken:(Ge(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,r){let{accessToken:o,refreshToken:n,expiresIn:i}=await NNe(e,r);this.updateTokensAndExpiration(o,n,Number(i))}updateTokensAndExpiration(e,r,o){this.refreshToken=r||null,this.accessToken=e||null,this.expirationTime=Date.now()+o*1e3}static fromJSON(e,r){let{refreshToken:o,accessToken:n,expirationTime:i}=r,a=new t;return o&&(Ge(typeof o=="string","internal-error",{appName:e}),a.refreshToken=o),n&&(Ge(typeof n=="string","internal-error",{appName:e}),a.accessToken=n),i&&(Ge(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}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 t,this.toJSON())}_performRefresh(){return Ys("not implemented")}};function nu(t,e){Ge(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}var iu=class t{constructor({uid:e,auth:r,stsTokenManager:o,...n}){this.providerId="firebase",this.proactiveRefresh=new LO(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=r,this.stsTokenManager=o,this.accessToken=o.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 bx(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let r=await xx(this,this.stsTokenManager.getToken(this.auth,e));return Ge(r,this.auth,"internal-error"),this.accessToken!==r&&(this.accessToken=r,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),r}getIdTokenResult(e){return zK(this,e)}reload(){return UK(this)}_assign(e){this!==e&&(Ge(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(r=>({...r})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let r=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return r.metadata._copy(this.metadata),r}_onReload(e){Ge(!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,r=!1){let o=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),o=!0),r&&await V0(this),await this.auth._persistUserIfCurrent(this),o&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ii(this.auth.app))return Promise.reject(Xd(this.auth));let e=await this.getIdToken();return await xx(this,CNe(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,r){let o=r.displayName??void 0,n=r.email??void 0,i=r.phoneNumber??void 0,a=r.photoURL??void 0,s=r.tenantId??void 0,l=r._redirectEventId??void 0,c=r.createdAt??void 0,u=r.lastLoginAt??void 0,{uid:d,emailVerified:f,isAnonymous:m,providerData:h,stsTokenManager:g}=r;Ge(d&&g,e,"internal-error");let _=hx.fromJSON(this.name,g);Ge(typeof d=="string",e,"internal-error"),nu(o,e.name),nu(n,e.name),Ge(typeof f=="boolean",e,"internal-error"),Ge(typeof m=="boolean",e,"internal-error"),nu(i,e.name),nu(a,e.name),nu(s,e.name),nu(l,e.name),nu(c,e.name),nu(u,e.name);let b=new t({uid:d,auth:e,email:n,emailVerified:f,displayName:o,isAnonymous:m,photoURL:a,phoneNumber:i,tenantId:s,stsTokenManager:_,createdAt:c,lastLoginAt:u});return h&&Array.isArray(h)&&(b.providerData=h.map(y=>({...y}))),l&&(b._redirectEventId=l),b}static async _fromIdTokenResponse(e,r,o=!1){let n=new hx;n.updateFromServerResponse(r);let i=new t({uid:r.localId,auth:e,stsTokenManager:n,isAnonymous:o});return await V0(i),i}static async _fromGetAccountInfoResponse(e,r,o){let n=r.users[0];Ge(n.localId!==void 0,"internal-error");let i=n.providerUserInfo!==void 0?VK(n.providerUserInfo):[],a=!(n.email&&n.passwordHash)&&!i?.length,s=new hx;s.updateFromIdToken(o);let l=new t({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:a}),c={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 bx(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash)&&!i?.length};return Object.assign(l,c),l}};var xK=new Map;function ql(t){Kl(t instanceof Function,"Expected a class definition");let e=xK.get(t);return e?(Kl(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,xK.set(t,e),e)}var H0=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,r){this.storage[e]=r}async _get(e){let r=this.storage[e];return r===void 0?null:r}async _remove(e){delete this.storage[e]}_addListener(e,r){}_removeListener(e,r){}};H0.type="NONE";var FO=H0;function R0(t,e,r){return`firebase:${t}:${e}:${r}`}var j0=class t{constructor(e,r,o){this.persistence=e,this.auth=r,this.userKey=o;let{config:n,name:i}=this.auth;this.fullUserKey=R0(this.userKey,n.apiKey,i),this.fullPersistenceKey=R0("persistence",n.apiKey,i),this.boundEventHandler=r._onStorageEvent.bind(r),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(typeof e=="string"){let r=await U0(this.auth,{idToken:e}).catch(()=>{});return r?iu._fromGetAccountInfoResponse(this.auth,r,e):null}return iu._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 r=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,r)return this.setCurrentUser(r)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,r,o="authUser"){if(!r.length)return new t(ql(FO),e,o);let n=(await Promise.all(r.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c),i=n[0]||ql(FO),a=R0(o,e.config.apiKey,e.name),s=null;for(let c of r)try{let u=await c._get(a);if(u){let d;if(typeof u=="string"){let f=await U0(e,{idToken:u}).catch(()=>{});if(!f)break;d=await iu._fromGetAccountInfoResponse(e,f,u)}else d=iu._fromJSON(e,u);c!==i&&(s=d),i=c;break}}catch{}let l=n.filter(c=>c._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new t(i,e,o):(i=l[0],s&&await i._set(a,s.toJSON()),await Promise.all(r.map(async c=>{if(c!==i)try{await c._remove(a)}catch{}})),new t(i,e,o))}};function bK(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(WK(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(HK(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(KK(e))return"Blackberry";if(YK(e))return"Webos";if(jK(e))return"Safari";if((e.includes("chrome/")||GK(e))&&!e.includes("edge/"))return"Chrome";if(qK(e))return"Android";{let r=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,o=t.match(r);if(o?.length===2)return o[1]}return"Other"}function HK(t=Yo()){return/firefox\//i.test(t)}function jK(t=Yo()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function GK(t=Yo()){return/crios\//i.test(t)}function WK(t=Yo()){return/iemobile/i.test(t)}function qK(t=Yo()){return/android/i.test(t)}function KK(t=Yo()){return/blackberry/i.test(t)}function YK(t=Yo()){return/webos/i.test(t)}function rA(t=Yo()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function ONe(t=Yo()){return rA(t)&&!!window.navigator?.standalone}function ANe(){return Xq()&&document.documentMode===10}function XK(t=Yo()){return rA(t)||qK(t)||YK(t)||KK(t)||/windows phone/i.test(t)||WK(t)}function JK(t,e=[]){let r;switch(t){case"Browser":r=bK(Yo());break;case"Worker":r=`${bK(Yo())}-${t}`;break;default:r=t}let o=e.length?e.join(","):"FirebaseCore-web";return`${r}/JsCore/${Ks}/${o}`}var BO=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,r){let o=i=>new Promise((a,s)=>{try{let l=e(i);a(l)}catch(l){s(l)}});o.onAbort=r,this.queue.push(o);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let r=[];try{for(let o of this.queue)await o(e),o.onAbort&&r.push(o.onAbort)}catch(o){r.reverse();for(let n of r)try{n()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:o?.message})}}};async function DNe(t,e={}){return $n(t,"GET","/v2/passwordPolicy",Xo(t,e))}var RNe=6,$O=class{constructor(e){let r=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=r.minPasswordLength??RNe,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),r.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),r.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),r.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),r.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let r={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,r),this.validatePasswordCharacterOptions(e,r),r.isValid&&(r.isValid=r.meetsMinPasswordLength??!0),r.isValid&&(r.isValid=r.meetsMaxPasswordLength??!0),r.isValid&&(r.isValid=r.containsLowercaseLetter??!0),r.isValid&&(r.isValid=r.containsUppercaseLetter??!0),r.isValid&&(r.isValid=r.containsNumericCharacter??!0),r.isValid&&(r.isValid=r.containsNonAlphanumericCharacter??!0),r}validatePasswordLengthOptions(e,r){let o=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;o&&(r.meetsMinPasswordLength=e.length>=o),n&&(r.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,r){this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);let o;for(let n=0;n<e.length;n++)o=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(r,o>="a"&&o<="z",o>="A"&&o<="Z",o>="0"&&o<="9",this.allowedNonAlphanumericCharacters.includes(o))}updatePasswordCharacterOptionsStatuses(e,r,o,n,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=r)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=o)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}};var zO=class{constructor(e,r,o,n){this.app=e,this.heartbeatServiceProvider=r,this.appCheckServiceProvider=o,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new G0(this),this.idTokenSubscription=new G0(this),this.beforeStateQueue=new BO(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=MK,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(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,r){return r&&(this._popupRedirectResolver=ql(r)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await j0.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(r),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 r=await U0(this,{idToken:e}),o=await iu._fromGetAccountInfoResponse(this,r,e);await this.directlySetCurrentUser(o)}catch(r){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",r),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Ii(this.app)){let i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}let r=await this.assertedPersistence.getCurrentUser(),o=r,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let i=this.redirectUser?._redirectEventId,a=o?._redirectEventId,s=await this.tryRedirectSignIn(e);(!i||i===a)&&s?.user&&(o=s.user,n=!0)}if(!o)return this.directlySetCurrentUser(null);if(!o._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(o)}catch(i){o=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return o?this.reloadAndSetCurrentUserOrClear(o):this.directlySetCurrentUser(null)}return Ge(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===o._redirectEventId?this.directlySetCurrentUser(o):this.reloadAndSetCurrentUserOrClear(o)}async tryRedirectSignIn(e){let r=null;try{r=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return r}async reloadAndSetCurrentUserOrClear(e){try{await V0(e)}catch(r){if(r?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=vNe()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Ii(this.app))return Promise.reject(Xd(this));let r=e?vr(e):null;return r&&Ge(r.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(r&&r._clone(this))}async _updateCurrentUser(e,r=!1){if(!this._deleted)return e&&Ge(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),r||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Ii(this.app)?Promise.reject(Xd(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Ii(this.app)?Promise.reject(Xd(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ql(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let r=this._getPasswordPolicyInternal();return r.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):r.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await DNe(this),r=new $O(e);this.tenantId===null?this._projectPasswordPolicy=r:this._tenantPasswordPolicies[this.tenantId]=r}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Gl("auth","Firebase",e())}onAuthStateChanged(e,r,o){return this.registerStateListener(this.authStateSubscription,e,r,o)}beforeAuthStateChanged(e,r){return this.beforeStateQueue.pushCallback(e,r)}onIdTokenChanged(e,r,o){return this.registerStateListener(this.idTokenSubscription,e,r,o)}authStateReady(){return new Promise((e,r)=>{if(this.currentUser)e();else{let o=this.onAuthStateChanged(()=>{o(),e()},r)}})}async revokeAccessToken(e){if(this.currentUser){let r=await this.currentUser.getIdToken(),o={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:r};this.tenantId!=null&&(o.tenantId=this.tenantId),await PNe(this,o)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,r){let o=await this.getOrInitRedirectPersistenceManager(r);return e===null?o.removeCurrentUser():o.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let r=e&&ql(e)||this._popupRedirectResolver;Ge(r,this,"argument-error"),this.redirectPersistenceManager=await j0.create(this,[ql(r._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,r,o,n){if(this._deleted)return()=>{};let i=typeof r=="function"?r:r.next.bind(r),a=!1,s=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ge(s,this,"internal-error"),s.then(()=>{a||i(this.currentUser)}),typeof r=="function"){let l=e.addObserver(r,o,n);return()=>{a=!0,l()}}else{let l=e.addObserver(r);return()=>{a=!0,l()}}}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 Ge(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=JK(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 r=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();r&&(e["X-Firebase-Client"]=r);let o=await this._getAppCheckToken();return o&&(e["X-Firebase-AppCheck"]=o),e}async _getAppCheckToken(){if(Ii(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&xNe(`Error while retrieving App Check token: ${e.error}`),e?.token}};function Rm(t){return vr(t)}var G0=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=eK(r=>this.observer=r)}get next(){return Ge(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var cE={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function MNe(t){cE=t}function QK(t){return cE.loadJS(t)}function LNe(){return cE.recaptchaEnterpriseScript}function FNe(){return cE.gapiScript}function ZK(t){return`__${t}${Math.floor(Math.random()*1e6)}`}var UO=class{constructor(){this.enterprise=new VO}ready(e){e()}execute(e,r){return Promise.resolve("token")}render(e,r){return""}},VO=class{ready(e){e()}execute(e,r){return Promise.resolve("token")}render(e,r){return""}};var BNe="recaptcha-enterprise",gx="NO_RECAPTCHA",W0=class{constructor(e){this.type=BNe,this.auth=Rm(e)}async verify(e="verify",r=!1){async function o(i){if(!r){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(a,s)=>{$K(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)s(new Error("recaptcha Enterprise site key undefined"));else{let c=new z0(l);return i.tenantId==null?i._agentRecaptchaConfig=c:i._tenantRecaptchaConfigs[i.tenantId]=c,a(c.siteKey)}}).catch(l=>{s(l)})})}function n(i,a,s){let l=window.grecaptcha;gK(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(c=>{a(c)}).catch(()=>{a(gx)})}):s(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new UO().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{o(this.auth).then(s=>{if(!r&&gK(window.grecaptcha))n(s,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=LNe();l.length!==0&&(l+=s),QK(l).then(()=>{n(s,i,a)}).catch(c=>{a(c)})}}).catch(s=>{a(s)})})}};async function fx(t,e,r,o=!1,n=!1){let i=new W0(t),a;if(n)a=gx;else try{a=await i.verify(r)}catch{a=await i.verify(r,!0)}let s={...e};if(r==="mfaSmsEnrollment"||r==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in s){let l=s.phoneEnrollmentInfo.phoneNumber,c=s.phoneEnrollmentInfo.recaptchaToken;Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:c,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in s){let l=s.phoneSignInInfo.recaptchaToken;Object.assign(s,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return s}return o?Object.assign(s,{captchaResp:a}):Object.assign(s,{captchaResponse:a}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}async function _x(t,e,r,o,n){if(n==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let i=await fx(t,e,r,r==="getOobCode");return o(t,i)}else return o(t,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let a=await fx(t,e,r,r==="getOobCode");return o(t,a)}else return Promise.reject(i)});else if(n==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let i=await fx(t,e,r);return o(t,i).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${r} flow.`);let s=await fx(t,e,r,!1,!0);return o(t,s)}return Promise.reject(a)})}else{let i=await fx(t,e,r,!1,!0);return o(t,i)}else return Promise.reject(n+" provider is not supported.")}async function $Ne(t){let e=Rm(t),r=await $K(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),o=new z0(r);e.tenantId==null?e._agentRecaptchaConfig=o:e._tenantRecaptchaConfigs[e.tenantId]=o,o.isAnyProviderEnabled()&&new W0(e).verify()}function eY(t,e){let r=Yd(t,"auth");if(r.isInitialized()){let n=r.getImmediate(),i=r.getOptions();if(ls(i,e??{}))return n;cs(n,"already-initialized")}return r.initialize({options:e})}function zNe(t,e){let r=e?.persistence||[],o=(Array.isArray(r)?r:[r]).map(ql);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(o,e?.popupRedirectResolver)}function tY(t,e,r){let o=Rm(t);Ge(/^https?:\/\//.test(e),o,"invalid-emulator-scheme");let n=!!r?.disableWarnings,i=rY(e),{host:a,port:s}=UNe(e),l=s===null?"":`:${s}`,c={url:`${i}//${a}${l}/`},u=Object.freeze({host:a,port:s,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:n})});if(!o._canInitEmulator){Ge(o.config.emulator&&o.emulatorConfig,o,"emulator-config-failed"),Ge(ls(c,o.config.emulator)&&ls(u,o.emulatorConfig),o,"emulator-config-failed");return}o.config.emulator=c,o.emulatorConfig=u,o.settings.appVerificationDisabledForTesting=!0,ss(a)?(km(`${i}//${a}${l}`),cx("Auth",!0)):n||VNe()}function rY(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function UNe(t){let e=rY(t),r=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!r)return{host:"",port:null};let o=r[2].split("@").pop()||"",n=/^(\[[^\]]+\])(:|$)/.exec(o);if(n){let i=n[1];return{host:i,port:yK(o.substr(i.length+1))}}else{let[i,a]=o.split(":");return{host:i,port:yK(a)}}}function yK(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function VNe(){function t(){let e=document.createElement("p"),r=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",r.position="fixed",r.width="100%",r.backgroundColor="#ffffff",r.border=".1em solid #000000",r.color="#b50000",r.bottom="0px",r.left="0px",r.margin="0px",r.zIndex="10000",r.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}var Qd=class{constructor(e,r){this.providerId=e,this.signInMethod=r}toJSON(){return Ys("not implemented")}_getIdTokenResponse(e){return Ys("not implemented")}_linkToIdToken(e,r){return Ys("not implemented")}_getReauthenticationResolver(e){return Ys("not implemented")}};async function HNe(t,e){return $n(t,"POST","/v1/accounts:signUp",e)}async function jNe(t,e){return rf(t,"POST","/v1/accounts:signInWithPassword",Xo(t,e))}async function GNe(t,e){return rf(t,"POST","/v1/accounts:signInWithEmailLink",Xo(t,e))}async function WNe(t,e){return rf(t,"POST","/v1/accounts:signInWithEmailLink",Xo(t,e))}var yx=class t extends Qd{constructor(e,r,o,n=null){super("password",o),this._email=e,this._password=r,this._tenantId=n}static _fromEmailAndPassword(e,r){return new t(e,r,"password")}static _fromEmailAndCode(e,r,o=null){return new t(e,r,"emailLink",o)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let r=typeof e=="string"?JSON.parse(e):e;if(r?.email&&r?.password){if(r.signInMethod==="password")return this._fromEmailAndPassword(r.email,r.password);if(r.signInMethod==="emailLink")return this._fromEmailAndCode(r.email,r.password,r.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let r={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return _x(e,r,"signInWithPassword",jNe,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return GNe(e,{email:this._email,oobCode:this._password});default:cs(e,"internal-error")}}async _linkToIdToken(e,r){switch(this.signInMethod){case"password":let o={idToken:r,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return _x(e,o,"signUpPassword",HNe,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return WNe(e,{idToken:r,email:this._email,oobCode:this._password});default:cs(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function Am(t,e){return rf(t,"POST","/v1/accounts:signInWithIdp",Xo(t,e))}var qNe="http://localhost",Zd=class t extends Qd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let r=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(r.idToken=e.idToken),e.accessToken&&(r.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(r.nonce=e.nonce),e.pendingToken&&(r.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(r.accessToken=e.oauthToken,r.secret=e.oauthTokenSecret):cs("argument-error"),r}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let r=typeof e=="string"?JSON.parse(e):e,{providerId:o,signInMethod:n,...i}=r;if(!o||!n)return null;let a=new t(o,n);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){let r=this.buildRequest();return Am(e,r)}_linkToIdToken(e,r){let o=this.buildRequest();return o.idToken=r,Am(e,o)}_getReauthenticationResolver(e){let r=this.buildRequest();return r.autoCreate=!1,Am(e,r)}buildRequest(){let e={requestUri:qNe,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let r={};this.idToken&&(r.id_token=this.idToken),this.accessToken&&(r.access_token=this.accessToken),this.secret&&(r.oauth_token_secret=this.secret),r.providerId=this.providerId,this.nonce&&!this.pendingToken&&(r.nonce=this.nonce),e.postBody=Nm(r)}return e}};async function vK(t,e){return $n(t,"POST","/v1/accounts:sendVerificationCode",Xo(t,e))}async function KNe(t,e){return rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,e))}async function YNe(t,e){let r=await rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,e));if(r.temporaryProof)throw px(t,"account-exists-with-different-credential",r);return r}var XNe={USER_NOT_FOUND:"user-not-found"};async function JNe(t,e){let r={...e,operation:"REAUTH"};return rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,r),XNe)}var vx=class t extends Qd{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,r){return new t({verificationId:e,verificationCode:r})}static _fromTokenResponse(e,r){return new t({phoneNumber:e,temporaryProof:r})}_getIdTokenResponse(e){return KNe(e,this._makeVerificationRequest())}_linkToIdToken(e,r){return YNe(e,{idToken:r,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return JNe(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:r,verificationId:o,verificationCode:n}=this.params;return e&&r?{temporaryProof:e,phoneNumber:r}:{sessionInfo:o,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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:r,verificationCode:o,phoneNumber:n,temporaryProof:i}=e;return!o&&!r&&!n&&!i?null:new t({verificationId:r,verificationCode:o,phoneNumber:n,temporaryProof:i})}};function QNe(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function ZNe(t){let e=Pm(Om(t)).link,r=e?Pm(Om(e)).deep_link_id:null,o=Pm(Om(t)).deep_link_id;return(o?Pm(Om(o)).link:null)||o||r||e||t}var q0=class t{constructor(e){let r=Pm(Om(e)),o=r.apiKey??null,n=r.oobCode??null,i=QNe(r.mode??null);Ge(o&&n&&i,"argument-error"),this.apiKey=o,this.operation=i,this.code=n,this.continueUrl=r.continueUrl??null,this.languageCode=r.lang??null,this.tenantId=r.tenantId??null}static parseLink(e){let r=ZNe(e);try{return new t(r)}catch{return null}}};var Dm=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,r){return yx._fromEmailAndPassword(e,r)}static credentialWithLink(e,r){let o=q0.parseLink(r);return Ge(o,"argument-error"),yx._fromEmailAndCode(e,o.code,o.tenantId)}};Dm.PROVIDER_ID="password";Dm.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Dm.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var K0=class{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}};var ef=class extends K0{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var Ix=class t extends ef{constructor(){super("facebook.com")}static credential(e){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Ix.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ix.PROVIDER_ID="facebook.com";var wx=class t extends ef{constructor(){super("google.com"),this.addScope("profile")}static credential(e,r){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:r})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:r,oauthAccessToken:o}=e;if(!r&&!o)return null;try{return t.credential(r,o)}catch{return null}}};wx.GOOGLE_SIGN_IN_METHOD="google.com";wx.PROVIDER_ID="google.com";var Ex=class t extends ef{constructor(){super("github.com")}static credential(e){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Ex.GITHUB_SIGN_IN_METHOD="github.com";Ex.PROVIDER_ID="github.com";var Sx=class t extends ef{constructor(){super("twitter.com")}static credential(e,r){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:r})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:r,oauthTokenSecret:o}=e;if(!r||!o)return null;try{return t.credential(r,o)}catch{return null}}};Sx.TWITTER_SIGN_IN_METHOD="twitter.com";Sx.PROVIDER_ID="twitter.com";var Cx=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,r,o,n=!1){let i=await iu._fromIdTokenResponse(e,o,n),a=IK(o);return new t({user:i,providerId:a,_tokenResponse:o,operationType:r})}static async _forOperation(e,r,o){await e._updateTokensIfNecessary(o,!0);let n=IK(o);return new t({user:e,providerId:n,_tokenResponse:o,operationType:r})}};function IK(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}var HO=class t extends li{constructor(e,r,o,n){super(r.code,r.message),this.operationType=o,this.user=n,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:r.customData._serverResponse,operationType:o}}static _fromErrorAndOperation(e,r,o,n){return new t(e,r,o,n)}};function oY(t,e,r,o){return(e==="reauthenticate"?r._getReauthenticationResolver(t):r._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?HO._fromErrorAndOperation(t,i,e,o):i})}async function ePe(t,e,r=!1){let o=await xx(t,e._linkToIdToken(t.auth,await t.getIdToken()),r);return Cx._forOperation(t,"link",o)}async function tPe(t,e,r=!1){let{auth:o}=t;if(Ii(o.app))return Promise.reject(Xd(o));let n="reauthenticate";try{let i=await xx(t,oY(o,n,e,t),r);Ge(i.idToken,o,"internal-error");let a=tA(i.idToken);Ge(a,o,"internal-error");let{sub:s}=a;return Ge(t.uid===s,o,"user-mismatch"),Cx._forOperation(t,n,i)}catch(i){throw i?.code==="auth/user-not-found"&&cs(o,"user-mismatch"),i}}async function rPe(t,e,r=!1){if(Ii(t.app))return Promise.reject(Xd(t));let o="signIn",n=await oY(t,o,e),i=await Cx._fromIdTokenResponse(t,o,n);return r||await t._updateCurrentUser(i.user),i}function nY(t,e,r,o){return vr(t).onIdTokenChanged(e,r,o)}function iY(t,e,r){return vr(t).beforeAuthStateChanged(e,r)}function wK(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:start",Xo(t,e))}function oPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:finalize",Xo(t,e))}function nPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:start",Xo(t,e))}function iPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:finalize",Xo(t,e))}var Y0="__sak";var X0=class{constructor(e,r){this.storageRetriever=e,this.type=r}_isAvailable(){try{return this.storage?(this.storage.setItem(Y0,"1"),this.storage.removeItem(Y0),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,r){return this.storage.setItem(e,JSON.stringify(r)),Promise.resolve()}_get(e){let r=this.storage.getItem(e);return Promise.resolve(r?JSON.parse(r):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var aPe=1e3,sPe=10,J0=class extends X0{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,r)=>this.onStorageEvent(e,r),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=XK(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let r of Object.keys(this.listeners)){let o=this.storage.getItem(r),n=this.localCache[r];o!==n&&e(r,n,o)}}onStorageEvent(e,r=!1){if(!e.key){this.forAllChangedKeys((a,s,l)=>{this.notifyListeners(a,l)});return}let o=e.key;r?this.detachListener():this.stopPolling();let n=()=>{let a=this.storage.getItem(o);!r&&this.localCache[o]===a||this.notifyListeners(o,a)},i=this.storage.getItem(o);ANe()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,sPe):n()}notifyListeners(e,r){this.localCache[e]=r;let o=this.listeners[e];if(o)for(let n of Array.from(o))n(r&&JSON.parse(r))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,r,o)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:r,newValue:o}),!0)})},aPe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,r){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(r)}_removeListener(e,r){this.listeners[e]&&(this.listeners[e].delete(r),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,r){await super._set(e,r),this.localCache[e]=JSON.stringify(r)}async _get(e){let r=await super._get(e);return this.localCache[e]=JSON.stringify(r),r}async _remove(e){await super._remove(e),delete this.localCache[e]}};J0.type="LOCAL";var aY=J0;var lPe=1e3;function PO(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=RegExp(`${e}=([^;]+)`);return document.cookie.match(r)?.[1]??null}function OO(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}var jO=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let r=new URL(`${window.location.origin}/__cookies__`);return r.searchParams.set("finalTarget",e),r}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,r){}async _get(e){if(!this._isAvailable())return null;let r=OO(e);return window.cookieStore?(await window.cookieStore.get(r))?.value:PO(r)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let o=OO(e);document.cookie=`${o}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,r){if(!this._isAvailable())return;let o=OO(e);if(window.cookieStore){let s=(c=>{let u=c.changed.find(f=>f.name===o);u&&r(u.value),c.deleted.find(f=>f.name===o)&&r(null)}),l=()=>window.cookieStore.removeEventListener("change",s);return this.listenerUnsubscribes.set(r,l),window.cookieStore.addEventListener("change",s)}let n=PO(o),i=setInterval(()=>{let s=PO(o);s!==n&&(r(s),n=s)},lPe),a=()=>clearInterval(i);this.listenerUnsubscribes.set(r,a)}_removeListener(e,r){let o=this.listenerUnsubscribes.get(r);o&&(o(),this.listenerUnsubscribes.delete(r))}};jO.type="COOKIE";var Q0=class extends X0{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,r){}_removeListener(e,r){}};Q0.type="SESSION";var oA=Q0;function cPe(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(r){return{fulfilled:!1,reason:r}}}))}var Z0=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let r=this.receivers.find(n=>n.isListeningto(e));if(r)return r;let o=new t(e);return this.receivers.push(o),o}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let r=e,{eventId:o,eventType:n,data:i}=r.data,a=this.handlersMap[n];if(!a?.size)return;r.ports[0].postMessage({status:"ack",eventId:o,eventType:n});let s=Array.from(a).map(async c=>c(r.origin,i)),l=await cPe(s);r.ports[0].postMessage({status:"done",eventId:o,eventType:n,response:l})}_subscribe(e,r){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(r)}_unsubscribe(e,r){this.handlersMap[e]&&r&&this.handlersMap[e].delete(r),(!r||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Z0.receivers=[];function nA(t="",e=10){let r="";for(let o=0;o<e;o++)r+=Math.floor(Math.random()*10);return t+r}var GO=class{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,r,o=50){let n=typeof MessageChannel<"u"?new MessageChannel:null;if(!n)throw new Error("connection_unavailable");let i,a;return new Promise((s,l)=>{let c=nA("",20);n.port1.start();let u=setTimeout(()=>{l(new Error("unsupported_event"))},o);a={messageChannel:n,onMessage(d){let f=d;if(f.data.eventId===c)switch(f.data.status){case"ack":clearTimeout(u),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),s(f.data.response);break;default:clearTimeout(u),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),n.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:c,data:r},[n.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};function Js(){return window}function uPe(t){Js().location.href=t}function sY(){return typeof Js().WorkerGlobalScope<"u"&&typeof Js().importScripts=="function"}async function dPe(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function fPe(){return navigator?.serviceWorker?.controller||null}function pPe(){return sY()?self:null}var lY="firebaseLocalStorageDb",mPe=1,eE="firebaseLocalStorage",cY="fbase_key",tf=class{constructor(e){this.request=e}toPromise(){return new Promise((e,r)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{r(this.request.error)})})}};function uE(t,e){return t.transaction([eE],e?"readwrite":"readonly").objectStore(eE)}function hPe(){let t=indexedDB.deleteDatabase(lY);return new tf(t).toPromise()}function WO(){let t=indexedDB.open(lY,mPe);return new Promise((e,r)=>{t.addEventListener("error",()=>{r(t.error)}),t.addEventListener("upgradeneeded",()=>{let o=t.result;try{o.createObjectStore(eE,{keyPath:cY})}catch(n){r(n)}}),t.addEventListener("success",async()=>{let o=t.result;o.objectStoreNames.contains(eE)?e(o):(o.close(),await hPe(),e(await WO()))})})}async function EK(t,e,r){let o=uE(t,!0).put({[cY]:e,value:r});return new tf(o).toPromise()}async function gPe(t,e){let r=uE(t,!1).get(e),o=await new tf(r).toPromise();return o===void 0?null:o.value}function SK(t,e){let r=uE(t,!0).delete(e);return new tf(r).toPromise()}var _Pe=800,xPe=3,tE=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await WO(),this.db)}async _withRetries(e){let r=0;for(;;)try{let o=await this._openDb();return await e(o)}catch(o){if(r++>xPe)throw o;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return sY()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Z0._getInstance(pPe()),this.receiver._subscribe("keyChanged",async(e,r)=>({keyProcessed:(await this._poll()).includes(r.key)})),this.receiver._subscribe("ping",async(e,r)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await dPe(),!this.activeServiceWorker)return;this.sender=new GO(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||fPe()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await WO();return await EK(e,Y0,"1"),await SK(e,Y0),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,r){return this._withPendingWrite(async()=>(await this._withRetries(o=>EK(o,e,r)),this.localCache[e]=r,this.notifyServiceWorker(e)))}async _get(e){let r=await this._withRetries(o=>gPe(o,e));return this.localCache[e]=r,r}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(r=>SK(r,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(n=>{let i=uE(n,!1).getAll();return new tf(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let r=[],o=new Set;if(e.length!==0)for(let{fbase_key:n,value:i}of e)o.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),r.push(n));for(let n of Object.keys(this.localCache))this.localCache[n]&&!o.has(n)&&(this.notifyListeners(n,null),r.push(n));return r}notifyListeners(e,r){this.localCache[e]=r;let o=this.listeners[e];if(o)for(let n of Array.from(o))n(r)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),_Pe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,r){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(r)}_removeListener(e,r){this.listeners[e]&&(this.listeners[e].delete(r),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};tE.type="LOCAL";var uY=tE;function CK(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:start",Xo(t,e))}function bPe(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:finalize",Xo(t,e))}function yPe(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:finalize",Xo(t,e))}var Wwt=ZK("rcb"),qwt=new Jd(3e4,6e4);var M0="recaptcha";async function vPe(t,e,r){if(!t._getRecaptchaConfig())try{await $Ne(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let o;if(typeof e=="string"?o={phoneNumber:e}:o=e,"session"in o){let n=o.session;if("phoneNumber"in o){Ge(n.type==="enroll",t,"internal-error");let i={idToken:n.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await _x(t,i,"mfaSmsEnrollment",async(c,u)=>{if(u.phoneEnrollmentInfo.captchaResponse===gx){Ge(r?.type===M0,c,"argument-error");let d=await AO(c,u,r);return wK(c,d)}return wK(c,u)},"PHONE_PROVIDER").catch(c=>Promise.reject(c))).phoneSessionInfo.sessionInfo}else{Ge(n.type==="signin",t,"internal-error");let i=o.multiFactorHint?.uid||o.multiFactorUid;Ge(i,t,"missing-multi-factor-info");let a={mfaPendingCredential:n.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await _x(t,a,"mfaSmsSignIn",async(u,d)=>{if(d.phoneSignInInfo.captchaResponse===gx){Ge(r?.type===M0,u,"argument-error");let f=await AO(u,d,r);return CK(u,f)}return CK(u,d)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneResponseInfo.sessionInfo}}else{let n={phoneNumber:o.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await _x(t,n,"sendVerificationCode",async(l,c)=>{if(c.captchaResponse===gx){Ge(r?.type===M0,l,"argument-error");let u=await AO(l,c,r);return vK(l,u)}return vK(l,c)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{r?._reset()}}async function AO(t,e,r){Ge(r.type===M0,t,"argument-error");let o=await r.verify();Ge(typeof o=="string",t,"argument-error");let n={...e};if("phoneEnrollmentInfo"in n){let i=n.phoneEnrollmentInfo.phoneNumber,a=n.phoneEnrollmentInfo.captchaResponse,s=n.phoneEnrollmentInfo.clientType,l=n.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(n,{phoneEnrollmentInfo:{phoneNumber:i,recaptchaToken:o,captchaResponse:a,clientType:s,recaptchaVersion:l}}),n}else if("phoneSignInInfo"in n){let i=n.phoneSignInInfo.captchaResponse,a=n.phoneSignInInfo.clientType,s=n.phoneSignInInfo.recaptchaVersion;return Object.assign(n,{phoneSignInInfo:{recaptchaToken:o,captchaResponse:i,clientType:a,recaptchaVersion:s}}),n}else return Object.assign(n,{recaptchaToken:o}),n}var Tx=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=Rm(e)}verifyPhoneNumber(e,r){return vPe(this.auth,e,vr(r))}static credential(e,r){return vx._fromVerification(e,r)}static credentialFromResult(e){let r=e;return t.credentialFromTaggedObject(r)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:r,temporaryProof:o}=e;return r&&o?vx._fromTokenResponse(r,o):null}};Tx.PROVIDER_ID="phone";Tx.PHONE_SIGN_IN_METHOD="phone";function IPe(t,e){return e?ql(e):(Ge(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}var kx=class extends Qd{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Am(e,this._buildIdpRequest())}_linkToIdToken(e,r){return Am(e,this._buildIdpRequest(r))}_getReauthenticationResolver(e){return Am(e,this._buildIdpRequest())}_buildIdpRequest(e){let r={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&&(r.idToken=e),r}};function wPe(t){return rPe(t.auth,new kx(t),t.bypassAuthState)}function EPe(t){let{auth:e,user:r}=t;return Ge(r,e,"internal-error"),tPe(r,new kx(t),t.bypassAuthState)}async function SPe(t){let{auth:e,user:r}=t;return Ge(r,e,"internal-error"),ePe(r,new kx(t),t.bypassAuthState)}var rE=class{constructor(e,r,o,n,i=!1){this.auth=e,this.resolver=o,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(r)?r:[r]}execute(){return new Promise(async(e,r)=>{this.pendingPromise={resolve:e,reject:r};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(o){this.reject(o)}})}async onAuthEvent(e){let{urlResponse:r,sessionId:o,postBody:n,tenantId:i,error:a,type:s}=e;if(a){this.reject(a);return}let l={auth:this.auth,requestUri:r,sessionId:o,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return wPe;case"linkViaPopup":case"linkViaRedirect":return SPe;case"reauthViaPopup":case"reauthViaRedirect":return EPe;default:cs(this.auth,"internal-error")}}resolve(e){Kl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Kl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var CPe=new Jd(2e3,1e4);var qO=class t extends rE{constructor(e,r,o,n,i){super(e,r,n,i),this.provider=o,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return Ge(e,this.auth,"internal-error"),e}async onExecution(){Kl(this.filter.length===1,"Popup operations only handle one event");let e=nA();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(r=>{this.reject(r)}),this.resolver._isIframeWebStorageSupported(this.auth,r=>{r||this.reject(Xs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Xs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Xs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,CPe.get())};e()}};qO.currentPopupAction=null;var TPe="pendingRedirect",L0=new Map,KO=class extends rE{constructor(e,r,o=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],r,void 0,o),this.eventId=null}async execute(){let e=L0.get(this.auth._key());if(!e){try{let o=await kPe(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(o)}catch(r){e=()=>Promise.reject(r)}L0.set(this.auth._key(),e)}return this.bypassAuthState||L0.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let r=await this.auth._redirectUserForId(e.eventId);if(r)return this.user=r,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function kPe(t,e){let r=OPe(e),o=PPe(t);if(!await o._isAvailable())return!1;let n=await o._get(r)==="true";return await o._remove(r),n}function NPe(t,e){L0.set(t._key(),e)}function PPe(t){return ql(t._redirectPersistence)}function OPe(t){return R0(TPe,t.config.apiKey,t.name)}async function APe(t,e,r=!1){if(Ii(t.app))return Promise.reject(Xd(t));let o=Rm(t),n=IPe(o,e),a=await new KO(o,n,r).execute();return a&&!r&&(delete a.user._redirectEventId,await o._persistUserIfCurrent(a.user),await o._setRedirectUser(null,e)),a}var DPe=600*1e3,YO=class{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 r=!1;return this.consumers.forEach(o=>{this.isEventForConsumer(e,o)&&(r=!0,this.sendToConsumer(e,o),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!RPe(e)||(this.hasHandledPotentialRedirect=!0,r||(this.queuedRedirectEvent=e,r=!0)),r}sendToConsumer(e,r){if(e.error&&!dY(e)){let o=e.error.code?.split("auth/")[1]||"internal-error";r.onError(Xs(this.auth,o))}else r.onAuthEvent(e)}isEventForConsumer(e,r){let o=r.eventId===null||!!e.eventId&&e.eventId===r.eventId;return r.filter.includes(e.type)&&o}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=DPe&&this.cachedEventUids.clear(),this.cachedEventUids.has(TK(e))}saveEventToCache(e){this.cachedEventUids.add(TK(e)),this.lastProcessedEventTime=Date.now()}};function TK(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function dY({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function RPe(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return dY(t);default:return!1}}async function MPe(t,e={}){return $n(t,"GET","/v1/projects",e)}var LPe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,FPe=/^https?/;async function BPe(t){if(t.config.emulator)return;let{authorizedDomains:e}=await MPe(t);for(let r of e)try{if($Pe(r))return}catch{}cs(t,"unauthorized-domain")}function $Pe(t){let e=RO(),{protocol:r,hostname:o}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&o===""?r==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):r==="chrome-extension:"&&a.hostname===o}if(!FPe.test(r))return!1;if(LPe.test(t))return o===t;let n=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+n+"|"+n+")$","i").test(o)}var zPe=new Jd(3e4,6e4);function kK(){let t=Js().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let r=0;r<t.CP.length;r++)t.CP[r]=null}}function UPe(t){return new Promise((e,r)=>{function o(){kK(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{kK(),r(Xs(t,"network-request-failed"))},timeout:zPe.get()})}if(Js().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(Js().gapi?.load)o();else{let n=ZK("iframefcb");return Js()[n]=()=>{gapi.load?o():r(Xs(t,"network-request-failed"))},QK(`${FNe()}?onload=${n}`).catch(i=>r(i))}}).catch(e=>{throw F0=null,e})}var F0=null;function VPe(t){return F0=F0||UPe(t),F0}var HPe=new Jd(5e3,15e3),jPe="__/auth/iframe",GPe="emulator/auth/iframe",WPe={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qPe=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function KPe(t){let e=t.config;Ge(e.authDomain,t,"auth-domain-config-required");let r=e.emulator?eA(e,GPe):`https://${t.config.authDomain}/${jPe}`,o={apiKey:e.apiKey,appName:t.name,v:Ks},n=qPe.get(t.config.apiHost);n&&(o.eid=n);let i=t._getFrameworks();return i.length&&(o.fw=i.join(",")),`${r}?${Nm(o).slice(1)}`}async function YPe(t){let e=await VPe(t),r=Js().gapi;return Ge(r,t,"internal-error"),e.open({where:document.body,url:KPe(t),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:WPe,dontclear:!0},o=>new Promise(async(n,i)=>{await o.restyle({setHideOnLeave:!1});let a=Xs(t,"network-request-failed"),s=Js().setTimeout(()=>{i(a)},HPe.get());function l(){Js().clearTimeout(s),n(o)}o.ping(l).then(l,()=>{i(a)})}))}var XPe={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},JPe=500,QPe=600,ZPe="_blank",eOe="http://localhost",oE=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function tOe(t,e,r,o=JPe,n=QPe){let i=Math.max((window.screen.availHeight-n)/2,0).toString(),a=Math.max((window.screen.availWidth-o)/2,0).toString(),s="",l={...XPe,width:o.toString(),height:n.toString(),top:i,left:a},c=Yo().toLowerCase();r&&(s=GK(c)?ZPe:r),HK(c)&&(e=e||eOe,l.scrollbars="yes");let u=Object.entries(l).reduce((f,[m,h])=>`${f}${m}=${h},`,"");if(ONe(c)&&s!=="_self")return rOe(e||"",s),new oE(null);let d=window.open(e||"",s,u);Ge(d,t,"popup-blocked");try{d.focus()}catch{}return new oE(d)}function rOe(t,e){let r=document.createElement("a");r.href=t,r.target=e;let o=document.createEvent("MouseEvent");o.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(o)}var oOe="__/auth/handler",nOe="emulator/auth/handler",iOe=encodeURIComponent("fac");async function NK(t,e,r,o,n,i){Ge(t.config.authDomain,t,"auth-domain-config-required"),Ge(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:r,redirectUrl:o,v:Ks,eventId:n};if(e instanceof K0){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",Zq(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[u,d]of Object.entries(i||{}))a[u]=d}if(e instanceof ef){let u=e.getScopes().filter(d=>d!=="");u.length>0&&(a.scopes=u.join(","))}t.tenantId&&(a.tid=t.tenantId);let s=a;for(let u of Object.keys(s))s[u]===void 0&&delete s[u];let l=await t._getAppCheckToken(),c=l?`#${iOe}=${encodeURIComponent(l)}`:"";return`${aOe(t)}?${Nm(s).slice(1)}${c}`}function aOe({config:t}){return t.emulator?eA(t,nOe):`https://${t.authDomain}/${oOe}`}var DO="webStorageSupport",XO=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=oA,this._completeRedirectFn=APe,this._overrideRedirectResult=NPe}async _openPopup(e,r,o,n){Kl(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let i=await NK(e,r,o,RO(),n);return tOe(e,i,nA())}async _openRedirect(e,r,o,n){await this._originValidation(e);let i=await NK(e,r,o,RO(),n);return uPe(i),new Promise(()=>{})}_initialize(e){let r=e._key();if(this.eventManagers[r]){let{manager:n,promise:i}=this.eventManagers[r];return n?Promise.resolve(n):(Kl(i,"If manager is not set, promise should be"),i)}let o=this.initAndGetManager(e);return this.eventManagers[r]={promise:o},o.catch(()=>{delete this.eventManagers[r]}),o}async initAndGetManager(e){let r=await YPe(e),o=new YO(e);return r.register("authEvent",n=>(Ge(n?.authEvent,e,"invalid-auth-event"),{status:o.onEvent(n.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:o},this.iframes[e._key()]=r,o}_isIframeWebStorageSupported(e,r){this.iframes[e._key()].send(DO,{type:DO},n=>{let i=n?.[0]?.[DO];i!==void 0&&r(!!i),cs(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let r=e._key();return this.originValidationPromises[r]||(this.originValidationPromises[r]=BPe(e)),this.originValidationPromises[r]}get _shouldInitProactively(){return XK()||jK()||rA()}},fY=XO,nE=class{constructor(e){this.factorId=e}_process(e,r,o){switch(r.type){case"enroll":return this._finalizeEnroll(e,r.credential,o);case"signin":return this._finalizeSignIn(e,r.credential);default:return Ys("unexpected MultiFactorSessionType")}}},JO=class t extends nE{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,r,o){return oPe(e,{idToken:r,displayName:o,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,r){return bPe(e,{mfaPendingCredential:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},iE=class{constructor(){}static assertion(e){return JO._fromCredential(e)}};iE.FACTOR_ID="phone";var aE=class{static assertionForEnrollment(e,r){return sE._fromSecret(e,r)}static assertionForSignIn(e,r){return sE._fromEnrollmentId(e,r)}static async generateSecret(e){let r=e;Ge(typeof r.user?.auth<"u","internal-error");let o=await nPe(r.user.auth,{idToken:r.credential,totpEnrollmentInfo:{}});return lE._fromStartTotpMfaEnrollmentResponse(o,r.user.auth)}};aE.FACTOR_ID="totp";var sE=class t extends nE{constructor(e,r,o){super("totp"),this.otp=e,this.enrollmentId=r,this.secret=o}static _fromSecret(e,r){return new t(r,void 0,e)}static _fromEnrollmentId(e,r){return new t(r,e)}async _finalizeEnroll(e,r,o){return Ge(typeof this.secret<"u",e,"argument-error"),iPe(e,{idToken:r,displayName:o,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,r){Ge(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let o={verificationCode:this.otp};return yPe(e,{mfaPendingCredential:r,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:o})}},lE=class t{constructor(e,r,o,n,i,a,s){this.sessionInfo=a,this.auth=s,this.secretKey=e,this.hashingAlgorithm=r,this.codeLength=o,this.codeIntervalSeconds=n,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(e,r){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,r)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,r){let o=!1;return(A0(e)||A0(r))&&(o=!0),o&&(A0(e)&&(e=this.auth.currentUser?.email||"unknownuser"),A0(r)&&(r=this.auth.name)),`otpauth://totp/${r}:${e}?secret=${this.secretKey}&issuer=${r}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function A0(t){return typeof t>"u"||t?.length===0}var PK="@firebase/auth",OK="1.11.0";var QO=class{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 r=this.auth.onIdTokenChanged(o=>{e(o?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,r),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let r=this.internalListeners.get(e);r&&(this.internalListeners.delete(e),r(),this.updateProactiveRefresh())}assertAuthConfigured(){Ge(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function sOe(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function lOe(t){qs(new yi("auth",(e,{options:r})=>{let o=e.getProvider("app").getImmediate(),n=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:s}=o.options;Ge(a&&!a.includes(":"),"invalid-api-key",{appName:o.name});let l={apiKey:a,authDomain:s,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:JK(t)},c=new zO(o,n,i,l);return zNe(c,r),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,r,o)=>{e.getProvider("auth-internal").initialize()})),qs(new yi("auth-internal",e=>{let r=Rm(e.getProvider("auth").getImmediate());return(o=>new QO(o))(r)},"PRIVATE").setInstantiationMode("EXPLICIT")),vi(PK,OK,sOe(t)),vi(PK,OK,"esm2020")}var cOe=300,uOe=dO("authIdTokenMaxAge")||cOe,AK=null,dOe=t=>async e=>{let r=e&&await e.getIdTokenResult(),o=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(o&&o>uOe)return;let n=r?.token;AK!==n&&(AK=n,await fetch(t,{method:n?"POST":"DELETE",headers:n?{Authorization:`Bearer ${n}`}:{}}))};function iA(t=dx()){let e=Yd(t,"auth");if(e.isInitialized())return e.getImmediate();let r=eY(t,{popupRedirectResolver:fY,persistence:[uY,aY,oA]}),o=dO("authTokenSyncURL");if(o&&typeof isSecureContext=="boolean"&&isSecureContext){let i=new URL(o,location.origin);if(location.origin===i.origin){let a=dOe(i.toString());iY(r,a,()=>a(r.currentUser)),nY(r,s=>a(s))}}let n=lO("auth");return n&&tY(r,`http://${n}`),r}function fOe(){return document.getElementsByTagName("head")?.[0]??document}MNe({loadJS(t){return new Promise((e,r)=>{let o=document.createElement("script");o.setAttribute("src",t),o.onload=e,o.onerror=n=>{let i=Xs("internal-error");i.customData=n,r(i)},o.type="text/javascript",o.charset="UTF-8",fOe().appendChild(o)})},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="});lOe("Browser");var pY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},mY={};var Yl,aA;(function(){var t;function e(E,w){function S(){}S.prototype=w.prototype,E.D=w.prototype,E.prototype=new S,E.prototype.constructor=E,E.C=function(T,A,R){for(var P=Array(arguments.length-2),B=2;B<arguments.length;B++)P[B-2]=arguments[B];return w.prototype[A].apply(T,P)}}function r(){this.blockSize=-1}function o(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(o,r),o.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function n(E,w,S){S||(S=0);var T=Array(16);if(typeof w=="string")for(var A=0;16>A;++A)T[A]=w.charCodeAt(S++)|w.charCodeAt(S++)<<8|w.charCodeAt(S++)<<16|w.charCodeAt(S++)<<24;else for(A=0;16>A;++A)T[A]=w[S++]|w[S++]<<8|w[S++]<<16|w[S++]<<24;w=E.g[0],S=E.g[1],A=E.g[2];var R=E.g[3],P=w+(R^S&(A^R))+T[0]+3614090360&4294967295;w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[1]+3905402710&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[2]+606105819&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[3]+3250441966&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[4]+4118548399&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[5]+1200080426&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[6]+2821735955&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[7]+4249261313&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[8]+1770035416&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[9]+2336552879&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[10]+4294925233&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[11]+2304563134&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[12]+1804603682&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[13]+4254626195&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[14]+2792965006&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[15]+1236535329&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(A^R&(S^A))+T[1]+4129170786&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[6]+3225465664&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[11]+643717713&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[0]+3921069994&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[5]+3593408605&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[10]+38016083&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[15]+3634488961&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[4]+3889429448&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[9]+568446438&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[14]+3275163606&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[3]+4107603335&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[8]+1163531501&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[13]+2850285829&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[2]+4243563512&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[7]+1735328473&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[12]+2368359562&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(S^A^R)+T[5]+4294588738&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[8]+2272392833&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[11]+1839030562&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[14]+4259657740&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[1]+2763975236&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[4]+1272893353&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[7]+4139469664&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[10]+3200236656&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[13]+681279174&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[0]+3936430074&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[3]+3572445317&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[6]+76029189&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[9]+3654602809&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[12]+3873151461&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[15]+530742520&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[2]+3299628645&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(A^(S|~R))+T[0]+4096336452&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[7]+1126891415&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[14]+2878612391&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[5]+4237533241&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[12]+1700485571&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[3]+2399980690&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[10]+4293915773&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[1]+2240044497&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[8]+1873313359&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[15]+4264355552&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[6]+2734768916&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[13]+1309151649&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[4]+4149444226&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[11]+3174756917&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[2]+718787259&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[9]+3951481745&4294967295,E.g[0]=E.g[0]+w&4294967295,E.g[1]=E.g[1]+(A+(P<<21&4294967295|P>>>11))&4294967295,E.g[2]=E.g[2]+A&4294967295,E.g[3]=E.g[3]+R&4294967295}o.prototype.u=function(E,w){w===void 0&&(w=E.length);for(var S=w-this.blockSize,T=this.B,A=this.h,R=0;R<w;){if(A==0)for(;R<=S;)n(this,E,R),R+=this.blockSize;if(typeof E=="string"){for(;R<w;)if(T[A++]=E.charCodeAt(R++),A==this.blockSize){n(this,T),A=0;break}}else for(;R<w;)if(T[A++]=E[R++],A==this.blockSize){n(this,T),A=0;break}}this.h=A,this.o+=w},o.prototype.v=function(){var E=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);E[0]=128;for(var w=1;w<E.length-8;++w)E[w]=0;var S=8*this.o;for(w=E.length-8;w<E.length;++w)E[w]=S&255,S/=256;for(this.u(E),E=Array(16),w=S=0;4>w;++w)for(var T=0;32>T;T+=8)E[S++]=this.g[w]>>>T&255;return E};function i(E,w){var S=s;return Object.prototype.hasOwnProperty.call(S,E)?S[E]:S[E]=w(E)}function a(E,w){this.h=w;for(var S=[],T=!0,A=E.length-1;0<=A;A--){var R=E[A]|0;T&&R==w||(S[A]=R,T=!1)}this.g=S}var s={};function l(E){return-128<=E&&128>E?i(E,function(w){return new a([w|0],0>w?-1:0)}):new a([E|0],0>E?-1:0)}function c(E){if(isNaN(E)||!isFinite(E))return d;if(0>E)return _(c(-E));for(var w=[],S=1,T=0;E>=S;T++)w[T]=E/S|0,S*=4294967296;return new a(w,0)}function u(E,w){if(E.length==0)throw Error("number format error: empty string");if(w=w||10,2>w||36<w)throw Error("radix out of range: "+w);if(E.charAt(0)=="-")return _(u(E.substring(1),w));if(0<=E.indexOf("-"))throw Error('number format error: interior "-" character');for(var S=c(Math.pow(w,8)),T=d,A=0;A<E.length;A+=8){var R=Math.min(8,E.length-A),P=parseInt(E.substring(A,A+R),w);8>R?(R=c(Math.pow(w,R)),T=T.j(R).add(c(P))):(T=T.j(S),T=T.add(c(P)))}return T}var d=l(0),f=l(1),m=l(16777216);t=a.prototype,t.m=function(){if(g(this))return-_(this).m();for(var E=0,w=1,S=0;S<this.g.length;S++){var T=this.i(S);E+=(0<=T?T:4294967296+T)*w,w*=4294967296}return E},t.toString=function(E){if(E=E||10,2>E||36<E)throw Error("radix out of range: "+E);if(h(this))return"0";if(g(this))return"-"+_(this).toString(E);for(var w=c(Math.pow(E,6)),S=this,T="";;){var A=C(S,w).g;S=b(S,A.j(w));var R=((0<S.g.length?S.g[0]:S.h)>>>0).toString(E);if(S=A,h(S))return R+T;for(;6>R.length;)R="0"+R;T=R+T}},t.i=function(E){return 0>E?0:E<this.g.length?this.g[E]:this.h};function h(E){if(E.h!=0)return!1;for(var w=0;w<E.g.length;w++)if(E.g[w]!=0)return!1;return!0}function g(E){return E.h==-1}t.l=function(E){return E=b(this,E),g(E)?-1:h(E)?0:1};function _(E){for(var w=E.g.length,S=[],T=0;T<w;T++)S[T]=~E.g[T];return new a(S,~E.h).add(f)}t.abs=function(){return g(this)?_(this):this},t.add=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0,A=0;A<=w;A++){var R=T+(this.i(A)&65535)+(E.i(A)&65535),P=(R>>>16)+(this.i(A)>>>16)+(E.i(A)>>>16);T=P>>>16,R&=65535,P&=65535,S[A]=P<<16|R}return new a(S,S[S.length-1]&-2147483648?-1:0)};function b(E,w){return E.add(_(w))}t.j=function(E){if(h(this)||h(E))return d;if(g(this))return g(E)?_(this).j(_(E)):_(_(this).j(E));if(g(E))return _(this.j(_(E)));if(0>this.l(m)&&0>E.l(m))return c(this.m()*E.m());for(var w=this.g.length+E.g.length,S=[],T=0;T<2*w;T++)S[T]=0;for(T=0;T<this.g.length;T++)for(var A=0;A<E.g.length;A++){var R=this.i(T)>>>16,P=this.i(T)&65535,B=E.i(A)>>>16,$=E.i(A)&65535;S[2*T+2*A]+=P*$,y(S,2*T+2*A),S[2*T+2*A+1]+=R*$,y(S,2*T+2*A+1),S[2*T+2*A+1]+=P*B,y(S,2*T+2*A+1),S[2*T+2*A+2]+=R*B,y(S,2*T+2*A+2)}for(T=0;T<w;T++)S[T]=S[2*T+1]<<16|S[2*T];for(T=w;T<2*w;T++)S[T]=0;return new a(S,0)};function y(E,w){for(;(E[w]&65535)!=E[w];)E[w+1]+=E[w]>>>16,E[w]&=65535,w++}function v(E,w){this.g=E,this.h=w}function C(E,w){if(h(w))throw Error("division by zero");if(h(E))return new v(d,d);if(g(E))return w=C(_(E),w),new v(_(w.g),_(w.h));if(g(w))return w=C(E,_(w)),new v(_(w.g),w.h);if(30<E.g.length){if(g(E)||g(w))throw Error("slowDivide_ only works with positive integers.");for(var S=f,T=w;0>=T.l(E);)S=N(S),T=N(T);var A=I(S,1),R=I(T,1);for(T=I(T,2),S=I(S,2);!h(T);){var P=R.add(T);0>=P.l(E)&&(A=A.add(S),R=P),T=I(T,1),S=I(S,1)}return w=b(E,A.j(w)),new v(A,w)}for(A=d;0<=E.l(w);){for(S=Math.max(1,Math.floor(E.m()/w.m())),T=Math.ceil(Math.log(S)/Math.LN2),T=48>=T?1:Math.pow(2,T-48),R=c(S),P=R.j(w);g(P)||0<P.l(E);)S-=T,R=c(S),P=R.j(w);h(R)&&(R=f),A=A.add(R),E=b(E,P)}return new v(A,E)}t.A=function(E){return C(this,E).h},t.and=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)&E.i(T);return new a(S,this.h&E.h)},t.or=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)|E.i(T);return new a(S,this.h|E.h)},t.xor=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)^E.i(T);return new a(S,this.h^E.h)};function N(E){for(var w=E.g.length+1,S=[],T=0;T<w;T++)S[T]=E.i(T)<<1|E.i(T-1)>>>31;return new a(S,E.h)}function I(E,w){var S=w>>5;w%=32;for(var T=E.g.length-S,A=[],R=0;R<T;R++)A[R]=0<w?E.i(R+S)>>>w|E.i(R+S+1)<<32-w:E.i(R+S);return new a(A,E.h)}o.prototype.digest=o.prototype.v,o.prototype.reset=o.prototype.s,o.prototype.update=o.prototype.u,aA=mY.Md5=o,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,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=u,Yl=mY.Integer=a}).apply(typeof pY<"u"?pY:typeof self<"u"?self:typeof window<"u"?window:{});var dE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xl={};var sA,pOe,Mm,lA,Nx,fE,cA,uA,dA;(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(x,k,O){return x==Array.prototype||x==Object.prototype||(x[k]=O.value),x};function r(x){x=[typeof globalThis=="object"&&globalThis,x,typeof window=="object"&&window,typeof self=="object"&&self,typeof dE=="object"&&dE];for(var k=0;k<x.length;++k){var O=x[k];if(O&&O.Math==Math)return O}throw Error("Cannot find global object")}var o=r(this);function n(x,k){if(k)e:{var O=o;x=x.split(".");for(var F=0;F<x.length-1;F++){var K=x[F];if(!(K in O))break e;O=O[K]}x=x[x.length-1],F=O[x],k=k(F),k!=F&&k!=null&&e(O,x,{configurable:!0,writable:!0,value:k})}}function i(x,k){x instanceof String&&(x+="");var O=0,F=!1,K={next:function(){if(!F&&O<x.length){var Z=O++;return{value:k(Z,x[Z]),done:!1}}return F=!0,{done:!0,value:void 0}}};return K[Symbol.iterator]=function(){return K},K}n("Array.prototype.values",function(x){return x||function(){return i(this,function(k,O){return O})}});var a=a||{},s=this||self;function l(x){var k=typeof x;return k=k!="object"?k:x?Array.isArray(x)?"array":k:"null",k=="array"||k=="object"&&typeof x.length=="number"}function c(x){var k=typeof x;return k=="object"&&x!=null||k=="function"}function u(x,k,O){return x.call.apply(x.bind,arguments)}function d(x,k,O){if(!x)throw Error();if(2<arguments.length){var F=Array.prototype.slice.call(arguments,2);return function(){var K=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(K,F),x.apply(k,K)}}return function(){return x.apply(k,arguments)}}function f(x,k,O){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:d,f.apply(null,arguments)}function m(x,k){var O=Array.prototype.slice.call(arguments,1);return function(){var F=O.slice();return F.push.apply(F,arguments),x.apply(this,F)}}function h(x,k){function O(){}O.prototype=k.prototype,x.aa=k.prototype,x.prototype=new O,x.prototype.constructor=x,x.Qb=function(F,K,Z){for(var be=Array(arguments.length-2),xr=2;xr<arguments.length;xr++)be[xr-2]=arguments[xr];return k.prototype[K].apply(F,be)}}function g(x){let k=x.length;if(0<k){let O=Array(k);for(let F=0;F<k;F++)O[F]=x[F];return O}return[]}function _(x,k){for(let O=1;O<arguments.length;O++){let F=arguments[O];if(l(F)){let K=x.length||0,Z=F.length||0;x.length=K+Z;for(let be=0;be<Z;be++)x[K+be]=F[be]}else x.push(F)}}class b{constructor(k,O){this.i=k,this.j=O,this.h=0,this.g=null}get(){let k;return 0<this.h?(this.h--,k=this.g,this.g=k.next,k.next=null):k=this.i(),k}}function y(x){return/^[\s\xa0]*$/.test(x)}function v(){var x=s.navigator;return x&&(x=x.userAgent)?x:""}function C(x){return C[" "](x),x}C[" "]=function(){};var N=v().indexOf("Gecko")!=-1&&!(v().toLowerCase().indexOf("webkit")!=-1&&v().indexOf("Edge")==-1)&&!(v().indexOf("Trident")!=-1||v().indexOf("MSIE")!=-1)&&v().indexOf("Edge")==-1;function I(x,k,O){for(let F in x)k.call(O,x[F],F,x)}function E(x,k){for(let O in x)k.call(void 0,x[O],O,x)}function w(x){let k={};for(let O in x)k[O]=x[O];return k}let S="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(x,k){let O,F;for(let K=1;K<arguments.length;K++){F=arguments[K];for(O in F)x[O]=F[O];for(let Z=0;Z<S.length;Z++)O=S[Z],Object.prototype.hasOwnProperty.call(F,O)&&(x[O]=F[O])}}function A(x){var k=1;x=x.split(":");let O=[];for(;0<k&&x.length;)O.push(x.shift()),k--;return x.length&&O.push(x.join(":")),O}function R(x){s.setTimeout(()=>{throw x},0)}function P(){var x=Y;let k=null;return x.g&&(k=x.g,x.g=x.g.next,x.g||(x.h=null),k.next=null),k}class B{constructor(){this.h=this.g=null}add(k,O){let F=$.get();F.set(k,O),this.h?this.h.next=F:this.g=F,this.h=F}}var $=new b(()=>new z,x=>x.reset());class z{constructor(){this.next=this.g=this.h=null}set(k,O){this.h=k,this.g=O,this.next=null}reset(){this.next=this.g=this.h=null}}let H,G=!1,Y=new B,L=()=>{let x=s.Promise.resolve(void 0);H=()=>{x.then(ne)}};var ne=()=>{for(var x;x=P();){try{x.h.call(x.g)}catch(O){R(O)}var k=$;k.j(x),100>k.h&&(k.h++,x.next=k.g,k.g=x)}G=!1};function ae(){this.s=this.s,this.C=this.C}ae.prototype.s=!1,ae.prototype.ma=function(){this.s||(this.s=!0,this.N())},ae.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function U(x,k){this.type=x,this.g=this.target=k,this.defaultPrevented=!1}U.prototype.h=function(){this.defaultPrevented=!0};var ge=(function(){if(!s.addEventListener||!Object.defineProperty)return!1;var x=!1,k=Object.defineProperty({},"passive",{get:function(){x=!0}});try{let O=()=>{};s.addEventListener("test",O,k),s.removeEventListener("test",O,k)}catch{}return x})();function Ce(x,k){if(U.call(this,x?x.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,x){var O=this.type=x.type,F=x.changedTouches&&x.changedTouches.length?x.changedTouches[0]:null;if(this.target=x.target||x.srcElement,this.g=k,k=x.relatedTarget){if(N){e:{try{C(k.nodeName);var K=!0;break e}catch{}K=!1}K||(k=null)}}else O=="mouseover"?k=x.fromElement:O=="mouseout"&&(k=x.toElement);this.relatedTarget=k,F?(this.clientX=F.clientX!==void 0?F.clientX:F.pageX,this.clientY=F.clientY!==void 0?F.clientY:F.pageY,this.screenX=F.screenX||0,this.screenY=F.screenY||0):(this.clientX=x.clientX!==void 0?x.clientX:x.pageX,this.clientY=x.clientY!==void 0?x.clientY:x.pageY,this.screenX=x.screenX||0,this.screenY=x.screenY||0),this.button=x.button,this.key=x.key||"",this.ctrlKey=x.ctrlKey,this.altKey=x.altKey,this.shiftKey=x.shiftKey,this.metaKey=x.metaKey,this.pointerId=x.pointerId||0,this.pointerType=typeof x.pointerType=="string"?x.pointerType:He[x.pointerType]||"",this.state=x.state,this.i=x,x.defaultPrevented&&Ce.aa.h.call(this)}}h(Ce,U);var He={2:"touch",3:"pen",4:"mouse"};Ce.prototype.h=function(){Ce.aa.h.call(this);var x=this.i;x.preventDefault?x.preventDefault():x.returnValue=!1};var Qe="closure_listenable_"+(1e6*Math.random()|0),Me=0;function ke(x,k,O,F,K){this.listener=x,this.proxy=null,this.src=k,this.type=O,this.capture=!!F,this.ha=K,this.key=++Me,this.da=this.fa=!1}function at(x){x.da=!0,x.listener=null,x.proxy=null,x.src=null,x.ha=null}function Rt(x){this.src=x,this.g={},this.h=0}Rt.prototype.add=function(x,k,O,F,K){var Z=x.toString();x=this.g[Z],x||(x=this.g[Z]=[],this.h++);var be=ht(x,k,F,K);return-1<be?(k=x[be],O||(k.fa=!1)):(k=new ke(k,this.src,Z,!!F,K),k.fa=O,x.push(k)),k};function ut(x,k){var O=k.type;if(O in x.g){var F=x.g[O],K=Array.prototype.indexOf.call(F,k,void 0),Z;(Z=0<=K)&&Array.prototype.splice.call(F,K,1),Z&&(at(k),x.g[O].length==0&&(delete x.g[O],x.h--))}}function ht(x,k,O,F){for(var K=0;K<x.length;++K){var Z=x[K];if(!Z.da&&Z.listener==k&&Z.capture==!!O&&Z.ha==F)return K}return-1}var bt="closure_lm_"+(1e6*Math.random()|0),Xr={};function Mt(x,k,O,F,K){if(F&&F.once)return Ut(x,k,O,F,K);if(Array.isArray(k)){for(var Z=0;Z<k.length;Z++)Mt(x,k[Z],O,F,K);return null}return O=j(O),x&&x[Qe]?x.K(k,O,c(F)?!!F.capture:!!F,K):ye(x,k,O,!1,F,K)}function ye(x,k,O,F,K,Z){if(!k)throw Error("Invalid event type");var be=c(K)?!!K.capture:!!K,xr=Be(x);if(xr||(x[bt]=xr=new Rt(x)),O=xr.add(k,O,F,be,Z),O.proxy)return O;if(F=dn(),O.proxy=F,F.src=x,F.listener=O,x.addEventListener)ge||(K=be),K===void 0&&(K=!1),x.addEventListener(k.toString(),F,K);else if(x.attachEvent)x.attachEvent(Vr(k.toString()),F);else if(x.addListener&&x.removeListener)x.addListener(F);else throw Error("addEventListener and attachEvent are unavailable.");return O}function dn(){function x(O){return k.call(x.src,x.listener,O)}let k=Do;return x}function Ut(x,k,O,F,K){if(Array.isArray(k)){for(var Z=0;Z<k.length;Z++)Ut(x,k[Z],O,F,K);return null}return O=j(O),x&&x[Qe]?x.L(k,O,c(F)?!!F.capture:!!F,K):ye(x,k,O,!0,F,K)}function pt(x,k,O,F,K){if(Array.isArray(k))for(var Z=0;Z<k.length;Z++)pt(x,k[Z],O,F,K);else F=c(F)?!!F.capture:!!F,O=j(O),x&&x[Qe]?(x=x.i,k=String(k).toString(),k in x.g&&(Z=x.g[k],O=ht(Z,O,F,K),-1<O&&(at(Z[O]),Array.prototype.splice.call(Z,O,1),Z.length==0&&(delete x.g[k],x.h--)))):x&&(x=Be(x))&&(k=x.g[k.toString()],x=-1,k&&(x=ht(k,O,F,K)),(O=-1<x?k[x]:null)&&Ur(O))}function Ur(x){if(typeof x!="number"&&x&&!x.da){var k=x.src;if(k&&k[Qe])ut(k.i,x);else{var O=x.type,F=x.proxy;k.removeEventListener?k.removeEventListener(O,F,x.capture):k.detachEvent?k.detachEvent(Vr(O),F):k.addListener&&k.removeListener&&k.removeListener(F),(O=Be(k))?(ut(O,x),O.h==0&&(O.src=null,k[bt]=null)):at(x)}}}function Vr(x){return x in Xr?Xr[x]:Xr[x]="on"+x}function Do(x,k){if(x.da)x=!0;else{k=new Ce(k,this);var O=x.listener,F=x.ha||x.src;x.fa&&Ur(x),x=O.call(F,k)}return x}function Be(x){return x=x[bt],x instanceof Rt?x:null}var ie="__closure_events_fn_"+(1e9*Math.random()>>>0);function j(x){return typeof x=="function"?x:(x[ie]||(x[ie]=function(k){return x.handleEvent(k)}),x[ie])}function Q(){ae.call(this),this.i=new Rt(this),this.M=this,this.F=null}h(Q,ae),Q.prototype[Qe]=!0,Q.prototype.removeEventListener=function(x,k,O,F){pt(this,x,k,O,F)};function se(x,k){var O,F=x.F;if(F)for(O=[];F;F=F.F)O.push(F);if(x=x.M,F=k.type||k,typeof k=="string")k=new U(k,x);else if(k instanceof U)k.target=k.target||x;else{var K=k;k=new U(F,x),T(k,K)}if(K=!0,O)for(var Z=O.length-1;0<=Z;Z--){var be=k.g=O[Z];K=Ve(be,F,!0,k)&&K}if(be=k.g=x,K=Ve(be,F,!0,k)&&K,K=Ve(be,F,!1,k)&&K,O)for(Z=0;Z<O.length;Z++)be=k.g=O[Z],K=Ve(be,F,!1,k)&&K}Q.prototype.N=function(){if(Q.aa.N.call(this),this.i){var x=this.i,k;for(k in x.g){for(var O=x.g[k],F=0;F<O.length;F++)at(O[F]);delete x.g[k],x.h--}}this.F=null},Q.prototype.K=function(x,k,O,F){return this.i.add(String(x),k,!1,O,F)},Q.prototype.L=function(x,k,O,F){return this.i.add(String(x),k,!0,O,F)};function Ve(x,k,O,F){if(k=x.i.g[String(k)],!k)return!0;k=k.concat();for(var K=!0,Z=0;Z<k.length;++Z){var be=k[Z];if(be&&!be.da&&be.capture==O){var xr=be.listener,xn=be.ha||be.src;be.fa&&ut(x.i,be),K=xr.call(xn,F)!==!1&&K}}return K&&!F.defaultPrevented}function yt(x,k,O){if(typeof x=="function")O&&(x=f(x,O));else if(x&&typeof x.handleEvent=="function")x=f(x.handleEvent,x);else throw Error("Invalid listener argument");return 2147483647<Number(k)?-1:s.setTimeout(x,k||0)}function Nt(x){x.g=yt(()=>{x.g=null,x.i&&(x.i=!1,Nt(x))},x.l);let k=x.h;x.h=null,x.m.apply(null,k)}class Mn extends ae{constructor(k,O){super(),this.m=k,this.l=O,this.h=null,this.i=!1,this.g=null}j(k){this.h=arguments,this.g?this.i=!0:Nt(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function _r(x){ae.call(this),this.h=x,this.g={}}h(_r,ae);var Nr=[];function Xn(x){I(x.g,function(k,O){this.g.hasOwnProperty(O)&&Ur(k)},x),x.g={}}_r.prototype.N=function(){_r.aa.N.call(this),Xn(this)},_r.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var io=s.JSON.stringify,fn=s.JSON.parse,pn=class{stringify(x){return s.JSON.stringify(x,void 0)}parse(x){return s.JSON.parse(x,void 0)}};function Sl(){}Sl.prototype.h=null;function mn(x){return x.h||(x.h=x.i())}function fr(){}var Ui={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Ln(){U.call(this,"d")}h(Ln,U);function bi(){U.call(this,"c")}h(bi,U);var ha={},hn=null;function gn(){return hn=hn||new Q}ha.La="serverreachability";function Rc(x){U.call(this,ha.La,x)}h(Rc,U);function Cl(x){let k=gn();se(k,new Rc(k))}ha.STAT_EVENT="statevent";function As(x,k){U.call(this,ha.STAT_EVENT,x),this.stat=k}h(As,U);function Xt(x){let k=gn();se(k,new As(k,x))}ha.Ma="timingevent";function Ds(x,k){U.call(this,ha.Ma,x),this.size=k}h(Ds,U);function Rs(x,k){if(typeof x!="function")throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){x()},k)}function jo(){this.g=!0}jo.prototype.xa=function(){this.g=!1};function Vi(x,k,O,F,K,Z){x.info(function(){if(x.g)if(Z)for(var be="",xr=Z.split("&"),xn=0;xn<xr.length;xn++){var Jt=xr[xn].split("=");if(1<Jt.length){var Fn=Jt[0];Jt=Jt[1];var Bn=Fn.split("_");be=2<=Bn.length&&Bn[1]=="type"?be+(Fn+"="+Jt+"&"):be+(Fn+"=redacted&")}}else be=null;else be=Z;return"XMLHTTP REQ ("+F+") [attempt "+K+"]: "+k+`
25
+ </defs>`,h.innerText="Preview backend running in this workspace."),h.setAttribute("id",m)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",d):d()}function Yo(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Wq(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Yo())}function uke(){let t=kE()?.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function qq(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Kq(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Yq(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Xq(){let t=Yo();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Jq(){return!uke()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function pO(){try{return typeof indexedDB=="object"}catch{return!1}}function Qq(){return new Promise((t,e)=>{try{let r=!0,o="validate-browser-context-for-indexeddb-analytics-module",n=self.indexedDB.open(o);n.onsuccess=()=>{n.result.close(),r||self.indexedDB.deleteDatabase(o),t(!0)},n.onupgradeneeded=()=>{r=!1},n.onerror=()=>{e(n.error?.message||"")}}catch(r){e(r)}})}var dke="FirebaseError",li=class t extends Error{constructor(e,r,o){super(r),this.code=e,this.customData=o,this.name=dke,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Gl.prototype.create)}},Gl=class{constructor(e,r,o){this.service=e,this.serviceName=r,this.errors=o}create(e,...r){let o=r[0]||{},n=`${this.service}/${e}`,i=this.errors[e],a=i?fke(i,o):"Error",s=`${this.serviceName}: ${a} (${n}).`;return new li(n,s,o)}};function fke(t,e){return t.replace(pke,(r,o)=>{let n=e[o];return n!=null?String(n):`<${o}?>`})}var pke=/\{\$([^}]+)}/g;function Zq(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ls(t,e){if(t===e)return!0;let r=Object.keys(t),o=Object.keys(e);for(let n of r){if(!o.includes(n))return!1;let i=t[n],a=e[n];if(Vq(i)&&Vq(a)){if(!ls(i,a))return!1}else if(i!==a)return!1}for(let n of o)if(!r.includes(n))return!1;return!0}function Vq(t){return t!==null&&typeof t=="object"}function Nm(t){let e=[];for(let[r,o]of Object.entries(t))Array.isArray(o)?o.forEach(n=>{e.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(r)+"="+encodeURIComponent(o));return e.length?"&"+e.join("&"):""}function Pm(t){let e={};return t.replace(/^\?/,"").split("&").forEach(o=>{if(o){let[n,i]=o.split("=");e[decodeURIComponent(n)]=decodeURIComponent(i)}}),e}function Om(t){let e=t.indexOf("?");if(!e)return"";let r=t.indexOf("#",e);return t.substring(e,r>0?r:void 0)}function eK(t,e){let r=new sO(t,e);return r.subscribe.bind(r)}var sO=class{constructor(e,r){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=r,this.task.then(()=>{e(this)}).catch(o=>{this.error(o)})}next(e){this.forEachObserver(r=>{r.next(e)})}error(e){this.forEachObserver(r=>{r.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,r,o){let n;if(e===void 0&&r===void 0&&o===void 0)throw new Error("Missing Observer.");mke(e,["next","error","complete"])?n=e:n={next:e,error:r,complete:o},n.next===void 0&&(n.next=iO),n.error===void 0&&(n.error=iO),n.complete===void 0&&(n.complete=iO);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{}}),this.observers.push(n),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let r=0;r<this.observers.length;r++)this.sendOne(r,e)}sendOne(e,r){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{r(this.observers[e])}catch(o){typeof console<"u"&&console.error&&console.error(o)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function mke(t,e){if(typeof t!="object"||t===null)return!1;for(let r of e)if(r in t&&typeof t[r]=="function")return!0;return!1}function iO(){}var ywt=14400*1e3;function vr(t){return t&&t._delegate?t._delegate:t}var yi=class{constructor(e,r,o){this.name=e,this.instanceFactory=r,this.type=o,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}};var Kd="[DEFAULT]";var mO=class{constructor(e,r){this.name=e,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let r=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(r)){let o=new CE;if(this.instancesDeferred.set(r,o),this.isInitialized(r)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:r});n&&o.resolve(n)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(e){let r=this.normalizeInstanceIdentifier(e?.identifier),o=e?.optional??!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(n){if(o)return null;throw n}else{if(o)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(gke(e))try{this.getOrInitializeService({instanceIdentifier:Kd})}catch{}for(let[r,o]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(r);try{let i=this.getOrInitializeService({instanceIdentifier:n});o.resolve(i)}catch{}}}}clearInstance(e=Kd){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(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...e.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Kd){return this.instances.has(e)}getOptions(e=Kd){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:r={}}=e,o=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(o))throw Error(`${this.name}(${o}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let n=this.getOrInitializeService({instanceIdentifier:o,options:r});for(let[i,a]of this.instancesDeferred.entries()){let s=this.normalizeInstanceIdentifier(i);o===s&&a.resolve(n)}return n}onInit(e,r){let o=this.normalizeInstanceIdentifier(r),n=this.onInitCallbacks.get(o)??new Set;n.add(e),this.onInitCallbacks.set(o,n);let i=this.instances.get(o);return i&&e(i,o),()=>{n.delete(e)}}invokeOnInitCallbacks(e,r){let o=this.onInitCallbacks.get(r);if(o)for(let n of o)try{n(e,r)}catch{}}getOrInitializeService({instanceIdentifier:e,options:r={}}){let o=this.instances.get(e);if(!o&&this.component&&(o=this.component.instanceFactory(this.container,{instanceIdentifier:hke(e),options:r}),this.instances.set(e,o),this.instancesOptions.set(e,r),this.invokeOnInitCallbacks(o,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,o)}catch{}return o||null}normalizeInstanceIdentifier(e=Kd){return this.component?this.component.multipleInstances?e:Kd:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function hke(t){return t===Kd?void 0:t}function gke(t){return t.instantiationMode==="EAGER"}var NE=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let r=this.getProvider(e.name);if(r.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);r.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 r=new mO(e,this);return this.providers.set(e,r),r}getProviders(){return Array.from(this.providers.values())}};var _ke=[],Pt;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Pt||(Pt={}));var xke={debug:Pt.DEBUG,verbose:Pt.VERBOSE,info:Pt.INFO,warn:Pt.WARN,error:Pt.ERROR,silent:Pt.SILENT},bke=Pt.INFO,yke={[Pt.DEBUG]:"log",[Pt.VERBOSE]:"log",[Pt.INFO]:"info",[Pt.WARN]:"warn",[Pt.ERROR]:"error"},vke=(t,e,...r)=>{if(e<t.logLevel)return;let o=new Date().toISOString(),n=yke[e];if(n)console[n](`[${o}] ${t.name}:`,...r);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},ru=class{constructor(e){this.name=e,this._logLevel=bke,this._logHandler=vke,this._userLogHandler=null,_ke.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Pt))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?xke[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Pt.DEBUG,...e),this._logHandler(this,Pt.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Pt.VERBOSE,...e),this._logHandler(this,Pt.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Pt.INFO,...e),this._logHandler(this,Pt.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Pt.WARN,...e),this._logHandler(this,Pt.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Pt.ERROR,...e),this._logHandler(this,Pt.ERROR,...e)}};var Ike=(t,e)=>e.some(r=>t instanceof r),tK,rK;function wke(){return tK||(tK=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Eke(){return rK||(rK=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var oK=new WeakMap,gO=new WeakMap,nK=new WeakMap,hO=new WeakMap,xO=new WeakMap;function Ske(t){let e=new Promise((r,o)=>{let n=()=>{t.removeEventListener("success",i),t.removeEventListener("error",a)},i=()=>{r(Ws(t.result)),n()},a=()=>{o(t.error),n()};t.addEventListener("success",i),t.addEventListener("error",a)});return e.then(r=>{r instanceof IDBCursor&&oK.set(r,t)}).catch(()=>{}),xO.set(e,t),e}function Cke(t){if(gO.has(t))return;let e=new Promise((r,o)=>{let n=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",a),t.removeEventListener("abort",a)},i=()=>{r(),n()},a=()=>{o(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",i),t.addEventListener("error",a),t.addEventListener("abort",a)});gO.set(t,e)}var _O={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return gO.get(t);if(e==="objectStoreNames")return t.objectStoreNames||nK.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ws(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function iK(t){_O=t(_O)}function Tke(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let o=t.call(PE(this),e,...r);return nK.set(o,e.sort?e.sort():[e]),Ws(o)}:Eke().includes(t)?function(...e){return t.apply(PE(this),e),Ws(oK.get(this))}:function(...e){return Ws(t.apply(PE(this),e))}}function kke(t){return typeof t=="function"?Tke(t):(t instanceof IDBTransaction&&Cke(t),Ike(t,wke())?new Proxy(t,_O):t)}function Ws(t){if(t instanceof IDBRequest)return Ske(t);if(hO.has(t))return hO.get(t);let e=kke(t);return e!==t&&(hO.set(t,e),xO.set(e,t)),e}var PE=t=>xO.get(t);function sK(t,e,{blocked:r,upgrade:o,blocking:n,terminated:i}={}){let a=indexedDB.open(t,e),s=Ws(a);return o&&a.addEventListener("upgradeneeded",l=>{o(Ws(a.result),l.oldVersion,l.newVersion,Ws(a.transaction),l)}),r&&a.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),n&&l.addEventListener("versionchange",c=>n(c.oldVersion,c.newVersion,c))}).catch(()=>{}),s}var Nke=["get","getKey","getAll","getAllKeys","count"],Pke=["put","add","delete","clear"],bO=new Map;function aK(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(bO.get(e))return bO.get(e);let r=e.replace(/FromIndex$/,""),o=e!==r,n=Pke.includes(r);if(!(r in(o?IDBIndex:IDBObjectStore).prototype)||!(n||Nke.includes(r)))return;let i=async function(a,...s){let l=this.transaction(a,n?"readwrite":"readonly"),c=l.store;return o&&(c=c.index(s.shift())),(await Promise.all([c[r](...s),n&&l.done]))[0]};return bO.set(e,i),i}iK(t=>({...t,get:(e,r,o)=>aK(e,r)||t.get(e,r,o),has:(e,r)=>!!aK(e,r)||t.has(e,r)}));var vO=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(Oke(r)){let o=r.getImmediate();return`${o.library}/${o.version}`}else return null}).filter(r=>r).join(" ")}};function Oke(t){return t.getComponent()?.type==="VERSION"}var IO="@firebase/app",lK="0.14.2";var Wl=new ru("@firebase/app"),Ake="@firebase/app-compat",Dke="@firebase/analytics-compat",Rke="@firebase/analytics",Mke="@firebase/app-check-compat",Lke="@firebase/app-check",Fke="@firebase/auth",Bke="@firebase/auth-compat",$ke="@firebase/database",zke="@firebase/data-connect",Uke="@firebase/database-compat",Vke="@firebase/functions",Hke="@firebase/functions-compat",jke="@firebase/installations",Gke="@firebase/installations-compat",Wke="@firebase/messaging",qke="@firebase/messaging-compat",Kke="@firebase/performance",Yke="@firebase/performance-compat",Xke="@firebase/remote-config",Jke="@firebase/remote-config-compat",Qke="@firebase/storage",Zke="@firebase/storage-compat",eNe="@firebase/firestore",tNe="@firebase/ai",rNe="@firebase/firestore-compat",oNe="firebase",nNe="12.2.0";var wO="[DEFAULT]",iNe={[IO]:"fire-core",[Ake]:"fire-core-compat",[Rke]:"fire-analytics",[Dke]:"fire-analytics-compat",[Lke]:"fire-app-check",[Mke]:"fire-app-check-compat",[Fke]:"fire-auth",[Bke]:"fire-auth-compat",[$ke]:"fire-rtdb",[zke]:"fire-data-connect",[Uke]:"fire-rtdb-compat",[Vke]:"fire-fn",[Hke]:"fire-fn-compat",[jke]:"fire-iid",[Gke]:"fire-iid-compat",[Wke]:"fire-fcm",[qke]:"fire-fcm-compat",[Kke]:"fire-perf",[Yke]:"fire-perf-compat",[Xke]:"fire-rc",[Jke]:"fire-rc-compat",[Qke]:"fire-gcs",[Zke]:"fire-gcs-compat",[eNe]:"fire-fst",[rNe]:"fire-fst-compat",[tNe]:"fire-vertex","fire-js":"fire-js",[oNe]:"fire-js-all"};var OE=new Map,aNe=new Map,EO=new Map;function cK(t,e){try{t.container.addComponent(e)}catch(r){Wl.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,r)}}function qs(t){let e=t.name;if(EO.has(e))return Wl.debug(`There were multiple attempts to register component ${e}.`),!1;EO.set(e,t);for(let r of OE.values())cK(r,t);for(let r of aNe.values())cK(r,t);return!0}function Yd(t,e){let r=t.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),t.container.getProvider(e)}function Ii(t){return t==null?!1:t.settings!==void 0}var sNe={"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."},ou=new Gl("app","Firebase",sNe);var SO=class{constructor(e,r,o){this._isDeleted=!1,this._options={...e},this._config={...r},this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=o,this.container.addComponent(new yi("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 ou.create("app-deleted",{appName:this._name})}};var Ks=nNe;function kO(t,e={}){let r=t;typeof e!="object"&&(e={name:e});let o={name:wO,automaticDataCollectionEnabled:!0,...e},n=o.name;if(typeof n!="string"||!n)throw ou.create("bad-app-name",{appName:String(n)});if(r||(r=uO()),!r)throw ou.create("no-options");let i=OE.get(n);if(i){if(ls(r,i.options)&&ls(o,i.config))return i;throw ou.create("duplicate-app",{appName:n})}let a=new NE(n);for(let l of EO.values())a.addComponent(l);let s=new SO(r,o,a);return OE.set(n,s),s}function dx(t=wO){let e=OE.get(t);if(!e&&t===wO&&uO())return kO();if(!e)throw ou.create("no-app",{appName:t});return e}function vi(t,e,r){let o=iNe[t]??t;r&&(o+=`-${r}`);let n=o.match(/\s|\//),i=e.match(/\s|\//);if(n||i){let a=[`Unable to register library "${o}" with version "${e}":`];n&&a.push(`library name "${o}" contains illegal characters (whitespace or "/")`),n&&i&&a.push("and"),i&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Wl.warn(a.join(" "));return}qs(new yi(`${o}-version`,()=>({library:o,version:e}),"VERSION"))}var lNe="firebase-heartbeat-database",cNe=1,ux="firebase-heartbeat-store",yO=null;function pK(){return yO||(yO=sK(lNe,cNe,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(ux)}catch(r){console.warn(r)}}}}).catch(t=>{throw ou.create("idb-open",{originalErrorMessage:t.message})})),yO}async function uNe(t){try{let r=(await pK()).transaction(ux),o=await r.objectStore(ux).get(mK(t));return await r.done,o}catch(e){if(e instanceof li)Wl.warn(e.message);else{let r=ou.create("idb-get",{originalErrorMessage:e?.message});Wl.warn(r.message)}}}async function uK(t,e){try{let o=(await pK()).transaction(ux,"readwrite");await o.objectStore(ux).put(e,mK(t)),await o.done}catch(r){if(r instanceof li)Wl.warn(r.message);else{let o=ou.create("idb-set",{originalErrorMessage:r?.message});Wl.warn(o.message)}}}function mK(t){return`${t.name}!${t.options.appId}`}var dNe=1024,fNe=30,CO=class{constructor(e){this.container=e,this._heartbeatsCache=null;let r=this.container.getProvider("app").getImmediate();this._storage=new TO(r),this._heartbeatsCachePromise=this._storage.read().then(o=>(this._heartbeatsCache=o,o))}async triggerHeartbeat(){try{let r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=dK();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(n=>n.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:r}),this._heartbeatsCache.heartbeats.length>fNe){let n=mNe(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(n,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Wl.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=dK(),{heartbeatsToSend:r,unsentEntries:o}=pNe(this._heartbeatsCache.heartbeats),n=lx(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=e,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return Wl.warn(e),""}}};function dK(){return new Date().toISOString().substring(0,10)}function pNe(t,e=dNe){let r=[],o=t.slice();for(let n of t){let i=r.find(a=>a.agent===n.agent);if(i){if(i.dates.push(n.date),fK(r)>e){i.dates.pop();break}}else if(r.push({agent:n.agent,dates:[n.date]}),fK(r)>e){r.pop();break}o=o.slice(1)}return{heartbeatsToSend:r,unsentEntries:o}}var TO=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return pO()?Qq().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let r=await uNe(this.app);return r?.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let o=await this.read();return uK(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let o=await this.read();return uK(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...e.heartbeats]})}else return}};function fK(t){return lx(JSON.stringify({version:2,heartbeats:t})).length}function mNe(t){if(t.length===0)return-1;let e=0,r=t[0].date;for(let o=1;o<t.length;o++)t[o].date<r&&(r=t[o].date,e=o);return e}function hNe(t){qs(new yi("platform-logger",e=>new vO(e),"PRIVATE")),qs(new yi("heartbeat",e=>new CO(e),"PRIVATE")),vi(IO,lK,t),vi(IO,lK,"esm2020"),vi("fire-js","")}hNe("");var gNe="firebase",_Ne="12.2.1";vi(gNe,_Ne,"app");function DK(){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."}}var RK=DK,MK=new Gl("auth","Firebase",DK());var BE=new ru("@firebase/auth");function xNe(t,...e){BE.logLevel<=Pt.WARN&&BE.warn(`Auth (${Ks}): ${t}`,...e)}function DE(t,...e){BE.logLevel<=Pt.ERROR&&BE.error(`Auth (${Ks}): ${t}`,...e)}function cs(t,...e){throw ZO(t,...e)}function Xs(t,...e){return ZO(t,...e)}function LK(t,e,r){let o={...RK(),[e]:r};return new Gl("auth","Firebase",o).create(e,{appName:t.name})}function Xd(t){return LK(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ZO(t,...e){if(typeof t!="string"){let r=e[0],o=[...e.slice(1)];return o[0]&&(o[0].appName=t.name),t._errorFactory.create(r,...o)}return MK.create(t,...e)}function Ge(t,e,...r){if(!t)throw ZO(e,...r)}function Ys(t){let e="INTERNAL ASSERTION FAILED: "+t;throw DE(e),new Error(e)}function Kl(t,e){t||Ys(e)}function RO(){return typeof self<"u"&&self.location?.href||""}function bNe(){return hK()==="http:"||hK()==="https:"}function hK(){return typeof self<"u"&&self.location?.protocol||null}function yNe(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(bNe()||Kq()||"connection"in navigator)?navigator.onLine:!0}function vNe(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}var Jd=class{constructor(e,r){this.shortDelay=e,this.longDelay=r,Kl(r>e,"Short delay should be less than long delay!"),this.isMobile=Wq()||Yq()}get(){return yNe()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function eA(t,e){Kl(t.emulator,"Emulator should always be set here");let{url:r}=t.emulator;return e?`${r}${e.startsWith("/")?e.slice(1):e}`:r}var $E=class{static initialize(e,r,o){this.fetchImpl=e,r&&(this.headersImpl=r),o&&(this.responseImpl=o)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ys("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ys("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ys("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var INe={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"};var wNe=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ENe=new Jd(3e4,6e4);function Xo(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function $n(t,e,r,o,n={}){return FK(t,n,async()=>{let i={},a={};o&&(e==="GET"?a=o:i={body:JSON.stringify(o)});let s=Nm({key:t.config.apiKey,...a}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let c={method:e,headers:l,...i};return qq()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&ss(t.emulatorConfig.host)&&(c.credentials="include"),$E.fetch()(await BK(t,t.config.apiHost,r,s),c)})}async function FK(t,e,r){t._canInitEmulator=!1;let o={...INe,...e};try{let n=new MO(t),i=await Promise.race([r(),n.promise]);n.clearNetworkTimeout();let a=await i.json();if("needConfirmation"in a)throw px(t,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{let s=i.ok?a.errorMessage:a.error.message,[l,c]=s.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw px(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw px(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw px(t,"user-disabled",a);let u=o[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw LK(t,u,c);cs(t,u)}}catch(n){if(n instanceof li)throw n;cs(t,"network-request-failed",{message:String(n)})}}async function rf(t,e,r,o,n={}){let i=await $n(t,e,r,o,n);return"mfaPendingCredential"in i&&cs(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function BK(t,e,r,o){let n=`${e}${r}?${o}`,i=t,a=i.config.emulator?eA(t.config,n):`${t.config.apiScheme}://${n}`;return wNe.includes(r)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}function SNe(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var MO=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((r,o)=>{this.timer=setTimeout(()=>o(Xs(this.auth,"network-request-failed")),ENe.get())})}};function px(t,e,r){let o={appName:t.name};r.email&&(o.email=r.email),r.phoneNumber&&(o.phoneNumber=r.phoneNumber);let n=Xs(t,e,o);return n.customData._tokenResponse=r,n}function gK(t){return t!==void 0&&t.enterprise!==void 0}var zE=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let r of this.recaptchaEnforcementState)if(r.provider&&r.provider===e)return SNe(r.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};async function $K(t,e){return $n(t,"GET","/v2/recaptchaConfig",Xo(t,e))}async function CNe(t,e){return $n(t,"POST","/v1/accounts:delete",e)}async function UE(t,e){return $n(t,"POST","/v1/accounts:lookup",e)}function mx(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function zK(t,e=!1){let r=vr(t),o=await r.getIdToken(e),n=tA(o);Ge(n&&n.exp&&n.auth_time&&n.iat,r.auth,"internal-error");let i=typeof n.firebase=="object"?n.firebase:void 0,a=i?.sign_in_provider;return{claims:n,token:o,authTime:mx(NO(n.auth_time)),issuedAtTime:mx(NO(n.iat)),expirationTime:mx(NO(n.exp)),signInProvider:a||null,signInSecondFactor:i?.sign_in_second_factor||null}}function NO(t){return Number(t)*1e3}function tA(t){let[e,r,o]=t.split(".");if(e===void 0||r===void 0||o===void 0)return DE("JWT malformed, contained fewer than 3 sections"),null;try{let n=TE(r);return n?JSON.parse(n):(DE("Failed to decode base64 JWT payload"),null)}catch(n){return DE("Caught error parsing JWT payload as JSON",n?.toString()),null}}function _K(t){let e=tA(t);return Ge(e,"internal-error"),Ge(typeof e.exp<"u","internal-error"),Ge(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function xx(t,e,r=!1){if(r)return e;try{return await e}catch(o){throw o instanceof li&&TNe(o)&&t.auth.currentUser===t&&await t.auth.signOut(),o}}function TNe({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}var LO=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;let o=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,o)}}schedule(e=!1){if(!this.isRunning)return;let r=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},r)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var bx=class{constructor(e,r){this.createdAt=e,this.lastLoginAt=r,this._initializeTime()}_initializeTime(){this.lastSignInTime=mx(this.lastLoginAt),this.creationTime=mx(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function VE(t){let e=t.auth,r=await t.getIdToken(),o=await xx(t,UE(e,{idToken:r}));Ge(o?.users.length,e,"internal-error");let n=o.users[0];t._notifyReloadListener(n);let i=n.providerUserInfo?.length?VK(n.providerUserInfo):[],a=kNe(t.providerData,i),s=t.isAnonymous,l=!(t.email&&n.passwordHash)&&!a?.length,c=s?l:!1,u={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:a,metadata:new bx(n.createdAt,n.lastLoginAt),isAnonymous:c};Object.assign(t,u)}async function UK(t){let e=vr(t);await VE(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function kNe(t,e){return[...t.filter(o=>!e.some(n=>n.providerId===o.providerId)),...e]}function VK(t){return t.map(({providerId:e,...r})=>({providerId:e,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}))}async function NNe(t,e){let r=await FK(t,{},async()=>{let o=Nm({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:n,apiKey:i}=t.config,a=await BK(t,n,"/v1/token",`key=${i}`),s=await t._getAdditionalHeaders();s["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:s,body:o};return t.emulatorConfig&&ss(t.emulatorConfig.host)&&(l.credentials="include"),$E.fetch()(a,l)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function PNe(t,e){return $n(t,"POST","/v2/accounts:revokeToken",Xo(t,e))}var hx=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ge(e.idToken,"internal-error"),Ge(typeof e.idToken<"u","internal-error"),Ge(typeof e.refreshToken<"u","internal-error");let r="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):_K(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,r)}updateFromIdToken(e){Ge(e.length!==0,"internal-error");let r=_K(e);this.updateTokensAndExpiration(e,null,r)}async getToken(e,r=!1){return!r&&this.accessToken&&!this.isExpired?this.accessToken:(Ge(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,r){let{accessToken:o,refreshToken:n,expiresIn:i}=await NNe(e,r);this.updateTokensAndExpiration(o,n,Number(i))}updateTokensAndExpiration(e,r,o){this.refreshToken=r||null,this.accessToken=e||null,this.expirationTime=Date.now()+o*1e3}static fromJSON(e,r){let{refreshToken:o,accessToken:n,expirationTime:i}=r,a=new t;return o&&(Ge(typeof o=="string","internal-error",{appName:e}),a.refreshToken=o),n&&(Ge(typeof n=="string","internal-error",{appName:e}),a.accessToken=n),i&&(Ge(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}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 t,this.toJSON())}_performRefresh(){return Ys("not implemented")}};function nu(t,e){Ge(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}var iu=class t{constructor({uid:e,auth:r,stsTokenManager:o,...n}){this.providerId="firebase",this.proactiveRefresh=new LO(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=r,this.stsTokenManager=o,this.accessToken=o.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 bx(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let r=await xx(this,this.stsTokenManager.getToken(this.auth,e));return Ge(r,this.auth,"internal-error"),this.accessToken!==r&&(this.accessToken=r,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),r}getIdTokenResult(e){return zK(this,e)}reload(){return UK(this)}_assign(e){this!==e&&(Ge(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(r=>({...r})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let r=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return r.metadata._copy(this.metadata),r}_onReload(e){Ge(!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,r=!1){let o=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),o=!0),r&&await VE(this),await this.auth._persistUserIfCurrent(this),o&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ii(this.auth.app))return Promise.reject(Xd(this.auth));let e=await this.getIdToken();return await xx(this,CNe(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,r){let o=r.displayName??void 0,n=r.email??void 0,i=r.phoneNumber??void 0,a=r.photoURL??void 0,s=r.tenantId??void 0,l=r._redirectEventId??void 0,c=r.createdAt??void 0,u=r.lastLoginAt??void 0,{uid:d,emailVerified:f,isAnonymous:m,providerData:h,stsTokenManager:g}=r;Ge(d&&g,e,"internal-error");let _=hx.fromJSON(this.name,g);Ge(typeof d=="string",e,"internal-error"),nu(o,e.name),nu(n,e.name),Ge(typeof f=="boolean",e,"internal-error"),Ge(typeof m=="boolean",e,"internal-error"),nu(i,e.name),nu(a,e.name),nu(s,e.name),nu(l,e.name),nu(c,e.name),nu(u,e.name);let b=new t({uid:d,auth:e,email:n,emailVerified:f,displayName:o,isAnonymous:m,photoURL:a,phoneNumber:i,tenantId:s,stsTokenManager:_,createdAt:c,lastLoginAt:u});return h&&Array.isArray(h)&&(b.providerData=h.map(y=>({...y}))),l&&(b._redirectEventId=l),b}static async _fromIdTokenResponse(e,r,o=!1){let n=new hx;n.updateFromServerResponse(r);let i=new t({uid:r.localId,auth:e,stsTokenManager:n,isAnonymous:o});return await VE(i),i}static async _fromGetAccountInfoResponse(e,r,o){let n=r.users[0];Ge(n.localId!==void 0,"internal-error");let i=n.providerUserInfo!==void 0?VK(n.providerUserInfo):[],a=!(n.email&&n.passwordHash)&&!i?.length,s=new hx;s.updateFromIdToken(o);let l=new t({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:a}),c={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 bx(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash)&&!i?.length};return Object.assign(l,c),l}};var xK=new Map;function ql(t){Kl(t instanceof Function,"Expected a class definition");let e=xK.get(t);return e?(Kl(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,xK.set(t,e),e)}var HE=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,r){this.storage[e]=r}async _get(e){let r=this.storage[e];return r===void 0?null:r}async _remove(e){delete this.storage[e]}_addListener(e,r){}_removeListener(e,r){}};HE.type="NONE";var FO=HE;function RE(t,e,r){return`firebase:${t}:${e}:${r}`}var jE=class t{constructor(e,r,o){this.persistence=e,this.auth=r,this.userKey=o;let{config:n,name:i}=this.auth;this.fullUserKey=RE(this.userKey,n.apiKey,i),this.fullPersistenceKey=RE("persistence",n.apiKey,i),this.boundEventHandler=r._onStorageEvent.bind(r),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(typeof e=="string"){let r=await UE(this.auth,{idToken:e}).catch(()=>{});return r?iu._fromGetAccountInfoResponse(this.auth,r,e):null}return iu._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 r=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,r)return this.setCurrentUser(r)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,r,o="authUser"){if(!r.length)return new t(ql(FO),e,o);let n=(await Promise.all(r.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c),i=n[0]||ql(FO),a=RE(o,e.config.apiKey,e.name),s=null;for(let c of r)try{let u=await c._get(a);if(u){let d;if(typeof u=="string"){let f=await UE(e,{idToken:u}).catch(()=>{});if(!f)break;d=await iu._fromGetAccountInfoResponse(e,f,u)}else d=iu._fromJSON(e,u);c!==i&&(s=d),i=c;break}}catch{}let l=n.filter(c=>c._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new t(i,e,o):(i=l[0],s&&await i._set(a,s.toJSON()),await Promise.all(r.map(async c=>{if(c!==i)try{await c._remove(a)}catch{}})),new t(i,e,o))}};function bK(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(WK(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(HK(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(KK(e))return"Blackberry";if(YK(e))return"Webos";if(jK(e))return"Safari";if((e.includes("chrome/")||GK(e))&&!e.includes("edge/"))return"Chrome";if(qK(e))return"Android";{let r=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,o=t.match(r);if(o?.length===2)return o[1]}return"Other"}function HK(t=Yo()){return/firefox\//i.test(t)}function jK(t=Yo()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function GK(t=Yo()){return/crios\//i.test(t)}function WK(t=Yo()){return/iemobile/i.test(t)}function qK(t=Yo()){return/android/i.test(t)}function KK(t=Yo()){return/blackberry/i.test(t)}function YK(t=Yo()){return/webos/i.test(t)}function rA(t=Yo()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function ONe(t=Yo()){return rA(t)&&!!window.navigator?.standalone}function ANe(){return Xq()&&document.documentMode===10}function XK(t=Yo()){return rA(t)||qK(t)||YK(t)||KK(t)||/windows phone/i.test(t)||WK(t)}function JK(t,e=[]){let r;switch(t){case"Browser":r=bK(Yo());break;case"Worker":r=`${bK(Yo())}-${t}`;break;default:r=t}let o=e.length?e.join(","):"FirebaseCore-web";return`${r}/JsCore/${Ks}/${o}`}var BO=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,r){let o=i=>new Promise((a,s)=>{try{let l=e(i);a(l)}catch(l){s(l)}});o.onAbort=r,this.queue.push(o);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let r=[];try{for(let o of this.queue)await o(e),o.onAbort&&r.push(o.onAbort)}catch(o){r.reverse();for(let n of r)try{n()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:o?.message})}}};async function DNe(t,e={}){return $n(t,"GET","/v2/passwordPolicy",Xo(t,e))}var RNe=6,$O=class{constructor(e){let r=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=r.minPasswordLength??RNe,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),r.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),r.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),r.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),r.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let r={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,r),this.validatePasswordCharacterOptions(e,r),r.isValid&&(r.isValid=r.meetsMinPasswordLength??!0),r.isValid&&(r.isValid=r.meetsMaxPasswordLength??!0),r.isValid&&(r.isValid=r.containsLowercaseLetter??!0),r.isValid&&(r.isValid=r.containsUppercaseLetter??!0),r.isValid&&(r.isValid=r.containsNumericCharacter??!0),r.isValid&&(r.isValid=r.containsNonAlphanumericCharacter??!0),r}validatePasswordLengthOptions(e,r){let o=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;o&&(r.meetsMinPasswordLength=e.length>=o),n&&(r.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,r){this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);let o;for(let n=0;n<e.length;n++)o=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(r,o>="a"&&o<="z",o>="A"&&o<="Z",o>="0"&&o<="9",this.allowedNonAlphanumericCharacters.includes(o))}updatePasswordCharacterOptionsStatuses(e,r,o,n,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=r)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=o)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}};var zO=class{constructor(e,r,o,n){this.app=e,this.heartbeatServiceProvider=r,this.appCheckServiceProvider=o,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new GE(this),this.idTokenSubscription=new GE(this),this.beforeStateQueue=new BO(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=MK,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(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,r){return r&&(this._popupRedirectResolver=ql(r)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await jE.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(r),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 r=await UE(this,{idToken:e}),o=await iu._fromGetAccountInfoResponse(this,r,e);await this.directlySetCurrentUser(o)}catch(r){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",r),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Ii(this.app)){let i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}let r=await this.assertedPersistence.getCurrentUser(),o=r,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let i=this.redirectUser?._redirectEventId,a=o?._redirectEventId,s=await this.tryRedirectSignIn(e);(!i||i===a)&&s?.user&&(o=s.user,n=!0)}if(!o)return this.directlySetCurrentUser(null);if(!o._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(o)}catch(i){o=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return o?this.reloadAndSetCurrentUserOrClear(o):this.directlySetCurrentUser(null)}return Ge(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===o._redirectEventId?this.directlySetCurrentUser(o):this.reloadAndSetCurrentUserOrClear(o)}async tryRedirectSignIn(e){let r=null;try{r=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return r}async reloadAndSetCurrentUserOrClear(e){try{await VE(e)}catch(r){if(r?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=vNe()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Ii(this.app))return Promise.reject(Xd(this));let r=e?vr(e):null;return r&&Ge(r.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(r&&r._clone(this))}async _updateCurrentUser(e,r=!1){if(!this._deleted)return e&&Ge(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),r||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Ii(this.app)?Promise.reject(Xd(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Ii(this.app)?Promise.reject(Xd(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ql(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let r=this._getPasswordPolicyInternal();return r.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):r.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await DNe(this),r=new $O(e);this.tenantId===null?this._projectPasswordPolicy=r:this._tenantPasswordPolicies[this.tenantId]=r}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Gl("auth","Firebase",e())}onAuthStateChanged(e,r,o){return this.registerStateListener(this.authStateSubscription,e,r,o)}beforeAuthStateChanged(e,r){return this.beforeStateQueue.pushCallback(e,r)}onIdTokenChanged(e,r,o){return this.registerStateListener(this.idTokenSubscription,e,r,o)}authStateReady(){return new Promise((e,r)=>{if(this.currentUser)e();else{let o=this.onAuthStateChanged(()=>{o(),e()},r)}})}async revokeAccessToken(e){if(this.currentUser){let r=await this.currentUser.getIdToken(),o={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:r};this.tenantId!=null&&(o.tenantId=this.tenantId),await PNe(this,o)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,r){let o=await this.getOrInitRedirectPersistenceManager(r);return e===null?o.removeCurrentUser():o.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let r=e&&ql(e)||this._popupRedirectResolver;Ge(r,this,"argument-error"),this.redirectPersistenceManager=await jE.create(this,[ql(r._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,r,o,n){if(this._deleted)return()=>{};let i=typeof r=="function"?r:r.next.bind(r),a=!1,s=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ge(s,this,"internal-error"),s.then(()=>{a||i(this.currentUser)}),typeof r=="function"){let l=e.addObserver(r,o,n);return()=>{a=!0,l()}}else{let l=e.addObserver(r);return()=>{a=!0,l()}}}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 Ge(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=JK(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 r=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();r&&(e["X-Firebase-Client"]=r);let o=await this._getAppCheckToken();return o&&(e["X-Firebase-AppCheck"]=o),e}async _getAppCheckToken(){if(Ii(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&xNe(`Error while retrieving App Check token: ${e.error}`),e?.token}};function Rm(t){return vr(t)}var GE=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=eK(r=>this.observer=r)}get next(){return Ge(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var c0={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function MNe(t){c0=t}function QK(t){return c0.loadJS(t)}function LNe(){return c0.recaptchaEnterpriseScript}function FNe(){return c0.gapiScript}function ZK(t){return`__${t}${Math.floor(Math.random()*1e6)}`}var UO=class{constructor(){this.enterprise=new VO}ready(e){e()}execute(e,r){return Promise.resolve("token")}render(e,r){return""}},VO=class{ready(e){e()}execute(e,r){return Promise.resolve("token")}render(e,r){return""}};var BNe="recaptcha-enterprise",gx="NO_RECAPTCHA",WE=class{constructor(e){this.type=BNe,this.auth=Rm(e)}async verify(e="verify",r=!1){async function o(i){if(!r){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(a,s)=>{$K(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)s(new Error("recaptcha Enterprise site key undefined"));else{let c=new zE(l);return i.tenantId==null?i._agentRecaptchaConfig=c:i._tenantRecaptchaConfigs[i.tenantId]=c,a(c.siteKey)}}).catch(l=>{s(l)})})}function n(i,a,s){let l=window.grecaptcha;gK(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(c=>{a(c)}).catch(()=>{a(gx)})}):s(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new UO().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{o(this.auth).then(s=>{if(!r&&gK(window.grecaptcha))n(s,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=LNe();l.length!==0&&(l+=s),QK(l).then(()=>{n(s,i,a)}).catch(c=>{a(c)})}}).catch(s=>{a(s)})})}};async function fx(t,e,r,o=!1,n=!1){let i=new WE(t),a;if(n)a=gx;else try{a=await i.verify(r)}catch{a=await i.verify(r,!0)}let s={...e};if(r==="mfaSmsEnrollment"||r==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in s){let l=s.phoneEnrollmentInfo.phoneNumber,c=s.phoneEnrollmentInfo.recaptchaToken;Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:c,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in s){let l=s.phoneSignInInfo.recaptchaToken;Object.assign(s,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return s}return o?Object.assign(s,{captchaResp:a}):Object.assign(s,{captchaResponse:a}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}async function _x(t,e,r,o,n){if(n==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let i=await fx(t,e,r,r==="getOobCode");return o(t,i)}else return o(t,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let a=await fx(t,e,r,r==="getOobCode");return o(t,a)}else return Promise.reject(i)});else if(n==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let i=await fx(t,e,r);return o(t,i).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${r} flow.`);let s=await fx(t,e,r,!1,!0);return o(t,s)}return Promise.reject(a)})}else{let i=await fx(t,e,r,!1,!0);return o(t,i)}else return Promise.reject(n+" provider is not supported.")}async function $Ne(t){let e=Rm(t),r=await $K(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),o=new zE(r);e.tenantId==null?e._agentRecaptchaConfig=o:e._tenantRecaptchaConfigs[e.tenantId]=o,o.isAnyProviderEnabled()&&new WE(e).verify()}function eY(t,e){let r=Yd(t,"auth");if(r.isInitialized()){let n=r.getImmediate(),i=r.getOptions();if(ls(i,e??{}))return n;cs(n,"already-initialized")}return r.initialize({options:e})}function zNe(t,e){let r=e?.persistence||[],o=(Array.isArray(r)?r:[r]).map(ql);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(o,e?.popupRedirectResolver)}function tY(t,e,r){let o=Rm(t);Ge(/^https?:\/\//.test(e),o,"invalid-emulator-scheme");let n=!!r?.disableWarnings,i=rY(e),{host:a,port:s}=UNe(e),l=s===null?"":`:${s}`,c={url:`${i}//${a}${l}/`},u=Object.freeze({host:a,port:s,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:n})});if(!o._canInitEmulator){Ge(o.config.emulator&&o.emulatorConfig,o,"emulator-config-failed"),Ge(ls(c,o.config.emulator)&&ls(u,o.emulatorConfig),o,"emulator-config-failed");return}o.config.emulator=c,o.emulatorConfig=u,o.settings.appVerificationDisabledForTesting=!0,ss(a)?(km(`${i}//${a}${l}`),cx("Auth",!0)):n||VNe()}function rY(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function UNe(t){let e=rY(t),r=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!r)return{host:"",port:null};let o=r[2].split("@").pop()||"",n=/^(\[[^\]]+\])(:|$)/.exec(o);if(n){let i=n[1];return{host:i,port:yK(o.substr(i.length+1))}}else{let[i,a]=o.split(":");return{host:i,port:yK(a)}}}function yK(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function VNe(){function t(){let e=document.createElement("p"),r=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",r.position="fixed",r.width="100%",r.backgroundColor="#ffffff",r.border=".1em solid #000000",r.color="#b50000",r.bottom="0px",r.left="0px",r.margin="0px",r.zIndex="10000",r.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}var Qd=class{constructor(e,r){this.providerId=e,this.signInMethod=r}toJSON(){return Ys("not implemented")}_getIdTokenResponse(e){return Ys("not implemented")}_linkToIdToken(e,r){return Ys("not implemented")}_getReauthenticationResolver(e){return Ys("not implemented")}};async function HNe(t,e){return $n(t,"POST","/v1/accounts:signUp",e)}async function jNe(t,e){return rf(t,"POST","/v1/accounts:signInWithPassword",Xo(t,e))}async function GNe(t,e){return rf(t,"POST","/v1/accounts:signInWithEmailLink",Xo(t,e))}async function WNe(t,e){return rf(t,"POST","/v1/accounts:signInWithEmailLink",Xo(t,e))}var yx=class t extends Qd{constructor(e,r,o,n=null){super("password",o),this._email=e,this._password=r,this._tenantId=n}static _fromEmailAndPassword(e,r){return new t(e,r,"password")}static _fromEmailAndCode(e,r,o=null){return new t(e,r,"emailLink",o)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let r=typeof e=="string"?JSON.parse(e):e;if(r?.email&&r?.password){if(r.signInMethod==="password")return this._fromEmailAndPassword(r.email,r.password);if(r.signInMethod==="emailLink")return this._fromEmailAndCode(r.email,r.password,r.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let r={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return _x(e,r,"signInWithPassword",jNe,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return GNe(e,{email:this._email,oobCode:this._password});default:cs(e,"internal-error")}}async _linkToIdToken(e,r){switch(this.signInMethod){case"password":let o={idToken:r,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return _x(e,o,"signUpPassword",HNe,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return WNe(e,{idToken:r,email:this._email,oobCode:this._password});default:cs(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function Am(t,e){return rf(t,"POST","/v1/accounts:signInWithIdp",Xo(t,e))}var qNe="http://localhost",Zd=class t extends Qd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let r=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(r.idToken=e.idToken),e.accessToken&&(r.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(r.nonce=e.nonce),e.pendingToken&&(r.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(r.accessToken=e.oauthToken,r.secret=e.oauthTokenSecret):cs("argument-error"),r}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let r=typeof e=="string"?JSON.parse(e):e,{providerId:o,signInMethod:n,...i}=r;if(!o||!n)return null;let a=new t(o,n);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){let r=this.buildRequest();return Am(e,r)}_linkToIdToken(e,r){let o=this.buildRequest();return o.idToken=r,Am(e,o)}_getReauthenticationResolver(e){let r=this.buildRequest();return r.autoCreate=!1,Am(e,r)}buildRequest(){let e={requestUri:qNe,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let r={};this.idToken&&(r.id_token=this.idToken),this.accessToken&&(r.access_token=this.accessToken),this.secret&&(r.oauth_token_secret=this.secret),r.providerId=this.providerId,this.nonce&&!this.pendingToken&&(r.nonce=this.nonce),e.postBody=Nm(r)}return e}};async function vK(t,e){return $n(t,"POST","/v1/accounts:sendVerificationCode",Xo(t,e))}async function KNe(t,e){return rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,e))}async function YNe(t,e){let r=await rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,e));if(r.temporaryProof)throw px(t,"account-exists-with-different-credential",r);return r}var XNe={USER_NOT_FOUND:"user-not-found"};async function JNe(t,e){let r={...e,operation:"REAUTH"};return rf(t,"POST","/v1/accounts:signInWithPhoneNumber",Xo(t,r),XNe)}var vx=class t extends Qd{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,r){return new t({verificationId:e,verificationCode:r})}static _fromTokenResponse(e,r){return new t({phoneNumber:e,temporaryProof:r})}_getIdTokenResponse(e){return KNe(e,this._makeVerificationRequest())}_linkToIdToken(e,r){return YNe(e,{idToken:r,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return JNe(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:r,verificationId:o,verificationCode:n}=this.params;return e&&r?{temporaryProof:e,phoneNumber:r}:{sessionInfo:o,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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:r,verificationCode:o,phoneNumber:n,temporaryProof:i}=e;return!o&&!r&&!n&&!i?null:new t({verificationId:r,verificationCode:o,phoneNumber:n,temporaryProof:i})}};function QNe(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function ZNe(t){let e=Pm(Om(t)).link,r=e?Pm(Om(e)).deep_link_id:null,o=Pm(Om(t)).deep_link_id;return(o?Pm(Om(o)).link:null)||o||r||e||t}var qE=class t{constructor(e){let r=Pm(Om(e)),o=r.apiKey??null,n=r.oobCode??null,i=QNe(r.mode??null);Ge(o&&n&&i,"argument-error"),this.apiKey=o,this.operation=i,this.code=n,this.continueUrl=r.continueUrl??null,this.languageCode=r.lang??null,this.tenantId=r.tenantId??null}static parseLink(e){let r=ZNe(e);try{return new t(r)}catch{return null}}};var Dm=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,r){return yx._fromEmailAndPassword(e,r)}static credentialWithLink(e,r){let o=qE.parseLink(r);return Ge(o,"argument-error"),yx._fromEmailAndCode(e,o.code,o.tenantId)}};Dm.PROVIDER_ID="password";Dm.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Dm.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var KE=class{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}};var ef=class extends KE{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var Ix=class t extends ef{constructor(){super("facebook.com")}static credential(e){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Ix.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ix.PROVIDER_ID="facebook.com";var wx=class t extends ef{constructor(){super("google.com"),this.addScope("profile")}static credential(e,r){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:r})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:r,oauthAccessToken:o}=e;if(!r&&!o)return null;try{return t.credential(r,o)}catch{return null}}};wx.GOOGLE_SIGN_IN_METHOD="google.com";wx.PROVIDER_ID="google.com";var Ex=class t extends ef{constructor(){super("github.com")}static credential(e){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Ex.GITHUB_SIGN_IN_METHOD="github.com";Ex.PROVIDER_ID="github.com";var Sx=class t extends ef{constructor(){super("twitter.com")}static credential(e,r){return Zd._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:r})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:r,oauthTokenSecret:o}=e;if(!r||!o)return null;try{return t.credential(r,o)}catch{return null}}};Sx.TWITTER_SIGN_IN_METHOD="twitter.com";Sx.PROVIDER_ID="twitter.com";var Cx=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,r,o,n=!1){let i=await iu._fromIdTokenResponse(e,o,n),a=IK(o);return new t({user:i,providerId:a,_tokenResponse:o,operationType:r})}static async _forOperation(e,r,o){await e._updateTokensIfNecessary(o,!0);let n=IK(o);return new t({user:e,providerId:n,_tokenResponse:o,operationType:r})}};function IK(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}var HO=class t extends li{constructor(e,r,o,n){super(r.code,r.message),this.operationType=o,this.user=n,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:r.customData._serverResponse,operationType:o}}static _fromErrorAndOperation(e,r,o,n){return new t(e,r,o,n)}};function oY(t,e,r,o){return(e==="reauthenticate"?r._getReauthenticationResolver(t):r._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?HO._fromErrorAndOperation(t,i,e,o):i})}async function ePe(t,e,r=!1){let o=await xx(t,e._linkToIdToken(t.auth,await t.getIdToken()),r);return Cx._forOperation(t,"link",o)}async function tPe(t,e,r=!1){let{auth:o}=t;if(Ii(o.app))return Promise.reject(Xd(o));let n="reauthenticate";try{let i=await xx(t,oY(o,n,e,t),r);Ge(i.idToken,o,"internal-error");let a=tA(i.idToken);Ge(a,o,"internal-error");let{sub:s}=a;return Ge(t.uid===s,o,"user-mismatch"),Cx._forOperation(t,n,i)}catch(i){throw i?.code==="auth/user-not-found"&&cs(o,"user-mismatch"),i}}async function rPe(t,e,r=!1){if(Ii(t.app))return Promise.reject(Xd(t));let o="signIn",n=await oY(t,o,e),i=await Cx._fromIdTokenResponse(t,o,n);return r||await t._updateCurrentUser(i.user),i}function nY(t,e,r,o){return vr(t).onIdTokenChanged(e,r,o)}function iY(t,e,r){return vr(t).beforeAuthStateChanged(e,r)}function wK(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:start",Xo(t,e))}function oPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:finalize",Xo(t,e))}function nPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:start",Xo(t,e))}function iPe(t,e){return $n(t,"POST","/v2/accounts/mfaEnrollment:finalize",Xo(t,e))}var YE="__sak";var XE=class{constructor(e,r){this.storageRetriever=e,this.type=r}_isAvailable(){try{return this.storage?(this.storage.setItem(YE,"1"),this.storage.removeItem(YE),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,r){return this.storage.setItem(e,JSON.stringify(r)),Promise.resolve()}_get(e){let r=this.storage.getItem(e);return Promise.resolve(r?JSON.parse(r):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var aPe=1e3,sPe=10,JE=class extends XE{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,r)=>this.onStorageEvent(e,r),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=XK(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let r of Object.keys(this.listeners)){let o=this.storage.getItem(r),n=this.localCache[r];o!==n&&e(r,n,o)}}onStorageEvent(e,r=!1){if(!e.key){this.forAllChangedKeys((a,s,l)=>{this.notifyListeners(a,l)});return}let o=e.key;r?this.detachListener():this.stopPolling();let n=()=>{let a=this.storage.getItem(o);!r&&this.localCache[o]===a||this.notifyListeners(o,a)},i=this.storage.getItem(o);ANe()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,sPe):n()}notifyListeners(e,r){this.localCache[e]=r;let o=this.listeners[e];if(o)for(let n of Array.from(o))n(r&&JSON.parse(r))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,r,o)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:r,newValue:o}),!0)})},aPe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,r){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(r)}_removeListener(e,r){this.listeners[e]&&(this.listeners[e].delete(r),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,r){await super._set(e,r),this.localCache[e]=JSON.stringify(r)}async _get(e){let r=await super._get(e);return this.localCache[e]=JSON.stringify(r),r}async _remove(e){await super._remove(e),delete this.localCache[e]}};JE.type="LOCAL";var aY=JE;var lPe=1e3;function PO(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=RegExp(`${e}=([^;]+)`);return document.cookie.match(r)?.[1]??null}function OO(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}var jO=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let r=new URL(`${window.location.origin}/__cookies__`);return r.searchParams.set("finalTarget",e),r}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,r){}async _get(e){if(!this._isAvailable())return null;let r=OO(e);return window.cookieStore?(await window.cookieStore.get(r))?.value:PO(r)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let o=OO(e);document.cookie=`${o}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,r){if(!this._isAvailable())return;let o=OO(e);if(window.cookieStore){let s=(c=>{let u=c.changed.find(f=>f.name===o);u&&r(u.value),c.deleted.find(f=>f.name===o)&&r(null)}),l=()=>window.cookieStore.removeEventListener("change",s);return this.listenerUnsubscribes.set(r,l),window.cookieStore.addEventListener("change",s)}let n=PO(o),i=setInterval(()=>{let s=PO(o);s!==n&&(r(s),n=s)},lPe),a=()=>clearInterval(i);this.listenerUnsubscribes.set(r,a)}_removeListener(e,r){let o=this.listenerUnsubscribes.get(r);o&&(o(),this.listenerUnsubscribes.delete(r))}};jO.type="COOKIE";var QE=class extends XE{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,r){}_removeListener(e,r){}};QE.type="SESSION";var oA=QE;function cPe(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(r){return{fulfilled:!1,reason:r}}}))}var ZE=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let r=this.receivers.find(n=>n.isListeningto(e));if(r)return r;let o=new t(e);return this.receivers.push(o),o}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let r=e,{eventId:o,eventType:n,data:i}=r.data,a=this.handlersMap[n];if(!a?.size)return;r.ports[0].postMessage({status:"ack",eventId:o,eventType:n});let s=Array.from(a).map(async c=>c(r.origin,i)),l=await cPe(s);r.ports[0].postMessage({status:"done",eventId:o,eventType:n,response:l})}_subscribe(e,r){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(r)}_unsubscribe(e,r){this.handlersMap[e]&&r&&this.handlersMap[e].delete(r),(!r||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};ZE.receivers=[];function nA(t="",e=10){let r="";for(let o=0;o<e;o++)r+=Math.floor(Math.random()*10);return t+r}var GO=class{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,r,o=50){let n=typeof MessageChannel<"u"?new MessageChannel:null;if(!n)throw new Error("connection_unavailable");let i,a;return new Promise((s,l)=>{let c=nA("",20);n.port1.start();let u=setTimeout(()=>{l(new Error("unsupported_event"))},o);a={messageChannel:n,onMessage(d){let f=d;if(f.data.eventId===c)switch(f.data.status){case"ack":clearTimeout(u),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),s(f.data.response);break;default:clearTimeout(u),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),n.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:c,data:r},[n.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};function Js(){return window}function uPe(t){Js().location.href=t}function sY(){return typeof Js().WorkerGlobalScope<"u"&&typeof Js().importScripts=="function"}async function dPe(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function fPe(){return navigator?.serviceWorker?.controller||null}function pPe(){return sY()?self:null}var lY="firebaseLocalStorageDb",mPe=1,e0="firebaseLocalStorage",cY="fbase_key",tf=class{constructor(e){this.request=e}toPromise(){return new Promise((e,r)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{r(this.request.error)})})}};function u0(t,e){return t.transaction([e0],e?"readwrite":"readonly").objectStore(e0)}function hPe(){let t=indexedDB.deleteDatabase(lY);return new tf(t).toPromise()}function WO(){let t=indexedDB.open(lY,mPe);return new Promise((e,r)=>{t.addEventListener("error",()=>{r(t.error)}),t.addEventListener("upgradeneeded",()=>{let o=t.result;try{o.createObjectStore(e0,{keyPath:cY})}catch(n){r(n)}}),t.addEventListener("success",async()=>{let o=t.result;o.objectStoreNames.contains(e0)?e(o):(o.close(),await hPe(),e(await WO()))})})}async function EK(t,e,r){let o=u0(t,!0).put({[cY]:e,value:r});return new tf(o).toPromise()}async function gPe(t,e){let r=u0(t,!1).get(e),o=await new tf(r).toPromise();return o===void 0?null:o.value}function SK(t,e){let r=u0(t,!0).delete(e);return new tf(r).toPromise()}var _Pe=800,xPe=3,t0=class{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await WO(),this.db)}async _withRetries(e){let r=0;for(;;)try{let o=await this._openDb();return await e(o)}catch(o){if(r++>xPe)throw o;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return sY()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ZE._getInstance(pPe()),this.receiver._subscribe("keyChanged",async(e,r)=>({keyProcessed:(await this._poll()).includes(r.key)})),this.receiver._subscribe("ping",async(e,r)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await dPe(),!this.activeServiceWorker)return;this.sender=new GO(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||fPe()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await WO();return await EK(e,YE,"1"),await SK(e,YE),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,r){return this._withPendingWrite(async()=>(await this._withRetries(o=>EK(o,e,r)),this.localCache[e]=r,this.notifyServiceWorker(e)))}async _get(e){let r=await this._withRetries(o=>gPe(o,e));return this.localCache[e]=r,r}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(r=>SK(r,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(n=>{let i=u0(n,!1).getAll();return new tf(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let r=[],o=new Set;if(e.length!==0)for(let{fbase_key:n,value:i}of e)o.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),r.push(n));for(let n of Object.keys(this.localCache))this.localCache[n]&&!o.has(n)&&(this.notifyListeners(n,null),r.push(n));return r}notifyListeners(e,r){this.localCache[e]=r;let o=this.listeners[e];if(o)for(let n of Array.from(o))n(r)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),_Pe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,r){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(r)}_removeListener(e,r){this.listeners[e]&&(this.listeners[e].delete(r),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};t0.type="LOCAL";var uY=t0;function CK(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:start",Xo(t,e))}function bPe(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:finalize",Xo(t,e))}function yPe(t,e){return $n(t,"POST","/v2/accounts/mfaSignIn:finalize",Xo(t,e))}var Wwt=ZK("rcb"),qwt=new Jd(3e4,6e4);var ME="recaptcha";async function vPe(t,e,r){if(!t._getRecaptchaConfig())try{await $Ne(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let o;if(typeof e=="string"?o={phoneNumber:e}:o=e,"session"in o){let n=o.session;if("phoneNumber"in o){Ge(n.type==="enroll",t,"internal-error");let i={idToken:n.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await _x(t,i,"mfaSmsEnrollment",async(c,u)=>{if(u.phoneEnrollmentInfo.captchaResponse===gx){Ge(r?.type===ME,c,"argument-error");let d=await AO(c,u,r);return wK(c,d)}return wK(c,u)},"PHONE_PROVIDER").catch(c=>Promise.reject(c))).phoneSessionInfo.sessionInfo}else{Ge(n.type==="signin",t,"internal-error");let i=o.multiFactorHint?.uid||o.multiFactorUid;Ge(i,t,"missing-multi-factor-info");let a={mfaPendingCredential:n.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await _x(t,a,"mfaSmsSignIn",async(u,d)=>{if(d.phoneSignInInfo.captchaResponse===gx){Ge(r?.type===ME,u,"argument-error");let f=await AO(u,d,r);return CK(u,f)}return CK(u,d)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneResponseInfo.sessionInfo}}else{let n={phoneNumber:o.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await _x(t,n,"sendVerificationCode",async(l,c)=>{if(c.captchaResponse===gx){Ge(r?.type===ME,l,"argument-error");let u=await AO(l,c,r);return vK(l,u)}return vK(l,c)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{r?._reset()}}async function AO(t,e,r){Ge(r.type===ME,t,"argument-error");let o=await r.verify();Ge(typeof o=="string",t,"argument-error");let n={...e};if("phoneEnrollmentInfo"in n){let i=n.phoneEnrollmentInfo.phoneNumber,a=n.phoneEnrollmentInfo.captchaResponse,s=n.phoneEnrollmentInfo.clientType,l=n.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(n,{phoneEnrollmentInfo:{phoneNumber:i,recaptchaToken:o,captchaResponse:a,clientType:s,recaptchaVersion:l}}),n}else if("phoneSignInInfo"in n){let i=n.phoneSignInInfo.captchaResponse,a=n.phoneSignInInfo.clientType,s=n.phoneSignInInfo.recaptchaVersion;return Object.assign(n,{phoneSignInInfo:{recaptchaToken:o,captchaResponse:i,clientType:a,recaptchaVersion:s}}),n}else return Object.assign(n,{recaptchaToken:o}),n}var Tx=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=Rm(e)}verifyPhoneNumber(e,r){return vPe(this.auth,e,vr(r))}static credential(e,r){return vx._fromVerification(e,r)}static credentialFromResult(e){let r=e;return t.credentialFromTaggedObject(r)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:r,temporaryProof:o}=e;return r&&o?vx._fromTokenResponse(r,o):null}};Tx.PROVIDER_ID="phone";Tx.PHONE_SIGN_IN_METHOD="phone";function IPe(t,e){return e?ql(e):(Ge(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}var kx=class extends Qd{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Am(e,this._buildIdpRequest())}_linkToIdToken(e,r){return Am(e,this._buildIdpRequest(r))}_getReauthenticationResolver(e){return Am(e,this._buildIdpRequest())}_buildIdpRequest(e){let r={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&&(r.idToken=e),r}};function wPe(t){return rPe(t.auth,new kx(t),t.bypassAuthState)}function EPe(t){let{auth:e,user:r}=t;return Ge(r,e,"internal-error"),tPe(r,new kx(t),t.bypassAuthState)}async function SPe(t){let{auth:e,user:r}=t;return Ge(r,e,"internal-error"),ePe(r,new kx(t),t.bypassAuthState)}var r0=class{constructor(e,r,o,n,i=!1){this.auth=e,this.resolver=o,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(r)?r:[r]}execute(){return new Promise(async(e,r)=>{this.pendingPromise={resolve:e,reject:r};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(o){this.reject(o)}})}async onAuthEvent(e){let{urlResponse:r,sessionId:o,postBody:n,tenantId:i,error:a,type:s}=e;if(a){this.reject(a);return}let l={auth:this.auth,requestUri:r,sessionId:o,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return wPe;case"linkViaPopup":case"linkViaRedirect":return SPe;case"reauthViaPopup":case"reauthViaRedirect":return EPe;default:cs(this.auth,"internal-error")}}resolve(e){Kl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Kl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var CPe=new Jd(2e3,1e4);var qO=class t extends r0{constructor(e,r,o,n,i){super(e,r,n,i),this.provider=o,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return Ge(e,this.auth,"internal-error"),e}async onExecution(){Kl(this.filter.length===1,"Popup operations only handle one event");let e=nA();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(r=>{this.reject(r)}),this.resolver._isIframeWebStorageSupported(this.auth,r=>{r||this.reject(Xs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Xs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Xs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,CPe.get())};e()}};qO.currentPopupAction=null;var TPe="pendingRedirect",LE=new Map,KO=class extends r0{constructor(e,r,o=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],r,void 0,o),this.eventId=null}async execute(){let e=LE.get(this.auth._key());if(!e){try{let o=await kPe(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(o)}catch(r){e=()=>Promise.reject(r)}LE.set(this.auth._key(),e)}return this.bypassAuthState||LE.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let r=await this.auth._redirectUserForId(e.eventId);if(r)return this.user=r,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function kPe(t,e){let r=OPe(e),o=PPe(t);if(!await o._isAvailable())return!1;let n=await o._get(r)==="true";return await o._remove(r),n}function NPe(t,e){LE.set(t._key(),e)}function PPe(t){return ql(t._redirectPersistence)}function OPe(t){return RE(TPe,t.config.apiKey,t.name)}async function APe(t,e,r=!1){if(Ii(t.app))return Promise.reject(Xd(t));let o=Rm(t),n=IPe(o,e),a=await new KO(o,n,r).execute();return a&&!r&&(delete a.user._redirectEventId,await o._persistUserIfCurrent(a.user),await o._setRedirectUser(null,e)),a}var DPe=600*1e3,YO=class{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 r=!1;return this.consumers.forEach(o=>{this.isEventForConsumer(e,o)&&(r=!0,this.sendToConsumer(e,o),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!RPe(e)||(this.hasHandledPotentialRedirect=!0,r||(this.queuedRedirectEvent=e,r=!0)),r}sendToConsumer(e,r){if(e.error&&!dY(e)){let o=e.error.code?.split("auth/")[1]||"internal-error";r.onError(Xs(this.auth,o))}else r.onAuthEvent(e)}isEventForConsumer(e,r){let o=r.eventId===null||!!e.eventId&&e.eventId===r.eventId;return r.filter.includes(e.type)&&o}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=DPe&&this.cachedEventUids.clear(),this.cachedEventUids.has(TK(e))}saveEventToCache(e){this.cachedEventUids.add(TK(e)),this.lastProcessedEventTime=Date.now()}};function TK(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function dY({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function RPe(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return dY(t);default:return!1}}async function MPe(t,e={}){return $n(t,"GET","/v1/projects",e)}var LPe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,FPe=/^https?/;async function BPe(t){if(t.config.emulator)return;let{authorizedDomains:e}=await MPe(t);for(let r of e)try{if($Pe(r))return}catch{}cs(t,"unauthorized-domain")}function $Pe(t){let e=RO(),{protocol:r,hostname:o}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&o===""?r==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):r==="chrome-extension:"&&a.hostname===o}if(!FPe.test(r))return!1;if(LPe.test(t))return o===t;let n=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+n+"|"+n+")$","i").test(o)}var zPe=new Jd(3e4,6e4);function kK(){let t=Js().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let r=0;r<t.CP.length;r++)t.CP[r]=null}}function UPe(t){return new Promise((e,r)=>{function o(){kK(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{kK(),r(Xs(t,"network-request-failed"))},timeout:zPe.get()})}if(Js().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(Js().gapi?.load)o();else{let n=ZK("iframefcb");return Js()[n]=()=>{gapi.load?o():r(Xs(t,"network-request-failed"))},QK(`${FNe()}?onload=${n}`).catch(i=>r(i))}}).catch(e=>{throw FE=null,e})}var FE=null;function VPe(t){return FE=FE||UPe(t),FE}var HPe=new Jd(5e3,15e3),jPe="__/auth/iframe",GPe="emulator/auth/iframe",WPe={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qPe=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function KPe(t){let e=t.config;Ge(e.authDomain,t,"auth-domain-config-required");let r=e.emulator?eA(e,GPe):`https://${t.config.authDomain}/${jPe}`,o={apiKey:e.apiKey,appName:t.name,v:Ks},n=qPe.get(t.config.apiHost);n&&(o.eid=n);let i=t._getFrameworks();return i.length&&(o.fw=i.join(",")),`${r}?${Nm(o).slice(1)}`}async function YPe(t){let e=await VPe(t),r=Js().gapi;return Ge(r,t,"internal-error"),e.open({where:document.body,url:KPe(t),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:WPe,dontclear:!0},o=>new Promise(async(n,i)=>{await o.restyle({setHideOnLeave:!1});let a=Xs(t,"network-request-failed"),s=Js().setTimeout(()=>{i(a)},HPe.get());function l(){Js().clearTimeout(s),n(o)}o.ping(l).then(l,()=>{i(a)})}))}var XPe={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},JPe=500,QPe=600,ZPe="_blank",eOe="http://localhost",o0=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function tOe(t,e,r,o=JPe,n=QPe){let i=Math.max((window.screen.availHeight-n)/2,0).toString(),a=Math.max((window.screen.availWidth-o)/2,0).toString(),s="",l={...XPe,width:o.toString(),height:n.toString(),top:i,left:a},c=Yo().toLowerCase();r&&(s=GK(c)?ZPe:r),HK(c)&&(e=e||eOe,l.scrollbars="yes");let u=Object.entries(l).reduce((f,[m,h])=>`${f}${m}=${h},`,"");if(ONe(c)&&s!=="_self")return rOe(e||"",s),new o0(null);let d=window.open(e||"",s,u);Ge(d,t,"popup-blocked");try{d.focus()}catch{}return new o0(d)}function rOe(t,e){let r=document.createElement("a");r.href=t,r.target=e;let o=document.createEvent("MouseEvent");o.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(o)}var oOe="__/auth/handler",nOe="emulator/auth/handler",iOe=encodeURIComponent("fac");async function NK(t,e,r,o,n,i){Ge(t.config.authDomain,t,"auth-domain-config-required"),Ge(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:r,redirectUrl:o,v:Ks,eventId:n};if(e instanceof KE){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",Zq(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[u,d]of Object.entries(i||{}))a[u]=d}if(e instanceof ef){let u=e.getScopes().filter(d=>d!=="");u.length>0&&(a.scopes=u.join(","))}t.tenantId&&(a.tid=t.tenantId);let s=a;for(let u of Object.keys(s))s[u]===void 0&&delete s[u];let l=await t._getAppCheckToken(),c=l?`#${iOe}=${encodeURIComponent(l)}`:"";return`${aOe(t)}?${Nm(s).slice(1)}${c}`}function aOe({config:t}){return t.emulator?eA(t,nOe):`https://${t.authDomain}/${oOe}`}var DO="webStorageSupport",XO=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=oA,this._completeRedirectFn=APe,this._overrideRedirectResult=NPe}async _openPopup(e,r,o,n){Kl(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let i=await NK(e,r,o,RO(),n);return tOe(e,i,nA())}async _openRedirect(e,r,o,n){await this._originValidation(e);let i=await NK(e,r,o,RO(),n);return uPe(i),new Promise(()=>{})}_initialize(e){let r=e._key();if(this.eventManagers[r]){let{manager:n,promise:i}=this.eventManagers[r];return n?Promise.resolve(n):(Kl(i,"If manager is not set, promise should be"),i)}let o=this.initAndGetManager(e);return this.eventManagers[r]={promise:o},o.catch(()=>{delete this.eventManagers[r]}),o}async initAndGetManager(e){let r=await YPe(e),o=new YO(e);return r.register("authEvent",n=>(Ge(n?.authEvent,e,"invalid-auth-event"),{status:o.onEvent(n.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:o},this.iframes[e._key()]=r,o}_isIframeWebStorageSupported(e,r){this.iframes[e._key()].send(DO,{type:DO},n=>{let i=n?.[0]?.[DO];i!==void 0&&r(!!i),cs(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let r=e._key();return this.originValidationPromises[r]||(this.originValidationPromises[r]=BPe(e)),this.originValidationPromises[r]}get _shouldInitProactively(){return XK()||jK()||rA()}},fY=XO,n0=class{constructor(e){this.factorId=e}_process(e,r,o){switch(r.type){case"enroll":return this._finalizeEnroll(e,r.credential,o);case"signin":return this._finalizeSignIn(e,r.credential);default:return Ys("unexpected MultiFactorSessionType")}}},JO=class t extends n0{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,r,o){return oPe(e,{idToken:r,displayName:o,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,r){return bPe(e,{mfaPendingCredential:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},i0=class{constructor(){}static assertion(e){return JO._fromCredential(e)}};i0.FACTOR_ID="phone";var a0=class{static assertionForEnrollment(e,r){return s0._fromSecret(e,r)}static assertionForSignIn(e,r){return s0._fromEnrollmentId(e,r)}static async generateSecret(e){let r=e;Ge(typeof r.user?.auth<"u","internal-error");let o=await nPe(r.user.auth,{idToken:r.credential,totpEnrollmentInfo:{}});return l0._fromStartTotpMfaEnrollmentResponse(o,r.user.auth)}};a0.FACTOR_ID="totp";var s0=class t extends n0{constructor(e,r,o){super("totp"),this.otp=e,this.enrollmentId=r,this.secret=o}static _fromSecret(e,r){return new t(r,void 0,e)}static _fromEnrollmentId(e,r){return new t(r,e)}async _finalizeEnroll(e,r,o){return Ge(typeof this.secret<"u",e,"argument-error"),iPe(e,{idToken:r,displayName:o,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,r){Ge(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let o={verificationCode:this.otp};return yPe(e,{mfaPendingCredential:r,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:o})}},l0=class t{constructor(e,r,o,n,i,a,s){this.sessionInfo=a,this.auth=s,this.secretKey=e,this.hashingAlgorithm=r,this.codeLength=o,this.codeIntervalSeconds=n,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(e,r){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,r)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,r){let o=!1;return(AE(e)||AE(r))&&(o=!0),o&&(AE(e)&&(e=this.auth.currentUser?.email||"unknownuser"),AE(r)&&(r=this.auth.name)),`otpauth://totp/${r}:${e}?secret=${this.secretKey}&issuer=${r}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function AE(t){return typeof t>"u"||t?.length===0}var PK="@firebase/auth",OK="1.11.0";var QO=class{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 r=this.auth.onIdTokenChanged(o=>{e(o?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,r),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let r=this.internalListeners.get(e);r&&(this.internalListeners.delete(e),r(),this.updateProactiveRefresh())}assertAuthConfigured(){Ge(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function sOe(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function lOe(t){qs(new yi("auth",(e,{options:r})=>{let o=e.getProvider("app").getImmediate(),n=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:s}=o.options;Ge(a&&!a.includes(":"),"invalid-api-key",{appName:o.name});let l={apiKey:a,authDomain:s,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:JK(t)},c=new zO(o,n,i,l);return zNe(c,r),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,r,o)=>{e.getProvider("auth-internal").initialize()})),qs(new yi("auth-internal",e=>{let r=Rm(e.getProvider("auth").getImmediate());return(o=>new QO(o))(r)},"PRIVATE").setInstantiationMode("EXPLICIT")),vi(PK,OK,sOe(t)),vi(PK,OK,"esm2020")}var cOe=300,uOe=dO("authIdTokenMaxAge")||cOe,AK=null,dOe=t=>async e=>{let r=e&&await e.getIdTokenResult(),o=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(o&&o>uOe)return;let n=r?.token;AK!==n&&(AK=n,await fetch(t,{method:n?"POST":"DELETE",headers:n?{Authorization:`Bearer ${n}`}:{}}))};function iA(t=dx()){let e=Yd(t,"auth");if(e.isInitialized())return e.getImmediate();let r=eY(t,{popupRedirectResolver:fY,persistence:[uY,aY,oA]}),o=dO("authTokenSyncURL");if(o&&typeof isSecureContext=="boolean"&&isSecureContext){let i=new URL(o,location.origin);if(location.origin===i.origin){let a=dOe(i.toString());iY(r,a,()=>a(r.currentUser)),nY(r,s=>a(s))}}let n=lO("auth");return n&&tY(r,`http://${n}`),r}function fOe(){return document.getElementsByTagName("head")?.[0]??document}MNe({loadJS(t){return new Promise((e,r)=>{let o=document.createElement("script");o.setAttribute("src",t),o.onload=e,o.onerror=n=>{let i=Xs("internal-error");i.customData=n,r(i)},o.type="text/javascript",o.charset="UTF-8",fOe().appendChild(o)})},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="});lOe("Browser");var pY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},mY={};var Yl,aA;(function(){var t;function e(E,w){function S(){}S.prototype=w.prototype,E.D=w.prototype,E.prototype=new S,E.prototype.constructor=E,E.C=function(T,A,R){for(var P=Array(arguments.length-2),B=2;B<arguments.length;B++)P[B-2]=arguments[B];return w.prototype[A].apply(T,P)}}function r(){this.blockSize=-1}function o(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(o,r),o.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function n(E,w,S){S||(S=0);var T=Array(16);if(typeof w=="string")for(var A=0;16>A;++A)T[A]=w.charCodeAt(S++)|w.charCodeAt(S++)<<8|w.charCodeAt(S++)<<16|w.charCodeAt(S++)<<24;else for(A=0;16>A;++A)T[A]=w[S++]|w[S++]<<8|w[S++]<<16|w[S++]<<24;w=E.g[0],S=E.g[1],A=E.g[2];var R=E.g[3],P=w+(R^S&(A^R))+T[0]+3614090360&4294967295;w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[1]+3905402710&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[2]+606105819&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[3]+3250441966&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[4]+4118548399&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[5]+1200080426&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[6]+2821735955&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[7]+4249261313&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[8]+1770035416&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[9]+2336552879&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[10]+4294925233&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[11]+2304563134&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(R^S&(A^R))+T[12]+1804603682&4294967295,w=S+(P<<7&4294967295|P>>>25),P=R+(A^w&(S^A))+T[13]+4254626195&4294967295,R=w+(P<<12&4294967295|P>>>20),P=A+(S^R&(w^S))+T[14]+2792965006&4294967295,A=R+(P<<17&4294967295|P>>>15),P=S+(w^A&(R^w))+T[15]+1236535329&4294967295,S=A+(P<<22&4294967295|P>>>10),P=w+(A^R&(S^A))+T[1]+4129170786&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[6]+3225465664&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[11]+643717713&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[0]+3921069994&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[5]+3593408605&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[10]+38016083&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[15]+3634488961&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[4]+3889429448&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[9]+568446438&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[14]+3275163606&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[3]+4107603335&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[8]+1163531501&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(A^R&(S^A))+T[13]+2850285829&4294967295,w=S+(P<<5&4294967295|P>>>27),P=R+(S^A&(w^S))+T[2]+4243563512&4294967295,R=w+(P<<9&4294967295|P>>>23),P=A+(w^S&(R^w))+T[7]+1735328473&4294967295,A=R+(P<<14&4294967295|P>>>18),P=S+(R^w&(A^R))+T[12]+2368359562&4294967295,S=A+(P<<20&4294967295|P>>>12),P=w+(S^A^R)+T[5]+4294588738&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[8]+2272392833&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[11]+1839030562&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[14]+4259657740&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[1]+2763975236&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[4]+1272893353&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[7]+4139469664&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[10]+3200236656&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[13]+681279174&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[0]+3936430074&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[3]+3572445317&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[6]+76029189&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(S^A^R)+T[9]+3654602809&4294967295,w=S+(P<<4&4294967295|P>>>28),P=R+(w^S^A)+T[12]+3873151461&4294967295,R=w+(P<<11&4294967295|P>>>21),P=A+(R^w^S)+T[15]+530742520&4294967295,A=R+(P<<16&4294967295|P>>>16),P=S+(A^R^w)+T[2]+3299628645&4294967295,S=A+(P<<23&4294967295|P>>>9),P=w+(A^(S|~R))+T[0]+4096336452&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[7]+1126891415&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[14]+2878612391&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[5]+4237533241&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[12]+1700485571&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[3]+2399980690&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[10]+4293915773&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[1]+2240044497&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[8]+1873313359&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[15]+4264355552&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[6]+2734768916&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[13]+1309151649&4294967295,S=A+(P<<21&4294967295|P>>>11),P=w+(A^(S|~R))+T[4]+4149444226&4294967295,w=S+(P<<6&4294967295|P>>>26),P=R+(S^(w|~A))+T[11]+3174756917&4294967295,R=w+(P<<10&4294967295|P>>>22),P=A+(w^(R|~S))+T[2]+718787259&4294967295,A=R+(P<<15&4294967295|P>>>17),P=S+(R^(A|~w))+T[9]+3951481745&4294967295,E.g[0]=E.g[0]+w&4294967295,E.g[1]=E.g[1]+(A+(P<<21&4294967295|P>>>11))&4294967295,E.g[2]=E.g[2]+A&4294967295,E.g[3]=E.g[3]+R&4294967295}o.prototype.u=function(E,w){w===void 0&&(w=E.length);for(var S=w-this.blockSize,T=this.B,A=this.h,R=0;R<w;){if(A==0)for(;R<=S;)n(this,E,R),R+=this.blockSize;if(typeof E=="string"){for(;R<w;)if(T[A++]=E.charCodeAt(R++),A==this.blockSize){n(this,T),A=0;break}}else for(;R<w;)if(T[A++]=E[R++],A==this.blockSize){n(this,T),A=0;break}}this.h=A,this.o+=w},o.prototype.v=function(){var E=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);E[0]=128;for(var w=1;w<E.length-8;++w)E[w]=0;var S=8*this.o;for(w=E.length-8;w<E.length;++w)E[w]=S&255,S/=256;for(this.u(E),E=Array(16),w=S=0;4>w;++w)for(var T=0;32>T;T+=8)E[S++]=this.g[w]>>>T&255;return E};function i(E,w){var S=s;return Object.prototype.hasOwnProperty.call(S,E)?S[E]:S[E]=w(E)}function a(E,w){this.h=w;for(var S=[],T=!0,A=E.length-1;0<=A;A--){var R=E[A]|0;T&&R==w||(S[A]=R,T=!1)}this.g=S}var s={};function l(E){return-128<=E&&128>E?i(E,function(w){return new a([w|0],0>w?-1:0)}):new a([E|0],0>E?-1:0)}function c(E){if(isNaN(E)||!isFinite(E))return d;if(0>E)return _(c(-E));for(var w=[],S=1,T=0;E>=S;T++)w[T]=E/S|0,S*=4294967296;return new a(w,0)}function u(E,w){if(E.length==0)throw Error("number format error: empty string");if(w=w||10,2>w||36<w)throw Error("radix out of range: "+w);if(E.charAt(0)=="-")return _(u(E.substring(1),w));if(0<=E.indexOf("-"))throw Error('number format error: interior "-" character');for(var S=c(Math.pow(w,8)),T=d,A=0;A<E.length;A+=8){var R=Math.min(8,E.length-A),P=parseInt(E.substring(A,A+R),w);8>R?(R=c(Math.pow(w,R)),T=T.j(R).add(c(P))):(T=T.j(S),T=T.add(c(P)))}return T}var d=l(0),f=l(1),m=l(16777216);t=a.prototype,t.m=function(){if(g(this))return-_(this).m();for(var E=0,w=1,S=0;S<this.g.length;S++){var T=this.i(S);E+=(0<=T?T:4294967296+T)*w,w*=4294967296}return E},t.toString=function(E){if(E=E||10,2>E||36<E)throw Error("radix out of range: "+E);if(h(this))return"0";if(g(this))return"-"+_(this).toString(E);for(var w=c(Math.pow(E,6)),S=this,T="";;){var A=C(S,w).g;S=b(S,A.j(w));var R=((0<S.g.length?S.g[0]:S.h)>>>0).toString(E);if(S=A,h(S))return R+T;for(;6>R.length;)R="0"+R;T=R+T}},t.i=function(E){return 0>E?0:E<this.g.length?this.g[E]:this.h};function h(E){if(E.h!=0)return!1;for(var w=0;w<E.g.length;w++)if(E.g[w]!=0)return!1;return!0}function g(E){return E.h==-1}t.l=function(E){return E=b(this,E),g(E)?-1:h(E)?0:1};function _(E){for(var w=E.g.length,S=[],T=0;T<w;T++)S[T]=~E.g[T];return new a(S,~E.h).add(f)}t.abs=function(){return g(this)?_(this):this},t.add=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0,A=0;A<=w;A++){var R=T+(this.i(A)&65535)+(E.i(A)&65535),P=(R>>>16)+(this.i(A)>>>16)+(E.i(A)>>>16);T=P>>>16,R&=65535,P&=65535,S[A]=P<<16|R}return new a(S,S[S.length-1]&-2147483648?-1:0)};function b(E,w){return E.add(_(w))}t.j=function(E){if(h(this)||h(E))return d;if(g(this))return g(E)?_(this).j(_(E)):_(_(this).j(E));if(g(E))return _(this.j(_(E)));if(0>this.l(m)&&0>E.l(m))return c(this.m()*E.m());for(var w=this.g.length+E.g.length,S=[],T=0;T<2*w;T++)S[T]=0;for(T=0;T<this.g.length;T++)for(var A=0;A<E.g.length;A++){var R=this.i(T)>>>16,P=this.i(T)&65535,B=E.i(A)>>>16,$=E.i(A)&65535;S[2*T+2*A]+=P*$,y(S,2*T+2*A),S[2*T+2*A+1]+=R*$,y(S,2*T+2*A+1),S[2*T+2*A+1]+=P*B,y(S,2*T+2*A+1),S[2*T+2*A+2]+=R*B,y(S,2*T+2*A+2)}for(T=0;T<w;T++)S[T]=S[2*T+1]<<16|S[2*T];for(T=w;T<2*w;T++)S[T]=0;return new a(S,0)};function y(E,w){for(;(E[w]&65535)!=E[w];)E[w+1]+=E[w]>>>16,E[w]&=65535,w++}function v(E,w){this.g=E,this.h=w}function C(E,w){if(h(w))throw Error("division by zero");if(h(E))return new v(d,d);if(g(E))return w=C(_(E),w),new v(_(w.g),_(w.h));if(g(w))return w=C(E,_(w)),new v(_(w.g),w.h);if(30<E.g.length){if(g(E)||g(w))throw Error("slowDivide_ only works with positive integers.");for(var S=f,T=w;0>=T.l(E);)S=N(S),T=N(T);var A=I(S,1),R=I(T,1);for(T=I(T,2),S=I(S,2);!h(T);){var P=R.add(T);0>=P.l(E)&&(A=A.add(S),R=P),T=I(T,1),S=I(S,1)}return w=b(E,A.j(w)),new v(A,w)}for(A=d;0<=E.l(w);){for(S=Math.max(1,Math.floor(E.m()/w.m())),T=Math.ceil(Math.log(S)/Math.LN2),T=48>=T?1:Math.pow(2,T-48),R=c(S),P=R.j(w);g(P)||0<P.l(E);)S-=T,R=c(S),P=R.j(w);h(R)&&(R=f),A=A.add(R),E=b(E,P)}return new v(A,E)}t.A=function(E){return C(this,E).h},t.and=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)&E.i(T);return new a(S,this.h&E.h)},t.or=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)|E.i(T);return new a(S,this.h|E.h)},t.xor=function(E){for(var w=Math.max(this.g.length,E.g.length),S=[],T=0;T<w;T++)S[T]=this.i(T)^E.i(T);return new a(S,this.h^E.h)};function N(E){for(var w=E.g.length+1,S=[],T=0;T<w;T++)S[T]=E.i(T)<<1|E.i(T-1)>>>31;return new a(S,E.h)}function I(E,w){var S=w>>5;w%=32;for(var T=E.g.length-S,A=[],R=0;R<T;R++)A[R]=0<w?E.i(R+S)>>>w|E.i(R+S+1)<<32-w:E.i(R+S);return new a(A,E.h)}o.prototype.digest=o.prototype.v,o.prototype.reset=o.prototype.s,o.prototype.update=o.prototype.u,aA=mY.Md5=o,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,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=u,Yl=mY.Integer=a}).apply(typeof pY<"u"?pY:typeof self<"u"?self:typeof window<"u"?window:{});var d0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xl={};var sA,pOe,Mm,lA,Nx,f0,cA,uA,dA;(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(x,k,O){return x==Array.prototype||x==Object.prototype||(x[k]=O.value),x};function r(x){x=[typeof globalThis=="object"&&globalThis,x,typeof window=="object"&&window,typeof self=="object"&&self,typeof d0=="object"&&d0];for(var k=0;k<x.length;++k){var O=x[k];if(O&&O.Math==Math)return O}throw Error("Cannot find global object")}var o=r(this);function n(x,k){if(k)e:{var O=o;x=x.split(".");for(var F=0;F<x.length-1;F++){var K=x[F];if(!(K in O))break e;O=O[K]}x=x[x.length-1],F=O[x],k=k(F),k!=F&&k!=null&&e(O,x,{configurable:!0,writable:!0,value:k})}}function i(x,k){x instanceof String&&(x+="");var O=0,F=!1,K={next:function(){if(!F&&O<x.length){var Z=O++;return{value:k(Z,x[Z]),done:!1}}return F=!0,{done:!0,value:void 0}}};return K[Symbol.iterator]=function(){return K},K}n("Array.prototype.values",function(x){return x||function(){return i(this,function(k,O){return O})}});var a=a||{},s=this||self;function l(x){var k=typeof x;return k=k!="object"?k:x?Array.isArray(x)?"array":k:"null",k=="array"||k=="object"&&typeof x.length=="number"}function c(x){var k=typeof x;return k=="object"&&x!=null||k=="function"}function u(x,k,O){return x.call.apply(x.bind,arguments)}function d(x,k,O){if(!x)throw Error();if(2<arguments.length){var F=Array.prototype.slice.call(arguments,2);return function(){var K=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(K,F),x.apply(k,K)}}return function(){return x.apply(k,arguments)}}function f(x,k,O){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:d,f.apply(null,arguments)}function m(x,k){var O=Array.prototype.slice.call(arguments,1);return function(){var F=O.slice();return F.push.apply(F,arguments),x.apply(this,F)}}function h(x,k){function O(){}O.prototype=k.prototype,x.aa=k.prototype,x.prototype=new O,x.prototype.constructor=x,x.Qb=function(F,K,Z){for(var be=Array(arguments.length-2),xr=2;xr<arguments.length;xr++)be[xr-2]=arguments[xr];return k.prototype[K].apply(F,be)}}function g(x){let k=x.length;if(0<k){let O=Array(k);for(let F=0;F<k;F++)O[F]=x[F];return O}return[]}function _(x,k){for(let O=1;O<arguments.length;O++){let F=arguments[O];if(l(F)){let K=x.length||0,Z=F.length||0;x.length=K+Z;for(let be=0;be<Z;be++)x[K+be]=F[be]}else x.push(F)}}class b{constructor(k,O){this.i=k,this.j=O,this.h=0,this.g=null}get(){let k;return 0<this.h?(this.h--,k=this.g,this.g=k.next,k.next=null):k=this.i(),k}}function y(x){return/^[\s\xa0]*$/.test(x)}function v(){var x=s.navigator;return x&&(x=x.userAgent)?x:""}function C(x){return C[" "](x),x}C[" "]=function(){};var N=v().indexOf("Gecko")!=-1&&!(v().toLowerCase().indexOf("webkit")!=-1&&v().indexOf("Edge")==-1)&&!(v().indexOf("Trident")!=-1||v().indexOf("MSIE")!=-1)&&v().indexOf("Edge")==-1;function I(x,k,O){for(let F in x)k.call(O,x[F],F,x)}function E(x,k){for(let O in x)k.call(void 0,x[O],O,x)}function w(x){let k={};for(let O in x)k[O]=x[O];return k}let S="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(x,k){let O,F;for(let K=1;K<arguments.length;K++){F=arguments[K];for(O in F)x[O]=F[O];for(let Z=0;Z<S.length;Z++)O=S[Z],Object.prototype.hasOwnProperty.call(F,O)&&(x[O]=F[O])}}function A(x){var k=1;x=x.split(":");let O=[];for(;0<k&&x.length;)O.push(x.shift()),k--;return x.length&&O.push(x.join(":")),O}function R(x){s.setTimeout(()=>{throw x},0)}function P(){var x=Y;let k=null;return x.g&&(k=x.g,x.g=x.g.next,x.g||(x.h=null),k.next=null),k}class B{constructor(){this.h=this.g=null}add(k,O){let F=$.get();F.set(k,O),this.h?this.h.next=F:this.g=F,this.h=F}}var $=new b(()=>new z,x=>x.reset());class z{constructor(){this.next=this.g=this.h=null}set(k,O){this.h=k,this.g=O,this.next=null}reset(){this.next=this.g=this.h=null}}let H,G=!1,Y=new B,L=()=>{let x=s.Promise.resolve(void 0);H=()=>{x.then(ne)}};var ne=()=>{for(var x;x=P();){try{x.h.call(x.g)}catch(O){R(O)}var k=$;k.j(x),100>k.h&&(k.h++,x.next=k.g,k.g=x)}G=!1};function ae(){this.s=this.s,this.C=this.C}ae.prototype.s=!1,ae.prototype.ma=function(){this.s||(this.s=!0,this.N())},ae.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function U(x,k){this.type=x,this.g=this.target=k,this.defaultPrevented=!1}U.prototype.h=function(){this.defaultPrevented=!0};var ge=(function(){if(!s.addEventListener||!Object.defineProperty)return!1;var x=!1,k=Object.defineProperty({},"passive",{get:function(){x=!0}});try{let O=()=>{};s.addEventListener("test",O,k),s.removeEventListener("test",O,k)}catch{}return x})();function Ce(x,k){if(U.call(this,x?x.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,x){var O=this.type=x.type,F=x.changedTouches&&x.changedTouches.length?x.changedTouches[0]:null;if(this.target=x.target||x.srcElement,this.g=k,k=x.relatedTarget){if(N){e:{try{C(k.nodeName);var K=!0;break e}catch{}K=!1}K||(k=null)}}else O=="mouseover"?k=x.fromElement:O=="mouseout"&&(k=x.toElement);this.relatedTarget=k,F?(this.clientX=F.clientX!==void 0?F.clientX:F.pageX,this.clientY=F.clientY!==void 0?F.clientY:F.pageY,this.screenX=F.screenX||0,this.screenY=F.screenY||0):(this.clientX=x.clientX!==void 0?x.clientX:x.pageX,this.clientY=x.clientY!==void 0?x.clientY:x.pageY,this.screenX=x.screenX||0,this.screenY=x.screenY||0),this.button=x.button,this.key=x.key||"",this.ctrlKey=x.ctrlKey,this.altKey=x.altKey,this.shiftKey=x.shiftKey,this.metaKey=x.metaKey,this.pointerId=x.pointerId||0,this.pointerType=typeof x.pointerType=="string"?x.pointerType:He[x.pointerType]||"",this.state=x.state,this.i=x,x.defaultPrevented&&Ce.aa.h.call(this)}}h(Ce,U);var He={2:"touch",3:"pen",4:"mouse"};Ce.prototype.h=function(){Ce.aa.h.call(this);var x=this.i;x.preventDefault?x.preventDefault():x.returnValue=!1};var Qe="closure_listenable_"+(1e6*Math.random()|0),Me=0;function ke(x,k,O,F,K){this.listener=x,this.proxy=null,this.src=k,this.type=O,this.capture=!!F,this.ha=K,this.key=++Me,this.da=this.fa=!1}function at(x){x.da=!0,x.listener=null,x.proxy=null,x.src=null,x.ha=null}function Rt(x){this.src=x,this.g={},this.h=0}Rt.prototype.add=function(x,k,O,F,K){var Z=x.toString();x=this.g[Z],x||(x=this.g[Z]=[],this.h++);var be=ht(x,k,F,K);return-1<be?(k=x[be],O||(k.fa=!1)):(k=new ke(k,this.src,Z,!!F,K),k.fa=O,x.push(k)),k};function ut(x,k){var O=k.type;if(O in x.g){var F=x.g[O],K=Array.prototype.indexOf.call(F,k,void 0),Z;(Z=0<=K)&&Array.prototype.splice.call(F,K,1),Z&&(at(k),x.g[O].length==0&&(delete x.g[O],x.h--))}}function ht(x,k,O,F){for(var K=0;K<x.length;++K){var Z=x[K];if(!Z.da&&Z.listener==k&&Z.capture==!!O&&Z.ha==F)return K}return-1}var bt="closure_lm_"+(1e6*Math.random()|0),Xr={};function Mt(x,k,O,F,K){if(F&&F.once)return Ut(x,k,O,F,K);if(Array.isArray(k)){for(var Z=0;Z<k.length;Z++)Mt(x,k[Z],O,F,K);return null}return O=j(O),x&&x[Qe]?x.K(k,O,c(F)?!!F.capture:!!F,K):ye(x,k,O,!1,F,K)}function ye(x,k,O,F,K,Z){if(!k)throw Error("Invalid event type");var be=c(K)?!!K.capture:!!K,xr=Be(x);if(xr||(x[bt]=xr=new Rt(x)),O=xr.add(k,O,F,be,Z),O.proxy)return O;if(F=dn(),O.proxy=F,F.src=x,F.listener=O,x.addEventListener)ge||(K=be),K===void 0&&(K=!1),x.addEventListener(k.toString(),F,K);else if(x.attachEvent)x.attachEvent(Vr(k.toString()),F);else if(x.addListener&&x.removeListener)x.addListener(F);else throw Error("addEventListener and attachEvent are unavailable.");return O}function dn(){function x(O){return k.call(x.src,x.listener,O)}let k=Do;return x}function Ut(x,k,O,F,K){if(Array.isArray(k)){for(var Z=0;Z<k.length;Z++)Ut(x,k[Z],O,F,K);return null}return O=j(O),x&&x[Qe]?x.L(k,O,c(F)?!!F.capture:!!F,K):ye(x,k,O,!0,F,K)}function pt(x,k,O,F,K){if(Array.isArray(k))for(var Z=0;Z<k.length;Z++)pt(x,k[Z],O,F,K);else F=c(F)?!!F.capture:!!F,O=j(O),x&&x[Qe]?(x=x.i,k=String(k).toString(),k in x.g&&(Z=x.g[k],O=ht(Z,O,F,K),-1<O&&(at(Z[O]),Array.prototype.splice.call(Z,O,1),Z.length==0&&(delete x.g[k],x.h--)))):x&&(x=Be(x))&&(k=x.g[k.toString()],x=-1,k&&(x=ht(k,O,F,K)),(O=-1<x?k[x]:null)&&Ur(O))}function Ur(x){if(typeof x!="number"&&x&&!x.da){var k=x.src;if(k&&k[Qe])ut(k.i,x);else{var O=x.type,F=x.proxy;k.removeEventListener?k.removeEventListener(O,F,x.capture):k.detachEvent?k.detachEvent(Vr(O),F):k.addListener&&k.removeListener&&k.removeListener(F),(O=Be(k))?(ut(O,x),O.h==0&&(O.src=null,k[bt]=null)):at(x)}}}function Vr(x){return x in Xr?Xr[x]:Xr[x]="on"+x}function Do(x,k){if(x.da)x=!0;else{k=new Ce(k,this);var O=x.listener,F=x.ha||x.src;x.fa&&Ur(x),x=O.call(F,k)}return x}function Be(x){return x=x[bt],x instanceof Rt?x:null}var ie="__closure_events_fn_"+(1e9*Math.random()>>>0);function j(x){return typeof x=="function"?x:(x[ie]||(x[ie]=function(k){return x.handleEvent(k)}),x[ie])}function Q(){ae.call(this),this.i=new Rt(this),this.M=this,this.F=null}h(Q,ae),Q.prototype[Qe]=!0,Q.prototype.removeEventListener=function(x,k,O,F){pt(this,x,k,O,F)};function se(x,k){var O,F=x.F;if(F)for(O=[];F;F=F.F)O.push(F);if(x=x.M,F=k.type||k,typeof k=="string")k=new U(k,x);else if(k instanceof U)k.target=k.target||x;else{var K=k;k=new U(F,x),T(k,K)}if(K=!0,O)for(var Z=O.length-1;0<=Z;Z--){var be=k.g=O[Z];K=Ve(be,F,!0,k)&&K}if(be=k.g=x,K=Ve(be,F,!0,k)&&K,K=Ve(be,F,!1,k)&&K,O)for(Z=0;Z<O.length;Z++)be=k.g=O[Z],K=Ve(be,F,!1,k)&&K}Q.prototype.N=function(){if(Q.aa.N.call(this),this.i){var x=this.i,k;for(k in x.g){for(var O=x.g[k],F=0;F<O.length;F++)at(O[F]);delete x.g[k],x.h--}}this.F=null},Q.prototype.K=function(x,k,O,F){return this.i.add(String(x),k,!1,O,F)},Q.prototype.L=function(x,k,O,F){return this.i.add(String(x),k,!0,O,F)};function Ve(x,k,O,F){if(k=x.i.g[String(k)],!k)return!0;k=k.concat();for(var K=!0,Z=0;Z<k.length;++Z){var be=k[Z];if(be&&!be.da&&be.capture==O){var xr=be.listener,xn=be.ha||be.src;be.fa&&ut(x.i,be),K=xr.call(xn,F)!==!1&&K}}return K&&!F.defaultPrevented}function yt(x,k,O){if(typeof x=="function")O&&(x=f(x,O));else if(x&&typeof x.handleEvent=="function")x=f(x.handleEvent,x);else throw Error("Invalid listener argument");return 2147483647<Number(k)?-1:s.setTimeout(x,k||0)}function Nt(x){x.g=yt(()=>{x.g=null,x.i&&(x.i=!1,Nt(x))},x.l);let k=x.h;x.h=null,x.m.apply(null,k)}class Mn extends ae{constructor(k,O){super(),this.m=k,this.l=O,this.h=null,this.i=!1,this.g=null}j(k){this.h=arguments,this.g?this.i=!0:Nt(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function _r(x){ae.call(this),this.h=x,this.g={}}h(_r,ae);var Nr=[];function Xn(x){I(x.g,function(k,O){this.g.hasOwnProperty(O)&&Ur(k)},x),x.g={}}_r.prototype.N=function(){_r.aa.N.call(this),Xn(this)},_r.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var io=s.JSON.stringify,fn=s.JSON.parse,pn=class{stringify(x){return s.JSON.stringify(x,void 0)}parse(x){return s.JSON.parse(x,void 0)}};function Sl(){}Sl.prototype.h=null;function mn(x){return x.h||(x.h=x.i())}function fr(){}var Ui={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Ln(){U.call(this,"d")}h(Ln,U);function bi(){U.call(this,"c")}h(bi,U);var ha={},hn=null;function gn(){return hn=hn||new Q}ha.La="serverreachability";function Rc(x){U.call(this,ha.La,x)}h(Rc,U);function Cl(x){let k=gn();se(k,new Rc(k))}ha.STAT_EVENT="statevent";function As(x,k){U.call(this,ha.STAT_EVENT,x),this.stat=k}h(As,U);function Xt(x){let k=gn();se(k,new As(k,x))}ha.Ma="timingevent";function Ds(x,k){U.call(this,ha.Ma,x),this.size=k}h(Ds,U);function Rs(x,k){if(typeof x!="function")throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){x()},k)}function jo(){this.g=!0}jo.prototype.xa=function(){this.g=!1};function Vi(x,k,O,F,K,Z){x.info(function(){if(x.g)if(Z)for(var be="",xr=Z.split("&"),xn=0;xn<xr.length;xn++){var Jt=xr[xn].split("=");if(1<Jt.length){var Fn=Jt[0];Jt=Jt[1];var Bn=Fn.split("_");be=2<=Bn.length&&Bn[1]=="type"?be+(Fn+"="+Jt+"&"):be+(Fn+"=redacted&")}}else be=null;else be=Z;return"XMLHTTP REQ ("+F+") [attempt "+K+"]: "+k+`
26
26
  `+O+`
27
27
  `+be})}function Ro(x,k,O,F,K,Z,be){x.info(function(){return"XMLHTTP RESP ("+F+") [ attempt "+K+"]: "+k+`
28
28
  `+O+`
@@ -30,20 +30,20 @@ https://github.com/highlightjs/highlight.js/issues/2277`),L=z,Y=H),G===void 0&&(
30
30
  `,O);return F==-1?Tl:(O=Number(k.substring(O,F)),isNaN(O)?Hr:(F+=1,F+O>k.length?Tl:(k=k.slice(F,F+O),x.C=F+O,k)))}Hi.prototype.cancel=function(){this.J=!0,_n(this)};function Ee(x){x.S=Date.now()+x.I,Pr(x,x.I)}function Pr(x,k){if(x.B!=null)throw Error("WatchDog timer not null");x.B=Rs(f(x.ba,x),k)}function we(x){x.B&&(s.clearTimeout(x.B),x.B=null)}Hi.prototype.ba=function(){this.B=null;let x=Date.now();0<=x-this.S?(r_(this.i,this.A),this.L!=2&&(Cl(),Xt(17)),_n(this),this.s=2,It(this)):Pr(this,this.S-x)};function It(x){x.j.G==0||x.J||s$(x.j,x)}function _n(x){we(x);var k=x.M;k&&typeof k.ma=="function"&&k.ma(),x.M=null,Xn(x.U),x.g&&(k=x.g,x.g=null,k.abort(),k.ma())}function ga(x,k){try{var O=x.j;if(O.G!=0&&(O.g==x||Vk(O.h,x))){if(!x.K&&Vk(O.h,x)&&O.G==3){try{var F=O.Da.g.parse(k)}catch{F=null}if(Array.isArray(F)&&F.length==3){var K=F;if(K[0]==0){e:if(!O.u){if(O.g)if(O.g.F+3e3<x.F)zv(O),Bv(O);else break e;Wk(O),Xt(18)}}else O.za=K[1],0<O.za-O.T&&37500>K[2]&&O.F&&O.v==0&&!O.C&&(O.C=Rs(f(O.Za,O),6e3));if(1>=$s(O.h)&&O.ca){try{O.ca()}catch{}O.ca=void 0}}else yd(O,11)}else if((x.K||O.g==x)&&zv(O),!y(k))for(K=O.Da.g.parse(k),k=0;k<K.length;k++){let Jt=K[k];if(O.T=Jt[0],Jt=Jt[1],O.G==2)if(Jt[0]=="c"){O.K=Jt[1],O.ia=Jt[2];let Fn=Jt[3];Fn!=null&&(O.la=Fn,O.j.info("VER="+O.la));let Bn=Jt[4];Bn!=null&&(O.Aa=Bn,O.j.info("SVER="+O.Aa));let Lp=Jt[5];Lp!=null&&typeof Lp=="number"&&0<Lp&&(F=1.5*Lp,O.L=F,O.j.info("backChannelRequestTimeoutMs_="+F)),F=O;let es=x.g;if(es){let Vv=es.g?es.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Vv){var Z=F.h;Z.g||Vv.indexOf("spdy")==-1&&Vv.indexOf("quic")==-1&&Vv.indexOf("h2")==-1||(Z.j=Z.l,Z.g=new Set,Z.h&&(Hk(Z,Z.h),Z.h=null))}if(F.D){let Kk=es.g?es.g.getResponseHeader("X-HTTP-Session-Id"):null;Kk&&(F.ya=Kk,Or(F.I,F.D,Kk))}}O.G=3,O.l&&O.l.ua(),O.ba&&(O.R=Date.now()-x.F,O.j.info("Handshake RTT: "+O.R+"ms")),F=O;var be=x;if(F.qa=u$(F,F.J?F.ia:null,F.W),be.K){$3(F.h,be);var xr=be,xn=F.L;xn&&(xr.I=xn),xr.B&&(we(xr),Ee(xr)),F.g=be}else i$(F);0<O.i.length&&$v(O)}else Jt[0]!="stop"&&Jt[0]!="close"||yd(O,7);else O.G==3&&(Jt[0]=="stop"||Jt[0]=="close"?Jt[0]=="stop"?yd(O,7):Gk(O):Jt[0]!="noop"&&O.l&&O.l.ta(Jt),O.v=0)}}Cl(4)}catch{}}var Nl=class{constructor(x,k){this.g=x,this.map=k}};function _a(x){this.l=x||10,s.PerformanceNavigationTiming?(x=s.performance.getEntriesByType("navigation"),x=0<x.length&&(x[0].nextHopProtocol=="hq"||x[0].nextHopProtocol=="h2")):x=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=x?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Mc(x){return x.h?!0:x.g?x.g.size>=x.j:!1}function $s(x){return x.h?1:x.g?x.g.size:0}function Vk(x,k){return x.h?x.h==k:x.g?x.g.has(k):!1}function Hk(x,k){x.g?x.g.add(k):x.h=k}function $3(x,k){x.h&&x.h==k?x.h=null:x.g&&x.g.has(k)&&x.g.delete(k)}_a.prototype.cancel=function(){if(this.i=z3(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let x of this.g.values())x.cancel();this.g.clear()}};function z3(x){if(x.h!=null)return x.i.concat(x.h.D);if(x.g!=null&&x.g.size!==0){let k=x.i;for(let O of x.g.values())k=k.concat(O.D);return k}return g(x.i)}function Fhe(x){if(x.V&&typeof x.V=="function")return x.V();if(typeof Map<"u"&&x instanceof Map||typeof Set<"u"&&x instanceof Set)return Array.from(x.values());if(typeof x=="string")return x.split("");if(l(x)){for(var k=[],O=x.length,F=0;F<O;F++)k.push(x[F]);return k}k=[],O=0;for(F in x)k[O++]=x[F];return k}function Bhe(x){if(x.na&&typeof x.na=="function")return x.na();if(!x.V||typeof x.V!="function"){if(typeof Map<"u"&&x instanceof Map)return Array.from(x.keys());if(!(typeof Set<"u"&&x instanceof Set)){if(l(x)||typeof x=="string"){var k=[];x=x.length;for(var O=0;O<x;O++)k.push(O);return k}k=[],O=0;for(let F in x)k[O++]=F;return k}}}function U3(x,k){if(x.forEach&&typeof x.forEach=="function")x.forEach(k,void 0);else if(l(x)||typeof x=="string")Array.prototype.forEach.call(x,k,void 0);else for(var O=Bhe(x),F=Fhe(x),K=F.length,Z=0;Z<K;Z++)k.call(void 0,F[Z],O&&O[Z],x)}var V3=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $he(x,k){if(x){x=x.split("&");for(var O=0;O<x.length;O++){var F=x[O].indexOf("="),K=null;if(0<=F){var Z=x[O].substring(0,F);K=x[O].substring(F+1)}else Z=x[O];k(Z,K?decodeURIComponent(K.replace(/\+/g," ")):"")}}}function bd(x){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,x instanceof bd){this.h=x.h,Dv(this,x.j),this.o=x.o,this.g=x.g,Rv(this,x.s),this.l=x.l;var k=x.i,O=new i_;O.i=k.i,k.g&&(O.g=new Map(k.g),O.h=k.h),H3(this,O),this.m=x.m}else x&&(k=String(x).match(V3))?(this.h=!1,Dv(this,k[1]||"",!0),this.o=o_(k[2]||""),this.g=o_(k[3]||"",!0),Rv(this,k[4]),this.l=o_(k[5]||"",!0),H3(this,k[6]||"",!0),this.m=o_(k[7]||"")):(this.h=!1,this.i=new i_(null,this.h))}bd.prototype.toString=function(){var x=[],k=this.j;k&&x.push(n_(k,j3,!0),":");var O=this.g;return(O||k=="file")&&(x.push("//"),(k=this.o)&&x.push(n_(k,j3,!0),"@"),x.push(encodeURIComponent(String(O)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),O=this.s,O!=null&&x.push(":",String(O))),(O=this.l)&&(this.g&&O.charAt(0)!="/"&&x.push("/"),x.push(n_(O,O.charAt(0)=="/"?Vhe:Uhe,!0))),(O=this.i.toString())&&x.push("?",O),(O=this.m)&&x.push("#",n_(O,jhe)),x.join("")};function Pl(x){return new bd(x)}function Dv(x,k,O){x.j=O?o_(k,!0):k,x.j&&(x.j=x.j.replace(/:$/,""))}function Rv(x,k){if(k){if(k=Number(k),isNaN(k)||0>k)throw Error("Bad port number "+k);x.s=k}else x.s=null}function H3(x,k,O){k instanceof i_?(x.i=k,Ghe(x.i,x.h)):(O||(k=n_(k,Hhe)),x.i=new i_(k,x.h))}function Or(x,k,O){x.i.set(k,O)}function Mv(x){return Or(x,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),x}function o_(x,k){return x?k?decodeURI(x.replace(/%25/g,"%2525")):decodeURIComponent(x):""}function n_(x,k,O){return typeof x=="string"?(x=encodeURI(x).replace(k,zhe),O&&(x=x.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),x):null}function zhe(x){return x=x.charCodeAt(0),"%"+(x>>4&15).toString(16)+(x&15).toString(16)}var j3=/[#\/\?@]/g,Uhe=/[#\?:]/g,Vhe=/[#\?]/g,Hhe=/[#\?@]/g,jhe=/#/g;function i_(x,k){this.h=this.g=null,this.i=x||null,this.j=!!k}function Lc(x){x.g||(x.g=new Map,x.h=0,x.i&&$he(x.i,function(k,O){x.add(decodeURIComponent(k.replace(/\+/g," ")),O)}))}t=i_.prototype,t.add=function(x,k){Lc(this),this.i=null,x=Rp(this,x);var O=this.g.get(x);return O||this.g.set(x,O=[]),O.push(k),this.h+=1,this};function G3(x,k){Lc(x),k=Rp(x,k),x.g.has(k)&&(x.i=null,x.h-=x.g.get(k).length,x.g.delete(k))}function W3(x,k){return Lc(x),k=Rp(x,k),x.g.has(k)}t.forEach=function(x,k){Lc(this),this.g.forEach(function(O,F){O.forEach(function(K){x.call(k,K,F,this)},this)},this)},t.na=function(){Lc(this);let x=Array.from(this.g.values()),k=Array.from(this.g.keys()),O=[];for(let F=0;F<k.length;F++){let K=x[F];for(let Z=0;Z<K.length;Z++)O.push(k[F])}return O},t.V=function(x){Lc(this);let k=[];if(typeof x=="string")W3(this,x)&&(k=k.concat(this.g.get(Rp(this,x))));else{x=Array.from(this.g.values());for(let O=0;O<x.length;O++)k=k.concat(x[O])}return k},t.set=function(x,k){return Lc(this),this.i=null,x=Rp(this,x),W3(this,x)&&(this.h-=this.g.get(x).length),this.g.set(x,[k]),this.h+=1,this},t.get=function(x,k){return x?(x=this.V(x),0<x.length?String(x[0]):k):k};function q3(x,k,O){G3(x,k),0<O.length&&(x.i=null,x.g.set(Rp(x,k),g(O)),x.h+=O.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";let x=[],k=Array.from(this.g.keys());for(var O=0;O<k.length;O++){var F=k[O];let Z=encodeURIComponent(String(F)),be=this.V(F);for(F=0;F<be.length;F++){var K=Z;be[F]!==""&&(K+="="+encodeURIComponent(String(be[F]))),x.push(K)}}return this.i=x.join("&")};function Rp(x,k){return k=String(k),x.j&&(k=k.toLowerCase()),k}function Ghe(x,k){k&&!x.j&&(Lc(x),x.i=null,x.g.forEach(function(O,F){var K=F.toLowerCase();F!=K&&(G3(this,F),q3(this,K,O))},x)),x.j=k}function Whe(x,k){let O=new jo;if(s.Image){let F=new Image;F.onload=m(Fc,O,"TestLoadImage: loaded",!0,k,F),F.onerror=m(Fc,O,"TestLoadImage: error",!1,k,F),F.onabort=m(Fc,O,"TestLoadImage: abort",!1,k,F),F.ontimeout=m(Fc,O,"TestLoadImage: timeout",!1,k,F),s.setTimeout(function(){F.ontimeout&&F.ontimeout()},1e4),F.src=x}else k(!1)}function qhe(x,k){let O=new jo,F=new AbortController,K=setTimeout(()=>{F.abort(),Fc(O,"TestPingServer: timeout",!1,k)},1e4);fetch(x,{signal:F.signal}).then(Z=>{clearTimeout(K),Z.ok?Fc(O,"TestPingServer: ok",!0,k):Fc(O,"TestPingServer: server error",!1,k)}).catch(()=>{clearTimeout(K),Fc(O,"TestPingServer: error",!1,k)})}function Fc(x,k,O,F,K){try{K&&(K.onload=null,K.onerror=null,K.onabort=null,K.ontimeout=null),F(O)}catch{}}function Khe(){this.g=new pn}function Yhe(x,k,O){let F=O||"";try{U3(x,function(K,Z){let be=K;c(K)&&(be=io(K)),k.push(F+Z+"="+encodeURIComponent(be))})}catch(K){throw k.push(F+"type="+encodeURIComponent("_badmap")),K}}function a_(x){this.l=x.Ub||null,this.j=x.eb||!1}h(a_,Sl),a_.prototype.g=function(){return new Lv(this.l,this.j)},a_.prototype.i=(function(x){return function(){return x}})({});function Lv(x,k){Q.call(this),this.D=x,this.o=k,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}h(Lv,Q),t=Lv.prototype,t.open=function(x,k){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=x,this.A=k,this.readyState=1,l_(this)},t.send=function(x){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let k={headers:this.u,method:this.B,credentials:this.m,cache:void 0};x&&(k.body=x),(this.D||s).fetch(new Request(this.A,k)).then(this.Sa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,s_(this)),this.readyState=0},t.Sa=function(x){if(this.g&&(this.l=x,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=x.headers,this.readyState=2,l_(this)),this.g&&(this.readyState=3,l_(this),this.g)))if(this.responseType==="arraybuffer")x.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof s.ReadableStream<"u"&&"body"in x){if(this.j=x.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;K3(this)}else x.text().then(this.Ra.bind(this),this.ga.bind(this))};function K3(x){x.j.read().then(x.Pa.bind(x)).catch(x.ga.bind(x))}t.Pa=function(x){if(this.g){if(this.o&&x.value)this.response.push(x.value);else if(!this.o){var k=x.value?x.value:new Uint8Array(0);(k=this.v.decode(k,{stream:!x.done}))&&(this.response=this.responseText+=k)}x.done?s_(this):l_(this),this.readyState==3&&K3(this)}},t.Ra=function(x){this.g&&(this.response=this.responseText=x,s_(this))},t.Qa=function(x){this.g&&(this.response=x,s_(this))},t.ga=function(){this.g&&s_(this)};function s_(x){x.readyState=4,x.l=null,x.j=null,x.v=null,l_(x)}t.setRequestHeader=function(x,k){this.u.append(x,k)},t.getResponseHeader=function(x){return this.h&&this.h.get(x.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";let x=[],k=this.h.entries();for(var O=k.next();!O.done;)O=O.value,x.push(O[0]+": "+O[1]),O=k.next();return x.join(`\r
31
31
  `)};function l_(x){x.onreadystatechange&&x.onreadystatechange.call(x)}Object.defineProperty(Lv.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(x){this.m=x?"include":"same-origin"}});function Y3(x){let k="";return I(x,function(O,F){k+=F,k+=":",k+=O,k+=`\r
32
32
  `}),k}function jk(x,k,O){e:{for(F in O){var F=!1;break e}F=!0}F||(O=Y3(O),typeof x=="string"?O!=null&&encodeURIComponent(String(O)):Or(x,k,O))}function Jr(x){Q.call(this),this.headers=new Map,this.o=x||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}h(Jr,Q);var Xhe=/^https?$/i,Jhe=["POST","PUT"];t=Jr.prototype,t.Ha=function(x){this.J=x},t.ea=function(x,k,O,F){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+x);k=k?k.toUpperCase():"GET",this.D=x,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Lo.g(),this.v=this.o?mn(this.o):mn(Lo),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(k,String(x),!0),this.B=!1}catch(Z){X3(this,Z);return}if(x=O||"",O=new Map(this.headers),F)if(Object.getPrototypeOf(F)===Object.prototype)for(var K in F)O.set(K,F[K]);else if(typeof F.keys=="function"&&typeof F.get=="function")for(let Z of F.keys())O.set(Z,F.get(Z));else throw Error("Unknown input type for opt_headers: "+String(F));F=Array.from(O.keys()).find(Z=>Z.toLowerCase()=="content-type"),K=s.FormData&&x instanceof s.FormData,!(0<=Array.prototype.indexOf.call(Jhe,k,void 0))||F||K||O.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[Z,be]of O)this.g.setRequestHeader(Z,be);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Z3(this),this.u=!0,this.g.send(x),this.u=!1}catch(Z){X3(this,Z)}};function X3(x,k){x.h=!1,x.g&&(x.j=!0,x.g.abort(),x.j=!1),x.l=k,x.m=5,J3(x),Fv(x)}function J3(x){x.A||(x.A=!0,se(x,"complete"),se(x,"error"))}t.abort=function(x){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=x||7,se(this,"complete"),se(this,"abort"),Fv(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Fv(this,!0)),Jr.aa.N.call(this)},t.Ea=function(){this.s||(this.B||this.u||this.j?Q3(this):this.bb())},t.bb=function(){Q3(this)};function Q3(x){if(x.h&&typeof a<"u"&&(!x.v[1]||Ol(x)!=4||x.Z()!=2)){if(x.u&&Ol(x)==4)yt(x.Ea,0,x);else if(se(x,"readystatechange"),Ol(x)==4){x.h=!1;try{let be=x.Z();e:switch(be){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var k=!0;break e;default:k=!1}var O;if(!(O=k)){var F;if(F=be===0){var K=String(x.D).match(V3)[1]||null;!K&&s.self&&s.self.location&&(K=s.self.location.protocol.slice(0,-1)),F=!Xhe.test(K?K.toLowerCase():"")}O=F}if(O)se(x,"complete"),se(x,"success");else{x.m=6;try{var Z=2<Ol(x)?x.g.statusText:""}catch{Z=""}x.l=Z+" ["+x.Z()+"]",J3(x)}}finally{Fv(x)}}}}function Fv(x,k){if(x.g){Z3(x);let O=x.g,F=x.v[0]?()=>{}:null;x.g=null,x.v=null,k||se(x,"ready");try{O.onreadystatechange=F}catch{}}}function Z3(x){x.I&&(s.clearTimeout(x.I),x.I=null)}t.isActive=function(){return!!this.g};function Ol(x){return x.g?x.g.readyState:0}t.Z=function(){try{return 2<Ol(this)?this.g.status:-1}catch{return-1}},t.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.Oa=function(x){if(this.g){var k=this.g.responseText;return x&&k.indexOf(x)==0&&(k=k.substring(x.length)),fn(k)}};function e$(x){try{if(!x.g)return null;if("response"in x.g)return x.g.response;switch(x.H){case"":case"text":return x.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in x.g)return x.g.mozResponseArrayBuffer}return null}catch{return null}}function Qhe(x){let k={};x=(x.g&&2<=Ol(x)&&x.g.getAllResponseHeaders()||"").split(`\r
33
- `);for(let F=0;F<x.length;F++){if(y(x[F]))continue;var O=A(x[F]);let K=O[0];if(O=O[1],typeof O!="string")continue;O=O.trim();let Z=k[K]||[];k[K]=Z,Z.push(O)}E(k,function(F){return F.join(", ")})}t.Ba=function(){return this.m},t.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function c_(x,k,O){return O&&O.internalChannelParams&&O.internalChannelParams[x]||k}function t$(x){this.Aa=0,this.i=[],this.j=new jo,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=c_("failFast",!1,x),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=c_("baseRetryDelayMs",5e3,x),this.cb=c_("retryDelaySeedMs",1e4,x),this.Wa=c_("forwardChannelMaxRetries",2,x),this.wa=c_("forwardChannelRequestTimeoutMs",2e4,x),this.pa=x&&x.xmlHttpFactory||void 0,this.Xa=x&&x.Tb||void 0,this.Ca=x&&x.useFetchStreams||!1,this.L=void 0,this.J=x&&x.supportsCrossDomainXhr||!1,this.K="",this.h=new _a(x&&x.concurrentRequestLimit),this.Da=new Khe,this.P=x&&x.fastHandshake||!1,this.O=x&&x.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=x&&x.Rb||!1,x&&x.xa&&this.j.xa(),x&&x.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&x&&x.detectBufferingProxy||!1,this.ja=void 0,x&&x.longPollingTimeout&&0<x.longPollingTimeout&&(this.ja=x.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}t=t$.prototype,t.la=8,t.G=1,t.connect=function(x,k,O,F){Xt(0),this.W=x,this.H=k||{},O&&F!==void 0&&(this.H.OSID=O,this.H.OAID=F),this.F=this.X,this.I=u$(this,null,this.W),$v(this)};function Gk(x){if(r$(x),x.G==3){var k=x.U++,O=Pl(x.I);if(Or(O,"SID",x.K),Or(O,"RID",k),Or(O,"TYPE","terminate"),u_(x,O),k=new Hi(x,x.j,k),k.L=2,k.v=Mv(Pl(O)),O=!1,s.navigator&&s.navigator.sendBeacon)try{O=s.navigator.sendBeacon(k.v.toString(),"")}catch{}!O&&s.Image&&(new Image().src=k.v,O=!0),O||(k.g=d$(k.j,null),k.g.ea(k.v)),k.F=Date.now(),Ee(k)}c$(x)}function Bv(x){x.g&&(qk(x),x.g.cancel(),x.g=null)}function r$(x){Bv(x),x.u&&(s.clearTimeout(x.u),x.u=null),zv(x),x.h.cancel(),x.s&&(typeof x.s=="number"&&s.clearTimeout(x.s),x.s=null)}function $v(x){if(!Mc(x.h)&&!x.s){x.s=!0;var k=x.Ga;H||L(),G||(H(),G=!0),Y.add(k,x),x.B=0}}function Zhe(x,k){return $s(x.h)>=x.h.j-(x.s?1:0)?!1:x.s?(x.i=k.D.concat(x.i),!0):x.G==1||x.G==2||x.B>=(x.Va?0:x.Wa)?!1:(x.s=Rs(f(x.Ga,x,k),l$(x,x.B)),x.B++,!0)}t.Ga=function(x){if(this.s)if(this.s=null,this.G==1){if(!x){this.U=Math.floor(1e5*Math.random()),x=this.U++;let K=new Hi(this,this.j,x),Z=this.o;if(this.S&&(Z?(Z=w(Z),T(Z,this.S)):Z=this.S),this.m!==null||this.O||(K.H=Z,Z=null),this.P)e:{for(var k=0,O=0;O<this.i.length;O++){t:{var F=this.i[O];if("__data__"in F.map&&(F=F.map.__data__,typeof F=="string")){F=F.length;break t}F=void 0}if(F===void 0)break;if(k+=F,4096<k){k=O;break e}if(k===4096||O===this.i.length-1){k=O+1;break e}}k=1e3}else k=1e3;k=n$(this,K,k),O=Pl(this.I),Or(O,"RID",x),Or(O,"CVER",22),this.D&&Or(O,"X-HTTP-Session-Id",this.D),u_(this,O),Z&&(this.O?k="headers="+encodeURIComponent(String(Y3(Z)))+"&"+k:this.m&&jk(O,this.m,Z)),Hk(this.h,K),this.Ua&&Or(O,"TYPE","init"),this.P?(Or(O,"$req",k),Or(O,"SID","null"),K.T=!0,Bs(K,O,null)):Bs(K,O,k),this.G=2}}else this.G==3&&(x?o$(this,x):this.i.length==0||Mc(this.h)||o$(this))};function o$(x,k){var O;k?O=k.l:O=x.U++;let F=Pl(x.I);Or(F,"SID",x.K),Or(F,"RID",O),Or(F,"AID",x.T),u_(x,F),x.m&&x.o&&jk(F,x.m,x.o),O=new Hi(x,x.j,O,x.B+1),x.m===null&&(O.H=x.o),k&&(x.i=k.D.concat(x.i)),k=n$(x,O,1e3),O.I=Math.round(.5*x.wa)+Math.round(.5*x.wa*Math.random()),Hk(x.h,O),Bs(O,F,k)}function u_(x,k){x.H&&I(x.H,function(O,F){Or(k,F,O)}),x.l&&U3({},function(O,F){Or(k,F,O)})}function n$(x,k,O){O=Math.min(x.i.length,O);var F=x.l?f(x.l.Na,x.l,x):null;e:{var K=x.i;let Z=-1;for(;;){let be=["count="+O];Z==-1?0<O?(Z=K[0].g,be.push("ofs="+Z)):Z=0:be.push("ofs="+Z);let xr=!0;for(let xn=0;xn<O;xn++){let Jt=K[xn].g,Fn=K[xn].map;if(Jt-=Z,0>Jt)Z=Math.max(0,K[xn].g-100),xr=!1;else try{Yhe(Fn,be,"req"+Jt+"_")}catch{F&&F(Fn)}}if(xr){F=be.join("&");break e}}}return x=x.i.splice(0,O),k.D=x,F}function i$(x){if(!x.g&&!x.u){x.Y=1;var k=x.Fa;H||L(),G||(H(),G=!0),Y.add(k,x),x.v=0}}function Wk(x){return x.g||x.u||3<=x.v?!1:(x.Y++,x.u=Rs(f(x.Fa,x),l$(x,x.v)),x.v++,!0)}t.Fa=function(){if(this.u=null,a$(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var x=2*this.R;this.j.info("BP detection timer enabled: "+x),this.A=Rs(f(this.ab,this),x)}},t.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Xt(10),Bv(this),a$(this))};function qk(x){x.A!=null&&(s.clearTimeout(x.A),x.A=null)}function a$(x){x.g=new Hi(x,x.j,"rpc",x.Y),x.m===null&&(x.g.H=x.o),x.g.O=0;var k=Pl(x.qa);Or(k,"RID","rpc"),Or(k,"SID",x.K),Or(k,"AID",x.T),Or(k,"CI",x.F?"0":"1"),!x.F&&x.ja&&Or(k,"TO",x.ja),Or(k,"TYPE","xmlhttp"),u_(x,k),x.m&&x.o&&jk(k,x.m,x.o),x.L&&(x.g.I=x.L);var O=x.g;x=x.ia,O.L=1,O.v=Mv(Pl(k)),O.m=null,O.P=!0,Ap(O,x)}t.Za=function(){this.C!=null&&(this.C=null,Bv(this),Wk(this),Xt(19))};function zv(x){x.C!=null&&(s.clearTimeout(x.C),x.C=null)}function s$(x,k){var O=null;if(x.g==k){zv(x),qk(x),x.g=null;var F=2}else if(Vk(x.h,k))O=k.D,$3(x.h,k),F=1;else return;if(x.G!=0){if(k.o)if(F==1){O=k.m?k.m.length:0,k=Date.now()-k.F;var K=x.B;F=gn(),se(F,new Ds(F,O)),$v(x)}else i$(x);else if(K=k.s,K==3||K==0&&0<k.X||!(F==1&&Zhe(x,k)||F==2&&Wk(x)))switch(O&&0<O.length&&(k=x.h,k.i=k.i.concat(O)),K){case 1:yd(x,5);break;case 4:yd(x,10);break;case 3:yd(x,6);break;default:yd(x,2)}}}function l$(x,k){let O=x.Ta+Math.floor(Math.random()*x.cb);return x.isActive()||(O*=2),O*k}function yd(x,k){if(x.j.info("Error code "+k),k==2){var O=f(x.fb,x),F=x.Xa;let K=!F;F=new bd(F||"//www.google.com/images/cleardot.gif"),s.location&&s.location.protocol=="http"||Dv(F,"https"),Mv(F),K?Whe(F.toString(),O):qhe(F.toString(),O)}else Xt(2);x.G=0,x.l&&x.l.sa(k),c$(x),r$(x)}t.fb=function(x){x?(this.j.info("Successfully pinged google.com"),Xt(2)):(this.j.info("Failed to ping google.com"),Xt(1))};function c$(x){if(x.G=0,x.ka=[],x.l){let k=z3(x.h);(k.length!=0||x.i.length!=0)&&(_(x.ka,k),_(x.ka,x.i),x.h.i.length=0,g(x.i),x.i.length=0),x.l.ra()}}function u$(x,k,O){var F=O instanceof bd?Pl(O):new bd(O);if(F.g!="")k&&(F.g=k+"."+F.g),Rv(F,F.s);else{var K=s.location;F=K.protocol,k=k?k+"."+K.hostname:K.hostname,K=+K.port;var Z=new bd(null);F&&Dv(Z,F),k&&(Z.g=k),K&&Rv(Z,K),O&&(Z.l=O),F=Z}return O=x.D,k=x.ya,O&&k&&Or(F,O,k),Or(F,"VER",x.la),u_(x,F),F}function d$(x,k,O){if(k&&!x.J)throw Error("Can't create secondary domain capable XhrIo object.");return k=x.Ca&&!x.pa?new Jr(new a_({eb:O})):new Jr(x.pa),k.Ha(x.J),k}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function f$(){}t=f$.prototype,t.ua=function(){},t.ta=function(){},t.sa=function(){},t.ra=function(){},t.isActive=function(){return!0},t.Na=function(){};function Uv(){}Uv.prototype.g=function(x,k){return new ji(x,k)};function ji(x,k){Q.call(this),this.g=new t$(k),this.l=x,this.h=k&&k.messageUrlParams||null,x=k&&k.messageHeaders||null,k&&k.clientProtocolHeaderRequired&&(x?x["X-Client-Protocol"]="webchannel":x={"X-Client-Protocol":"webchannel"}),this.g.o=x,x=k&&k.initMessageHeaders||null,k&&k.messageContentType&&(x?x["X-WebChannel-Content-Type"]=k.messageContentType:x={"X-WebChannel-Content-Type":k.messageContentType}),k&&k.va&&(x?x["X-WebChannel-Client-Profile"]=k.va:x={"X-WebChannel-Client-Profile":k.va}),this.g.S=x,(x=k&&k.Sb)&&!y(x)&&(this.g.m=x),this.v=k&&k.supportsCrossDomainXhr||!1,this.u=k&&k.sendRawJson||!1,(k=k&&k.httpSessionIdParam)&&!y(k)&&(this.g.D=k,x=this.h,x!==null&&k in x&&(x=this.h,k in x&&delete x[k])),this.j=new Mp(this)}h(ji,Q),ji.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},ji.prototype.close=function(){Gk(this.g)},ji.prototype.o=function(x){var k=this.g;if(typeof x=="string"){var O={};O.__data__=x,x=O}else this.u&&(O={},O.__data__=io(x),x=O);k.i.push(new Nl(k.Ya++,x)),k.G==3&&$v(k)},ji.prototype.N=function(){this.g.l=null,delete this.j,Gk(this.g),delete this.g,ji.aa.N.call(this)};function p$(x){Ln.call(this),x.__headers__&&(this.headers=x.__headers__,this.statusCode=x.__status__,delete x.__headers__,delete x.__status__);var k=x.__sm__;if(k){e:{for(let O in k){x=O;break e}x=void 0}(this.i=x)&&(x=this.i,k=k!==null&&x in k?k[x]:void 0),this.data=k}else this.data=x}h(p$,Ln);function m$(){bi.call(this),this.status=1}h(m$,bi);function Mp(x){this.g=x}h(Mp,f$),Mp.prototype.ua=function(){se(this.g,"a")},Mp.prototype.ta=function(x){se(this.g,new p$(x))},Mp.prototype.sa=function(x){se(this.g,new m$)},Mp.prototype.ra=function(){se(this.g,"b")},Uv.prototype.createWebChannel=Uv.prototype.g,ji.prototype.send=ji.prototype.o,ji.prototype.open=ji.prototype.m,ji.prototype.close=ji.prototype.close,dA=Xl.createWebChannelTransport=function(){return new Uv},uA=Xl.getStatEventTarget=function(){return gn()},cA=Xl.Event=ha,fE=Xl.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},vt.NO_ERROR=0,vt.TIMEOUT=8,vt.HTTP_ERROR=6,Nx=Xl.ErrorCode=vt,Za.COMPLETE="complete",lA=Xl.EventType=Za,fr.EventType=Ui,Ui.OPEN="a",Ui.CLOSE="b",Ui.ERROR="c",Ui.MESSAGE="d",Q.prototype.listen=Q.prototype.K,Mm=Xl.WebChannel=fr,pOe=Xl.FetchXmlHttpFactory=a_,Jr.prototype.listenOnce=Jr.prototype.L,Jr.prototype.getLastError=Jr.prototype.Ka,Jr.prototype.getLastErrorCode=Jr.prototype.Ba,Jr.prototype.getStatus=Jr.prototype.Z,Jr.prototype.getResponseJson=Jr.prototype.Oa,Jr.prototype.getResponseText=Jr.prototype.oa,Jr.prototype.send=Jr.prototype.ea,Jr.prototype.setWithCredentials=Jr.prototype.Ha,sA=Xl.XhrIo=Jr}).apply(typeof dE<"u"?dE:typeof self<"u"?self:typeof window<"u"?window:{});var hY="@firebase/firestore",gY="4.9.1";var Un=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};Un.UNAUTHENTICATED=new Un(null),Un.GOOGLE_CREDENTIALS=new Un("google-credentials-uid"),Un.FIRST_PARTY=new Un("first-party-uid"),Un.MOCK_USER=new Un("mock-user");var rh="12.2.0";var sf=new ru("@firebase/firestore");function Lm(){return sf.logLevel}function Le(t,...e){if(sf.logLevel<=Pt.DEBUG){let r=e.map(nR);sf.debug(`Firestore (${rh}): ${t}`,...r)}}function Ql(t,...e){if(sf.logLevel<=Pt.ERROR){let r=e.map(nR);sf.error(`Firestore (${rh}): ${t}`,...r)}}function Lx(t,...e){if(sf.logLevel<=Pt.WARN){let r=e.map(nR);sf.warn(`Firestore (${rh}): ${t}`,...r)}}function nR(t){if(typeof t=="string")return t;try{return(function(r){return JSON.stringify(r)})(t)}catch{return t}}function rt(t,e,r){let o="Unexpected state";typeof e=="string"?o=e:r=e,iX(t,o,r)}function iX(t,e,r){let o=`FIRESTORE (${rh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(r!==void 0)try{o+=" CONTEXT: "+JSON.stringify(r)}catch{o+=" CONTEXT: "+r}throw Ql(o),new Error(o)}function Gt(t,e,r,o){let n="Unexpected state";typeof r=="string"?n=r:o=r,t||iX(e,n,o)}function gt(t,e){return t}var te={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},xe=class extends li{constructor(e,r){super(e,r),this.code=e,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Oa=class{constructor(){this.promise=new Promise(((e,r)=>{this.resolve=e,this.reject=r}))}};var gA=class{constructor(e,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},_A=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,r){e.enqueueRetryable((()=>r(Un.UNAUTHENTICATED)))}shutdown(){}};var xA=class{constructor(e){this.t=e,this.currentUser=Un.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,r){Gt(this.o===void 0,42304);let o=this.i,n=l=>this.i!==o?(o=this.i,r(l)):Promise.resolve(),i=new Oa;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Oa,e.enqueueRetryable((()=>n(this.currentUser)))};let a=()=>{let l=i;e.enqueueRetryable((async()=>{await l.promise,await n(this.currentUser)}))},s=l=>{Le("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((l=>s(l))),setTimeout((()=>{if(!this.auth){let l=this.t.getImmediate({optional:!0});l?s(l):(Le("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Oa)}}),0),a()}getToken(){let e=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then((o=>this.i!==e?(Le("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):o?(Gt(typeof o.accessToken=="string",31837,{l:o}),new gA(o.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 Gt(e===null||typeof e=="string",2055,{h:e}),new Un(e)}},bA=class{constructor(e,r,o){this.P=e,this.T=r,this.I=o,this.type="FirstParty",this.user=Un.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},yA=class{constructor(e,r,o){this.P=e,this.T=r,this.I=o}getToken(){return Promise.resolve(new bA(this.P,this.T,this.I))}start(e,r){e.enqueueRetryable((()=>r(Un.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},bE=class{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}},vA=class{constructor(e,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Ii(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,r){Gt(this.o===void 0,3512);let o=i=>{i.error!=null&&Le("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);let a=i.token!==this.m;return this.m=i.token,Le("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?r(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>o(i)))};let n=i=>{Le("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>n(i))),setTimeout((()=>{if(!this.appCheck){let i=this.V.getImmediate({optional:!0});i?n(i):Le("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new bE(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((r=>r?(Gt(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new bE(r.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function mOe(t){let e=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(r);else for(let o=0;o<t;o++)r[o]=Math.floor(256*Math.random());return r}var Fx=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=62*Math.floor(4.129032258064516),o="";for(;o.length<20;){let n=mOe(40);for(let i=0;i<n.length;++i)o.length<20&&n[i]<r&&(o+=e.charAt(n[i]%62))}return o}};function Bt(t,e){return t<e?-1:t>e?1:0}function IA(t,e){let r=Math.min(t.length,e.length);for(let o=0;o<r;o++){let n=t.charAt(o),i=e.charAt(o);if(n!==i)return fA(n)===fA(i)?Bt(n,i):fA(n)?1:-1}return Bt(t.length,e.length)}var hOe=55296,gOe=57343;function fA(t){let e=t.charCodeAt(0);return e>=hOe&&e<=gOe}function Hm(t,e,r){return t.length===e.length&&t.every(((o,n)=>r(o,e[n])))}var wA="__name__",yE=class t{constructor(e,r,o){r===void 0?r=0:r>e.length&&rt(637,{offset:r,range:e.length}),o===void 0?o=e.length-r:o>e.length-r&&rt(1746,{length:o,range:e.length-r}),this.segments=e,this.offset=r,this.len=o}get length(){return this.len}isEqual(e){return t.comparator(this,e)===0}child(e){let r=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach((o=>{r.push(o)})):r.push(e),this.construct(r)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}forEach(e){for(let r=this.offset,o=this.limit();r<o;r++)e(this.segments[r])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,r){let o=Math.min(e.length,r.length);for(let n=0;n<o;n++){let i=t.compareSegments(e.get(n),r.get(n));if(i!==0)return i}return Bt(e.length,r.length)}static compareSegments(e,r){let o=t.isNumericId(e),n=t.isNumericId(r);return o&&!n?-1:!o&&n?1:o&&n?t.extractNumericId(e).compare(t.extractNumericId(r)):IA(e,r)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Yl.fromString(e.substring(4,e.length-2))}},Sr=class t extends yE{construct(e,r,o){return new t(e,r,o)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let r=[];for(let o of e){if(o.indexOf("//")>=0)throw new xe(te.INVALID_ARGUMENT,`Invalid segment (${o}). Paths must not contain // in them.`);r.push(...o.split("/").filter((n=>n.length>0)))}return new t(r)}static emptyPath(){return new t([])}},_Oe=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Xi=class t extends yE{construct(e,r,o){return new t(e,r,o)}static isValidIdentifier(e){return _Oe.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===wA}static keyField(){return new t([wA])}static fromServerFormat(e){let r=[],o="",n=0,i=()=>{if(o.length===0)throw new xe(te.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(o),o=""},a=!1;for(;n<e.length;){let s=e[n];if(s==="\\"){if(n+1===e.length)throw new xe(te.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let l=e[n+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new xe(te.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);o+=l,n+=2}else s==="`"?(a=!a,n++):s!=="."||a?(o+=s,n++):(i(),n++)}if(i(),a)throw new xe(te.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(r)}static emptyPath(){return new t([])}};var ot=class t{constructor(e){this.path=e}static fromPath(e){return new t(Sr.fromString(e))}static fromName(e){return new t(Sr.fromString(e).popFirst(5))}static empty(){return new t(Sr.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Sr.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,r){return Sr.comparator(e.path,r.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new t(new Sr(e.slice()))}};function aX(t,e,r){if(!r)throw new xe(te.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function xOe(t,e,r,o){if(e===!0&&o===!0)throw new xe(te.INVALID_ARGUMENT,`${t} and ${r} cannot be used together.`)}function _Y(t){if(!ot.isDocumentKey(t))throw new xe(te.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function xY(t){if(ot.isDocumentKey(t))throw new xe(te.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function sX(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function eS(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{let e=(function(o){return o.constructor?o.constructor.name:null})(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":rt(12329,{type:typeof t})}function Ei(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new xe(te.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=eS(t);throw new xe(te.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${r}`)}}return t}function bOe(t,e){if(e<=0)throw new xe(te.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}function Co(t,e){let r={typeString:t};return e&&(r.value=e),r}function eb(t,e){if(!sX(t))throw new xe(te.INVALID_ARGUMENT,"JSON must be an object");let r;for(let o in e)if(e[o]){let n=e[o].typeString,i="value"in e[o]?{value:e[o].value}:void 0;if(!(o in t)){r=`JSON missing required field: '${o}'`;break}let a=t[o];if(n&&typeof a!==n){r=`JSON field '${o}' must be a ${n}.`;break}if(i!==void 0&&a!==i.value){r=`Expected '${o}' field to equal '${i.value}'`;break}}if(r)throw new xe(te.INVALID_ARGUMENT,r);return!0}var bY=-62135596800,yY=1e6,Tt=class t{static now(){return t.fromMillis(Date.now())}static fromDate(e){return t.fromMillis(e.getTime())}static fromMillis(e){let r=Math.floor(e/1e3),o=Math.floor((e-1e3*r)*yY);return new t(r,o)}constructor(e,r){if(this.seconds=e,this.nanoseconds=r,r<0)throw new xe(te.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new xe(te.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(e<bY)throw new xe(te.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new xe(te.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/yY}_compareTo(e){return this.seconds===e.seconds?Bt(this.nanoseconds,e.nanoseconds):Bt(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:t._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(eb(e,t._jsonSchema))return new t(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-bY;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};Tt._jsonSchemaVersion="firestore/timestamp/1.0",Tt._jsonSchema={type:Co("string",Tt._jsonSchemaVersion),seconds:Co("number"),nanoseconds:Co("number")};var mt=class t{static fromTimestamp(e){return new t(e)}static min(){return new t(new Tt(0,0))}static max(){return new t(new Tt(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};var Bx=-1,EA=class{constructor(e,r,o,n){this.indexId=e,this.collectionGroup=r,this.fields=o,this.indexState=n}};EA.UNKNOWN_ID=-1;function yOe(t,e){let r=t.toTimestamp().seconds,o=t.toTimestamp().nanoseconds+1,n=mt.fromTimestamp(o===1e9?new Tt(r+1,0):new Tt(r,o));return new lf(n,ot.empty(),e)}function vOe(t){return new lf(t.readTime,t.key,Bx)}var lf=class t{constructor(e,r,o){this.readTime=e,this.documentKey=r,this.largestBatchId=o}static min(){return new t(mt.min(),ot.empty(),Bx)}static max(){return new t(mt.max(),ot.empty(),Bx)}};function IOe(t,e){let r=t.readTime.compareTo(e.readTime);return r!==0?r:(r=ot.comparator(t.documentKey,e.documentKey),r!==0?r:Bt(t.largestBatchId,e.largestBatchId))}var wOe="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",SA=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function oh(t){if(t.code!==te.FAILED_PRECONDITION||t.message!==wOe)throw t;Le("LocalStore","Unexpectedly lost primary lease")}var fe=class t{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)}),(r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)}))}catch(e){return this.next(void 0,e)}next(e,r){return this.callbackAttached&&rt(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(e,this.result):new t(((o,n)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(o,n)},this.catchCallback=i=>{this.wrapFailure(r,i).next(o,n)}}))}toPromise(){return new Promise(((e,r)=>{this.next(e,r)}))}wrapUserFunction(e){try{let r=e();return r instanceof t?r:t.resolve(r)}catch(r){return t.reject(r)}}wrapSuccess(e,r){return e?this.wrapUserFunction((()=>e(r))):t.resolve(r)}wrapFailure(e,r){return e?this.wrapUserFunction((()=>e(r))):t.reject(r)}static resolve(e){return new t(((r,o)=>{r(e)}))}static reject(e){return new t(((r,o)=>{o(e)}))}static waitFor(e){return new t(((r,o)=>{let n=0,i=0,a=!1;e.forEach((s=>{++n,s.next((()=>{++i,a&&i===n&&r()}),(l=>o(l)))})),a=!0,i===n&&r()}))}static or(e){let r=t.resolve(!1);for(let o of e)r=r.next((n=>n?t.resolve(n):o()));return r}static forEach(e,r){let o=[];return e.forEach(((n,i)=>{o.push(r.call(this,n,i))})),this.waitFor(o)}static mapArray(e,r){return new t(((o,n)=>{let i=e.length,a=new Array(i),s=0;for(let l=0;l<i;l++){let c=l;r(e[c]).next((u=>{a[c]=u,++s,s===i&&o(a)}),(u=>n(u)))}}))}static doWhile(e,r){return new t(((o,n)=>{let i=()=>{e()===!0?r().next((()=>{i()}),n):o()};i()}))}};function EOe(t){let e=t.match(/Android ([\d.]+)/i),r=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(r)}function nh(t){return t.name==="IndexedDbTransactionError"}var jm=class{constructor(e,r){this.previousValue=e,r&&(r.sequenceNumberHandler=o=>this.ae(o),this.ue=o=>r.writeSequenceNumber(o))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};jm.ce=-1;var iR=-1;function tb(t){return t==null}function $x(t){return t===0&&1/t==-1/0}function SOe(t){return typeof t=="number"&&Number.isInteger(t)&&!$x(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var lX="";function COe(t){let e="";for(let r=0;r<t.length;r++)e.length>0&&(e=vY(e)),e=TOe(t.get(r),e);return vY(e)}function TOe(t,e){let r=e,o=t.length;for(let n=0;n<o;n++){let i=t.charAt(n);switch(i){case"\0":r+="";break;case lX:r+="";break;default:r+=i}}return r}function vY(t){return t+lX+""}var kOe="remoteDocuments",cX="owner";var uX="mutationQueues";var dX="mutations";var fX="documentMutations",NOe="remoteDocumentsV14";var pX="remoteDocumentGlobal";var mX="targets";var hX="targetDocuments";var gX="targetGlobal",_X="collectionParents";var xX="clientMetadata";var bX="bundles";var yX="namedQueries";var POe="indexConfiguration";var OOe="indexState";var AOe="indexEntries";var vX="documentOverlays";var DOe="globals";var ROe=[uX,dX,fX,kOe,mX,cX,gX,hX,xX,pX,_X,bX,yX],bEt=[...ROe,vX],MOe=[uX,dX,fX,NOe,mX,cX,gX,hX,xX,pX,_X,bX,yX,vX],LOe=MOe,FOe=[...LOe,POe,OOe,AOe];var yEt=[...FOe,DOe];function IY(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function _u(t,e){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e(r,t[r])}function IX(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Zr=class t{constructor(e,r){this.comparator=e,this.root=r||Qs.EMPTY}insert(e,r){return new t(this.comparator,this.root.insert(e,r,this.comparator).copy(null,null,Qs.BLACK,null,null))}remove(e){return new t(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Qs.BLACK,null,null))}get(e){let r=this.root;for(;!r.isEmpty();){let o=this.comparator(e,r.key);if(o===0)return r.value;o<0?r=r.left:o>0&&(r=r.right)}return null}indexOf(e){let r=0,o=this.root;for(;!o.isEmpty();){let n=this.comparator(e,o.key);if(n===0)return r+o.left.size;n<0?o=o.left:(r+=o.left.size+1,o=o.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(((r,o)=>(e(r,o),!1)))}toString(){let e=[];return this.inorderTraversal(((r,o)=>(e.push(`${r}:${o}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new zm(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new zm(this.root,e,this.comparator,!1)}getReverseIterator(){return new zm(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new zm(this.root,e,this.comparator,!0)}},zm=class{constructor(e,r,o,n){this.isReverse=n,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=r?o(e.key,r):1,r&&n&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),r={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 r}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},Qs=class t{constructor(e,r,o,n,i){this.key=e,this.value=r,this.color=o??t.RED,this.left=n??t.EMPTY,this.right=i??t.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,r,o,n,i){return new t(e??this.key,r??this.value,o??this.color,n??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,r,o){let n=this,i=o(e,n.key);return n=i<0?n.copy(null,null,null,n.left.insert(e,r,o),null):i===0?n.copy(null,r,null,null,null):n.copy(null,null,null,null,n.right.insert(e,r,o)),n.fixUp()}removeMin(){if(this.left.isEmpty())return t.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,r){let o,n=this;if(r(e,n.key)<0)n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()||(n=n.moveRedLeft()),n=n.copy(null,null,null,n.left.remove(e,r),null);else{if(n.left.isRed()&&(n=n.rotateRight()),n.right.isEmpty()||n.right.isRed()||n.right.left.isRed()||(n=n.moveRedRight()),r(e,n.key)===0){if(n.right.isEmpty())return t.EMPTY;o=n.right.min(),n=n.copy(o.key,o.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(e,r))}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.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,t.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),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,r)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw rt(43730,{key:this.key,value:this.value});if(this.right.isRed())throw rt(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw rt(27949);return e+(this.isRed()?0:1)}};Qs.EMPTY=null,Qs.RED=!0,Qs.BLACK=!1;Qs.EMPTY=new class{constructor(){this.size=0}get key(){throw rt(57766)}get value(){throw rt(16141)}get color(){throw rt(16727)}get left(){throw rt(29726)}get right(){throw rt(36894)}copy(e,r,o,n,i){return this}insert(e,r,o){return new Qs(e,r)}remove(e,r){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}};var Jo=class t{constructor(e){this.comparator=e,this.data=new Zr(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((r,o)=>(e(r),!1)))}forEachInRange(e,r){let o=this.data.getIteratorFrom(e[0]);for(;o.hasNext();){let n=o.getNext();if(this.comparator(n.key,e[1])>=0)return;r(n.key)}}forEachWhile(e,r){let o;for(o=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();o.hasNext();)if(!e(o.getNext().key))return}firstAfterOrEqual(e){let r=this.data.getIteratorFrom(e);return r.hasNext()?r.getNext().key:null}getIterator(){return new vE(this.data.getIterator())}getIteratorFrom(e){return new vE(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 r=this;return r.size<e.size&&(r=e,e=this),e.forEach((o=>{r=r.add(o)})),r}isEqual(e){if(!(e instanceof t)||this.size!==e.size)return!1;let r=this.data.getIterator(),o=e.data.getIterator();for(;r.hasNext();){let n=r.getNext().key,i=o.getNext().key;if(this.comparator(n,i)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((r=>{e.push(r)})),e}toString(){let e=[];return this.forEach((r=>e.push(r))),"SortedSet("+e.toString()+")"}copy(e){let r=new t(this.comparator);return r.data=e,r}},vE=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};var Pa=class t{constructor(e){this.fields=e,e.sort(Xi.comparator)}static empty(){return new t([])}unionWith(e){let r=new Jo(Xi.comparator);for(let o of this.fields)r=r.add(o);for(let o of e)r=r.add(o);return new t(r.toArray())}covers(e){for(let r of this.fields)if(r.isPrefixOf(e))return!0;return!1}isEqual(e){return Hm(this.fields,e.fields,((r,o)=>r.isEqual(o)))}};var IE=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var Vn=class t{constructor(e){this.binaryString=e}static fromBase64String(e){let r=(function(n){try{return atob(n)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new IE("Invalid base64 string: "+i):i}})(e);return new t(r)}static fromUint8Array(e){let r=(function(n){let i="";for(let a=0;a<n.length;++a)i+=String.fromCharCode(n[a]);return i})(e);return new t(r)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(r){return btoa(r)})(this.binaryString)}toUint8Array(){return(function(r){let o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Bt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Vn.EMPTY_BYTE_STRING=new Vn("");var BOe=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Zl(t){if(Gt(!!t,39018),typeof t=="string"){let e=0,r=BOe.exec(t);if(Gt(!!r,46558,{timestamp:t}),r[1]){let n=r[1];n=(n+"000000000").substr(0,9),e=Number(n)}let o=new Date(t);return{seconds:Math.floor(o.getTime()/1e3),nanos:e}}return{seconds:Rr(t.seconds),nanos:Rr(t.nanos)}}function Rr(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function ec(t){return typeof t=="string"?Vn.fromBase64String(t):Vn.fromUint8Array(t)}var wX="server_timestamp",EX="__type__",SX="__previous_value__",CX="__local_write_time__";function aR(t){return(t?.mapValue?.fields||{})[EX]?.stringValue===wX}function tS(t){let e=t.mapValue.fields[SX];return aR(e)?tS(e):e}function zx(t){let e=Zl(t.mapValue.fields[CX].timestampValue);return new Tt(e.seconds,e.nanos)}var CA=class{constructor(e,r,o,n,i,a,s,l,c,u){this.databaseId=e,this.appId=r,this.persistenceKey=o,this.host=n,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=s,this.longPollingOptions=l,this.useFetchStreams=c,this.isUsingEmulator=u}},wE="(default)",EE=class t{constructor(e,r){this.projectId=e,this.database=r||wE}static empty(){return new t("","")}get isDefaultDatabase(){return this.database===wE}isEqual(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database}};var sR="__type__",TX="__max__",pE={mapValue:{fields:{__type__:{stringValue:TX}}}},lR="__vector__",Gm="value";function fu(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?aR(t)?4:NX(t)?9007199254740991:kX(t)?10:11:rt(28295,{value:t})}function el(t,e){if(t===e)return!0;let r=fu(t);if(r!==fu(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return zx(t).isEqual(zx(e));case 3:return(function(n,i){if(typeof n.timestampValue=="string"&&typeof i.timestampValue=="string"&&n.timestampValue.length===i.timestampValue.length)return n.timestampValue===i.timestampValue;let a=Zl(n.timestampValue),s=Zl(i.timestampValue);return a.seconds===s.seconds&&a.nanos===s.nanos})(t,e);case 5:return t.stringValue===e.stringValue;case 6:return(function(n,i){return ec(n.bytesValue).isEqual(ec(i.bytesValue))})(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return(function(n,i){return Rr(n.geoPointValue.latitude)===Rr(i.geoPointValue.latitude)&&Rr(n.geoPointValue.longitude)===Rr(i.geoPointValue.longitude)})(t,e);case 2:return(function(n,i){if("integerValue"in n&&"integerValue"in i)return Rr(n.integerValue)===Rr(i.integerValue);if("doubleValue"in n&&"doubleValue"in i){let a=Rr(n.doubleValue),s=Rr(i.doubleValue);return a===s?$x(a)===$x(s):isNaN(a)&&isNaN(s)}return!1})(t,e);case 9:return Hm(t.arrayValue.values||[],e.arrayValue.values||[],el);case 10:case 11:return(function(n,i){let a=n.mapValue.fields||{},s=i.mapValue.fields||{};if(IY(a)!==IY(s))return!1;for(let l in a)if(a.hasOwnProperty(l)&&(s[l]===void 0||!el(a[l],s[l])))return!1;return!0})(t,e);default:return rt(52216,{left:t})}}function Ux(t,e){return(t.values||[]).find((r=>el(r,e)))!==void 0}function Wm(t,e){if(t===e)return 0;let r=fu(t),o=fu(e);if(r!==o)return Bt(r,o);switch(r){case 0:case 9007199254740991:return 0;case 1:return Bt(t.booleanValue,e.booleanValue);case 2:return(function(i,a){let s=Rr(i.integerValue||i.doubleValue),l=Rr(a.integerValue||a.doubleValue);return s<l?-1:s>l?1:s===l?0:isNaN(s)?isNaN(l)?0:-1:1})(t,e);case 3:return wY(t.timestampValue,e.timestampValue);case 4:return wY(zx(t),zx(e));case 5:return IA(t.stringValue,e.stringValue);case 6:return(function(i,a){let s=ec(i),l=ec(a);return s.compareTo(l)})(t.bytesValue,e.bytesValue);case 7:return(function(i,a){let s=i.split("/"),l=a.split("/");for(let c=0;c<s.length&&c<l.length;c++){let u=Bt(s[c],l[c]);if(u!==0)return u}return Bt(s.length,l.length)})(t.referenceValue,e.referenceValue);case 8:return(function(i,a){let s=Bt(Rr(i.latitude),Rr(a.latitude));return s!==0?s:Bt(Rr(i.longitude),Rr(a.longitude))})(t.geoPointValue,e.geoPointValue);case 9:return EY(t.arrayValue,e.arrayValue);case 10:return(function(i,a){let s=i.fields||{},l=a.fields||{},c=s[Gm]?.arrayValue,u=l[Gm]?.arrayValue,d=Bt(c?.values?.length||0,u?.values?.length||0);return d!==0?d:EY(c,u)})(t.mapValue,e.mapValue);case 11:return(function(i,a){if(i===pE.mapValue&&a===pE.mapValue)return 0;if(i===pE.mapValue)return 1;if(a===pE.mapValue)return-1;let s=i.fields||{},l=Object.keys(s),c=a.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let d=0;d<l.length&&d<u.length;++d){let f=IA(l[d],u[d]);if(f!==0)return f;let m=Wm(s[l[d]],c[u[d]]);if(m!==0)return m}return Bt(l.length,u.length)})(t.mapValue,e.mapValue);default:throw rt(23264,{he:r})}}function wY(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return Bt(t,e);let r=Zl(t),o=Zl(e),n=Bt(r.seconds,o.seconds);return n!==0?n:Bt(r.nanos,o.nanos)}function EY(t,e){let r=t.values||[],o=e.values||[];for(let n=0;n<r.length&&n<o.length;++n){let i=Wm(r[n],o[n]);if(i)return i}return Bt(r.length,o.length)}function qm(t){return TA(t)}function TA(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?(function(r){let o=Zl(r);return`time(${o.seconds},${o.nanos})`})(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?(function(r){return ec(r).toBase64()})(t.bytesValue):"referenceValue"in t?(function(r){return ot.fromName(r).toString()})(t.referenceValue):"geoPointValue"in t?(function(r){return`geo(${r.latitude},${r.longitude})`})(t.geoPointValue):"arrayValue"in t?(function(r){let o="[",n=!0;for(let i of r.values||[])n?n=!1:o+=",",o+=TA(i);return o+"]"})(t.arrayValue):"mapValue"in t?(function(r){let o=Object.keys(r.fields||{}).sort(),n="{",i=!0;for(let a of o)i?i=!1:n+=",",n+=`${a}:${TA(r.fields[a])}`;return n+"}"})(t.mapValue):rt(61005,{value:t})}function gE(t){switch(fu(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=tS(t);return e?16+gE(e):16;case 5:return 2*t.stringValue.length;case 6:return ec(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(function(o){return(o.values||[]).reduce(((n,i)=>n+gE(i)),0)})(t.arrayValue);case 10:case 11:return(function(o){let n=0;return _u(o.fields,((i,a)=>{n+=i.length+gE(a)})),n})(t.mapValue);default:throw rt(13486,{value:t})}}function SY(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function kA(t){return!!t&&"integerValue"in t}function cR(t){return!!t&&"arrayValue"in t}function CY(t){return!!t&&"nullValue"in t}function TY(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function _E(t){return!!t&&"mapValue"in t}function kX(t){return(t?.mapValue?.fields||{})[sR]?.stringValue===lR}function Ox(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){let e={mapValue:{fields:{}}};return _u(t.mapValue.fields,((r,o)=>e.mapValue.fields[r]=Ox(o))),e}if(t.arrayValue){let e={arrayValue:{values:[]}};for(let r=0;r<(t.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=Ox(t.arrayValue.values[r]);return e}return{...t}}function NX(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===TX}var IEt={mapValue:{fields:{[sR]:{stringValue:lR},[Gm]:{arrayValue:{}}}}};var wi=class t{constructor(e){this.value=e}static empty(){return new t({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let r=this.value;for(let o=0;o<e.length-1;++o)if(r=(r.mapValue.fields||{})[e.get(o)],!_E(r))return null;return r=(r.mapValue.fields||{})[e.lastSegment()],r||null}}set(e,r){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ox(r)}setAll(e){let r=Xi.emptyPath(),o={},n=[];e.forEach(((a,s)=>{if(!r.isImmediateParentOf(s)){let l=this.getFieldsMap(r);this.applyChanges(l,o,n),o={},n=[],r=s.popLast()}a?o[s.lastSegment()]=Ox(a):n.push(s.lastSegment())}));let i=this.getFieldsMap(r);this.applyChanges(i,o,n)}delete(e){let r=this.field(e.popLast());_E(r)&&r.mapValue.fields&&delete r.mapValue.fields[e.lastSegment()]}isEqual(e){return el(this.value,e.value)}getFieldsMap(e){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let o=0;o<e.length;++o){let n=r.mapValue.fields[e.get(o)];_E(n)&&n.mapValue.fields||(n={mapValue:{fields:{}}},r.mapValue.fields[e.get(o)]=n),r=n}return r.mapValue.fields}applyChanges(e,r,o){_u(r,((n,i)=>e[n]=i));for(let n of o)delete e[n]}clone(){return new t(Ox(this.value))}};function PX(t){let e=[];return _u(t.fields,((r,o)=>{let n=new Xi([r]);if(_E(o)){let i=PX(o.mapValue).fields;if(i.length===0)e.push(n);else for(let a of i)e.push(n.child(a))}else e.push(n)})),new Pa(e)}var Qi=class t{constructor(e,r,o,n,i,a,s){this.key=e,this.documentType=r,this.version=o,this.readTime=n,this.createTime=i,this.data=a,this.documentState=s}static newInvalidDocument(e){return new t(e,0,mt.min(),mt.min(),mt.min(),wi.empty(),0)}static newFoundDocument(e,r,o,n){return new t(e,1,r,mt.min(),o,n,0)}static newNoDocument(e,r){return new t(e,2,r,mt.min(),mt.min(),wi.empty(),0)}static newUnknownDocument(e,r){return new t(e,3,r,mt.min(),mt.min(),wi.empty(),2)}convertToFoundDocument(e,r){return!this.createTime.isEqual(mt.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=wi.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=wi.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=mt.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof t&&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 t(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}})`}};var Km=class{constructor(e,r){this.position=e,this.inclusive=r}};function kY(t,e,r){let o=0;for(let n=0;n<t.position.length;n++){let i=e[n],a=t.position[n];if(i.field.isKeyField()?o=ot.comparator(ot.fromName(a.referenceValue),r.key):o=Wm(a,r.data.field(i.field)),i.dir==="desc"&&(o*=-1),o!==0)break}return o}function NY(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let r=0;r<t.position.length;r++)if(!el(t.position[r],e.position[r]))return!1;return!0}var cf=class{constructor(e,r="asc"){this.field=e,this.dir=r}};function $Oe(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}var SE=class{},So=class t extends SE{constructor(e,r,o){super(),this.field=e,this.op=r,this.value=o}static create(e,r,o){return e.isKeyField()?r==="in"||r==="not-in"?this.createKeyFieldInFilter(e,r,o):new PA(e,r,o):r==="array-contains"?new DA(e,o):r==="in"?new RA(e,o):r==="not-in"?new MA(e,o):r==="array-contains-any"?new LA(e,o):new t(e,r,o)}static createKeyFieldInFilter(e,r,o){return r==="in"?new OA(e,o):new AA(e,o)}matches(e){let r=e.data.field(this.field);return this.op==="!="?r!==null&&r.nullValue===void 0&&this.matchesComparison(Wm(r,this.value)):r!==null&&fu(this.value)===fu(r)&&this.matchesComparison(Wm(r,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return rt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},us=class t extends SE{constructor(e,r){super(),this.filters=e,this.op=r,this.Pe=null}static create(e,r){return new t(e,r)}matches(e){return OX(this)?this.filters.find((r=>!r.matches(e)))===void 0:this.filters.find((r=>r.matches(e)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((e,r)=>e.concat(r.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}};function OX(t){return t.op==="and"}function AX(t){return zOe(t)&&OX(t)}function zOe(t){for(let e of t.filters)if(e instanceof us)return!1;return!0}function NA(t){if(t instanceof So)return t.field.canonicalString()+t.op.toString()+qm(t.value);if(AX(t))return t.filters.map((e=>NA(e))).join(",");{let e=t.filters.map((r=>NA(r))).join(",");return`${t.op}(${e})`}}function DX(t,e){return t instanceof So?(function(o,n){return n instanceof So&&o.op===n.op&&o.field.isEqual(n.field)&&el(o.value,n.value)})(t,e):t instanceof us?(function(o,n){return n instanceof us&&o.op===n.op&&o.filters.length===n.filters.length?o.filters.reduce(((i,a,s)=>i&&DX(a,n.filters[s])),!0):!1})(t,e):void rt(19439)}function RX(t){return t instanceof So?(function(r){return`${r.field.canonicalString()} ${r.op} ${qm(r.value)}`})(t):t instanceof us?(function(r){return r.op.toString()+" {"+r.getFilters().map(RX).join(" ,")+"}"})(t):"Filter"}var PA=class extends So{constructor(e,r,o){super(e,r,o),this.key=ot.fromName(o.referenceValue)}matches(e){let r=ot.comparator(e.key,this.key);return this.matchesComparison(r)}},OA=class extends So{constructor(e,r){super(e,"in",r),this.keys=MX("in",r)}matches(e){return this.keys.some((r=>r.isEqual(e.key)))}},AA=class extends So{constructor(e,r){super(e,"not-in",r),this.keys=MX("not-in",r)}matches(e){return!this.keys.some((r=>r.isEqual(e.key)))}};function MX(t,e){return(e.arrayValue?.values||[]).map((r=>ot.fromName(r.referenceValue)))}var DA=class extends So{constructor(e,r){super(e,"array-contains",r)}matches(e){let r=e.data.field(this.field);return cR(r)&&Ux(r.arrayValue,this.value)}},RA=class extends So{constructor(e,r){super(e,"in",r)}matches(e){let r=e.data.field(this.field);return r!==null&&Ux(this.value.arrayValue,r)}},MA=class extends So{constructor(e,r){super(e,"not-in",r)}matches(e){if(Ux(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let r=e.data.field(this.field);return r!==null&&r.nullValue===void 0&&!Ux(this.value.arrayValue,r)}},LA=class extends So{constructor(e,r){super(e,"array-contains-any",r)}matches(e){let r=e.data.field(this.field);return!(!cR(r)||!r.arrayValue.values)&&r.arrayValue.values.some((o=>Ux(this.value.arrayValue,o)))}};var FA=class{constructor(e,r=null,o=[],n=[],i=null,a=null,s=null){this.path=e,this.collectionGroup=r,this.orderBy=o,this.filters=n,this.limit=i,this.startAt=a,this.endAt=s,this.Te=null}};function PY(t,e=null,r=[],o=[],n=null,i=null,a=null){return new FA(t,e,r,o,n,i,a)}function uR(t){let e=gt(t);if(e.Te===null){let r=e.path.canonicalString();e.collectionGroup!==null&&(r+="|cg:"+e.collectionGroup),r+="|f:",r+=e.filters.map((o=>NA(o))).join(","),r+="|ob:",r+=e.orderBy.map((o=>(function(i){return i.field.canonicalString()+i.dir})(o))).join(","),tb(e.limit)||(r+="|l:",r+=e.limit),e.startAt&&(r+="|lb:",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map((o=>qm(o))).join(",")),e.endAt&&(r+="|ub:",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map((o=>qm(o))).join(",")),e.Te=r}return e.Te}function dR(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let r=0;r<t.orderBy.length;r++)if(!$Oe(t.orderBy[r],e.orderBy[r]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let r=0;r<t.filters.length;r++)if(!DX(t.filters[r],e.filters[r]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!NY(t.startAt,e.startAt)&&NY(t.endAt,e.endAt)}function BA(t){return ot.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}var pu=class{constructor(e,r=null,o=[],n=[],i=null,a="F",s=null,l=null){this.path=e,this.collectionGroup=r,this.explicitOrderBy=o,this.filters=n,this.limit=i,this.limitType=a,this.startAt=s,this.endAt=l,this.Ie=null,this.Ee=null,this.de=null,this.startAt,this.endAt}};function UOe(t,e,r,o,n,i,a,s){return new pu(t,e,r,o,n,i,a,s)}function rS(t){return new pu(t)}function OY(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function LX(t){return t.collectionGroup!==null}function Ax(t){let e=gt(t);if(e.Ie===null){e.Ie=[];let r=new Set;for(let i of e.explicitOrderBy)e.Ie.push(i),r.add(i.field.canonicalString());let o=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let s=new Jo(Xi.comparator);return a.filters.forEach((l=>{l.getFlattenedFilters().forEach((c=>{c.isInequality()&&(s=s.add(c.field))}))})),s})(e).forEach((i=>{r.has(i.canonicalString())||i.isKeyField()||e.Ie.push(new cf(i,o))})),r.has(Xi.keyField().canonicalString())||e.Ie.push(new cf(Xi.keyField(),o))}return e.Ie}function Zs(t){let e=gt(t);return e.Ee||(e.Ee=VOe(e,Ax(t))),e.Ee}function VOe(t,e){if(t.limitType==="F")return PY(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map((n=>{let i=n.dir==="desc"?"asc":"desc";return new cf(n.field,i)}));let r=t.endAt?new Km(t.endAt.position,t.endAt.inclusive):null,o=t.startAt?new Km(t.startAt.position,t.startAt.inclusive):null;return PY(t.path,t.collectionGroup,e,t.filters,t.limit,r,o)}}function $A(t,e){let r=t.filters.concat([e]);return new pu(t.path,t.collectionGroup,t.explicitOrderBy.slice(),r,t.limit,t.limitType,t.startAt,t.endAt)}function CE(t,e,r){return new pu(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,r,t.startAt,t.endAt)}function oS(t,e){return dR(Zs(t),Zs(e))&&t.limitType===e.limitType}function FX(t){return`${uR(Zs(t))}|lt:${t.limitType}`}function Fm(t){return`Query(target=${(function(r){let o=r.path.canonicalString();return r.collectionGroup!==null&&(o+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(o+=`, filters: [${r.filters.map((n=>RX(n))).join(", ")}]`),tb(r.limit)||(o+=", limit: "+r.limit),r.orderBy.length>0&&(o+=`, orderBy: [${r.orderBy.map((n=>(function(a){return`${a.field.canonicalString()} (${a.dir})`})(n))).join(", ")}]`),r.startAt&&(o+=", startAt: ",o+=r.startAt.inclusive?"b:":"a:",o+=r.startAt.position.map((n=>qm(n))).join(",")),r.endAt&&(o+=", endAt: ",o+=r.endAt.inclusive?"a:":"b:",o+=r.endAt.position.map((n=>qm(n))).join(",")),`Target(${o})`})(Zs(t))}; limitType=${t.limitType})`}function nS(t,e){return e.isFoundDocument()&&(function(o,n){let i=n.key.path;return o.collectionGroup!==null?n.key.hasCollectionId(o.collectionGroup)&&o.path.isPrefixOf(i):ot.isDocumentKey(o.path)?o.path.isEqual(i):o.path.isImmediateParentOf(i)})(t,e)&&(function(o,n){for(let i of Ax(o))if(!i.field.isKeyField()&&n.data.field(i.field)===null)return!1;return!0})(t,e)&&(function(o,n){for(let i of o.filters)if(!i.matches(n))return!1;return!0})(t,e)&&(function(o,n){return!(o.startAt&&!(function(a,s,l){let c=kY(a,s,l);return a.inclusive?c<=0:c<0})(o.startAt,Ax(o),n)||o.endAt&&!(function(a,s,l){let c=kY(a,s,l);return a.inclusive?c>=0:c>0})(o.endAt,Ax(o),n))})(t,e)}function HOe(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function BX(t){return(e,r)=>{let o=!1;for(let n of Ax(t)){let i=jOe(n,e,r);if(i!==0)return i;o=o||n.field.isKeyField()}return 0}}function jOe(t,e,r){let o=t.field.isKeyField()?ot.comparator(e.key,r.key):(function(i,a,s){let l=a.data.field(i),c=s.data.field(i);return l!==null&&c!==null?Wm(l,c):rt(42886)})(t.field,e,r);switch(t.dir){case"asc":return o;case"desc":return-1*o;default:return rt(19790,{direction:t.dir})}}var tc=class{constructor(e,r){this.mapKeyFn=e,this.equalsFn=r,this.inner={},this.innerSize=0}get(e){let r=this.mapKeyFn(e),o=this.inner[r];if(o!==void 0){for(let[n,i]of o)if(this.equalsFn(n,e))return i}}has(e){return this.get(e)!==void 0}set(e,r){let o=this.mapKeyFn(e),n=this.inner[o];if(n===void 0)return this.inner[o]=[[e,r]],void this.innerSize++;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return void(n[i]=[e,r]);n.push([e,r]),this.innerSize++}delete(e){let r=this.mapKeyFn(e),o=this.inner[r];if(o===void 0)return!1;for(let n=0;n<o.length;n++)if(this.equalsFn(o[n][0],e))return o.length===1?delete this.inner[r]:o.splice(n,1),this.innerSize--,!0;return!1}forEach(e){_u(this.inner,((r,o)=>{for(let[n,i]of o)e(n,i)}))}isEmpty(){return IX(this.inner)}size(){return this.innerSize}};var GOe=new Zr(ot.comparator);function rc(){return GOe}var $X=new Zr(ot.comparator);function Px(...t){let e=$X;for(let r of t)e=e.insert(r.key,r);return e}function zX(t){let e=$X;return t.forEach(((r,o)=>e=e.insert(r,o.overlayedDocument))),e}function of(){return Dx()}function UX(){return Dx()}function Dx(){return new tc((t=>t.toString()),((t,e)=>t.isEqual(e)))}var WOe=new Zr(ot.comparator),qOe=new Jo(ot.comparator);function $t(...t){let e=qOe;for(let r of t)e=e.add(r);return e}var KOe=new Jo(Bt);function YOe(){return KOe}function fR(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:$x(e)?"-0":e}}function VX(t){return{integerValue:""+t}}function XOe(t,e){return SOe(e)?VX(e):fR(t,e)}var Ym=class{constructor(){this._=void 0}};function JOe(t,e,r){return t instanceof uf?(function(n,i){let a={fields:{[EX]:{stringValue:wX},[CX]:{timestampValue:{seconds:n.seconds,nanos:n.nanoseconds}}}};return i&&aR(i)&&(i=tS(i)),i&&(a.fields[SX]=i),{mapValue:a}})(r,e):t instanceof mu?jX(t,e):t instanceof df?GX(t,e):(function(n,i){let a=HX(n,i),s=AY(a)+AY(n.Ae);return kA(a)&&kA(n.Ae)?VX(s):fR(n.serializer,s)})(t,e)}function QOe(t,e,r){return t instanceof mu?jX(t,e):t instanceof df?GX(t,e):r}function HX(t,e){return t instanceof Xm?(function(o){return kA(o)||(function(i){return!!i&&"doubleValue"in i})(o)})(e)?e:{integerValue:0}:null}var uf=class extends Ym{},mu=class extends Ym{constructor(e){super(),this.elements=e}};function jX(t,e){let r=WX(e);for(let o of t.elements)r.some((n=>el(n,o)))||r.push(o);return{arrayValue:{values:r}}}var df=class extends Ym{constructor(e){super(),this.elements=e}};function GX(t,e){let r=WX(e);for(let o of t.elements)r=r.filter((n=>!el(n,o)));return{arrayValue:{values:r}}}var Xm=class extends Ym{constructor(e,r){super(),this.serializer=e,this.Ae=r}};function AY(t){return Rr(t.integerValue||t.doubleValue)}function WX(t){return cR(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var TE=class{constructor(e,r){this.field=e,this.transform=r}};function ZOe(t,e){return t.field.isEqual(e.field)&&(function(o,n){return o instanceof mu&&n instanceof mu||o instanceof df&&n instanceof df?Hm(o.elements,n.elements,el):o instanceof Xm&&n instanceof Xm?el(o.Ae,n.Ae):o instanceof uf&&n instanceof uf})(t.transform,e.transform)}var zA=class{constructor(e,r){this.version=e,this.transformResults=r}},Nn=class t{constructor(e,r){this.updateTime=e,this.exists=r}static none(){return new t}static exists(e){return new t(void 0,e)}static updateTime(e){return new t(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function xE(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}var Jm=class{};function qX(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new pf(t.key,Nn.none()):new ff(t.key,t.data,Nn.none());{let r=t.data,o=wi.empty(),n=new Jo(Xi.comparator);for(let i of e.fields)if(!n.has(i)){let a=r.field(i);a===null&&i.length>1&&(i=i.popLast(),a=r.field(i)),a===null?o.delete(i):o.set(i,a),n=n.add(i)}return new tl(t.key,o,new Pa(n.toArray()),Nn.none())}}function eAe(t,e,r){t instanceof ff?(function(n,i,a){let s=n.value.clone(),l=RY(n.fieldTransforms,i,a.transformResults);s.setAll(l),i.convertToFoundDocument(a.version,s).setHasCommittedMutations()})(t,e,r):t instanceof tl?(function(n,i,a){if(!xE(n.precondition,i))return void i.convertToUnknownDocument(a.version);let s=RY(n.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(KX(n)),l.setAll(s),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()})(t,e,r):(function(n,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()})(0,e,r)}function Rx(t,e,r,o){return t instanceof ff?(function(i,a,s,l){if(!xE(i.precondition,a))return s;let c=i.value.clone(),u=MY(i.fieldTransforms,l,a);return c.setAll(u),a.convertToFoundDocument(a.version,c).setHasLocalMutations(),null})(t,e,r,o):t instanceof tl?(function(i,a,s,l){if(!xE(i.precondition,a))return s;let c=MY(i.fieldTransforms,l,a),u=a.data;return u.setAll(KX(i)),u.setAll(c),a.convertToFoundDocument(a.version,u).setHasLocalMutations(),s===null?null:s.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((d=>d.field)))})(t,e,r,o):(function(i,a,s){return xE(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):s})(t,e,r)}function tAe(t,e){let r=null;for(let o of t.fieldTransforms){let n=e.data.field(o.field),i=HX(o.transform,n||null);i!=null&&(r===null&&(r=wi.empty()),r.set(o.field,i))}return r||null}function DY(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!(function(o,n){return o===void 0&&n===void 0||!(!o||!n)&&Hm(o,n,((i,a)=>ZOe(i,a)))})(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}var ff=class extends Jm{constructor(e,r,o,n=[]){super(),this.key=e,this.value=r,this.precondition=o,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}},tl=class extends Jm{constructor(e,r,o,n,i=[]){super(),this.key=e,this.data=r,this.fieldMask=o,this.precondition=n,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function KX(t){let e=new Map;return t.fieldMask.fields.forEach((r=>{if(!r.isEmpty()){let o=t.data.field(r);e.set(r,o)}})),e}function RY(t,e,r){let o=new Map;Gt(t.length===r.length,32656,{Re:r.length,Ve:t.length});for(let n=0;n<r.length;n++){let i=t[n],a=i.transform,s=e.data.field(i.field);o.set(i.field,QOe(a,s,r[n]))}return o}function MY(t,e,r){let o=new Map;for(let n of t){let i=n.transform,a=r.data.field(n.field);o.set(n.field,JOe(i,a,e))}return o}var pf=class extends Jm{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},kE=class extends Jm{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var UA=class{constructor(e,r,o,n){this.batchId=e,this.localWriteTime=r,this.baseMutations=o,this.mutations=n}applyToRemoteDocument(e,r){let o=r.mutationResults;for(let n=0;n<this.mutations.length;n++){let i=this.mutations[n];i.key.isEqual(e.key)&&eAe(i,e,o[n])}}applyToLocalView(e,r){for(let o of this.baseMutations)o.key.isEqual(e.key)&&(r=Rx(o,e,r,this.localWriteTime));for(let o of this.mutations)o.key.isEqual(e.key)&&(r=Rx(o,e,r,this.localWriteTime));return r}applyToLocalDocumentSet(e,r){let o=UX();return this.mutations.forEach((n=>{let i=e.get(n.key),a=i.overlayedDocument,s=this.applyToLocalView(a,i.mutatedFields);s=r.has(n.key)?null:s;let l=qX(a,s);l!==null&&o.set(n.key,l),a.isValidDocument()||a.convertToNoDocument(mt.min())})),o}keys(){return this.mutations.reduce(((e,r)=>e.add(r.key)),$t())}isEqual(e){return this.batchId===e.batchId&&Hm(this.mutations,e.mutations,((r,o)=>DY(r,o)))&&Hm(this.baseMutations,e.baseMutations,((r,o)=>DY(r,o)))}},VA=class t{constructor(e,r,o,n){this.batch=e,this.commitVersion=r,this.mutationResults=o,this.docVersions=n}static from(e,r,o){Gt(e.mutations.length===o.length,58842,{me:e.mutations.length,fe:o.length});let n=(function(){return WOe})(),i=e.mutations;for(let a=0;a<i.length;a++)n=n.insert(i[a].key,o[a].version);return new t(e,r,o,n)}};var HA=class{constructor(e,r){this.largestBatchId=e,this.mutation=r}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
33
+ `);for(let F=0;F<x.length;F++){if(y(x[F]))continue;var O=A(x[F]);let K=O[0];if(O=O[1],typeof O!="string")continue;O=O.trim();let Z=k[K]||[];k[K]=Z,Z.push(O)}E(k,function(F){return F.join(", ")})}t.Ba=function(){return this.m},t.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function c_(x,k,O){return O&&O.internalChannelParams&&O.internalChannelParams[x]||k}function t$(x){this.Aa=0,this.i=[],this.j=new jo,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=c_("failFast",!1,x),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=c_("baseRetryDelayMs",5e3,x),this.cb=c_("retryDelaySeedMs",1e4,x),this.Wa=c_("forwardChannelMaxRetries",2,x),this.wa=c_("forwardChannelRequestTimeoutMs",2e4,x),this.pa=x&&x.xmlHttpFactory||void 0,this.Xa=x&&x.Tb||void 0,this.Ca=x&&x.useFetchStreams||!1,this.L=void 0,this.J=x&&x.supportsCrossDomainXhr||!1,this.K="",this.h=new _a(x&&x.concurrentRequestLimit),this.Da=new Khe,this.P=x&&x.fastHandshake||!1,this.O=x&&x.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=x&&x.Rb||!1,x&&x.xa&&this.j.xa(),x&&x.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&x&&x.detectBufferingProxy||!1,this.ja=void 0,x&&x.longPollingTimeout&&0<x.longPollingTimeout&&(this.ja=x.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}t=t$.prototype,t.la=8,t.G=1,t.connect=function(x,k,O,F){Xt(0),this.W=x,this.H=k||{},O&&F!==void 0&&(this.H.OSID=O,this.H.OAID=F),this.F=this.X,this.I=u$(this,null,this.W),$v(this)};function Gk(x){if(r$(x),x.G==3){var k=x.U++,O=Pl(x.I);if(Or(O,"SID",x.K),Or(O,"RID",k),Or(O,"TYPE","terminate"),u_(x,O),k=new Hi(x,x.j,k),k.L=2,k.v=Mv(Pl(O)),O=!1,s.navigator&&s.navigator.sendBeacon)try{O=s.navigator.sendBeacon(k.v.toString(),"")}catch{}!O&&s.Image&&(new Image().src=k.v,O=!0),O||(k.g=d$(k.j,null),k.g.ea(k.v)),k.F=Date.now(),Ee(k)}c$(x)}function Bv(x){x.g&&(qk(x),x.g.cancel(),x.g=null)}function r$(x){Bv(x),x.u&&(s.clearTimeout(x.u),x.u=null),zv(x),x.h.cancel(),x.s&&(typeof x.s=="number"&&s.clearTimeout(x.s),x.s=null)}function $v(x){if(!Mc(x.h)&&!x.s){x.s=!0;var k=x.Ga;H||L(),G||(H(),G=!0),Y.add(k,x),x.B=0}}function Zhe(x,k){return $s(x.h)>=x.h.j-(x.s?1:0)?!1:x.s?(x.i=k.D.concat(x.i),!0):x.G==1||x.G==2||x.B>=(x.Va?0:x.Wa)?!1:(x.s=Rs(f(x.Ga,x,k),l$(x,x.B)),x.B++,!0)}t.Ga=function(x){if(this.s)if(this.s=null,this.G==1){if(!x){this.U=Math.floor(1e5*Math.random()),x=this.U++;let K=new Hi(this,this.j,x),Z=this.o;if(this.S&&(Z?(Z=w(Z),T(Z,this.S)):Z=this.S),this.m!==null||this.O||(K.H=Z,Z=null),this.P)e:{for(var k=0,O=0;O<this.i.length;O++){t:{var F=this.i[O];if("__data__"in F.map&&(F=F.map.__data__,typeof F=="string")){F=F.length;break t}F=void 0}if(F===void 0)break;if(k+=F,4096<k){k=O;break e}if(k===4096||O===this.i.length-1){k=O+1;break e}}k=1e3}else k=1e3;k=n$(this,K,k),O=Pl(this.I),Or(O,"RID",x),Or(O,"CVER",22),this.D&&Or(O,"X-HTTP-Session-Id",this.D),u_(this,O),Z&&(this.O?k="headers="+encodeURIComponent(String(Y3(Z)))+"&"+k:this.m&&jk(O,this.m,Z)),Hk(this.h,K),this.Ua&&Or(O,"TYPE","init"),this.P?(Or(O,"$req",k),Or(O,"SID","null"),K.T=!0,Bs(K,O,null)):Bs(K,O,k),this.G=2}}else this.G==3&&(x?o$(this,x):this.i.length==0||Mc(this.h)||o$(this))};function o$(x,k){var O;k?O=k.l:O=x.U++;let F=Pl(x.I);Or(F,"SID",x.K),Or(F,"RID",O),Or(F,"AID",x.T),u_(x,F),x.m&&x.o&&jk(F,x.m,x.o),O=new Hi(x,x.j,O,x.B+1),x.m===null&&(O.H=x.o),k&&(x.i=k.D.concat(x.i)),k=n$(x,O,1e3),O.I=Math.round(.5*x.wa)+Math.round(.5*x.wa*Math.random()),Hk(x.h,O),Bs(O,F,k)}function u_(x,k){x.H&&I(x.H,function(O,F){Or(k,F,O)}),x.l&&U3({},function(O,F){Or(k,F,O)})}function n$(x,k,O){O=Math.min(x.i.length,O);var F=x.l?f(x.l.Na,x.l,x):null;e:{var K=x.i;let Z=-1;for(;;){let be=["count="+O];Z==-1?0<O?(Z=K[0].g,be.push("ofs="+Z)):Z=0:be.push("ofs="+Z);let xr=!0;for(let xn=0;xn<O;xn++){let Jt=K[xn].g,Fn=K[xn].map;if(Jt-=Z,0>Jt)Z=Math.max(0,K[xn].g-100),xr=!1;else try{Yhe(Fn,be,"req"+Jt+"_")}catch{F&&F(Fn)}}if(xr){F=be.join("&");break e}}}return x=x.i.splice(0,O),k.D=x,F}function i$(x){if(!x.g&&!x.u){x.Y=1;var k=x.Fa;H||L(),G||(H(),G=!0),Y.add(k,x),x.v=0}}function Wk(x){return x.g||x.u||3<=x.v?!1:(x.Y++,x.u=Rs(f(x.Fa,x),l$(x,x.v)),x.v++,!0)}t.Fa=function(){if(this.u=null,a$(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var x=2*this.R;this.j.info("BP detection timer enabled: "+x),this.A=Rs(f(this.ab,this),x)}},t.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Xt(10),Bv(this),a$(this))};function qk(x){x.A!=null&&(s.clearTimeout(x.A),x.A=null)}function a$(x){x.g=new Hi(x,x.j,"rpc",x.Y),x.m===null&&(x.g.H=x.o),x.g.O=0;var k=Pl(x.qa);Or(k,"RID","rpc"),Or(k,"SID",x.K),Or(k,"AID",x.T),Or(k,"CI",x.F?"0":"1"),!x.F&&x.ja&&Or(k,"TO",x.ja),Or(k,"TYPE","xmlhttp"),u_(x,k),x.m&&x.o&&jk(k,x.m,x.o),x.L&&(x.g.I=x.L);var O=x.g;x=x.ia,O.L=1,O.v=Mv(Pl(k)),O.m=null,O.P=!0,Ap(O,x)}t.Za=function(){this.C!=null&&(this.C=null,Bv(this),Wk(this),Xt(19))};function zv(x){x.C!=null&&(s.clearTimeout(x.C),x.C=null)}function s$(x,k){var O=null;if(x.g==k){zv(x),qk(x),x.g=null;var F=2}else if(Vk(x.h,k))O=k.D,$3(x.h,k),F=1;else return;if(x.G!=0){if(k.o)if(F==1){O=k.m?k.m.length:0,k=Date.now()-k.F;var K=x.B;F=gn(),se(F,new Ds(F,O)),$v(x)}else i$(x);else if(K=k.s,K==3||K==0&&0<k.X||!(F==1&&Zhe(x,k)||F==2&&Wk(x)))switch(O&&0<O.length&&(k=x.h,k.i=k.i.concat(O)),K){case 1:yd(x,5);break;case 4:yd(x,10);break;case 3:yd(x,6);break;default:yd(x,2)}}}function l$(x,k){let O=x.Ta+Math.floor(Math.random()*x.cb);return x.isActive()||(O*=2),O*k}function yd(x,k){if(x.j.info("Error code "+k),k==2){var O=f(x.fb,x),F=x.Xa;let K=!F;F=new bd(F||"//www.google.com/images/cleardot.gif"),s.location&&s.location.protocol=="http"||Dv(F,"https"),Mv(F),K?Whe(F.toString(),O):qhe(F.toString(),O)}else Xt(2);x.G=0,x.l&&x.l.sa(k),c$(x),r$(x)}t.fb=function(x){x?(this.j.info("Successfully pinged google.com"),Xt(2)):(this.j.info("Failed to ping google.com"),Xt(1))};function c$(x){if(x.G=0,x.ka=[],x.l){let k=z3(x.h);(k.length!=0||x.i.length!=0)&&(_(x.ka,k),_(x.ka,x.i),x.h.i.length=0,g(x.i),x.i.length=0),x.l.ra()}}function u$(x,k,O){var F=O instanceof bd?Pl(O):new bd(O);if(F.g!="")k&&(F.g=k+"."+F.g),Rv(F,F.s);else{var K=s.location;F=K.protocol,k=k?k+"."+K.hostname:K.hostname,K=+K.port;var Z=new bd(null);F&&Dv(Z,F),k&&(Z.g=k),K&&Rv(Z,K),O&&(Z.l=O),F=Z}return O=x.D,k=x.ya,O&&k&&Or(F,O,k),Or(F,"VER",x.la),u_(x,F),F}function d$(x,k,O){if(k&&!x.J)throw Error("Can't create secondary domain capable XhrIo object.");return k=x.Ca&&!x.pa?new Jr(new a_({eb:O})):new Jr(x.pa),k.Ha(x.J),k}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function f$(){}t=f$.prototype,t.ua=function(){},t.ta=function(){},t.sa=function(){},t.ra=function(){},t.isActive=function(){return!0},t.Na=function(){};function Uv(){}Uv.prototype.g=function(x,k){return new ji(x,k)};function ji(x,k){Q.call(this),this.g=new t$(k),this.l=x,this.h=k&&k.messageUrlParams||null,x=k&&k.messageHeaders||null,k&&k.clientProtocolHeaderRequired&&(x?x["X-Client-Protocol"]="webchannel":x={"X-Client-Protocol":"webchannel"}),this.g.o=x,x=k&&k.initMessageHeaders||null,k&&k.messageContentType&&(x?x["X-WebChannel-Content-Type"]=k.messageContentType:x={"X-WebChannel-Content-Type":k.messageContentType}),k&&k.va&&(x?x["X-WebChannel-Client-Profile"]=k.va:x={"X-WebChannel-Client-Profile":k.va}),this.g.S=x,(x=k&&k.Sb)&&!y(x)&&(this.g.m=x),this.v=k&&k.supportsCrossDomainXhr||!1,this.u=k&&k.sendRawJson||!1,(k=k&&k.httpSessionIdParam)&&!y(k)&&(this.g.D=k,x=this.h,x!==null&&k in x&&(x=this.h,k in x&&delete x[k])),this.j=new Mp(this)}h(ji,Q),ji.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},ji.prototype.close=function(){Gk(this.g)},ji.prototype.o=function(x){var k=this.g;if(typeof x=="string"){var O={};O.__data__=x,x=O}else this.u&&(O={},O.__data__=io(x),x=O);k.i.push(new Nl(k.Ya++,x)),k.G==3&&$v(k)},ji.prototype.N=function(){this.g.l=null,delete this.j,Gk(this.g),delete this.g,ji.aa.N.call(this)};function p$(x){Ln.call(this),x.__headers__&&(this.headers=x.__headers__,this.statusCode=x.__status__,delete x.__headers__,delete x.__status__);var k=x.__sm__;if(k){e:{for(let O in k){x=O;break e}x=void 0}(this.i=x)&&(x=this.i,k=k!==null&&x in k?k[x]:void 0),this.data=k}else this.data=x}h(p$,Ln);function m$(){bi.call(this),this.status=1}h(m$,bi);function Mp(x){this.g=x}h(Mp,f$),Mp.prototype.ua=function(){se(this.g,"a")},Mp.prototype.ta=function(x){se(this.g,new p$(x))},Mp.prototype.sa=function(x){se(this.g,new m$)},Mp.prototype.ra=function(){se(this.g,"b")},Uv.prototype.createWebChannel=Uv.prototype.g,ji.prototype.send=ji.prototype.o,ji.prototype.open=ji.prototype.m,ji.prototype.close=ji.prototype.close,dA=Xl.createWebChannelTransport=function(){return new Uv},uA=Xl.getStatEventTarget=function(){return gn()},cA=Xl.Event=ha,f0=Xl.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},vt.NO_ERROR=0,vt.TIMEOUT=8,vt.HTTP_ERROR=6,Nx=Xl.ErrorCode=vt,Za.COMPLETE="complete",lA=Xl.EventType=Za,fr.EventType=Ui,Ui.OPEN="a",Ui.CLOSE="b",Ui.ERROR="c",Ui.MESSAGE="d",Q.prototype.listen=Q.prototype.K,Mm=Xl.WebChannel=fr,pOe=Xl.FetchXmlHttpFactory=a_,Jr.prototype.listenOnce=Jr.prototype.L,Jr.prototype.getLastError=Jr.prototype.Ka,Jr.prototype.getLastErrorCode=Jr.prototype.Ba,Jr.prototype.getStatus=Jr.prototype.Z,Jr.prototype.getResponseJson=Jr.prototype.Oa,Jr.prototype.getResponseText=Jr.prototype.oa,Jr.prototype.send=Jr.prototype.ea,Jr.prototype.setWithCredentials=Jr.prototype.Ha,sA=Xl.XhrIo=Jr}).apply(typeof d0<"u"?d0:typeof self<"u"?self:typeof window<"u"?window:{});var hY="@firebase/firestore",gY="4.9.1";var Un=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};Un.UNAUTHENTICATED=new Un(null),Un.GOOGLE_CREDENTIALS=new Un("google-credentials-uid"),Un.FIRST_PARTY=new Un("first-party-uid"),Un.MOCK_USER=new Un("mock-user");var rh="12.2.0";var sf=new ru("@firebase/firestore");function Lm(){return sf.logLevel}function Le(t,...e){if(sf.logLevel<=Pt.DEBUG){let r=e.map(nR);sf.debug(`Firestore (${rh}): ${t}`,...r)}}function Ql(t,...e){if(sf.logLevel<=Pt.ERROR){let r=e.map(nR);sf.error(`Firestore (${rh}): ${t}`,...r)}}function Lx(t,...e){if(sf.logLevel<=Pt.WARN){let r=e.map(nR);sf.warn(`Firestore (${rh}): ${t}`,...r)}}function nR(t){if(typeof t=="string")return t;try{return(function(r){return JSON.stringify(r)})(t)}catch{return t}}function rt(t,e,r){let o="Unexpected state";typeof e=="string"?o=e:r=e,iX(t,o,r)}function iX(t,e,r){let o=`FIRESTORE (${rh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(r!==void 0)try{o+=" CONTEXT: "+JSON.stringify(r)}catch{o+=" CONTEXT: "+r}throw Ql(o),new Error(o)}function Gt(t,e,r,o){let n="Unexpected state";typeof r=="string"?n=r:o=r,t||iX(e,n,o)}function gt(t,e){return t}var te={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},xe=class extends li{constructor(e,r){super(e,r),this.code=e,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Oa=class{constructor(){this.promise=new Promise(((e,r)=>{this.resolve=e,this.reject=r}))}};var gA=class{constructor(e,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},_A=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,r){e.enqueueRetryable((()=>r(Un.UNAUTHENTICATED)))}shutdown(){}};var xA=class{constructor(e){this.t=e,this.currentUser=Un.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,r){Gt(this.o===void 0,42304);let o=this.i,n=l=>this.i!==o?(o=this.i,r(l)):Promise.resolve(),i=new Oa;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Oa,e.enqueueRetryable((()=>n(this.currentUser)))};let a=()=>{let l=i;e.enqueueRetryable((async()=>{await l.promise,await n(this.currentUser)}))},s=l=>{Le("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((l=>s(l))),setTimeout((()=>{if(!this.auth){let l=this.t.getImmediate({optional:!0});l?s(l):(Le("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Oa)}}),0),a()}getToken(){let e=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then((o=>this.i!==e?(Le("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):o?(Gt(typeof o.accessToken=="string",31837,{l:o}),new gA(o.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 Gt(e===null||typeof e=="string",2055,{h:e}),new Un(e)}},bA=class{constructor(e,r,o){this.P=e,this.T=r,this.I=o,this.type="FirstParty",this.user=Un.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},yA=class{constructor(e,r,o){this.P=e,this.T=r,this.I=o}getToken(){return Promise.resolve(new bA(this.P,this.T,this.I))}start(e,r){e.enqueueRetryable((()=>r(Un.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},b0=class{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}},vA=class{constructor(e,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Ii(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,r){Gt(this.o===void 0,3512);let o=i=>{i.error!=null&&Le("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);let a=i.token!==this.m;return this.m=i.token,Le("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?r(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>o(i)))};let n=i=>{Le("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>n(i))),setTimeout((()=>{if(!this.appCheck){let i=this.V.getImmediate({optional:!0});i?n(i):Le("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new b0(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((r=>r?(Gt(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new b0(r.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function mOe(t){let e=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(r);else for(let o=0;o<t;o++)r[o]=Math.floor(256*Math.random());return r}var Fx=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=62*Math.floor(4.129032258064516),o="";for(;o.length<20;){let n=mOe(40);for(let i=0;i<n.length;++i)o.length<20&&n[i]<r&&(o+=e.charAt(n[i]%62))}return o}};function Bt(t,e){return t<e?-1:t>e?1:0}function IA(t,e){let r=Math.min(t.length,e.length);for(let o=0;o<r;o++){let n=t.charAt(o),i=e.charAt(o);if(n!==i)return fA(n)===fA(i)?Bt(n,i):fA(n)?1:-1}return Bt(t.length,e.length)}var hOe=55296,gOe=57343;function fA(t){let e=t.charCodeAt(0);return e>=hOe&&e<=gOe}function Hm(t,e,r){return t.length===e.length&&t.every(((o,n)=>r(o,e[n])))}var wA="__name__",y0=class t{constructor(e,r,o){r===void 0?r=0:r>e.length&&rt(637,{offset:r,range:e.length}),o===void 0?o=e.length-r:o>e.length-r&&rt(1746,{length:o,range:e.length-r}),this.segments=e,this.offset=r,this.len=o}get length(){return this.len}isEqual(e){return t.comparator(this,e)===0}child(e){let r=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach((o=>{r.push(o)})):r.push(e),this.construct(r)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}forEach(e){for(let r=this.offset,o=this.limit();r<o;r++)e(this.segments[r])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,r){let o=Math.min(e.length,r.length);for(let n=0;n<o;n++){let i=t.compareSegments(e.get(n),r.get(n));if(i!==0)return i}return Bt(e.length,r.length)}static compareSegments(e,r){let o=t.isNumericId(e),n=t.isNumericId(r);return o&&!n?-1:!o&&n?1:o&&n?t.extractNumericId(e).compare(t.extractNumericId(r)):IA(e,r)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Yl.fromString(e.substring(4,e.length-2))}},Sr=class t extends y0{construct(e,r,o){return new t(e,r,o)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let r=[];for(let o of e){if(o.indexOf("//")>=0)throw new xe(te.INVALID_ARGUMENT,`Invalid segment (${o}). Paths must not contain // in them.`);r.push(...o.split("/").filter((n=>n.length>0)))}return new t(r)}static emptyPath(){return new t([])}},_Oe=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Xi=class t extends y0{construct(e,r,o){return new t(e,r,o)}static isValidIdentifier(e){return _Oe.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===wA}static keyField(){return new t([wA])}static fromServerFormat(e){let r=[],o="",n=0,i=()=>{if(o.length===0)throw new xe(te.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(o),o=""},a=!1;for(;n<e.length;){let s=e[n];if(s==="\\"){if(n+1===e.length)throw new xe(te.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let l=e[n+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new xe(te.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);o+=l,n+=2}else s==="`"?(a=!a,n++):s!=="."||a?(o+=s,n++):(i(),n++)}if(i(),a)throw new xe(te.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(r)}static emptyPath(){return new t([])}};var ot=class t{constructor(e){this.path=e}static fromPath(e){return new t(Sr.fromString(e))}static fromName(e){return new t(Sr.fromString(e).popFirst(5))}static empty(){return new t(Sr.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Sr.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,r){return Sr.comparator(e.path,r.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new t(new Sr(e.slice()))}};function aX(t,e,r){if(!r)throw new xe(te.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function xOe(t,e,r,o){if(e===!0&&o===!0)throw new xe(te.INVALID_ARGUMENT,`${t} and ${r} cannot be used together.`)}function _Y(t){if(!ot.isDocumentKey(t))throw new xe(te.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function xY(t){if(ot.isDocumentKey(t))throw new xe(te.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function sX(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function eS(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{let e=(function(o){return o.constructor?o.constructor.name:null})(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":rt(12329,{type:typeof t})}function Ei(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new xe(te.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=eS(t);throw new xe(te.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${r}`)}}return t}function bOe(t,e){if(e<=0)throw new xe(te.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}function Co(t,e){let r={typeString:t};return e&&(r.value=e),r}function eb(t,e){if(!sX(t))throw new xe(te.INVALID_ARGUMENT,"JSON must be an object");let r;for(let o in e)if(e[o]){let n=e[o].typeString,i="value"in e[o]?{value:e[o].value}:void 0;if(!(o in t)){r=`JSON missing required field: '${o}'`;break}let a=t[o];if(n&&typeof a!==n){r=`JSON field '${o}' must be a ${n}.`;break}if(i!==void 0&&a!==i.value){r=`Expected '${o}' field to equal '${i.value}'`;break}}if(r)throw new xe(te.INVALID_ARGUMENT,r);return!0}var bY=-62135596800,yY=1e6,Tt=class t{static now(){return t.fromMillis(Date.now())}static fromDate(e){return t.fromMillis(e.getTime())}static fromMillis(e){let r=Math.floor(e/1e3),o=Math.floor((e-1e3*r)*yY);return new t(r,o)}constructor(e,r){if(this.seconds=e,this.nanoseconds=r,r<0)throw new xe(te.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new xe(te.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(e<bY)throw new xe(te.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new xe(te.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/yY}_compareTo(e){return this.seconds===e.seconds?Bt(this.nanoseconds,e.nanoseconds):Bt(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:t._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(eb(e,t._jsonSchema))return new t(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-bY;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};Tt._jsonSchemaVersion="firestore/timestamp/1.0",Tt._jsonSchema={type:Co("string",Tt._jsonSchemaVersion),seconds:Co("number"),nanoseconds:Co("number")};var mt=class t{static fromTimestamp(e){return new t(e)}static min(){return new t(new Tt(0,0))}static max(){return new t(new Tt(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};var Bx=-1,EA=class{constructor(e,r,o,n){this.indexId=e,this.collectionGroup=r,this.fields=o,this.indexState=n}};EA.UNKNOWN_ID=-1;function yOe(t,e){let r=t.toTimestamp().seconds,o=t.toTimestamp().nanoseconds+1,n=mt.fromTimestamp(o===1e9?new Tt(r+1,0):new Tt(r,o));return new lf(n,ot.empty(),e)}function vOe(t){return new lf(t.readTime,t.key,Bx)}var lf=class t{constructor(e,r,o){this.readTime=e,this.documentKey=r,this.largestBatchId=o}static min(){return new t(mt.min(),ot.empty(),Bx)}static max(){return new t(mt.max(),ot.empty(),Bx)}};function IOe(t,e){let r=t.readTime.compareTo(e.readTime);return r!==0?r:(r=ot.comparator(t.documentKey,e.documentKey),r!==0?r:Bt(t.largestBatchId,e.largestBatchId))}var wOe="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",SA=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function oh(t){if(t.code!==te.FAILED_PRECONDITION||t.message!==wOe)throw t;Le("LocalStore","Unexpectedly lost primary lease")}var fe=class t{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)}),(r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)}))}catch(e){return this.next(void 0,e)}next(e,r){return this.callbackAttached&&rt(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(e,this.result):new t(((o,n)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(o,n)},this.catchCallback=i=>{this.wrapFailure(r,i).next(o,n)}}))}toPromise(){return new Promise(((e,r)=>{this.next(e,r)}))}wrapUserFunction(e){try{let r=e();return r instanceof t?r:t.resolve(r)}catch(r){return t.reject(r)}}wrapSuccess(e,r){return e?this.wrapUserFunction((()=>e(r))):t.resolve(r)}wrapFailure(e,r){return e?this.wrapUserFunction((()=>e(r))):t.reject(r)}static resolve(e){return new t(((r,o)=>{r(e)}))}static reject(e){return new t(((r,o)=>{o(e)}))}static waitFor(e){return new t(((r,o)=>{let n=0,i=0,a=!1;e.forEach((s=>{++n,s.next((()=>{++i,a&&i===n&&r()}),(l=>o(l)))})),a=!0,i===n&&r()}))}static or(e){let r=t.resolve(!1);for(let o of e)r=r.next((n=>n?t.resolve(n):o()));return r}static forEach(e,r){let o=[];return e.forEach(((n,i)=>{o.push(r.call(this,n,i))})),this.waitFor(o)}static mapArray(e,r){return new t(((o,n)=>{let i=e.length,a=new Array(i),s=0;for(let l=0;l<i;l++){let c=l;r(e[c]).next((u=>{a[c]=u,++s,s===i&&o(a)}),(u=>n(u)))}}))}static doWhile(e,r){return new t(((o,n)=>{let i=()=>{e()===!0?r().next((()=>{i()}),n):o()};i()}))}};function EOe(t){let e=t.match(/Android ([\d.]+)/i),r=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(r)}function nh(t){return t.name==="IndexedDbTransactionError"}var jm=class{constructor(e,r){this.previousValue=e,r&&(r.sequenceNumberHandler=o=>this.ae(o),this.ue=o=>r.writeSequenceNumber(o))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};jm.ce=-1;var iR=-1;function tb(t){return t==null}function $x(t){return t===0&&1/t==-1/0}function SOe(t){return typeof t=="number"&&Number.isInteger(t)&&!$x(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var lX="";function COe(t){let e="";for(let r=0;r<t.length;r++)e.length>0&&(e=vY(e)),e=TOe(t.get(r),e);return vY(e)}function TOe(t,e){let r=e,o=t.length;for(let n=0;n<o;n++){let i=t.charAt(n);switch(i){case"\0":r+="";break;case lX:r+="";break;default:r+=i}}return r}function vY(t){return t+lX+""}var kOe="remoteDocuments",cX="owner";var uX="mutationQueues";var dX="mutations";var fX="documentMutations",NOe="remoteDocumentsV14";var pX="remoteDocumentGlobal";var mX="targets";var hX="targetDocuments";var gX="targetGlobal",_X="collectionParents";var xX="clientMetadata";var bX="bundles";var yX="namedQueries";var POe="indexConfiguration";var OOe="indexState";var AOe="indexEntries";var vX="documentOverlays";var DOe="globals";var ROe=[uX,dX,fX,kOe,mX,cX,gX,hX,xX,pX,_X,bX,yX],b0t=[...ROe,vX],MOe=[uX,dX,fX,NOe,mX,cX,gX,hX,xX,pX,_X,bX,yX,vX],LOe=MOe,FOe=[...LOe,POe,OOe,AOe];var y0t=[...FOe,DOe];function IY(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function _u(t,e){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e(r,t[r])}function IX(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Zr=class t{constructor(e,r){this.comparator=e,this.root=r||Qs.EMPTY}insert(e,r){return new t(this.comparator,this.root.insert(e,r,this.comparator).copy(null,null,Qs.BLACK,null,null))}remove(e){return new t(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Qs.BLACK,null,null))}get(e){let r=this.root;for(;!r.isEmpty();){let o=this.comparator(e,r.key);if(o===0)return r.value;o<0?r=r.left:o>0&&(r=r.right)}return null}indexOf(e){let r=0,o=this.root;for(;!o.isEmpty();){let n=this.comparator(e,o.key);if(n===0)return r+o.left.size;n<0?o=o.left:(r+=o.left.size+1,o=o.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(((r,o)=>(e(r,o),!1)))}toString(){let e=[];return this.inorderTraversal(((r,o)=>(e.push(`${r}:${o}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new zm(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new zm(this.root,e,this.comparator,!1)}getReverseIterator(){return new zm(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new zm(this.root,e,this.comparator,!0)}},zm=class{constructor(e,r,o,n){this.isReverse=n,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=r?o(e.key,r):1,r&&n&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),r={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 r}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},Qs=class t{constructor(e,r,o,n,i){this.key=e,this.value=r,this.color=o??t.RED,this.left=n??t.EMPTY,this.right=i??t.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,r,o,n,i){return new t(e??this.key,r??this.value,o??this.color,n??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,r,o){let n=this,i=o(e,n.key);return n=i<0?n.copy(null,null,null,n.left.insert(e,r,o),null):i===0?n.copy(null,r,null,null,null):n.copy(null,null,null,null,n.right.insert(e,r,o)),n.fixUp()}removeMin(){if(this.left.isEmpty())return t.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,r){let o,n=this;if(r(e,n.key)<0)n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()||(n=n.moveRedLeft()),n=n.copy(null,null,null,n.left.remove(e,r),null);else{if(n.left.isRed()&&(n=n.rotateRight()),n.right.isEmpty()||n.right.isRed()||n.right.left.isRed()||(n=n.moveRedRight()),r(e,n.key)===0){if(n.right.isEmpty())return t.EMPTY;o=n.right.min(),n=n.copy(o.key,o.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(e,r))}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.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,t.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),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,r)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw rt(43730,{key:this.key,value:this.value});if(this.right.isRed())throw rt(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw rt(27949);return e+(this.isRed()?0:1)}};Qs.EMPTY=null,Qs.RED=!0,Qs.BLACK=!1;Qs.EMPTY=new class{constructor(){this.size=0}get key(){throw rt(57766)}get value(){throw rt(16141)}get color(){throw rt(16727)}get left(){throw rt(29726)}get right(){throw rt(36894)}copy(e,r,o,n,i){return this}insert(e,r,o){return new Qs(e,r)}remove(e,r){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}};var Jo=class t{constructor(e){this.comparator=e,this.data=new Zr(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((r,o)=>(e(r),!1)))}forEachInRange(e,r){let o=this.data.getIteratorFrom(e[0]);for(;o.hasNext();){let n=o.getNext();if(this.comparator(n.key,e[1])>=0)return;r(n.key)}}forEachWhile(e,r){let o;for(o=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();o.hasNext();)if(!e(o.getNext().key))return}firstAfterOrEqual(e){let r=this.data.getIteratorFrom(e);return r.hasNext()?r.getNext().key:null}getIterator(){return new v0(this.data.getIterator())}getIteratorFrom(e){return new v0(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 r=this;return r.size<e.size&&(r=e,e=this),e.forEach((o=>{r=r.add(o)})),r}isEqual(e){if(!(e instanceof t)||this.size!==e.size)return!1;let r=this.data.getIterator(),o=e.data.getIterator();for(;r.hasNext();){let n=r.getNext().key,i=o.getNext().key;if(this.comparator(n,i)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((r=>{e.push(r)})),e}toString(){let e=[];return this.forEach((r=>e.push(r))),"SortedSet("+e.toString()+")"}copy(e){let r=new t(this.comparator);return r.data=e,r}},v0=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};var Pa=class t{constructor(e){this.fields=e,e.sort(Xi.comparator)}static empty(){return new t([])}unionWith(e){let r=new Jo(Xi.comparator);for(let o of this.fields)r=r.add(o);for(let o of e)r=r.add(o);return new t(r.toArray())}covers(e){for(let r of this.fields)if(r.isPrefixOf(e))return!0;return!1}isEqual(e){return Hm(this.fields,e.fields,((r,o)=>r.isEqual(o)))}};var I0=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var Vn=class t{constructor(e){this.binaryString=e}static fromBase64String(e){let r=(function(n){try{return atob(n)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new I0("Invalid base64 string: "+i):i}})(e);return new t(r)}static fromUint8Array(e){let r=(function(n){let i="";for(let a=0;a<n.length;++a)i+=String.fromCharCode(n[a]);return i})(e);return new t(r)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(r){return btoa(r)})(this.binaryString)}toUint8Array(){return(function(r){let o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Bt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Vn.EMPTY_BYTE_STRING=new Vn("");var BOe=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Zl(t){if(Gt(!!t,39018),typeof t=="string"){let e=0,r=BOe.exec(t);if(Gt(!!r,46558,{timestamp:t}),r[1]){let n=r[1];n=(n+"000000000").substr(0,9),e=Number(n)}let o=new Date(t);return{seconds:Math.floor(o.getTime()/1e3),nanos:e}}return{seconds:Rr(t.seconds),nanos:Rr(t.nanos)}}function Rr(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function ec(t){return typeof t=="string"?Vn.fromBase64String(t):Vn.fromUint8Array(t)}var wX="server_timestamp",EX="__type__",SX="__previous_value__",CX="__local_write_time__";function aR(t){return(t?.mapValue?.fields||{})[EX]?.stringValue===wX}function tS(t){let e=t.mapValue.fields[SX];return aR(e)?tS(e):e}function zx(t){let e=Zl(t.mapValue.fields[CX].timestampValue);return new Tt(e.seconds,e.nanos)}var CA=class{constructor(e,r,o,n,i,a,s,l,c,u){this.databaseId=e,this.appId=r,this.persistenceKey=o,this.host=n,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=s,this.longPollingOptions=l,this.useFetchStreams=c,this.isUsingEmulator=u}},w0="(default)",E0=class t{constructor(e,r){this.projectId=e,this.database=r||w0}static empty(){return new t("","")}get isDefaultDatabase(){return this.database===w0}isEqual(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database}};var sR="__type__",TX="__max__",p0={mapValue:{fields:{__type__:{stringValue:TX}}}},lR="__vector__",Gm="value";function fu(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?aR(t)?4:NX(t)?9007199254740991:kX(t)?10:11:rt(28295,{value:t})}function el(t,e){if(t===e)return!0;let r=fu(t);if(r!==fu(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return zx(t).isEqual(zx(e));case 3:return(function(n,i){if(typeof n.timestampValue=="string"&&typeof i.timestampValue=="string"&&n.timestampValue.length===i.timestampValue.length)return n.timestampValue===i.timestampValue;let a=Zl(n.timestampValue),s=Zl(i.timestampValue);return a.seconds===s.seconds&&a.nanos===s.nanos})(t,e);case 5:return t.stringValue===e.stringValue;case 6:return(function(n,i){return ec(n.bytesValue).isEqual(ec(i.bytesValue))})(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return(function(n,i){return Rr(n.geoPointValue.latitude)===Rr(i.geoPointValue.latitude)&&Rr(n.geoPointValue.longitude)===Rr(i.geoPointValue.longitude)})(t,e);case 2:return(function(n,i){if("integerValue"in n&&"integerValue"in i)return Rr(n.integerValue)===Rr(i.integerValue);if("doubleValue"in n&&"doubleValue"in i){let a=Rr(n.doubleValue),s=Rr(i.doubleValue);return a===s?$x(a)===$x(s):isNaN(a)&&isNaN(s)}return!1})(t,e);case 9:return Hm(t.arrayValue.values||[],e.arrayValue.values||[],el);case 10:case 11:return(function(n,i){let a=n.mapValue.fields||{},s=i.mapValue.fields||{};if(IY(a)!==IY(s))return!1;for(let l in a)if(a.hasOwnProperty(l)&&(s[l]===void 0||!el(a[l],s[l])))return!1;return!0})(t,e);default:return rt(52216,{left:t})}}function Ux(t,e){return(t.values||[]).find((r=>el(r,e)))!==void 0}function Wm(t,e){if(t===e)return 0;let r=fu(t),o=fu(e);if(r!==o)return Bt(r,o);switch(r){case 0:case 9007199254740991:return 0;case 1:return Bt(t.booleanValue,e.booleanValue);case 2:return(function(i,a){let s=Rr(i.integerValue||i.doubleValue),l=Rr(a.integerValue||a.doubleValue);return s<l?-1:s>l?1:s===l?0:isNaN(s)?isNaN(l)?0:-1:1})(t,e);case 3:return wY(t.timestampValue,e.timestampValue);case 4:return wY(zx(t),zx(e));case 5:return IA(t.stringValue,e.stringValue);case 6:return(function(i,a){let s=ec(i),l=ec(a);return s.compareTo(l)})(t.bytesValue,e.bytesValue);case 7:return(function(i,a){let s=i.split("/"),l=a.split("/");for(let c=0;c<s.length&&c<l.length;c++){let u=Bt(s[c],l[c]);if(u!==0)return u}return Bt(s.length,l.length)})(t.referenceValue,e.referenceValue);case 8:return(function(i,a){let s=Bt(Rr(i.latitude),Rr(a.latitude));return s!==0?s:Bt(Rr(i.longitude),Rr(a.longitude))})(t.geoPointValue,e.geoPointValue);case 9:return EY(t.arrayValue,e.arrayValue);case 10:return(function(i,a){let s=i.fields||{},l=a.fields||{},c=s[Gm]?.arrayValue,u=l[Gm]?.arrayValue,d=Bt(c?.values?.length||0,u?.values?.length||0);return d!==0?d:EY(c,u)})(t.mapValue,e.mapValue);case 11:return(function(i,a){if(i===p0.mapValue&&a===p0.mapValue)return 0;if(i===p0.mapValue)return 1;if(a===p0.mapValue)return-1;let s=i.fields||{},l=Object.keys(s),c=a.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let d=0;d<l.length&&d<u.length;++d){let f=IA(l[d],u[d]);if(f!==0)return f;let m=Wm(s[l[d]],c[u[d]]);if(m!==0)return m}return Bt(l.length,u.length)})(t.mapValue,e.mapValue);default:throw rt(23264,{he:r})}}function wY(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return Bt(t,e);let r=Zl(t),o=Zl(e),n=Bt(r.seconds,o.seconds);return n!==0?n:Bt(r.nanos,o.nanos)}function EY(t,e){let r=t.values||[],o=e.values||[];for(let n=0;n<r.length&&n<o.length;++n){let i=Wm(r[n],o[n]);if(i)return i}return Bt(r.length,o.length)}function qm(t){return TA(t)}function TA(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?(function(r){let o=Zl(r);return`time(${o.seconds},${o.nanos})`})(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?(function(r){return ec(r).toBase64()})(t.bytesValue):"referenceValue"in t?(function(r){return ot.fromName(r).toString()})(t.referenceValue):"geoPointValue"in t?(function(r){return`geo(${r.latitude},${r.longitude})`})(t.geoPointValue):"arrayValue"in t?(function(r){let o="[",n=!0;for(let i of r.values||[])n?n=!1:o+=",",o+=TA(i);return o+"]"})(t.arrayValue):"mapValue"in t?(function(r){let o=Object.keys(r.fields||{}).sort(),n="{",i=!0;for(let a of o)i?i=!1:n+=",",n+=`${a}:${TA(r.fields[a])}`;return n+"}"})(t.mapValue):rt(61005,{value:t})}function g0(t){switch(fu(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=tS(t);return e?16+g0(e):16;case 5:return 2*t.stringValue.length;case 6:return ec(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(function(o){return(o.values||[]).reduce(((n,i)=>n+g0(i)),0)})(t.arrayValue);case 10:case 11:return(function(o){let n=0;return _u(o.fields,((i,a)=>{n+=i.length+g0(a)})),n})(t.mapValue);default:throw rt(13486,{value:t})}}function SY(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function kA(t){return!!t&&"integerValue"in t}function cR(t){return!!t&&"arrayValue"in t}function CY(t){return!!t&&"nullValue"in t}function TY(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function _0(t){return!!t&&"mapValue"in t}function kX(t){return(t?.mapValue?.fields||{})[sR]?.stringValue===lR}function Ox(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){let e={mapValue:{fields:{}}};return _u(t.mapValue.fields,((r,o)=>e.mapValue.fields[r]=Ox(o))),e}if(t.arrayValue){let e={arrayValue:{values:[]}};for(let r=0;r<(t.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=Ox(t.arrayValue.values[r]);return e}return{...t}}function NX(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===TX}var I0t={mapValue:{fields:{[sR]:{stringValue:lR},[Gm]:{arrayValue:{}}}}};var wi=class t{constructor(e){this.value=e}static empty(){return new t({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let r=this.value;for(let o=0;o<e.length-1;++o)if(r=(r.mapValue.fields||{})[e.get(o)],!_0(r))return null;return r=(r.mapValue.fields||{})[e.lastSegment()],r||null}}set(e,r){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ox(r)}setAll(e){let r=Xi.emptyPath(),o={},n=[];e.forEach(((a,s)=>{if(!r.isImmediateParentOf(s)){let l=this.getFieldsMap(r);this.applyChanges(l,o,n),o={},n=[],r=s.popLast()}a?o[s.lastSegment()]=Ox(a):n.push(s.lastSegment())}));let i=this.getFieldsMap(r);this.applyChanges(i,o,n)}delete(e){let r=this.field(e.popLast());_0(r)&&r.mapValue.fields&&delete r.mapValue.fields[e.lastSegment()]}isEqual(e){return el(this.value,e.value)}getFieldsMap(e){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let o=0;o<e.length;++o){let n=r.mapValue.fields[e.get(o)];_0(n)&&n.mapValue.fields||(n={mapValue:{fields:{}}},r.mapValue.fields[e.get(o)]=n),r=n}return r.mapValue.fields}applyChanges(e,r,o){_u(r,((n,i)=>e[n]=i));for(let n of o)delete e[n]}clone(){return new t(Ox(this.value))}};function PX(t){let e=[];return _u(t.fields,((r,o)=>{let n=new Xi([r]);if(_0(o)){let i=PX(o.mapValue).fields;if(i.length===0)e.push(n);else for(let a of i)e.push(n.child(a))}else e.push(n)})),new Pa(e)}var Qi=class t{constructor(e,r,o,n,i,a,s){this.key=e,this.documentType=r,this.version=o,this.readTime=n,this.createTime=i,this.data=a,this.documentState=s}static newInvalidDocument(e){return new t(e,0,mt.min(),mt.min(),mt.min(),wi.empty(),0)}static newFoundDocument(e,r,o,n){return new t(e,1,r,mt.min(),o,n,0)}static newNoDocument(e,r){return new t(e,2,r,mt.min(),mt.min(),wi.empty(),0)}static newUnknownDocument(e,r){return new t(e,3,r,mt.min(),mt.min(),wi.empty(),2)}convertToFoundDocument(e,r){return!this.createTime.isEqual(mt.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=wi.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=wi.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=mt.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof t&&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 t(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}})`}};var Km=class{constructor(e,r){this.position=e,this.inclusive=r}};function kY(t,e,r){let o=0;for(let n=0;n<t.position.length;n++){let i=e[n],a=t.position[n];if(i.field.isKeyField()?o=ot.comparator(ot.fromName(a.referenceValue),r.key):o=Wm(a,r.data.field(i.field)),i.dir==="desc"&&(o*=-1),o!==0)break}return o}function NY(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let r=0;r<t.position.length;r++)if(!el(t.position[r],e.position[r]))return!1;return!0}var cf=class{constructor(e,r="asc"){this.field=e,this.dir=r}};function $Oe(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}var S0=class{},So=class t extends S0{constructor(e,r,o){super(),this.field=e,this.op=r,this.value=o}static create(e,r,o){return e.isKeyField()?r==="in"||r==="not-in"?this.createKeyFieldInFilter(e,r,o):new PA(e,r,o):r==="array-contains"?new DA(e,o):r==="in"?new RA(e,o):r==="not-in"?new MA(e,o):r==="array-contains-any"?new LA(e,o):new t(e,r,o)}static createKeyFieldInFilter(e,r,o){return r==="in"?new OA(e,o):new AA(e,o)}matches(e){let r=e.data.field(this.field);return this.op==="!="?r!==null&&r.nullValue===void 0&&this.matchesComparison(Wm(r,this.value)):r!==null&&fu(this.value)===fu(r)&&this.matchesComparison(Wm(r,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return rt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},us=class t extends S0{constructor(e,r){super(),this.filters=e,this.op=r,this.Pe=null}static create(e,r){return new t(e,r)}matches(e){return OX(this)?this.filters.find((r=>!r.matches(e)))===void 0:this.filters.find((r=>r.matches(e)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((e,r)=>e.concat(r.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}};function OX(t){return t.op==="and"}function AX(t){return zOe(t)&&OX(t)}function zOe(t){for(let e of t.filters)if(e instanceof us)return!1;return!0}function NA(t){if(t instanceof So)return t.field.canonicalString()+t.op.toString()+qm(t.value);if(AX(t))return t.filters.map((e=>NA(e))).join(",");{let e=t.filters.map((r=>NA(r))).join(",");return`${t.op}(${e})`}}function DX(t,e){return t instanceof So?(function(o,n){return n instanceof So&&o.op===n.op&&o.field.isEqual(n.field)&&el(o.value,n.value)})(t,e):t instanceof us?(function(o,n){return n instanceof us&&o.op===n.op&&o.filters.length===n.filters.length?o.filters.reduce(((i,a,s)=>i&&DX(a,n.filters[s])),!0):!1})(t,e):void rt(19439)}function RX(t){return t instanceof So?(function(r){return`${r.field.canonicalString()} ${r.op} ${qm(r.value)}`})(t):t instanceof us?(function(r){return r.op.toString()+" {"+r.getFilters().map(RX).join(" ,")+"}"})(t):"Filter"}var PA=class extends So{constructor(e,r,o){super(e,r,o),this.key=ot.fromName(o.referenceValue)}matches(e){let r=ot.comparator(e.key,this.key);return this.matchesComparison(r)}},OA=class extends So{constructor(e,r){super(e,"in",r),this.keys=MX("in",r)}matches(e){return this.keys.some((r=>r.isEqual(e.key)))}},AA=class extends So{constructor(e,r){super(e,"not-in",r),this.keys=MX("not-in",r)}matches(e){return!this.keys.some((r=>r.isEqual(e.key)))}};function MX(t,e){return(e.arrayValue?.values||[]).map((r=>ot.fromName(r.referenceValue)))}var DA=class extends So{constructor(e,r){super(e,"array-contains",r)}matches(e){let r=e.data.field(this.field);return cR(r)&&Ux(r.arrayValue,this.value)}},RA=class extends So{constructor(e,r){super(e,"in",r)}matches(e){let r=e.data.field(this.field);return r!==null&&Ux(this.value.arrayValue,r)}},MA=class extends So{constructor(e,r){super(e,"not-in",r)}matches(e){if(Ux(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let r=e.data.field(this.field);return r!==null&&r.nullValue===void 0&&!Ux(this.value.arrayValue,r)}},LA=class extends So{constructor(e,r){super(e,"array-contains-any",r)}matches(e){let r=e.data.field(this.field);return!(!cR(r)||!r.arrayValue.values)&&r.arrayValue.values.some((o=>Ux(this.value.arrayValue,o)))}};var FA=class{constructor(e,r=null,o=[],n=[],i=null,a=null,s=null){this.path=e,this.collectionGroup=r,this.orderBy=o,this.filters=n,this.limit=i,this.startAt=a,this.endAt=s,this.Te=null}};function PY(t,e=null,r=[],o=[],n=null,i=null,a=null){return new FA(t,e,r,o,n,i,a)}function uR(t){let e=gt(t);if(e.Te===null){let r=e.path.canonicalString();e.collectionGroup!==null&&(r+="|cg:"+e.collectionGroup),r+="|f:",r+=e.filters.map((o=>NA(o))).join(","),r+="|ob:",r+=e.orderBy.map((o=>(function(i){return i.field.canonicalString()+i.dir})(o))).join(","),tb(e.limit)||(r+="|l:",r+=e.limit),e.startAt&&(r+="|lb:",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map((o=>qm(o))).join(",")),e.endAt&&(r+="|ub:",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map((o=>qm(o))).join(",")),e.Te=r}return e.Te}function dR(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let r=0;r<t.orderBy.length;r++)if(!$Oe(t.orderBy[r],e.orderBy[r]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let r=0;r<t.filters.length;r++)if(!DX(t.filters[r],e.filters[r]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!NY(t.startAt,e.startAt)&&NY(t.endAt,e.endAt)}function BA(t){return ot.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}var pu=class{constructor(e,r=null,o=[],n=[],i=null,a="F",s=null,l=null){this.path=e,this.collectionGroup=r,this.explicitOrderBy=o,this.filters=n,this.limit=i,this.limitType=a,this.startAt=s,this.endAt=l,this.Ie=null,this.Ee=null,this.de=null,this.startAt,this.endAt}};function UOe(t,e,r,o,n,i,a,s){return new pu(t,e,r,o,n,i,a,s)}function rS(t){return new pu(t)}function OY(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function LX(t){return t.collectionGroup!==null}function Ax(t){let e=gt(t);if(e.Ie===null){e.Ie=[];let r=new Set;for(let i of e.explicitOrderBy)e.Ie.push(i),r.add(i.field.canonicalString());let o=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let s=new Jo(Xi.comparator);return a.filters.forEach((l=>{l.getFlattenedFilters().forEach((c=>{c.isInequality()&&(s=s.add(c.field))}))})),s})(e).forEach((i=>{r.has(i.canonicalString())||i.isKeyField()||e.Ie.push(new cf(i,o))})),r.has(Xi.keyField().canonicalString())||e.Ie.push(new cf(Xi.keyField(),o))}return e.Ie}function Zs(t){let e=gt(t);return e.Ee||(e.Ee=VOe(e,Ax(t))),e.Ee}function VOe(t,e){if(t.limitType==="F")return PY(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map((n=>{let i=n.dir==="desc"?"asc":"desc";return new cf(n.field,i)}));let r=t.endAt?new Km(t.endAt.position,t.endAt.inclusive):null,o=t.startAt?new Km(t.startAt.position,t.startAt.inclusive):null;return PY(t.path,t.collectionGroup,e,t.filters,t.limit,r,o)}}function $A(t,e){let r=t.filters.concat([e]);return new pu(t.path,t.collectionGroup,t.explicitOrderBy.slice(),r,t.limit,t.limitType,t.startAt,t.endAt)}function C0(t,e,r){return new pu(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,r,t.startAt,t.endAt)}function oS(t,e){return dR(Zs(t),Zs(e))&&t.limitType===e.limitType}function FX(t){return`${uR(Zs(t))}|lt:${t.limitType}`}function Fm(t){return`Query(target=${(function(r){let o=r.path.canonicalString();return r.collectionGroup!==null&&(o+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(o+=`, filters: [${r.filters.map((n=>RX(n))).join(", ")}]`),tb(r.limit)||(o+=", limit: "+r.limit),r.orderBy.length>0&&(o+=`, orderBy: [${r.orderBy.map((n=>(function(a){return`${a.field.canonicalString()} (${a.dir})`})(n))).join(", ")}]`),r.startAt&&(o+=", startAt: ",o+=r.startAt.inclusive?"b:":"a:",o+=r.startAt.position.map((n=>qm(n))).join(",")),r.endAt&&(o+=", endAt: ",o+=r.endAt.inclusive?"a:":"b:",o+=r.endAt.position.map((n=>qm(n))).join(",")),`Target(${o})`})(Zs(t))}; limitType=${t.limitType})`}function nS(t,e){return e.isFoundDocument()&&(function(o,n){let i=n.key.path;return o.collectionGroup!==null?n.key.hasCollectionId(o.collectionGroup)&&o.path.isPrefixOf(i):ot.isDocumentKey(o.path)?o.path.isEqual(i):o.path.isImmediateParentOf(i)})(t,e)&&(function(o,n){for(let i of Ax(o))if(!i.field.isKeyField()&&n.data.field(i.field)===null)return!1;return!0})(t,e)&&(function(o,n){for(let i of o.filters)if(!i.matches(n))return!1;return!0})(t,e)&&(function(o,n){return!(o.startAt&&!(function(a,s,l){let c=kY(a,s,l);return a.inclusive?c<=0:c<0})(o.startAt,Ax(o),n)||o.endAt&&!(function(a,s,l){let c=kY(a,s,l);return a.inclusive?c>=0:c>0})(o.endAt,Ax(o),n))})(t,e)}function HOe(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function BX(t){return(e,r)=>{let o=!1;for(let n of Ax(t)){let i=jOe(n,e,r);if(i!==0)return i;o=o||n.field.isKeyField()}return 0}}function jOe(t,e,r){let o=t.field.isKeyField()?ot.comparator(e.key,r.key):(function(i,a,s){let l=a.data.field(i),c=s.data.field(i);return l!==null&&c!==null?Wm(l,c):rt(42886)})(t.field,e,r);switch(t.dir){case"asc":return o;case"desc":return-1*o;default:return rt(19790,{direction:t.dir})}}var tc=class{constructor(e,r){this.mapKeyFn=e,this.equalsFn=r,this.inner={},this.innerSize=0}get(e){let r=this.mapKeyFn(e),o=this.inner[r];if(o!==void 0){for(let[n,i]of o)if(this.equalsFn(n,e))return i}}has(e){return this.get(e)!==void 0}set(e,r){let o=this.mapKeyFn(e),n=this.inner[o];if(n===void 0)return this.inner[o]=[[e,r]],void this.innerSize++;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return void(n[i]=[e,r]);n.push([e,r]),this.innerSize++}delete(e){let r=this.mapKeyFn(e),o=this.inner[r];if(o===void 0)return!1;for(let n=0;n<o.length;n++)if(this.equalsFn(o[n][0],e))return o.length===1?delete this.inner[r]:o.splice(n,1),this.innerSize--,!0;return!1}forEach(e){_u(this.inner,((r,o)=>{for(let[n,i]of o)e(n,i)}))}isEmpty(){return IX(this.inner)}size(){return this.innerSize}};var GOe=new Zr(ot.comparator);function rc(){return GOe}var $X=new Zr(ot.comparator);function Px(...t){let e=$X;for(let r of t)e=e.insert(r.key,r);return e}function zX(t){let e=$X;return t.forEach(((r,o)=>e=e.insert(r,o.overlayedDocument))),e}function of(){return Dx()}function UX(){return Dx()}function Dx(){return new tc((t=>t.toString()),((t,e)=>t.isEqual(e)))}var WOe=new Zr(ot.comparator),qOe=new Jo(ot.comparator);function $t(...t){let e=qOe;for(let r of t)e=e.add(r);return e}var KOe=new Jo(Bt);function YOe(){return KOe}function fR(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:$x(e)?"-0":e}}function VX(t){return{integerValue:""+t}}function XOe(t,e){return SOe(e)?VX(e):fR(t,e)}var Ym=class{constructor(){this._=void 0}};function JOe(t,e,r){return t instanceof uf?(function(n,i){let a={fields:{[EX]:{stringValue:wX},[CX]:{timestampValue:{seconds:n.seconds,nanos:n.nanoseconds}}}};return i&&aR(i)&&(i=tS(i)),i&&(a.fields[SX]=i),{mapValue:a}})(r,e):t instanceof mu?jX(t,e):t instanceof df?GX(t,e):(function(n,i){let a=HX(n,i),s=AY(a)+AY(n.Ae);return kA(a)&&kA(n.Ae)?VX(s):fR(n.serializer,s)})(t,e)}function QOe(t,e,r){return t instanceof mu?jX(t,e):t instanceof df?GX(t,e):r}function HX(t,e){return t instanceof Xm?(function(o){return kA(o)||(function(i){return!!i&&"doubleValue"in i})(o)})(e)?e:{integerValue:0}:null}var uf=class extends Ym{},mu=class extends Ym{constructor(e){super(),this.elements=e}};function jX(t,e){let r=WX(e);for(let o of t.elements)r.some((n=>el(n,o)))||r.push(o);return{arrayValue:{values:r}}}var df=class extends Ym{constructor(e){super(),this.elements=e}};function GX(t,e){let r=WX(e);for(let o of t.elements)r=r.filter((n=>!el(n,o)));return{arrayValue:{values:r}}}var Xm=class extends Ym{constructor(e,r){super(),this.serializer=e,this.Ae=r}};function AY(t){return Rr(t.integerValue||t.doubleValue)}function WX(t){return cR(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var T0=class{constructor(e,r){this.field=e,this.transform=r}};function ZOe(t,e){return t.field.isEqual(e.field)&&(function(o,n){return o instanceof mu&&n instanceof mu||o instanceof df&&n instanceof df?Hm(o.elements,n.elements,el):o instanceof Xm&&n instanceof Xm?el(o.Ae,n.Ae):o instanceof uf&&n instanceof uf})(t.transform,e.transform)}var zA=class{constructor(e,r){this.version=e,this.transformResults=r}},Nn=class t{constructor(e,r){this.updateTime=e,this.exists=r}static none(){return new t}static exists(e){return new t(void 0,e)}static updateTime(e){return new t(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function x0(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}var Jm=class{};function qX(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new pf(t.key,Nn.none()):new ff(t.key,t.data,Nn.none());{let r=t.data,o=wi.empty(),n=new Jo(Xi.comparator);for(let i of e.fields)if(!n.has(i)){let a=r.field(i);a===null&&i.length>1&&(i=i.popLast(),a=r.field(i)),a===null?o.delete(i):o.set(i,a),n=n.add(i)}return new tl(t.key,o,new Pa(n.toArray()),Nn.none())}}function eAe(t,e,r){t instanceof ff?(function(n,i,a){let s=n.value.clone(),l=RY(n.fieldTransforms,i,a.transformResults);s.setAll(l),i.convertToFoundDocument(a.version,s).setHasCommittedMutations()})(t,e,r):t instanceof tl?(function(n,i,a){if(!x0(n.precondition,i))return void i.convertToUnknownDocument(a.version);let s=RY(n.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(KX(n)),l.setAll(s),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()})(t,e,r):(function(n,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()})(0,e,r)}function Rx(t,e,r,o){return t instanceof ff?(function(i,a,s,l){if(!x0(i.precondition,a))return s;let c=i.value.clone(),u=MY(i.fieldTransforms,l,a);return c.setAll(u),a.convertToFoundDocument(a.version,c).setHasLocalMutations(),null})(t,e,r,o):t instanceof tl?(function(i,a,s,l){if(!x0(i.precondition,a))return s;let c=MY(i.fieldTransforms,l,a),u=a.data;return u.setAll(KX(i)),u.setAll(c),a.convertToFoundDocument(a.version,u).setHasLocalMutations(),s===null?null:s.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((d=>d.field)))})(t,e,r,o):(function(i,a,s){return x0(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):s})(t,e,r)}function tAe(t,e){let r=null;for(let o of t.fieldTransforms){let n=e.data.field(o.field),i=HX(o.transform,n||null);i!=null&&(r===null&&(r=wi.empty()),r.set(o.field,i))}return r||null}function DY(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!(function(o,n){return o===void 0&&n===void 0||!(!o||!n)&&Hm(o,n,((i,a)=>ZOe(i,a)))})(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}var ff=class extends Jm{constructor(e,r,o,n=[]){super(),this.key=e,this.value=r,this.precondition=o,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}},tl=class extends Jm{constructor(e,r,o,n,i=[]){super(),this.key=e,this.data=r,this.fieldMask=o,this.precondition=n,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function KX(t){let e=new Map;return t.fieldMask.fields.forEach((r=>{if(!r.isEmpty()){let o=t.data.field(r);e.set(r,o)}})),e}function RY(t,e,r){let o=new Map;Gt(t.length===r.length,32656,{Re:r.length,Ve:t.length});for(let n=0;n<r.length;n++){let i=t[n],a=i.transform,s=e.data.field(i.field);o.set(i.field,QOe(a,s,r[n]))}return o}function MY(t,e,r){let o=new Map;for(let n of t){let i=n.transform,a=r.data.field(n.field);o.set(n.field,JOe(i,a,e))}return o}var pf=class extends Jm{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},k0=class extends Jm{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var UA=class{constructor(e,r,o,n){this.batchId=e,this.localWriteTime=r,this.baseMutations=o,this.mutations=n}applyToRemoteDocument(e,r){let o=r.mutationResults;for(let n=0;n<this.mutations.length;n++){let i=this.mutations[n];i.key.isEqual(e.key)&&eAe(i,e,o[n])}}applyToLocalView(e,r){for(let o of this.baseMutations)o.key.isEqual(e.key)&&(r=Rx(o,e,r,this.localWriteTime));for(let o of this.mutations)o.key.isEqual(e.key)&&(r=Rx(o,e,r,this.localWriteTime));return r}applyToLocalDocumentSet(e,r){let o=UX();return this.mutations.forEach((n=>{let i=e.get(n.key),a=i.overlayedDocument,s=this.applyToLocalView(a,i.mutatedFields);s=r.has(n.key)?null:s;let l=qX(a,s);l!==null&&o.set(n.key,l),a.isValidDocument()||a.convertToNoDocument(mt.min())})),o}keys(){return this.mutations.reduce(((e,r)=>e.add(r.key)),$t())}isEqual(e){return this.batchId===e.batchId&&Hm(this.mutations,e.mutations,((r,o)=>DY(r,o)))&&Hm(this.baseMutations,e.baseMutations,((r,o)=>DY(r,o)))}},VA=class t{constructor(e,r,o,n){this.batch=e,this.commitVersion=r,this.mutationResults=o,this.docVersions=n}static from(e,r,o){Gt(e.mutations.length===o.length,58842,{me:e.mutations.length,fe:o.length});let n=(function(){return WOe})(),i=e.mutations;for(let a=0;a<i.length;a++)n=n.insert(i[a].key,o[a].version);return new t(e,r,o,n)}};var HA=class{constructor(e,r){this.largestBatchId=e,this.mutation=r}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
34
34
  largestBatchId: ${this.largestBatchId},
35
35
  mutation: ${this.mutation.toString()}
36
- }`}};var jA=class{constructor(e,r){this.count=e,this.unchangedNames=r}};var wo,jt;function YX(t){switch(t){case te.OK:return rt(64938);case te.CANCELLED:case te.UNKNOWN:case te.DEADLINE_EXCEEDED:case te.RESOURCE_EXHAUSTED:case te.INTERNAL:case te.UNAVAILABLE:case te.UNAUTHENTICATED:return!1;case te.INVALID_ARGUMENT:case te.NOT_FOUND:case te.ALREADY_EXISTS:case te.PERMISSION_DENIED:case te.FAILED_PRECONDITION:case te.ABORTED:case te.OUT_OF_RANGE:case te.UNIMPLEMENTED:case te.DATA_LOSS:return!0;default:return rt(15467,{code:t})}}function XX(t){if(t===void 0)return Ql("GRPC error has no .code"),te.UNKNOWN;switch(t){case wo.OK:return te.OK;case wo.CANCELLED:return te.CANCELLED;case wo.UNKNOWN:return te.UNKNOWN;case wo.DEADLINE_EXCEEDED:return te.DEADLINE_EXCEEDED;case wo.RESOURCE_EXHAUSTED:return te.RESOURCE_EXHAUSTED;case wo.INTERNAL:return te.INTERNAL;case wo.UNAVAILABLE:return te.UNAVAILABLE;case wo.UNAUTHENTICATED:return te.UNAUTHENTICATED;case wo.INVALID_ARGUMENT:return te.INVALID_ARGUMENT;case wo.NOT_FOUND:return te.NOT_FOUND;case wo.ALREADY_EXISTS:return te.ALREADY_EXISTS;case wo.PERMISSION_DENIED:return te.PERMISSION_DENIED;case wo.FAILED_PRECONDITION:return te.FAILED_PRECONDITION;case wo.ABORTED:return te.ABORTED;case wo.OUT_OF_RANGE:return te.OUT_OF_RANGE;case wo.UNIMPLEMENTED:return te.UNIMPLEMENTED;case wo.DATA_LOSS:return te.DATA_LOSS;default:return rt(39323,{code:t})}}(jt=wo||(wo={}))[jt.OK=0]="OK",jt[jt.CANCELLED=1]="CANCELLED",jt[jt.UNKNOWN=2]="UNKNOWN",jt[jt.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",jt[jt.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",jt[jt.NOT_FOUND=5]="NOT_FOUND",jt[jt.ALREADY_EXISTS=6]="ALREADY_EXISTS",jt[jt.PERMISSION_DENIED=7]="PERMISSION_DENIED",jt[jt.UNAUTHENTICATED=16]="UNAUTHENTICATED",jt[jt.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",jt[jt.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",jt[jt.ABORTED=10]="ABORTED",jt[jt.OUT_OF_RANGE=11]="OUT_OF_RANGE",jt[jt.UNIMPLEMENTED=12]="UNIMPLEMENTED",jt[jt.INTERNAL=13]="INTERNAL",jt[jt.UNAVAILABLE=14]="UNAVAILABLE",jt[jt.DATA_LOSS=15]="DATA_LOSS";var rAe=null;function oAe(){return new TextEncoder}var nAe=new Yl([4294967295,4294967295],0);function LY(t){let e=oAe().encode(t),r=new aA;return r.update(e),new Uint8Array(r.digest())}function FY(t){let e=new DataView(t.buffer),r=e.getUint32(0,!0),o=e.getUint32(4,!0),n=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new Yl([r,o],0),new Yl([n,i],0)]}var GA=class t{constructor(e,r,o){if(this.bitmap=e,this.padding=r,this.hashCount=o,r<0||r>=8)throw new nf(`Invalid padding: ${r}`);if(o<0)throw new nf(`Invalid hash count: ${o}`);if(e.length>0&&this.hashCount===0)throw new nf(`Invalid hash count: ${o}`);if(e.length===0&&r!==0)throw new nf(`Invalid padding when bitmap length is 0: ${r}`);this.ge=8*e.length-r,this.pe=Yl.fromNumber(this.ge)}ye(e,r,o){let n=e.add(r.multiply(Yl.fromNumber(o)));return n.compare(nAe)===1&&(n=new Yl([n.getBits(0),n.getBits(1)],0)),n.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let r=LY(e),[o,n]=FY(r);for(let i=0;i<this.hashCount;i++){let a=this.ye(o,n,i);if(!this.we(a))return!1}return!0}static create(e,r,o){let n=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new t(i,n,r);return o.forEach((s=>a.insert(s))),a}insert(e){if(this.ge===0)return;let r=LY(e),[o,n]=FY(r);for(let i=0;i<this.hashCount;i++){let a=this.ye(o,n,i);this.Se(a)}}Se(e){let r=Math.floor(e/8),o=e%8;this.bitmap[r]|=1<<o}},nf=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var NE=class t{constructor(e,r,o,n,i){this.snapshotVersion=e,this.targetChanges=r,this.targetMismatches=o,this.documentUpdates=n,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,r,o){let n=new Map;return n.set(e,Vx.createSynthesizedTargetChangeForCurrentChange(e,r,o)),new t(mt.min(),n,new Zr(Bt),rc(),$t())}},Vx=class t{constructor(e,r,o,n,i){this.resumeToken=e,this.current=r,this.addedDocuments=o,this.modifiedDocuments=n,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,r,o){return new t(o,r,$t(),$t(),$t())}};var Um=class{constructor(e,r,o,n){this.be=e,this.removedTargetIds=r,this.key=o,this.De=n}},PE=class{constructor(e,r){this.targetId=e,this.Ce=r}},OE=class{constructor(e,r,o=Vn.EMPTY_BYTE_STRING,n=null){this.state=e,this.targetIds=r,this.resumeToken=o,this.cause=n}},AE=class{constructor(){this.ve=0,this.Fe=BY(),this.Me=Vn.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=$t(),r=$t(),o=$t();return this.Fe.forEach(((n,i)=>{switch(i){case 0:e=e.add(n);break;case 2:r=r.add(n);break;case 1:o=o.add(n);break;default:rt(38017,{changeType:i})}})),new Vx(this.Me,this.xe,e,r,o)}qe(){this.Oe=!1,this.Fe=BY()}Qe(e,r){this.Oe=!0,this.Fe=this.Fe.insert(e,r)}$e(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}Ue(){this.ve+=1}Ke(){this.ve-=1,Gt(this.ve>=0,3241,{ve:this.ve})}We(){this.Oe=!0,this.xe=!0}},WA=class{constructor(e){this.Ge=e,this.ze=new Map,this.je=rc(),this.Je=mE(),this.He=mE(),this.Ye=new Zr(Bt)}Ze(e){for(let r of e.be)e.De&&e.De.isFoundDocument()?this.Xe(r,e.De):this.et(r,e.key,e.De);for(let r of e.removedTargetIds)this.et(r,e.key,e.De)}tt(e){this.forEachTarget(e,(r=>{let o=this.nt(r);switch(e.state){case 0:this.rt(r)&&o.Le(e.resumeToken);break;case 1:o.Ke(),o.Ne||o.qe(),o.Le(e.resumeToken);break;case 2:o.Ke(),o.Ne||this.removeTarget(r);break;case 3:this.rt(r)&&(o.We(),o.Le(e.resumeToken));break;case 4:this.rt(r)&&(this.it(r),o.Le(e.resumeToken));break;default:rt(56790,{state:e.state})}}))}forEachTarget(e,r){e.targetIds.length>0?e.targetIds.forEach(r):this.ze.forEach(((o,n)=>{this.rt(n)&&r(n)}))}st(e){let r=e.targetId,o=e.Ce.count,n=this.ot(r);if(n){let i=n.target;if(BA(i))if(o===0){let a=new ot(i.path);this.et(r,a,Qi.newNoDocument(a,mt.min()))}else Gt(o===1,20013,{expectedCount:o});else{let a=this._t(r);if(a!==o){let s=this.ut(e),l=s?this.ct(s,e,a):1;if(l!==0){this.it(r);let c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ye=this.Ye.insert(r,c)}rAe?.lt((function(u,d,f,m,h){let g={localCacheCount:u,existenceFilterCount:d.count,databaseId:f.database,projectId:f.projectId},_=d.unchangedNames;return _&&(g.bloomFilter={applied:h===0,hashCount:_?.hashCount??0,bitmapLength:_?.bits?.bitmap?.length??0,padding:_?.bits?.padding??0,mightContain:b=>m?.mightContain(b)??!1}),g})(a,e.Ce,this.Ge.ht(),s,l))}}}}ut(e){let r=e.Ce.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:o="",padding:n=0},hashCount:i=0}=r,a,s;try{a=ec(o).toUint8Array()}catch(l){if(l instanceof IE)return Lx("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{s=new GA(a,n,i)}catch(l){return Lx(l instanceof nf?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return s.ge===0?null:s}ct(e,r,o){return r.Ce.count===o-this.Pt(e,r.targetId)?0:2}Pt(e,r){let o=this.Ge.getRemoteKeysForTarget(r),n=0;return o.forEach((i=>{let a=this.Ge.ht(),s=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(s)||(this.et(r,i,null),n++)})),n}Tt(e){let r=new Map;this.ze.forEach(((i,a)=>{let s=this.ot(a);if(s){if(i.current&&BA(s.target)){let l=new ot(s.target.path);this.It(l).has(a)||this.Et(a,l)||this.et(a,l,Qi.newNoDocument(l,e))}i.Be&&(r.set(a,i.ke()),i.qe())}}));let o=$t();this.He.forEach(((i,a)=>{let s=!0;a.forEachWhile((l=>{let c=this.ot(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(s=!1,!1)})),s&&(o=o.add(i))})),this.je.forEach(((i,a)=>a.setReadTime(e)));let n=new NE(e,r,this.Ye,this.je,o);return this.je=rc(),this.Je=mE(),this.He=mE(),this.Ye=new Zr(Bt),n}Xe(e,r){if(!this.rt(e))return;let o=this.Et(e,r.key)?2:0;this.nt(e).Qe(r.key,o),this.je=this.je.insert(r.key,r),this.Je=this.Je.insert(r.key,this.It(r.key).add(e)),this.He=this.He.insert(r.key,this.dt(r.key).add(e))}et(e,r,o){if(!this.rt(e))return;let n=this.nt(e);this.Et(e,r)?n.Qe(r,1):n.$e(r),this.He=this.He.insert(r,this.dt(r).delete(e)),this.He=this.He.insert(r,this.dt(r).add(e)),o&&(this.je=this.je.insert(r,o))}removeTarget(e){this.ze.delete(e)}_t(e){let r=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}Ue(e){this.nt(e).Ue()}nt(e){let r=this.ze.get(e);return r||(r=new AE,this.ze.set(e,r)),r}dt(e){let r=this.He.get(e);return r||(r=new Jo(Bt),this.He=this.He.insert(e,r)),r}It(e){let r=this.Je.get(e);return r||(r=new Jo(Bt),this.Je=this.Je.insert(e,r)),r}rt(e){let r=this.ot(e)!==null;return r||Le("WatchChangeAggregator","Detected inactive target",e),r}ot(e){let r=this.ze.get(e);return r&&r.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new AE),this.Ge.getRemoteKeysForTarget(e).forEach((r=>{this.et(e,r,null)}))}Et(e,r){return this.Ge.getRemoteKeysForTarget(e).has(r)}};function mE(){return new Zr(ot.comparator)}function BY(){return new Zr(ot.comparator)}var iAe={asc:"ASCENDING",desc:"DESCENDING"},aAe={"<":"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"},sAe={and:"AND",or:"OR"},qA=class{constructor(e,r){this.databaseId=e,this.useProto3Json=r}};function KA(t,e){return t.useProto3Json||tb(e)?e:{value:e}}function DE(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function JX(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function lAe(t,e){return DE(t,e.toTimestamp())}function Ji(t){return Gt(!!t,49232),mt.fromTimestamp((function(r){let o=Zl(r);return new Tt(o.seconds,o.nanos)})(t))}function pR(t,e){return YA(t,e).canonicalString()}function YA(t,e){let r=(function(n){return new Sr(["projects",n.projectId,"databases",n.database])})(t).child("documents");return e===void 0?r:r.child(e)}function QX(t){let e=Sr.fromString(t);return Gt(nJ(e),10190,{key:e.toString()}),e}function RE(t,e){return pR(t.databaseId,e.path)}function Mx(t,e){let r=QX(e);if(r.get(1)!==t.databaseId.projectId)throw new xe(te.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+t.databaseId.projectId);if(r.get(3)!==t.databaseId.database)throw new xe(te.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+t.databaseId.database);return new ot(eJ(r))}function ZX(t,e){return pR(t.databaseId,e)}function cAe(t){let e=QX(t);return e.length===4?Sr.emptyPath():eJ(e)}function XA(t){return new Sr(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function eJ(t){return Gt(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function $Y(t,e,r){return{name:RE(t,e),fields:r.value.mapValue.fields}}function uAe(t,e){return"found"in e?(function(o,n){Gt(!!n.found,43571),n.found.name,n.found.updateTime;let i=Mx(o,n.found.name),a=Ji(n.found.updateTime),s=n.found.createTime?Ji(n.found.createTime):mt.min(),l=new wi({mapValue:{fields:n.found.fields}});return Qi.newFoundDocument(i,a,s,l)})(t,e):"missing"in e?(function(o,n){Gt(!!n.missing,3894),Gt(!!n.readTime,22933);let i=Mx(o,n.missing),a=Ji(n.readTime);return Qi.newNoDocument(i,a)})(t,e):rt(7234,{result:e})}function dAe(t,e){let r;if("targetChange"in e){e.targetChange;let o=(function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:rt(39313,{state:c})})(e.targetChange.targetChangeType||"NO_CHANGE"),n=e.targetChange.targetIds||[],i=(function(c,u){return c.useProto3Json?(Gt(u===void 0||typeof u=="string",58123),Vn.fromBase64String(u||"")):(Gt(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),Vn.fromUint8Array(u||new Uint8Array))})(t,e.targetChange.resumeToken),a=e.targetChange.cause,s=a&&(function(c){let u=c.code===void 0?te.UNKNOWN:XX(c.code);return new xe(u,c.message||"")})(a);r=new OE(o,n,i,s||null)}else if("documentChange"in e){e.documentChange;let o=e.documentChange;o.document,o.document.name,o.document.updateTime;let n=Mx(t,o.document.name),i=Ji(o.document.updateTime),a=o.document.createTime?Ji(o.document.createTime):mt.min(),s=new wi({mapValue:{fields:o.document.fields}}),l=Qi.newFoundDocument(n,i,a,s),c=o.targetIds||[],u=o.removedTargetIds||[];r=new Um(c,u,l.key,l)}else if("documentDelete"in e){e.documentDelete;let o=e.documentDelete;o.document;let n=Mx(t,o.document),i=o.readTime?Ji(o.readTime):mt.min(),a=Qi.newNoDocument(n,i),s=o.removedTargetIds||[];r=new Um([],s,a.key,a)}else if("documentRemove"in e){e.documentRemove;let o=e.documentRemove;o.document;let n=Mx(t,o.document),i=o.removedTargetIds||[];r=new Um([],i,n,null)}else{if(!("filter"in e))return rt(11601,{Rt:e});{e.filter;let o=e.filter;o.targetId;let{count:n=0,unchangedNames:i}=o,a=new jA(n,i),s=o.targetId;r=new PE(s,a)}}return r}function tJ(t,e){let r;if(e instanceof ff)r={update:$Y(t,e.key,e.value)};else if(e instanceof pf)r={delete:RE(t,e.key)};else if(e instanceof tl)r={update:$Y(t,e.key,e.data),updateMask:yAe(e.fieldMask)};else{if(!(e instanceof kE))return rt(16599,{Vt:e.type});r={verify:RE(t,e.key)}}return e.fieldTransforms.length>0&&(r.updateTransforms=e.fieldTransforms.map((o=>(function(i,a){let s=a.transform;if(s instanceof uf)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(s instanceof mu)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:s.elements}};if(s instanceof df)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:s.elements}};if(s instanceof Xm)return{fieldPath:a.field.canonicalString(),increment:s.Ae};throw rt(20930,{transform:a.transform})})(0,o)))),e.precondition.isNone||(r.currentDocument=(function(n,i){return i.updateTime!==void 0?{updateTime:lAe(n,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:rt(27497)})(t,e.precondition)),r}function fAe(t,e){return t&&t.length>0?(Gt(e!==void 0,14353),t.map((r=>(function(n,i){let a=n.updateTime?Ji(n.updateTime):Ji(i);return a.isEqual(mt.min())&&(a=Ji(i)),new zA(a,n.transformResults||[])})(r,e)))):[]}function pAe(t,e){return{documents:[ZX(t,e.path)]}}function mAe(t,e){let r={structuredQuery:{}},o=e.path,n;e.collectionGroup!==null?(n=o,r.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n=o.popLast(),r.structuredQuery.from=[{collectionId:o.lastSegment()}]),r.parent=ZX(t,n);let i=(function(c){if(c.length!==0)return oJ(us.create(c,"and"))})(e.filters);i&&(r.structuredQuery.where=i);let a=(function(c){if(c.length!==0)return c.map((u=>(function(f){return{field:Bm(f.field),direction:_Ae(f.dir)}})(u)))})(e.orderBy);a&&(r.structuredQuery.orderBy=a);let s=KA(t,e.limit);return s!==null&&(r.structuredQuery.limit=s),e.startAt&&(r.structuredQuery.startAt=(function(c){return{before:c.inclusive,values:c.position}})(e.startAt)),e.endAt&&(r.structuredQuery.endAt=(function(c){return{before:!c.inclusive,values:c.position}})(e.endAt)),{ft:r,parent:n}}function hAe(t){let e=cAe(t.parent),r=t.structuredQuery,o=r.from?r.from.length:0,n=null;if(o>0){Gt(o===1,65062);let u=r.from[0];u.allDescendants?n=u.collectionId:e=e.child(u.collectionId)}let i=[];r.where&&(i=(function(d){let f=rJ(d);return f instanceof us&&AX(f)?f.getFilters():[f]})(r.where));let a=[];r.orderBy&&(a=(function(d){return d.map((f=>(function(h){return new cf($m(h.field),(function(_){switch(_){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(h.direction))})(f)))})(r.orderBy));let s=null;r.limit&&(s=(function(d){let f;return f=typeof d=="object"?d.value:d,tb(f)?null:f})(r.limit));let l=null;r.startAt&&(l=(function(d){let f=!!d.before,m=d.values||[];return new Km(m,f)})(r.startAt));let c=null;return r.endAt&&(c=(function(d){let f=!d.before,m=d.values||[];return new Km(m,f)})(r.endAt)),UOe(e,n,a,i,s,"F",l,c)}function gAe(t,e){let r=(function(n){switch(n){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return rt(28987,{purpose:n})}})(e.purpose);return r==null?null:{"goog-listen-tags":r}}function rJ(t){return t.unaryFilter!==void 0?(function(r){switch(r.unaryFilter.op){case"IS_NAN":let o=$m(r.unaryFilter.field);return So.create(o,"==",{doubleValue:NaN});case"IS_NULL":let n=$m(r.unaryFilter.field);return So.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=$m(r.unaryFilter.field);return So.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let a=$m(r.unaryFilter.field);return So.create(a,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return rt(61313);default:return rt(60726)}})(t):t.fieldFilter!==void 0?(function(r){return So.create($m(r.fieldFilter.field),(function(n){switch(n){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 rt(58110);default:return rt(50506)}})(r.fieldFilter.op),r.fieldFilter.value)})(t):t.compositeFilter!==void 0?(function(r){return us.create(r.compositeFilter.filters.map((o=>rJ(o))),(function(n){switch(n){case"AND":return"and";case"OR":return"or";default:return rt(1026)}})(r.compositeFilter.op))})(t):rt(30097,{filter:t})}function _Ae(t){return iAe[t]}function xAe(t){return aAe[t]}function bAe(t){return sAe[t]}function Bm(t){return{fieldPath:t.canonicalString()}}function $m(t){return Xi.fromServerFormat(t.fieldPath)}function oJ(t){return t instanceof So?(function(r){if(r.op==="=="){if(TY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NAN"}};if(CY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NULL"}}}else if(r.op==="!="){if(TY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NOT_NAN"}};if(CY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Bm(r.field),op:xAe(r.op),value:r.value}}})(t):t instanceof us?(function(r){let o=r.getFilters().map((n=>oJ(n)));return o.length===1?o[0]:{compositeFilter:{op:bAe(r.op),filters:o}}})(t):rt(54877,{filter:t})}function yAe(t){let e=[];return t.fields.forEach((r=>e.push(r.canonicalString()))),{fieldPaths:e}}function nJ(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}var Hx=class t{constructor(e,r,o,n,i=mt.min(),a=mt.min(),s=Vn.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=r,this.purpose=o,this.sequenceNumber=n,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=s,this.expectedCount=l}withSequenceNumber(e){return new t(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,r){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,r,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var JA=class{constructor(e){this.yt=e}};function vAe(t){let e=hAe({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?CE(e,e.limit,"L"):e}var ME=class{constructor(){}Dt(e,r){this.Ct(e,r),r.vt()}Ct(e,r){if("nullValue"in e)this.Ft(r,5);else if("booleanValue"in e)this.Ft(r,10),r.Mt(e.booleanValue?1:0);else if("integerValue"in e)this.Ft(r,15),r.Mt(Rr(e.integerValue));else if("doubleValue"in e){let o=Rr(e.doubleValue);isNaN(o)?this.Ft(r,13):(this.Ft(r,15),$x(o)?r.Mt(0):r.Mt(o))}else if("timestampValue"in e){let o=e.timestampValue;this.Ft(r,20),typeof o=="string"&&(o=Zl(o)),r.xt(`${o.seconds||""}`),r.Mt(o.nanos||0)}else if("stringValue"in e)this.Ot(e.stringValue,r),this.Nt(r);else if("bytesValue"in e)this.Ft(r,30),r.Bt(ec(e.bytesValue)),this.Nt(r);else if("referenceValue"in e)this.Lt(e.referenceValue,r);else if("geoPointValue"in e){let o=e.geoPointValue;this.Ft(r,45),r.Mt(o.latitude||0),r.Mt(o.longitude||0)}else"mapValue"in e?NX(e)?this.Ft(r,Number.MAX_SAFE_INTEGER):kX(e)?this.kt(e.mapValue,r):(this.qt(e.mapValue,r),this.Nt(r)):"arrayValue"in e?(this.Qt(e.arrayValue,r),this.Nt(r)):rt(19022,{$t:e})}Ot(e,r){this.Ft(r,25),this.Ut(e,r)}Ut(e,r){r.xt(e)}qt(e,r){let o=e.fields||{};this.Ft(r,55);for(let n of Object.keys(o))this.Ot(n,r),this.Ct(o[n],r)}kt(e,r){let o=e.fields||{};this.Ft(r,53);let n=Gm,i=o[n].arrayValue?.values?.length||0;this.Ft(r,15),r.Mt(Rr(i)),this.Ot(n,r),this.Ct(o[n],r)}Qt(e,r){let o=e.values||[];this.Ft(r,50);for(let n of o)this.Ct(n,r)}Lt(e,r){this.Ft(r,37),ot.fromName(e).path.forEach((o=>{this.Ft(r,60),this.Ut(o,r)}))}Ft(e,r){e.Mt(r)}Nt(e){e.Mt(2)}};ME.Kt=new ME;var QA=class{constructor(){this.Cn=new ZA}addToCollectionParentIndex(e,r){return this.Cn.add(r),fe.resolve()}getCollectionParents(e,r){return fe.resolve(this.Cn.getEntries(r))}addFieldIndex(e,r){return fe.resolve()}deleteFieldIndex(e,r){return fe.resolve()}deleteAllFieldIndexes(e){return fe.resolve()}createTargetIndexes(e,r){return fe.resolve()}getDocumentsMatchingTarget(e,r){return fe.resolve(null)}getIndexType(e,r){return fe.resolve(0)}getFieldIndexes(e,r){return fe.resolve([])}getNextCollectionGroupToUpdate(e){return fe.resolve(null)}getMinOffset(e,r){return fe.resolve(lf.min())}getMinOffsetFromCollectionGroup(e,r){return fe.resolve(lf.min())}updateCollectionGroup(e,r,o){return fe.resolve()}updateIndexEntries(e,r){return fe.resolve()}},ZA=class{constructor(){this.index={}}add(e){let r=e.lastSegment(),o=e.popLast(),n=this.index[r]||new Jo(Sr.comparator),i=!n.has(o);return this.index[r]=n.add(o),i}has(e){let r=e.lastSegment(),o=e.popLast(),n=this.index[r];return n&&n.has(o)}getEntries(e){return(this.index[e]||new Jo(Sr.comparator)).toArray()}};var wEt=new Uint8Array(0);var zY={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},iJ=41943040,Na=class t{static withCacheSize(e){return new t(e,t.DEFAULT_COLLECTION_PERCENTILE,t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,r,o){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=r,this.maximumSequenceNumbersToCollect=o}};Na.DEFAULT_COLLECTION_PERCENTILE=10,Na.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Na.DEFAULT=new Na(iJ,Na.DEFAULT_COLLECTION_PERCENTILE,Na.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Na.DISABLED=new Na(-1,0,0);var jx=class t{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new t(0)}static cr(){return new t(-1)}};var UY="LruGarbageCollector",aJ=1048576;function VY([t,e],[r,o]){let n=Bt(t,r);return n===0?Bt(e,o):n}var eD=class{constructor(e){this.Ir=e,this.buffer=new Jo(VY),this.Er=0}dr(){return++this.Er}Ar(e){let r=[e,this.dr()];if(this.buffer.size<this.Ir)this.buffer=this.buffer.add(r);else{let o=this.buffer.last();VY(r,o)<0&&(this.buffer=this.buffer.delete(o).add(r))}}get maxValue(){return this.buffer.last()[0]}},tD=class{constructor(e,r,o){this.garbageCollector=e,this.asyncQueue=r,this.localStore=o,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Vr(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Vr(e){Le(UY,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(r){nh(r)?Le(UY,"Ignoring IndexedDB error during garbage collection: ",r):await oh(r)}await this.Vr(3e5)}))}},rD=class{constructor(e,r){this.mr=e,this.params=r}calculateTargetCount(e,r){return this.mr.gr(e).next((o=>Math.floor(r/100*o)))}nthSequenceNumber(e,r){if(r===0)return fe.resolve(jm.ce);let o=new eD(r);return this.mr.forEachTarget(e,(n=>o.Ar(n.sequenceNumber))).next((()=>this.mr.pr(e,(n=>o.Ar(n))))).next((()=>o.maxValue))}removeTargets(e,r,o){return this.mr.removeTargets(e,r,o)}removeOrphanedDocuments(e,r){return this.mr.removeOrphanedDocuments(e,r)}collect(e,r){return this.params.cacheSizeCollectionThreshold===-1?(Le("LruGarbageCollector","Garbage collection skipped; disabled"),fe.resolve(zY)):this.getCacheSize(e).next((o=>o<this.params.cacheSizeCollectionThreshold?(Le("LruGarbageCollector",`Garbage collection skipped; Cache size ${o} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),zY):this.yr(e,r)))}getCacheSize(e){return this.mr.getCacheSize(e)}yr(e,r){let o,n,i,a,s,l,c,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((d=>(d>this.params.maximumSequenceNumbersToCollect?(Le("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),n=this.params.maximumSequenceNumbersToCollect):n=d,a=Date.now(),this.nthSequenceNumber(e,n)))).next((d=>(o=d,s=Date.now(),this.removeTargets(e,o,r)))).next((d=>(i=d,l=Date.now(),this.removeOrphanedDocuments(e,o)))).next((d=>(c=Date.now(),Lm()<=Pt.DEBUG&&Le("LruGarbageCollector",`LRU Garbage Collection
36
+ }`}};var jA=class{constructor(e,r){this.count=e,this.unchangedNames=r}};var wo,jt;function YX(t){switch(t){case te.OK:return rt(64938);case te.CANCELLED:case te.UNKNOWN:case te.DEADLINE_EXCEEDED:case te.RESOURCE_EXHAUSTED:case te.INTERNAL:case te.UNAVAILABLE:case te.UNAUTHENTICATED:return!1;case te.INVALID_ARGUMENT:case te.NOT_FOUND:case te.ALREADY_EXISTS:case te.PERMISSION_DENIED:case te.FAILED_PRECONDITION:case te.ABORTED:case te.OUT_OF_RANGE:case te.UNIMPLEMENTED:case te.DATA_LOSS:return!0;default:return rt(15467,{code:t})}}function XX(t){if(t===void 0)return Ql("GRPC error has no .code"),te.UNKNOWN;switch(t){case wo.OK:return te.OK;case wo.CANCELLED:return te.CANCELLED;case wo.UNKNOWN:return te.UNKNOWN;case wo.DEADLINE_EXCEEDED:return te.DEADLINE_EXCEEDED;case wo.RESOURCE_EXHAUSTED:return te.RESOURCE_EXHAUSTED;case wo.INTERNAL:return te.INTERNAL;case wo.UNAVAILABLE:return te.UNAVAILABLE;case wo.UNAUTHENTICATED:return te.UNAUTHENTICATED;case wo.INVALID_ARGUMENT:return te.INVALID_ARGUMENT;case wo.NOT_FOUND:return te.NOT_FOUND;case wo.ALREADY_EXISTS:return te.ALREADY_EXISTS;case wo.PERMISSION_DENIED:return te.PERMISSION_DENIED;case wo.FAILED_PRECONDITION:return te.FAILED_PRECONDITION;case wo.ABORTED:return te.ABORTED;case wo.OUT_OF_RANGE:return te.OUT_OF_RANGE;case wo.UNIMPLEMENTED:return te.UNIMPLEMENTED;case wo.DATA_LOSS:return te.DATA_LOSS;default:return rt(39323,{code:t})}}(jt=wo||(wo={}))[jt.OK=0]="OK",jt[jt.CANCELLED=1]="CANCELLED",jt[jt.UNKNOWN=2]="UNKNOWN",jt[jt.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",jt[jt.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",jt[jt.NOT_FOUND=5]="NOT_FOUND",jt[jt.ALREADY_EXISTS=6]="ALREADY_EXISTS",jt[jt.PERMISSION_DENIED=7]="PERMISSION_DENIED",jt[jt.UNAUTHENTICATED=16]="UNAUTHENTICATED",jt[jt.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",jt[jt.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",jt[jt.ABORTED=10]="ABORTED",jt[jt.OUT_OF_RANGE=11]="OUT_OF_RANGE",jt[jt.UNIMPLEMENTED=12]="UNIMPLEMENTED",jt[jt.INTERNAL=13]="INTERNAL",jt[jt.UNAVAILABLE=14]="UNAVAILABLE",jt[jt.DATA_LOSS=15]="DATA_LOSS";var rAe=null;function oAe(){return new TextEncoder}var nAe=new Yl([4294967295,4294967295],0);function LY(t){let e=oAe().encode(t),r=new aA;return r.update(e),new Uint8Array(r.digest())}function FY(t){let e=new DataView(t.buffer),r=e.getUint32(0,!0),o=e.getUint32(4,!0),n=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new Yl([r,o],0),new Yl([n,i],0)]}var GA=class t{constructor(e,r,o){if(this.bitmap=e,this.padding=r,this.hashCount=o,r<0||r>=8)throw new nf(`Invalid padding: ${r}`);if(o<0)throw new nf(`Invalid hash count: ${o}`);if(e.length>0&&this.hashCount===0)throw new nf(`Invalid hash count: ${o}`);if(e.length===0&&r!==0)throw new nf(`Invalid padding when bitmap length is 0: ${r}`);this.ge=8*e.length-r,this.pe=Yl.fromNumber(this.ge)}ye(e,r,o){let n=e.add(r.multiply(Yl.fromNumber(o)));return n.compare(nAe)===1&&(n=new Yl([n.getBits(0),n.getBits(1)],0)),n.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let r=LY(e),[o,n]=FY(r);for(let i=0;i<this.hashCount;i++){let a=this.ye(o,n,i);if(!this.we(a))return!1}return!0}static create(e,r,o){let n=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new t(i,n,r);return o.forEach((s=>a.insert(s))),a}insert(e){if(this.ge===0)return;let r=LY(e),[o,n]=FY(r);for(let i=0;i<this.hashCount;i++){let a=this.ye(o,n,i);this.Se(a)}}Se(e){let r=Math.floor(e/8),o=e%8;this.bitmap[r]|=1<<o}},nf=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var N0=class t{constructor(e,r,o,n,i){this.snapshotVersion=e,this.targetChanges=r,this.targetMismatches=o,this.documentUpdates=n,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,r,o){let n=new Map;return n.set(e,Vx.createSynthesizedTargetChangeForCurrentChange(e,r,o)),new t(mt.min(),n,new Zr(Bt),rc(),$t())}},Vx=class t{constructor(e,r,o,n,i){this.resumeToken=e,this.current=r,this.addedDocuments=o,this.modifiedDocuments=n,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,r,o){return new t(o,r,$t(),$t(),$t())}};var Um=class{constructor(e,r,o,n){this.be=e,this.removedTargetIds=r,this.key=o,this.De=n}},P0=class{constructor(e,r){this.targetId=e,this.Ce=r}},O0=class{constructor(e,r,o=Vn.EMPTY_BYTE_STRING,n=null){this.state=e,this.targetIds=r,this.resumeToken=o,this.cause=n}},A0=class{constructor(){this.ve=0,this.Fe=BY(),this.Me=Vn.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=$t(),r=$t(),o=$t();return this.Fe.forEach(((n,i)=>{switch(i){case 0:e=e.add(n);break;case 2:r=r.add(n);break;case 1:o=o.add(n);break;default:rt(38017,{changeType:i})}})),new Vx(this.Me,this.xe,e,r,o)}qe(){this.Oe=!1,this.Fe=BY()}Qe(e,r){this.Oe=!0,this.Fe=this.Fe.insert(e,r)}$e(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}Ue(){this.ve+=1}Ke(){this.ve-=1,Gt(this.ve>=0,3241,{ve:this.ve})}We(){this.Oe=!0,this.xe=!0}},WA=class{constructor(e){this.Ge=e,this.ze=new Map,this.je=rc(),this.Je=m0(),this.He=m0(),this.Ye=new Zr(Bt)}Ze(e){for(let r of e.be)e.De&&e.De.isFoundDocument()?this.Xe(r,e.De):this.et(r,e.key,e.De);for(let r of e.removedTargetIds)this.et(r,e.key,e.De)}tt(e){this.forEachTarget(e,(r=>{let o=this.nt(r);switch(e.state){case 0:this.rt(r)&&o.Le(e.resumeToken);break;case 1:o.Ke(),o.Ne||o.qe(),o.Le(e.resumeToken);break;case 2:o.Ke(),o.Ne||this.removeTarget(r);break;case 3:this.rt(r)&&(o.We(),o.Le(e.resumeToken));break;case 4:this.rt(r)&&(this.it(r),o.Le(e.resumeToken));break;default:rt(56790,{state:e.state})}}))}forEachTarget(e,r){e.targetIds.length>0?e.targetIds.forEach(r):this.ze.forEach(((o,n)=>{this.rt(n)&&r(n)}))}st(e){let r=e.targetId,o=e.Ce.count,n=this.ot(r);if(n){let i=n.target;if(BA(i))if(o===0){let a=new ot(i.path);this.et(r,a,Qi.newNoDocument(a,mt.min()))}else Gt(o===1,20013,{expectedCount:o});else{let a=this._t(r);if(a!==o){let s=this.ut(e),l=s?this.ct(s,e,a):1;if(l!==0){this.it(r);let c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ye=this.Ye.insert(r,c)}rAe?.lt((function(u,d,f,m,h){let g={localCacheCount:u,existenceFilterCount:d.count,databaseId:f.database,projectId:f.projectId},_=d.unchangedNames;return _&&(g.bloomFilter={applied:h===0,hashCount:_?.hashCount??0,bitmapLength:_?.bits?.bitmap?.length??0,padding:_?.bits?.padding??0,mightContain:b=>m?.mightContain(b)??!1}),g})(a,e.Ce,this.Ge.ht(),s,l))}}}}ut(e){let r=e.Ce.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:o="",padding:n=0},hashCount:i=0}=r,a,s;try{a=ec(o).toUint8Array()}catch(l){if(l instanceof I0)return Lx("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{s=new GA(a,n,i)}catch(l){return Lx(l instanceof nf?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return s.ge===0?null:s}ct(e,r,o){return r.Ce.count===o-this.Pt(e,r.targetId)?0:2}Pt(e,r){let o=this.Ge.getRemoteKeysForTarget(r),n=0;return o.forEach((i=>{let a=this.Ge.ht(),s=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(s)||(this.et(r,i,null),n++)})),n}Tt(e){let r=new Map;this.ze.forEach(((i,a)=>{let s=this.ot(a);if(s){if(i.current&&BA(s.target)){let l=new ot(s.target.path);this.It(l).has(a)||this.Et(a,l)||this.et(a,l,Qi.newNoDocument(l,e))}i.Be&&(r.set(a,i.ke()),i.qe())}}));let o=$t();this.He.forEach(((i,a)=>{let s=!0;a.forEachWhile((l=>{let c=this.ot(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(s=!1,!1)})),s&&(o=o.add(i))})),this.je.forEach(((i,a)=>a.setReadTime(e)));let n=new N0(e,r,this.Ye,this.je,o);return this.je=rc(),this.Je=m0(),this.He=m0(),this.Ye=new Zr(Bt),n}Xe(e,r){if(!this.rt(e))return;let o=this.Et(e,r.key)?2:0;this.nt(e).Qe(r.key,o),this.je=this.je.insert(r.key,r),this.Je=this.Je.insert(r.key,this.It(r.key).add(e)),this.He=this.He.insert(r.key,this.dt(r.key).add(e))}et(e,r,o){if(!this.rt(e))return;let n=this.nt(e);this.Et(e,r)?n.Qe(r,1):n.$e(r),this.He=this.He.insert(r,this.dt(r).delete(e)),this.He=this.He.insert(r,this.dt(r).add(e)),o&&(this.je=this.je.insert(r,o))}removeTarget(e){this.ze.delete(e)}_t(e){let r=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}Ue(e){this.nt(e).Ue()}nt(e){let r=this.ze.get(e);return r||(r=new A0,this.ze.set(e,r)),r}dt(e){let r=this.He.get(e);return r||(r=new Jo(Bt),this.He=this.He.insert(e,r)),r}It(e){let r=this.Je.get(e);return r||(r=new Jo(Bt),this.Je=this.Je.insert(e,r)),r}rt(e){let r=this.ot(e)!==null;return r||Le("WatchChangeAggregator","Detected inactive target",e),r}ot(e){let r=this.ze.get(e);return r&&r.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new A0),this.Ge.getRemoteKeysForTarget(e).forEach((r=>{this.et(e,r,null)}))}Et(e,r){return this.Ge.getRemoteKeysForTarget(e).has(r)}};function m0(){return new Zr(ot.comparator)}function BY(){return new Zr(ot.comparator)}var iAe={asc:"ASCENDING",desc:"DESCENDING"},aAe={"<":"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"},sAe={and:"AND",or:"OR"},qA=class{constructor(e,r){this.databaseId=e,this.useProto3Json=r}};function KA(t,e){return t.useProto3Json||tb(e)?e:{value:e}}function D0(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function JX(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function lAe(t,e){return D0(t,e.toTimestamp())}function Ji(t){return Gt(!!t,49232),mt.fromTimestamp((function(r){let o=Zl(r);return new Tt(o.seconds,o.nanos)})(t))}function pR(t,e){return YA(t,e).canonicalString()}function YA(t,e){let r=(function(n){return new Sr(["projects",n.projectId,"databases",n.database])})(t).child("documents");return e===void 0?r:r.child(e)}function QX(t){let e=Sr.fromString(t);return Gt(nJ(e),10190,{key:e.toString()}),e}function R0(t,e){return pR(t.databaseId,e.path)}function Mx(t,e){let r=QX(e);if(r.get(1)!==t.databaseId.projectId)throw new xe(te.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+t.databaseId.projectId);if(r.get(3)!==t.databaseId.database)throw new xe(te.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+t.databaseId.database);return new ot(eJ(r))}function ZX(t,e){return pR(t.databaseId,e)}function cAe(t){let e=QX(t);return e.length===4?Sr.emptyPath():eJ(e)}function XA(t){return new Sr(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function eJ(t){return Gt(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function $Y(t,e,r){return{name:R0(t,e),fields:r.value.mapValue.fields}}function uAe(t,e){return"found"in e?(function(o,n){Gt(!!n.found,43571),n.found.name,n.found.updateTime;let i=Mx(o,n.found.name),a=Ji(n.found.updateTime),s=n.found.createTime?Ji(n.found.createTime):mt.min(),l=new wi({mapValue:{fields:n.found.fields}});return Qi.newFoundDocument(i,a,s,l)})(t,e):"missing"in e?(function(o,n){Gt(!!n.missing,3894),Gt(!!n.readTime,22933);let i=Mx(o,n.missing),a=Ji(n.readTime);return Qi.newNoDocument(i,a)})(t,e):rt(7234,{result:e})}function dAe(t,e){let r;if("targetChange"in e){e.targetChange;let o=(function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:rt(39313,{state:c})})(e.targetChange.targetChangeType||"NO_CHANGE"),n=e.targetChange.targetIds||[],i=(function(c,u){return c.useProto3Json?(Gt(u===void 0||typeof u=="string",58123),Vn.fromBase64String(u||"")):(Gt(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),Vn.fromUint8Array(u||new Uint8Array))})(t,e.targetChange.resumeToken),a=e.targetChange.cause,s=a&&(function(c){let u=c.code===void 0?te.UNKNOWN:XX(c.code);return new xe(u,c.message||"")})(a);r=new O0(o,n,i,s||null)}else if("documentChange"in e){e.documentChange;let o=e.documentChange;o.document,o.document.name,o.document.updateTime;let n=Mx(t,o.document.name),i=Ji(o.document.updateTime),a=o.document.createTime?Ji(o.document.createTime):mt.min(),s=new wi({mapValue:{fields:o.document.fields}}),l=Qi.newFoundDocument(n,i,a,s),c=o.targetIds||[],u=o.removedTargetIds||[];r=new Um(c,u,l.key,l)}else if("documentDelete"in e){e.documentDelete;let o=e.documentDelete;o.document;let n=Mx(t,o.document),i=o.readTime?Ji(o.readTime):mt.min(),a=Qi.newNoDocument(n,i),s=o.removedTargetIds||[];r=new Um([],s,a.key,a)}else if("documentRemove"in e){e.documentRemove;let o=e.documentRemove;o.document;let n=Mx(t,o.document),i=o.removedTargetIds||[];r=new Um([],i,n,null)}else{if(!("filter"in e))return rt(11601,{Rt:e});{e.filter;let o=e.filter;o.targetId;let{count:n=0,unchangedNames:i}=o,a=new jA(n,i),s=o.targetId;r=new P0(s,a)}}return r}function tJ(t,e){let r;if(e instanceof ff)r={update:$Y(t,e.key,e.value)};else if(e instanceof pf)r={delete:R0(t,e.key)};else if(e instanceof tl)r={update:$Y(t,e.key,e.data),updateMask:yAe(e.fieldMask)};else{if(!(e instanceof k0))return rt(16599,{Vt:e.type});r={verify:R0(t,e.key)}}return e.fieldTransforms.length>0&&(r.updateTransforms=e.fieldTransforms.map((o=>(function(i,a){let s=a.transform;if(s instanceof uf)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(s instanceof mu)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:s.elements}};if(s instanceof df)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:s.elements}};if(s instanceof Xm)return{fieldPath:a.field.canonicalString(),increment:s.Ae};throw rt(20930,{transform:a.transform})})(0,o)))),e.precondition.isNone||(r.currentDocument=(function(n,i){return i.updateTime!==void 0?{updateTime:lAe(n,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:rt(27497)})(t,e.precondition)),r}function fAe(t,e){return t&&t.length>0?(Gt(e!==void 0,14353),t.map((r=>(function(n,i){let a=n.updateTime?Ji(n.updateTime):Ji(i);return a.isEqual(mt.min())&&(a=Ji(i)),new zA(a,n.transformResults||[])})(r,e)))):[]}function pAe(t,e){return{documents:[ZX(t,e.path)]}}function mAe(t,e){let r={structuredQuery:{}},o=e.path,n;e.collectionGroup!==null?(n=o,r.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n=o.popLast(),r.structuredQuery.from=[{collectionId:o.lastSegment()}]),r.parent=ZX(t,n);let i=(function(c){if(c.length!==0)return oJ(us.create(c,"and"))})(e.filters);i&&(r.structuredQuery.where=i);let a=(function(c){if(c.length!==0)return c.map((u=>(function(f){return{field:Bm(f.field),direction:_Ae(f.dir)}})(u)))})(e.orderBy);a&&(r.structuredQuery.orderBy=a);let s=KA(t,e.limit);return s!==null&&(r.structuredQuery.limit=s),e.startAt&&(r.structuredQuery.startAt=(function(c){return{before:c.inclusive,values:c.position}})(e.startAt)),e.endAt&&(r.structuredQuery.endAt=(function(c){return{before:!c.inclusive,values:c.position}})(e.endAt)),{ft:r,parent:n}}function hAe(t){let e=cAe(t.parent),r=t.structuredQuery,o=r.from?r.from.length:0,n=null;if(o>0){Gt(o===1,65062);let u=r.from[0];u.allDescendants?n=u.collectionId:e=e.child(u.collectionId)}let i=[];r.where&&(i=(function(d){let f=rJ(d);return f instanceof us&&AX(f)?f.getFilters():[f]})(r.where));let a=[];r.orderBy&&(a=(function(d){return d.map((f=>(function(h){return new cf($m(h.field),(function(_){switch(_){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(h.direction))})(f)))})(r.orderBy));let s=null;r.limit&&(s=(function(d){let f;return f=typeof d=="object"?d.value:d,tb(f)?null:f})(r.limit));let l=null;r.startAt&&(l=(function(d){let f=!!d.before,m=d.values||[];return new Km(m,f)})(r.startAt));let c=null;return r.endAt&&(c=(function(d){let f=!d.before,m=d.values||[];return new Km(m,f)})(r.endAt)),UOe(e,n,a,i,s,"F",l,c)}function gAe(t,e){let r=(function(n){switch(n){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return rt(28987,{purpose:n})}})(e.purpose);return r==null?null:{"goog-listen-tags":r}}function rJ(t){return t.unaryFilter!==void 0?(function(r){switch(r.unaryFilter.op){case"IS_NAN":let o=$m(r.unaryFilter.field);return So.create(o,"==",{doubleValue:NaN});case"IS_NULL":let n=$m(r.unaryFilter.field);return So.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=$m(r.unaryFilter.field);return So.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let a=$m(r.unaryFilter.field);return So.create(a,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return rt(61313);default:return rt(60726)}})(t):t.fieldFilter!==void 0?(function(r){return So.create($m(r.fieldFilter.field),(function(n){switch(n){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 rt(58110);default:return rt(50506)}})(r.fieldFilter.op),r.fieldFilter.value)})(t):t.compositeFilter!==void 0?(function(r){return us.create(r.compositeFilter.filters.map((o=>rJ(o))),(function(n){switch(n){case"AND":return"and";case"OR":return"or";default:return rt(1026)}})(r.compositeFilter.op))})(t):rt(30097,{filter:t})}function _Ae(t){return iAe[t]}function xAe(t){return aAe[t]}function bAe(t){return sAe[t]}function Bm(t){return{fieldPath:t.canonicalString()}}function $m(t){return Xi.fromServerFormat(t.fieldPath)}function oJ(t){return t instanceof So?(function(r){if(r.op==="=="){if(TY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NAN"}};if(CY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NULL"}}}else if(r.op==="!="){if(TY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NOT_NAN"}};if(CY(r.value))return{unaryFilter:{field:Bm(r.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Bm(r.field),op:xAe(r.op),value:r.value}}})(t):t instanceof us?(function(r){let o=r.getFilters().map((n=>oJ(n)));return o.length===1?o[0]:{compositeFilter:{op:bAe(r.op),filters:o}}})(t):rt(54877,{filter:t})}function yAe(t){let e=[];return t.fields.forEach((r=>e.push(r.canonicalString()))),{fieldPaths:e}}function nJ(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}var Hx=class t{constructor(e,r,o,n,i=mt.min(),a=mt.min(),s=Vn.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=r,this.purpose=o,this.sequenceNumber=n,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=s,this.expectedCount=l}withSequenceNumber(e){return new t(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,r){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,r,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var JA=class{constructor(e){this.yt=e}};function vAe(t){let e=hAe({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?C0(e,e.limit,"L"):e}var M0=class{constructor(){}Dt(e,r){this.Ct(e,r),r.vt()}Ct(e,r){if("nullValue"in e)this.Ft(r,5);else if("booleanValue"in e)this.Ft(r,10),r.Mt(e.booleanValue?1:0);else if("integerValue"in e)this.Ft(r,15),r.Mt(Rr(e.integerValue));else if("doubleValue"in e){let o=Rr(e.doubleValue);isNaN(o)?this.Ft(r,13):(this.Ft(r,15),$x(o)?r.Mt(0):r.Mt(o))}else if("timestampValue"in e){let o=e.timestampValue;this.Ft(r,20),typeof o=="string"&&(o=Zl(o)),r.xt(`${o.seconds||""}`),r.Mt(o.nanos||0)}else if("stringValue"in e)this.Ot(e.stringValue,r),this.Nt(r);else if("bytesValue"in e)this.Ft(r,30),r.Bt(ec(e.bytesValue)),this.Nt(r);else if("referenceValue"in e)this.Lt(e.referenceValue,r);else if("geoPointValue"in e){let o=e.geoPointValue;this.Ft(r,45),r.Mt(o.latitude||0),r.Mt(o.longitude||0)}else"mapValue"in e?NX(e)?this.Ft(r,Number.MAX_SAFE_INTEGER):kX(e)?this.kt(e.mapValue,r):(this.qt(e.mapValue,r),this.Nt(r)):"arrayValue"in e?(this.Qt(e.arrayValue,r),this.Nt(r)):rt(19022,{$t:e})}Ot(e,r){this.Ft(r,25),this.Ut(e,r)}Ut(e,r){r.xt(e)}qt(e,r){let o=e.fields||{};this.Ft(r,55);for(let n of Object.keys(o))this.Ot(n,r),this.Ct(o[n],r)}kt(e,r){let o=e.fields||{};this.Ft(r,53);let n=Gm,i=o[n].arrayValue?.values?.length||0;this.Ft(r,15),r.Mt(Rr(i)),this.Ot(n,r),this.Ct(o[n],r)}Qt(e,r){let o=e.values||[];this.Ft(r,50);for(let n of o)this.Ct(n,r)}Lt(e,r){this.Ft(r,37),ot.fromName(e).path.forEach((o=>{this.Ft(r,60),this.Ut(o,r)}))}Ft(e,r){e.Mt(r)}Nt(e){e.Mt(2)}};M0.Kt=new M0;var QA=class{constructor(){this.Cn=new ZA}addToCollectionParentIndex(e,r){return this.Cn.add(r),fe.resolve()}getCollectionParents(e,r){return fe.resolve(this.Cn.getEntries(r))}addFieldIndex(e,r){return fe.resolve()}deleteFieldIndex(e,r){return fe.resolve()}deleteAllFieldIndexes(e){return fe.resolve()}createTargetIndexes(e,r){return fe.resolve()}getDocumentsMatchingTarget(e,r){return fe.resolve(null)}getIndexType(e,r){return fe.resolve(0)}getFieldIndexes(e,r){return fe.resolve([])}getNextCollectionGroupToUpdate(e){return fe.resolve(null)}getMinOffset(e,r){return fe.resolve(lf.min())}getMinOffsetFromCollectionGroup(e,r){return fe.resolve(lf.min())}updateCollectionGroup(e,r,o){return fe.resolve()}updateIndexEntries(e,r){return fe.resolve()}},ZA=class{constructor(){this.index={}}add(e){let r=e.lastSegment(),o=e.popLast(),n=this.index[r]||new Jo(Sr.comparator),i=!n.has(o);return this.index[r]=n.add(o),i}has(e){let r=e.lastSegment(),o=e.popLast(),n=this.index[r];return n&&n.has(o)}getEntries(e){return(this.index[e]||new Jo(Sr.comparator)).toArray()}};var w0t=new Uint8Array(0);var zY={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},iJ=41943040,Na=class t{static withCacheSize(e){return new t(e,t.DEFAULT_COLLECTION_PERCENTILE,t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,r,o){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=r,this.maximumSequenceNumbersToCollect=o}};Na.DEFAULT_COLLECTION_PERCENTILE=10,Na.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Na.DEFAULT=new Na(iJ,Na.DEFAULT_COLLECTION_PERCENTILE,Na.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Na.DISABLED=new Na(-1,0,0);var jx=class t{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new t(0)}static cr(){return new t(-1)}};var UY="LruGarbageCollector",aJ=1048576;function VY([t,e],[r,o]){let n=Bt(t,r);return n===0?Bt(e,o):n}var eD=class{constructor(e){this.Ir=e,this.buffer=new Jo(VY),this.Er=0}dr(){return++this.Er}Ar(e){let r=[e,this.dr()];if(this.buffer.size<this.Ir)this.buffer=this.buffer.add(r);else{let o=this.buffer.last();VY(r,o)<0&&(this.buffer=this.buffer.delete(o).add(r))}}get maxValue(){return this.buffer.last()[0]}},tD=class{constructor(e,r,o){this.garbageCollector=e,this.asyncQueue=r,this.localStore=o,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Vr(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Vr(e){Le(UY,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(r){nh(r)?Le(UY,"Ignoring IndexedDB error during garbage collection: ",r):await oh(r)}await this.Vr(3e5)}))}},rD=class{constructor(e,r){this.mr=e,this.params=r}calculateTargetCount(e,r){return this.mr.gr(e).next((o=>Math.floor(r/100*o)))}nthSequenceNumber(e,r){if(r===0)return fe.resolve(jm.ce);let o=new eD(r);return this.mr.forEachTarget(e,(n=>o.Ar(n.sequenceNumber))).next((()=>this.mr.pr(e,(n=>o.Ar(n))))).next((()=>o.maxValue))}removeTargets(e,r,o){return this.mr.removeTargets(e,r,o)}removeOrphanedDocuments(e,r){return this.mr.removeOrphanedDocuments(e,r)}collect(e,r){return this.params.cacheSizeCollectionThreshold===-1?(Le("LruGarbageCollector","Garbage collection skipped; disabled"),fe.resolve(zY)):this.getCacheSize(e).next((o=>o<this.params.cacheSizeCollectionThreshold?(Le("LruGarbageCollector",`Garbage collection skipped; Cache size ${o} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),zY):this.yr(e,r)))}getCacheSize(e){return this.mr.getCacheSize(e)}yr(e,r){let o,n,i,a,s,l,c,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((d=>(d>this.params.maximumSequenceNumbersToCollect?(Le("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),n=this.params.maximumSequenceNumbersToCollect):n=d,a=Date.now(),this.nthSequenceNumber(e,n)))).next((d=>(o=d,s=Date.now(),this.removeTargets(e,o,r)))).next((d=>(i=d,l=Date.now(),this.removeOrphanedDocuments(e,o)))).next((d=>(c=Date.now(),Lm()<=Pt.DEBUG&&Le("LruGarbageCollector",`LRU Garbage Collection
37
37
  Counted targets in ${a-u}ms
38
38
  Determined least recently used ${n} in `+(s-a)+`ms
39
39
  Removed ${i} targets in `+(l-s)+`ms
40
40
  Removed ${d} documents in `+(c-l)+`ms
41
- Total Duration: ${c-u}ms`),fe.resolve({didRun:!0,sequenceNumbersCollected:n,targetsRemoved:i,documentsRemoved:d}))))}};function IAe(t,e){return new rD(t,e)}var oD=class{constructor(){this.changes=new tc((e=>e.toString()),((e,r)=>e.isEqual(r))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,r){this.assertNotApplied(),this.changes.set(e,Qi.newInvalidDocument(e).setReadTime(r))}getEntry(e,r){this.assertNotApplied();let o=this.changes.get(r);return o!==void 0?fe.resolve(o):this.getFromCache(e,r)}getEntries(e,r){return this.getAllFromCache(e,r)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};var nD=class{constructor(e,r){this.overlayedDocument=e,this.mutatedFields=r}};var iD=class{constructor(e,r,o,n){this.remoteDocumentCache=e,this.mutationQueue=r,this.documentOverlayCache=o,this.indexManager=n}getDocument(e,r){let o=null;return this.documentOverlayCache.getOverlay(e,r).next((n=>(o=n,this.remoteDocumentCache.getEntry(e,r)))).next((n=>(o!==null&&Rx(o.mutation,n,Pa.empty(),Tt.now()),n)))}getDocuments(e,r){return this.remoteDocumentCache.getEntries(e,r).next((o=>this.getLocalViewOfDocuments(e,o,$t()).next((()=>o))))}getLocalViewOfDocuments(e,r,o=$t()){let n=of();return this.populateOverlays(e,n,r).next((()=>this.computeViews(e,r,n,o).next((i=>{let a=Px();return i.forEach(((s,l)=>{a=a.insert(s,l.overlayedDocument)})),a}))))}getOverlayedDocuments(e,r){let o=of();return this.populateOverlays(e,o,r).next((()=>this.computeViews(e,r,o,$t())))}populateOverlays(e,r,o){let n=[];return o.forEach((i=>{r.has(i)||n.push(i)})),this.documentOverlayCache.getOverlays(e,n).next((i=>{i.forEach(((a,s)=>{r.set(a,s)}))}))}computeViews(e,r,o,n){let i=rc(),a=Dx(),s=(function(){return Dx()})();return r.forEach(((l,c)=>{let u=o.get(c.key);n.has(c.key)&&(u===void 0||u.mutation instanceof tl)?i=i.insert(c.key,c):u!==void 0?(a.set(c.key,u.mutation.getFieldMask()),Rx(u.mutation,c,u.mutation.getFieldMask(),Tt.now())):a.set(c.key,Pa.empty())})),this.recalculateAndSaveOverlays(e,i).next((l=>(l.forEach(((c,u)=>a.set(c,u))),r.forEach(((c,u)=>s.set(c,new nD(u,a.get(c)??null)))),s)))}recalculateAndSaveOverlays(e,r){let o=Dx(),n=new Zr(((a,s)=>a-s)),i=$t();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,r).next((a=>{for(let s of a)s.keys().forEach((l=>{let c=r.get(l);if(c===null)return;let u=o.get(l)||Pa.empty();u=s.applyToLocalView(c,u),o.set(l,u);let d=(n.get(s.batchId)||$t()).add(l);n=n.insert(s.batchId,d)}))})).next((()=>{let a=[],s=n.getReverseIterator();for(;s.hasNext();){let l=s.getNext(),c=l.key,u=l.value,d=UX();u.forEach((f=>{if(!i.has(f)){let m=qX(r.get(f),o.get(f));m!==null&&d.set(f,m),i=i.add(f)}})),a.push(this.documentOverlayCache.saveOverlays(e,c,d))}return fe.waitFor(a)})).next((()=>o))}recalculateAndSaveOverlaysForDocumentKeys(e,r){return this.remoteDocumentCache.getEntries(e,r).next((o=>this.recalculateAndSaveOverlays(e,o)))}getDocumentsMatchingQuery(e,r,o,n){return(function(a){return ot.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0})(r)?this.getDocumentsMatchingDocumentQuery(e,r.path):LX(r)?this.getDocumentsMatchingCollectionGroupQuery(e,r,o,n):this.getDocumentsMatchingCollectionQuery(e,r,o,n)}getNextDocuments(e,r,o,n){return this.remoteDocumentCache.getAllFromCollectionGroup(e,r,o,n).next((i=>{let a=n-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,r,o.largestBatchId,n-i.size):fe.resolve(of()),s=Bx,l=i;return a.next((c=>fe.forEach(c,((u,d)=>(s<d.largestBatchId&&(s=d.largestBatchId),i.get(u)?fe.resolve():this.remoteDocumentCache.getEntry(e,u).next((f=>{l=l.insert(u,f)}))))).next((()=>this.populateOverlays(e,c,i))).next((()=>this.computeViews(e,l,c,$t()))).next((u=>({batchId:s,changes:zX(u)})))))}))}getDocumentsMatchingDocumentQuery(e,r){return this.getDocument(e,new ot(r)).next((o=>{let n=Px();return o.isFoundDocument()&&(n=n.insert(o.key,o)),n}))}getDocumentsMatchingCollectionGroupQuery(e,r,o,n){let i=r.collectionGroup,a=Px();return this.indexManager.getCollectionParents(e,i).next((s=>fe.forEach(s,(l=>{let c=(function(d,f){return new pu(f,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)})(r,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,c,o,n).next((u=>{u.forEach(((d,f)=>{a=a.insert(d,f)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,r,o,n){let i;return this.documentOverlayCache.getOverlaysForCollection(e,r.path,o.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,r,o,i,n)))).next((a=>{i.forEach(((l,c)=>{let u=c.getKey();a.get(u)===null&&(a=a.insert(u,Qi.newInvalidDocument(u)))}));let s=Px();return a.forEach(((l,c)=>{let u=i.get(l);u!==void 0&&Rx(u.mutation,c,Pa.empty(),Tt.now()),nS(r,c)&&(s=s.insert(l,c))})),s}))}};var aD=class{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,r){return fe.resolve(this.Lr.get(r))}saveBundleMetadata(e,r){return this.Lr.set(r.id,(function(n){return{id:n.id,version:n.version,createTime:Ji(n.createTime)}})(r)),fe.resolve()}getNamedQuery(e,r){return fe.resolve(this.kr.get(r))}saveNamedQuery(e,r){return this.kr.set(r.name,(function(n){return{name:n.name,query:vAe(n.bundledQuery),readTime:Ji(n.readTime)}})(r)),fe.resolve()}};var sD=class{constructor(){this.overlays=new Zr(ot.comparator),this.qr=new Map}getOverlay(e,r){return fe.resolve(this.overlays.get(r))}getOverlays(e,r){let o=of();return fe.forEach(r,(n=>this.getOverlay(e,n).next((i=>{i!==null&&o.set(n,i)})))).next((()=>o))}saveOverlays(e,r,o){return o.forEach(((n,i)=>{this.St(e,r,i)})),fe.resolve()}removeOverlaysForBatchId(e,r,o){let n=this.qr.get(o);return n!==void 0&&(n.forEach((i=>this.overlays=this.overlays.remove(i))),this.qr.delete(o)),fe.resolve()}getOverlaysForCollection(e,r,o){let n=of(),i=r.length+1,a=new ot(r.child("")),s=this.overlays.getIteratorFrom(a);for(;s.hasNext();){let l=s.getNext().value,c=l.getKey();if(!r.isPrefixOf(c.path))break;c.path.length===i&&l.largestBatchId>o&&n.set(l.getKey(),l)}return fe.resolve(n)}getOverlaysForCollectionGroup(e,r,o,n){let i=new Zr(((c,u)=>c-u)),a=this.overlays.getIterator();for(;a.hasNext();){let c=a.getNext().value;if(c.getKey().getCollectionGroup()===r&&c.largestBatchId>o){let u=i.get(c.largestBatchId);u===null&&(u=of(),i=i.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}let s=of(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach(((c,u)=>s.set(c,u))),!(s.size()>=n)););return fe.resolve(s)}St(e,r,o){let n=this.overlays.get(o.key);if(n!==null){let a=this.qr.get(n.largestBatchId).delete(o.key);this.qr.set(n.largestBatchId,a)}this.overlays=this.overlays.insert(o.key,new HA(r,o));let i=this.qr.get(r);i===void 0&&(i=$t(),this.qr.set(r,i)),this.qr.set(r,i.add(o.key))}};var lD=class{constructor(){this.sessionToken=Vn.EMPTY_BYTE_STRING}getSessionToken(e){return fe.resolve(this.sessionToken)}setSessionToken(e,r){return this.sessionToken=r,fe.resolve()}};var Gx=class{constructor(){this.Qr=new Jo(Eo.$r),this.Ur=new Jo(Eo.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,r){let o=new Eo(e,r);this.Qr=this.Qr.add(o),this.Ur=this.Ur.add(o)}Wr(e,r){e.forEach((o=>this.addReference(o,r)))}removeReference(e,r){this.Gr(new Eo(e,r))}zr(e,r){e.forEach((o=>this.removeReference(o,r)))}jr(e){let r=new ot(new Sr([])),o=new Eo(r,e),n=new Eo(r,e+1),i=[];return this.Ur.forEachInRange([o,n],(a=>{this.Gr(a),i.push(a.key)})),i}Jr(){this.Qr.forEach((e=>this.Gr(e)))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){let r=new ot(new Sr([])),o=new Eo(r,e),n=new Eo(r,e+1),i=$t();return this.Ur.forEachInRange([o,n],(a=>{i=i.add(a.key)})),i}containsKey(e){let r=new Eo(e,0),o=this.Qr.firstAfterOrEqual(r);return o!==null&&e.isEqual(o.key)}},Eo=class{constructor(e,r){this.key=e,this.Yr=r}static $r(e,r){return ot.comparator(e.key,r.key)||Bt(e.Yr,r.Yr)}static Kr(e,r){return Bt(e.Yr,r.Yr)||ot.comparator(e.key,r.key)}};var cD=class{constructor(e,r){this.indexManager=e,this.referenceDelegate=r,this.mutationQueue=[],this.tr=1,this.Zr=new Jo(Eo.$r)}checkEmpty(e){return fe.resolve(this.mutationQueue.length===0)}addMutationBatch(e,r,o,n){let i=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new UA(i,r,o,n);this.mutationQueue.push(a);for(let s of n)this.Zr=this.Zr.add(new Eo(s.key,i)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast());return fe.resolve(a)}lookupMutationBatch(e,r){return fe.resolve(this.Xr(r))}getNextMutationBatchAfterBatchId(e,r){let o=r+1,n=this.ei(o),i=n<0?0:n;return fe.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return fe.resolve(this.mutationQueue.length===0?iR:this.tr-1)}getAllMutationBatches(e){return fe.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,r){let o=new Eo(r,0),n=new Eo(r,Number.POSITIVE_INFINITY),i=[];return this.Zr.forEachInRange([o,n],(a=>{let s=this.Xr(a.Yr);i.push(s)})),fe.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,r){let o=new Jo(Bt);return r.forEach((n=>{let i=new Eo(n,0),a=new Eo(n,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([i,a],(s=>{o=o.add(s.Yr)}))})),fe.resolve(this.ti(o))}getAllMutationBatchesAffectingQuery(e,r){let o=r.path,n=o.length+1,i=o;ot.isDocumentKey(i)||(i=i.child(""));let a=new Eo(new ot(i),0),s=new Jo(Bt);return this.Zr.forEachWhile((l=>{let c=l.key.path;return!!o.isPrefixOf(c)&&(c.length===n&&(s=s.add(l.Yr)),!0)}),a),fe.resolve(this.ti(s))}ti(e){let r=[];return e.forEach((o=>{let n=this.Xr(o);n!==null&&r.push(n)})),r}removeMutationBatch(e,r){Gt(this.ni(r.batchId,"removed")===0,55003),this.mutationQueue.shift();let o=this.Zr;return fe.forEach(r.mutations,(n=>{let i=new Eo(n.key,r.batchId);return o=o.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,n.key)})).next((()=>{this.Zr=o}))}ir(e){}containsKey(e,r){let o=new Eo(r,0),n=this.Zr.firstAfterOrEqual(o);return fe.resolve(r.isEqual(n&&n.key))}performConsistencyCheck(e){return this.mutationQueue.length,fe.resolve()}ni(e,r){return this.ei(e)}ei(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Xr(e){let r=this.ei(e);return r<0||r>=this.mutationQueue.length?null:this.mutationQueue[r]}};var uD=class{constructor(e){this.ri=e,this.docs=(function(){return new Zr(ot.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,r){let o=r.key,n=this.docs.get(o),i=n?n.size:0,a=this.ri(r);return this.docs=this.docs.insert(o,{document:r.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,o.path.popLast())}removeEntry(e){let r=this.docs.get(e);r&&(this.docs=this.docs.remove(e),this.size-=r.size)}getEntry(e,r){let o=this.docs.get(r);return fe.resolve(o?o.document.mutableCopy():Qi.newInvalidDocument(r))}getEntries(e,r){let o=rc();return r.forEach((n=>{let i=this.docs.get(n);o=o.insert(n,i?i.document.mutableCopy():Qi.newInvalidDocument(n))})),fe.resolve(o)}getDocumentsMatchingQuery(e,r,o,n){let i=rc(),a=r.path,s=new ot(a.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(s);for(;l.hasNext();){let{key:c,value:{document:u}}=l.getNext();if(!a.isPrefixOf(c.path))break;c.path.length>a.length+1||IOe(vOe(u),o)<=0||(n.has(u.key)||nS(r,u))&&(i=i.insert(u.key,u.mutableCopy()))}return fe.resolve(i)}getAllFromCollectionGroup(e,r,o,n){rt(9500)}ii(e,r){return fe.forEach(this.docs,(o=>r(o)))}newChangeBuffer(e){return new dD(this)}getSize(e){return fe.resolve(this.size)}},dD=class extends oD{constructor(e){super(),this.Nr=e}applyChanges(e){let r=[];return this.changes.forEach(((o,n)=>{n.isValidDocument()?r.push(this.Nr.addEntry(e,n)):this.Nr.removeEntry(o)})),fe.waitFor(r)}getFromCache(e,r){return this.Nr.getEntry(e,r)}getAllFromCache(e,r){return this.Nr.getEntries(e,r)}};var fD=class{constructor(e){this.persistence=e,this.si=new tc((r=>uR(r)),dR),this.lastRemoteSnapshotVersion=mt.min(),this.highestTargetId=0,this.oi=0,this._i=new Gx,this.targetCount=0,this.ai=jx.ur()}forEachTarget(e,r){return this.si.forEach(((o,n)=>r(n))),fe.resolve()}getLastRemoteSnapshotVersion(e){return fe.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return fe.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),fe.resolve(this.highestTargetId)}setTargetsMetadata(e,r,o){return o&&(this.lastRemoteSnapshotVersion=o),r>this.oi&&(this.oi=r),fe.resolve()}Pr(e){this.si.set(e.target,e);let r=e.targetId;r>this.highestTargetId&&(this.ai=new jx(r),this.highestTargetId=r),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,r){return this.Pr(r),this.targetCount+=1,fe.resolve()}updateTargetData(e,r){return this.Pr(r),fe.resolve()}removeTargetData(e,r){return this.si.delete(r.target),this._i.jr(r.targetId),this.targetCount-=1,fe.resolve()}removeTargets(e,r,o){let n=0,i=[];return this.si.forEach(((a,s)=>{s.sequenceNumber<=r&&o.get(s.targetId)===null&&(this.si.delete(a),i.push(this.removeMatchingKeysForTargetId(e,s.targetId)),n++)})),fe.waitFor(i).next((()=>n))}getTargetCount(e){return fe.resolve(this.targetCount)}getTargetData(e,r){let o=this.si.get(r)||null;return fe.resolve(o)}addMatchingKeys(e,r,o){return this._i.Wr(r,o),fe.resolve()}removeMatchingKeys(e,r,o){this._i.zr(r,o);let n=this.persistence.referenceDelegate,i=[];return n&&r.forEach((a=>{i.push(n.markPotentiallyOrphaned(e,a))})),fe.waitFor(i)}removeMatchingKeysForTargetId(e,r){return this._i.jr(r),fe.resolve()}getMatchingKeysForTargetId(e,r){let o=this._i.Hr(r);return fe.resolve(o)}containsKey(e,r){return fe.resolve(this._i.containsKey(r))}};var LE=class{constructor(e,r){this.ui={},this.overlays={},this.ci=new jm(0),this.li=!1,this.li=!0,this.hi=new lD,this.referenceDelegate=e(this),this.Pi=new fD(this),this.indexManager=new QA,this.remoteDocumentCache=(function(n){return new uD(n)})((o=>this.referenceDelegate.Ti(o))),this.serializer=new JA(r),this.Ii=new aD(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let r=this.overlays[e.toKey()];return r||(r=new sD,this.overlays[e.toKey()]=r),r}getMutationQueue(e,r){let o=this.ui[e.toKey()];return o||(o=new cD(r,this.referenceDelegate),this.ui[e.toKey()]=o),o}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,r,o){Le("MemoryPersistence","Starting transaction:",e);let n=new pD(this.ci.next());return this.referenceDelegate.Ei(),o(n).next((i=>this.referenceDelegate.di(n).next((()=>i)))).toPromise().then((i=>(n.raiseOnCommittedEvent(),i)))}Ai(e,r){return fe.or(Object.values(this.ui).map((o=>()=>o.containsKey(e,r))))}},pD=class extends SA{constructor(e){super(),this.currentSequenceNumber=e}},mD=class t{constructor(e){this.persistence=e,this.Ri=new Gx,this.Vi=null}static mi(e){return new t(e)}get fi(){if(this.Vi)return this.Vi;throw rt(60996)}addReference(e,r,o){return this.Ri.addReference(o,r),this.fi.delete(o.toString()),fe.resolve()}removeReference(e,r,o){return this.Ri.removeReference(o,r),this.fi.add(o.toString()),fe.resolve()}markPotentiallyOrphaned(e,r){return this.fi.add(r.toString()),fe.resolve()}removeTarget(e,r){this.Ri.jr(r.targetId).forEach((n=>this.fi.add(n.toString())));let o=this.persistence.getTargetCache();return o.getMatchingKeysForTargetId(e,r.targetId).next((n=>{n.forEach((i=>this.fi.add(i.toString())))})).next((()=>o.removeTargetData(e,r)))}Ei(){this.Vi=new Set}di(e){let r=this.persistence.getRemoteDocumentCache().newChangeBuffer();return fe.forEach(this.fi,(o=>{let n=ot.fromPath(o);return this.gi(e,n).next((i=>{i||r.removeEntry(n,mt.min())}))})).next((()=>(this.Vi=null,r.apply(e))))}updateLimboDocument(e,r){return this.gi(e,r).next((o=>{o?this.fi.delete(r.toString()):this.fi.add(r.toString())}))}Ti(e){return 0}gi(e,r){return fe.or([()=>fe.resolve(this.Ri.containsKey(r)),()=>this.persistence.getTargetCache().containsKey(e,r),()=>this.persistence.Ai(e,r)])}},FE=class t{constructor(e,r){this.persistence=e,this.pi=new tc((o=>COe(o.path)),((o,n)=>o.isEqual(n))),this.garbageCollector=IAe(this,r)}static mi(e,r){return new t(e,r)}Ei(){}di(e){return fe.resolve()}forEachTarget(e,r){return this.persistence.getTargetCache().forEachTarget(e,r)}gr(e){let r=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next((o=>r.next((n=>o+n))))}wr(e){let r=0;return this.pr(e,(o=>{r++})).next((()=>r))}pr(e,r){return fe.forEach(this.pi,((o,n)=>this.br(e,o,n).next((i=>i?fe.resolve():r(n)))))}removeTargets(e,r,o){return this.persistence.getTargetCache().removeTargets(e,r,o)}removeOrphanedDocuments(e,r){let o=0,n=this.persistence.getRemoteDocumentCache(),i=n.newChangeBuffer();return n.ii(e,(a=>this.br(e,a,r).next((s=>{s||(o++,i.removeEntry(a,mt.min()))})))).next((()=>i.apply(e))).next((()=>o))}markPotentiallyOrphaned(e,r){return this.pi.set(r,e.currentSequenceNumber),fe.resolve()}removeTarget(e,r){let o=r.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,o)}addReference(e,r,o){return this.pi.set(o,e.currentSequenceNumber),fe.resolve()}removeReference(e,r,o){return this.pi.set(o,e.currentSequenceNumber),fe.resolve()}updateLimboDocument(e,r){return this.pi.set(r,e.currentSequenceNumber),fe.resolve()}Ti(e){let r=e.key.toString().length;return e.isFoundDocument()&&(r+=gE(e.data.value)),r}br(e,r,o){return fe.or([()=>this.persistence.Ai(e,r),()=>this.persistence.getTargetCache().containsKey(e,r),()=>{let n=this.pi.get(r);return fe.resolve(n!==void 0&&n>o)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var hD=class t{constructor(e,r,o,n){this.targetId=e,this.fromCache=r,this.Es=o,this.ds=n}static As(e,r){let o=$t(),n=$t();for(let i of r.docChanges)switch(i.type){case 0:o=o.add(i.doc.key);break;case 1:n=n.add(i.doc.key)}return new t(e,r.fromCache,o,n)}};var gD=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var _D=class{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=(function(){return Jq()?8:EOe(Yo())>0?6:4})()}initialize(e,r){this.ps=e,this.indexManager=r,this.Rs=!0}getDocumentsMatchingQuery(e,r,o,n){let i={result:null};return this.ys(e,r).next((a=>{i.result=a})).next((()=>{if(!i.result)return this.ws(e,r,n,o).next((a=>{i.result=a}))})).next((()=>{if(i.result)return;let a=new gD;return this.Ss(e,r,a).next((s=>{if(i.result=s,this.Vs)return this.bs(e,r,a,s.size)}))})).next((()=>i.result))}bs(e,r,o,n){return o.documentReadCount<this.fs?(Lm()<=Pt.DEBUG&&Le("QueryEngine","SDK will not create cache indexes for query:",Fm(r),"since it only creates cache indexes for collection contains","more than or equal to",this.fs,"documents"),fe.resolve()):(Lm()<=Pt.DEBUG&&Le("QueryEngine","Query:",Fm(r),"scans",o.documentReadCount,"local documents and returns",n,"documents as results."),o.documentReadCount>this.gs*n?(Lm()<=Pt.DEBUG&&Le("QueryEngine","The SDK decides to create cache indexes for query:",Fm(r),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Zs(r))):fe.resolve())}ys(e,r){if(OY(r))return fe.resolve(null);let o=Zs(r);return this.indexManager.getIndexType(e,o).next((n=>n===0?null:(r.limit!==null&&n===1&&(r=CE(r,null,"F"),o=Zs(r)),this.indexManager.getDocumentsMatchingTarget(e,o).next((i=>{let a=$t(...i);return this.ps.getDocuments(e,a).next((s=>this.indexManager.getMinOffset(e,o).next((l=>{let c=this.Ds(r,s);return this.Cs(r,c,a,l.readTime)?this.ys(e,CE(r,null,"F")):this.vs(e,c,r,l)}))))})))))}ws(e,r,o,n){return OY(r)||n.isEqual(mt.min())?fe.resolve(null):this.ps.getDocuments(e,o).next((i=>{let a=this.Ds(r,i);return this.Cs(r,a,o,n)?fe.resolve(null):(Lm()<=Pt.DEBUG&&Le("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),Fm(r)),this.vs(e,a,r,yOe(n,Bx)).next((s=>s)))}))}Ds(e,r){let o=new Jo(BX(e));return r.forEach(((n,i)=>{nS(e,i)&&(o=o.add(i))})),o}Cs(e,r,o,n){if(e.limit===null)return!1;if(o.size!==r.size)return!0;let i=e.limitType==="F"?r.last():r.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(n)>0)}Ss(e,r,o){return Lm()<=Pt.DEBUG&&Le("QueryEngine","Using full collection scan to execute query:",Fm(r)),this.ps.getDocumentsMatchingQuery(e,r,lf.min(),o)}vs(e,r,o,n){return this.ps.getDocumentsMatchingQuery(e,o,n).next((i=>(r.forEach((a=>{i=i.insert(a.key,a)})),i)))}};var mR="LocalStore",wAe=3e8,xD=class{constructor(e,r,o,n){this.persistence=e,this.Fs=r,this.serializer=n,this.Ms=new Zr(Bt),this.xs=new tc((i=>uR(i)),dR),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(o)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new iD(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(r=>e.collect(r,this.Ms)))}};function EAe(t,e,r,o){return new xD(t,e,r,o)}async function sJ(t,e){let r=gt(t);return await r.persistence.runTransaction("Handle user change","readonly",(o=>{let n;return r.mutationQueue.getAllMutationBatches(o).next((i=>(n=i,r.Bs(e),r.mutationQueue.getAllMutationBatches(o)))).next((i=>{let a=[],s=[],l=$t();for(let c of n){a.push(c.batchId);for(let u of c.mutations)l=l.add(u.key)}for(let c of i){s.push(c.batchId);for(let u of c.mutations)l=l.add(u.key)}return r.localDocuments.getDocuments(o,l).next((c=>({Ls:c,removedBatchIds:a,addedBatchIds:s})))}))}))}function SAe(t,e){let r=gt(t);return r.persistence.runTransaction("Acknowledge batch","readwrite-primary",(o=>{let n=e.batch.keys(),i=r.Ns.newChangeBuffer({trackRemovals:!0});return(function(s,l,c,u){let d=c.batch,f=d.keys(),m=fe.resolve();return f.forEach((h=>{m=m.next((()=>u.getEntry(l,h))).next((g=>{let _=c.docVersions.get(h);Gt(_!==null,48541),g.version.compareTo(_)<0&&(d.applyToRemoteDocument(g,c),g.isValidDocument()&&(g.setReadTime(c.commitVersion),u.addEntry(g)))}))})),m.next((()=>s.mutationQueue.removeMutationBatch(l,d)))})(r,o,e,i).next((()=>i.apply(o))).next((()=>r.mutationQueue.performConsistencyCheck(o))).next((()=>r.documentOverlayCache.removeOverlaysForBatchId(o,n,e.batch.batchId))).next((()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(o,(function(s){let l=$t();for(let c=0;c<s.mutationResults.length;++c)s.mutationResults[c].transformResults.length>0&&(l=l.add(s.batch.mutations[c].key));return l})(e)))).next((()=>r.localDocuments.getDocuments(o,n)))}))}function lJ(t){let e=gt(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(r=>e.Pi.getLastRemoteSnapshotVersion(r)))}function CAe(t,e){let r=gt(t),o=e.snapshotVersion,n=r.Ms;return r.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{let a=r.Ns.newChangeBuffer({trackRemovals:!0});n=r.Ms;let s=[];e.targetChanges.forEach(((u,d)=>{let f=n.get(d);if(!f)return;s.push(r.Pi.removeMatchingKeys(i,u.removedDocuments,d).next((()=>r.Pi.addMatchingKeys(i,u.addedDocuments,d))));let m=f.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(d)!==null?m=m.withResumeToken(Vn.EMPTY_BYTE_STRING,mt.min()).withLastLimboFreeSnapshotVersion(mt.min()):u.resumeToken.approximateByteSize()>0&&(m=m.withResumeToken(u.resumeToken,o)),n=n.insert(d,m),(function(g,_,b){return g.resumeToken.approximateByteSize()===0||_.snapshotVersion.toMicroseconds()-g.snapshotVersion.toMicroseconds()>=wAe?!0:b.addedDocuments.size+b.modifiedDocuments.size+b.removedDocuments.size>0})(f,m,u)&&s.push(r.Pi.updateTargetData(i,m))}));let l=rc(),c=$t();if(e.documentUpdates.forEach((u=>{e.resolvedLimboDocuments.has(u)&&s.push(r.persistence.referenceDelegate.updateLimboDocument(i,u))})),s.push(TAe(i,a,e.documentUpdates).next((u=>{l=u.ks,c=u.qs}))),!o.isEqual(mt.min())){let u=r.Pi.getLastRemoteSnapshotVersion(i).next((d=>r.Pi.setTargetsMetadata(i,i.currentSequenceNumber,o)));s.push(u)}return fe.waitFor(s).next((()=>a.apply(i))).next((()=>r.localDocuments.getLocalViewOfDocuments(i,l,c))).next((()=>l))})).then((i=>(r.Ms=n,i)))}function TAe(t,e,r){let o=$t(),n=$t();return r.forEach((i=>o=o.add(i))),e.getEntries(t,o).next((i=>{let a=rc();return r.forEach(((s,l)=>{let c=i.get(s);l.isFoundDocument()!==c.isFoundDocument()&&(n=n.add(s)),l.isNoDocument()&&l.version.isEqual(mt.min())?(e.removeEntry(s,l.readTime),a=a.insert(s,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),a=a.insert(s,l)):Le(mR,"Ignoring outdated watch update for ",s,". Current version:",c.version," Watch version:",l.version)})),{ks:a,qs:n}}))}function kAe(t,e){let r=gt(t);return r.persistence.runTransaction("Get next mutation batch","readonly",(o=>(e===void 0&&(e=iR),r.mutationQueue.getNextMutationBatchAfterBatchId(o,e))))}function NAe(t,e){let r=gt(t);return r.persistence.runTransaction("Allocate target","readwrite",(o=>{let n;return r.Pi.getTargetData(o,e).next((i=>i?(n=i,fe.resolve(n)):r.Pi.allocateTargetId(o).next((a=>(n=new Hx(e,a,"TargetPurposeListen",o.currentSequenceNumber),r.Pi.addTargetData(o,n).next((()=>n)))))))})).then((o=>{let n=r.Ms.get(o.targetId);return(n===null||o.snapshotVersion.compareTo(n.snapshotVersion)>0)&&(r.Ms=r.Ms.insert(o.targetId,o),r.xs.set(e,o.targetId)),o}))}async function bD(t,e,r){let o=gt(t),n=o.Ms.get(e),i=r?"readwrite":"readwrite-primary";try{r||await o.persistence.runTransaction("Release target",i,(a=>o.persistence.referenceDelegate.removeTarget(a,n)))}catch(a){if(!nh(a))throw a;Le(mR,`Failed to update sequence numbers for target ${e}: ${a}`)}o.Ms=o.Ms.remove(e),o.xs.delete(n.target)}function HY(t,e,r){let o=gt(t),n=mt.min(),i=$t();return o.persistence.runTransaction("Execute query","readwrite",(a=>(function(l,c,u){let d=gt(l),f=d.xs.get(u);return f!==void 0?fe.resolve(d.Ms.get(f)):d.Pi.getTargetData(c,u)})(o,a,Zs(e)).next((s=>{if(s)return n=s.lastLimboFreeSnapshotVersion,o.Pi.getMatchingKeysForTargetId(a,s.targetId).next((l=>{i=l}))})).next((()=>o.Fs.getDocumentsMatchingQuery(a,e,r?n:mt.min(),r?i:$t()))).next((s=>(PAe(o,HOe(e),s),{documents:s,Qs:i})))))}function PAe(t,e,r){let o=t.Os.get(e)||mt.min();r.forEach(((n,i)=>{i.readTime.compareTo(o)>0&&(o=i.readTime)})),t.Os.set(e,o)}var BE=class{constructor(){this.activeTargetIds=YOe()}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}};var yD=class{constructor(){this.Mo=new BE,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,r,o){}addLocalQueryTarget(e,r=!0){return r&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,r,o){this.xo[e]=r}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new BE,Promise.resolve()}handleUserChange(e,r,o){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var vD=class{Oo(e){}shutdown(){}};var jY="ConnectivityMonitor",$E=class{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){Le(jY,"Network connectivity changed: AVAILABLE");for(let e of this.qo)e(0)}ko(){Le(jY,"Network connectivity changed: UNAVAILABLE");for(let e of this.qo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var hE=null;function ID(){return hE===null?hE=(function(){return 268435456+Math.round(2147483648*Math.random())})():hE++,"0x"+hE.toString(16)}var pA="RestConnection",OAe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},wD=class{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let r=e.ssl?"https":"http",o=encodeURIComponent(this.databaseId.projectId),n=encodeURIComponent(this.databaseId.database);this.Uo=r+"://"+e.host,this.Ko=`projects/${o}/databases/${n}`,this.Wo=this.databaseId.database===wE?`project_id=${o}`:`project_id=${o}&database_id=${n}`}Go(e,r,o,n,i){let a=ID(),s=this.zo(e,r.toUriEncodedString());Le(pA,`Sending RPC '${e}' ${a}:`,s,o);let l={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(l,n,i);let{host:c}=new URL(s),u=ss(c);return this.Jo(e,s,l,o,u).then((d=>(Le(pA,`Received RPC '${e}' ${a}: `,d),d)),(d=>{throw Lx(pA,`RPC '${e}' ${a} failed with error: `,d,"url: ",s,"request:",o),d}))}Ho(e,r,o,n,i,a){return this.Go(e,r,o,n,i)}jo(e,r,o){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+rh})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach(((n,i)=>e[i]=n)),o&&o.headers.forEach(((n,i)=>e[i]=n))}zo(e,r){let o=OAe[e];return`${this.Uo}/v1/${r}:${o}`}terminate(){}};var ED=class{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}};var zn="WebChannelConnection",SD=class extends wD{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,r,o,n,i){let a=ID();return new Promise(((s,l)=>{let c=new sA;c.setWithCredentials(!0),c.listenOnce(lA.COMPLETE,(()=>{try{switch(c.getLastErrorCode()){case Nx.NO_ERROR:let d=c.getResponseJson();Le(zn,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(d)),s(d);break;case Nx.TIMEOUT:Le(zn,`RPC '${e}' ${a} timed out`),l(new xe(te.DEADLINE_EXCEEDED,"Request time out"));break;case Nx.HTTP_ERROR:let f=c.getStatus();if(Le(zn,`RPC '${e}' ${a} failed with status:`,f,"response text:",c.getResponseText()),f>0){let m=c.getResponseJson();Array.isArray(m)&&(m=m[0]);let h=m?.error;if(h&&h.status&&h.message){let g=(function(b){let y=b.toLowerCase().replace(/_/g,"-");return Object.values(te).indexOf(y)>=0?y:te.UNKNOWN})(h.status);l(new xe(g,h.message))}else l(new xe(te.UNKNOWN,"Server responded with status "+c.getStatus()))}else l(new xe(te.UNAVAILABLE,"Connection failed."));break;default:rt(9055,{l_:e,streamId:a,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{Le(zn,`RPC '${e}' ${a} completed.`)}}));let u=JSON.stringify(n);Le(zn,`RPC '${e}' ${a} sending request:`,n),c.send(r,"POST",u,o,15)}))}T_(e,r,o){let n=ID(),i=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=dA(),s=uA(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.jo(l.initMessageHeaders,r,o),l.encodeInitMessageHeaders=!0;let u=i.join("");Le(zn,`Creating RPC '${e}' stream ${n}: ${u}`,l);let d=a.createWebChannel(u,l);this.I_(d);let f=!1,m=!1,h=new ED({Yo:_=>{m?Le(zn,`Not sending because RPC '${e}' stream ${n} is closed:`,_):(f||(Le(zn,`Opening RPC '${e}' stream ${n} transport.`),d.open(),f=!0),Le(zn,`RPC '${e}' stream ${n} sending:`,_),d.send(_))},Zo:()=>d.close()}),g=(_,b,y)=>{_.listen(b,(v=>{try{y(v)}catch(C){setTimeout((()=>{throw C}),0)}}))};return g(d,Mm.EventType.OPEN,(()=>{m||(Le(zn,`RPC '${e}' stream ${n} transport opened.`),h.o_())})),g(d,Mm.EventType.CLOSE,(()=>{m||(m=!0,Le(zn,`RPC '${e}' stream ${n} transport closed`),h.a_(),this.E_(d))})),g(d,Mm.EventType.ERROR,(_=>{m||(m=!0,Lx(zn,`RPC '${e}' stream ${n} transport errored. Name:`,_.name,"Message:",_.message),h.a_(new xe(te.UNAVAILABLE,"The operation could not be completed")))})),g(d,Mm.EventType.MESSAGE,(_=>{if(!m){let b=_.data[0];Gt(!!b,16349);let y=b,v=y?.error||y[0]?.error;if(v){Le(zn,`RPC '${e}' stream ${n} received error:`,v);let C=v.status,N=(function(w){let S=wo[w];if(S!==void 0)return XX(S)})(C),I=v.message;N===void 0&&(N=te.INTERNAL,I="Unknown error status: "+C+" with message "+v.message),m=!0,h.a_(new xe(N,I)),d.close()}else Le(zn,`RPC '${e}' stream ${n} received:`,b),h.u_(b)}})),g(s,cA.STAT_EVENT,(_=>{_.stat===fE.PROXY?Le(zn,`RPC '${e}' stream ${n} detected buffering proxy`):_.stat===fE.NOPROXY&&Le(zn,`RPC '${e}' stream ${n} detected no buffering proxy`)})),setTimeout((()=>{h.__()}),0),h}terminate(){this.c_.forEach((e=>e.close())),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter((r=>r===e))}};function mA(){return typeof document<"u"?document:null}function iS(t){return new qA(t,!0)}var Wx=class{constructor(e,r,o=1e3,n=1.5,i=6e4){this.Mi=e,this.timerId=r,this.d_=o,this.A_=n,this.R_=i,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();let r=Math.floor(this.V_+this.y_()),o=Math.max(0,Date.now()-this.f_),n=Math.max(0,r-o);n>0&&Le("ExponentialBackoff",`Backing off for ${n} ms (base delay: ${this.V_} ms, delay with jitter: ${r} ms, last attempt: ${o} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,n,(()=>(this.f_=Date.now(),e()))),this.V_*=this.A_,this.V_<this.d_&&(this.V_=this.d_),this.V_>this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}};var GY="PersistentStream",zE=class{constructor(e,r,o,n,i,a,s,l){this.Mi=e,this.S_=o,this.b_=n,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=s,this.listener=l,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new Wx(e,r)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,(()=>this.k_())))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,r){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():r&&r.code===te.RESOURCE_EXHAUSTED?(Ql(r.toString()),Ql("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):r&&r.code===te.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(r)}K_(){}auth(){this.state=1;let e=this.W_(this.D_),r=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([o,n])=>{this.D_===r&&this.G_(o,n)}),(o=>{e((()=>{let n=new xe(te.UNKNOWN,"Fetching auth token failed: "+o.message);return this.z_(n)}))}))}G_(e,r){let o=this.W_(this.D_);this.stream=this.j_(e,r),this.stream.Xo((()=>{o((()=>this.listener.Xo()))})),this.stream.t_((()=>{o((()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.t_())))})),this.stream.r_((n=>{o((()=>this.z_(n)))})),this.stream.onMessage((n=>{o((()=>++this.F_==1?this.J_(n):this.onNext(n)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return Le(GY,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return r=>{this.Mi.enqueueAndForget((()=>this.D_===e?r():(Le(GY,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}},CD=class extends zE{constructor(e,r,o,n,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,o,n,a),this.serializer=i}j_(e,r){return this.connection.T_("Listen",e,r)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();let r=dAe(this.serializer,e),o=(function(i){if(!("targetChange"in i))return mt.min();let a=i.targetChange;return a.targetIds&&a.targetIds.length?mt.min():a.readTime?Ji(a.readTime):mt.min()})(e);return this.listener.H_(r,o)}Y_(e){let r={};r.database=XA(this.serializer),r.addTarget=(function(i,a){let s,l=a.target;if(s=BA(l)?{documents:pAe(i,l)}:{query:mAe(i,l).ft},s.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){s.resumeToken=JX(i,a.resumeToken);let c=KA(i,a.expectedCount);c!==null&&(s.expectedCount=c)}else if(a.snapshotVersion.compareTo(mt.min())>0){s.readTime=DE(i,a.snapshotVersion.toTimestamp());let c=KA(i,a.expectedCount);c!==null&&(s.expectedCount=c)}return s})(this.serializer,e);let o=gAe(this.serializer,e);o&&(r.labels=o),this.q_(r)}Z_(e){let r={};r.database=XA(this.serializer),r.removeTarget=e,this.q_(r)}},TD=class extends zE{constructor(e,r,o,n,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,o,n,a),this.serializer=i}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,r){return this.connection.T_("Write",e,r)}J_(e){return Gt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Gt(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Gt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();let r=fAe(e.writeResults,e.commitTime),o=Ji(e.commitTime);return this.listener.na(o,r)}ra(){let e={};e.database=XA(this.serializer),this.q_(e)}ea(e){let r={streamToken:this.lastStreamToken,writes:e.map((o=>tJ(this.serializer,o)))};this.q_(r)}};var kD=class{},ND=class extends kD{constructor(e,r,o,n){super(),this.authCredentials=e,this.appCheckCredentials=r,this.connection=o,this.serializer=n,this.ia=!1}sa(){if(this.ia)throw new xe(te.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,r,o,n){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Go(e,YA(r,o),n,i,a))).catch((i=>{throw i.name==="FirebaseError"?(i.code===te.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new xe(te.UNKNOWN,i.toString())}))}Ho(e,r,o,n,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,s])=>this.connection.Ho(e,YA(r,o),n,a,s,i))).catch((a=>{throw a.name==="FirebaseError"?(a.code===te.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new xe(te.UNKNOWN,a.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}},PD=class{constructor(e,r){this.asyncQueue=e,this.onlineStateHandler=r,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve()))))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){let r=`Could not reach Cloud Firestore backend. ${e}
42
- This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Ql(r),this.aa=!1):Le("OnlineStateTracker",r)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}};var mf="RemoteStore",OD=class{constructor(e,r,o,n,i){this.localStore=e,this.datastore=r,this.asyncQueue=o,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=i,this.Aa.Oo((a=>{o.enqueueAndForget((async()=>{gf(this)&&(Le(mf,"Restarting streams for network reachability change."),await(async function(l){let c=gt(l);c.Ea.add(4),await rb(c),c.Ra.set("Unknown"),c.Ea.delete(4),await aS(c)})(this))}))})),this.Ra=new PD(o,n)}};async function aS(t){if(gf(t))for(let e of t.da)await e(!0)}async function rb(t){for(let e of t.da)await e(!1)}function cJ(t,e){let r=gt(t);r.Ia.has(e.targetId)||(r.Ia.set(e.targetId,e),xR(r)?_R(r):ih(r).O_()&&gR(r,e))}function hR(t,e){let r=gt(t),o=ih(r);r.Ia.delete(e),o.O_()&&uJ(r,e),r.Ia.size===0&&(o.O_()?o.L_():gf(r)&&r.Ra.set("Unknown"))}function gR(t,e){if(t.Va.Ue(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(mt.min())>0){let r=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(r)}ih(t).Y_(e)}function uJ(t,e){t.Va.Ue(e),ih(t).Z_(e)}function _R(t){t.Va=new WA({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),ih(t).start(),t.Ra.ua()}function xR(t){return gf(t)&&!ih(t).x_()&&t.Ia.size>0}function gf(t){return gt(t).Ea.size===0}function dJ(t){t.Va=void 0}async function AAe(t){t.Ra.set("Online")}async function DAe(t){t.Ia.forEach(((e,r)=>{gR(t,e)}))}async function RAe(t,e){dJ(t),xR(t)?(t.Ra.ha(e),_R(t)):t.Ra.set("Unknown")}async function MAe(t,e,r){if(t.Ra.set("Online"),e instanceof OE&&e.state===2&&e.cause)try{await(async function(n,i){let a=i.cause;for(let s of i.targetIds)n.Ia.has(s)&&(await n.remoteSyncer.rejectListen(s,a),n.Ia.delete(s),n.Va.removeTarget(s))})(t,e)}catch(o){Le(mf,"Failed to remove targets %s: %s ",e.targetIds.join(","),o),await UE(t,o)}else if(e instanceof Um?t.Va.Ze(e):e instanceof PE?t.Va.st(e):t.Va.tt(e),!r.isEqual(mt.min()))try{let o=await lJ(t.localStore);r.compareTo(o)>=0&&await(function(i,a){let s=i.Va.Tt(a);return s.targetChanges.forEach(((l,c)=>{if(l.resumeToken.approximateByteSize()>0){let u=i.Ia.get(c);u&&i.Ia.set(c,u.withResumeToken(l.resumeToken,a))}})),s.targetMismatches.forEach(((l,c)=>{let u=i.Ia.get(l);if(!u)return;i.Ia.set(l,u.withResumeToken(Vn.EMPTY_BYTE_STRING,u.snapshotVersion)),uJ(i,l);let d=new Hx(u.target,l,c,u.sequenceNumber);gR(i,d)})),i.remoteSyncer.applyRemoteEvent(s)})(t,r)}catch(o){Le(mf,"Failed to raise snapshot:",o),await UE(t,o)}}async function UE(t,e,r){if(!nh(e))throw e;t.Ea.add(1),await rb(t),t.Ra.set("Offline"),r||(r=()=>lJ(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Le(mf,"Retrying IndexedDB access"),await r(),t.Ea.delete(1),await aS(t)}))}function fJ(t,e){return e().catch((r=>UE(t,r,e)))}async function sS(t){let e=gt(t),r=hu(e),o=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:iR;for(;LAe(e);)try{let n=await kAe(e.localStore,o);if(n===null){e.Ta.length===0&&r.L_();break}o=n.batchId,FAe(e,n)}catch(n){await UE(e,n)}pJ(e)&&mJ(e)}function LAe(t){return gf(t)&&t.Ta.length<10}function FAe(t,e){t.Ta.push(e);let r=hu(t);r.O_()&&r.X_&&r.ea(e.mutations)}function pJ(t){return gf(t)&&!hu(t).x_()&&t.Ta.length>0}function mJ(t){hu(t).start()}async function BAe(t){hu(t).ra()}async function $Ae(t){let e=hu(t);for(let r of t.Ta)e.ea(r.mutations)}async function zAe(t,e,r){let o=t.Ta.shift(),n=VA.from(o,e,r);await fJ(t,(()=>t.remoteSyncer.applySuccessfulWrite(n))),await sS(t)}async function UAe(t,e){e&&hu(t).X_&&await(async function(o,n){if((function(a){return YX(a)&&a!==te.ABORTED})(n.code)){let i=o.Ta.shift();hu(o).B_(),await fJ(o,(()=>o.remoteSyncer.rejectFailedWrite(i.batchId,n))),await sS(o)}})(t,e),pJ(t)&&mJ(t)}async function WY(t,e){let r=gt(t);r.asyncQueue.verifyOperationInProgress(),Le(mf,"RemoteStore received new credentials");let o=gf(r);r.Ea.add(3),await rb(r),o&&r.Ra.set("Unknown"),await r.remoteSyncer.handleCredentialChange(e),r.Ea.delete(3),await aS(r)}async function VAe(t,e){let r=gt(t);e?(r.Ea.delete(2),await aS(r)):e||(r.Ea.add(2),await rb(r),r.Ra.set("Unknown"))}function ih(t){return t.ma||(t.ma=(function(r,o,n){let i=gt(r);return i.sa(),new CD(o,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)})(t.datastore,t.asyncQueue,{Xo:AAe.bind(null,t),t_:DAe.bind(null,t),r_:RAe.bind(null,t),H_:MAe.bind(null,t)}),t.da.push((async e=>{e?(t.ma.B_(),xR(t)?_R(t):t.Ra.set("Unknown")):(await t.ma.stop(),dJ(t))}))),t.ma}function hu(t){return t.fa||(t.fa=(function(r,o,n){let i=gt(r);return i.sa(),new TD(o,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)})(t.datastore,t.asyncQueue,{Xo:()=>Promise.resolve(),t_:BAe.bind(null,t),r_:UAe.bind(null,t),ta:$Ae.bind(null,t),na:zAe.bind(null,t)}),t.da.push((async e=>{e?(t.fa.B_(),await sS(t)):(await t.fa.stop(),t.Ta.length>0&&(Le(mf,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))}))),t.fa}var AD=class t{constructor(e,r,o,n,i){this.asyncQueue=e,this.timerId=r,this.targetTimeMs=o,this.op=n,this.removalCallback=i,this.deferred=new Oa,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((a=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,r,o,n,i){let a=Date.now()+o,s=new t(e,r,a,n,i);return s.start(o),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new xe(te.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function bR(t,e){if(Ql("AsyncQueue",`${e}: ${t}`),nh(t))return new xe(te.UNAVAILABLE,`${e}: ${t}`);throw t}var VE=class t{static emptySet(e){return new t(e.comparator)}constructor(e){this.comparator=e?(r,o)=>e(r,o)||ot.comparator(r.key,o.key):(r,o)=>ot.comparator(r.key,o.key),this.keyedMap=Px(),this.sortedSet=new Zr(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let r=this.keyedMap.get(e);return r?this.sortedSet.indexOf(r):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((r,o)=>(e(r),!1)))}add(e){let r=this.delete(e.key);return r.copy(r.keyedMap.insert(e.key,e),r.sortedSet.insert(e,null))}delete(e){let r=this.get(e);return r?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(r)):this}isEqual(e){if(!(e instanceof t)||this.size!==e.size)return!1;let r=this.sortedSet.getIterator(),o=e.sortedSet.getIterator();for(;r.hasNext();){let n=r.getNext().key,i=o.getNext().key;if(!n.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach((r=>{e.push(r.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
41
+ Total Duration: ${c-u}ms`),fe.resolve({didRun:!0,sequenceNumbersCollected:n,targetsRemoved:i,documentsRemoved:d}))))}};function IAe(t,e){return new rD(t,e)}var oD=class{constructor(){this.changes=new tc((e=>e.toString()),((e,r)=>e.isEqual(r))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,r){this.assertNotApplied(),this.changes.set(e,Qi.newInvalidDocument(e).setReadTime(r))}getEntry(e,r){this.assertNotApplied();let o=this.changes.get(r);return o!==void 0?fe.resolve(o):this.getFromCache(e,r)}getEntries(e,r){return this.getAllFromCache(e,r)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};var nD=class{constructor(e,r){this.overlayedDocument=e,this.mutatedFields=r}};var iD=class{constructor(e,r,o,n){this.remoteDocumentCache=e,this.mutationQueue=r,this.documentOverlayCache=o,this.indexManager=n}getDocument(e,r){let o=null;return this.documentOverlayCache.getOverlay(e,r).next((n=>(o=n,this.remoteDocumentCache.getEntry(e,r)))).next((n=>(o!==null&&Rx(o.mutation,n,Pa.empty(),Tt.now()),n)))}getDocuments(e,r){return this.remoteDocumentCache.getEntries(e,r).next((o=>this.getLocalViewOfDocuments(e,o,$t()).next((()=>o))))}getLocalViewOfDocuments(e,r,o=$t()){let n=of();return this.populateOverlays(e,n,r).next((()=>this.computeViews(e,r,n,o).next((i=>{let a=Px();return i.forEach(((s,l)=>{a=a.insert(s,l.overlayedDocument)})),a}))))}getOverlayedDocuments(e,r){let o=of();return this.populateOverlays(e,o,r).next((()=>this.computeViews(e,r,o,$t())))}populateOverlays(e,r,o){let n=[];return o.forEach((i=>{r.has(i)||n.push(i)})),this.documentOverlayCache.getOverlays(e,n).next((i=>{i.forEach(((a,s)=>{r.set(a,s)}))}))}computeViews(e,r,o,n){let i=rc(),a=Dx(),s=(function(){return Dx()})();return r.forEach(((l,c)=>{let u=o.get(c.key);n.has(c.key)&&(u===void 0||u.mutation instanceof tl)?i=i.insert(c.key,c):u!==void 0?(a.set(c.key,u.mutation.getFieldMask()),Rx(u.mutation,c,u.mutation.getFieldMask(),Tt.now())):a.set(c.key,Pa.empty())})),this.recalculateAndSaveOverlays(e,i).next((l=>(l.forEach(((c,u)=>a.set(c,u))),r.forEach(((c,u)=>s.set(c,new nD(u,a.get(c)??null)))),s)))}recalculateAndSaveOverlays(e,r){let o=Dx(),n=new Zr(((a,s)=>a-s)),i=$t();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,r).next((a=>{for(let s of a)s.keys().forEach((l=>{let c=r.get(l);if(c===null)return;let u=o.get(l)||Pa.empty();u=s.applyToLocalView(c,u),o.set(l,u);let d=(n.get(s.batchId)||$t()).add(l);n=n.insert(s.batchId,d)}))})).next((()=>{let a=[],s=n.getReverseIterator();for(;s.hasNext();){let l=s.getNext(),c=l.key,u=l.value,d=UX();u.forEach((f=>{if(!i.has(f)){let m=qX(r.get(f),o.get(f));m!==null&&d.set(f,m),i=i.add(f)}})),a.push(this.documentOverlayCache.saveOverlays(e,c,d))}return fe.waitFor(a)})).next((()=>o))}recalculateAndSaveOverlaysForDocumentKeys(e,r){return this.remoteDocumentCache.getEntries(e,r).next((o=>this.recalculateAndSaveOverlays(e,o)))}getDocumentsMatchingQuery(e,r,o,n){return(function(a){return ot.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0})(r)?this.getDocumentsMatchingDocumentQuery(e,r.path):LX(r)?this.getDocumentsMatchingCollectionGroupQuery(e,r,o,n):this.getDocumentsMatchingCollectionQuery(e,r,o,n)}getNextDocuments(e,r,o,n){return this.remoteDocumentCache.getAllFromCollectionGroup(e,r,o,n).next((i=>{let a=n-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,r,o.largestBatchId,n-i.size):fe.resolve(of()),s=Bx,l=i;return a.next((c=>fe.forEach(c,((u,d)=>(s<d.largestBatchId&&(s=d.largestBatchId),i.get(u)?fe.resolve():this.remoteDocumentCache.getEntry(e,u).next((f=>{l=l.insert(u,f)}))))).next((()=>this.populateOverlays(e,c,i))).next((()=>this.computeViews(e,l,c,$t()))).next((u=>({batchId:s,changes:zX(u)})))))}))}getDocumentsMatchingDocumentQuery(e,r){return this.getDocument(e,new ot(r)).next((o=>{let n=Px();return o.isFoundDocument()&&(n=n.insert(o.key,o)),n}))}getDocumentsMatchingCollectionGroupQuery(e,r,o,n){let i=r.collectionGroup,a=Px();return this.indexManager.getCollectionParents(e,i).next((s=>fe.forEach(s,(l=>{let c=(function(d,f){return new pu(f,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)})(r,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,c,o,n).next((u=>{u.forEach(((d,f)=>{a=a.insert(d,f)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,r,o,n){let i;return this.documentOverlayCache.getOverlaysForCollection(e,r.path,o.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,r,o,i,n)))).next((a=>{i.forEach(((l,c)=>{let u=c.getKey();a.get(u)===null&&(a=a.insert(u,Qi.newInvalidDocument(u)))}));let s=Px();return a.forEach(((l,c)=>{let u=i.get(l);u!==void 0&&Rx(u.mutation,c,Pa.empty(),Tt.now()),nS(r,c)&&(s=s.insert(l,c))})),s}))}};var aD=class{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,r){return fe.resolve(this.Lr.get(r))}saveBundleMetadata(e,r){return this.Lr.set(r.id,(function(n){return{id:n.id,version:n.version,createTime:Ji(n.createTime)}})(r)),fe.resolve()}getNamedQuery(e,r){return fe.resolve(this.kr.get(r))}saveNamedQuery(e,r){return this.kr.set(r.name,(function(n){return{name:n.name,query:vAe(n.bundledQuery),readTime:Ji(n.readTime)}})(r)),fe.resolve()}};var sD=class{constructor(){this.overlays=new Zr(ot.comparator),this.qr=new Map}getOverlay(e,r){return fe.resolve(this.overlays.get(r))}getOverlays(e,r){let o=of();return fe.forEach(r,(n=>this.getOverlay(e,n).next((i=>{i!==null&&o.set(n,i)})))).next((()=>o))}saveOverlays(e,r,o){return o.forEach(((n,i)=>{this.St(e,r,i)})),fe.resolve()}removeOverlaysForBatchId(e,r,o){let n=this.qr.get(o);return n!==void 0&&(n.forEach((i=>this.overlays=this.overlays.remove(i))),this.qr.delete(o)),fe.resolve()}getOverlaysForCollection(e,r,o){let n=of(),i=r.length+1,a=new ot(r.child("")),s=this.overlays.getIteratorFrom(a);for(;s.hasNext();){let l=s.getNext().value,c=l.getKey();if(!r.isPrefixOf(c.path))break;c.path.length===i&&l.largestBatchId>o&&n.set(l.getKey(),l)}return fe.resolve(n)}getOverlaysForCollectionGroup(e,r,o,n){let i=new Zr(((c,u)=>c-u)),a=this.overlays.getIterator();for(;a.hasNext();){let c=a.getNext().value;if(c.getKey().getCollectionGroup()===r&&c.largestBatchId>o){let u=i.get(c.largestBatchId);u===null&&(u=of(),i=i.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}let s=of(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach(((c,u)=>s.set(c,u))),!(s.size()>=n)););return fe.resolve(s)}St(e,r,o){let n=this.overlays.get(o.key);if(n!==null){let a=this.qr.get(n.largestBatchId).delete(o.key);this.qr.set(n.largestBatchId,a)}this.overlays=this.overlays.insert(o.key,new HA(r,o));let i=this.qr.get(r);i===void 0&&(i=$t(),this.qr.set(r,i)),this.qr.set(r,i.add(o.key))}};var lD=class{constructor(){this.sessionToken=Vn.EMPTY_BYTE_STRING}getSessionToken(e){return fe.resolve(this.sessionToken)}setSessionToken(e,r){return this.sessionToken=r,fe.resolve()}};var Gx=class{constructor(){this.Qr=new Jo(Eo.$r),this.Ur=new Jo(Eo.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,r){let o=new Eo(e,r);this.Qr=this.Qr.add(o),this.Ur=this.Ur.add(o)}Wr(e,r){e.forEach((o=>this.addReference(o,r)))}removeReference(e,r){this.Gr(new Eo(e,r))}zr(e,r){e.forEach((o=>this.removeReference(o,r)))}jr(e){let r=new ot(new Sr([])),o=new Eo(r,e),n=new Eo(r,e+1),i=[];return this.Ur.forEachInRange([o,n],(a=>{this.Gr(a),i.push(a.key)})),i}Jr(){this.Qr.forEach((e=>this.Gr(e)))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){let r=new ot(new Sr([])),o=new Eo(r,e),n=new Eo(r,e+1),i=$t();return this.Ur.forEachInRange([o,n],(a=>{i=i.add(a.key)})),i}containsKey(e){let r=new Eo(e,0),o=this.Qr.firstAfterOrEqual(r);return o!==null&&e.isEqual(o.key)}},Eo=class{constructor(e,r){this.key=e,this.Yr=r}static $r(e,r){return ot.comparator(e.key,r.key)||Bt(e.Yr,r.Yr)}static Kr(e,r){return Bt(e.Yr,r.Yr)||ot.comparator(e.key,r.key)}};var cD=class{constructor(e,r){this.indexManager=e,this.referenceDelegate=r,this.mutationQueue=[],this.tr=1,this.Zr=new Jo(Eo.$r)}checkEmpty(e){return fe.resolve(this.mutationQueue.length===0)}addMutationBatch(e,r,o,n){let i=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new UA(i,r,o,n);this.mutationQueue.push(a);for(let s of n)this.Zr=this.Zr.add(new Eo(s.key,i)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast());return fe.resolve(a)}lookupMutationBatch(e,r){return fe.resolve(this.Xr(r))}getNextMutationBatchAfterBatchId(e,r){let o=r+1,n=this.ei(o),i=n<0?0:n;return fe.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return fe.resolve(this.mutationQueue.length===0?iR:this.tr-1)}getAllMutationBatches(e){return fe.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,r){let o=new Eo(r,0),n=new Eo(r,Number.POSITIVE_INFINITY),i=[];return this.Zr.forEachInRange([o,n],(a=>{let s=this.Xr(a.Yr);i.push(s)})),fe.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,r){let o=new Jo(Bt);return r.forEach((n=>{let i=new Eo(n,0),a=new Eo(n,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([i,a],(s=>{o=o.add(s.Yr)}))})),fe.resolve(this.ti(o))}getAllMutationBatchesAffectingQuery(e,r){let o=r.path,n=o.length+1,i=o;ot.isDocumentKey(i)||(i=i.child(""));let a=new Eo(new ot(i),0),s=new Jo(Bt);return this.Zr.forEachWhile((l=>{let c=l.key.path;return!!o.isPrefixOf(c)&&(c.length===n&&(s=s.add(l.Yr)),!0)}),a),fe.resolve(this.ti(s))}ti(e){let r=[];return e.forEach((o=>{let n=this.Xr(o);n!==null&&r.push(n)})),r}removeMutationBatch(e,r){Gt(this.ni(r.batchId,"removed")===0,55003),this.mutationQueue.shift();let o=this.Zr;return fe.forEach(r.mutations,(n=>{let i=new Eo(n.key,r.batchId);return o=o.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,n.key)})).next((()=>{this.Zr=o}))}ir(e){}containsKey(e,r){let o=new Eo(r,0),n=this.Zr.firstAfterOrEqual(o);return fe.resolve(r.isEqual(n&&n.key))}performConsistencyCheck(e){return this.mutationQueue.length,fe.resolve()}ni(e,r){return this.ei(e)}ei(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Xr(e){let r=this.ei(e);return r<0||r>=this.mutationQueue.length?null:this.mutationQueue[r]}};var uD=class{constructor(e){this.ri=e,this.docs=(function(){return new Zr(ot.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,r){let o=r.key,n=this.docs.get(o),i=n?n.size:0,a=this.ri(r);return this.docs=this.docs.insert(o,{document:r.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,o.path.popLast())}removeEntry(e){let r=this.docs.get(e);r&&(this.docs=this.docs.remove(e),this.size-=r.size)}getEntry(e,r){let o=this.docs.get(r);return fe.resolve(o?o.document.mutableCopy():Qi.newInvalidDocument(r))}getEntries(e,r){let o=rc();return r.forEach((n=>{let i=this.docs.get(n);o=o.insert(n,i?i.document.mutableCopy():Qi.newInvalidDocument(n))})),fe.resolve(o)}getDocumentsMatchingQuery(e,r,o,n){let i=rc(),a=r.path,s=new ot(a.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(s);for(;l.hasNext();){let{key:c,value:{document:u}}=l.getNext();if(!a.isPrefixOf(c.path))break;c.path.length>a.length+1||IOe(vOe(u),o)<=0||(n.has(u.key)||nS(r,u))&&(i=i.insert(u.key,u.mutableCopy()))}return fe.resolve(i)}getAllFromCollectionGroup(e,r,o,n){rt(9500)}ii(e,r){return fe.forEach(this.docs,(o=>r(o)))}newChangeBuffer(e){return new dD(this)}getSize(e){return fe.resolve(this.size)}},dD=class extends oD{constructor(e){super(),this.Nr=e}applyChanges(e){let r=[];return this.changes.forEach(((o,n)=>{n.isValidDocument()?r.push(this.Nr.addEntry(e,n)):this.Nr.removeEntry(o)})),fe.waitFor(r)}getFromCache(e,r){return this.Nr.getEntry(e,r)}getAllFromCache(e,r){return this.Nr.getEntries(e,r)}};var fD=class{constructor(e){this.persistence=e,this.si=new tc((r=>uR(r)),dR),this.lastRemoteSnapshotVersion=mt.min(),this.highestTargetId=0,this.oi=0,this._i=new Gx,this.targetCount=0,this.ai=jx.ur()}forEachTarget(e,r){return this.si.forEach(((o,n)=>r(n))),fe.resolve()}getLastRemoteSnapshotVersion(e){return fe.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return fe.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),fe.resolve(this.highestTargetId)}setTargetsMetadata(e,r,o){return o&&(this.lastRemoteSnapshotVersion=o),r>this.oi&&(this.oi=r),fe.resolve()}Pr(e){this.si.set(e.target,e);let r=e.targetId;r>this.highestTargetId&&(this.ai=new jx(r),this.highestTargetId=r),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,r){return this.Pr(r),this.targetCount+=1,fe.resolve()}updateTargetData(e,r){return this.Pr(r),fe.resolve()}removeTargetData(e,r){return this.si.delete(r.target),this._i.jr(r.targetId),this.targetCount-=1,fe.resolve()}removeTargets(e,r,o){let n=0,i=[];return this.si.forEach(((a,s)=>{s.sequenceNumber<=r&&o.get(s.targetId)===null&&(this.si.delete(a),i.push(this.removeMatchingKeysForTargetId(e,s.targetId)),n++)})),fe.waitFor(i).next((()=>n))}getTargetCount(e){return fe.resolve(this.targetCount)}getTargetData(e,r){let o=this.si.get(r)||null;return fe.resolve(o)}addMatchingKeys(e,r,o){return this._i.Wr(r,o),fe.resolve()}removeMatchingKeys(e,r,o){this._i.zr(r,o);let n=this.persistence.referenceDelegate,i=[];return n&&r.forEach((a=>{i.push(n.markPotentiallyOrphaned(e,a))})),fe.waitFor(i)}removeMatchingKeysForTargetId(e,r){return this._i.jr(r),fe.resolve()}getMatchingKeysForTargetId(e,r){let o=this._i.Hr(r);return fe.resolve(o)}containsKey(e,r){return fe.resolve(this._i.containsKey(r))}};var L0=class{constructor(e,r){this.ui={},this.overlays={},this.ci=new jm(0),this.li=!1,this.li=!0,this.hi=new lD,this.referenceDelegate=e(this),this.Pi=new fD(this),this.indexManager=new QA,this.remoteDocumentCache=(function(n){return new uD(n)})((o=>this.referenceDelegate.Ti(o))),this.serializer=new JA(r),this.Ii=new aD(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let r=this.overlays[e.toKey()];return r||(r=new sD,this.overlays[e.toKey()]=r),r}getMutationQueue(e,r){let o=this.ui[e.toKey()];return o||(o=new cD(r,this.referenceDelegate),this.ui[e.toKey()]=o),o}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,r,o){Le("MemoryPersistence","Starting transaction:",e);let n=new pD(this.ci.next());return this.referenceDelegate.Ei(),o(n).next((i=>this.referenceDelegate.di(n).next((()=>i)))).toPromise().then((i=>(n.raiseOnCommittedEvent(),i)))}Ai(e,r){return fe.or(Object.values(this.ui).map((o=>()=>o.containsKey(e,r))))}},pD=class extends SA{constructor(e){super(),this.currentSequenceNumber=e}},mD=class t{constructor(e){this.persistence=e,this.Ri=new Gx,this.Vi=null}static mi(e){return new t(e)}get fi(){if(this.Vi)return this.Vi;throw rt(60996)}addReference(e,r,o){return this.Ri.addReference(o,r),this.fi.delete(o.toString()),fe.resolve()}removeReference(e,r,o){return this.Ri.removeReference(o,r),this.fi.add(o.toString()),fe.resolve()}markPotentiallyOrphaned(e,r){return this.fi.add(r.toString()),fe.resolve()}removeTarget(e,r){this.Ri.jr(r.targetId).forEach((n=>this.fi.add(n.toString())));let o=this.persistence.getTargetCache();return o.getMatchingKeysForTargetId(e,r.targetId).next((n=>{n.forEach((i=>this.fi.add(i.toString())))})).next((()=>o.removeTargetData(e,r)))}Ei(){this.Vi=new Set}di(e){let r=this.persistence.getRemoteDocumentCache().newChangeBuffer();return fe.forEach(this.fi,(o=>{let n=ot.fromPath(o);return this.gi(e,n).next((i=>{i||r.removeEntry(n,mt.min())}))})).next((()=>(this.Vi=null,r.apply(e))))}updateLimboDocument(e,r){return this.gi(e,r).next((o=>{o?this.fi.delete(r.toString()):this.fi.add(r.toString())}))}Ti(e){return 0}gi(e,r){return fe.or([()=>fe.resolve(this.Ri.containsKey(r)),()=>this.persistence.getTargetCache().containsKey(e,r),()=>this.persistence.Ai(e,r)])}},F0=class t{constructor(e,r){this.persistence=e,this.pi=new tc((o=>COe(o.path)),((o,n)=>o.isEqual(n))),this.garbageCollector=IAe(this,r)}static mi(e,r){return new t(e,r)}Ei(){}di(e){return fe.resolve()}forEachTarget(e,r){return this.persistence.getTargetCache().forEachTarget(e,r)}gr(e){let r=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next((o=>r.next((n=>o+n))))}wr(e){let r=0;return this.pr(e,(o=>{r++})).next((()=>r))}pr(e,r){return fe.forEach(this.pi,((o,n)=>this.br(e,o,n).next((i=>i?fe.resolve():r(n)))))}removeTargets(e,r,o){return this.persistence.getTargetCache().removeTargets(e,r,o)}removeOrphanedDocuments(e,r){let o=0,n=this.persistence.getRemoteDocumentCache(),i=n.newChangeBuffer();return n.ii(e,(a=>this.br(e,a,r).next((s=>{s||(o++,i.removeEntry(a,mt.min()))})))).next((()=>i.apply(e))).next((()=>o))}markPotentiallyOrphaned(e,r){return this.pi.set(r,e.currentSequenceNumber),fe.resolve()}removeTarget(e,r){let o=r.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,o)}addReference(e,r,o){return this.pi.set(o,e.currentSequenceNumber),fe.resolve()}removeReference(e,r,o){return this.pi.set(o,e.currentSequenceNumber),fe.resolve()}updateLimboDocument(e,r){return this.pi.set(r,e.currentSequenceNumber),fe.resolve()}Ti(e){let r=e.key.toString().length;return e.isFoundDocument()&&(r+=g0(e.data.value)),r}br(e,r,o){return fe.or([()=>this.persistence.Ai(e,r),()=>this.persistence.getTargetCache().containsKey(e,r),()=>{let n=this.pi.get(r);return fe.resolve(n!==void 0&&n>o)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var hD=class t{constructor(e,r,o,n){this.targetId=e,this.fromCache=r,this.Es=o,this.ds=n}static As(e,r){let o=$t(),n=$t();for(let i of r.docChanges)switch(i.type){case 0:o=o.add(i.doc.key);break;case 1:n=n.add(i.doc.key)}return new t(e,r.fromCache,o,n)}};var gD=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var _D=class{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=(function(){return Jq()?8:EOe(Yo())>0?6:4})()}initialize(e,r){this.ps=e,this.indexManager=r,this.Rs=!0}getDocumentsMatchingQuery(e,r,o,n){let i={result:null};return this.ys(e,r).next((a=>{i.result=a})).next((()=>{if(!i.result)return this.ws(e,r,n,o).next((a=>{i.result=a}))})).next((()=>{if(i.result)return;let a=new gD;return this.Ss(e,r,a).next((s=>{if(i.result=s,this.Vs)return this.bs(e,r,a,s.size)}))})).next((()=>i.result))}bs(e,r,o,n){return o.documentReadCount<this.fs?(Lm()<=Pt.DEBUG&&Le("QueryEngine","SDK will not create cache indexes for query:",Fm(r),"since it only creates cache indexes for collection contains","more than or equal to",this.fs,"documents"),fe.resolve()):(Lm()<=Pt.DEBUG&&Le("QueryEngine","Query:",Fm(r),"scans",o.documentReadCount,"local documents and returns",n,"documents as results."),o.documentReadCount>this.gs*n?(Lm()<=Pt.DEBUG&&Le("QueryEngine","The SDK decides to create cache indexes for query:",Fm(r),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Zs(r))):fe.resolve())}ys(e,r){if(OY(r))return fe.resolve(null);let o=Zs(r);return this.indexManager.getIndexType(e,o).next((n=>n===0?null:(r.limit!==null&&n===1&&(r=C0(r,null,"F"),o=Zs(r)),this.indexManager.getDocumentsMatchingTarget(e,o).next((i=>{let a=$t(...i);return this.ps.getDocuments(e,a).next((s=>this.indexManager.getMinOffset(e,o).next((l=>{let c=this.Ds(r,s);return this.Cs(r,c,a,l.readTime)?this.ys(e,C0(r,null,"F")):this.vs(e,c,r,l)}))))})))))}ws(e,r,o,n){return OY(r)||n.isEqual(mt.min())?fe.resolve(null):this.ps.getDocuments(e,o).next((i=>{let a=this.Ds(r,i);return this.Cs(r,a,o,n)?fe.resolve(null):(Lm()<=Pt.DEBUG&&Le("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),Fm(r)),this.vs(e,a,r,yOe(n,Bx)).next((s=>s)))}))}Ds(e,r){let o=new Jo(BX(e));return r.forEach(((n,i)=>{nS(e,i)&&(o=o.add(i))})),o}Cs(e,r,o,n){if(e.limit===null)return!1;if(o.size!==r.size)return!0;let i=e.limitType==="F"?r.last():r.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(n)>0)}Ss(e,r,o){return Lm()<=Pt.DEBUG&&Le("QueryEngine","Using full collection scan to execute query:",Fm(r)),this.ps.getDocumentsMatchingQuery(e,r,lf.min(),o)}vs(e,r,o,n){return this.ps.getDocumentsMatchingQuery(e,o,n).next((i=>(r.forEach((a=>{i=i.insert(a.key,a)})),i)))}};var mR="LocalStore",wAe=3e8,xD=class{constructor(e,r,o,n){this.persistence=e,this.Fs=r,this.serializer=n,this.Ms=new Zr(Bt),this.xs=new tc((i=>uR(i)),dR),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(o)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new iD(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(r=>e.collect(r,this.Ms)))}};function EAe(t,e,r,o){return new xD(t,e,r,o)}async function sJ(t,e){let r=gt(t);return await r.persistence.runTransaction("Handle user change","readonly",(o=>{let n;return r.mutationQueue.getAllMutationBatches(o).next((i=>(n=i,r.Bs(e),r.mutationQueue.getAllMutationBatches(o)))).next((i=>{let a=[],s=[],l=$t();for(let c of n){a.push(c.batchId);for(let u of c.mutations)l=l.add(u.key)}for(let c of i){s.push(c.batchId);for(let u of c.mutations)l=l.add(u.key)}return r.localDocuments.getDocuments(o,l).next((c=>({Ls:c,removedBatchIds:a,addedBatchIds:s})))}))}))}function SAe(t,e){let r=gt(t);return r.persistence.runTransaction("Acknowledge batch","readwrite-primary",(o=>{let n=e.batch.keys(),i=r.Ns.newChangeBuffer({trackRemovals:!0});return(function(s,l,c,u){let d=c.batch,f=d.keys(),m=fe.resolve();return f.forEach((h=>{m=m.next((()=>u.getEntry(l,h))).next((g=>{let _=c.docVersions.get(h);Gt(_!==null,48541),g.version.compareTo(_)<0&&(d.applyToRemoteDocument(g,c),g.isValidDocument()&&(g.setReadTime(c.commitVersion),u.addEntry(g)))}))})),m.next((()=>s.mutationQueue.removeMutationBatch(l,d)))})(r,o,e,i).next((()=>i.apply(o))).next((()=>r.mutationQueue.performConsistencyCheck(o))).next((()=>r.documentOverlayCache.removeOverlaysForBatchId(o,n,e.batch.batchId))).next((()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(o,(function(s){let l=$t();for(let c=0;c<s.mutationResults.length;++c)s.mutationResults[c].transformResults.length>0&&(l=l.add(s.batch.mutations[c].key));return l})(e)))).next((()=>r.localDocuments.getDocuments(o,n)))}))}function lJ(t){let e=gt(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(r=>e.Pi.getLastRemoteSnapshotVersion(r)))}function CAe(t,e){let r=gt(t),o=e.snapshotVersion,n=r.Ms;return r.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{let a=r.Ns.newChangeBuffer({trackRemovals:!0});n=r.Ms;let s=[];e.targetChanges.forEach(((u,d)=>{let f=n.get(d);if(!f)return;s.push(r.Pi.removeMatchingKeys(i,u.removedDocuments,d).next((()=>r.Pi.addMatchingKeys(i,u.addedDocuments,d))));let m=f.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(d)!==null?m=m.withResumeToken(Vn.EMPTY_BYTE_STRING,mt.min()).withLastLimboFreeSnapshotVersion(mt.min()):u.resumeToken.approximateByteSize()>0&&(m=m.withResumeToken(u.resumeToken,o)),n=n.insert(d,m),(function(g,_,b){return g.resumeToken.approximateByteSize()===0||_.snapshotVersion.toMicroseconds()-g.snapshotVersion.toMicroseconds()>=wAe?!0:b.addedDocuments.size+b.modifiedDocuments.size+b.removedDocuments.size>0})(f,m,u)&&s.push(r.Pi.updateTargetData(i,m))}));let l=rc(),c=$t();if(e.documentUpdates.forEach((u=>{e.resolvedLimboDocuments.has(u)&&s.push(r.persistence.referenceDelegate.updateLimboDocument(i,u))})),s.push(TAe(i,a,e.documentUpdates).next((u=>{l=u.ks,c=u.qs}))),!o.isEqual(mt.min())){let u=r.Pi.getLastRemoteSnapshotVersion(i).next((d=>r.Pi.setTargetsMetadata(i,i.currentSequenceNumber,o)));s.push(u)}return fe.waitFor(s).next((()=>a.apply(i))).next((()=>r.localDocuments.getLocalViewOfDocuments(i,l,c))).next((()=>l))})).then((i=>(r.Ms=n,i)))}function TAe(t,e,r){let o=$t(),n=$t();return r.forEach((i=>o=o.add(i))),e.getEntries(t,o).next((i=>{let a=rc();return r.forEach(((s,l)=>{let c=i.get(s);l.isFoundDocument()!==c.isFoundDocument()&&(n=n.add(s)),l.isNoDocument()&&l.version.isEqual(mt.min())?(e.removeEntry(s,l.readTime),a=a.insert(s,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),a=a.insert(s,l)):Le(mR,"Ignoring outdated watch update for ",s,". Current version:",c.version," Watch version:",l.version)})),{ks:a,qs:n}}))}function kAe(t,e){let r=gt(t);return r.persistence.runTransaction("Get next mutation batch","readonly",(o=>(e===void 0&&(e=iR),r.mutationQueue.getNextMutationBatchAfterBatchId(o,e))))}function NAe(t,e){let r=gt(t);return r.persistence.runTransaction("Allocate target","readwrite",(o=>{let n;return r.Pi.getTargetData(o,e).next((i=>i?(n=i,fe.resolve(n)):r.Pi.allocateTargetId(o).next((a=>(n=new Hx(e,a,"TargetPurposeListen",o.currentSequenceNumber),r.Pi.addTargetData(o,n).next((()=>n)))))))})).then((o=>{let n=r.Ms.get(o.targetId);return(n===null||o.snapshotVersion.compareTo(n.snapshotVersion)>0)&&(r.Ms=r.Ms.insert(o.targetId,o),r.xs.set(e,o.targetId)),o}))}async function bD(t,e,r){let o=gt(t),n=o.Ms.get(e),i=r?"readwrite":"readwrite-primary";try{r||await o.persistence.runTransaction("Release target",i,(a=>o.persistence.referenceDelegate.removeTarget(a,n)))}catch(a){if(!nh(a))throw a;Le(mR,`Failed to update sequence numbers for target ${e}: ${a}`)}o.Ms=o.Ms.remove(e),o.xs.delete(n.target)}function HY(t,e,r){let o=gt(t),n=mt.min(),i=$t();return o.persistence.runTransaction("Execute query","readwrite",(a=>(function(l,c,u){let d=gt(l),f=d.xs.get(u);return f!==void 0?fe.resolve(d.Ms.get(f)):d.Pi.getTargetData(c,u)})(o,a,Zs(e)).next((s=>{if(s)return n=s.lastLimboFreeSnapshotVersion,o.Pi.getMatchingKeysForTargetId(a,s.targetId).next((l=>{i=l}))})).next((()=>o.Fs.getDocumentsMatchingQuery(a,e,r?n:mt.min(),r?i:$t()))).next((s=>(PAe(o,HOe(e),s),{documents:s,Qs:i})))))}function PAe(t,e,r){let o=t.Os.get(e)||mt.min();r.forEach(((n,i)=>{i.readTime.compareTo(o)>0&&(o=i.readTime)})),t.Os.set(e,o)}var B0=class{constructor(){this.activeTargetIds=YOe()}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}};var yD=class{constructor(){this.Mo=new B0,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,r,o){}addLocalQueryTarget(e,r=!0){return r&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,r,o){this.xo[e]=r}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new B0,Promise.resolve()}handleUserChange(e,r,o){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var vD=class{Oo(e){}shutdown(){}};var jY="ConnectivityMonitor",$0=class{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){Le(jY,"Network connectivity changed: AVAILABLE");for(let e of this.qo)e(0)}ko(){Le(jY,"Network connectivity changed: UNAVAILABLE");for(let e of this.qo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var h0=null;function ID(){return h0===null?h0=(function(){return 268435456+Math.round(2147483648*Math.random())})():h0++,"0x"+h0.toString(16)}var pA="RestConnection",OAe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},wD=class{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let r=e.ssl?"https":"http",o=encodeURIComponent(this.databaseId.projectId),n=encodeURIComponent(this.databaseId.database);this.Uo=r+"://"+e.host,this.Ko=`projects/${o}/databases/${n}`,this.Wo=this.databaseId.database===w0?`project_id=${o}`:`project_id=${o}&database_id=${n}`}Go(e,r,o,n,i){let a=ID(),s=this.zo(e,r.toUriEncodedString());Le(pA,`Sending RPC '${e}' ${a}:`,s,o);let l={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(l,n,i);let{host:c}=new URL(s),u=ss(c);return this.Jo(e,s,l,o,u).then((d=>(Le(pA,`Received RPC '${e}' ${a}: `,d),d)),(d=>{throw Lx(pA,`RPC '${e}' ${a} failed with error: `,d,"url: ",s,"request:",o),d}))}Ho(e,r,o,n,i,a){return this.Go(e,r,o,n,i)}jo(e,r,o){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+rh})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach(((n,i)=>e[i]=n)),o&&o.headers.forEach(((n,i)=>e[i]=n))}zo(e,r){let o=OAe[e];return`${this.Uo}/v1/${r}:${o}`}terminate(){}};var ED=class{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}};var zn="WebChannelConnection",SD=class extends wD{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,r,o,n,i){let a=ID();return new Promise(((s,l)=>{let c=new sA;c.setWithCredentials(!0),c.listenOnce(lA.COMPLETE,(()=>{try{switch(c.getLastErrorCode()){case Nx.NO_ERROR:let d=c.getResponseJson();Le(zn,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(d)),s(d);break;case Nx.TIMEOUT:Le(zn,`RPC '${e}' ${a} timed out`),l(new xe(te.DEADLINE_EXCEEDED,"Request time out"));break;case Nx.HTTP_ERROR:let f=c.getStatus();if(Le(zn,`RPC '${e}' ${a} failed with status:`,f,"response text:",c.getResponseText()),f>0){let m=c.getResponseJson();Array.isArray(m)&&(m=m[0]);let h=m?.error;if(h&&h.status&&h.message){let g=(function(b){let y=b.toLowerCase().replace(/_/g,"-");return Object.values(te).indexOf(y)>=0?y:te.UNKNOWN})(h.status);l(new xe(g,h.message))}else l(new xe(te.UNKNOWN,"Server responded with status "+c.getStatus()))}else l(new xe(te.UNAVAILABLE,"Connection failed."));break;default:rt(9055,{l_:e,streamId:a,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{Le(zn,`RPC '${e}' ${a} completed.`)}}));let u=JSON.stringify(n);Le(zn,`RPC '${e}' ${a} sending request:`,n),c.send(r,"POST",u,o,15)}))}T_(e,r,o){let n=ID(),i=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=dA(),s=uA(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.jo(l.initMessageHeaders,r,o),l.encodeInitMessageHeaders=!0;let u=i.join("");Le(zn,`Creating RPC '${e}' stream ${n}: ${u}`,l);let d=a.createWebChannel(u,l);this.I_(d);let f=!1,m=!1,h=new ED({Yo:_=>{m?Le(zn,`Not sending because RPC '${e}' stream ${n} is closed:`,_):(f||(Le(zn,`Opening RPC '${e}' stream ${n} transport.`),d.open(),f=!0),Le(zn,`RPC '${e}' stream ${n} sending:`,_),d.send(_))},Zo:()=>d.close()}),g=(_,b,y)=>{_.listen(b,(v=>{try{y(v)}catch(C){setTimeout((()=>{throw C}),0)}}))};return g(d,Mm.EventType.OPEN,(()=>{m||(Le(zn,`RPC '${e}' stream ${n} transport opened.`),h.o_())})),g(d,Mm.EventType.CLOSE,(()=>{m||(m=!0,Le(zn,`RPC '${e}' stream ${n} transport closed`),h.a_(),this.E_(d))})),g(d,Mm.EventType.ERROR,(_=>{m||(m=!0,Lx(zn,`RPC '${e}' stream ${n} transport errored. Name:`,_.name,"Message:",_.message),h.a_(new xe(te.UNAVAILABLE,"The operation could not be completed")))})),g(d,Mm.EventType.MESSAGE,(_=>{if(!m){let b=_.data[0];Gt(!!b,16349);let y=b,v=y?.error||y[0]?.error;if(v){Le(zn,`RPC '${e}' stream ${n} received error:`,v);let C=v.status,N=(function(w){let S=wo[w];if(S!==void 0)return XX(S)})(C),I=v.message;N===void 0&&(N=te.INTERNAL,I="Unknown error status: "+C+" with message "+v.message),m=!0,h.a_(new xe(N,I)),d.close()}else Le(zn,`RPC '${e}' stream ${n} received:`,b),h.u_(b)}})),g(s,cA.STAT_EVENT,(_=>{_.stat===f0.PROXY?Le(zn,`RPC '${e}' stream ${n} detected buffering proxy`):_.stat===f0.NOPROXY&&Le(zn,`RPC '${e}' stream ${n} detected no buffering proxy`)})),setTimeout((()=>{h.__()}),0),h}terminate(){this.c_.forEach((e=>e.close())),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter((r=>r===e))}};function mA(){return typeof document<"u"?document:null}function iS(t){return new qA(t,!0)}var Wx=class{constructor(e,r,o=1e3,n=1.5,i=6e4){this.Mi=e,this.timerId=r,this.d_=o,this.A_=n,this.R_=i,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();let r=Math.floor(this.V_+this.y_()),o=Math.max(0,Date.now()-this.f_),n=Math.max(0,r-o);n>0&&Le("ExponentialBackoff",`Backing off for ${n} ms (base delay: ${this.V_} ms, delay with jitter: ${r} ms, last attempt: ${o} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,n,(()=>(this.f_=Date.now(),e()))),this.V_*=this.A_,this.V_<this.d_&&(this.V_=this.d_),this.V_>this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}};var GY="PersistentStream",z0=class{constructor(e,r,o,n,i,a,s,l){this.Mi=e,this.S_=o,this.b_=n,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=s,this.listener=l,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new Wx(e,r)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,(()=>this.k_())))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,r){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():r&&r.code===te.RESOURCE_EXHAUSTED?(Ql(r.toString()),Ql("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):r&&r.code===te.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(r)}K_(){}auth(){this.state=1;let e=this.W_(this.D_),r=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([o,n])=>{this.D_===r&&this.G_(o,n)}),(o=>{e((()=>{let n=new xe(te.UNKNOWN,"Fetching auth token failed: "+o.message);return this.z_(n)}))}))}G_(e,r){let o=this.W_(this.D_);this.stream=this.j_(e,r),this.stream.Xo((()=>{o((()=>this.listener.Xo()))})),this.stream.t_((()=>{o((()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.t_())))})),this.stream.r_((n=>{o((()=>this.z_(n)))})),this.stream.onMessage((n=>{o((()=>++this.F_==1?this.J_(n):this.onNext(n)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return Le(GY,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return r=>{this.Mi.enqueueAndForget((()=>this.D_===e?r():(Le(GY,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}},CD=class extends z0{constructor(e,r,o,n,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,o,n,a),this.serializer=i}j_(e,r){return this.connection.T_("Listen",e,r)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();let r=dAe(this.serializer,e),o=(function(i){if(!("targetChange"in i))return mt.min();let a=i.targetChange;return a.targetIds&&a.targetIds.length?mt.min():a.readTime?Ji(a.readTime):mt.min()})(e);return this.listener.H_(r,o)}Y_(e){let r={};r.database=XA(this.serializer),r.addTarget=(function(i,a){let s,l=a.target;if(s=BA(l)?{documents:pAe(i,l)}:{query:mAe(i,l).ft},s.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){s.resumeToken=JX(i,a.resumeToken);let c=KA(i,a.expectedCount);c!==null&&(s.expectedCount=c)}else if(a.snapshotVersion.compareTo(mt.min())>0){s.readTime=D0(i,a.snapshotVersion.toTimestamp());let c=KA(i,a.expectedCount);c!==null&&(s.expectedCount=c)}return s})(this.serializer,e);let o=gAe(this.serializer,e);o&&(r.labels=o),this.q_(r)}Z_(e){let r={};r.database=XA(this.serializer),r.removeTarget=e,this.q_(r)}},TD=class extends z0{constructor(e,r,o,n,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,o,n,a),this.serializer=i}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,r){return this.connection.T_("Write",e,r)}J_(e){return Gt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Gt(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Gt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();let r=fAe(e.writeResults,e.commitTime),o=Ji(e.commitTime);return this.listener.na(o,r)}ra(){let e={};e.database=XA(this.serializer),this.q_(e)}ea(e){let r={streamToken:this.lastStreamToken,writes:e.map((o=>tJ(this.serializer,o)))};this.q_(r)}};var kD=class{},ND=class extends kD{constructor(e,r,o,n){super(),this.authCredentials=e,this.appCheckCredentials=r,this.connection=o,this.serializer=n,this.ia=!1}sa(){if(this.ia)throw new xe(te.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,r,o,n){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Go(e,YA(r,o),n,i,a))).catch((i=>{throw i.name==="FirebaseError"?(i.code===te.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new xe(te.UNKNOWN,i.toString())}))}Ho(e,r,o,n,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,s])=>this.connection.Ho(e,YA(r,o),n,a,s,i))).catch((a=>{throw a.name==="FirebaseError"?(a.code===te.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new xe(te.UNKNOWN,a.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}},PD=class{constructor(e,r){this.asyncQueue=e,this.onlineStateHandler=r,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve()))))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){let r=`Could not reach Cloud Firestore backend. ${e}
42
+ This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Ql(r),this.aa=!1):Le("OnlineStateTracker",r)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}};var mf="RemoteStore",OD=class{constructor(e,r,o,n,i){this.localStore=e,this.datastore=r,this.asyncQueue=o,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=i,this.Aa.Oo((a=>{o.enqueueAndForget((async()=>{gf(this)&&(Le(mf,"Restarting streams for network reachability change."),await(async function(l){let c=gt(l);c.Ea.add(4),await rb(c),c.Ra.set("Unknown"),c.Ea.delete(4),await aS(c)})(this))}))})),this.Ra=new PD(o,n)}};async function aS(t){if(gf(t))for(let e of t.da)await e(!0)}async function rb(t){for(let e of t.da)await e(!1)}function cJ(t,e){let r=gt(t);r.Ia.has(e.targetId)||(r.Ia.set(e.targetId,e),xR(r)?_R(r):ih(r).O_()&&gR(r,e))}function hR(t,e){let r=gt(t),o=ih(r);r.Ia.delete(e),o.O_()&&uJ(r,e),r.Ia.size===0&&(o.O_()?o.L_():gf(r)&&r.Ra.set("Unknown"))}function gR(t,e){if(t.Va.Ue(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(mt.min())>0){let r=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(r)}ih(t).Y_(e)}function uJ(t,e){t.Va.Ue(e),ih(t).Z_(e)}function _R(t){t.Va=new WA({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),ih(t).start(),t.Ra.ua()}function xR(t){return gf(t)&&!ih(t).x_()&&t.Ia.size>0}function gf(t){return gt(t).Ea.size===0}function dJ(t){t.Va=void 0}async function AAe(t){t.Ra.set("Online")}async function DAe(t){t.Ia.forEach(((e,r)=>{gR(t,e)}))}async function RAe(t,e){dJ(t),xR(t)?(t.Ra.ha(e),_R(t)):t.Ra.set("Unknown")}async function MAe(t,e,r){if(t.Ra.set("Online"),e instanceof O0&&e.state===2&&e.cause)try{await(async function(n,i){let a=i.cause;for(let s of i.targetIds)n.Ia.has(s)&&(await n.remoteSyncer.rejectListen(s,a),n.Ia.delete(s),n.Va.removeTarget(s))})(t,e)}catch(o){Le(mf,"Failed to remove targets %s: %s ",e.targetIds.join(","),o),await U0(t,o)}else if(e instanceof Um?t.Va.Ze(e):e instanceof P0?t.Va.st(e):t.Va.tt(e),!r.isEqual(mt.min()))try{let o=await lJ(t.localStore);r.compareTo(o)>=0&&await(function(i,a){let s=i.Va.Tt(a);return s.targetChanges.forEach(((l,c)=>{if(l.resumeToken.approximateByteSize()>0){let u=i.Ia.get(c);u&&i.Ia.set(c,u.withResumeToken(l.resumeToken,a))}})),s.targetMismatches.forEach(((l,c)=>{let u=i.Ia.get(l);if(!u)return;i.Ia.set(l,u.withResumeToken(Vn.EMPTY_BYTE_STRING,u.snapshotVersion)),uJ(i,l);let d=new Hx(u.target,l,c,u.sequenceNumber);gR(i,d)})),i.remoteSyncer.applyRemoteEvent(s)})(t,r)}catch(o){Le(mf,"Failed to raise snapshot:",o),await U0(t,o)}}async function U0(t,e,r){if(!nh(e))throw e;t.Ea.add(1),await rb(t),t.Ra.set("Offline"),r||(r=()=>lJ(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Le(mf,"Retrying IndexedDB access"),await r(),t.Ea.delete(1),await aS(t)}))}function fJ(t,e){return e().catch((r=>U0(t,r,e)))}async function sS(t){let e=gt(t),r=hu(e),o=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:iR;for(;LAe(e);)try{let n=await kAe(e.localStore,o);if(n===null){e.Ta.length===0&&r.L_();break}o=n.batchId,FAe(e,n)}catch(n){await U0(e,n)}pJ(e)&&mJ(e)}function LAe(t){return gf(t)&&t.Ta.length<10}function FAe(t,e){t.Ta.push(e);let r=hu(t);r.O_()&&r.X_&&r.ea(e.mutations)}function pJ(t){return gf(t)&&!hu(t).x_()&&t.Ta.length>0}function mJ(t){hu(t).start()}async function BAe(t){hu(t).ra()}async function $Ae(t){let e=hu(t);for(let r of t.Ta)e.ea(r.mutations)}async function zAe(t,e,r){let o=t.Ta.shift(),n=VA.from(o,e,r);await fJ(t,(()=>t.remoteSyncer.applySuccessfulWrite(n))),await sS(t)}async function UAe(t,e){e&&hu(t).X_&&await(async function(o,n){if((function(a){return YX(a)&&a!==te.ABORTED})(n.code)){let i=o.Ta.shift();hu(o).B_(),await fJ(o,(()=>o.remoteSyncer.rejectFailedWrite(i.batchId,n))),await sS(o)}})(t,e),pJ(t)&&mJ(t)}async function WY(t,e){let r=gt(t);r.asyncQueue.verifyOperationInProgress(),Le(mf,"RemoteStore received new credentials");let o=gf(r);r.Ea.add(3),await rb(r),o&&r.Ra.set("Unknown"),await r.remoteSyncer.handleCredentialChange(e),r.Ea.delete(3),await aS(r)}async function VAe(t,e){let r=gt(t);e?(r.Ea.delete(2),await aS(r)):e||(r.Ea.add(2),await rb(r),r.Ra.set("Unknown"))}function ih(t){return t.ma||(t.ma=(function(r,o,n){let i=gt(r);return i.sa(),new CD(o,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)})(t.datastore,t.asyncQueue,{Xo:AAe.bind(null,t),t_:DAe.bind(null,t),r_:RAe.bind(null,t),H_:MAe.bind(null,t)}),t.da.push((async e=>{e?(t.ma.B_(),xR(t)?_R(t):t.Ra.set("Unknown")):(await t.ma.stop(),dJ(t))}))),t.ma}function hu(t){return t.fa||(t.fa=(function(r,o,n){let i=gt(r);return i.sa(),new TD(o,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)})(t.datastore,t.asyncQueue,{Xo:()=>Promise.resolve(),t_:BAe.bind(null,t),r_:UAe.bind(null,t),ta:$Ae.bind(null,t),na:zAe.bind(null,t)}),t.da.push((async e=>{e?(t.fa.B_(),await sS(t)):(await t.fa.stop(),t.Ta.length>0&&(Le(mf,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))}))),t.fa}var AD=class t{constructor(e,r,o,n,i){this.asyncQueue=e,this.timerId=r,this.targetTimeMs=o,this.op=n,this.removalCallback=i,this.deferred=new Oa,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((a=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,r,o,n,i){let a=Date.now()+o,s=new t(e,r,a,n,i);return s.start(o),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new xe(te.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function bR(t,e){if(Ql("AsyncQueue",`${e}: ${t}`),nh(t))return new xe(te.UNAVAILABLE,`${e}: ${t}`);throw t}var V0=class t{static emptySet(e){return new t(e.comparator)}constructor(e){this.comparator=e?(r,o)=>e(r,o)||ot.comparator(r.key,o.key):(r,o)=>ot.comparator(r.key,o.key),this.keyedMap=Px(),this.sortedSet=new Zr(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let r=this.keyedMap.get(e);return r?this.sortedSet.indexOf(r):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((r,o)=>(e(r),!1)))}add(e){let r=this.delete(e.key);return r.copy(r.keyedMap.insert(e.key,e),r.sortedSet.insert(e,null))}delete(e){let r=this.get(e);return r?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(r)):this}isEqual(e){if(!(e instanceof t)||this.size!==e.size)return!1;let r=this.sortedSet.getIterator(),o=e.sortedSet.getIterator();for(;r.hasNext();){let n=r.getNext().key,i=o.getNext().key;if(!n.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach((r=>{e.push(r.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
43
43
  `+e.join(`
44
44
  `)+`
45
- )`}copy(e,r){let o=new t;return o.comparator=this.comparator,o.keyedMap=e,o.sortedSet=r,o}};var HE=class{constructor(){this.ga=new Zr(ot.comparator)}track(e){let r=e.doc.key,o=this.ga.get(r);o?e.type!==0&&o.type===3?this.ga=this.ga.insert(r,e):e.type===3&&o.type!==1?this.ga=this.ga.insert(r,{type:o.type,doc:e.doc}):e.type===2&&o.type===2?this.ga=this.ga.insert(r,{type:2,doc:e.doc}):e.type===2&&o.type===0?this.ga=this.ga.insert(r,{type:0,doc:e.doc}):e.type===1&&o.type===0?this.ga=this.ga.remove(r):e.type===1&&o.type===2?this.ga=this.ga.insert(r,{type:1,doc:o.doc}):e.type===0&&o.type===1?this.ga=this.ga.insert(r,{type:2,doc:e.doc}):rt(63341,{Rt:e,pa:o}):this.ga=this.ga.insert(r,e)}ya(){let e=[];return this.ga.inorderTraversal(((r,o)=>{e.push(o)})),e}},Qm=class t{constructor(e,r,o,n,i,a,s,l,c){this.query=e,this.docs=r,this.oldDocs=o,this.docChanges=n,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=s,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,r,o,n,i){let a=[];return r.forEach((s=>{a.push({type:0,doc:s})})),new t(e,r,VE.emptySet(r),a,o,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)&&oS(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let r=this.docChanges,o=e.docChanges;if(r.length!==o.length)return!1;for(let n=0;n<r.length;n++)if(r[n].type!==o[n].type||!r[n].doc.isEqual(o[n].doc))return!1;return!0}};var DD=class{constructor(){this.wa=void 0,this.Sa=[]}ba(){return this.Sa.some((e=>e.Da()))}},RD=class{constructor(){this.queries=qY(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(r,o){let n=gt(r),i=n.queries;n.queries=qY(),i.forEach(((a,s)=>{for(let l of s.Sa)l.onError(o)}))})(this,new xe(te.ABORTED,"Firestore shutting down"))}};function qY(){return new tc((t=>FX(t)),oS)}async function yR(t,e){let r=gt(t),o=3,n=e.query,i=r.queries.get(n);i?!i.ba()&&e.Da()&&(o=2):(i=new DD,o=e.Da()?0:1);try{switch(o){case 0:i.wa=await r.onListen(n,!0);break;case 1:i.wa=await r.onListen(n,!1);break;case 2:await r.onFirstRemoteStoreListen(n)}}catch(a){let s=bR(a,`Initialization of query '${Fm(e.query)}' failed`);return void e.onError(s)}r.queries.set(n,i),i.Sa.push(e),e.va(r.onlineState),i.wa&&e.Fa(i.wa)&&IR(r)}async function vR(t,e){let r=gt(t),o=e.query,n=3,i=r.queries.get(o);if(i){let a=i.Sa.indexOf(e);a>=0&&(i.Sa.splice(a,1),i.Sa.length===0?n=e.Da()?0:1:!i.ba()&&e.Da()&&(n=2))}switch(n){case 0:return r.queries.delete(o),r.onUnlisten(o,!0);case 1:return r.queries.delete(o),r.onUnlisten(o,!1);case 2:return r.onLastRemoteStoreUnlisten(o);default:return}}function HAe(t,e){let r=gt(t),o=!1;for(let n of e){let i=n.query,a=r.queries.get(i);if(a){for(let s of a.Sa)s.Fa(n)&&(o=!0);a.wa=n}}o&&IR(r)}function jAe(t,e,r){let o=gt(t),n=o.queries.get(e);if(n)for(let i of n.Sa)i.onError(r);o.queries.delete(e)}function IR(t){t.Ca.forEach((e=>{e.next()}))}var MD,KY;(KY=MD||(MD={})).Ma="default",KY.Cache="cache";var qx=class{constructor(e,r,o){this.query=e,this.xa=r,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=o||{}}Fa(e){if(!this.options.includeMetadataChanges){let o=[];for(let n of e.docChanges)n.type!==3&&o.push(n);e=new Qm(e.query,e.docs,e.oldDocs,o,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let r=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),r=!0):this.La(e,this.onlineState)&&(this.ka(e),r=!0),this.Na=e,r}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let r=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),r=!0),r}La(e,r){if(!e.fromCache||!this.Da())return!0;let o=r!=="Offline";return(!this.options.qa||!o)&&(!e.docs.isEmpty()||e.hasCachedResults||r==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;let r=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}ka(e){e=Qm.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==MD.Cache}};var jE=class{constructor(e){this.key=e}},GE=class{constructor(e){this.key=e}},LD=class{constructor(e,r){this.query=e,this.Ya=r,this.Za=null,this.hasCachedResults=!1,this.current=!1,this.Xa=$t(),this.mutatedKeys=$t(),this.eu=BX(e),this.tu=new VE(this.eu)}get nu(){return this.Ya}ru(e,r){let o=r?r.iu:new HE,n=r?r.tu:this.tu,i=r?r.mutatedKeys:this.mutatedKeys,a=n,s=!1,l=this.query.limitType==="F"&&n.size===this.query.limit?n.last():null,c=this.query.limitType==="L"&&n.size===this.query.limit?n.first():null;if(e.inorderTraversal(((u,d)=>{let f=n.get(u),m=nS(this.query,d)?d:null,h=!!f&&this.mutatedKeys.has(f.key),g=!!m&&(m.hasLocalMutations||this.mutatedKeys.has(m.key)&&m.hasCommittedMutations),_=!1;f&&m?f.data.isEqual(m.data)?h!==g&&(o.track({type:3,doc:m}),_=!0):this.su(f,m)||(o.track({type:2,doc:m}),_=!0,(l&&this.eu(m,l)>0||c&&this.eu(m,c)<0)&&(s=!0)):!f&&m?(o.track({type:0,doc:m}),_=!0):f&&!m&&(o.track({type:1,doc:f}),_=!0,(l||c)&&(s=!0)),_&&(m?(a=a.add(m),i=g?i.add(u):i.delete(u)):(a=a.delete(u),i=i.delete(u)))})),this.query.limit!==null)for(;a.size>this.query.limit;){let u=this.query.limitType==="F"?a.last():a.first();a=a.delete(u.key),i=i.delete(u.key),o.track({type:1,doc:u})}return{tu:a,iu:o,Cs:s,mutatedKeys:i}}su(e,r){return e.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(e,r,o,n){let i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;let a=e.iu.ya();a.sort(((u,d)=>(function(m,h){let g=_=>{switch(_){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return rt(20277,{Rt:_})}};return g(m)-g(h)})(u.type,d.type)||this.eu(u.doc,d.doc))),this.ou(o),n=n??!1;let s=r&&!n?this._u():[],l=this.Xa.size===0&&this.current&&!n?1:0,c=l!==this.Za;return this.Za=l,a.length!==0||c?{snapshot:new Qm(this.query,e.tu,i,a,e.mutatedKeys,l===0,c,!1,!!o&&o.resumeToken.approximateByteSize()>0),au:s}:{au:s}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new HE,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{au:[]}}uu(e){return!this.Ya.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach((r=>this.Ya=this.Ya.add(r))),e.modifiedDocuments.forEach((r=>{})),e.removedDocuments.forEach((r=>this.Ya=this.Ya.delete(r))),this.current=e.current)}_u(){if(!this.current)return[];let e=this.Xa;this.Xa=$t(),this.tu.forEach((o=>{this.uu(o.key)&&(this.Xa=this.Xa.add(o.key))}));let r=[];return e.forEach((o=>{this.Xa.has(o)||r.push(new GE(o))})),this.Xa.forEach((o=>{e.has(o)||r.push(new jE(o))})),r}cu(e){this.Ya=e.Qs,this.Xa=$t();let r=this.ru(e.documents);return this.applyChanges(r,!0)}lu(){return Qm.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Za===0,this.hasCachedResults)}},wR="SyncEngine",FD=class{constructor(e,r,o){this.query=e,this.targetId=r,this.view=o}},BD=class{constructor(e){this.key=e,this.hu=!1}},$D=class{constructor(e,r,o,n,i,a){this.localStore=e,this.remoteStore=r,this.eventManager=o,this.sharedClientState=n,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Pu={},this.Tu=new tc((s=>FX(s)),oS),this.Iu=new Map,this.Eu=new Set,this.du=new Zr(ot.comparator),this.Au=new Map,this.Ru=new Gx,this.Vu={},this.mu=new Map,this.fu=jx.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}};async function GAe(t,e,r=!0){let o=yJ(t),n,i=o.Tu.get(e);return i?(o.sharedClientState.addLocalQueryTarget(i.targetId),n=i.view.lu()):n=await hJ(o,e,r,!0),n}async function WAe(t,e){let r=yJ(t);await hJ(r,e,!0,!1)}async function hJ(t,e,r,o){let n=await NAe(t.localStore,Zs(e)),i=n.targetId,a=t.sharedClientState.addLocalQueryTarget(i,r),s;return o&&(s=await qAe(t,e,i,a==="current",n.resumeToken)),t.isPrimaryClient&&r&&cJ(t.remoteStore,n),s}async function qAe(t,e,r,o,n){t.pu=(d,f,m)=>(async function(g,_,b,y){let v=_.view.ru(b);v.Cs&&(v=await HY(g.localStore,_.query,!1).then((({documents:E})=>_.view.ru(E,v))));let C=y&&y.targetChanges.get(_.targetId),N=y&&y.targetMismatches.get(_.targetId)!=null,I=_.view.applyChanges(v,g.isPrimaryClient,C,N);return XY(g,_.targetId,I.au),I.snapshot})(t,d,f,m);let i=await HY(t.localStore,e,!0),a=new LD(e,i.Qs),s=a.ru(i.documents),l=Vx.createSynthesizedTargetChangeForCurrentChange(r,o&&t.onlineState!=="Offline",n),c=a.applyChanges(s,t.isPrimaryClient,l);XY(t,r,c.au);let u=new FD(e,r,a);return t.Tu.set(e,u),t.Iu.has(r)?t.Iu.get(r).push(e):t.Iu.set(r,[e]),c.snapshot}async function KAe(t,e,r){let o=gt(t),n=o.Tu.get(e),i=o.Iu.get(n.targetId);if(i.length>1)return o.Iu.set(n.targetId,i.filter((a=>!oS(a,e)))),void o.Tu.delete(e);o.isPrimaryClient?(o.sharedClientState.removeLocalQueryTarget(n.targetId),o.sharedClientState.isActiveQueryTarget(n.targetId)||await bD(o.localStore,n.targetId,!1).then((()=>{o.sharedClientState.clearQueryState(n.targetId),r&&hR(o.remoteStore,n.targetId),zD(o,n.targetId)})).catch(oh)):(zD(o,n.targetId),await bD(o.localStore,n.targetId,!0))}async function YAe(t,e){let r=gt(t),o=r.Tu.get(e),n=r.Iu.get(o.targetId);r.isPrimaryClient&&n.length===1&&(r.sharedClientState.removeLocalQueryTarget(o.targetId),hR(r.remoteStore,o.targetId))}async function XAe(t,e,r){let o=oDe(t);try{let n=await(function(a,s){let l=gt(a),c=Tt.now(),u=s.reduce(((m,h)=>m.add(h.key)),$t()),d,f;return l.persistence.runTransaction("Locally write mutations","readwrite",(m=>{let h=rc(),g=$t();return l.Ns.getEntries(m,u).next((_=>{h=_,h.forEach(((b,y)=>{y.isValidDocument()||(g=g.add(b))}))})).next((()=>l.localDocuments.getOverlayedDocuments(m,h))).next((_=>{d=_;let b=[];for(let y of s){let v=tAe(y,d.get(y.key).overlayedDocument);v!=null&&b.push(new tl(y.key,v,PX(v.value.mapValue),Nn.exists(!0)))}return l.mutationQueue.addMutationBatch(m,c,b,s)})).next((_=>{f=_;let b=_.applyToLocalDocumentSet(d,g);return l.documentOverlayCache.saveOverlays(m,_.batchId,b)}))})).then((()=>({batchId:f.batchId,changes:zX(d)})))})(o.localStore,e);o.sharedClientState.addPendingMutation(n.batchId),(function(a,s,l){let c=a.Vu[a.currentUser.toKey()];c||(c=new Zr(Bt)),c=c.insert(s,l),a.Vu[a.currentUser.toKey()]=c})(o,n.batchId,r),await ob(o,n.changes),await sS(o.remoteStore)}catch(n){let i=bR(n,"Failed to persist write");r.reject(i)}}async function gJ(t,e){let r=gt(t);try{let o=await CAe(r.localStore,e);e.targetChanges.forEach(((n,i)=>{let a=r.Au.get(i);a&&(Gt(n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size<=1,22616),n.addedDocuments.size>0?a.hu=!0:n.modifiedDocuments.size>0?Gt(a.hu,14607):n.removedDocuments.size>0&&(Gt(a.hu,42227),a.hu=!1))})),await ob(r,o,e)}catch(o){await oh(o)}}function YY(t,e,r){let o=gt(t);if(o.isPrimaryClient&&r===0||!o.isPrimaryClient&&r===1){let n=[];o.Tu.forEach(((i,a)=>{let s=a.view.va(e);s.snapshot&&n.push(s.snapshot)})),(function(a,s){let l=gt(a);l.onlineState=s;let c=!1;l.queries.forEach(((u,d)=>{for(let f of d.Sa)f.va(s)&&(c=!0)})),c&&IR(l)})(o.eventManager,e),n.length&&o.Pu.H_(n),o.onlineState=e,o.isPrimaryClient&&o.sharedClientState.setOnlineState(e)}}async function JAe(t,e,r){let o=gt(t);o.sharedClientState.updateQueryState(e,"rejected",r);let n=o.Au.get(e),i=n&&n.key;if(i){let a=new Zr(ot.comparator);a=a.insert(i,Qi.newNoDocument(i,mt.min()));let s=$t().add(i),l=new NE(mt.min(),new Map,new Zr(Bt),a,s);await gJ(o,l),o.du=o.du.remove(i),o.Au.delete(e),ER(o)}else await bD(o.localStore,e,!1).then((()=>zD(o,e,r))).catch(oh)}async function QAe(t,e){let r=gt(t),o=e.batch.batchId;try{let n=await SAe(r.localStore,e);xJ(r,o,null),_J(r,o),r.sharedClientState.updateMutationState(o,"acknowledged"),await ob(r,n)}catch(n){await oh(n)}}async function ZAe(t,e,r){let o=gt(t);try{let n=await(function(a,s){let l=gt(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",(c=>{let u;return l.mutationQueue.lookupMutationBatch(c,s).next((d=>(Gt(d!==null,37113),u=d.keys(),l.mutationQueue.removeMutationBatch(c,d)))).next((()=>l.mutationQueue.performConsistencyCheck(c))).next((()=>l.documentOverlayCache.removeOverlaysForBatchId(c,u,s))).next((()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,u))).next((()=>l.localDocuments.getDocuments(c,u)))}))})(o.localStore,e);xJ(o,e,r),_J(o,e),o.sharedClientState.updateMutationState(e,"rejected",r),await ob(o,n)}catch(n){await oh(n)}}function _J(t,e){(t.mu.get(e)||[]).forEach((r=>{r.resolve()})),t.mu.delete(e)}function xJ(t,e,r){let o=gt(t),n=o.Vu[o.currentUser.toKey()];if(n){let i=n.get(e);i&&(r?i.reject(r):i.resolve(),n=n.remove(e)),o.Vu[o.currentUser.toKey()]=n}}function zD(t,e,r=null){t.sharedClientState.removeLocalQueryTarget(e);for(let o of t.Iu.get(e))t.Tu.delete(o),r&&t.Pu.yu(o,r);t.Iu.delete(e),t.isPrimaryClient&&t.Ru.jr(e).forEach((o=>{t.Ru.containsKey(o)||bJ(t,o)}))}function bJ(t,e){t.Eu.delete(e.path.canonicalString());let r=t.du.get(e);r!==null&&(hR(t.remoteStore,r),t.du=t.du.remove(e),t.Au.delete(r),ER(t))}function XY(t,e,r){for(let o of r)o instanceof jE?(t.Ru.addReference(o.key,e),eDe(t,o)):o instanceof GE?(Le(wR,"Document no longer in limbo: "+o.key),t.Ru.removeReference(o.key,e),t.Ru.containsKey(o.key)||bJ(t,o.key)):rt(19791,{wu:o})}function eDe(t,e){let r=e.key,o=r.path.canonicalString();t.du.get(r)||t.Eu.has(o)||(Le(wR,"New document in limbo: "+r),t.Eu.add(o),ER(t))}function ER(t){for(;t.Eu.size>0&&t.du.size<t.maxConcurrentLimboResolutions;){let e=t.Eu.values().next().value;t.Eu.delete(e);let r=new ot(Sr.fromString(e)),o=t.fu.next();t.Au.set(o,new BD(r)),t.du=t.du.insert(r,o),cJ(t.remoteStore,new Hx(Zs(rS(r.path)),o,"TargetPurposeLimboResolution",jm.ce))}}async function ob(t,e,r){let o=gt(t),n=[],i=[],a=[];o.Tu.isEmpty()||(o.Tu.forEach(((s,l)=>{a.push(o.pu(l,e,r).then((c=>{if((c||r)&&o.isPrimaryClient){let u=c?!c.fromCache:r?.targetChanges.get(l.targetId)?.current;o.sharedClientState.updateQueryState(l.targetId,u?"current":"not-current")}if(c){n.push(c);let u=hD.As(l.targetId,c);i.push(u)}})))})),await Promise.all(a),o.Pu.H_(n),await(async function(l,c){let u=gt(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",(d=>fe.forEach(c,(f=>fe.forEach(f.Es,(m=>u.persistence.referenceDelegate.addReference(d,f.targetId,m))).next((()=>fe.forEach(f.ds,(m=>u.persistence.referenceDelegate.removeReference(d,f.targetId,m)))))))))}catch(d){if(!nh(d))throw d;Le(mR,"Failed to update sequence numbers: "+d)}for(let d of c){let f=d.targetId;if(!d.fromCache){let m=u.Ms.get(f),h=m.snapshotVersion,g=m.withLastLimboFreeSnapshotVersion(h);u.Ms=u.Ms.insert(f,g)}}})(o.localStore,i))}async function tDe(t,e){let r=gt(t);if(!r.currentUser.isEqual(e)){Le(wR,"User change. New user:",e.toKey());let o=await sJ(r.localStore,e);r.currentUser=e,(function(i,a){i.mu.forEach((s=>{s.forEach((l=>{l.reject(new xe(te.CANCELLED,a))}))})),i.mu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(e,o.removedBatchIds,o.addedBatchIds),await ob(r,o.Ls)}}function rDe(t,e){let r=gt(t),o=r.Au.get(e);if(o&&o.hu)return $t().add(o.key);{let n=$t(),i=r.Iu.get(e);if(!i)return n;for(let a of i){let s=r.Tu.get(a);n=n.unionWith(s.view.nu)}return n}}function yJ(t){let e=gt(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=gJ.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=rDe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=JAe.bind(null,e),e.Pu.H_=HAe.bind(null,e.eventManager),e.Pu.yu=jAe.bind(null,e.eventManager),e}function oDe(t){let e=gt(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=QAe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ZAe.bind(null,e),e}var Zm=class{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=iS(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,r){return null}Mu(e,r){return null}vu(e){return EAe(this.persistence,new _D,e.initialUser,this.serializer)}Cu(e){return new LE(mD.mi,this.serializer)}Du(e){return new yD}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Zm.provider={build:()=>new Zm};var UD=class extends Zm{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,r){Gt(this.persistence.referenceDelegate instanceof FE,46915);let o=this.persistence.referenceDelegate.garbageCollector;return new tD(o,e.asyncQueue,r)}Cu(e){let r=this.cacheSizeBytes!==void 0?Na.withCacheSize(this.cacheSizeBytes):Na.DEFAULT;return new LE((o=>FE.mi(o,r)),this.serializer)}};var Kx=class{async initialize(e,r){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=o=>YY(this.syncEngine,o,1),this.remoteStore.remoteSyncer.handleCredentialChange=tDe.bind(null,this.syncEngine),await VAe(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new RD})()}createDatastore(e){let r=iS(e.databaseInfo.databaseId),o=(function(i){return new SD(i)})(e.databaseInfo);return(function(i,a,s,l){return new ND(i,a,s,l)})(e.authCredentials,e.appCheckCredentials,o,r)}createRemoteStore(e){return(function(o,n,i,a,s){return new OD(o,n,i,a,s)})(this.localStore,this.datastore,e.asyncQueue,(r=>YY(this.syncEngine,r,0)),(function(){return $E.v()?new $E:new vD})())}createSyncEngine(e,r){return(function(n,i,a,s,l,c,u){let d=new $D(n,i,a,s,l,c);return u&&(d.gu=!0),d})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,r)}async terminate(){await(async function(r){let o=gt(r);Le(mf,"RemoteStore shutting down."),o.Ea.add(5),await rb(o),o.Aa.shutdown(),o.Ra.set("Unknown")})(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};Kx.provider={build:()=>new Kx};var Yx=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Ql("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,r){setTimeout((()=>{this.muted||e(r)}),0)}};var VD=class{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 xe(te.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let r=await(async function(n,i){let a=gt(n),s={documents:i.map((d=>RE(a.serializer,d)))},l=await a.Ho("BatchGetDocuments",a.serializer.databaseId,Sr.emptyPath(),s,i.length),c=new Map;l.forEach((d=>{let f=uAe(a.serializer,d);c.set(f.key.toString(),f)}));let u=[];return i.forEach((d=>{let f=c.get(d.toString());Gt(!!f,55234,{key:d}),u.push(f)})),u})(this.datastore,e);return r.forEach((o=>this.recordVersion(o))),r}set(e,r){this.write(r.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,r){try{this.write(r.toMutation(e,this.preconditionForUpdate(e)))}catch(o){this.lastTransactionError=o}this.writtenDocs.add(e.toString())}delete(e){this.write(new pf(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((r=>{e.delete(r.key.toString())})),e.forEach(((r,o)=>{let n=ot.fromPath(o);this.mutations.push(new kE(n,this.precondition(n)))})),await(async function(o,n){let i=gt(o),a={writes:n.map((s=>tJ(i.serializer,s)))};await i.Go("Commit",i.serializer.databaseId,Sr.emptyPath(),a)})(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let r;if(e.isFoundDocument())r=e.version;else{if(!e.isNoDocument())throw rt(50498,{Gu:e.constructor.name});r=mt.min()}let o=this.readVersions.get(e.key.toString());if(o){if(!r.isEqual(o))throw new xe(te.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),r)}precondition(e){let r=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&r?r.isEqual(mt.min())?Nn.exists(!1):Nn.updateTime(r):Nn.none()}preconditionForUpdate(e){let r=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&r){if(r.isEqual(mt.min()))throw new xe(te.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Nn.updateTime(r)}return Nn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var HD=class{constructor(e,r,o,n,i){this.asyncQueue=e,this.datastore=r,this.options=o,this.updateFunction=n,this.deferred=i,this.zu=o.maxAttempts,this.M_=new Wx(this.asyncQueue,"transaction_retry")}ju(){this.zu-=1,this.Ju()}Ju(){this.M_.p_((async()=>{let e=new VD(this.datastore),r=this.Hu(e);r&&r.then((o=>{this.asyncQueue.enqueueAndForget((()=>e.commit().then((()=>{this.deferred.resolve(o)})).catch((n=>{this.Yu(n)}))))})).catch((o=>{this.Yu(o)}))}))}Hu(e){try{let r=this.updateFunction(e);return!tb(r)&&r.catch&&r.then?r:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.deferred.reject(r),null}}Yu(e){this.zu>0&&this.Zu(e)?(this.zu-=1,this.asyncQueue.enqueueAndForget((()=>(this.Ju(),Promise.resolve())))):this.deferred.reject(e)}Zu(e){if(e?.name==="FirebaseError"){let r=e.code;return r==="aborted"||r==="failed-precondition"||r==="already-exists"||!YX(r)}return!1}};var gu="FirestoreClient",jD=class{constructor(e,r,o,n,i){this.authCredentials=e,this.appCheckCredentials=r,this.asyncQueue=o,this.databaseInfo=n,this.user=Un.UNAUTHENTICATED,this.clientId=Fx.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(o,(async a=>{Le(gu,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a})),this.appCheckCredentials.start(o,(a=>(Le(gu,"Received new app check token=",a),this.appCheckCredentialListener(a,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 Oa;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 o=bR(r,"Failed to shutdown persistence");e.reject(o)}})),e.promise}};async function hA(t,e){t.asyncQueue.verifyOperationInProgress(),Le(gu,"Initializing OfflineComponentProvider");let r=t.configuration;await e.initialize(r);let o=r.initialUser;t.setCredentialChangeListener((async n=>{o.isEqual(n)||(await sJ(e.localStore,n),o=n)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t._offlineComponents=e}async function JY(t,e){t.asyncQueue.verifyOperationInProgress();let r=await nDe(t);Le(gu,"Initializing OnlineComponentProvider"),await e.initialize(r,t.configuration),t.setCredentialChangeListener((o=>WY(e.remoteStore,o))),t.setAppCheckTokenChangeListener(((o,n)=>WY(e.remoteStore,n))),t._onlineComponents=e}async function nDe(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){Le(gu,"Using user provided OfflineComponentProvider");try{await hA(t,t._uninitializedComponentsProvider._offline)}catch(e){let r=e;if(!(function(n){return n.name==="FirebaseError"?n.code===te.FAILED_PRECONDITION||n.code===te.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11})(r))throw r;Lx("Error using user provided cache. Falling back to memory cache: "+r),await hA(t,new Zm)}}else Le(gu,"Using default OfflineComponentProvider"),await hA(t,new UD(void 0));return t._offlineComponents}async function SR(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(Le(gu,"Using user provided OnlineComponentProvider"),await JY(t,t._uninitializedComponentsProvider._online)):(Le(gu,"Using default OnlineComponentProvider"),await JY(t,new Kx))),t._onlineComponents}function iDe(t){return SR(t).then((e=>e.syncEngine))}function aDe(t){return SR(t).then((e=>e.datastore))}async function WE(t){let e=await SR(t),r=e.eventManager;return r.onListen=GAe.bind(null,e.syncEngine),r.onUnlisten=KAe.bind(null,e.syncEngine),r.onFirstRemoteStoreListen=WAe.bind(null,e.syncEngine),r.onLastRemoteStoreUnlisten=YAe.bind(null,e.syncEngine),r}function sDe(t,e,r={}){let o=new Oa;return t.asyncQueue.enqueueAndForget((async()=>(function(i,a,s,l,c){let u=new Yx({next:f=>{u.Nu(),a.enqueueAndForget((()=>vR(i,d)));let m=f.docs.has(s);!m&&f.fromCache?c.reject(new xe(te.UNAVAILABLE,"Failed to get document because the client is offline.")):m&&f.fromCache&&l&&l.source==="server"?c.reject(new xe(te.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.)')):c.resolve(f)},error:f=>c.reject(f)}),d=new qx(rS(s.path),u,{includeMetadataChanges:!0,qa:!0});return yR(i,d)})(await WE(t),t.asyncQueue,e,r,o))),o.promise}function lDe(t,e,r={}){let o=new Oa;return t.asyncQueue.enqueueAndForget((async()=>(function(i,a,s,l,c){let u=new Yx({next:f=>{u.Nu(),a.enqueueAndForget((()=>vR(i,d))),f.fromCache&&l.source==="server"?c.reject(new xe(te.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.)')):c.resolve(f)},error:f=>c.reject(f)}),d=new qx(s,u,{includeMetadataChanges:!0,qa:!0});return yR(i,d)})(await WE(t),t.asyncQueue,e,r,o))),o.promise}function vJ(t){let e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}var QY=new Map;var cDe="firestore.googleapis.com",ZY=!0,qE=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new xe(te.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=cDe,this.ssl=ZY}else this.host=e.host,this.ssl=e.ssl??ZY;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=iJ;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<aJ)throw new xe(te.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}xOe("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=vJ(e.experimentalLongPollingOptions??{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(o,n){return o.timeoutSeconds===n.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Xx=class{constructor(e,r,o,n){this._authCredentials=e,this._appCheckCredentials=r,this._databaseId=o,this._app=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new qE({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new xe(te.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new xe(te.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 qE(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(o){if(!o)return new _A;switch(o.type){case"firstParty":return new yA(o.sessionIndex||"0",o.iamToken||null,o.authTokenFactory||null);case"provider":return o.client;default:throw new xe(te.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){let o=QY.get(r);o&&(Le("ComponentProvider","Removing Datastore"),QY.delete(r),o.terminate())})(this),Promise.resolve()}};var oc=class t{constructor(e,r,o){this.converter=r,this._query=o,this.type="query",this.firestore=e}withConverter(e){return new t(this.firestore,e,this._query)}},To=class t{constructor(e,r,o){this.converter=r,this._key=o,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 lu(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new t(this.firestore,e,this._key)}toJSON(){return{type:t._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,r,o){if(eb(r,t._jsonSchema))return new t(e,o||null,new ot(Sr.fromString(r.referencePath)))}};To._jsonSchemaVersion="firestore/documentReference/1.0",To._jsonSchema={type:Co("string",To._jsonSchemaVersion),referencePath:Co("string")};var lu=class t extends oc{constructor(e,r,o){super(e,r,rS(o)),this._path=o,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 To(this.firestore,null,new ot(e))}withConverter(e){return new t(this.firestore,e,this._path)}};function Zi(t,e,...r){if(t=vr(t),aX("collection","path",e),t instanceof Xx){let o=Sr.fromString(e,...r);return xY(o),new lu(t,null,o)}{if(!(t instanceof To||t instanceof lu))throw new xe(te.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let o=t._path.child(Sr.fromString(e,...r));return xY(o),new lu(t.firestore,null,o)}}function $e(t,e,...r){if(t=vr(t),arguments.length===1&&(e=Fx.newId()),aX("doc","path",e),t instanceof Xx){let o=Sr.fromString(e,...r);return _Y(o),new To(t,null,new ot(o))}{if(!(t instanceof To||t instanceof lu))throw new xe(te.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let o=t._path.child(Sr.fromString(e,...r));return _Y(o),new To(t.firestore,t instanceof lu?t.converter:null,new ot(o))}}var eX="AsyncQueue",KE=class{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new Wx(this,"async_queue_retry"),this._c=()=>{let o=mA();o&&Le(eX,"Visibility state changed to "+o.visibilityState),this.M_.w_()},this.ac=e;let r=mA();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;let r=mA();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));let r=new Oa;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(r.resolve,r.reject),r.promise))).then((()=>r.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Xu.push(e),this.lc())))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!nh(e))throw e;Le(eX,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){let r=this.ac.then((()=>(this.rc=!0,e().catch((o=>{throw this.nc=o,this.rc=!1,Ql("INTERNAL UNHANDLED ERROR: ",tX(o)),o})).then((o=>(this.rc=!1,o))))));return this.ac=r,r}enqueueAfterDelay(e,r,o){this.uc(),this.oc.indexOf(e)>-1&&(r=0);let n=AD.createAndSchedule(this,e,r,o,(i=>this.hc(i)));return this.tc.push(n),n}uc(){this.nc&&rt(47125,{Pc:tX(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(let r of this.tc)if(r.timerId===e)return!0;return!1}Ec(e){return this.Tc().then((()=>{this.tc.sort(((r,o)=>r.targetTimeMs-o.targetTimeMs));for(let r of this.tc)if(r.skipDelay(),e!=="all"&&r.timerId===e)break;return this.Tc()}))}dc(e){this.oc.push(e)}hc(e){let r=this.tc.indexOf(e);this.tc.splice(r,1)}};function tX(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
46
- `+t.stack),e}function rX(t){return(function(r,o){if(typeof r!="object"||r===null)return!1;let n=r;for(let i of o)if(i in n&&typeof n[i]=="function")return!0;return!1})(t,["next","error","complete"])}var Aa=class extends Xx{constructor(e,r,o,n){super(e,r,o,n),this.type="firestore",this._queue=new KE,this._persistenceKey=n?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new KE(e),this._firestoreClient=void 0,await e}}};function IJ(t,e,r){r||(r=wE);let o=Yd(t,"firestore");if(o.isInitialized(r)){let n=o.getImmediate({identifier:r}),i=o.getOptions(r);if(ls(i,e))return n;throw new xe(te.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new xe(te.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<aJ)throw new xe(te.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&ss(e.host)&&km(e.host),o.initialize({options:e,instanceIdentifier:r})}function ah(t){if(t._terminated)throw new xe(te.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||uDe(t),t._firestoreClient}function uDe(t){let e=t._freezeSettings(),r=(function(n,i,a,s){return new CA(n,i,a,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,vJ(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator)})(t._databaseId,t._app?.options.appId||"",t._persistenceKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new jD(t._authCredentials,t._appCheckCredentials,t._queue,r,t._componentsProvider&&(function(n){let i=n?._online.build();return{_offline:n?._offline.build(i),_online:i}})(t._componentsProvider))}var Jl=class t{constructor(e){this._byteString=e}static fromBase64String(e){try{return new t(Vn.fromBase64String(e))}catch(r){throw new xe(te.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+r)}}static fromUint8Array(e){return new t(Vn.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:t._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(eb(e,t._jsonSchema))return t.fromBase64String(e.bytes)}};Jl._jsonSchemaVersion="firestore/bytes/1.0",Jl._jsonSchema={type:Co("string",Jl._jsonSchemaVersion),bytes:Co("string")};var Pn=class{constructor(...e){for(let r=0;r<e.length;++r)if(e[r].length===0)throw new xe(te.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Xi(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};function nb(){return new Pn(wA)}var hf=class{constructor(e){this._methodName=e}};var cu=class t{constructor(e,r){if(!isFinite(e)||e<-90||e>90)throw new xe(te.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(r)||r<-180||r>180)throw new xe(te.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=e,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Bt(this._lat,e._lat)||Bt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:t._jsonSchemaVersion}}static fromJSON(e){if(eb(e,t._jsonSchema))return new t(e.latitude,e.longitude)}};cu._jsonSchemaVersion="firestore/geoPoint/1.0",cu._jsonSchema={type:Co("string",cu._jsonSchemaVersion),latitude:Co("number"),longitude:Co("number")};var uu=class t{constructor(e){this._values=(e||[]).map((r=>r))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(o,n){if(o.length!==n.length)return!1;for(let i=0;i<o.length;++i)if(o[i]!==n[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:t._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(eb(e,t._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((r=>typeof r=="number")))return new t(e.vectorValues);throw new xe(te.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};uu._jsonSchemaVersion="firestore/vectorValue/1.0",uu._jsonSchema={type:Co("string",uu._jsonSchemaVersion),vectorValues:Co("object")};var dDe=/^__.*__$/,GD=class{constructor(e,r,o){this.data=e,this.fieldMask=r,this.fieldTransforms=o}toMutation(e,r){return this.fieldMask!==null?new tl(e,this.data,this.fieldMask,r,this.fieldTransforms):new ff(e,this.data,r,this.fieldTransforms)}},YE=class{constructor(e,r,o){this.data=e,this.fieldMask=r,this.fieldTransforms=o}toMutation(e,r){return new tl(e,this.data,this.fieldMask,r,this.fieldTransforms)}};function wJ(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw rt(40011,{Ac:t})}}var XE=class t{constructor(e,r,o,n,i,a){this.settings=e,this.databaseId=r,this.serializer=o,this.ignoreUndefinedProperties=n,i===void 0&&this.Rc(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Ac(){return this.settings.Ac}Vc(e){return new t({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}mc(e){let r=this.path?.child(e),o=this.Vc({path:r,fc:!1});return o.gc(e),o}yc(e){let r=this.path?.child(e),o=this.Vc({path:r,fc:!1});return o.Rc(),o}wc(e){return this.Vc({path:void 0,fc:!0})}Sc(e){return JE(e,this.settings.methodName,this.settings.bc||!1,this.path,this.settings.Dc)}contains(e){return this.fieldMask.find((r=>e.isPrefixOf(r)))!==void 0||this.fieldTransforms.find((r=>e.isPrefixOf(r.field)))!==void 0}Rc(){if(this.path)for(let e=0;e<this.path.length;e++)this.gc(this.path.get(e))}gc(e){if(e.length===0)throw this.Sc("Document fields must not be empty");if(wJ(this.Ac)&&dDe.test(e))throw this.Sc('Document fields cannot begin and end with "__"')}},WD=class{constructor(e,r,o){this.databaseId=e,this.ignoreUndefinedProperties=r,this.serializer=o||iS(e)}Cc(e,r,o,n=!1){return new XE({Ac:e,methodName:r,Dc:o,path:Xi.emptyPath(),fc:!1,bc:n},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function ib(t){let e=t._freezeSettings(),r=iS(t._databaseId);return new WD(t._databaseId,!!e.ignoreUndefinedProperties,r)}function CR(t,e,r,o,n,i={}){let a=t.Cc(i.merge||i.mergeFields?2:0,e,r,n);NR("Data must be an object, but it was:",a,o);let s=EJ(o,a),l,c;if(i.merge)l=new Pa(a.fieldMask),c=a.fieldTransforms;else if(i.mergeFields){let u=[];for(let d of i.mergeFields){let f=YD(e,d,r);if(!a.contains(f))throw new xe(te.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);CJ(u,f)||u.push(f)}l=new Pa(u),c=a.fieldTransforms.filter((d=>l.covers(d.field)))}else l=null,c=a.fieldTransforms;return new GD(new wi(s),l,c)}var Jx=class t extends hf{_toFieldTransform(e){if(e.Ac!==2)throw e.Ac===1?e.Sc(`${this._methodName}() can only appear at the top level of your update data`):e.Sc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof t}};function fDe(t,e,r){return new XE({Ac:3,Dc:e.settings.Dc,methodName:t._methodName,fc:r},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}var qD=class t extends hf{_toFieldTransform(e){return new TE(e.path,new uf)}isEqual(e){return e instanceof t}},KD=class t extends hf{constructor(e,r){super(e),this.vc=r}_toFieldTransform(e){let r=fDe(this,e,!0),o=this.vc.map((i=>sh(i,r))),n=new mu(o);return new TE(e.path,n)}isEqual(e){return e instanceof t&&ls(this.vc,e.vc)}};function TR(t,e,r,o){let n=t.Cc(1,e,r);NR("Data must be an object, but it was:",n,o);let i=[],a=wi.empty();_u(o,((l,c)=>{let u=PR(e,l,r);c=vr(c);let d=n.yc(u);if(c instanceof Jx)i.push(u);else{let f=sh(c,d);f!=null&&(i.push(u),a.set(u,f))}}));let s=new Pa(i);return new YE(a,s,n.fieldTransforms)}function kR(t,e,r,o,n,i){let a=t.Cc(1,e,r),s=[YD(e,o,r)],l=[n];if(i.length%2!=0)throw new xe(te.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<i.length;f+=2)s.push(YD(e,i[f])),l.push(i[f+1]);let c=[],u=wi.empty();for(let f=s.length-1;f>=0;--f)if(!CJ(c,s[f])){let m=s[f],h=l[f];h=vr(h);let g=a.yc(m);if(h instanceof Jx)c.push(m);else{let _=sh(h,g);_!=null&&(c.push(m),u.set(m,_))}}let d=new Pa(c);return new YE(u,d,a.fieldTransforms)}function pDe(t,e,r,o=!1){return sh(r,t.Cc(o?4:3,e))}function sh(t,e){if(SJ(t=vr(t)))return NR("Unsupported field value:",e,t),EJ(t,e);if(t instanceof hf)return(function(o,n){if(!wJ(n.Ac))throw n.Sc(`${o._methodName}() can only be used with update() and set()`);if(!n.path)throw n.Sc(`${o._methodName}() is not currently supported inside arrays`);let i=o._toFieldTransform(n);i&&n.fieldTransforms.push(i)})(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.fc&&e.Ac!==4)throw e.Sc("Nested arrays are not supported");return(function(o,n){let i=[],a=0;for(let s of o){let l=sh(s,n.wc(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}})(t,e)}return(function(o,n){if((o=vr(o))===null)return{nullValue:"NULL_VALUE"};if(typeof o=="number")return XOe(n.serializer,o);if(typeof o=="boolean")return{booleanValue:o};if(typeof o=="string")return{stringValue:o};if(o instanceof Date){let i=Tt.fromDate(o);return{timestampValue:DE(n.serializer,i)}}if(o instanceof Tt){let i=new Tt(o.seconds,1e3*Math.floor(o.nanoseconds/1e3));return{timestampValue:DE(n.serializer,i)}}if(o instanceof cu)return{geoPointValue:{latitude:o.latitude,longitude:o.longitude}};if(o instanceof Jl)return{bytesValue:JX(n.serializer,o._byteString)};if(o instanceof To){let i=n.databaseId,a=o.firestore._databaseId;if(!a.isEqual(i))throw n.Sc(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:pR(o.firestore._databaseId||n.databaseId,o._key.path)}}if(o instanceof uu)return(function(a,s){return{mapValue:{fields:{[sR]:{stringValue:lR},[Gm]:{arrayValue:{values:a.toArray().map((c=>{if(typeof c!="number")throw s.Sc("VectorValues must only contain numeric values.");return fR(s.serializer,c)}))}}}}}})(o,n);throw n.Sc(`Unsupported field value: ${eS(o)}`)})(t,e)}function EJ(t,e){let r={};return IX(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):_u(t,((o,n)=>{let i=sh(n,e.mc(o));i!=null&&(r[o]=i)})),{mapValue:{fields:r}}}function SJ(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Tt||t instanceof cu||t instanceof Jl||t instanceof To||t instanceof hf||t instanceof uu)}function NR(t,e,r){if(!SJ(r)||!sX(r)){let o=eS(r);throw o==="an object"?e.Sc(t+" a custom object"):e.Sc(t+" "+o)}}function YD(t,e,r){if((e=vr(e))instanceof Pn)return e._internalPath;if(typeof e=="string")return PR(t,e);throw JE("Field path arguments must be of type string or ",t,!1,void 0,r)}var mDe=new RegExp("[~\\*/\\[\\]]");function PR(t,e,r){if(e.search(mDe)>=0)throw JE(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,r);try{return new Pn(...e.split("."))._internalPath}catch{throw JE(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,r)}}function JE(t,e,r,o,n){let i=o&&!o.isEmpty(),a=n!==void 0,s=`Function ${e}() called with invalid data`;r&&(s+=" (via `toFirestore()`)"),s+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${o}`),a&&(l+=` in document ${n}`),l+=")"),new xe(te.INVALID_ARGUMENT,s+t+l)}function CJ(t,e){return t.some((r=>r.isEqual(e)))}var eh=class{constructor(e,r,o,n,i){this._firestore=e,this._userDataWriter=r,this._key=o,this._document=n,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new To(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new XD(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let r=this._document.data.field(lS("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r)}}},XD=class extends eh{data(){return super.data()}};function lS(t,e){return typeof e=="string"?PR(t,e):e instanceof Pn?e._internalPath:e._delegate._internalPath}function TJ(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new xe(te.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Qx=class{},Zx=class extends Qx{};function po(t,e,...r){let o=[];e instanceof Qx&&o.push(e),o=o.concat(r),(function(i){let a=i.filter((l=>l instanceof JD)).length,s=i.filter((l=>l instanceof QE)).length;if(a>1||a>0&&s>0)throw new xe(te.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(...)))`.")})(o);for(let n of o)t=n._apply(t);return t}var QE=class t extends Zx{constructor(e,r,o){super(),this._field=e,this._op=r,this._value=o,this.type="where"}static _create(e,r,o){return new t(e,r,o)}_apply(e){let r=this._parse(e);return NJ(e._query,r),new oc(e.firestore,e.converter,$A(e._query,r))}_parse(e){let r=ib(e.firestore);return(function(i,a,s,l,c,u,d){let f;if(c.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new xe(te.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){nX(d,u);let h=[];for(let g of d)h.push(oX(l,i,g));f={arrayValue:{values:h}}}else f=oX(l,i,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||nX(d,u),f=pDe(s,a,d,u==="in"||u==="not-in");return So.create(c,u,f)})(e._query,"where",r,e.firestore._databaseId,this._field,this._op,this._value)}};function ab(t,e,r){let o=e,n=lS("where",t);return QE._create(n,o,r)}var JD=class t extends Qx{constructor(e,r){super(),this.type=e,this._queryConstraints=r}static _create(e,r){return new t(e,r)}_parse(e){let r=this._queryConstraints.map((o=>o._parse(e))).filter((o=>o.getFilters().length>0));return r.length===1?r[0]:us.create(r,this._getOperator())}_apply(e){let r=this._parse(e);return r.getFilters().length===0?e:((function(n,i){let a=n,s=i.getFlattenedFilters();for(let l of s)NJ(a,l),a=$A(a,l)})(e._query,r),new oc(e.firestore,e.converter,$A(e._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};var QD=class t extends Zx{constructor(e,r){super(),this._field=e,this._direction=r,this.type="orderBy"}static _create(e,r){return new t(e,r)}_apply(e){let r=(function(n,i,a){if(n.startAt!==null)throw new xe(te.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(n.endAt!==null)throw new xe(te.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new cf(i,a)})(e._query,this._field,this._direction);return new oc(e.firestore,e.converter,(function(n,i){let a=n.explicitOrderBy.concat([i]);return new pu(n.path,n.collectionGroup,a,n.filters.slice(),n.limit,n.limitType,n.startAt,n.endAt)})(e._query,r))}};function Si(t,e="asc"){let r=e,o=lS("orderBy",t);return QD._create(o,r)}var ZD=class t extends Zx{constructor(e,r,o){super(),this.type=e,this._limit=r,this._limitType=o}static _create(e,r,o){return new t(e,r,o)}_apply(e){return new oc(e.firestore,e.converter,CE(e._query,this._limit,this._limitType))}};function kJ(t){return bOe("limit",t),ZD._create("limit",t,"F")}function oX(t,e,r){if(typeof(r=vr(r))=="string"){if(r==="")throw new xe(te.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!LX(e)&&r.indexOf("/")!==-1)throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let o=e.path.child(Sr.fromString(r));if(!ot.isDocumentKey(o))throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${o}' is not because it has an odd number of segments (${o.length}).`);return SY(t,new ot(o))}if(r instanceof To)return SY(t,r._key);throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${eS(r)}.`)}function nX(t,e){if(!Array.isArray(t)||t.length===0)throw new xe(te.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function NJ(t,e){let r=(function(n,i){for(let a of n)for(let s of a.getFlattenedFilters())if(i.indexOf(s.op)>=0)return s.op;return null})(t.filters,(function(n){switch(n){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(r!==null)throw r===e.op?new xe(te.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new xe(te.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`)}var ZE=class{convertValue(e,r="none"){switch(fu(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Rr(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,r);case 5:return e.stringValue;case 6:return this.convertBytes(ec(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,r);case 11:return this.convertObject(e.mapValue,r);case 10:return this.convertVectorValue(e.mapValue);default:throw rt(62114,{value:e})}}convertObject(e,r){return this.convertObjectMap(e.fields,r)}convertObjectMap(e,r="none"){let o={};return _u(e,((n,i)=>{o[n]=this.convertValue(i,r)})),o}convertVectorValue(e){let r=e.fields?.[Gm].arrayValue?.values?.map((o=>Rr(o.doubleValue)));return new uu(r)}convertGeoPoint(e){return new cu(Rr(e.latitude),Rr(e.longitude))}convertArray(e,r){return(e.values||[]).map((o=>this.convertValue(o,r)))}convertServerTimestamp(e,r){switch(r){case"previous":let o=tS(e);return o==null?null:this.convertValue(o,r);case"estimate":return this.convertTimestamp(zx(e));default:return null}}convertTimestamp(e){let r=Zl(e);return new Tt(r.seconds,r.nanos)}convertDocumentKey(e,r){let o=Sr.fromString(e);Gt(nJ(o),9688,{name:e});let n=new EE(o.get(1),o.get(3)),i=new ot(o.popFirst(5));return n.isEqual(r)||Ql(`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 (${r.projectId}/${r.database}) instead.`),i}};function OR(t,e,r){let o;return o=t?r&&(r.merge||r.mergeFields)?t.toFirestore(e,r):t.toFirestore(e):e,o}var eR=class extends ZE{constructor(e){super(),this.firestore=e}convertBytes(e){return new Jl(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new To(this.firestore,null,r)}};var au=class{constructor(e,r){this.hasPendingWrites=e,this.fromCache=r}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},du=class t extends eh{constructor(e,r,o,n,i,a){super(e,r,o,n,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let r=new Vm(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,r={}){if(this._document){let o=this._document.data.field(lS("DocumentSnapshot.get",e));if(o!==null)return this._userDataWriter.convertValue(o,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new xe(te.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,r={};return r.type=t._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}};du._jsonSchemaVersion="firestore/documentSnapshot/1.0",du._jsonSchema={type:Co("string",du._jsonSchemaVersion),bundleSource:Co("string","DocumentSnapshot"),bundleName:Co("string"),bundle:Co("string")};var Vm=class extends du{data(e={}){return super.data(e)}},af=class t{constructor(e,r,o,n){this._firestore=e,this._userDataWriter=r,this._snapshot=n,this.metadata=new au(n.hasPendingWrites,n.fromCache),this.query=o}get docs(){let e=[];return this.forEach((r=>e.push(r))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,r){this._snapshot.docs.forEach((o=>{e.call(r,new Vm(this._firestore,this._userDataWriter,o.key,o,new au(this._snapshot.mutatedKeys.has(o.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let r=!!e.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new xe(te.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(n,i){if(n._snapshot.oldDocs.isEmpty()){let a=0;return n._snapshot.docChanges.map((s=>{let l=new Vm(n._firestore,n._userDataWriter,s.doc.key,s.doc,new au(n._snapshot.mutatedKeys.has(s.doc.key),n._snapshot.fromCache),n.query.converter);return s.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}}))}{let a=n._snapshot.oldDocs;return n._snapshot.docChanges.filter((s=>i||s.type!==3)).map((s=>{let l=new Vm(n._firestore,n._userDataWriter,s.doc.key,s.doc,new au(n._snapshot.mutatedKeys.has(s.doc.key),n._snapshot.fromCache),n.query.converter),c=-1,u=-1;return s.type!==0&&(c=a.indexOf(s.doc.key),a=a.delete(s.doc.key)),s.type!==1&&(a=a.add(s.doc),u=a.indexOf(s.doc.key)),{type:hDe(s.type),doc:l,oldIndex:c,newIndex:u}}))}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new xe(te.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=t._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Fx.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let r=[],o=[],n=[];return this.docs.forEach((i=>{i._document!==null&&(r.push(i._document),o.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),n.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function hDe(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return rt(61501,{type:t})}}function ko(t){t=Ei(t,To);let e=Ei(t.firestore,Aa);return sDe(ah(e),t._key).then((r=>OJ(e,t,r)))}af._jsonSchemaVersion="firestore/querySnapshot/1.0",af._jsonSchema={type:Co("string",af._jsonSchemaVersion),bundleSource:Co("string","QuerySnapshot"),bundleName:Co("string"),bundle:Co("string")};var th=class extends ZE{constructor(e){super(),this.firestore=e}convertBytes(e){return new Jl(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new To(this.firestore,null,r)}};function ea(t){t=Ei(t,oc);let e=Ei(t.firestore,Aa),r=ah(e),o=new th(e);return TJ(t._query),lDe(r,t._query).then((n=>new af(e,o,t,n)))}function xu(t,e,r){t=Ei(t,To);let o=Ei(t.firestore,Aa),n=OR(t.converter,e,r);return cS(o,[CR(ib(o),"setDoc",t._key,n,t.converter!==null,r).toMutation(t._key,Nn.none())])}function Mr(t,e,r,...o){t=Ei(t,To);let n=Ei(t.firestore,Aa),i=ib(n),a;return a=typeof(e=vr(e))=="string"||e instanceof Pn?kR(i,"updateDoc",t._key,e,r,o):TR(i,"updateDoc",t._key,e),cS(n,[a.toMutation(t._key,Nn.exists(!0))])}function PJ(t){return cS(Ei(t.firestore,Aa),[new pf(t._key,Nn.none())])}function bu(t,...e){t=vr(t);let r={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||rX(e[o])||(r=e[o++]);let n={includeMetadataChanges:r.includeMetadataChanges,source:r.source};if(rX(e[o])){let l=e[o];e[o]=l.next?.bind(l),e[o+1]=l.error?.bind(l),e[o+2]=l.complete?.bind(l)}let i,a,s;if(t instanceof To)a=Ei(t.firestore,Aa),s=rS(t._key.path),i={next:l=>{e[o]&&e[o](OJ(a,t,l))},error:e[o+1],complete:e[o+2]};else{let l=Ei(t,oc);a=Ei(l.firestore,Aa),s=l._query;let c=new th(a);i={next:u=>{e[o]&&e[o](new af(a,c,l,u))},error:e[o+1],complete:e[o+2]},TJ(t._query)}return(function(c,u,d,f){let m=new Yx(f),h=new qx(u,m,d);return c.asyncQueue.enqueueAndForget((async()=>yR(await WE(c),h))),()=>{m.Nu(),c.asyncQueue.enqueueAndForget((async()=>vR(await WE(c),h)))}})(ah(a),s,n,i)}function cS(t,e){return(function(o,n){let i=new Oa;return o.asyncQueue.enqueueAndForget((async()=>XAe(await iDe(o),n,i))),i.promise})(ah(t),e)}function OJ(t,e,r){let o=r.docs.get(e._key),n=new th(t);return new du(t,n,e._key,o,new au(r.hasPendingWrites,r.fromCache),e.converter)}var gDe={maxAttempts:5};var tR=class{constructor(e,r){this._firestore=e,this._commitHandler=r,this._mutations=[],this._committed=!1,this._dataReader=ib(e)}set(e,r,o){this._verifyNotCommitted();let n=su(e,this._firestore),i=OR(n.converter,r,o),a=CR(this._dataReader,"WriteBatch.set",n._key,i,n.converter!==null,o);return this._mutations.push(a.toMutation(n._key,Nn.none())),this}update(e,r,o,...n){this._verifyNotCommitted();let i=su(e,this._firestore),a;return a=typeof(r=vr(r))=="string"||r instanceof Pn?kR(this._dataReader,"WriteBatch.update",i._key,r,o,n):TR(this._dataReader,"WriteBatch.update",i._key,r),this._mutations.push(a.toMutation(i._key,Nn.exists(!0))),this}delete(e){this._verifyNotCommitted();let r=su(e,this._firestore);return this._mutations=this._mutations.concat(new pf(r._key,Nn.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 xe(te.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}};function su(t,e){if((t=vr(t)).firestore!==e)throw new xe(te.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var rR=class{constructor(e,r){this._firestore=e,this._transaction=r,this._dataReader=ib(e)}get(e){let r=su(e,this._firestore),o=new eR(this._firestore);return this._transaction.lookup([r._key]).then((n=>{if(!n||n.length!==1)return rt(24041);let i=n[0];if(i.isFoundDocument())return new eh(this._firestore,o,i.key,i,r.converter);if(i.isNoDocument())return new eh(this._firestore,o,r._key,null,r.converter);throw rt(18433,{doc:i})}))}set(e,r,o){let n=su(e,this._firestore),i=OR(n.converter,r,o),a=CR(this._dataReader,"Transaction.set",n._key,i,n.converter!==null,o);return this._transaction.set(n._key,a),this}update(e,r,o,...n){let i=su(e,this._firestore),a;return a=typeof(r=vr(r))=="string"||r instanceof Pn?kR(this._dataReader,"Transaction.update",i._key,r,o,n):TR(this._dataReader,"Transaction.update",i._key,r),this._transaction.update(i._key,a),this}delete(e){let r=su(e,this._firestore);return this._transaction.delete(r._key),this}};var oR=class extends rR{constructor(e,r){super(e,r),this._firestore=e}get(e){let r=su(e,this._firestore),o=new th(this._firestore);return super.get(e).then((n=>new du(this._firestore,o,r._key,n._document,new au(!1,!1),r.converter)))}};function sb(t,e,r){t=Ei(t,Aa);let o={...gDe,...r};return(function(i){if(i.maxAttempts<1)throw new xe(te.INVALID_ARGUMENT,"Max attempts must be at least 1")})(o),(function(i,a,s){let l=new Oa;return i.asyncQueue.enqueueAndForget((async()=>{let c=await aDe(i);new HD(i.asyncQueue,c,s,a,l).ju()})),l.promise})(ah(t),(n=>e(new oR(t,n))),o)}function $o(){return new Jx("deleteField")}function Cr(){return new qD("serverTimestamp")}function AJ(...t){return new KD("arrayUnion",t)}function Ci(t){return ah(t=Ei(t,Aa)),new tR(t,(e=>cS(t,e)))}(function(e,r=!0){(function(n){rh=n})(Ks),qs(new yi("firestore",((o,{instanceIdentifier:n,options:i})=>{let a=o.getProvider("app").getImmediate(),s=new Aa(new xA(o.getProvider("auth-internal")),new vA(a,o.getProvider("app-check-internal")),(function(c,u){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new xe(te.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new EE(c.options.projectId,u)})(a,n),a);return i={useFetchStreams:r,...i},s._setSettings(i),s}),"PUBLIC").setMultipleInstances(!0)),vi(hY,gY,e),vi(hY,gY,"esm2020")})();var zJ="firebasestorage.googleapis.com",UJ="storageBucket",_De=120*1e3,xDe=600*1e3,bDe=1e3;var eo=class t extends li{constructor(e,r,o=0){super(AR(e),`Firebase Storage: ${r} (${AR(e)})`),this.status_=o,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return AR(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
45
+ )`}copy(e,r){let o=new t;return o.comparator=this.comparator,o.keyedMap=e,o.sortedSet=r,o}};var H0=class{constructor(){this.ga=new Zr(ot.comparator)}track(e){let r=e.doc.key,o=this.ga.get(r);o?e.type!==0&&o.type===3?this.ga=this.ga.insert(r,e):e.type===3&&o.type!==1?this.ga=this.ga.insert(r,{type:o.type,doc:e.doc}):e.type===2&&o.type===2?this.ga=this.ga.insert(r,{type:2,doc:e.doc}):e.type===2&&o.type===0?this.ga=this.ga.insert(r,{type:0,doc:e.doc}):e.type===1&&o.type===0?this.ga=this.ga.remove(r):e.type===1&&o.type===2?this.ga=this.ga.insert(r,{type:1,doc:o.doc}):e.type===0&&o.type===1?this.ga=this.ga.insert(r,{type:2,doc:e.doc}):rt(63341,{Rt:e,pa:o}):this.ga=this.ga.insert(r,e)}ya(){let e=[];return this.ga.inorderTraversal(((r,o)=>{e.push(o)})),e}},Qm=class t{constructor(e,r,o,n,i,a,s,l,c){this.query=e,this.docs=r,this.oldDocs=o,this.docChanges=n,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=s,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,r,o,n,i){let a=[];return r.forEach((s=>{a.push({type:0,doc:s})})),new t(e,r,V0.emptySet(r),a,o,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)&&oS(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let r=this.docChanges,o=e.docChanges;if(r.length!==o.length)return!1;for(let n=0;n<r.length;n++)if(r[n].type!==o[n].type||!r[n].doc.isEqual(o[n].doc))return!1;return!0}};var DD=class{constructor(){this.wa=void 0,this.Sa=[]}ba(){return this.Sa.some((e=>e.Da()))}},RD=class{constructor(){this.queries=qY(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(r,o){let n=gt(r),i=n.queries;n.queries=qY(),i.forEach(((a,s)=>{for(let l of s.Sa)l.onError(o)}))})(this,new xe(te.ABORTED,"Firestore shutting down"))}};function qY(){return new tc((t=>FX(t)),oS)}async function yR(t,e){let r=gt(t),o=3,n=e.query,i=r.queries.get(n);i?!i.ba()&&e.Da()&&(o=2):(i=new DD,o=e.Da()?0:1);try{switch(o){case 0:i.wa=await r.onListen(n,!0);break;case 1:i.wa=await r.onListen(n,!1);break;case 2:await r.onFirstRemoteStoreListen(n)}}catch(a){let s=bR(a,`Initialization of query '${Fm(e.query)}' failed`);return void e.onError(s)}r.queries.set(n,i),i.Sa.push(e),e.va(r.onlineState),i.wa&&e.Fa(i.wa)&&IR(r)}async function vR(t,e){let r=gt(t),o=e.query,n=3,i=r.queries.get(o);if(i){let a=i.Sa.indexOf(e);a>=0&&(i.Sa.splice(a,1),i.Sa.length===0?n=e.Da()?0:1:!i.ba()&&e.Da()&&(n=2))}switch(n){case 0:return r.queries.delete(o),r.onUnlisten(o,!0);case 1:return r.queries.delete(o),r.onUnlisten(o,!1);case 2:return r.onLastRemoteStoreUnlisten(o);default:return}}function HAe(t,e){let r=gt(t),o=!1;for(let n of e){let i=n.query,a=r.queries.get(i);if(a){for(let s of a.Sa)s.Fa(n)&&(o=!0);a.wa=n}}o&&IR(r)}function jAe(t,e,r){let o=gt(t),n=o.queries.get(e);if(n)for(let i of n.Sa)i.onError(r);o.queries.delete(e)}function IR(t){t.Ca.forEach((e=>{e.next()}))}var MD,KY;(KY=MD||(MD={})).Ma="default",KY.Cache="cache";var qx=class{constructor(e,r,o){this.query=e,this.xa=r,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=o||{}}Fa(e){if(!this.options.includeMetadataChanges){let o=[];for(let n of e.docChanges)n.type!==3&&o.push(n);e=new Qm(e.query,e.docs,e.oldDocs,o,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let r=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),r=!0):this.La(e,this.onlineState)&&(this.ka(e),r=!0),this.Na=e,r}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let r=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),r=!0),r}La(e,r){if(!e.fromCache||!this.Da())return!0;let o=r!=="Offline";return(!this.options.qa||!o)&&(!e.docs.isEmpty()||e.hasCachedResults||r==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;let r=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}ka(e){e=Qm.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==MD.Cache}};var j0=class{constructor(e){this.key=e}},G0=class{constructor(e){this.key=e}},LD=class{constructor(e,r){this.query=e,this.Ya=r,this.Za=null,this.hasCachedResults=!1,this.current=!1,this.Xa=$t(),this.mutatedKeys=$t(),this.eu=BX(e),this.tu=new V0(this.eu)}get nu(){return this.Ya}ru(e,r){let o=r?r.iu:new H0,n=r?r.tu:this.tu,i=r?r.mutatedKeys:this.mutatedKeys,a=n,s=!1,l=this.query.limitType==="F"&&n.size===this.query.limit?n.last():null,c=this.query.limitType==="L"&&n.size===this.query.limit?n.first():null;if(e.inorderTraversal(((u,d)=>{let f=n.get(u),m=nS(this.query,d)?d:null,h=!!f&&this.mutatedKeys.has(f.key),g=!!m&&(m.hasLocalMutations||this.mutatedKeys.has(m.key)&&m.hasCommittedMutations),_=!1;f&&m?f.data.isEqual(m.data)?h!==g&&(o.track({type:3,doc:m}),_=!0):this.su(f,m)||(o.track({type:2,doc:m}),_=!0,(l&&this.eu(m,l)>0||c&&this.eu(m,c)<0)&&(s=!0)):!f&&m?(o.track({type:0,doc:m}),_=!0):f&&!m&&(o.track({type:1,doc:f}),_=!0,(l||c)&&(s=!0)),_&&(m?(a=a.add(m),i=g?i.add(u):i.delete(u)):(a=a.delete(u),i=i.delete(u)))})),this.query.limit!==null)for(;a.size>this.query.limit;){let u=this.query.limitType==="F"?a.last():a.first();a=a.delete(u.key),i=i.delete(u.key),o.track({type:1,doc:u})}return{tu:a,iu:o,Cs:s,mutatedKeys:i}}su(e,r){return e.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(e,r,o,n){let i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;let a=e.iu.ya();a.sort(((u,d)=>(function(m,h){let g=_=>{switch(_){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return rt(20277,{Rt:_})}};return g(m)-g(h)})(u.type,d.type)||this.eu(u.doc,d.doc))),this.ou(o),n=n??!1;let s=r&&!n?this._u():[],l=this.Xa.size===0&&this.current&&!n?1:0,c=l!==this.Za;return this.Za=l,a.length!==0||c?{snapshot:new Qm(this.query,e.tu,i,a,e.mutatedKeys,l===0,c,!1,!!o&&o.resumeToken.approximateByteSize()>0),au:s}:{au:s}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new H0,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{au:[]}}uu(e){return!this.Ya.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach((r=>this.Ya=this.Ya.add(r))),e.modifiedDocuments.forEach((r=>{})),e.removedDocuments.forEach((r=>this.Ya=this.Ya.delete(r))),this.current=e.current)}_u(){if(!this.current)return[];let e=this.Xa;this.Xa=$t(),this.tu.forEach((o=>{this.uu(o.key)&&(this.Xa=this.Xa.add(o.key))}));let r=[];return e.forEach((o=>{this.Xa.has(o)||r.push(new G0(o))})),this.Xa.forEach((o=>{e.has(o)||r.push(new j0(o))})),r}cu(e){this.Ya=e.Qs,this.Xa=$t();let r=this.ru(e.documents);return this.applyChanges(r,!0)}lu(){return Qm.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Za===0,this.hasCachedResults)}},wR="SyncEngine",FD=class{constructor(e,r,o){this.query=e,this.targetId=r,this.view=o}},BD=class{constructor(e){this.key=e,this.hu=!1}},$D=class{constructor(e,r,o,n,i,a){this.localStore=e,this.remoteStore=r,this.eventManager=o,this.sharedClientState=n,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Pu={},this.Tu=new tc((s=>FX(s)),oS),this.Iu=new Map,this.Eu=new Set,this.du=new Zr(ot.comparator),this.Au=new Map,this.Ru=new Gx,this.Vu={},this.mu=new Map,this.fu=jx.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}};async function GAe(t,e,r=!0){let o=yJ(t),n,i=o.Tu.get(e);return i?(o.sharedClientState.addLocalQueryTarget(i.targetId),n=i.view.lu()):n=await hJ(o,e,r,!0),n}async function WAe(t,e){let r=yJ(t);await hJ(r,e,!0,!1)}async function hJ(t,e,r,o){let n=await NAe(t.localStore,Zs(e)),i=n.targetId,a=t.sharedClientState.addLocalQueryTarget(i,r),s;return o&&(s=await qAe(t,e,i,a==="current",n.resumeToken)),t.isPrimaryClient&&r&&cJ(t.remoteStore,n),s}async function qAe(t,e,r,o,n){t.pu=(d,f,m)=>(async function(g,_,b,y){let v=_.view.ru(b);v.Cs&&(v=await HY(g.localStore,_.query,!1).then((({documents:E})=>_.view.ru(E,v))));let C=y&&y.targetChanges.get(_.targetId),N=y&&y.targetMismatches.get(_.targetId)!=null,I=_.view.applyChanges(v,g.isPrimaryClient,C,N);return XY(g,_.targetId,I.au),I.snapshot})(t,d,f,m);let i=await HY(t.localStore,e,!0),a=new LD(e,i.Qs),s=a.ru(i.documents),l=Vx.createSynthesizedTargetChangeForCurrentChange(r,o&&t.onlineState!=="Offline",n),c=a.applyChanges(s,t.isPrimaryClient,l);XY(t,r,c.au);let u=new FD(e,r,a);return t.Tu.set(e,u),t.Iu.has(r)?t.Iu.get(r).push(e):t.Iu.set(r,[e]),c.snapshot}async function KAe(t,e,r){let o=gt(t),n=o.Tu.get(e),i=o.Iu.get(n.targetId);if(i.length>1)return o.Iu.set(n.targetId,i.filter((a=>!oS(a,e)))),void o.Tu.delete(e);o.isPrimaryClient?(o.sharedClientState.removeLocalQueryTarget(n.targetId),o.sharedClientState.isActiveQueryTarget(n.targetId)||await bD(o.localStore,n.targetId,!1).then((()=>{o.sharedClientState.clearQueryState(n.targetId),r&&hR(o.remoteStore,n.targetId),zD(o,n.targetId)})).catch(oh)):(zD(o,n.targetId),await bD(o.localStore,n.targetId,!0))}async function YAe(t,e){let r=gt(t),o=r.Tu.get(e),n=r.Iu.get(o.targetId);r.isPrimaryClient&&n.length===1&&(r.sharedClientState.removeLocalQueryTarget(o.targetId),hR(r.remoteStore,o.targetId))}async function XAe(t,e,r){let o=oDe(t);try{let n=await(function(a,s){let l=gt(a),c=Tt.now(),u=s.reduce(((m,h)=>m.add(h.key)),$t()),d,f;return l.persistence.runTransaction("Locally write mutations","readwrite",(m=>{let h=rc(),g=$t();return l.Ns.getEntries(m,u).next((_=>{h=_,h.forEach(((b,y)=>{y.isValidDocument()||(g=g.add(b))}))})).next((()=>l.localDocuments.getOverlayedDocuments(m,h))).next((_=>{d=_;let b=[];for(let y of s){let v=tAe(y,d.get(y.key).overlayedDocument);v!=null&&b.push(new tl(y.key,v,PX(v.value.mapValue),Nn.exists(!0)))}return l.mutationQueue.addMutationBatch(m,c,b,s)})).next((_=>{f=_;let b=_.applyToLocalDocumentSet(d,g);return l.documentOverlayCache.saveOverlays(m,_.batchId,b)}))})).then((()=>({batchId:f.batchId,changes:zX(d)})))})(o.localStore,e);o.sharedClientState.addPendingMutation(n.batchId),(function(a,s,l){let c=a.Vu[a.currentUser.toKey()];c||(c=new Zr(Bt)),c=c.insert(s,l),a.Vu[a.currentUser.toKey()]=c})(o,n.batchId,r),await ob(o,n.changes),await sS(o.remoteStore)}catch(n){let i=bR(n,"Failed to persist write");r.reject(i)}}async function gJ(t,e){let r=gt(t);try{let o=await CAe(r.localStore,e);e.targetChanges.forEach(((n,i)=>{let a=r.Au.get(i);a&&(Gt(n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size<=1,22616),n.addedDocuments.size>0?a.hu=!0:n.modifiedDocuments.size>0?Gt(a.hu,14607):n.removedDocuments.size>0&&(Gt(a.hu,42227),a.hu=!1))})),await ob(r,o,e)}catch(o){await oh(o)}}function YY(t,e,r){let o=gt(t);if(o.isPrimaryClient&&r===0||!o.isPrimaryClient&&r===1){let n=[];o.Tu.forEach(((i,a)=>{let s=a.view.va(e);s.snapshot&&n.push(s.snapshot)})),(function(a,s){let l=gt(a);l.onlineState=s;let c=!1;l.queries.forEach(((u,d)=>{for(let f of d.Sa)f.va(s)&&(c=!0)})),c&&IR(l)})(o.eventManager,e),n.length&&o.Pu.H_(n),o.onlineState=e,o.isPrimaryClient&&o.sharedClientState.setOnlineState(e)}}async function JAe(t,e,r){let o=gt(t);o.sharedClientState.updateQueryState(e,"rejected",r);let n=o.Au.get(e),i=n&&n.key;if(i){let a=new Zr(ot.comparator);a=a.insert(i,Qi.newNoDocument(i,mt.min()));let s=$t().add(i),l=new N0(mt.min(),new Map,new Zr(Bt),a,s);await gJ(o,l),o.du=o.du.remove(i),o.Au.delete(e),ER(o)}else await bD(o.localStore,e,!1).then((()=>zD(o,e,r))).catch(oh)}async function QAe(t,e){let r=gt(t),o=e.batch.batchId;try{let n=await SAe(r.localStore,e);xJ(r,o,null),_J(r,o),r.sharedClientState.updateMutationState(o,"acknowledged"),await ob(r,n)}catch(n){await oh(n)}}async function ZAe(t,e,r){let o=gt(t);try{let n=await(function(a,s){let l=gt(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",(c=>{let u;return l.mutationQueue.lookupMutationBatch(c,s).next((d=>(Gt(d!==null,37113),u=d.keys(),l.mutationQueue.removeMutationBatch(c,d)))).next((()=>l.mutationQueue.performConsistencyCheck(c))).next((()=>l.documentOverlayCache.removeOverlaysForBatchId(c,u,s))).next((()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,u))).next((()=>l.localDocuments.getDocuments(c,u)))}))})(o.localStore,e);xJ(o,e,r),_J(o,e),o.sharedClientState.updateMutationState(e,"rejected",r),await ob(o,n)}catch(n){await oh(n)}}function _J(t,e){(t.mu.get(e)||[]).forEach((r=>{r.resolve()})),t.mu.delete(e)}function xJ(t,e,r){let o=gt(t),n=o.Vu[o.currentUser.toKey()];if(n){let i=n.get(e);i&&(r?i.reject(r):i.resolve(),n=n.remove(e)),o.Vu[o.currentUser.toKey()]=n}}function zD(t,e,r=null){t.sharedClientState.removeLocalQueryTarget(e);for(let o of t.Iu.get(e))t.Tu.delete(o),r&&t.Pu.yu(o,r);t.Iu.delete(e),t.isPrimaryClient&&t.Ru.jr(e).forEach((o=>{t.Ru.containsKey(o)||bJ(t,o)}))}function bJ(t,e){t.Eu.delete(e.path.canonicalString());let r=t.du.get(e);r!==null&&(hR(t.remoteStore,r),t.du=t.du.remove(e),t.Au.delete(r),ER(t))}function XY(t,e,r){for(let o of r)o instanceof j0?(t.Ru.addReference(o.key,e),eDe(t,o)):o instanceof G0?(Le(wR,"Document no longer in limbo: "+o.key),t.Ru.removeReference(o.key,e),t.Ru.containsKey(o.key)||bJ(t,o.key)):rt(19791,{wu:o})}function eDe(t,e){let r=e.key,o=r.path.canonicalString();t.du.get(r)||t.Eu.has(o)||(Le(wR,"New document in limbo: "+r),t.Eu.add(o),ER(t))}function ER(t){for(;t.Eu.size>0&&t.du.size<t.maxConcurrentLimboResolutions;){let e=t.Eu.values().next().value;t.Eu.delete(e);let r=new ot(Sr.fromString(e)),o=t.fu.next();t.Au.set(o,new BD(r)),t.du=t.du.insert(r,o),cJ(t.remoteStore,new Hx(Zs(rS(r.path)),o,"TargetPurposeLimboResolution",jm.ce))}}async function ob(t,e,r){let o=gt(t),n=[],i=[],a=[];o.Tu.isEmpty()||(o.Tu.forEach(((s,l)=>{a.push(o.pu(l,e,r).then((c=>{if((c||r)&&o.isPrimaryClient){let u=c?!c.fromCache:r?.targetChanges.get(l.targetId)?.current;o.sharedClientState.updateQueryState(l.targetId,u?"current":"not-current")}if(c){n.push(c);let u=hD.As(l.targetId,c);i.push(u)}})))})),await Promise.all(a),o.Pu.H_(n),await(async function(l,c){let u=gt(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",(d=>fe.forEach(c,(f=>fe.forEach(f.Es,(m=>u.persistence.referenceDelegate.addReference(d,f.targetId,m))).next((()=>fe.forEach(f.ds,(m=>u.persistence.referenceDelegate.removeReference(d,f.targetId,m)))))))))}catch(d){if(!nh(d))throw d;Le(mR,"Failed to update sequence numbers: "+d)}for(let d of c){let f=d.targetId;if(!d.fromCache){let m=u.Ms.get(f),h=m.snapshotVersion,g=m.withLastLimboFreeSnapshotVersion(h);u.Ms=u.Ms.insert(f,g)}}})(o.localStore,i))}async function tDe(t,e){let r=gt(t);if(!r.currentUser.isEqual(e)){Le(wR,"User change. New user:",e.toKey());let o=await sJ(r.localStore,e);r.currentUser=e,(function(i,a){i.mu.forEach((s=>{s.forEach((l=>{l.reject(new xe(te.CANCELLED,a))}))})),i.mu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(e,o.removedBatchIds,o.addedBatchIds),await ob(r,o.Ls)}}function rDe(t,e){let r=gt(t),o=r.Au.get(e);if(o&&o.hu)return $t().add(o.key);{let n=$t(),i=r.Iu.get(e);if(!i)return n;for(let a of i){let s=r.Tu.get(a);n=n.unionWith(s.view.nu)}return n}}function yJ(t){let e=gt(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=gJ.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=rDe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=JAe.bind(null,e),e.Pu.H_=HAe.bind(null,e.eventManager),e.Pu.yu=jAe.bind(null,e.eventManager),e}function oDe(t){let e=gt(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=QAe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ZAe.bind(null,e),e}var Zm=class{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=iS(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,r){return null}Mu(e,r){return null}vu(e){return EAe(this.persistence,new _D,e.initialUser,this.serializer)}Cu(e){return new L0(mD.mi,this.serializer)}Du(e){return new yD}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Zm.provider={build:()=>new Zm};var UD=class extends Zm{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,r){Gt(this.persistence.referenceDelegate instanceof F0,46915);let o=this.persistence.referenceDelegate.garbageCollector;return new tD(o,e.asyncQueue,r)}Cu(e){let r=this.cacheSizeBytes!==void 0?Na.withCacheSize(this.cacheSizeBytes):Na.DEFAULT;return new L0((o=>F0.mi(o,r)),this.serializer)}};var Kx=class{async initialize(e,r){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=o=>YY(this.syncEngine,o,1),this.remoteStore.remoteSyncer.handleCredentialChange=tDe.bind(null,this.syncEngine),await VAe(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new RD})()}createDatastore(e){let r=iS(e.databaseInfo.databaseId),o=(function(i){return new SD(i)})(e.databaseInfo);return(function(i,a,s,l){return new ND(i,a,s,l)})(e.authCredentials,e.appCheckCredentials,o,r)}createRemoteStore(e){return(function(o,n,i,a,s){return new OD(o,n,i,a,s)})(this.localStore,this.datastore,e.asyncQueue,(r=>YY(this.syncEngine,r,0)),(function(){return $0.v()?new $0:new vD})())}createSyncEngine(e,r){return(function(n,i,a,s,l,c,u){let d=new $D(n,i,a,s,l,c);return u&&(d.gu=!0),d})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,r)}async terminate(){await(async function(r){let o=gt(r);Le(mf,"RemoteStore shutting down."),o.Ea.add(5),await rb(o),o.Aa.shutdown(),o.Ra.set("Unknown")})(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};Kx.provider={build:()=>new Kx};var Yx=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Ql("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,r){setTimeout((()=>{this.muted||e(r)}),0)}};var VD=class{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 xe(te.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let r=await(async function(n,i){let a=gt(n),s={documents:i.map((d=>R0(a.serializer,d)))},l=await a.Ho("BatchGetDocuments",a.serializer.databaseId,Sr.emptyPath(),s,i.length),c=new Map;l.forEach((d=>{let f=uAe(a.serializer,d);c.set(f.key.toString(),f)}));let u=[];return i.forEach((d=>{let f=c.get(d.toString());Gt(!!f,55234,{key:d}),u.push(f)})),u})(this.datastore,e);return r.forEach((o=>this.recordVersion(o))),r}set(e,r){this.write(r.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,r){try{this.write(r.toMutation(e,this.preconditionForUpdate(e)))}catch(o){this.lastTransactionError=o}this.writtenDocs.add(e.toString())}delete(e){this.write(new pf(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((r=>{e.delete(r.key.toString())})),e.forEach(((r,o)=>{let n=ot.fromPath(o);this.mutations.push(new k0(n,this.precondition(n)))})),await(async function(o,n){let i=gt(o),a={writes:n.map((s=>tJ(i.serializer,s)))};await i.Go("Commit",i.serializer.databaseId,Sr.emptyPath(),a)})(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let r;if(e.isFoundDocument())r=e.version;else{if(!e.isNoDocument())throw rt(50498,{Gu:e.constructor.name});r=mt.min()}let o=this.readVersions.get(e.key.toString());if(o){if(!r.isEqual(o))throw new xe(te.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),r)}precondition(e){let r=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&r?r.isEqual(mt.min())?Nn.exists(!1):Nn.updateTime(r):Nn.none()}preconditionForUpdate(e){let r=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&r){if(r.isEqual(mt.min()))throw new xe(te.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Nn.updateTime(r)}return Nn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var HD=class{constructor(e,r,o,n,i){this.asyncQueue=e,this.datastore=r,this.options=o,this.updateFunction=n,this.deferred=i,this.zu=o.maxAttempts,this.M_=new Wx(this.asyncQueue,"transaction_retry")}ju(){this.zu-=1,this.Ju()}Ju(){this.M_.p_((async()=>{let e=new VD(this.datastore),r=this.Hu(e);r&&r.then((o=>{this.asyncQueue.enqueueAndForget((()=>e.commit().then((()=>{this.deferred.resolve(o)})).catch((n=>{this.Yu(n)}))))})).catch((o=>{this.Yu(o)}))}))}Hu(e){try{let r=this.updateFunction(e);return!tb(r)&&r.catch&&r.then?r:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.deferred.reject(r),null}}Yu(e){this.zu>0&&this.Zu(e)?(this.zu-=1,this.asyncQueue.enqueueAndForget((()=>(this.Ju(),Promise.resolve())))):this.deferred.reject(e)}Zu(e){if(e?.name==="FirebaseError"){let r=e.code;return r==="aborted"||r==="failed-precondition"||r==="already-exists"||!YX(r)}return!1}};var gu="FirestoreClient",jD=class{constructor(e,r,o,n,i){this.authCredentials=e,this.appCheckCredentials=r,this.asyncQueue=o,this.databaseInfo=n,this.user=Un.UNAUTHENTICATED,this.clientId=Fx.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(o,(async a=>{Le(gu,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a})),this.appCheckCredentials.start(o,(a=>(Le(gu,"Received new app check token=",a),this.appCheckCredentialListener(a,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 Oa;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 o=bR(r,"Failed to shutdown persistence");e.reject(o)}})),e.promise}};async function hA(t,e){t.asyncQueue.verifyOperationInProgress(),Le(gu,"Initializing OfflineComponentProvider");let r=t.configuration;await e.initialize(r);let o=r.initialUser;t.setCredentialChangeListener((async n=>{o.isEqual(n)||(await sJ(e.localStore,n),o=n)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t._offlineComponents=e}async function JY(t,e){t.asyncQueue.verifyOperationInProgress();let r=await nDe(t);Le(gu,"Initializing OnlineComponentProvider"),await e.initialize(r,t.configuration),t.setCredentialChangeListener((o=>WY(e.remoteStore,o))),t.setAppCheckTokenChangeListener(((o,n)=>WY(e.remoteStore,n))),t._onlineComponents=e}async function nDe(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){Le(gu,"Using user provided OfflineComponentProvider");try{await hA(t,t._uninitializedComponentsProvider._offline)}catch(e){let r=e;if(!(function(n){return n.name==="FirebaseError"?n.code===te.FAILED_PRECONDITION||n.code===te.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11})(r))throw r;Lx("Error using user provided cache. Falling back to memory cache: "+r),await hA(t,new Zm)}}else Le(gu,"Using default OfflineComponentProvider"),await hA(t,new UD(void 0));return t._offlineComponents}async function SR(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(Le(gu,"Using user provided OnlineComponentProvider"),await JY(t,t._uninitializedComponentsProvider._online)):(Le(gu,"Using default OnlineComponentProvider"),await JY(t,new Kx))),t._onlineComponents}function iDe(t){return SR(t).then((e=>e.syncEngine))}function aDe(t){return SR(t).then((e=>e.datastore))}async function W0(t){let e=await SR(t),r=e.eventManager;return r.onListen=GAe.bind(null,e.syncEngine),r.onUnlisten=KAe.bind(null,e.syncEngine),r.onFirstRemoteStoreListen=WAe.bind(null,e.syncEngine),r.onLastRemoteStoreUnlisten=YAe.bind(null,e.syncEngine),r}function sDe(t,e,r={}){let o=new Oa;return t.asyncQueue.enqueueAndForget((async()=>(function(i,a,s,l,c){let u=new Yx({next:f=>{u.Nu(),a.enqueueAndForget((()=>vR(i,d)));let m=f.docs.has(s);!m&&f.fromCache?c.reject(new xe(te.UNAVAILABLE,"Failed to get document because the client is offline.")):m&&f.fromCache&&l&&l.source==="server"?c.reject(new xe(te.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.)')):c.resolve(f)},error:f=>c.reject(f)}),d=new qx(rS(s.path),u,{includeMetadataChanges:!0,qa:!0});return yR(i,d)})(await W0(t),t.asyncQueue,e,r,o))),o.promise}function lDe(t,e,r={}){let o=new Oa;return t.asyncQueue.enqueueAndForget((async()=>(function(i,a,s,l,c){let u=new Yx({next:f=>{u.Nu(),a.enqueueAndForget((()=>vR(i,d))),f.fromCache&&l.source==="server"?c.reject(new xe(te.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.)')):c.resolve(f)},error:f=>c.reject(f)}),d=new qx(s,u,{includeMetadataChanges:!0,qa:!0});return yR(i,d)})(await W0(t),t.asyncQueue,e,r,o))),o.promise}function vJ(t){let e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}var QY=new Map;var cDe="firestore.googleapis.com",ZY=!0,q0=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new xe(te.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=cDe,this.ssl=ZY}else this.host=e.host,this.ssl=e.ssl??ZY;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=iJ;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<aJ)throw new xe(te.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}xOe("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=vJ(e.experimentalLongPollingOptions??{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new xe(te.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(o,n){return o.timeoutSeconds===n.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Xx=class{constructor(e,r,o,n){this._authCredentials=e,this._appCheckCredentials=r,this._databaseId=o,this._app=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new q0({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new xe(te.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new xe(te.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 q0(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(o){if(!o)return new _A;switch(o.type){case"firstParty":return new yA(o.sessionIndex||"0",o.iamToken||null,o.authTokenFactory||null);case"provider":return o.client;default:throw new xe(te.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){let o=QY.get(r);o&&(Le("ComponentProvider","Removing Datastore"),QY.delete(r),o.terminate())})(this),Promise.resolve()}};var oc=class t{constructor(e,r,o){this.converter=r,this._query=o,this.type="query",this.firestore=e}withConverter(e){return new t(this.firestore,e,this._query)}},To=class t{constructor(e,r,o){this.converter=r,this._key=o,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 lu(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new t(this.firestore,e,this._key)}toJSON(){return{type:t._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,r,o){if(eb(r,t._jsonSchema))return new t(e,o||null,new ot(Sr.fromString(r.referencePath)))}};To._jsonSchemaVersion="firestore/documentReference/1.0",To._jsonSchema={type:Co("string",To._jsonSchemaVersion),referencePath:Co("string")};var lu=class t extends oc{constructor(e,r,o){super(e,r,rS(o)),this._path=o,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 To(this.firestore,null,new ot(e))}withConverter(e){return new t(this.firestore,e,this._path)}};function Zi(t,e,...r){if(t=vr(t),aX("collection","path",e),t instanceof Xx){let o=Sr.fromString(e,...r);return xY(o),new lu(t,null,o)}{if(!(t instanceof To||t instanceof lu))throw new xe(te.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let o=t._path.child(Sr.fromString(e,...r));return xY(o),new lu(t.firestore,null,o)}}function $e(t,e,...r){if(t=vr(t),arguments.length===1&&(e=Fx.newId()),aX("doc","path",e),t instanceof Xx){let o=Sr.fromString(e,...r);return _Y(o),new To(t,null,new ot(o))}{if(!(t instanceof To||t instanceof lu))throw new xe(te.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let o=t._path.child(Sr.fromString(e,...r));return _Y(o),new To(t.firestore,t instanceof lu?t.converter:null,new ot(o))}}var eX="AsyncQueue",K0=class{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new Wx(this,"async_queue_retry"),this._c=()=>{let o=mA();o&&Le(eX,"Visibility state changed to "+o.visibilityState),this.M_.w_()},this.ac=e;let r=mA();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;let r=mA();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));let r=new Oa;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(r.resolve,r.reject),r.promise))).then((()=>r.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Xu.push(e),this.lc())))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!nh(e))throw e;Le(eX,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){let r=this.ac.then((()=>(this.rc=!0,e().catch((o=>{throw this.nc=o,this.rc=!1,Ql("INTERNAL UNHANDLED ERROR: ",tX(o)),o})).then((o=>(this.rc=!1,o))))));return this.ac=r,r}enqueueAfterDelay(e,r,o){this.uc(),this.oc.indexOf(e)>-1&&(r=0);let n=AD.createAndSchedule(this,e,r,o,(i=>this.hc(i)));return this.tc.push(n),n}uc(){this.nc&&rt(47125,{Pc:tX(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(let r of this.tc)if(r.timerId===e)return!0;return!1}Ec(e){return this.Tc().then((()=>{this.tc.sort(((r,o)=>r.targetTimeMs-o.targetTimeMs));for(let r of this.tc)if(r.skipDelay(),e!=="all"&&r.timerId===e)break;return this.Tc()}))}dc(e){this.oc.push(e)}hc(e){let r=this.tc.indexOf(e);this.tc.splice(r,1)}};function tX(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
46
+ `+t.stack),e}function rX(t){return(function(r,o){if(typeof r!="object"||r===null)return!1;let n=r;for(let i of o)if(i in n&&typeof n[i]=="function")return!0;return!1})(t,["next","error","complete"])}var Aa=class extends Xx{constructor(e,r,o,n){super(e,r,o,n),this.type="firestore",this._queue=new K0,this._persistenceKey=n?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new K0(e),this._firestoreClient=void 0,await e}}};function IJ(t,e,r){r||(r=w0);let o=Yd(t,"firestore");if(o.isInitialized(r)){let n=o.getImmediate({identifier:r}),i=o.getOptions(r);if(ls(i,e))return n;throw new xe(te.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new xe(te.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<aJ)throw new xe(te.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&ss(e.host)&&km(e.host),o.initialize({options:e,instanceIdentifier:r})}function ah(t){if(t._terminated)throw new xe(te.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||uDe(t),t._firestoreClient}function uDe(t){let e=t._freezeSettings(),r=(function(n,i,a,s){return new CA(n,i,a,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,vJ(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator)})(t._databaseId,t._app?.options.appId||"",t._persistenceKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new jD(t._authCredentials,t._appCheckCredentials,t._queue,r,t._componentsProvider&&(function(n){let i=n?._online.build();return{_offline:n?._offline.build(i),_online:i}})(t._componentsProvider))}var Jl=class t{constructor(e){this._byteString=e}static fromBase64String(e){try{return new t(Vn.fromBase64String(e))}catch(r){throw new xe(te.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+r)}}static fromUint8Array(e){return new t(Vn.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:t._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(eb(e,t._jsonSchema))return t.fromBase64String(e.bytes)}};Jl._jsonSchemaVersion="firestore/bytes/1.0",Jl._jsonSchema={type:Co("string",Jl._jsonSchemaVersion),bytes:Co("string")};var Pn=class{constructor(...e){for(let r=0;r<e.length;++r)if(e[r].length===0)throw new xe(te.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Xi(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};function nb(){return new Pn(wA)}var hf=class{constructor(e){this._methodName=e}};var cu=class t{constructor(e,r){if(!isFinite(e)||e<-90||e>90)throw new xe(te.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(r)||r<-180||r>180)throw new xe(te.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=e,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Bt(this._lat,e._lat)||Bt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:t._jsonSchemaVersion}}static fromJSON(e){if(eb(e,t._jsonSchema))return new t(e.latitude,e.longitude)}};cu._jsonSchemaVersion="firestore/geoPoint/1.0",cu._jsonSchema={type:Co("string",cu._jsonSchemaVersion),latitude:Co("number"),longitude:Co("number")};var uu=class t{constructor(e){this._values=(e||[]).map((r=>r))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(o,n){if(o.length!==n.length)return!1;for(let i=0;i<o.length;++i)if(o[i]!==n[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:t._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(eb(e,t._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((r=>typeof r=="number")))return new t(e.vectorValues);throw new xe(te.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};uu._jsonSchemaVersion="firestore/vectorValue/1.0",uu._jsonSchema={type:Co("string",uu._jsonSchemaVersion),vectorValues:Co("object")};var dDe=/^__.*__$/,GD=class{constructor(e,r,o){this.data=e,this.fieldMask=r,this.fieldTransforms=o}toMutation(e,r){return this.fieldMask!==null?new tl(e,this.data,this.fieldMask,r,this.fieldTransforms):new ff(e,this.data,r,this.fieldTransforms)}},Y0=class{constructor(e,r,o){this.data=e,this.fieldMask=r,this.fieldTransforms=o}toMutation(e,r){return new tl(e,this.data,this.fieldMask,r,this.fieldTransforms)}};function wJ(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw rt(40011,{Ac:t})}}var X0=class t{constructor(e,r,o,n,i,a){this.settings=e,this.databaseId=r,this.serializer=o,this.ignoreUndefinedProperties=n,i===void 0&&this.Rc(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Ac(){return this.settings.Ac}Vc(e){return new t({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}mc(e){let r=this.path?.child(e),o=this.Vc({path:r,fc:!1});return o.gc(e),o}yc(e){let r=this.path?.child(e),o=this.Vc({path:r,fc:!1});return o.Rc(),o}wc(e){return this.Vc({path:void 0,fc:!0})}Sc(e){return J0(e,this.settings.methodName,this.settings.bc||!1,this.path,this.settings.Dc)}contains(e){return this.fieldMask.find((r=>e.isPrefixOf(r)))!==void 0||this.fieldTransforms.find((r=>e.isPrefixOf(r.field)))!==void 0}Rc(){if(this.path)for(let e=0;e<this.path.length;e++)this.gc(this.path.get(e))}gc(e){if(e.length===0)throw this.Sc("Document fields must not be empty");if(wJ(this.Ac)&&dDe.test(e))throw this.Sc('Document fields cannot begin and end with "__"')}},WD=class{constructor(e,r,o){this.databaseId=e,this.ignoreUndefinedProperties=r,this.serializer=o||iS(e)}Cc(e,r,o,n=!1){return new X0({Ac:e,methodName:r,Dc:o,path:Xi.emptyPath(),fc:!1,bc:n},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function ib(t){let e=t._freezeSettings(),r=iS(t._databaseId);return new WD(t._databaseId,!!e.ignoreUndefinedProperties,r)}function CR(t,e,r,o,n,i={}){let a=t.Cc(i.merge||i.mergeFields?2:0,e,r,n);NR("Data must be an object, but it was:",a,o);let s=EJ(o,a),l,c;if(i.merge)l=new Pa(a.fieldMask),c=a.fieldTransforms;else if(i.mergeFields){let u=[];for(let d of i.mergeFields){let f=YD(e,d,r);if(!a.contains(f))throw new xe(te.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);CJ(u,f)||u.push(f)}l=new Pa(u),c=a.fieldTransforms.filter((d=>l.covers(d.field)))}else l=null,c=a.fieldTransforms;return new GD(new wi(s),l,c)}var Jx=class t extends hf{_toFieldTransform(e){if(e.Ac!==2)throw e.Ac===1?e.Sc(`${this._methodName}() can only appear at the top level of your update data`):e.Sc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof t}};function fDe(t,e,r){return new X0({Ac:3,Dc:e.settings.Dc,methodName:t._methodName,fc:r},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}var qD=class t extends hf{_toFieldTransform(e){return new T0(e.path,new uf)}isEqual(e){return e instanceof t}},KD=class t extends hf{constructor(e,r){super(e),this.vc=r}_toFieldTransform(e){let r=fDe(this,e,!0),o=this.vc.map((i=>sh(i,r))),n=new mu(o);return new T0(e.path,n)}isEqual(e){return e instanceof t&&ls(this.vc,e.vc)}};function TR(t,e,r,o){let n=t.Cc(1,e,r);NR("Data must be an object, but it was:",n,o);let i=[],a=wi.empty();_u(o,((l,c)=>{let u=PR(e,l,r);c=vr(c);let d=n.yc(u);if(c instanceof Jx)i.push(u);else{let f=sh(c,d);f!=null&&(i.push(u),a.set(u,f))}}));let s=new Pa(i);return new Y0(a,s,n.fieldTransforms)}function kR(t,e,r,o,n,i){let a=t.Cc(1,e,r),s=[YD(e,o,r)],l=[n];if(i.length%2!=0)throw new xe(te.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<i.length;f+=2)s.push(YD(e,i[f])),l.push(i[f+1]);let c=[],u=wi.empty();for(let f=s.length-1;f>=0;--f)if(!CJ(c,s[f])){let m=s[f],h=l[f];h=vr(h);let g=a.yc(m);if(h instanceof Jx)c.push(m);else{let _=sh(h,g);_!=null&&(c.push(m),u.set(m,_))}}let d=new Pa(c);return new Y0(u,d,a.fieldTransforms)}function pDe(t,e,r,o=!1){return sh(r,t.Cc(o?4:3,e))}function sh(t,e){if(SJ(t=vr(t)))return NR("Unsupported field value:",e,t),EJ(t,e);if(t instanceof hf)return(function(o,n){if(!wJ(n.Ac))throw n.Sc(`${o._methodName}() can only be used with update() and set()`);if(!n.path)throw n.Sc(`${o._methodName}() is not currently supported inside arrays`);let i=o._toFieldTransform(n);i&&n.fieldTransforms.push(i)})(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.fc&&e.Ac!==4)throw e.Sc("Nested arrays are not supported");return(function(o,n){let i=[],a=0;for(let s of o){let l=sh(s,n.wc(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}})(t,e)}return(function(o,n){if((o=vr(o))===null)return{nullValue:"NULL_VALUE"};if(typeof o=="number")return XOe(n.serializer,o);if(typeof o=="boolean")return{booleanValue:o};if(typeof o=="string")return{stringValue:o};if(o instanceof Date){let i=Tt.fromDate(o);return{timestampValue:D0(n.serializer,i)}}if(o instanceof Tt){let i=new Tt(o.seconds,1e3*Math.floor(o.nanoseconds/1e3));return{timestampValue:D0(n.serializer,i)}}if(o instanceof cu)return{geoPointValue:{latitude:o.latitude,longitude:o.longitude}};if(o instanceof Jl)return{bytesValue:JX(n.serializer,o._byteString)};if(o instanceof To){let i=n.databaseId,a=o.firestore._databaseId;if(!a.isEqual(i))throw n.Sc(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:pR(o.firestore._databaseId||n.databaseId,o._key.path)}}if(o instanceof uu)return(function(a,s){return{mapValue:{fields:{[sR]:{stringValue:lR},[Gm]:{arrayValue:{values:a.toArray().map((c=>{if(typeof c!="number")throw s.Sc("VectorValues must only contain numeric values.");return fR(s.serializer,c)}))}}}}}})(o,n);throw n.Sc(`Unsupported field value: ${eS(o)}`)})(t,e)}function EJ(t,e){let r={};return IX(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):_u(t,((o,n)=>{let i=sh(n,e.mc(o));i!=null&&(r[o]=i)})),{mapValue:{fields:r}}}function SJ(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Tt||t instanceof cu||t instanceof Jl||t instanceof To||t instanceof hf||t instanceof uu)}function NR(t,e,r){if(!SJ(r)||!sX(r)){let o=eS(r);throw o==="an object"?e.Sc(t+" a custom object"):e.Sc(t+" "+o)}}function YD(t,e,r){if((e=vr(e))instanceof Pn)return e._internalPath;if(typeof e=="string")return PR(t,e);throw J0("Field path arguments must be of type string or ",t,!1,void 0,r)}var mDe=new RegExp("[~\\*/\\[\\]]");function PR(t,e,r){if(e.search(mDe)>=0)throw J0(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,r);try{return new Pn(...e.split("."))._internalPath}catch{throw J0(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,r)}}function J0(t,e,r,o,n){let i=o&&!o.isEmpty(),a=n!==void 0,s=`Function ${e}() called with invalid data`;r&&(s+=" (via `toFirestore()`)"),s+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${o}`),a&&(l+=` in document ${n}`),l+=")"),new xe(te.INVALID_ARGUMENT,s+t+l)}function CJ(t,e){return t.some((r=>r.isEqual(e)))}var eh=class{constructor(e,r,o,n,i){this._firestore=e,this._userDataWriter=r,this._key=o,this._document=n,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new To(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new XD(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let r=this._document.data.field(lS("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r)}}},XD=class extends eh{data(){return super.data()}};function lS(t,e){return typeof e=="string"?PR(t,e):e instanceof Pn?e._internalPath:e._delegate._internalPath}function TJ(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new xe(te.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Qx=class{},Zx=class extends Qx{};function po(t,e,...r){let o=[];e instanceof Qx&&o.push(e),o=o.concat(r),(function(i){let a=i.filter((l=>l instanceof JD)).length,s=i.filter((l=>l instanceof Q0)).length;if(a>1||a>0&&s>0)throw new xe(te.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(...)))`.")})(o);for(let n of o)t=n._apply(t);return t}var Q0=class t extends Zx{constructor(e,r,o){super(),this._field=e,this._op=r,this._value=o,this.type="where"}static _create(e,r,o){return new t(e,r,o)}_apply(e){let r=this._parse(e);return NJ(e._query,r),new oc(e.firestore,e.converter,$A(e._query,r))}_parse(e){let r=ib(e.firestore);return(function(i,a,s,l,c,u,d){let f;if(c.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new xe(te.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){nX(d,u);let h=[];for(let g of d)h.push(oX(l,i,g));f={arrayValue:{values:h}}}else f=oX(l,i,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||nX(d,u),f=pDe(s,a,d,u==="in"||u==="not-in");return So.create(c,u,f)})(e._query,"where",r,e.firestore._databaseId,this._field,this._op,this._value)}};function ab(t,e,r){let o=e,n=lS("where",t);return Q0._create(n,o,r)}var JD=class t extends Qx{constructor(e,r){super(),this.type=e,this._queryConstraints=r}static _create(e,r){return new t(e,r)}_parse(e){let r=this._queryConstraints.map((o=>o._parse(e))).filter((o=>o.getFilters().length>0));return r.length===1?r[0]:us.create(r,this._getOperator())}_apply(e){let r=this._parse(e);return r.getFilters().length===0?e:((function(n,i){let a=n,s=i.getFlattenedFilters();for(let l of s)NJ(a,l),a=$A(a,l)})(e._query,r),new oc(e.firestore,e.converter,$A(e._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};var QD=class t extends Zx{constructor(e,r){super(),this._field=e,this._direction=r,this.type="orderBy"}static _create(e,r){return new t(e,r)}_apply(e){let r=(function(n,i,a){if(n.startAt!==null)throw new xe(te.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(n.endAt!==null)throw new xe(te.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new cf(i,a)})(e._query,this._field,this._direction);return new oc(e.firestore,e.converter,(function(n,i){let a=n.explicitOrderBy.concat([i]);return new pu(n.path,n.collectionGroup,a,n.filters.slice(),n.limit,n.limitType,n.startAt,n.endAt)})(e._query,r))}};function Si(t,e="asc"){let r=e,o=lS("orderBy",t);return QD._create(o,r)}var ZD=class t extends Zx{constructor(e,r,o){super(),this.type=e,this._limit=r,this._limitType=o}static _create(e,r,o){return new t(e,r,o)}_apply(e){return new oc(e.firestore,e.converter,C0(e._query,this._limit,this._limitType))}};function kJ(t){return bOe("limit",t),ZD._create("limit",t,"F")}function oX(t,e,r){if(typeof(r=vr(r))=="string"){if(r==="")throw new xe(te.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!LX(e)&&r.indexOf("/")!==-1)throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let o=e.path.child(Sr.fromString(r));if(!ot.isDocumentKey(o))throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${o}' is not because it has an odd number of segments (${o.length}).`);return SY(t,new ot(o))}if(r instanceof To)return SY(t,r._key);throw new xe(te.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${eS(r)}.`)}function nX(t,e){if(!Array.isArray(t)||t.length===0)throw new xe(te.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function NJ(t,e){let r=(function(n,i){for(let a of n)for(let s of a.getFlattenedFilters())if(i.indexOf(s.op)>=0)return s.op;return null})(t.filters,(function(n){switch(n){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(r!==null)throw r===e.op?new xe(te.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new xe(te.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`)}var Z0=class{convertValue(e,r="none"){switch(fu(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Rr(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,r);case 5:return e.stringValue;case 6:return this.convertBytes(ec(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,r);case 11:return this.convertObject(e.mapValue,r);case 10:return this.convertVectorValue(e.mapValue);default:throw rt(62114,{value:e})}}convertObject(e,r){return this.convertObjectMap(e.fields,r)}convertObjectMap(e,r="none"){let o={};return _u(e,((n,i)=>{o[n]=this.convertValue(i,r)})),o}convertVectorValue(e){let r=e.fields?.[Gm].arrayValue?.values?.map((o=>Rr(o.doubleValue)));return new uu(r)}convertGeoPoint(e){return new cu(Rr(e.latitude),Rr(e.longitude))}convertArray(e,r){return(e.values||[]).map((o=>this.convertValue(o,r)))}convertServerTimestamp(e,r){switch(r){case"previous":let o=tS(e);return o==null?null:this.convertValue(o,r);case"estimate":return this.convertTimestamp(zx(e));default:return null}}convertTimestamp(e){let r=Zl(e);return new Tt(r.seconds,r.nanos)}convertDocumentKey(e,r){let o=Sr.fromString(e);Gt(nJ(o),9688,{name:e});let n=new E0(o.get(1),o.get(3)),i=new ot(o.popFirst(5));return n.isEqual(r)||Ql(`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 (${r.projectId}/${r.database}) instead.`),i}};function OR(t,e,r){let o;return o=t?r&&(r.merge||r.mergeFields)?t.toFirestore(e,r):t.toFirestore(e):e,o}var eR=class extends Z0{constructor(e){super(),this.firestore=e}convertBytes(e){return new Jl(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new To(this.firestore,null,r)}};var au=class{constructor(e,r){this.hasPendingWrites=e,this.fromCache=r}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},du=class t extends eh{constructor(e,r,o,n,i,a){super(e,r,o,n,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let r=new Vm(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,r={}){if(this._document){let o=this._document.data.field(lS("DocumentSnapshot.get",e));if(o!==null)return this._userDataWriter.convertValue(o,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new xe(te.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,r={};return r.type=t._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}};du._jsonSchemaVersion="firestore/documentSnapshot/1.0",du._jsonSchema={type:Co("string",du._jsonSchemaVersion),bundleSource:Co("string","DocumentSnapshot"),bundleName:Co("string"),bundle:Co("string")};var Vm=class extends du{data(e={}){return super.data(e)}},af=class t{constructor(e,r,o,n){this._firestore=e,this._userDataWriter=r,this._snapshot=n,this.metadata=new au(n.hasPendingWrites,n.fromCache),this.query=o}get docs(){let e=[];return this.forEach((r=>e.push(r))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,r){this._snapshot.docs.forEach((o=>{e.call(r,new Vm(this._firestore,this._userDataWriter,o.key,o,new au(this._snapshot.mutatedKeys.has(o.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let r=!!e.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new xe(te.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(n,i){if(n._snapshot.oldDocs.isEmpty()){let a=0;return n._snapshot.docChanges.map((s=>{let l=new Vm(n._firestore,n._userDataWriter,s.doc.key,s.doc,new au(n._snapshot.mutatedKeys.has(s.doc.key),n._snapshot.fromCache),n.query.converter);return s.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}}))}{let a=n._snapshot.oldDocs;return n._snapshot.docChanges.filter((s=>i||s.type!==3)).map((s=>{let l=new Vm(n._firestore,n._userDataWriter,s.doc.key,s.doc,new au(n._snapshot.mutatedKeys.has(s.doc.key),n._snapshot.fromCache),n.query.converter),c=-1,u=-1;return s.type!==0&&(c=a.indexOf(s.doc.key),a=a.delete(s.doc.key)),s.type!==1&&(a=a.add(s.doc),u=a.indexOf(s.doc.key)),{type:hDe(s.type),doc:l,oldIndex:c,newIndex:u}}))}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new xe(te.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=t._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Fx.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let r=[],o=[],n=[];return this.docs.forEach((i=>{i._document!==null&&(r.push(i._document),o.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),n.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function hDe(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return rt(61501,{type:t})}}function ko(t){t=Ei(t,To);let e=Ei(t.firestore,Aa);return sDe(ah(e),t._key).then((r=>OJ(e,t,r)))}af._jsonSchemaVersion="firestore/querySnapshot/1.0",af._jsonSchema={type:Co("string",af._jsonSchemaVersion),bundleSource:Co("string","QuerySnapshot"),bundleName:Co("string"),bundle:Co("string")};var th=class extends Z0{constructor(e){super(),this.firestore=e}convertBytes(e){return new Jl(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new To(this.firestore,null,r)}};function ea(t){t=Ei(t,oc);let e=Ei(t.firestore,Aa),r=ah(e),o=new th(e);return TJ(t._query),lDe(r,t._query).then((n=>new af(e,o,t,n)))}function xu(t,e,r){t=Ei(t,To);let o=Ei(t.firestore,Aa),n=OR(t.converter,e,r);return cS(o,[CR(ib(o),"setDoc",t._key,n,t.converter!==null,r).toMutation(t._key,Nn.none())])}function Mr(t,e,r,...o){t=Ei(t,To);let n=Ei(t.firestore,Aa),i=ib(n),a;return a=typeof(e=vr(e))=="string"||e instanceof Pn?kR(i,"updateDoc",t._key,e,r,o):TR(i,"updateDoc",t._key,e),cS(n,[a.toMutation(t._key,Nn.exists(!0))])}function PJ(t){return cS(Ei(t.firestore,Aa),[new pf(t._key,Nn.none())])}function bu(t,...e){t=vr(t);let r={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||rX(e[o])||(r=e[o++]);let n={includeMetadataChanges:r.includeMetadataChanges,source:r.source};if(rX(e[o])){let l=e[o];e[o]=l.next?.bind(l),e[o+1]=l.error?.bind(l),e[o+2]=l.complete?.bind(l)}let i,a,s;if(t instanceof To)a=Ei(t.firestore,Aa),s=rS(t._key.path),i={next:l=>{e[o]&&e[o](OJ(a,t,l))},error:e[o+1],complete:e[o+2]};else{let l=Ei(t,oc);a=Ei(l.firestore,Aa),s=l._query;let c=new th(a);i={next:u=>{e[o]&&e[o](new af(a,c,l,u))},error:e[o+1],complete:e[o+2]},TJ(t._query)}return(function(c,u,d,f){let m=new Yx(f),h=new qx(u,m,d);return c.asyncQueue.enqueueAndForget((async()=>yR(await W0(c),h))),()=>{m.Nu(),c.asyncQueue.enqueueAndForget((async()=>vR(await W0(c),h)))}})(ah(a),s,n,i)}function cS(t,e){return(function(o,n){let i=new Oa;return o.asyncQueue.enqueueAndForget((async()=>XAe(await iDe(o),n,i))),i.promise})(ah(t),e)}function OJ(t,e,r){let o=r.docs.get(e._key),n=new th(t);return new du(t,n,e._key,o,new au(r.hasPendingWrites,r.fromCache),e.converter)}var gDe={maxAttempts:5};var tR=class{constructor(e,r){this._firestore=e,this._commitHandler=r,this._mutations=[],this._committed=!1,this._dataReader=ib(e)}set(e,r,o){this._verifyNotCommitted();let n=su(e,this._firestore),i=OR(n.converter,r,o),a=CR(this._dataReader,"WriteBatch.set",n._key,i,n.converter!==null,o);return this._mutations.push(a.toMutation(n._key,Nn.none())),this}update(e,r,o,...n){this._verifyNotCommitted();let i=su(e,this._firestore),a;return a=typeof(r=vr(r))=="string"||r instanceof Pn?kR(this._dataReader,"WriteBatch.update",i._key,r,o,n):TR(this._dataReader,"WriteBatch.update",i._key,r),this._mutations.push(a.toMutation(i._key,Nn.exists(!0))),this}delete(e){this._verifyNotCommitted();let r=su(e,this._firestore);return this._mutations=this._mutations.concat(new pf(r._key,Nn.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 xe(te.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}};function su(t,e){if((t=vr(t)).firestore!==e)throw new xe(te.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var rR=class{constructor(e,r){this._firestore=e,this._transaction=r,this._dataReader=ib(e)}get(e){let r=su(e,this._firestore),o=new eR(this._firestore);return this._transaction.lookup([r._key]).then((n=>{if(!n||n.length!==1)return rt(24041);let i=n[0];if(i.isFoundDocument())return new eh(this._firestore,o,i.key,i,r.converter);if(i.isNoDocument())return new eh(this._firestore,o,r._key,null,r.converter);throw rt(18433,{doc:i})}))}set(e,r,o){let n=su(e,this._firestore),i=OR(n.converter,r,o),a=CR(this._dataReader,"Transaction.set",n._key,i,n.converter!==null,o);return this._transaction.set(n._key,a),this}update(e,r,o,...n){let i=su(e,this._firestore),a;return a=typeof(r=vr(r))=="string"||r instanceof Pn?kR(this._dataReader,"Transaction.update",i._key,r,o,n):TR(this._dataReader,"Transaction.update",i._key,r),this._transaction.update(i._key,a),this}delete(e){let r=su(e,this._firestore);return this._transaction.delete(r._key),this}};var oR=class extends rR{constructor(e,r){super(e,r),this._firestore=e}get(e){let r=su(e,this._firestore),o=new th(this._firestore);return super.get(e).then((n=>new du(this._firestore,o,r._key,n._document,new au(!1,!1),r.converter)))}};function sb(t,e,r){t=Ei(t,Aa);let o={...gDe,...r};return(function(i){if(i.maxAttempts<1)throw new xe(te.INVALID_ARGUMENT,"Max attempts must be at least 1")})(o),(function(i,a,s){let l=new Oa;return i.asyncQueue.enqueueAndForget((async()=>{let c=await aDe(i);new HD(i.asyncQueue,c,s,a,l).ju()})),l.promise})(ah(t),(n=>e(new oR(t,n))),o)}function $o(){return new Jx("deleteField")}function Cr(){return new qD("serverTimestamp")}function AJ(...t){return new KD("arrayUnion",t)}function Ci(t){return ah(t=Ei(t,Aa)),new tR(t,(e=>cS(t,e)))}(function(e,r=!0){(function(n){rh=n})(Ks),qs(new yi("firestore",((o,{instanceIdentifier:n,options:i})=>{let a=o.getProvider("app").getImmediate(),s=new Aa(new xA(o.getProvider("auth-internal")),new vA(a,o.getProvider("app-check-internal")),(function(c,u){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new xe(te.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new E0(c.options.projectId,u)})(a,n),a);return i={useFetchStreams:r,...i},s._setSettings(i),s}),"PUBLIC").setMultipleInstances(!0)),vi(hY,gY,e),vi(hY,gY,"esm2020")})();var zJ="firebasestorage.googleapis.com",UJ="storageBucket",_De=120*1e3,xDe=600*1e3,bDe=1e3;var eo=class t extends li{constructor(e,r,o=0){super(AR(e),`Firebase Storage: ${r} (${AR(e)})`),this.status_=o,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return AR(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
47
47
  ${this.customData.serverResponse}`:this.message=this._baseMessage}},Lr;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Lr||(Lr={}));function AR(t){return"storage/"+t}function UR(){let t="An unknown error occurred, please check the error payload for server response.";return new eo(Lr.UNKNOWN,t)}function yDe(t){return new eo(Lr.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function vDe(t){return new eo(Lr.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function IDe(){let t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new eo(Lr.UNAUTHENTICATED,t)}function wDe(){return new eo(Lr.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function EDe(t){return new eo(Lr.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function VJ(){return new eo(Lr.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function HJ(){return new eo(Lr.CANCELED,"User canceled the upload/download.")}function SDe(t){return new eo(Lr.INVALID_URL,"Invalid URL '"+t+"'.")}function CDe(t){return new eo(Lr.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function TDe(){return new eo(Lr.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+UJ+"' property when initializing the app?")}function jJ(){return new eo(Lr.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function kDe(){return new eo(Lr.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function NDe(t){return new eo(Lr.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function RR(t){return new eo(Lr.INVALID_ARGUMENT,t)}function GJ(){return new eo(Lr.APP_DELETED,"The Firebase app was deleted.")}function PDe(t){return new eo(Lr.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function cb(t,e){return new eo(Lr.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function lb(t){throw new eo(Lr.INTERNAL_ERROR,"Internal error: "+t)}var ds=class t{constructor(e,r){this.bucket=e,this.path_=r}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,r){let o;try{o=t.makeFromUrl(e,r)}catch{return new t(e,"")}if(o.path==="")return o;throw CDe(e)}static makeFromUrl(e,r){let o=null,n="([A-Za-z0-9.\\-_]+)";function i(C){C.path.charAt(C.path.length-1)==="/"&&(C.path_=C.path_.slice(0,-1))}let a="(/(.*))?$",s=new RegExp("^gs://"+n+a,"i"),l={bucket:1,path:3};function c(C){C.path_=decodeURIComponent(C.path)}let u="v[A-Za-z0-9_]+",d=r.replace(/[.]/g,"\\."),f="(/([^?#]*).*)?$",m=new RegExp(`^https?://${d}/${u}/b/${n}/o${f}`,"i"),h={bucket:1,path:3},g=r===zJ?"(?:storage.googleapis.com|storage.cloud.google.com)":r,_="([^?#]*)",b=new RegExp(`^https?://${g}/${n}/${_}`,"i"),v=[{regex:s,indices:l,postModify:i},{regex:m,indices:h,postModify:c},{regex:b,indices:{bucket:1,path:2},postModify:c}];for(let C=0;C<v.length;C++){let N=v[C],I=N.regex.exec(e);if(I){let E=I[N.indices.bucket],w=I[N.indices.path];w||(w=""),o=new t(E,w),N.postModify(o);break}}if(o==null)throw SDe(e);return o}},MR=class{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}};function ODe(t,e,r){let o=1,n=null,i=null,a=!1,s=0;function l(){return s===2}let c=!1;function u(..._){c||(c=!0,e.apply(null,_))}function d(_){n=setTimeout(()=>{n=null,t(m,l())},_)}function f(){i&&clearTimeout(i)}function m(_,...b){if(c){f();return}if(_){f(),u.call(null,_,...b);return}if(l()||a){f(),u.call(null,_,...b);return}o<64&&(o*=2);let v;s===1?(s=2,v=0):v=(o+Math.random())*1e3,d(v)}let h=!1;function g(_){h||(h=!0,f(),!c&&(n!==null?(_||(s=2),clearTimeout(n),d(0)):_||(s=1)))}return d(0),i=setTimeout(()=>{a=!0,g(!0)},r),g}function ADe(t){t(!1)}function DDe(t){return t!==void 0}function RDe(t){return typeof t=="function"}function MDe(t){return typeof t=="object"&&!Array.isArray(t)}function VR(t){return typeof t=="string"||t instanceof String}function DJ(t){return HR()&&t instanceof Blob}function HR(){return typeof Blob<"u"}function RJ(t,e,r,o){if(o<e)throw RR(`Invalid value for '${t}'. Expected ${e} or greater.`);if(o>r)throw RR(`Invalid value for '${t}'. Expected ${r} or less.`)}function pS(t,e,r){let o=e;return r==null&&(o=`https://${e}`),`${r}://${o}/v0${t}`}function LDe(t){let e=encodeURIComponent,r="?";for(let o in t)if(t.hasOwnProperty(o)){let n=e(o)+"="+e(t[o]);r=r+n+"&"}return r=r.slice(0,-1),r}var _f;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(_f||(_f={}));function WJ(t,e){let r=t>=500&&t<600,n=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return r||n||i}var LR=class{constructor(e,r,o,n,i,a,s,l,c,u,d,f=!0,m=!1){this.url_=e,this.method_=r,this.headers_=o,this.body_=n,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=s,this.errorCallback_=l,this.timeout_=c,this.progressCallback_=u,this.connectionFactory_=d,this.retry=f,this.isUsingEmulator=m,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((h,g)=>{this.resolve_=h,this.reject_=g,this.start_()})}start_(){let e=(o,n)=>{if(n){o(!1,new uh(!1,null,!0));return}let i=this.connectionFactory_();this.pendingConnection_=i;let a=s=>{let l=s.loaded,c=s.lengthComputable?s.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,c)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;let s=i.getErrorCode()===_f.NO_ERROR,l=i.getStatus();if(!s||WJ(l,this.additionalRetryCodes_)&&this.retry){let u=i.getErrorCode()===_f.ABORT;o(!1,new uh(!1,null,u));return}let c=this.successCodes_.indexOf(l)!==-1;o(!0,new uh(c,i))})},r=(o,n)=>{let i=this.resolve_,a=this.reject_,s=n.connection;if(n.wasSuccessCode)try{let l=this.callback_(s,s.getResponse());DDe(l)?i(l):i()}catch(l){a(l)}else if(s!==null){let l=UR();l.serverResponse=s.getErrorText(),this.errorCallback_?a(this.errorCallback_(s,l)):a(l)}else if(n.canceled){let l=this.appDelete_?GJ():HJ();a(l)}else{let l=VJ();a(l)}};this.canceled_?r(!1,new uh(!1,null,!0)):this.backoffId_=ODe(e,r,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&ADe(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},uh=class{constructor(e,r,o){this.wasSuccessCode=e,this.connection=r,this.canceled=!!o}};function FDe(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function BDe(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function $De(t,e){e&&(t["X-Firebase-GMPID"]=e)}function zDe(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function UDe(t,e,r,o,n,i,a=!0,s=!1){let l=LDe(t.urlParams),c=t.url+l,u=Object.assign({},t.headers);return $De(u,e),FDe(u,r),BDe(u,i),zDe(u,o),new LR(c,t.method,u,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,n,a,s)}function VDe(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function HDe(...t){let e=VDe();if(e!==void 0){let r=new e;for(let o=0;o<t.length;o++)r.append(t[o]);return r.getBlob()}else{if(HR())return new Blob(t);throw new eo(Lr.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function jDe(t,e,r){return t.webkitSlice?t.webkitSlice(e,r):t.mozSlice?t.mozSlice(e,r):t.slice?t.slice(e,r):null}function GDe(t){if(typeof atob>"u")throw NDe("base-64");return atob(t)}var rl={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},ub=class{constructor(e,r){this.data=e,this.contentType=r||null}};function WDe(t,e){switch(t){case rl.RAW:return new ub(qJ(e));case rl.BASE64:case rl.BASE64URL:return new ub(KJ(t,e));case rl.DATA_URL:return new ub(KDe(e),YDe(e))}throw UR()}function qJ(t){let e=[];for(let r=0;r<t.length;r++){let o=t.charCodeAt(r);if(o<=127)e.push(o);else if(o<=2047)e.push(192|o>>6,128|o&63);else if((o&64512)===55296)if(!(r<t.length-1&&(t.charCodeAt(r+1)&64512)===56320))e.push(239,191,189);else{let i=o,a=t.charCodeAt(++r);o=65536|(i&1023)<<10|a&1023,e.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}else(o&64512)===56320?e.push(239,191,189):e.push(224|o>>12,128|o>>6&63,128|o&63)}return new Uint8Array(e)}function qDe(t){let e;try{e=decodeURIComponent(t)}catch{throw cb(rl.DATA_URL,"Malformed data URL.")}return qJ(e)}function KJ(t,e){switch(t){case rl.BASE64:{let n=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(n||i)throw cb(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break}case rl.BASE64URL:{let n=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(n||i)throw cb(t,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let r;try{r=GDe(e)}catch(n){throw n.message.includes("polyfill")?n:cb(t,"Invalid character found")}let o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o}var dS=class{constructor(e){this.base64=!1,this.contentType=null;let r=e.match(/^data:([^,]+)?,/);if(r===null)throw cb(rl.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let o=r[1]||null;o!=null&&(this.base64=XDe(o,";base64"),this.contentType=this.base64?o.substring(0,o.length-7):o),this.rest=e.substring(e.indexOf(",")+1)}};function KDe(t){let e=new dS(t);return e.base64?KJ(rl.BASE64,e.rest):qDe(e.rest)}function YDe(t){return new dS(t).contentType}function XDe(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}var fS=class t{constructor(e,r){let o=0,n="";DJ(e)?(this.data_=e,o=e.size,n=e.type):e instanceof ArrayBuffer?(r?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),o=this.data_.length):e instanceof Uint8Array&&(r?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),o=e.length),this.size_=o,this.type_=n}size(){return this.size_}type(){return this.type_}slice(e,r){if(DJ(this.data_)){let o=this.data_,n=jDe(o,e,r);return n===null?null:new t(n)}else{let o=new Uint8Array(this.data_.buffer,e,r-e);return new t(o,!0)}}static getBlob(...e){if(HR()){let r=e.map(o=>o instanceof t?o.data_:o);return new t(HDe.apply(null,r))}else{let r=e.map(a=>VR(a)?WDe(rl.RAW,a).data:a.data_),o=0;r.forEach(a=>{o+=a.byteLength});let n=new Uint8Array(o),i=0;return r.forEach(a=>{for(let s=0;s<a.length;s++)n[i++]=a[s]}),new t(n,!0)}}uploadData(){return this.data_}};function JDe(t){let e;try{e=JSON.parse(t)}catch{return null}return MDe(e)?e:null}function QDe(t){if(t.length===0)return null;let e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function ZDe(t,e){let r=e.split("/").filter(o=>o.length>0).join("/");return t.length===0?r:t+"/"+r}function YJ(t){let e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}function eRe(t,e){return e}var On=class{constructor(e,r,o,n){this.server=e,this.local=r||e,this.writable=!!o,this.xform=n||eRe}},uS=null;function tRe(t){return!VR(t)||t.length<2?t:YJ(t)}function XJ(){if(uS)return uS;let t=[];t.push(new On("bucket")),t.push(new On("generation")),t.push(new On("metageneration")),t.push(new On("name","fullPath",!0));function e(i,a){return tRe(a)}let r=new On("name");r.xform=e,t.push(r);function o(i,a){return a!==void 0?Number(a):a}let n=new On("size");return n.xform=o,t.push(n),t.push(new On("timeCreated")),t.push(new On("updated")),t.push(new On("md5Hash",null,!0)),t.push(new On("cacheControl",null,!0)),t.push(new On("contentDisposition",null,!0)),t.push(new On("contentEncoding",null,!0)),t.push(new On("contentLanguage",null,!0)),t.push(new On("contentType",null,!0)),t.push(new On("metadata","customMetadata",!0)),uS=t,uS}function rRe(t,e){function r(){let o=t.bucket,n=t.fullPath,i=new ds(o,n);return e._makeStorageReference(i)}Object.defineProperty(t,"ref",{get:r})}function oRe(t,e,r){let o={};o.type="file";let n=r.length;for(let i=0;i<n;i++){let a=r[i];o[a.local]=a.xform(o,e[a.server])}return rRe(o,t),o}function nRe(t,e,r){let o=JDe(e);return o===null?null:oRe(t,o,r)}function jR(t,e){let r={},o=e.length;for(let n=0;n<o;n++){let i=e[n];i.writable&&(r[i.server]=t[i.local])}return JSON.stringify(r)}var vu=class{constructor(e,r,o,n){this.url=e,this.method=r,this.handler=o,this.timeout=n,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}};function yu(t){if(!t)throw UR()}function mS(t,e){function r(o,n){let i=nRe(t,n,e);return yu(i!==null),i}return r}function fb(t){function e(r,o){let n;return r.getStatus()===401?r.getErrorText().includes("Firebase App Check token is invalid")?n=wDe():n=IDe():r.getStatus()===402?n=vDe(t.bucket):r.getStatus()===403?n=EDe(t.path):n=o,n.status=r.getStatus(),n.serverResponse=o.serverResponse,n}return e}function JJ(t){let e=fb(t);function r(o,n){let i=e(o,n);return o.getStatus()===404&&(i=yDe(t.path)),i.serverResponse=n.serverResponse,i}return r}function iRe(t,e,r){let o=e.fullServerUrl(),n=pS(o,t.host,t._protocol),i="GET",a=t.maxOperationRetryTime,s=new vu(n,i,mS(t,r),a);return s.errorHandler=JJ(e),s}function aRe(t,e,r,o){let n=e.fullServerUrl(),i=pS(n,t.host,t._protocol),a="PATCH",s=jR(r,o),l={"Content-Type":"application/json; charset=utf-8"},c=t.maxOperationRetryTime,u=new vu(i,a,mS(t,o),c);return u.headers=l,u.body=s,u.errorHandler=JJ(e),u}function sRe(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function QJ(t,e,r){let o=Object.assign({},r);return o.fullPath=t.path,o.size=e.size(),o.contentType||(o.contentType=sRe(null,e)),o}function lRe(t,e,r,o,n){let i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function s(){let v="";for(let C=0;C<2;C++)v=v+Math.random().toString().slice(2);return v}let l=s();a["Content-Type"]="multipart/related; boundary="+l;let c=QJ(e,o,n),u=jR(c,r),d="--"+l+`\r
48
48
  Content-Type: application/json; charset=utf-8\r
49
49
  \r
@@ -62,7 +62,7 @@ Content-Type: `+c.contentType+`\r
62
62
  `));let r=[],o=t.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let n=0;n<o.length;n++){let i=o[n];n%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r}Pe();function De(...t){return t.filter(e=>!!e).join(" ")||void 0}xo();xo();var WRe=0,Fkt=Array.isArray;function p(t,e,r,o,n,i){e||(e={});var a,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?a=e[s]:l[s]=e[s];var c={type:t,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--WRe,__i:-1,__u:0,__source:n,__self:i};if(typeof t=="function"&&(a=t.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return wt.vnode&&wt.vnode(c),c}function MQ(t){let{oldCode:e,newCode:r,className:o=""}=t,n=ve(()=>$M(e,r),[e,r]),i=W(null);V(()=>{if(i.current){let s=i.current.querySelector(".JsDiff__diffLine--added, .JsDiff__diffLine--removed");s&&s.scrollIntoView({behavior:"smooth",block:"center"})}},[e,r]);let a=()=>{let s=[],l=0;return n.forEach((c,u)=>{let d=c.added?"+":c.removed?"-":" ",f=c.value.split(`
63
63
  `);f.forEach((m,h)=>{(m.length>0||h<f.length-1)&&s.push(p("div",{className:De("JsDiff__diffLine",c.added&&"JsDiff__diffLine--added",c.removed&&"JsDiff__diffLine--removed",!c.added&&!c.removed&&"JsDiff__diffLine--unchanged"),children:[p("span",{className:"JsDiff__lineNumber",children:++l}),p("span",{className:"JsDiff__lineContent",children:[p("span",{className:"JsDiff__sign",children:d}),p("span",{children:m||" "})]})]},`${u}-${h}`))})}),s};return p("div",{className:De("JsDiff__container",o),children:p("div",{className:"JsDiff__content",ref:i,children:a()})})}var Vee=Fp(Uee(),1);var eL=Vee.default;var YLe={};function tL(t,e){let r=e||YLe,o=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,n=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return jee(t,o,n)}function jee(t,e,r){if(XLe(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Hee(t.children,e,r)}return Array.isArray(t)?Hee(t,e,r):""}function Hee(t,e,r){let o=[],n=-1;for(;++n<t.length;)o[n]=jee(t[n],e,r);return o.join("")}function XLe(t){return!!(t&&typeof t=="object")}var Gee=document.createElement("i");function vh(t){let e="&"+t+";";Gee.innerHTML=e;let r=Gee.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Po(t,e,r,o){let n=t.length,i=0,a;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,r=r>0?r:0,o.length<1e4)a=Array.from(o),a.unshift(e,r),t.splice(...a);else for(r&&t.splice(e,r);i<o.length;)a=o.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function ci(t,e){return t.length>0?(Po(t,t.length,0,e),t):e}var Wee={}.hasOwnProperty;function US(t){let e={},r=-1;for(;++r<t.length;)JLe(e,t[r]);return e}function JLe(t,e){let r;for(r in e){let n=(Wee.call(t,r)?t[r]:void 0)||(t[r]={}),i=e[r],a;if(i)for(a in i){Wee.call(n,a)||(n[a]=[]);let s=i[a];QLe(n[a],Array.isArray(s)?s:s?[s]:[])}}}function QLe(t,e){let r=-1,o=[];for(;++r<e.length;)(e[r].add==="after"?t:o).push(e[r]);Po(t,0,0,o)}function VS(t,e){let r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function jn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var zo=Tu(/[A-Za-z]/),Uo=Tu(/[\dA-Za-z]/),qee=Tu(/[#-'*+\--9=?A-Z^-~]/);function Pf(t){return t!==null&&(t<32||t===127)}var Ub=Tu(/\d/),Kee=Tu(/[\dA-Fa-f]/),Yee=Tu(/[!-/:-@[-`{-~]/);function Ne(t){return t!==null&&t<-2}function At(t){return t!==null&&(t<0||t===32)}function st(t){return t===-2||t===-1||t===32}var Of=Tu(/\p{P}|\p{S}/u),nl=Tu(/\s/);function Tu(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function nt(t,e,r,o){let n=o?o-1:Number.POSITIVE_INFINITY,i=0;return a;function a(l){return st(l)?(t.enter(r),s(l)):e(l)}function s(l){return st(l)&&i++<n?(t.consume(l),s):(t.exit(r),e(l))}}var Xee={tokenize:ZLe};function ZLe(t){let e=t.attempt(this.parser.constructs.contentInitial,o,n),r;return e;function o(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),nt(t,e,"linePrefix")}function n(s){return t.enter("paragraph"),i(s)}function i(s){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,a(s)}function a(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return Ne(s)?(t.consume(s),t.exit("chunkText"),i):(t.consume(s),a)}}var Qee={tokenize:e2e},Jee={tokenize:t2e};function e2e(t){let e=this,r=[],o=0,n,i,a;return s;function s(v){if(o<r.length){let C=r[o];return e.containerState=C[1],t.attempt(C[0].continuation,l,c)(v)}return c(v)}function l(v){if(o++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&y();let C=e.events.length,N=C,I;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){I=e.events[N][1].end;break}b(o);let E=C;for(;E<e.events.length;)e.events[E][1].end=Object.assign({},I),E++;return Po(e.events,N+1,0,e.events.slice(C)),e.events.length=E,c(v)}return s(v)}function c(v){if(o===r.length){if(!n)return f(v);if(n.currentConstruct&&n.currentConstruct.concrete)return h(v);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Jee,u,d)(v)}function u(v){return n&&y(),b(o),f(v)}function d(v){return e.parser.lazy[e.now().line]=o!==r.length,a=e.now().offset,h(v)}function f(v){return e.containerState={},t.attempt(Jee,m,h)(v)}function m(v){return o++,r.push([e.currentConstruct,e.containerState]),f(v)}function h(v){if(v===null){n&&y(),b(0),t.consume(v);return}return n=n||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),g(v)}function g(v){if(v===null){_(t.exit("chunkFlow"),!0),b(0),t.consume(v);return}return Ne(v)?(t.consume(v),_(t.exit("chunkFlow")),o=0,e.interrupt=void 0,s):(t.consume(v),g)}function _(v,C){let N=e.sliceStream(v);if(C&&N.push(null),v.previous=i,i&&(i.next=v),i=v,n.defineSkip(v.start),n.write(N),e.parser.lazy[v.start.line]){let I=n.events.length;for(;I--;)if(n.events[I][1].start.offset<a&&(!n.events[I][1].end||n.events[I][1].end.offset>a))return;let E=e.events.length,w=E,S,T;for(;w--;)if(e.events[w][0]==="exit"&&e.events[w][1].type==="chunkFlow"){if(S){T=e.events[w][1].end;break}S=!0}for(b(o),I=E;I<e.events.length;)e.events[I][1].end=Object.assign({},T),I++;Po(e.events,w+1,0,e.events.slice(E)),e.events.length=I}}function b(v){let C=r.length;for(;C-- >v;){let N=r[C];e.containerState=N[1],N[0].exit.call(e,t)}r.length=v}function y(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function t2e(t,e,r){return nt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ih(t){if(t===null||At(t)||nl(t))return 1;if(Of(t))return 2}function ku(t,e,r){let o=[],n=-1;for(;++n<t.length;){let i=t[n].resolveAll;i&&!o.includes(i)&&(e=i(e,r),o.push(i))}return e}var Vb={name:"attention",tokenize:o2e,resolveAll:r2e};function r2e(t,e){let r=-1,o,n,i,a,s,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(o=r;o--;)if(t[o][0]==="exit"&&t[o][1].type==="attentionSequence"&&t[o][1]._open&&e.sliceSerialize(t[o][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[o][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[o][1].end.offset-t[o][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[o][1].end.offset-t[o][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[o][1].end),f=Object.assign({},t[r][1].start);Zee(d,-l),Zee(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[o][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:f},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[o][1].end),end:Object.assign({},t[r][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},a.start),end:Object.assign({},s.end)},t[o][1].end=Object.assign({},a.start),t[r][1].start=Object.assign({},s.end),c=[],t[o][1].end.offset-t[o][1].start.offset&&(c=ci(c,[["enter",t[o][1],e],["exit",t[o][1],e]])),c=ci(c,[["enter",n,e],["enter",a,e],["exit",a,e],["enter",i,e]]),c=ci(c,ku(e.parser.constructs.insideSpan.null,t.slice(o+1,r),e)),c=ci(c,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",n,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=ci(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Po(t,o-1,r-o+3,c),r=o+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function o2e(t,e){let r=this.parser.constructs.attentionMarkers.null,o=this.previous,n=Ih(o),i;return a;function a(l){return i=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===i)return t.consume(l),s;let c=t.exit("attentionSequence"),u=Ih(l),d=!u||u===2&&n||r.includes(l),f=!n||n===2&&u||r.includes(o);return c._open=!!(i===42?d:d&&(n||!f)),c._close=!!(i===42?f:f&&(u||!d)),e(l)}}function Zee(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var rL={name:"autolink",tokenize:n2e};function n2e(t,e,r){let o=0;return n;function n(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(m){return zo(m)?(t.consume(m),a):m===64?r(m):c(m)}function a(m){return m===43||m===45||m===46||Uo(m)?(o=1,s(m)):c(m)}function s(m){return m===58?(t.consume(m),o=0,l):(m===43||m===45||m===46||Uo(m))&&o++<32?(t.consume(m),s):(o=0,c(m))}function l(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):m===null||m===32||m===60||Pf(m)?r(m):(t.consume(m),l)}function c(m){return m===64?(t.consume(m),u):qee(m)?(t.consume(m),c):r(m)}function u(m){return Uo(m)?d(m):r(m)}function d(m){return m===46?(t.consume(m),o=0,u):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):f(m)}function f(m){if((m===45||Uo(m))&&o++<63){let h=m===45?f:d;return t.consume(m),h}return r(m)}}var il={tokenize:i2e,partial:!0};function i2e(t,e,r){return o;function o(i){return st(i)?nt(t,n,"linePrefix")(i):n(i)}function n(i){return i===null||Ne(i)?e(i):r(i)}}var HS={name:"blockQuote",tokenize:a2e,continuation:{tokenize:s2e},exit:l2e};function a2e(t,e,r){let o=this;return n;function n(a){if(a===62){let s=o.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return r(a)}function i(a){return st(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function s2e(t,e,r){let o=this;return n;function n(a){return st(a)?nt(t,i,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(HS,e,r)(a)}}function l2e(t){t.exit("blockQuote")}var jS={name:"characterEscape",tokenize:c2e};function c2e(t,e,r){return o;function o(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),n}function n(i){return Yee(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(i)}}var GS={name:"characterReference",tokenize:u2e};function u2e(t,e,r){let o=this,n=0,i,a;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),i=31,a=Uo,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=Kee,u):(t.enter("characterReferenceValue"),i=7,a=Ub,u(d))}function u(d){if(d===59&&n){let f=t.exit("characterReferenceValue");return a===Uo&&!vh(o.sliceSerialize(f))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(d)&&n++<i?(t.consume(d),u):r(d)}}var ete={tokenize:f2e,partial:!0},WS={name:"codeFenced",tokenize:d2e,concrete:!0};function d2e(t,e,r){let o=this,n={tokenize:N,partial:!0},i=0,a=0,s;return l;function l(I){return c(I)}function c(I){let E=o.events[o.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,s=I,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(I)}function u(I){return I===s?(a++,t.consume(I),u):a<3?r(I):(t.exit("codeFencedFenceSequence"),st(I)?nt(t,d,"whitespace")(I):d(I))}function d(I){return I===null||Ne(I)?(t.exit("codeFencedFence"),o.interrupt?e(I):t.check(ete,g,C)(I)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(I))}function f(I){return I===null||Ne(I)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(I)):st(I)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,m,"whitespace")(I)):I===96&&I===s?r(I):(t.consume(I),f)}function m(I){return I===null||Ne(I)?d(I):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(I))}function h(I){return I===null||Ne(I)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(I)):I===96&&I===s?r(I):(t.consume(I),h)}function g(I){return t.attempt(n,C,_)(I)}function _(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),b}function b(I){return i>0&&st(I)?nt(t,y,"linePrefix",i+1)(I):y(I)}function y(I){return I===null||Ne(I)?t.check(ete,g,C)(I):(t.enter("codeFlowValue"),v(I))}function v(I){return I===null||Ne(I)?(t.exit("codeFlowValue"),y(I)):(t.consume(I),v)}function C(I){return t.exit("codeFenced"),e(I)}function N(I,E,w){let S=0;return T;function T($){return I.enter("lineEnding"),I.consume($),I.exit("lineEnding"),A}function A($){return I.enter("codeFencedFence"),st($)?nt(I,R,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):R($)}function R($){return $===s?(I.enter("codeFencedFenceSequence"),P($)):w($)}function P($){return $===s?(S++,I.consume($),P):S>=a?(I.exit("codeFencedFenceSequence"),st($)?nt(I,B,"whitespace")($):B($)):w($)}function B($){return $===null||Ne($)?(I.exit("codeFencedFence"),E($)):w($)}}}function f2e(t,e,r){let o=this;return n;function n(a){return a===null?r(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return o.parser.lazy[o.now().line]?r(a):e(a)}}var Hb={name:"codeIndented",tokenize:m2e},p2e={tokenize:h2e,partial:!0};function m2e(t,e,r){let o=this;return n;function n(c){return t.enter("codeIndented"),nt(t,i,"linePrefix",5)(c)}function i(c){let u=o.events[o.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):r(c)}function a(c){return c===null?l(c):Ne(c)?t.attempt(p2e,a,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||Ne(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function h2e(t,e,r){let o=this;return n;function n(a){return o.parser.lazy[o.now().line]?r(a):Ne(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n):nt(t,i,"linePrefix",5)(a)}function i(a){let s=o.events[o.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):Ne(a)?n(a):r(a)}}var oL={name:"codeText",tokenize:x2e,resolve:g2e,previous:_2e};function g2e(t){let e=t.length-4,r=3,o,n;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(o=r;++o<e;)if(t[o][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(o=r-1,e++;++o<=e;)n===void 0?o!==e&&t[o][1].type!=="lineEnding"&&(n=o):(o===e||t[o][1].type==="lineEnding")&&(t[n][1].type="codeTextData",o!==n+2&&(t[n][1].end=t[o-1][1].end,t.splice(n+2,o-n-2),e-=o-n-2,o=n+2),n=void 0);return t}function _2e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function x2e(t,e,r){let o=this,n=0,i,a;return s;function s(f){return t.enter("codeText"),t.enter("codeTextSequence"),l(f)}function l(f){return f===96?(t.consume(f),n++,l):(t.exit("codeTextSequence"),c(f))}function c(f){return f===null?r(f):f===32?(t.enter("space"),t.consume(f),t.exit("space"),c):f===96?(a=t.enter("codeTextSequence"),i=0,d(f)):Ne(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ne(f)?(t.exit("codeTextData"),c(f)):(t.consume(f),u)}function d(f){return f===96?(t.consume(f),i++,d):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(f)):(a.type="codeTextData",u(f))}}var qS=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let o=r??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,r,o){let n=r||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return o&&jb(this.left,o),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),jb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);jb(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);jb(this.left,r.reverse())}}};function jb(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function KS(t){let e={},r=-1,o,n,i,a,s,l,c,u=new qS(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(o=u.get(r),r&&o[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=o[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(o[0]==="enter")o[1].contentType&&(Object.assign(e,b2e(u,r)),r=e[r],c=!0);else if(o[1]._container){for(i=r,n=void 0;i--&&(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank");)a[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),a[1].type="lineEnding",n=i);n&&(o[1].end=Object.assign({},u.get(n)[1].start),s=u.slice(n,r),s.unshift(o),u.splice(n,r-n+1,s))}}return Po(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function b2e(t,e){let r=t.get(e)[1],o=t.get(e)[2],n=e-1,i=[],a=r._tokenizer||o.parser[r.contentType](r.start),s=a.events,l=[],c={},u,d,f=-1,m=r,h=0,g=0,_=[g];for(;m;){for(;t.get(++n)[1]!==m;);i.push(n),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),d&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=r;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(g=f+1,_.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):_.pop(),f=_.length;f--;){let b=s.slice(_[f],_[f+1]),y=i.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[h+l[f][0]]=h+l[f][1],h+=l[f][1]-l[f][0]-1;return c}var nL={tokenize:I2e,resolve:v2e},y2e={tokenize:w2e,partial:!0};function v2e(t){return KS(t),t}function I2e(t,e){let r;return o;function o(s){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),n(s)}function n(s){return s===null?i(s):Ne(s)?t.check(y2e,a,i)(s):(t.consume(s),n)}function i(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function a(s){return t.consume(s),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}function w2e(t,e,r){let o=this;return n;function n(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),nt(t,i,"linePrefix")}function i(a){if(a===null||Ne(a))return r(a);let s=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):t.interrupt(o.parser.constructs.flow,r,e)(a)}}function YS(t,e,r,o,n,i,a,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(b){return b===60?(t.enter(o),t.enter(n),t.enter(i),t.consume(b),t.exit(i),f):b===null||b===32||b===41||Pf(b)?r(b):(t.enter(o),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),g(b))}function f(b){return b===62?(t.enter(i),t.consume(b),t.exit(i),t.exit(n),t.exit(o),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(t.exit("chunkString"),t.exit(s),f(b)):b===null||b===60||Ne(b)?r(b):(t.consume(b),b===92?h:m)}function h(b){return b===60||b===62||b===92?(t.consume(b),m):m(b)}function g(b){return!u&&(b===null||b===41||At(b))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(o),e(b)):u<c&&b===40?(t.consume(b),u++,g):b===41?(t.consume(b),u--,g):b===null||b===32||b===40||Pf(b)?r(b):(t.consume(b),b===92?_:g)}function _(b){return b===40||b===41||b===92?(t.consume(b),g):g(b)}}function XS(t,e,r,o,n,i){let a=this,s=0,l;return c;function c(m){return t.enter(o),t.enter(n),t.consume(m),t.exit(n),t.enter(i),u}function u(m){return s>999||m===null||m===91||m===93&&!l||m===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?r(m):m===93?(t.exit(i),t.enter(n),t.consume(m),t.exit(n),t.exit(o),e):Ne(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||Ne(m)||s++>999?(t.exit("chunkString"),u(m)):(t.consume(m),l||(l=!st(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(t.consume(m),s++,d):d(m)}}function JS(t,e,r,o,n,i){let a;return s;function s(f){return f===34||f===39||f===40?(t.enter(o),t.enter(n),t.consume(f),t.exit(n),a=f===40?41:f,l):r(f)}function l(f){return f===a?(t.enter(n),t.consume(f),t.exit(n),t.exit(o),e):(t.enter(i),c(f))}function c(f){return f===a?(t.exit(i),l(a)):f===null?r(f):Ne(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),nt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||Ne(f)?(t.exit("chunkString"),c(f)):(t.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(t.consume(f),u):u(f)}}function Af(t,e){let r;return o;function o(n){return Ne(n)?(t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),r=!0,o):st(n)?nt(t,o,r?"linePrefix":"lineSuffix")(n):e(n)}}var iL={name:"definition",tokenize:S2e},E2e={tokenize:C2e,partial:!0};function S2e(t,e,r){let o=this,n;return i;function i(m){return t.enter("definition"),a(m)}function a(m){return XS.call(o,t,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function s(m){return n=jn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),l):r(m)}function l(m){return At(m)?Af(t,c)(m):c(m)}function c(m){return YS(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return t.attempt(E2e,d,d)(m)}function d(m){return st(m)?nt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ne(m)?(t.exit("definition"),o.parser.defined.push(n),e(m)):r(m)}}function C2e(t,e,r){return o;function o(s){return At(s)?Af(t,n)(s):r(s)}function n(s){return JS(t,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return st(s)?nt(t,a,"whitespace")(s):a(s)}function a(s){return s===null||Ne(s)?e(s):r(s)}}var aL={name:"hardBreakEscape",tokenize:T2e};function T2e(t,e,r){return o;function o(i){return t.enter("hardBreakEscape"),t.consume(i),n}function n(i){return Ne(i)?(t.exit("hardBreakEscape"),e(i)):r(i)}}var sL={name:"headingAtx",tokenize:N2e,resolve:k2e};function k2e(t,e){let r=t.length-2,o=3,n,i;return t[o][1].type==="whitespace"&&(o+=2),r-2>o&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(o===r-1||r-4>o&&t[r-2][1].type==="whitespace")&&(r-=o+1===r?2:4),r>o&&(n={type:"atxHeadingText",start:t[o][1].start,end:t[r][1].end},i={type:"chunkText",start:t[o][1].start,end:t[r][1].end,contentType:"text"},Po(t,o,r-o+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),t}function N2e(t,e,r){let o=0;return n;function n(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&o++<6?(t.consume(u),a):u===null||At(u)?(t.exit("atxHeadingSequence"),s(u)):r(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Ne(u)?(t.exit("atxHeading"),e(u)):st(u)?nt(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||At(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var tte=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lL=["pre","script","style","textarea"];var cL={name:"htmlFlow",tokenize:D2e,resolveTo:A2e,concrete:!0},P2e={tokenize:M2e,partial:!0},O2e={tokenize:R2e,partial:!0};function A2e(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function D2e(t,e,r){let o=this,n,i,a,s,l;return c;function c(U){return u(U)}function u(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),d}function d(U){return U===33?(t.consume(U),f):U===47?(t.consume(U),i=!0,g):U===63?(t.consume(U),n=3,o.interrupt?e:L):zo(U)?(t.consume(U),a=String.fromCharCode(U),_):r(U)}function f(U){return U===45?(t.consume(U),n=2,m):U===91?(t.consume(U),n=5,s=0,h):zo(U)?(t.consume(U),n=4,o.interrupt?e:L):r(U)}function m(U){return U===45?(t.consume(U),o.interrupt?e:L):r(U)}function h(U){let ge="CDATA[";return U===ge.charCodeAt(s++)?(t.consume(U),s===ge.length?o.interrupt?e:R:h):r(U)}function g(U){return zo(U)?(t.consume(U),a=String.fromCharCode(U),_):r(U)}function _(U){if(U===null||U===47||U===62||At(U)){let ge=U===47,Ce=a.toLowerCase();return!ge&&!i&&lL.includes(Ce)?(n=1,o.interrupt?e(U):R(U)):tte.includes(a.toLowerCase())?(n=6,ge?(t.consume(U),b):o.interrupt?e(U):R(U)):(n=7,o.interrupt&&!o.parser.lazy[o.now().line]?r(U):i?y(U):v(U))}return U===45||Uo(U)?(t.consume(U),a+=String.fromCharCode(U),_):r(U)}function b(U){return U===62?(t.consume(U),o.interrupt?e:R):r(U)}function y(U){return st(U)?(t.consume(U),y):T(U)}function v(U){return U===47?(t.consume(U),T):U===58||U===95||zo(U)?(t.consume(U),C):st(U)?(t.consume(U),v):T(U)}function C(U){return U===45||U===46||U===58||U===95||Uo(U)?(t.consume(U),C):N(U)}function N(U){return U===61?(t.consume(U),I):st(U)?(t.consume(U),N):v(U)}function I(U){return U===null||U===60||U===61||U===62||U===96?r(U):U===34||U===39?(t.consume(U),l=U,E):st(U)?(t.consume(U),I):w(U)}function E(U){return U===l?(t.consume(U),l=null,S):U===null||Ne(U)?r(U):(t.consume(U),E)}function w(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||At(U)?N(U):(t.consume(U),w)}function S(U){return U===47||U===62||st(U)?v(U):r(U)}function T(U){return U===62?(t.consume(U),A):r(U)}function A(U){return U===null||Ne(U)?R(U):st(U)?(t.consume(U),A):r(U)}function R(U){return U===45&&n===2?(t.consume(U),z):U===60&&n===1?(t.consume(U),H):U===62&&n===4?(t.consume(U),ne):U===63&&n===3?(t.consume(U),L):U===93&&n===5?(t.consume(U),Y):Ne(U)&&(n===6||n===7)?(t.exit("htmlFlowData"),t.check(P2e,ae,P)(U)):U===null||Ne(U)?(t.exit("htmlFlowData"),P(U)):(t.consume(U),R)}function P(U){return t.check(O2e,B,ae)(U)}function B(U){return t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),$}function $(U){return U===null||Ne(U)?P(U):(t.enter("htmlFlowData"),R(U))}function z(U){return U===45?(t.consume(U),L):R(U)}function H(U){return U===47?(t.consume(U),a="",G):R(U)}function G(U){if(U===62){let ge=a.toLowerCase();return lL.includes(ge)?(t.consume(U),ne):R(U)}return zo(U)&&a.length<8?(t.consume(U),a+=String.fromCharCode(U),G):R(U)}function Y(U){return U===93?(t.consume(U),L):R(U)}function L(U){return U===62?(t.consume(U),ne):U===45&&n===2?(t.consume(U),L):R(U)}function ne(U){return U===null||Ne(U)?(t.exit("htmlFlowData"),ae(U)):(t.consume(U),ne)}function ae(U){return t.exit("htmlFlow"),e(U)}}function R2e(t,e,r){let o=this;return n;function n(a){return Ne(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):r(a)}function i(a){return o.parser.lazy[o.now().line]?r(a):e(a)}}function M2e(t,e,r){return o;function o(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),t.attempt(il,e,r)}}var uL={name:"htmlText",tokenize:L2e};function L2e(t,e,r){let o=this,n,i,a;return s;function s(L){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(L),l}function l(L){return L===33?(t.consume(L),c):L===47?(t.consume(L),N):L===63?(t.consume(L),v):zo(L)?(t.consume(L),w):r(L)}function c(L){return L===45?(t.consume(L),u):L===91?(t.consume(L),i=0,h):zo(L)?(t.consume(L),y):r(L)}function u(L){return L===45?(t.consume(L),m):r(L)}function d(L){return L===null?r(L):L===45?(t.consume(L),f):Ne(L)?(a=d,H(L)):(t.consume(L),d)}function f(L){return L===45?(t.consume(L),m):d(L)}function m(L){return L===62?z(L):L===45?f(L):d(L)}function h(L){let ne="CDATA[";return L===ne.charCodeAt(i++)?(t.consume(L),i===ne.length?g:h):r(L)}function g(L){return L===null?r(L):L===93?(t.consume(L),_):Ne(L)?(a=g,H(L)):(t.consume(L),g)}function _(L){return L===93?(t.consume(L),b):g(L)}function b(L){return L===62?z(L):L===93?(t.consume(L),b):g(L)}function y(L){return L===null||L===62?z(L):Ne(L)?(a=y,H(L)):(t.consume(L),y)}function v(L){return L===null?r(L):L===63?(t.consume(L),C):Ne(L)?(a=v,H(L)):(t.consume(L),v)}function C(L){return L===62?z(L):v(L)}function N(L){return zo(L)?(t.consume(L),I):r(L)}function I(L){return L===45||Uo(L)?(t.consume(L),I):E(L)}function E(L){return Ne(L)?(a=E,H(L)):st(L)?(t.consume(L),E):z(L)}function w(L){return L===45||Uo(L)?(t.consume(L),w):L===47||L===62||At(L)?S(L):r(L)}function S(L){return L===47?(t.consume(L),z):L===58||L===95||zo(L)?(t.consume(L),T):Ne(L)?(a=S,H(L)):st(L)?(t.consume(L),S):z(L)}function T(L){return L===45||L===46||L===58||L===95||Uo(L)?(t.consume(L),T):A(L)}function A(L){return L===61?(t.consume(L),R):Ne(L)?(a=A,H(L)):st(L)?(t.consume(L),A):S(L)}function R(L){return L===null||L===60||L===61||L===62||L===96?r(L):L===34||L===39?(t.consume(L),n=L,P):Ne(L)?(a=R,H(L)):st(L)?(t.consume(L),R):(t.consume(L),B)}function P(L){return L===n?(t.consume(L),n=void 0,$):L===null?r(L):Ne(L)?(a=P,H(L)):(t.consume(L),P)}function B(L){return L===null||L===34||L===39||L===60||L===61||L===96?r(L):L===47||L===62||At(L)?S(L):(t.consume(L),B)}function $(L){return L===47||L===62||At(L)?S(L):r(L)}function z(L){return L===62?(t.consume(L),t.exit("htmlTextData"),t.exit("htmlText"),e):r(L)}function H(L){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),G}function G(L){return st(L)?nt(t,Y,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Y(L)}function Y(L){return t.enter("htmlTextData"),a(L)}}var Df={name:"labelEnd",tokenize:V2e,resolveTo:U2e,resolveAll:z2e},F2e={tokenize:H2e},B2e={tokenize:j2e},$2e={tokenize:G2e};function z2e(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function U2e(t,e){let r=t.length,o=0,n,i,a,s;for(;r--;)if(n=t[r][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[r][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(a){if(t[r][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=r,n.type!=="labelLink")){o=2;break}}else n.type==="labelEnd"&&(a=r);let l={type:t[i][1].type==="labelLink"?"link":"image",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[i][1].start),end:Object.assign({},t[a][1].end)},u={type:"labelText",start:Object.assign({},t[i+o+2][1].end),end:Object.assign({},t[a-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=ci(s,t.slice(i+1,i+o+3)),s=ci(s,[["enter",u,e]]),s=ci(s,ku(e.parser.constructs.insideSpan.null,t.slice(i+o+4,a-3),e)),s=ci(s,[["exit",u,e],t[a-2],t[a-1],["exit",c,e]]),s=ci(s,t.slice(a+1)),s=ci(s,[["exit",l,e]]),Po(t,i,t.length,s),t}function V2e(t,e,r){let o=this,n=o.events.length,i,a;for(;n--;)if((o.events[n][1].type==="labelImage"||o.events[n][1].type==="labelLink")&&!o.events[n][1]._balanced){i=o.events[n][1];break}return s;function s(f){return i?i._inactive?d(f):(a=o.parser.defined.includes(jn(o.sliceSerialize({start:i.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):r(f)}function l(f){return f===40?t.attempt(F2e,u,a?u:d)(f):f===91?t.attempt(B2e,u,a?c:d)(f):a?u(f):d(f)}function c(f){return t.attempt($2e,u,d)(f)}function u(f){return e(f)}function d(f){return i._balanced=!0,r(f)}}function H2e(t,e,r){return o;function o(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),n}function n(d){return At(d)?Af(t,i)(d):i(d)}function i(d){return d===41?u(d):YS(t,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return At(d)?Af(t,l)(d):u(d)}function s(d){return r(d)}function l(d){return d===34||d===39||d===40?JS(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return At(d)?Af(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function j2e(t,e,r){let o=this;return n;function n(s){return XS.call(o,t,i,a,"reference","referenceMarker","referenceString")(s)}function i(s){return o.parser.defined.includes(jn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(s):r(s)}function a(s){return r(s)}}function G2e(t,e,r){return o;function o(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),n}function n(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):r(i)}}var dL={name:"labelStartImage",tokenize:W2e,resolveAll:Df.resolveAll};function W2e(t,e,r){let o=this;return n;function n(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),i}function i(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),a):r(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?r(s):e(s)}}var fL={name:"labelStartLink",tokenize:q2e,resolveAll:Df.resolveAll};function q2e(t,e,r){let o=this;return n;function n(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in o.parser.constructs?r(a):e(a)}}var Gb={name:"lineEnding",tokenize:K2e};function K2e(t,e){return r;function r(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,e,"linePrefix")}}var Rf={name:"thematicBreak",tokenize:Y2e};function Y2e(t,e,r){let o=0,n;return i;function i(c){return t.enter("thematicBreak"),a(c)}function a(c){return n=c,s(c)}function s(c){return c===n?(t.enter("thematicBreakSequence"),l(c)):o>=3&&(c===null||Ne(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===n?(t.consume(c),o++,l):(t.exit("thematicBreakSequence"),st(c)?nt(t,s,"whitespace")(c):s(c))}}var Gn={name:"list",tokenize:Q2e,continuation:{tokenize:Z2e},exit:tFe},X2e={tokenize:rFe,partial:!0},J2e={tokenize:eFe,partial:!0};function Q2e(t,e,r){let o=this,n=o.events[o.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,a=0;return s;function s(m){let h=o.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!o.containerState.marker||m===o.containerState.marker:Ub(m)){if(o.containerState.type||(o.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(Rf,r,c)(m):c(m);if(!o.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(m)}return r(m)}function l(m){return Ub(m)&&++a<10?(t.consume(m),l):(!o.interrupt||a<2)&&(o.containerState.marker?m===o.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):r(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||m,t.check(il,o.interrupt?r:u,t.attempt(X2e,f,d))}function u(m){return o.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return st(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),f):r(m)}function f(m){return o.containerState.size=i+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function Z2e(t,e,r){let o=this;return o.containerState._closeFlow=void 0,t.check(il,n,i);function n(s){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,nt(t,e,"listItemIndent",o.containerState.size+1)(s)}function i(s){return o.containerState.furtherBlankLines||!st(s)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,a(s)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(J2e,e,a)(s))}function a(s){return o.containerState._closeFlow=!0,o.interrupt=void 0,nt(t,t.attempt(Gn,e,r),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function eFe(t,e,r){let o=this;return nt(t,n,"listItemIndent",o.containerState.size+1);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===o.containerState.size?e(i):r(i)}}function tFe(t){t.exit(this.containerState.type)}function rFe(t,e,r){let o=this;return nt(t,n,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let a=o.events[o.events.length-1];return!st(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):r(i)}}var QS={name:"setextUnderline",tokenize:nFe,resolveTo:oFe};function oFe(t,e){let r=t.length,o,n,i;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){o=r;break}t[r][1].type==="paragraph"&&(n=r)}else t[r][1].type==="content"&&t.splice(r,1),!i&&t[r][1].type==="definition"&&(i=r);let a={type:"setextHeading",start:Object.assign({},t[n][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[n][1].type="setextHeadingText",i?(t.splice(n,0,["enter",a,e]),t.splice(i+1,0,["exit",t[o][1],e]),t[o][1].end=Object.assign({},t[i][1].end)):t[o][1]=a,t.push(["exit",a,e]),t}function nFe(t,e,r){let o=this,n;return i;function i(c){let u=o.events.length,d;for(;u--;)if(o.events[u][1].type!=="lineEnding"&&o.events[u][1].type!=="linePrefix"&&o.events[u][1].type!=="content"){d=o.events[u][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||d)?(t.enter("setextHeadingLine"),n=c,a(c)):r(c)}function a(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===n?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),st(c)?nt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ne(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var rte={tokenize:iFe};function iFe(t){let e=this,r=t.attempt(il,o,t.attempt(this.parser.constructs.flowInitial,n,nt(t,t.attempt(this.parser.constructs.flow,n,t.attempt(nL,n)),"linePrefix")));return r;function o(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function n(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var ote={resolveAll:ste()},nte=ate("string"),ite=ate("text");function ate(t){return{tokenize:e,resolveAll:ste(t==="text"?aFe:void 0)};function e(r){let o=this,n=this.parser.constructs[t],i=r.attempt(n,a,s);return a;function a(u){return c(u)?i(u):s(u)}function s(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),i(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=n[u],f=-1;if(d)for(;++f<d.length;){let m=d[f];if(!m.previous||m.previous.call(o,o.previous))return!0}return!1}}}function ste(t){return e;function e(r,o){let n=-1,i;for(;++n<=r.length;)i===void 0?r[n]&&r[n][1].type==="data"&&(i=n,n++):(!r[n]||r[n][1].type!=="data")&&(n!==i+2&&(r[i][1].end=r[n-1][1].end,r.splice(i+2,n-i-2),n=i+2),i=void 0);return t?t(r,o):r}}function aFe(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let o=t[r-1][1],n=e.sliceStream(o),i=n.length,a=-1,s=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(s){let c={type:r===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:o.end.line,column:o.end.column-s,offset:o.end.offset-s,_index:o.start._index+i,_bufferIndex:i?a:o.start._bufferIndex+a},end:Object.assign({},o.end)};o.end=Object.assign({},c.start),o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function lte(t,e,r){let o=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],a=[],s=[],l=!0,c={consume:C,enter:N,exit:I,attempt:S(E),check:S(w),interrupt:S(w,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:g,sliceSerialize:h,now:_,defineSkip:b,write:m},d=e.tokenize.call(u,c),f;return e.resolveAll&&i.push(e),u;function m(P){return a=ci(a,P),y(),a[a.length-1]!==null?[]:(T(e,0),u.events=ku(i,u.events,u),u.events)}function h(P,B){return lFe(g(P),B)}function g(P){return sFe(a,P)}function _(){let{line:P,column:B,offset:$,_index:z,_bufferIndex:H}=o;return{line:P,column:B,offset:$,_index:z,_bufferIndex:H}}function b(P){n[P.line]=P.column,R()}function y(){let P;for(;o._index<a.length;){let B=a[o._index];if(typeof B=="string")for(P=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===P&&o._bufferIndex<B.length;)v(B.charCodeAt(o._bufferIndex));else v(B)}}function v(P){l=void 0,f=P,d=d(P)}function C(P){Ne(P)?(o.line++,o.column=1,o.offset+=P===-3?2:1,R()):P!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===a[o._index].length&&(o._bufferIndex=-1,o._index++)),u.previous=P,l=!0}function N(P,B){let $=B||{};return $.type=P,$.start=_(),u.events.push(["enter",$,u]),s.push($),$}function I(P){let B=s.pop();return B.end=_(),u.events.push(["exit",B,u]),B}function E(P,B){T(P,B.from)}function w(P,B){B.restore()}function S(P,B){return $;function $(z,H,G){let Y,L,ne,ae;return Array.isArray(z)?ge(z):"tokenize"in z?ge([z]):U(z);function U(Me){return ke;function ke(at){let Rt=at!==null&&Me[at],ut=at!==null&&Me.null,ht=[...Array.isArray(Rt)?Rt:Rt?[Rt]:[],...Array.isArray(ut)?ut:ut?[ut]:[]];return ge(ht)(at)}}function ge(Me){return Y=Me,L=0,Me.length===0?G:Ce(Me[L])}function Ce(Me){return ke;function ke(at){return ae=A(),ne=Me,Me.partial||(u.currentConstruct=Me),Me.name&&u.parser.constructs.disable.null.includes(Me.name)?Qe(at):Me.tokenize.call(B?Object.assign(Object.create(u),B):u,c,He,Qe)(at)}}function He(Me){return l=!0,P(ne,ae),H}function Qe(Me){return l=!0,ae.restore(),++L<Y.length?Ce(Y[L]):G}}}function T(P,B){P.resolveAll&&!i.includes(P)&&i.push(P),P.resolve&&Po(u.events,B,u.events.length-B,P.resolve(u.events.slice(B),u)),P.resolveTo&&(u.events=P.resolveTo(u.events,u))}function A(){let P=_(),B=u.previous,$=u.currentConstruct,z=u.events.length,H=Array.from(s);return{restore:G,from:z};function G(){o=P,u.previous=B,u.currentConstruct=$,u.events.length=z,s=H,R()}}function R(){o.line in n&&o.column<2&&(o.column=n[o.line],o.offset+=n[o.line]-1)}}function sFe(t,e){let r=e.start._index,o=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,a;if(r===n)a=[t[r].slice(o,i)];else{if(a=t.slice(r,n),o>-1){let s=a[0];typeof s=="string"?a[0]=s.slice(o):a.shift()}i>0&&a.push(t[n].slice(0,i))}return a}function lFe(t,e){let r=-1,o=[],n;for(;++r<t.length;){let i=t[r],a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
64
64
  `;break}case-3:{a=`\r
65
- `;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&n)continue;a=" ";break}default:a=String.fromCharCode(i)}n=i===-2,o.push(a)}return o.join("")}var pL={};nr(pL,{attentionMarkers:()=>gFe,contentInitial:()=>uFe,disable:()=>_Fe,document:()=>cFe,flow:()=>fFe,flowInitial:()=>dFe,insideSpan:()=>hFe,string:()=>pFe,text:()=>mFe});var cFe={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:HS},uFe={91:iL},dFe={[-2]:Hb,[-1]:Hb,32:Hb},fFe={35:sL,42:Rf,45:[QS,Rf],60:cL,61:QS,95:Rf,96:WS,126:WS},pFe={38:GS,92:jS},mFe={[-5]:Gb,[-4]:Gb,[-3]:Gb,33:dL,38:GS,42:Vb,60:[rL,uL],91:fL,92:[aL,jS],93:Df,95:Vb,96:oL},hFe={null:[Vb,ote]},gFe={null:[42,95]},_Fe={null:[]};function mL(t){let r=US([pL,...(t||{}).extensions||[]]),o={defined:[],lazy:{},constructs:r,content:n(Xee),document:n(Qee),flow:n(rte),string:n(nte),text:n(ite)};return o;function n(i){return a;function a(s){return lte(o,i,s)}}}function hL(t){for(;!KS(t););return t}var cte=/[\0\t\n\r]/g;function gL(){let t=1,e="",r=!0,o;return n;function n(i,a,s){let l=[],c,u,d,f,m;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,e="",r&&(i.charCodeAt(0)===65279&&d++,r=void 0);d<i.length;){if(cte.lastIndex=d,c=cte.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){e=i.slice(d);break}if(m===10&&d===f&&o)l.push(-3),o=void 0;else switch(o&&(l.push(-5),o=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),m){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:o=!0,t=1}d=f+1}return s&&(o&&l.push(-5),e&&l.push(e),l.push(null)),l}}var xFe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ute(t){return t.replace(xFe,bFe)}function bFe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let n=r.charCodeAt(1),i=n===120||n===88;return VS(r.slice(i?2:1),i?16:10)}return vh(r)||t}function wh(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?dte(t.position):"start"in t||"end"in t?dte(t):"line"in t||"column"in t?_L(t):""}function _L(t){return fte(t&&t.line)+":"+fte(t&&t.column)}function dte(t){return _L(t&&t.start)+"-"+_L(t&&t.end)}function fte(t){return t&&typeof t=="number"?t:1}var mte={}.hasOwnProperty;function xL(t,e,r){return typeof e!="string"&&(r=e,e=void 0),yFe(r)(hL(mL(r).document().write(gL()(t,e,!0))))}function yFe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ut),autolinkProtocol:S,autolinkEmail:S,atxHeading:i(Xr),blockQuote:i(at),characterEscape:S,characterReference:S,codeFenced:i(Rt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Rt,a),codeText:i(ut,a),codeTextData:S,data:S,codeFlowValue:S,definition:i(ht),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(bt),hardBreakEscape:i(Mt),hardBreakTrailing:i(Mt),htmlFlow:i(ye,a),htmlFlowData:S,htmlText:i(ye,a),htmlTextData:S,image:i(dn),label:a,link:i(Ut),listItem:i(Ur),listItemValue:f,listOrdered:i(pt,d),listUnordered:i(pt),paragraph:i(Vr),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Xr),strong:i(Do),thematicBreak:i(ie)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:ke,autolinkProtocol:Me,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:He,characterReference:Qe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:T,codeIndented:l(b),codeText:l($),codeTextData:T,data:T,definition:l(),definitionDestinationString:C,definitionLabelString:y,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(P),htmlFlowData:T,htmlText:l(B),htmlTextData:T,image:l(H),label:Y,labelText:G,lineEnding:A,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ge,resourceDestinationString:L,resourceTitleString:ne,resource:ae,setextHeading:l(w),setextHeadingLineSequence:E,setextHeadingText:I,strong:l(),thematicBreak:l()}};hte(e,(t||{}).mdastExtensions||[]);let r={};return o;function o(j){let Q={type:"root",children:[]},se={stack:[Q],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:r},Ve=[],yt=-1;for(;++yt<j.length;)if(j[yt][1].type==="listOrdered"||j[yt][1].type==="listUnordered")if(j[yt][0]==="enter")Ve.push(yt);else{let Nt=Ve.pop();yt=n(j,Nt,yt)}for(yt=-1;++yt<j.length;){let Nt=e[j[yt][0]];mte.call(Nt,j[yt][1].type)&&Nt[j[yt][1].type].call(Object.assign({sliceSerialize:j[yt][2].sliceSerialize},se),j[yt][1])}if(se.tokenStack.length>0){let Nt=se.tokenStack[se.tokenStack.length-1];(Nt[1]||pte).call(se,void 0,Nt[0])}for(Q.position={start:Nu(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Nu(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},yt=-1;++yt<e.transforms.length;)Q=e.transforms[yt](Q)||Q;return Q}function n(j,Q,se){let Ve=Q-1,yt=-1,Nt=!1,Mn,_r,Nr,Xn;for(;++Ve<=se;){let io=j[Ve];switch(io[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{io[0]==="enter"?yt++:yt--,Xn=void 0;break}case"lineEndingBlank":{io[0]==="enter"&&(Mn&&!Xn&&!yt&&!Nr&&(Nr=Ve),Xn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xn=void 0}if(!yt&&io[0]==="enter"&&io[1].type==="listItemPrefix"||yt===-1&&io[0]==="exit"&&(io[1].type==="listUnordered"||io[1].type==="listOrdered")){if(Mn){let fn=Ve;for(_r=void 0;fn--;){let pn=j[fn];if(pn[1].type==="lineEnding"||pn[1].type==="lineEndingBlank"){if(pn[0]==="exit")continue;_r&&(j[_r][1].type="lineEndingBlank",Nt=!0),pn[1].type="lineEnding",_r=fn}else if(!(pn[1].type==="linePrefix"||pn[1].type==="blockQuotePrefix"||pn[1].type==="blockQuotePrefixWhitespace"||pn[1].type==="blockQuoteMarker"||pn[1].type==="listItemIndent"))break}Nr&&(!_r||Nr<_r)&&(Mn._spread=!0),Mn.end=Object.assign({},_r?j[_r][1].start:io[1].end),j.splice(_r||Ve,0,["exit",Mn,io[2]]),Ve++,se++}if(io[1].type==="listItemPrefix"){let fn={type:"listItem",_spread:!1,start:Object.assign({},io[1].start),end:void 0};Mn=fn,j.splice(Ve,0,["enter",fn,io[2]]),Ve++,se++,Nr=void 0,Xn=!0}}}return j[Q][1]._spread=Nt,se}function i(j,Q){return se;function se(Ve){s.call(this,j(Ve),Ve),Q&&Q.call(this,Ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(j,Q,se){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([Q,se]),j.position={start:Nu(Q.start),end:void 0}}function l(j){return Q;function Q(se){j&&j.call(this,se),c.call(this,se)}}function c(j,Q){let se=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==j.type&&(Q?Q.call(this,j,Ve[0]):(Ve[1]||pte).call(this,j,Ve[0]));else throw new Error("Cannot close `"+j.type+"` ("+wh({start:j.start,end:j.end})+"): it\u2019s not open");se.position.end=Nu(j.end)}function u(){return tL(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(j){if(this.data.expectingFirstListItemValue){let Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function m(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=j}function h(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=j}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/(\r?\n|\r)$/g,"")}function y(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase()}function v(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function C(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function N(j){let Q=this.stack[this.stack.length-1];if(!Q.depth){let se=this.sliceSerialize(j).length;Q.depth=se}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function E(j){let Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function S(j){let se=this.stack[this.stack.length-1].children,Ve=se[se.length-1];(!Ve||Ve.type!=="text")&&(Ve=Be(),Ve.position={start:Nu(j.start),end:void 0},se.push(Ve)),this.stack.push(Ve)}function T(j){let Q=this.stack.pop();Q.value+=this.sliceSerialize(j),Q.position.end=Nu(j.end)}function A(j){let Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let se=Q.children[Q.children.length-1];se.position.end=Nu(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Q.type)&&(S.call(this,j),T.call(this,j))}function R(){this.data.atHardBreak=!0}function P(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function B(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function $(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function z(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function H(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function G(j){let Q=this.sliceSerialize(j),se=this.stack[this.stack.length-2];se.label=ute(Q),se.identifier=jn(Q).toLowerCase()}function Y(){let j=this.stack[this.stack.length-1],Q=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){let Ve=j.children;se.children=Ve}else se.alt=Q}function L(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function ne(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function ae(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ge(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function Ce(j){this.data.characterReferenceType=j.type}function He(j){let Q=this.sliceSerialize(j),se=this.data.characterReferenceType,Ve;se?(Ve=VS(Q,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=vh(Q);let yt=this.stack[this.stack.length-1];yt.value+=Ve}function Qe(j){let Q=this.stack.pop();Q.position.end=Nu(j.end)}function Me(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(j)}function ke(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(j)}function at(){return{type:"blockquote",children:[]}}function Rt(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bt(){return{type:"emphasis",children:[]}}function Xr(){return{type:"heading",depth:0,children:[]}}function Mt(){return{type:"break"}}function ye(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function Ut(){return{type:"link",title:null,url:"",children:[]}}function pt(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Ur(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Do(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Nu(t){return{line:t.line,column:t.column,offset:t.offset}}function hte(t,e){let r=-1;for(;++r<e.length;){let o=e[r];Array.isArray(o)?hte(t,o):vFe(t,o)}}function vFe(t,e){let r;for(r in e)if(mte.call(e,r))switch(r){case"canContainEols":{let o=e[r];o&&t[r].push(...o);break}case"transforms":{let o=e[r];o&&t[r].push(...o);break}case"enter":case"exit":{let o=e[r];o&&Object.assign(t[r],o);break}}}function pte(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+wh({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is still open")}function bL(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let o=0,n=r.indexOf(e);for(;n!==-1;)o++,n=r.indexOf(e,n+e.length);return o}function yL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Eh=(function(t){if(t==null)return SFe;if(typeof t=="function")return ZS(t);if(typeof t=="object")return Array.isArray(t)?IFe(t):wFe(t);if(typeof t=="string")return EFe(t);throw new Error("Expected function, string, or object as test")});function IFe(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Eh(t[r]);return ZS(o);function o(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function wFe(t){let e=t;return ZS(r);function r(o){let n=o,i;for(i in t)if(n[i]!==e[i])return!1;return!0}}function EFe(t){return ZS(e);function e(r){return r&&r.type===t}}function ZS(t){return e;function e(r,o,n){return!!(CFe(r)&&t.call(this,r,typeof o=="number"?o:void 0,n||void 0))}}function SFe(){return!0}function CFe(t){return t!==null&&typeof t=="object"&&"type"in t}var gte=[],_te=!0,vL=!1,xte="skip";function IL(t,e,r,o){let n;typeof e=="function"&&typeof r!="function"?(o=r,r=e):n=e;let i=Eh(n),a=o?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=gte,h,g,_;if((!e||i(l,c,u[u.length-1]||void 0))&&(m=TFe(r(l,u)),m[0]===vL))return m;if("children"in l&&l.children){let b=l;if(b.children&&m[0]!==xte)for(g=(o?b.children.length:-1)+a,_=u.concat(b);g>-1&&g<b.children.length;){let y=b.children[g];if(h=s(y,g,_)(),h[0]===vL)return h;g=typeof h[1]=="number"?h[1]:g+a}}return m}}}function TFe(t){return Array.isArray(t)?t:typeof t=="number"?[_te,t]:t==null?gte:[t]}function wL(t,e,r){let n=Eh((r||{}).ignore||[]),i=kFe(e),a=-1;for(;++a<i.length;)IL(t,"text",s);function s(c,u){let d=-1,f;for(;++d<u.length;){let m=u[d],h=f?f.children:void 0;if(n(m,h?h.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){let d=u[u.length-1],f=i[a][0],m=i[a][1],h=0,_=d.children.indexOf(c),b=!1,y=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){let C=v.index,N={index:v.index,input:v.input,stack:[...u,c]},I=m(...v,N);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?f.lastIndex=C+1:(h!==C&&y.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(I)?y.push(...I):I&&y.push(I),h=C+v[0].length,b=!0),!f.global)break;v=f.exec(c.value)}return b?(h<c.value.length&&y.push({type:"text",value:c.value.slice(h)}),d.children.splice(_,1,...y)):y=[c],_+y.length}}function kFe(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!t[0]||Array.isArray(t[0])?t:[t],o=-1;for(;++o<r.length;){let n=r[o];e.push([NFe(n[0]),PFe(n[1])])}return e}function NFe(t){return typeof t=="string"?new RegExp(yL(t),"g"):t}function PFe(t){return typeof t=="function"?t:function(){return t}}function SL(){return{transforms:[LFe],enter:{literalAutolink:OFe,literalAutolinkEmail:EL,literalAutolinkHttp:EL,literalAutolinkWww:EL},exit:{literalAutolink:MFe,literalAutolinkEmail:RFe,literalAutolinkHttp:AFe,literalAutolinkWww:DFe}}}function OFe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function EL(t){this.config.enter.autolinkProtocol.call(this,t)}function AFe(t){this.config.exit.autolinkProtocol.call(this,t)}function DFe(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function RFe(t){this.config.exit.autolinkEmail.call(this,t)}function MFe(t){this.exit(t)}function LFe(t){wL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FFe],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,BFe]],{ignore:["link","linkReference"]})}function FFe(t,e,r,o,n){let i="";if(!bte(n)||(/^w/i.test(e)&&(r=e+r,e="",i="http://"),!$Fe(r)))return!1;let a=zFe(r+o);if(!a[0])return!1;let s={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function BFe(t,e,r,o){return!bte(o,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function $Fe(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function zFe(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],o=r.indexOf(")"),n=bL(t,"("),i=bL(t,")");for(;o!==-1&&n>i;)t+=r.slice(0,o+1),r=r.slice(o+1),o=r.indexOf(")"),i++;return[t,r]}function bte(t,e){let r=t.input.charCodeAt(t.index-1);return(t.index===0||nl(r)||Of(r))&&(!e||r!==47)}XFe.peek=JFe;function CL(){return{enter:{gfmFootnoteDefinition:VFe,gfmFootnoteDefinitionLabelString:HFe,gfmFootnoteCall:WFe,gfmFootnoteCallString:qFe},exit:{gfmFootnoteDefinition:GFe,gfmFootnoteDefinitionLabelString:jFe,gfmFootnoteCall:YFe,gfmFootnoteCallString:KFe}}}function VFe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function HFe(){this.buffer()}function jFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function GFe(t){this.exit(t)}function WFe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function qFe(){this.buffer()}function KFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function YFe(t){this.exit(t)}function XFe(t,e,r,o){let n=r.createTracker(o),i=n.move("[^"),a=r.enter("footnoteReference"),s=r.enter("reference");return i+=n.move(r.safe(r.associationId(t),{...n.current(),before:i,after:"]"})),s(),a(),i+=n.move("]"),i}function JFe(){return"["}tBe.peek=rBe;function TL(){return{canContainEols:["delete"],enter:{strikethrough:ZFe},exit:{strikethrough:eBe}}}function ZFe(t){this.enter({type:"delete",children:[]},t)}function eBe(t){this.exit(t)}function tBe(t,e,r,o){let n=r.createTracker(o),i=r.enter("strikethrough"),a=n.move("~~");return a+=r.containerPhrasing(t,{...n.current(),before:a,after:"~"}),a+=n.move("~~"),i(),a}function rBe(){return"~"}function NL(){return{enter:{table:nBe,tableData:yte,tableHeader:yte,tableRow:aBe},exit:{codeText:sBe,table:iBe,tableData:kL,tableHeader:kL,tableRow:kL}}}function nBe(t){let e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function iBe(t){this.exit(t),this.data.inTable=void 0}function aBe(t){this.enter({type:"tableRow",children:[]},t)}function kL(t){this.exit(t)}function yte(t){this.enter({type:"tableCell",children:[]},t)}function sBe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,lBe));let r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function lBe(t,e){return e==="|"?e:t}function PL(){return{exit:{taskListCheckValueChecked:vte,taskListCheckValueUnchecked:vte,paragraph:uBe}}}function vte(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function uBe(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let o=r.children[0];if(o&&o.type==="text"){let n=e.children,i=-1,a;for(;++i<n.length;){let s=n[i];if(s.type==="paragraph"){a=s;break}}a===r&&(o.value=o.value.slice(1),o.value.length===0?r.children.shift():r.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,r.position.start=Object.assign({},o.position.start)))}}this.exit(t)}function OL(){return[SL(),CL(),TL(),NL(),PL()]}var fBe={tokenize:_Be,partial:!0},Ite={tokenize:xBe,partial:!0},wte={tokenize:bBe,partial:!0},Ete={tokenize:yBe,partial:!0},pBe={tokenize:vBe,partial:!0},Ste={tokenize:hBe,previous:Tte},Cte={tokenize:gBe,previous:kte},sc={tokenize:mBe,previous:Nte},al={};function DL(){return{text:al}}var Mf=48;for(;Mf<123;)al[Mf]=sc,Mf++,Mf===58?Mf=65:Mf===91&&(Mf=97);al[43]=sc;al[45]=sc;al[46]=sc;al[95]=sc;al[72]=[sc,Cte];al[104]=[sc,Cte];al[87]=[sc,Ste];al[119]=[sc,Ste];function mBe(t,e,r){let o=this,n,i;return a;function a(d){return!AL(d)||!Nte.call(o,o.previous)||RL(o.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return AL(d)?(t.consume(d),s):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(pBe,u,c)(d):d===45||d===95||Uo(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),n=!0,l}function u(d){return i&&n&&zo(o.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function hBe(t,e,r){let o=this;return n;function n(a){return a!==87&&a!==119||!Tte.call(o,o.previous)||RL(o.events)?r(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(fBe,t.attempt(Ite,t.attempt(wte,i),r),r)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function gBe(t,e,r){let o=this,n="",i=!1;return a;function a(d){return(d===72||d===104)&&kte.call(o,o.previous)&&!RL(o.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),n+=String.fromCodePoint(d),t.consume(d),s):r(d)}function s(d){if(zo(d)&&n.length<5)return n+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let f=n.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):r(d)}function c(d){return d===null||Pf(d)||At(d)||nl(d)||Of(d)?r(d):t.attempt(Ite,t.attempt(wte,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function _Be(t,e,r){let o=0;return n;function n(a){return(a===87||a===119)&&o<3?(o++,t.consume(a),n):a===46&&o===3?(t.consume(a),i):r(a)}function i(a){return a===null?r(a):e(a)}}function xBe(t,e,r){let o,n,i;return a;function a(c){return c===46||c===95?t.check(Ete,l,s)(c):c===null||At(c)||nl(c)||c!==45&&Of(c)?l(c):(i=!0,t.consume(c),a)}function s(c){return c===95?o=!0:(n=o,o=void 0),t.consume(c),a}function l(c){return n||o||!i?r(c):e(c)}}function bBe(t,e){let r=0,o=0;return n;function n(a){return a===40?(r++,t.consume(a),n):a===41&&o<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(Ete,e,i)(a):a===null||At(a)||nl(a)?e(a):(t.consume(a),n)}function i(a){return a===41&&o++,t.consume(a),n}}function yBe(t,e,r){return o;function o(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(t.consume(s),o):s===38?(t.consume(s),i):s===93?(t.consume(s),n):s===60||s===null||At(s)||nl(s)?e(s):r(s)}function n(s){return s===null||s===40||s===91||At(s)||nl(s)?e(s):o(s)}function i(s){return zo(s)?a(s):r(s)}function a(s){return s===59?(t.consume(s),o):zo(s)?(t.consume(s),a):r(s)}}function vBe(t,e,r){return o;function o(i){return t.consume(i),n}function n(i){return Uo(i)?r(i):e(i)}}function Tte(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||At(t)}function kte(t){return!zo(t)}function Nte(t){return!(t===47||AL(t))}function AL(t){return t===43||t===45||t===46||t===95||Uo(t)}function RL(t){let e=t.length,r=!1;for(;e--;){let o=t[e][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){r=!0;break}if(o._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var IBe={tokenize:NBe,partial:!0};function ML(){return{document:{91:{tokenize:CBe,continuation:{tokenize:TBe},exit:kBe}},text:{91:{tokenize:SBe},93:{add:"after",tokenize:wBe,resolveTo:EBe}}}}function wBe(t,e,r){let o=this,n=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),a;for(;n--;){let l=o.events[n][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return r(l);let c=jn(o.sliceSerialize({start:a.end,end:o.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function EBe(t,e){let r=t.length,o;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){o=t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...l),t}function SBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i=0,a;return s;function s(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!a||d===null||d===91||At(d))return r(d);if(d===93){t.exit("chunkString");let f=t.exit("gfmFootnoteCallString");return n.includes(jn(o.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return At(d)||(a=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function CBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i,a=0,s;return l;function l(h){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(h)}function u(h){if(a>999||h===93&&!s||h===null||h===91||At(h))return r(h);if(h===93){t.exit("chunkString");let g=t.exit("gfmFootnoteDefinitionLabelString");return i=jn(o.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return At(h)||(s=!0),a++,t.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,u):u(h)}function f(h){return h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),n.includes(i)||n.push(i),nt(t,m,"gfmFootnoteDefinitionWhitespace")):r(h)}function m(h){return e(h)}}function TBe(t,e,r){return t.check(il,e,t.attempt(IBe,e,r))}function kBe(t){t.exit("gfmFootnoteDefinition")}function NBe(t,e,r){let o=this;return nt(t,n,"gfmFootnoteDefinitionIndent",5);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):r(i)}}function LL(t){let r=(t||{}).singleTilde,o={tokenize:i,resolveAll:n};return r==null&&(r=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function n(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",d,s]],m=s.parser.constructs.insideSpan.null;m&&Po(f,f.length,0,ku(m,a.slice(c+1,l),s)),Po(f,f.length,0,[["exit",d,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",u,s]]),Po(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){let c=this.previous,u=this.events,d=0;return f;function f(h){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),m(h))}function m(h){let g=Ih(c);if(h===126)return d>1?l(h):(a.consume(h),d++,m);if(d<2&&!r)return l(h);let _=a.exit("strikethroughSequenceTemporary"),b=Ih(h);return _._open=!b||b===2&&!!g,_._close=!g||g===2&&!!b,s(h)}}}var eC=class{constructor(){this.map=[]}add(e,r,o){PBe(this,e,r,o)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length,o=[];for(;r>0;)r-=1,o.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];o.push([...e]),e.length=0;let n=o.pop();for(;n;)e.push(...n),n=o.pop();this.map.length=0}};function PBe(t,e,r,o){let n=0;if(!(r===0&&o.length===0)){for(;n<t.map.length;){if(t.map[n][0]===e){t.map[n][1]+=r,t.map[n][2].push(...o);return}n+=1}t.map.push([e,r,o])}}function Pte(t,e){let r=!1,o=[];for(;e<t.length;){let n=t[e];if(r){if(n[0]==="enter")n[1].type==="tableContent"&&o.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(n[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let i=o.length-1;o[i]=o[i]==="left"?"center":"right"}}else if(n[1].type==="tableDelimiterRow")break}else n[0]==="enter"&&n[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return o}function FL(){return{flow:{null:{tokenize:OBe,resolveAll:ABe}}}}function OBe(t,e,r){let o=this,n=0,i=0,a;return s;function s(T){let A=o.events.length-1;for(;A>-1;){let B=o.events[A][1].type;if(B==="lineEnding"||B==="linePrefix")A--;else break}let R=A>-1?o.events[A][1].type:null,P=R==="tableHead"||R==="tableRow"?I:l;return P===I&&o.parser.lazy[o.now().line]?r(T):P(T)}function l(T){return t.enter("tableHead"),t.enter("tableRow"),c(T)}function c(T){return T===124||(a=!0,i+=1),u(T)}function u(T){return T===null?r(T):Ne(T)?i>1?(i=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),m):r(T):st(T)?nt(t,u,"whitespace")(T):(i+=1,a&&(a=!1,n+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(T)))}function d(T){return T===null||T===124||At(T)?(t.exit("data"),u(T)):(t.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(t.consume(T),d):d(T)}function m(T){return o.interrupt=!1,o.parser.lazy[o.now().line]?r(T):(t.enter("tableDelimiterRow"),a=!1,st(T)?nt(t,h,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):h(T))}function h(T){return T===45||T===58?_(T):T===124?(a=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),g):N(T)}function g(T){return st(T)?nt(t,_,"whitespace")(T):_(T)}function _(T){return T===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),b):T===45?(i+=1,b(T)):T===null||Ne(T)?C(T):N(T)}function b(T){return T===45?(t.enter("tableDelimiterFiller"),y(T)):N(T)}function y(T){return T===45?(t.consume(T),y):T===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(T))}function v(T){return st(T)?nt(t,C,"whitespace")(T):C(T)}function C(T){return T===124?h(T):T===null||Ne(T)?!a||n!==i?N(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(T)):N(T)}function N(T){return r(T)}function I(T){return t.enter("tableRow"),E(T)}function E(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),E):T===null||Ne(T)?(t.exit("tableRow"),e(T)):st(T)?nt(t,E,"whitespace")(T):(t.enter("data"),w(T))}function w(T){return T===null||T===124||At(T)?(t.exit("data"),E(T)):(t.consume(T),T===92?S:w)}function S(T){return T===92||T===124?(t.consume(T),w):w(T)}}function ABe(t,e){let r=-1,o=!0,n=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,u,d,f=new eC;for(;++r<t.length;){let m=t[r],h=m[1];m[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(Ote(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",c,e]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(o=!0,d=void 0,i=[0,0,0,0],a=[0,r+1,0,0],s&&(s=!1,u={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",u,e]])),n=h.type==="tableDelimiterRow"?2:u?3:1):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(o=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d),i=[0,0,0,0]),a[2]=r)):h.type==="tableCellDivider"&&(o?o=!1:(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d)),i=a,a=[i[1],r,0,0])):h.type==="tableHead"?(s=!0,l=r):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],d=tC(f,e,i,n,r,d)):a[1]!==0&&(d=tC(f,e,a,n,r,d)),n=0):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&Ote(f,e,l,c,u),f.consume(e.events),r=-1;++r<e.events.length;){let m=e.events[r];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Pte(e.events,r))}return t}function tC(t,e,r,o,n,i){let a=o===1?"tableHeader":o===2?"tableDelimiter":"tableData",s="tableContent";r[0]!==0&&(i.end=Object.assign({},Sh(e.events,r[0])),t.add(r[0],0,[["exit",i,e]]));let l=Sh(e.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",i,e]]),r[2]!==0){let c=Sh(e.events,r[2]),u=Sh(e.events,r[3]),d={type:s,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),o!==2){let f=e.events[r[2]],m=e.events[r[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){let h=r[2]+1,g=r[3]-r[2]-1;t.add(h,g,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return n!==void 0&&(i.end=Object.assign({},Sh(e.events,n)),t.add(n,0,[["exit",i,e]]),i=void 0),i}function Ote(t,e,r,o,n){let i=[],a=Sh(e.events,r);n&&(n.end=Object.assign({},a),i.push(["exit",n,e])),o.end=Object.assign({},a),i.push(["exit",o,e]),t.add(r+1,0,i)}function Sh(t,e){let r=t[e],o=r[0]==="enter"?"start":"end";return r[1][o]}var DBe={tokenize:RBe};function BL(){return{text:{91:DBe}}}function RBe(t,e,r){let o=this;return n;function n(l){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return At(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),s):r(l)}function s(l){return Ne(l)?e(l):st(l)?t.check({tokenize:MBe},e,r)(l):r(l)}}function MBe(t,e,r){return nt(t,o,"whitespace");function o(n){return n===null?r(n):e(n)}}function Ate(t){return US([DL(),ML(),LL(t),FL(),BL()])}Pe();Pe();var Dte=["bmp","gif","ico","jpeg","jpg","png","tiff","webp"],Rte=[...Dte,"svg"],Mte=["mp4","webm"],LBe="https://lh3.googleusercontent.com/";async function Pu(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=await VBe(t),n=Ch(t.name),i=e?.preserveFilename?`${o}/${t.name}`:`${o}.${n}`,a=`${r}/uploads/${i}`,s=oQ(window.firebase.storage,a),l=tQ(s,t),c=-1,u=Date.now();return await new Promise((d,f)=>{let m=setInterval(()=>{Date.now()-u>1e4&&(clearInterval(m),f(new Error("Upload stalled: no progress for 10 seconds")))},1e3);l.on("state_changed",h=>{h.bytesTransferred>0&&clearInterval(m),console.log(`uploading ${t.name}: ${h.bytesTransferred} / ${h.totalBytes} bytes`),h.bytesTransferred!==c&&(c=h.bytesTransferred,u=Date.now())},h=>{clearInterval(m),f(h)},()=>{console.log(`uploaded ${a}`),clearInterval(m),d(l.snapshot)})}),FBe(s,t,n,e)}async function FBe(t,e,r,o){let n={};n.filename=e.name,n.uploadedBy=window.firebase.user.email||"unknown",n.uploadedAt=String(Math.floor(new Date().getTime()));let i=`/${t.bucket}/${t.fullPath}`,a=`https://storage.googleapis.com${i}`;if(Rte.includes(r)){let l=await zBe(e);if(n.width=l.width,n.height=l.height,!o?.disableGci&&Dte.includes(r)){let c=await $Be(i);c&&(n.gcsPath=i,a=c)}n.canvasBgColor=await jBe(e)?"dark":"light"}else if(Mte.includes(r)){let l=await UBe(a);n.width=l.width,n.height=l.height,console.log("video dimensions:",l)}let s=o?.cacheControl||"public, max-age=31536000";return await rQ(t,{cacheControl:s,customMetadata:HBe(n)}),console.log("updated meta data: ",n),{...n,src:a}}function Ch(t){return BBe(t.split(".").at(-1)||"")}function BBe(t){let e=String(t).toLowerCase();return e==="jpeg"&&(e="jpg"),e}async function $Be(t){let e=window.__ROOT_CTX.rootConfig.gci;if(!e)return"";let r=new URLSearchParams({gcs:t}),o=`${e}/_/serving_url?${r.toString()}`,n=await window.fetch(o);if(n.status!==200){let a=await n.text();throw console.error(`failed to get gci url: ${o}`),console.error(a),new Error("failed to get gci url")}return(await n.json()).servingUrl}async function zBe(t){return new Promise((e,r)=>{let o=new FileReader;o.onload=()=>{let n=new Image;n.onload=()=>{e({width:n.width,height:n.height})},n.onerror=r,n.src=String(o.result)},o.onerror=r,o.readAsDataURL(t)})}async function UBe(t){return new Promise((e,r)=>{let o=document.createElement("video");o.addEventListener("loadedmetadata",()=>{let n={width:o.videoWidth,height:o.videoHeight};e(n),document.body.removeChild(o)},!1),o.addEventListener("error",()=>{r(new Error("Failed to load video metadata")),document.body.removeChild(o)},!1),o.className="sr-only",o.src=t,o.preload="metadata",document.body.appendChild(o)})}async function VBe(t){let e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}function HBe(t){let e={};return Object.entries(t).forEach(([r,o])=>{t[r]=String(o).trim()}),e}function $L(t){if(!t)return!1;if(rC(t)||t.startsWith("data:image/"))return!0;let e=Ch(t);return Rte.includes(e)}function rC(t){return t?t.startsWith(LBe):!1}function zL(t){if(!t)return!1;let e=Ch(t);return Mte.includes(e)}function Lte(t){return rC(t)?t.split("=")[0]+"=s0-d":t}function jBe(t){return new Promise((e,r)=>{let o=new Image,n=new FileReader;n.onload=()=>{o.src=n.result},o.onload=()=>{let i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width,i.height=o.height,a.drawImage(o,0,0,i.width,i.height);let{data:s}=a.getImageData(0,0,i.width,i.height),l=0,c=0,u=0,d=0;for(let m=0;m<s.length;m+=400)l+=s[m],c+=s[m+1],u+=s[m+2],d++;let f=.299*(l/d)+.587*(c/d)+.114*(u/d);e(f<128)},o.onerror=r,n.onerror=r,n.readAsDataURL(t)})}function oC(t){let[e,r]=M(""),o=W(null),n=W(null),[i,a]=M(null),[s,l]=M(!1),c=!e;function u(b){return b.endsWith(".jpg")?"image/jpeg":"image/png"}async function d(){if(!e)return;let b=[{type:"text",text:e}];i&&b.push({type:"image",image:{src:i.src,width:i.width,height:i.height,alt:i.filename}});let y=t.chat.addMessage({sender:"user",blocks:b});r(""),a(null),f();let v=[{text:e}];i&&v.push({media:{url:i.src,contentType:u(i.filename)}});let C=await t.chat.sendPrompt(y,v,t.options);t.onData&&C&&t.onData(C)}function f(){window.requestAnimationFrame(()=>{let b=o.current;b.style.height="auto",b.style.height=`${b.scrollHeight}px`})}function m(b){if(b.key==="Enter"&&!b.shiftKey){b.preventDefault(),d();return}}async function h(b){try{l(!0),f();let y=await Pu(b,{disableGci:!0});a({src:y.src,width:y.width,height:y.height,filename:y.filename}),l(!1)}catch{l(!1)}if(n.current){let y=n.current;y.value=""}}function g(b){let C=(b.target.files||[])[0];C&&h(C)}function _(){a(null),f()}return V(()=>{f()},[e]),p("div",{className:"AIPage__ChatBar",children:[p("div",{className:De("AIPage__ChatBar__prompt",(s||i)&&"AIPage__ChatBar__prompt--hasImage"),children:[p("label",{className:"AIPage__ChatBar__prompt__imageUpload",children:[p("input",{className:"AIPage__ChatBar__prompt__imageUpload__input",type:"file",accept:"image/png, image/jpeg, image/webp",onChange:g,ref:n}),p(Se,{label:"Upload image",children:p(Je,{component:"div",className:"AIPage__ChatBar__prompt__imageUpload__icon",radius:"xl",children:p(Tb,{size:18})})})]}),p("textarea",{className:"AIPage__ChatBar__prompt__textInput",ref:o,placeholder:"Enter prompt...",rows:1,onKeyDown:m,onPaste:b=>{let y=b.clipboardData?.items||[];for(let v of y)if(v.kind==="file"&&v.type.startsWith("image/")){let C=v.getAsFile();C&&h(C)}},onChange:b=>{r(b.target.value)},value:e,autofocus:!0}),(s||i)&&p("div",{className:"AIPage__ChatBar__prompt__imagePreview",children:s?p(Ze,{size:"sm"}):p(Se,{label:i.filename,transition:"pop",position:"right",withArrow:!0,children:p("button",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton",onClick:()=>_(),children:[p("img",{src:i.src,width:i.width,height:i.height,alt:"attachment"}),p("div",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton__icon",children:p(Db,{size:24,color:"white"})})]})})}),p(Je,{className:"AIPage__ChatBar__prompt__submit",variant:"filled",color:"dark",radius:"xl",onClick:()=>d(),disabled:c,children:p(NM,{size:18})})]}),p("div",{className:"AIPage__ChatBar__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var Fte={name:"@blinkk/root-cms",version:"2.2.9",author:"s@blinkk.com",license:"MIT",engines:{node:">=16.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"tsup-node --config=./core/tsup.config.ts","//":"NOTE: esbuild is used here because tsup doesn't currently support aliases.","build:ui":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui --watch",test:"pnpm build && firebase emulators:exec 'vitest run'","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@genkit-ai/ai":"1.18.0","@genkit-ai/core":"1.18.0","@genkit-ai/vertexai":"1.18.0","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","body-parser":"1.20.2",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",genkit:"1.18.0",jsonwebtoken:"9.0.2",kleur:"4.1.5",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"3.23.8"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@mantine/spotlight":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"2.47.0","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1",concurrently:"7.6.0",esbuild:"0.25.9",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",preact:"10.27.1","preact-render-to-string":"6.6.1","preact-router":"4.1.2",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-json-view-compare":"2.0.2",tsup:"8.5.0",typescript:"5.9.2",vite:"7.1.4",vitest:"3.2.4",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"2.2.9","firebase-admin":">=11","firebase-functions":">=4",preact:">=10","preact-render-to-string":">=5"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Bte(){return p("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("g",{"clip-path":"url(#clip0_1_318)",children:[p("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),p("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),p("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),p("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),p("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),p("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),p("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),p("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),p("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),p("defs",{children:p("clipPath",{id:"clip0_1_318",children:p("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}var lc="1.5";function Fe(t){return p("div",{className:"Layout",children:[p(Fe.Top,{}),p(Fe.Side,{}),p(Fe.Main,{...t,children:t.children}),p(Fe.Bottom,{})]})}Fe.Top=()=>{let t=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId;return p("div",{className:"Layout__top",children:[p("a",{className:"Layout__top__logo",href:"/cms",children:p(Bte,{})}),p("div",{className:"Layout__top__version",children:["v",Fte.version]}),p("div",{className:"Layout__top__project",children:t})]})};Fe.Side=()=>{let[t]=sQ(),e=t.url.replace(/\/*$/g,""),r=window.firebase.user,o=window.__ROOT_CTX.sidebar?.tools,n=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),i=s=>n.has(s),a=window.__ROOT_CTX.experiments||{};return p("div",{className:"Layout__side",children:[p("div",{className:"Layout__side__buttons",children:[!i("home")&&p(Fe.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:p(xM,{stroke:lc})}),!i("content")&&p(Fe.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:p(vf,{stroke:lc})}),!i("releases")&&p(Fe.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:p(mh,{stroke:lc})}),!i("data")&&p(Fe.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:p(sM,{stroke:lc})}),!i("assets")&&p(Fe.SideButton,{label:"Assets",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:p(bS,{stroke:lc})}),!i("translations")&&p(Fe.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:p(Eu,{stroke:lc})}),a.ai&&!i("ai")&&p(Fe.SideButton,{label:"Root AI (experimental)",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:p(wf,{stroke:lc})}),o&&p(Te,{children:[p("div",{className:"Layout__side__divider"}),Object.entries(o).map(([s,l])=>{let c=l.cmsUrl?.startsWith("/cms/")?l.cmsUrl:void 0,u=l.externalUrl,d=u??c??`/cms/tools/${s}`,f=u?void 0:d.replace(/\/*$/g,""),m=!u&&!!f&&(e===f||e.startsWith(`${f}/`));return p(Fe.SideButton,{className:"Layout__side__tool",label:l.label||"",url:d,active:m,external:!!u,children:l.icon?p("img",{className:"Layout__side__tool__icon",src:l.icon,alt:l.label||""}):p(tM,{stroke:lc})},s)}),p("div",{className:"Layout__side__divider"})]}),!i("settings")&&p(Fe.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:p(Ef,{stroke:lc})})]}),p("div",{className:"Layout__side__user",children:p(Se,{label:r.email,position:"right",withArrow:!0,children:p(Ca,{src:r.photoURL,alt:r.email,size:30,radius:"xl"})})})]})};Fe.SideButton=t=>p(Se,{className:De("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:p("a",{className:De(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});Fe.Main=t=>p("div",{className:"Layout__main",children:t.children});Fe.Bottom=()=>p("div",{className:"Layout__bottom"});function ra(t){t||(t=6);let e=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length;for(let n=0;n<t;n++)e.push(r.charAt(Math.floor(Math.random()*o)));return e.join("")}function $te(t,e){return Math.random()*(e-t)+t}var WBe=[20,40];eL.configure({ignoreUnescapedHTML:!0});function zte(){return $te(...WBe)}function Wb(){let[t,e]=M([]),[r,o]=M(""),n=s=>{let l=0;return e(c=>{let u={sender:"bot",blocks:[{type:"pending"}],key:ra()},d=[...c,{...s,key:ra()},u];return l=d.length-1,d}),l},i=(s,l)=>{e(c=>{let u=[...c];return u[s]={...l,key:ra()},u})};return{chatId:r,messages:t,addMessage:n,updateMessage:i,sendPrompt:async(s,l,c)=>{let u="/cms/api/ai.chat";typeof window.__ROOT_CTX.experiments?.ai=="object"&&window.__ROOT_CTX.experiments.ai.endpoint&&(u=window.__ROOT_CTX.experiments.ai.endpoint);let d={prompt:l,chatId:r,options:c},f=await window.fetch(u,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)});if(f.status!==200){let h=await f.text();console.error("chat failed",h);let g=["Something went wrong:","```",h,"```"].join(`
65
+ `;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&n)continue;a=" ";break}default:a=String.fromCharCode(i)}n=i===-2,o.push(a)}return o.join("")}var pL={};nr(pL,{attentionMarkers:()=>gFe,contentInitial:()=>uFe,disable:()=>_Fe,document:()=>cFe,flow:()=>fFe,flowInitial:()=>dFe,insideSpan:()=>hFe,string:()=>pFe,text:()=>mFe});var cFe={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:HS},uFe={91:iL},dFe={[-2]:Hb,[-1]:Hb,32:Hb},fFe={35:sL,42:Rf,45:[QS,Rf],60:cL,61:QS,95:Rf,96:WS,126:WS},pFe={38:GS,92:jS},mFe={[-5]:Gb,[-4]:Gb,[-3]:Gb,33:dL,38:GS,42:Vb,60:[rL,uL],91:fL,92:[aL,jS],93:Df,95:Vb,96:oL},hFe={null:[Vb,ote]},gFe={null:[42,95]},_Fe={null:[]};function mL(t){let r=US([pL,...(t||{}).extensions||[]]),o={defined:[],lazy:{},constructs:r,content:n(Xee),document:n(Qee),flow:n(rte),string:n(nte),text:n(ite)};return o;function n(i){return a;function a(s){return lte(o,i,s)}}}function hL(t){for(;!KS(t););return t}var cte=/[\0\t\n\r]/g;function gL(){let t=1,e="",r=!0,o;return n;function n(i,a,s){let l=[],c,u,d,f,m;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,e="",r&&(i.charCodeAt(0)===65279&&d++,r=void 0);d<i.length;){if(cte.lastIndex=d,c=cte.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){e=i.slice(d);break}if(m===10&&d===f&&o)l.push(-3),o=void 0;else switch(o&&(l.push(-5),o=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),m){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:o=!0,t=1}d=f+1}return s&&(o&&l.push(-5),e&&l.push(e),l.push(null)),l}}var xFe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ute(t){return t.replace(xFe,bFe)}function bFe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let n=r.charCodeAt(1),i=n===120||n===88;return VS(r.slice(i?2:1),i?16:10)}return vh(r)||t}function wh(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?dte(t.position):"start"in t||"end"in t?dte(t):"line"in t||"column"in t?_L(t):""}function _L(t){return fte(t&&t.line)+":"+fte(t&&t.column)}function dte(t){return _L(t&&t.start)+"-"+_L(t&&t.end)}function fte(t){return t&&typeof t=="number"?t:1}var mte={}.hasOwnProperty;function xL(t,e,r){return typeof e!="string"&&(r=e,e=void 0),yFe(r)(hL(mL(r).document().write(gL()(t,e,!0))))}function yFe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ut),autolinkProtocol:S,autolinkEmail:S,atxHeading:i(Xr),blockQuote:i(at),characterEscape:S,characterReference:S,codeFenced:i(Rt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Rt,a),codeText:i(ut,a),codeTextData:S,data:S,codeFlowValue:S,definition:i(ht),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(bt),hardBreakEscape:i(Mt),hardBreakTrailing:i(Mt),htmlFlow:i(ye,a),htmlFlowData:S,htmlText:i(ye,a),htmlTextData:S,image:i(dn),label:a,link:i(Ut),listItem:i(Ur),listItemValue:f,listOrdered:i(pt,d),listUnordered:i(pt),paragraph:i(Vr),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Xr),strong:i(Do),thematicBreak:i(ie)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:ke,autolinkProtocol:Me,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:He,characterReference:Qe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:T,codeIndented:l(b),codeText:l($),codeTextData:T,data:T,definition:l(),definitionDestinationString:C,definitionLabelString:y,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(P),htmlFlowData:T,htmlText:l(B),htmlTextData:T,image:l(H),label:Y,labelText:G,lineEnding:A,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ge,resourceDestinationString:L,resourceTitleString:ne,resource:ae,setextHeading:l(w),setextHeadingLineSequence:E,setextHeadingText:I,strong:l(),thematicBreak:l()}};hte(e,(t||{}).mdastExtensions||[]);let r={};return o;function o(j){let Q={type:"root",children:[]},se={stack:[Q],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:r},Ve=[],yt=-1;for(;++yt<j.length;)if(j[yt][1].type==="listOrdered"||j[yt][1].type==="listUnordered")if(j[yt][0]==="enter")Ve.push(yt);else{let Nt=Ve.pop();yt=n(j,Nt,yt)}for(yt=-1;++yt<j.length;){let Nt=e[j[yt][0]];mte.call(Nt,j[yt][1].type)&&Nt[j[yt][1].type].call(Object.assign({sliceSerialize:j[yt][2].sliceSerialize},se),j[yt][1])}if(se.tokenStack.length>0){let Nt=se.tokenStack[se.tokenStack.length-1];(Nt[1]||pte).call(se,void 0,Nt[0])}for(Q.position={start:Nu(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Nu(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},yt=-1;++yt<e.transforms.length;)Q=e.transforms[yt](Q)||Q;return Q}function n(j,Q,se){let Ve=Q-1,yt=-1,Nt=!1,Mn,_r,Nr,Xn;for(;++Ve<=se;){let io=j[Ve];switch(io[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{io[0]==="enter"?yt++:yt--,Xn=void 0;break}case"lineEndingBlank":{io[0]==="enter"&&(Mn&&!Xn&&!yt&&!Nr&&(Nr=Ve),Xn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xn=void 0}if(!yt&&io[0]==="enter"&&io[1].type==="listItemPrefix"||yt===-1&&io[0]==="exit"&&(io[1].type==="listUnordered"||io[1].type==="listOrdered")){if(Mn){let fn=Ve;for(_r=void 0;fn--;){let pn=j[fn];if(pn[1].type==="lineEnding"||pn[1].type==="lineEndingBlank"){if(pn[0]==="exit")continue;_r&&(j[_r][1].type="lineEndingBlank",Nt=!0),pn[1].type="lineEnding",_r=fn}else if(!(pn[1].type==="linePrefix"||pn[1].type==="blockQuotePrefix"||pn[1].type==="blockQuotePrefixWhitespace"||pn[1].type==="blockQuoteMarker"||pn[1].type==="listItemIndent"))break}Nr&&(!_r||Nr<_r)&&(Mn._spread=!0),Mn.end=Object.assign({},_r?j[_r][1].start:io[1].end),j.splice(_r||Ve,0,["exit",Mn,io[2]]),Ve++,se++}if(io[1].type==="listItemPrefix"){let fn={type:"listItem",_spread:!1,start:Object.assign({},io[1].start),end:void 0};Mn=fn,j.splice(Ve,0,["enter",fn,io[2]]),Ve++,se++,Nr=void 0,Xn=!0}}}return j[Q][1]._spread=Nt,se}function i(j,Q){return se;function se(Ve){s.call(this,j(Ve),Ve),Q&&Q.call(this,Ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(j,Q,se){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([Q,se]),j.position={start:Nu(Q.start),end:void 0}}function l(j){return Q;function Q(se){j&&j.call(this,se),c.call(this,se)}}function c(j,Q){let se=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==j.type&&(Q?Q.call(this,j,Ve[0]):(Ve[1]||pte).call(this,j,Ve[0]));else throw new Error("Cannot close `"+j.type+"` ("+wh({start:j.start,end:j.end})+"): it\u2019s not open");se.position.end=Nu(j.end)}function u(){return tL(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(j){if(this.data.expectingFirstListItemValue){let Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function m(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=j}function h(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=j}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/(\r?\n|\r)$/g,"")}function y(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase()}function v(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function C(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function N(j){let Q=this.stack[this.stack.length-1];if(!Q.depth){let se=this.sliceSerialize(j).length;Q.depth=se}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function E(j){let Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function S(j){let se=this.stack[this.stack.length-1].children,Ve=se[se.length-1];(!Ve||Ve.type!=="text")&&(Ve=Be(),Ve.position={start:Nu(j.start),end:void 0},se.push(Ve)),this.stack.push(Ve)}function T(j){let Q=this.stack.pop();Q.value+=this.sliceSerialize(j),Q.position.end=Nu(j.end)}function A(j){let Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let se=Q.children[Q.children.length-1];se.position.end=Nu(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Q.type)&&(S.call(this,j),T.call(this,j))}function R(){this.data.atHardBreak=!0}function P(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function B(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function $(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function z(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function H(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function G(j){let Q=this.sliceSerialize(j),se=this.stack[this.stack.length-2];se.label=ute(Q),se.identifier=jn(Q).toLowerCase()}function Y(){let j=this.stack[this.stack.length-1],Q=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){let Ve=j.children;se.children=Ve}else se.alt=Q}function L(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function ne(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function ae(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ge(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function Ce(j){this.data.characterReferenceType=j.type}function He(j){let Q=this.sliceSerialize(j),se=this.data.characterReferenceType,Ve;se?(Ve=VS(Q,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=vh(Q);let yt=this.stack[this.stack.length-1];yt.value+=Ve}function Qe(j){let Q=this.stack.pop();Q.position.end=Nu(j.end)}function Me(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(j)}function ke(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(j)}function at(){return{type:"blockquote",children:[]}}function Rt(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bt(){return{type:"emphasis",children:[]}}function Xr(){return{type:"heading",depth:0,children:[]}}function Mt(){return{type:"break"}}function ye(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function Ut(){return{type:"link",title:null,url:"",children:[]}}function pt(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Ur(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Do(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Nu(t){return{line:t.line,column:t.column,offset:t.offset}}function hte(t,e){let r=-1;for(;++r<e.length;){let o=e[r];Array.isArray(o)?hte(t,o):vFe(t,o)}}function vFe(t,e){let r;for(r in e)if(mte.call(e,r))switch(r){case"canContainEols":{let o=e[r];o&&t[r].push(...o);break}case"transforms":{let o=e[r];o&&t[r].push(...o);break}case"enter":case"exit":{let o=e[r];o&&Object.assign(t[r],o);break}}}function pte(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+wh({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is still open")}function bL(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let o=0,n=r.indexOf(e);for(;n!==-1;)o++,n=r.indexOf(e,n+e.length);return o}function yL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Eh=(function(t){if(t==null)return SFe;if(typeof t=="function")return ZS(t);if(typeof t=="object")return Array.isArray(t)?IFe(t):wFe(t);if(typeof t=="string")return EFe(t);throw new Error("Expected function, string, or object as test")});function IFe(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Eh(t[r]);return ZS(o);function o(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function wFe(t){let e=t;return ZS(r);function r(o){let n=o,i;for(i in t)if(n[i]!==e[i])return!1;return!0}}function EFe(t){return ZS(e);function e(r){return r&&r.type===t}}function ZS(t){return e;function e(r,o,n){return!!(CFe(r)&&t.call(this,r,typeof o=="number"?o:void 0,n||void 0))}}function SFe(){return!0}function CFe(t){return t!==null&&typeof t=="object"&&"type"in t}var gte=[],_te=!0,vL=!1,xte="skip";function IL(t,e,r,o){let n;typeof e=="function"&&typeof r!="function"?(o=r,r=e):n=e;let i=Eh(n),a=o?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=gte,h,g,_;if((!e||i(l,c,u[u.length-1]||void 0))&&(m=TFe(r(l,u)),m[0]===vL))return m;if("children"in l&&l.children){let b=l;if(b.children&&m[0]!==xte)for(g=(o?b.children.length:-1)+a,_=u.concat(b);g>-1&&g<b.children.length;){let y=b.children[g];if(h=s(y,g,_)(),h[0]===vL)return h;g=typeof h[1]=="number"?h[1]:g+a}}return m}}}function TFe(t){return Array.isArray(t)?t:typeof t=="number"?[_te,t]:t==null?gte:[t]}function wL(t,e,r){let n=Eh((r||{}).ignore||[]),i=kFe(e),a=-1;for(;++a<i.length;)IL(t,"text",s);function s(c,u){let d=-1,f;for(;++d<u.length;){let m=u[d],h=f?f.children:void 0;if(n(m,h?h.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){let d=u[u.length-1],f=i[a][0],m=i[a][1],h=0,_=d.children.indexOf(c),b=!1,y=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){let C=v.index,N={index:v.index,input:v.input,stack:[...u,c]},I=m(...v,N);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?f.lastIndex=C+1:(h!==C&&y.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(I)?y.push(...I):I&&y.push(I),h=C+v[0].length,b=!0),!f.global)break;v=f.exec(c.value)}return b?(h<c.value.length&&y.push({type:"text",value:c.value.slice(h)}),d.children.splice(_,1,...y)):y=[c],_+y.length}}function kFe(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!t[0]||Array.isArray(t[0])?t:[t],o=-1;for(;++o<r.length;){let n=r[o];e.push([NFe(n[0]),PFe(n[1])])}return e}function NFe(t){return typeof t=="string"?new RegExp(yL(t),"g"):t}function PFe(t){return typeof t=="function"?t:function(){return t}}function SL(){return{transforms:[LFe],enter:{literalAutolink:OFe,literalAutolinkEmail:EL,literalAutolinkHttp:EL,literalAutolinkWww:EL},exit:{literalAutolink:MFe,literalAutolinkEmail:RFe,literalAutolinkHttp:AFe,literalAutolinkWww:DFe}}}function OFe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function EL(t){this.config.enter.autolinkProtocol.call(this,t)}function AFe(t){this.config.exit.autolinkProtocol.call(this,t)}function DFe(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function RFe(t){this.config.exit.autolinkEmail.call(this,t)}function MFe(t){this.exit(t)}function LFe(t){wL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FFe],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,BFe]],{ignore:["link","linkReference"]})}function FFe(t,e,r,o,n){let i="";if(!bte(n)||(/^w/i.test(e)&&(r=e+r,e="",i="http://"),!$Fe(r)))return!1;let a=zFe(r+o);if(!a[0])return!1;let s={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function BFe(t,e,r,o){return!bte(o,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function $Fe(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function zFe(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],o=r.indexOf(")"),n=bL(t,"("),i=bL(t,")");for(;o!==-1&&n>i;)t+=r.slice(0,o+1),r=r.slice(o+1),o=r.indexOf(")"),i++;return[t,r]}function bte(t,e){let r=t.input.charCodeAt(t.index-1);return(t.index===0||nl(r)||Of(r))&&(!e||r!==47)}XFe.peek=JFe;function CL(){return{enter:{gfmFootnoteDefinition:VFe,gfmFootnoteDefinitionLabelString:HFe,gfmFootnoteCall:WFe,gfmFootnoteCallString:qFe},exit:{gfmFootnoteDefinition:GFe,gfmFootnoteDefinitionLabelString:jFe,gfmFootnoteCall:YFe,gfmFootnoteCallString:KFe}}}function VFe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function HFe(){this.buffer()}function jFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function GFe(t){this.exit(t)}function WFe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function qFe(){this.buffer()}function KFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function YFe(t){this.exit(t)}function XFe(t,e,r,o){let n=r.createTracker(o),i=n.move("[^"),a=r.enter("footnoteReference"),s=r.enter("reference");return i+=n.move(r.safe(r.associationId(t),{...n.current(),before:i,after:"]"})),s(),a(),i+=n.move("]"),i}function JFe(){return"["}tBe.peek=rBe;function TL(){return{canContainEols:["delete"],enter:{strikethrough:ZFe},exit:{strikethrough:eBe}}}function ZFe(t){this.enter({type:"delete",children:[]},t)}function eBe(t){this.exit(t)}function tBe(t,e,r,o){let n=r.createTracker(o),i=r.enter("strikethrough"),a=n.move("~~");return a+=r.containerPhrasing(t,{...n.current(),before:a,after:"~"}),a+=n.move("~~"),i(),a}function rBe(){return"~"}function NL(){return{enter:{table:nBe,tableData:yte,tableHeader:yte,tableRow:aBe},exit:{codeText:sBe,table:iBe,tableData:kL,tableHeader:kL,tableRow:kL}}}function nBe(t){let e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function iBe(t){this.exit(t),this.data.inTable=void 0}function aBe(t){this.enter({type:"tableRow",children:[]},t)}function kL(t){this.exit(t)}function yte(t){this.enter({type:"tableCell",children:[]},t)}function sBe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,lBe));let r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function lBe(t,e){return e==="|"?e:t}function PL(){return{exit:{taskListCheckValueChecked:vte,taskListCheckValueUnchecked:vte,paragraph:uBe}}}function vte(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function uBe(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let o=r.children[0];if(o&&o.type==="text"){let n=e.children,i=-1,a;for(;++i<n.length;){let s=n[i];if(s.type==="paragraph"){a=s;break}}a===r&&(o.value=o.value.slice(1),o.value.length===0?r.children.shift():r.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,r.position.start=Object.assign({},o.position.start)))}}this.exit(t)}function OL(){return[SL(),CL(),TL(),NL(),PL()]}var fBe={tokenize:_Be,partial:!0},Ite={tokenize:xBe,partial:!0},wte={tokenize:bBe,partial:!0},Ete={tokenize:yBe,partial:!0},pBe={tokenize:vBe,partial:!0},Ste={tokenize:hBe,previous:Tte},Cte={tokenize:gBe,previous:kte},sc={tokenize:mBe,previous:Nte},al={};function DL(){return{text:al}}var Mf=48;for(;Mf<123;)al[Mf]=sc,Mf++,Mf===58?Mf=65:Mf===91&&(Mf=97);al[43]=sc;al[45]=sc;al[46]=sc;al[95]=sc;al[72]=[sc,Cte];al[104]=[sc,Cte];al[87]=[sc,Ste];al[119]=[sc,Ste];function mBe(t,e,r){let o=this,n,i;return a;function a(d){return!AL(d)||!Nte.call(o,o.previous)||RL(o.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return AL(d)?(t.consume(d),s):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(pBe,u,c)(d):d===45||d===95||Uo(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),n=!0,l}function u(d){return i&&n&&zo(o.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function hBe(t,e,r){let o=this;return n;function n(a){return a!==87&&a!==119||!Tte.call(o,o.previous)||RL(o.events)?r(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(fBe,t.attempt(Ite,t.attempt(wte,i),r),r)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function gBe(t,e,r){let o=this,n="",i=!1;return a;function a(d){return(d===72||d===104)&&kte.call(o,o.previous)&&!RL(o.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),n+=String.fromCodePoint(d),t.consume(d),s):r(d)}function s(d){if(zo(d)&&n.length<5)return n+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let f=n.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):r(d)}function c(d){return d===null||Pf(d)||At(d)||nl(d)||Of(d)?r(d):t.attempt(Ite,t.attempt(wte,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function _Be(t,e,r){let o=0;return n;function n(a){return(a===87||a===119)&&o<3?(o++,t.consume(a),n):a===46&&o===3?(t.consume(a),i):r(a)}function i(a){return a===null?r(a):e(a)}}function xBe(t,e,r){let o,n,i;return a;function a(c){return c===46||c===95?t.check(Ete,l,s)(c):c===null||At(c)||nl(c)||c!==45&&Of(c)?l(c):(i=!0,t.consume(c),a)}function s(c){return c===95?o=!0:(n=o,o=void 0),t.consume(c),a}function l(c){return n||o||!i?r(c):e(c)}}function bBe(t,e){let r=0,o=0;return n;function n(a){return a===40?(r++,t.consume(a),n):a===41&&o<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(Ete,e,i)(a):a===null||At(a)||nl(a)?e(a):(t.consume(a),n)}function i(a){return a===41&&o++,t.consume(a),n}}function yBe(t,e,r){return o;function o(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(t.consume(s),o):s===38?(t.consume(s),i):s===93?(t.consume(s),n):s===60||s===null||At(s)||nl(s)?e(s):r(s)}function n(s){return s===null||s===40||s===91||At(s)||nl(s)?e(s):o(s)}function i(s){return zo(s)?a(s):r(s)}function a(s){return s===59?(t.consume(s),o):zo(s)?(t.consume(s),a):r(s)}}function vBe(t,e,r){return o;function o(i){return t.consume(i),n}function n(i){return Uo(i)?r(i):e(i)}}function Tte(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||At(t)}function kte(t){return!zo(t)}function Nte(t){return!(t===47||AL(t))}function AL(t){return t===43||t===45||t===46||t===95||Uo(t)}function RL(t){let e=t.length,r=!1;for(;e--;){let o=t[e][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){r=!0;break}if(o._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var IBe={tokenize:NBe,partial:!0};function ML(){return{document:{91:{tokenize:CBe,continuation:{tokenize:TBe},exit:kBe}},text:{91:{tokenize:SBe},93:{add:"after",tokenize:wBe,resolveTo:EBe}}}}function wBe(t,e,r){let o=this,n=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),a;for(;n--;){let l=o.events[n][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return r(l);let c=jn(o.sliceSerialize({start:a.end,end:o.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function EBe(t,e){let r=t.length,o;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){o=t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...l),t}function SBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i=0,a;return s;function s(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!a||d===null||d===91||At(d))return r(d);if(d===93){t.exit("chunkString");let f=t.exit("gfmFootnoteCallString");return n.includes(jn(o.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return At(d)||(a=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function CBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i,a=0,s;return l;function l(h){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(h)}function u(h){if(a>999||h===93&&!s||h===null||h===91||At(h))return r(h);if(h===93){t.exit("chunkString");let g=t.exit("gfmFootnoteDefinitionLabelString");return i=jn(o.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return At(h)||(s=!0),a++,t.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,u):u(h)}function f(h){return h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),n.includes(i)||n.push(i),nt(t,m,"gfmFootnoteDefinitionWhitespace")):r(h)}function m(h){return e(h)}}function TBe(t,e,r){return t.check(il,e,t.attempt(IBe,e,r))}function kBe(t){t.exit("gfmFootnoteDefinition")}function NBe(t,e,r){let o=this;return nt(t,n,"gfmFootnoteDefinitionIndent",5);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):r(i)}}function LL(t){let r=(t||{}).singleTilde,o={tokenize:i,resolveAll:n};return r==null&&(r=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function n(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",d,s]],m=s.parser.constructs.insideSpan.null;m&&Po(f,f.length,0,ku(m,a.slice(c+1,l),s)),Po(f,f.length,0,[["exit",d,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",u,s]]),Po(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){let c=this.previous,u=this.events,d=0;return f;function f(h){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),m(h))}function m(h){let g=Ih(c);if(h===126)return d>1?l(h):(a.consume(h),d++,m);if(d<2&&!r)return l(h);let _=a.exit("strikethroughSequenceTemporary"),b=Ih(h);return _._open=!b||b===2&&!!g,_._close=!g||g===2&&!!b,s(h)}}}var eC=class{constructor(){this.map=[]}add(e,r,o){PBe(this,e,r,o)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length,o=[];for(;r>0;)r-=1,o.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];o.push([...e]),e.length=0;let n=o.pop();for(;n;)e.push(...n),n=o.pop();this.map.length=0}};function PBe(t,e,r,o){let n=0;if(!(r===0&&o.length===0)){for(;n<t.map.length;){if(t.map[n][0]===e){t.map[n][1]+=r,t.map[n][2].push(...o);return}n+=1}t.map.push([e,r,o])}}function Pte(t,e){let r=!1,o=[];for(;e<t.length;){let n=t[e];if(r){if(n[0]==="enter")n[1].type==="tableContent"&&o.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(n[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let i=o.length-1;o[i]=o[i]==="left"?"center":"right"}}else if(n[1].type==="tableDelimiterRow")break}else n[0]==="enter"&&n[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return o}function FL(){return{flow:{null:{tokenize:OBe,resolveAll:ABe}}}}function OBe(t,e,r){let o=this,n=0,i=0,a;return s;function s(T){let A=o.events.length-1;for(;A>-1;){let B=o.events[A][1].type;if(B==="lineEnding"||B==="linePrefix")A--;else break}let R=A>-1?o.events[A][1].type:null,P=R==="tableHead"||R==="tableRow"?I:l;return P===I&&o.parser.lazy[o.now().line]?r(T):P(T)}function l(T){return t.enter("tableHead"),t.enter("tableRow"),c(T)}function c(T){return T===124||(a=!0,i+=1),u(T)}function u(T){return T===null?r(T):Ne(T)?i>1?(i=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),m):r(T):st(T)?nt(t,u,"whitespace")(T):(i+=1,a&&(a=!1,n+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(T)))}function d(T){return T===null||T===124||At(T)?(t.exit("data"),u(T)):(t.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(t.consume(T),d):d(T)}function m(T){return o.interrupt=!1,o.parser.lazy[o.now().line]?r(T):(t.enter("tableDelimiterRow"),a=!1,st(T)?nt(t,h,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):h(T))}function h(T){return T===45||T===58?_(T):T===124?(a=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),g):N(T)}function g(T){return st(T)?nt(t,_,"whitespace")(T):_(T)}function _(T){return T===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),b):T===45?(i+=1,b(T)):T===null||Ne(T)?C(T):N(T)}function b(T){return T===45?(t.enter("tableDelimiterFiller"),y(T)):N(T)}function y(T){return T===45?(t.consume(T),y):T===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(T))}function v(T){return st(T)?nt(t,C,"whitespace")(T):C(T)}function C(T){return T===124?h(T):T===null||Ne(T)?!a||n!==i?N(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(T)):N(T)}function N(T){return r(T)}function I(T){return t.enter("tableRow"),E(T)}function E(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),E):T===null||Ne(T)?(t.exit("tableRow"),e(T)):st(T)?nt(t,E,"whitespace")(T):(t.enter("data"),w(T))}function w(T){return T===null||T===124||At(T)?(t.exit("data"),E(T)):(t.consume(T),T===92?S:w)}function S(T){return T===92||T===124?(t.consume(T),w):w(T)}}function ABe(t,e){let r=-1,o=!0,n=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,u,d,f=new eC;for(;++r<t.length;){let m=t[r],h=m[1];m[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(Ote(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",c,e]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(o=!0,d=void 0,i=[0,0,0,0],a=[0,r+1,0,0],s&&(s=!1,u={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",u,e]])),n=h.type==="tableDelimiterRow"?2:u?3:1):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(o=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d),i=[0,0,0,0]),a[2]=r)):h.type==="tableCellDivider"&&(o?o=!1:(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d)),i=a,a=[i[1],r,0,0])):h.type==="tableHead"?(s=!0,l=r):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],d=tC(f,e,i,n,r,d)):a[1]!==0&&(d=tC(f,e,a,n,r,d)),n=0):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&Ote(f,e,l,c,u),f.consume(e.events),r=-1;++r<e.events.length;){let m=e.events[r];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Pte(e.events,r))}return t}function tC(t,e,r,o,n,i){let a=o===1?"tableHeader":o===2?"tableDelimiter":"tableData",s="tableContent";r[0]!==0&&(i.end=Object.assign({},Sh(e.events,r[0])),t.add(r[0],0,[["exit",i,e]]));let l=Sh(e.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",i,e]]),r[2]!==0){let c=Sh(e.events,r[2]),u=Sh(e.events,r[3]),d={type:s,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),o!==2){let f=e.events[r[2]],m=e.events[r[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){let h=r[2]+1,g=r[3]-r[2]-1;t.add(h,g,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return n!==void 0&&(i.end=Object.assign({},Sh(e.events,n)),t.add(n,0,[["exit",i,e]]),i=void 0),i}function Ote(t,e,r,o,n){let i=[],a=Sh(e.events,r);n&&(n.end=Object.assign({},a),i.push(["exit",n,e])),o.end=Object.assign({},a),i.push(["exit",o,e]),t.add(r+1,0,i)}function Sh(t,e){let r=t[e],o=r[0]==="enter"?"start":"end";return r[1][o]}var DBe={tokenize:RBe};function BL(){return{text:{91:DBe}}}function RBe(t,e,r){let o=this;return n;function n(l){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return At(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),s):r(l)}function s(l){return Ne(l)?e(l):st(l)?t.check({tokenize:MBe},e,r)(l):r(l)}}function MBe(t,e,r){return nt(t,o,"whitespace");function o(n){return n===null?r(n):e(n)}}function Ate(t){return US([DL(),ML(),LL(t),FL(),BL()])}Pe();Pe();var Dte=["bmp","gif","ico","jpeg","jpg","png","tiff","webp"],Rte=[...Dte,"svg"],Mte=["mp4","webm"],LBe="https://lh3.googleusercontent.com/";async function Pu(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=await VBe(t),n=Ch(t.name),i=e?.preserveFilename?`${o}/${t.name}`:`${o}.${n}`,a=`${r}/uploads/${i}`,s=oQ(window.firebase.storage,a),l=tQ(s,t),c=-1,u=Date.now();return await new Promise((d,f)=>{let m=setInterval(()=>{Date.now()-u>1e4&&(clearInterval(m),f(new Error("Upload stalled: no progress for 10 seconds")))},1e3);l.on("state_changed",h=>{h.bytesTransferred>0&&clearInterval(m),console.log(`uploading ${t.name}: ${h.bytesTransferred} / ${h.totalBytes} bytes`),h.bytesTransferred!==c&&(c=h.bytesTransferred,u=Date.now())},h=>{clearInterval(m),f(h)},()=>{console.log(`uploaded ${a}`),clearInterval(m),d(l.snapshot)})}),FBe(s,t,n,e)}async function FBe(t,e,r,o){let n={};n.filename=e.name,n.uploadedBy=window.firebase.user.email||"unknown",n.uploadedAt=String(Math.floor(new Date().getTime()));let i=`/${t.bucket}/${t.fullPath}`,a=`https://storage.googleapis.com${i}`;if(Rte.includes(r)){let l=await zBe(e);if(n.width=l.width,n.height=l.height,!o?.disableGci&&Dte.includes(r)){let c=await $Be(i);c&&(n.gcsPath=i,a=c)}n.canvasBgColor=await jBe(e)?"dark":"light"}else if(Mte.includes(r)){let l=await UBe(a);n.width=l.width,n.height=l.height,console.log("video dimensions:",l)}let s=o?.cacheControl||"public, max-age=31536000";return await rQ(t,{cacheControl:s,customMetadata:HBe(n)}),console.log("updated meta data: ",n),{...n,src:a}}function Ch(t){return BBe(t.split(".").at(-1)||"")}function BBe(t){let e=String(t).toLowerCase();return e==="jpeg"&&(e="jpg"),e}async function $Be(t){let e=window.__ROOT_CTX.rootConfig.gci;if(!e)return"";let r=new URLSearchParams({gcs:t}),o=`${e}/_/serving_url?${r.toString()}`,n=await window.fetch(o);if(n.status!==200){let a=await n.text();throw console.error(`failed to get gci url: ${o}`),console.error(a),new Error("failed to get gci url")}return(await n.json()).servingUrl}async function zBe(t){return new Promise((e,r)=>{let o=new FileReader;o.onload=()=>{let n=new Image;n.onload=()=>{e({width:n.width,height:n.height})},n.onerror=r,n.src=String(o.result)},o.onerror=r,o.readAsDataURL(t)})}async function UBe(t){return new Promise((e,r)=>{let o=document.createElement("video");o.addEventListener("loadedmetadata",()=>{let n={width:o.videoWidth,height:o.videoHeight};e(n),document.body.removeChild(o)},!1),o.addEventListener("error",()=>{r(new Error("Failed to load video metadata")),document.body.removeChild(o)},!1),o.className="sr-only",o.src=t,o.preload="metadata",document.body.appendChild(o)})}async function VBe(t){let e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}function HBe(t){let e={};return Object.entries(t).forEach(([r,o])=>{t[r]=String(o).trim()}),e}function $L(t){if(!t)return!1;if(rC(t)||t.startsWith("data:image/"))return!0;let e=Ch(t);return Rte.includes(e)}function rC(t){return t?t.startsWith(LBe):!1}function zL(t){if(!t)return!1;let e=Ch(t);return Mte.includes(e)}function Lte(t){return rC(t)?t.split("=")[0]+"=s0-d":t}function jBe(t){return new Promise((e,r)=>{let o=new Image,n=new FileReader;n.onload=()=>{o.src=n.result},o.onload=()=>{let i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width,i.height=o.height,a.drawImage(o,0,0,i.width,i.height);let{data:s}=a.getImageData(0,0,i.width,i.height),l=0,c=0,u=0,d=0;for(let m=0;m<s.length;m+=400)l+=s[m],c+=s[m+1],u+=s[m+2],d++;let f=.299*(l/d)+.587*(c/d)+.114*(u/d);e(f<128)},o.onerror=r,n.onerror=r,n.readAsDataURL(t)})}function oC(t){let[e,r]=M(""),o=W(null),n=W(null),[i,a]=M(null),[s,l]=M(!1),c=!e;function u(b){return b.endsWith(".jpg")?"image/jpeg":"image/png"}async function d(){if(!e)return;let b=[{type:"text",text:e}];i&&b.push({type:"image",image:{src:i.src,width:i.width,height:i.height,alt:i.filename}});let y=t.chat.addMessage({sender:"user",blocks:b});r(""),a(null),f();let v=[{text:e}];i&&v.push({media:{url:i.src,contentType:u(i.filename)}});let C=await t.chat.sendPrompt(y,v,t.options);t.onData&&C&&t.onData(C)}function f(){window.requestAnimationFrame(()=>{let b=o.current;b.style.height="auto",b.style.height=`${b.scrollHeight}px`})}function m(b){if(b.key==="Enter"&&!b.shiftKey){b.preventDefault(),d();return}}async function h(b){try{l(!0),f();let y=await Pu(b,{disableGci:!0});a({src:y.src,width:y.width,height:y.height,filename:y.filename}),l(!1)}catch{l(!1)}if(n.current){let y=n.current;y.value=""}}function g(b){let C=(b.target.files||[])[0];C&&h(C)}function _(){a(null),f()}return V(()=>{f()},[e]),p("div",{className:"AIPage__ChatBar",children:[p("div",{className:De("AIPage__ChatBar__prompt",(s||i)&&"AIPage__ChatBar__prompt--hasImage"),children:[p("label",{className:"AIPage__ChatBar__prompt__imageUpload",children:[p("input",{className:"AIPage__ChatBar__prompt__imageUpload__input",type:"file",accept:"image/png, image/jpeg, image/webp",onChange:g,ref:n}),p(Se,{label:"Upload image",children:p(Je,{component:"div",className:"AIPage__ChatBar__prompt__imageUpload__icon",radius:"xl",children:p(Tb,{size:18})})})]}),p("textarea",{className:"AIPage__ChatBar__prompt__textInput",ref:o,placeholder:"Enter prompt...",rows:1,onKeyDown:m,onPaste:b=>{let y=b.clipboardData?.items||[];for(let v of y)if(v.kind==="file"&&v.type.startsWith("image/")){let C=v.getAsFile();C&&h(C)}},onChange:b=>{r(b.target.value)},value:e,autofocus:!0}),(s||i)&&p("div",{className:"AIPage__ChatBar__prompt__imagePreview",children:s?p(Ze,{size:"sm"}):p(Se,{label:i.filename,transition:"pop",position:"right",withArrow:!0,children:p("button",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton",onClick:()=>_(),children:[p("img",{src:i.src,width:i.width,height:i.height,alt:"attachment"}),p("div",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton__icon",children:p(Db,{size:24,color:"white"})})]})})}),p(Je,{className:"AIPage__ChatBar__prompt__submit",variant:"filled",color:"dark",radius:"xl",onClick:()=>d(),disabled:c,children:p(NM,{size:18})})]}),p("div",{className:"AIPage__ChatBar__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var Fte={name:"@blinkk/root-cms",version:"2.2.10",author:"s@blinkk.com",license:"MIT",engines:{node:">=16.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"tsup-node --config=./core/tsup.config.ts","//":"NOTE: esbuild is used here because tsup doesn't currently support aliases.","build:ui":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui --watch",test:"pnpm build && firebase emulators:exec 'vitest run'","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@genkit-ai/ai":"1.18.0","@genkit-ai/core":"1.18.0","@genkit-ai/vertexai":"1.18.0","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","body-parser":"1.20.2",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",genkit:"1.18.0",jsonwebtoken:"9.0.2",kleur:"4.1.5",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"3.23.8"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@mantine/spotlight":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"2.47.0","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1",concurrently:"7.6.0",esbuild:"0.25.9",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",preact:"10.27.1","preact-render-to-string":"6.6.1","preact-router":"4.1.2",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-json-view-compare":"2.0.2",tsup:"8.5.0",typescript:"5.9.2",vite:"7.1.4",vitest:"3.2.4",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"2.2.10","firebase-admin":">=11","firebase-functions":">=4",preact:">=10","preact-render-to-string":">=5"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Bte(){return p("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("g",{"clip-path":"url(#clip0_1_318)",children:[p("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),p("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),p("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),p("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),p("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),p("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),p("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),p("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),p("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),p("defs",{children:p("clipPath",{id:"clip0_1_318",children:p("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}var lc="1.5";function Fe(t){return p("div",{className:"Layout",children:[p(Fe.Top,{}),p(Fe.Side,{}),p(Fe.Main,{...t,children:t.children}),p(Fe.Bottom,{})]})}Fe.Top=()=>{let t=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId;return p("div",{className:"Layout__top",children:[p("a",{className:"Layout__top__logo",href:"/cms",children:p(Bte,{})}),p("div",{className:"Layout__top__version",children:["v",Fte.version]}),p("div",{className:"Layout__top__project",children:t})]})};Fe.Side=()=>{let[t]=sQ(),e=t.url.replace(/\/*$/g,""),r=window.firebase.user,o=window.__ROOT_CTX.sidebar?.tools,n=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),i=s=>n.has(s),a=window.__ROOT_CTX.experiments||{};return p("div",{className:"Layout__side",children:[p("div",{className:"Layout__side__buttons",children:[!i("home")&&p(Fe.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:p(xM,{stroke:lc})}),!i("content")&&p(Fe.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:p(vf,{stroke:lc})}),!i("releases")&&p(Fe.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:p(mh,{stroke:lc})}),!i("data")&&p(Fe.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:p(sM,{stroke:lc})}),!i("assets")&&p(Fe.SideButton,{label:"Assets",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:p(bS,{stroke:lc})}),!i("translations")&&p(Fe.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:p(Eu,{stroke:lc})}),a.ai&&!i("ai")&&p(Fe.SideButton,{label:"Root AI (experimental)",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:p(wf,{stroke:lc})}),o&&p(Te,{children:[p("div",{className:"Layout__side__divider"}),Object.entries(o).map(([s,l])=>{let c=l.cmsUrl?.startsWith("/cms/")?l.cmsUrl:void 0,u=l.externalUrl,d=u??c??`/cms/tools/${s}`,f=u?void 0:d.replace(/\/*$/g,""),m=!u&&!!f&&(e===f||e.startsWith(`${f}/`));return p(Fe.SideButton,{className:"Layout__side__tool",label:l.label||"",url:d,active:m,external:!!u,children:l.icon?p("img",{className:"Layout__side__tool__icon",src:l.icon,alt:l.label||""}):p(tM,{stroke:lc})},s)}),p("div",{className:"Layout__side__divider"})]}),!i("settings")&&p(Fe.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:p(Ef,{stroke:lc})})]}),p("div",{className:"Layout__side__user",children:p(Se,{label:r.email,position:"right",withArrow:!0,children:p(Ca,{src:r.photoURL,alt:r.email,size:30,radius:"xl"})})})]})};Fe.SideButton=t=>p(Se,{className:De("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:p("a",{className:De(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});Fe.Main=t=>p("div",{className:"Layout__main",children:t.children});Fe.Bottom=()=>p("div",{className:"Layout__bottom"});function ra(t){t||(t=6);let e=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length;for(let n=0;n<t;n++)e.push(r.charAt(Math.floor(Math.random()*o)));return e.join("")}function $te(t,e){return Math.random()*(e-t)+t}var WBe=[20,40];eL.configure({ignoreUnescapedHTML:!0});function zte(){return $te(...WBe)}function Wb(){let[t,e]=M([]),[r,o]=M(""),n=s=>{let l=0;return e(c=>{let u={sender:"bot",blocks:[{type:"pending"}],key:ra()},d=[...c,{...s,key:ra()},u];return l=d.length-1,d}),l},i=(s,l)=>{e(c=>{let u=[...c];return u[s]={...l,key:ra()},u})};return{chatId:r,messages:t,addMessage:n,updateMessage:i,sendPrompt:async(s,l,c)=>{let u="/cms/api/ai.chat";typeof window.__ROOT_CTX.experiments?.ai=="object"&&window.__ROOT_CTX.experiments.ai.endpoint&&(u=window.__ROOT_CTX.experiments.ai.endpoint);let d={prompt:l,chatId:r,options:c},f=await window.fetch(u,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)});if(f.status!==200){let h=await f.text();console.error("chat failed",h);let g=["Something went wrong:","```",h,"```"].join(`
66
66
  `);return i(s,{sender:"bot",blocks:[{type:"text",text:g}]}),{message:g,data:{},error:h}}let m=await f.json();return m.success&&m.chatId?(o(m.chatId),i(s,{sender:"bot",data:m.response?.data||{},blocks:[{type:"text",text:m.response?.message||""}]}),m.response):{message:"Sorry. Something went wrong. An unknown error occurred.",data:{},error:"Unknown error"}}}}function Ute(){let t=Wb(),e=window.__ROOT_CTX.experiments?.ai||!1;return p(Fe,{children:p("div",{className:"AIPage",children:e?p(Te,{children:[p(UL,{chat:t,children:p("p",{children:"Chat with me about your website. Ask questions about the content and I can tell you about it."})}),p(oC,{chat:t})]}):p("div",{className:"AIPage__notEnabled",children:[p("div",{className:"AIPage__notEnabled__icon",children:p(wf,{size:36})}),p("div",{className:"AIPage__notEnabled__title",children:"Root AI is not enabled for this project."})]})})})}function UL(t){let e=t.chat.messages;return p("div",{className:"AIPage__ChatWindow",children:e.length>0?p("div",{className:"AIPage__ChatWindow__messages",children:t.chat.messages.map((r,o)=>p(qBe,{message:r},r.key||o))}):p("div",{className:"AIPage__ChatWindow__welcome",children:[p("div",{className:"AIPage__ChatWindow__welcome__icon",children:p(wf,{size:36})}),p("div",{className:"AIPage__ChatWindow__welcome__title",children:"Root AI is ready"}),t.children&&p("div",{className:"AIPage__ChatWindow__welcome__body",children:t.children})]})})}function qBe(t){let e=t.message,r=e.sender==="user"?"You":"Root AI",o=window.firebase.user,n=e.sender==="bot",i=W(null);return V(()=>{e.sender==="user"&&i.current.scrollIntoView({behavior:"smooth",block:"start"})},[]),p("div",{className:"AIPage__ChatMessage",ref:i,children:[p("div",{className:"AIPage__ChatMessage__side",children:p("div",{className:"AIPage__ChatMessage__side__avatar",children:e.sender==="user"?p(Ca,{src:o.photoURL,alt:o.email,size:28,radius:"xl"}):p(wf,{size:28})})}),p("div",{className:"AIPage__ChatMessage__main",children:[p("div",{className:"AIPage__ChatMessage__main__username",children:r}),p("div",{className:"AIPage__ChatMessage__main__blocks",children:p(KBe,{message:e,animated:n})})]})]})}function KBe(t){let e=t.message,[r,o]=M(t.animated?[]:e.blocks);function n(){if(r.length>=e.blocks.length)return;let i=[...r,e.blocks[r.length]];o(i)}return V(()=>{t.animated&&n()},[t.animated]),p("div",{className:"AIPage__ChatMessageBlocks",children:r.map((i,a)=>{let s=`${a}-${i.type}`;return i.type==="image"?p(QBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):i.type==="pending"?p(JBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):i.type==="text"?p(YBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):p("div",{children:["unknown block type: ",i.type]})})})}function Vte(t){let[e,r]=M(t.animated?[]:t.nodes),o=e.length>=t.nodes.length,n=()=>{r(a=>a.length>=t.nodes.length?t.nodes:[...a,t.nodes[a.length]])},i=()=>{if(e.length>=t.nodes.length){t.onAnimationComplete&&t.onAnimationComplete();return}window.setTimeout(()=>n(),zte())};return V(()=>{t.animated&&n()},[]),{nodes:e,next:i,complete:o}}function YBe(t){let e=ve(()=>xL(t.block.text,{extensions:[Ate()],mdastExtensions:[OL()]}),[t.block.text]),{nodes:r,next:o}=Vte({nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete});return p("div",{className:"AIPage__ChatMessageTextBlock",children:r.map((n,i)=>p(Hte,{node:n,animated:t.animated,onAnimationComplete:o},i))})}function Hte(t){let e=t.node;if(e.type==="code")return p(XBe,{text:e.value,language:e.lang,animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="heading"){let r=`h${e.depth||2}`;return p(Lf,{as:r,nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete})}if(e.type==="inlineCode")return p(Lf,{as:"code",nodes:[{type:"text",value:e.value}],animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="link")return p(Lf,{as:"a",attrs:{href:e.url,target:"_blank"},nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="list"){let r=e.ordered?"ol":"ul";return p(Lf,{as:r,nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete})}return e.type==="listItem"?p(Lf,{as:"li",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="paragraph"?p(Lf,{as:"p",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="strong"?p(Lf,{as:"b",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="text"?p(jte,{text:e.value,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):p("div",{children:JSON.stringify(t.node)})}function Lf(t){let{nodes:e,next:r}=Vte({nodes:t.nodes,animated:t.animated,onAnimationComplete:t.onAnimationComplete}),o=t.as;return p(o,{...t.attrs,children:e.map((n,i)=>p(Hte,{node:n,animated:t.animated,onAnimationComplete:()=>r()},i))})}function jte(t){let e=t.sep||" ",r=ve(()=>t.text.split(e),[t.text]),[o,n]=M(t.animated?0:r.length),i=o>=r.length;return V(()=>{if(!t.animated||o>=r.length)return;let a=window.setTimeout(()=>{n(o+1)},zte());return()=>window.clearTimeout(a)},[t.text,o]),V(()=>{i&&t.animated&&t.onAnimationComplete()},[i]),p(Te,{children:[r.slice(0,o).join(e),!i&&p(Gte,{})]})}function XBe(t){let e=W(null),[r,o]=M(!1);function n(){let s=e.current;eL.highlightElement(s),console.log("highlight:",s)}async function i(){try{await navigator.clipboard.writeText(t.text),o(!0),window.setTimeout(()=>{o(!1)},2e3)}catch(s){console.error("failed to copy to clipboard:",s)}}function a(){n(),t.onAnimationComplete()}return V(()=>{t.animated||n()},[t.animated]),p("div",{className:"AIPage__CodeBlockNode",children:[p("div",{className:"AIPage__CodeBlockNode__header",children:[t.language&&p("div",{className:"AIPage__CodeBlockNode__language",children:t.language}),p(Se,{label:"Copy code",position:"bottom",transition:"pop",children:p(Je,{onClick:()=>i(),size:"xs",children:r?p(nM,{color:"#80868b","stroke-width":1.5,size:16}):p(xb,{color:"#80868b","stroke-width":1.5,size:16})})})]}),p("pre",{ref:e,class:`language-${t.language||"unknown"}`,children:p(jte,{text:t.text,sep:`
67
67
  `,animated:t.animated,onAnimationComplete:a})})]})}function JBe(t){return V(()=>{t.animated&&t.onAnimationComplete()},[]),p("div",{className:"AIPage__PendingMessageBlock",children:p(Gte,{})})}function Gte(){return p("div",{className:"AIPage__CursorDot"})}function QBe(t){let e=t.block.image;return V(()=>{t.animated&&t.onAnimationComplete()},[]),p("div",{className:"AIPage__ImageMessageBlock",children:p("img",{src:e.src,width:e.width,height:e.height,alt:e.alt})})}function Wte(t){let e=Wb();return p(Te,{children:[p(UL,{chat:e,children:t.children}),p(oC,{chat:e,options:{mode:"edit",editData:t.editModeData},onData:t.onEditModeResponse})]})}var VL="AiEditModal";function qte(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(VL,{...e,title:r.title||"Edit with AI (Experimental)",innerProps:r,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(VL)}}}function nC(t){let{innerProps:e,context:r,id:o}=t,n=W(null),i=ve(()=>JSON.stringify(e.data||{},null,2),[e.data]),[a,s]=M(i),l=ve(()=>{if(!a)return null;try{return JSON.parse(a)}catch{return null}},[a]),c=ve(()=>a!==i,[a,i]),u=qe(()=>{if(!l)return;let f=_h(l);e.onSave&&e.onSave(f)},[l]),d=qe(f=>{if(f?.data){let m=JSON.stringify(f.data,null,2);s(m),n.current?.click()}},[]);return p("div",{className:"AiEditModal",children:[p("div",{className:"AiEditModal__SplitPanel",children:[p("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:p(Wte,{editModeData:l,onEditModeResponse:d,children:[p("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),p("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),p("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:p(Gs,{className:"AiEditModal__Tabs",grow:!0,children:[p(Gs.Tab,{label:"JSON",icon:p(yM,{size:20}),children:p("div",{className:"AiEditModal__JsonEditor",children:p(Zc,{value:a,onChange:f=>s(f),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),p(Gs.Tab,{ref:n,label:"Diff",icon:p(fM,{size:20}),children:p("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&a&&p(MQ,{oldCode:i,newCode:a})})})]})})]}),p("div",{className:"AiEditModal__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{variant:"default",size:"xs",type:"button",leftIcon:p(mb,{size:16}),disabled:!c,onClick:()=>s(i),children:"Reset"}),p(re,{leftIcon:p(_b,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:u,children:"Accept changes"})]})]})}nC.id=VL;Pe();var ZBe=/^[a-z0-9_]+(?:--?[a-z0-9_]+)*$/;function sl(t,e){e||(e=ZBe);let r=typeof e=="string"?new RegExp(e):e;return!!(t&&r.test(t))}function Ou(t){return t.replace(/^[\s/]*/g,"").replace(/[\s/]*$/g,"").replace(/^\/+|\/+$/g,"").replaceAll("/","--")}Pe();function Ye(t){let{className:e,as:r,size:o,weight:n,color:i,children:a,...s}=t;return p(r||"div",{...s,className:De(e,"text",o&&`size:${o}`,n&&`weight:${n}`,i&&`color:${i}`),children:a})}function fs(t){let r=window.__ROOT_CTX.collections[t.collectionId];if(!r)throw new Error(`collection not found: ${t.collectionId}`);let o=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",n=HL(t);return`${o}${n}`}function HL(t){let e=window.__ROOT_CTX.collections,{collectionId:r,slug:o,locale:n}=t,i=e[r];if(!i)throw new Error(`collection not found: ${r}`);let a=window.__ROOT_CTX.rootConfig,s=a.base||"/",l="/[base]/[path]";n&&(l=a.i18n.urlFormat||"/[locale]/[base]/[path]");let c="",u=i?.url;if(u)if(o){let d=u.replace(/\[.*slug\]/,o).replaceAll("--","/").replace(/\/+/g,"/");d==="/index"&&(d="/"),c=d}else c=u;return Kte(l,{base:s,path:c,locale:n||"",slug:o})}function iC(t){let e=window.__ROOT_CTX.collections,{collectionId:r,slug:o,locale:n}=t,i=e[r];if(!i)throw new Error(`collection not found: ${r}`);let a=window.__ROOT_CTX.rootConfig,s=a.base||"/",l="/[base]/[path]";n&&(l=a.i18n.urlFormat||"/[locale]/[base]/[path]");let c="",u=i?.previewUrl||i?.url;if(u)if(o){let d=u.replace(/\[.*slug\]/,o).replaceAll("--","/").replace(/\/+/g,"/");d==="/index"&&(d="/"),c=d}else c=u;return Kte(l,{base:s,path:c,locale:n||"",slug:o})}function Kte(t,e){let r=t.replaceAll(/\[\[?(\.\.\.)?([\w\-_]*)\]?\]/g,(o,n,i)=>e[i]??o);return e4e(r,{trailingSlash:window.__ROOT_CTX.rootConfig.server.trailingSlash})}function e4e(t,e){return t=t.replace(/\/+/g,"/"),e?.trailingSlash===!1&&t!=="/"&&t.endsWith("/")&&(t=t.replace(/\/*$/g,"")),(t.endsWith("/index")||t.endsWith("/index/"))&&(t=t.slice(0,-6)),t.startsWith("/")||(t=`/${t}`),e?.trailingSlash&&!t.endsWith("/")&&(t=`${t}/`),t}function aC(t){let[e,r]=M(t.collectionId||""),o=W(null),[n,i]=M(""),a=window.__ROOT_CTX.collections[e],s=[];t.collectionId&&t.collectionDisabled?s.push({value:t.collectionId,label:t.collectionId}):Object.keys(window.__ROOT_CTX.collections).forEach(d=>{s.push({value:d,label:d})});let l="";if(a?.url){if(n){let d=Ou(n),f=a?.slugRegex;sl(d,f)?l=fs({collectionId:e,slug:d}):l="INVALID SLUG"}else l=fs({collectionId:e,slug:"[slug]"});l.endsWith("/index")&&(l=l.replace(/\/index$/,"/"))}function c(d){r(d),t.onChange&&t.onChange({collectionId:d,slug:n})}function u(d){i(d),t.onChange&&t.onChange({collectionId:e,slug:d})}return p("div",{className:De(t.className,"SlugInput"),children:[p("div",{className:"SlugInput__inputs",children:[p(Er,{className:"SlugInput__collection",placeholder:"Collection",size:"xs",data:s,onChange:d=>c(d),value:e,disabled:!!t.collectionDisabled}),p("div",{className:"SlugInput__divider",children:"/"}),p(ir,{className:"SlugInput__slug",name:"slug",ref:o,value:n,onChange:d=>{u(d.currentTarget.value)},placeholder:"slug",autoComplete:"off",size:"xs"})]}),l&&p(Ye,{className:"SlugInput__urlHelp",size:"body-sm",children:l})]})}var Yte="CopyDocModal";function sC(t){let e=Ct(),r=Vt();return{open:o=>{e.openContextModal(Yte,{...r,innerProps:{...t,...o}})}}}function lC(t){let{innerProps:e,context:r,id:o}=t,[n,i]=M(""),[a,s]=M(""),[l,c]=M(""),[u,d]=M(!1),[f,m]=M(!1),h=e.fromDocId,g=h.split("/")[0],_=e.fromLabel||h;async function b(y){if(y.preventDefault(),m(!0),c(""),!g){c("Please select a collection."),m(!1);return}let v=Ou(a),C=window.__ROOT_CTX.collections[n]?.slugRegex;if(!sl(v,C)){c('Please enter a valid slug (e.g. "foo-bar-123").'),m(!1);return}let N=`${n}/${v}`;try{e.fields?await Lb(N,{fields:e.fields,overwrite:u}):await kQ(h,N,{overwrite:u}),r.closeModal(o),Ae({title:"Copied!",message:`Succesfully copied ${_} to ${N}.`,autoClose:5e3}),e.onSuccess&&e.onSuccess(N)}catch(I){let E=String(I);c(E),E.includes("already exists")&&d(!0),m(!1);return}m(!1),mo(`/cms/content/${n}/${v}`)}return p("div",{className:"CopyDocModal",children:p("form",{onSubmit:y=>b(y),children:[p("div",{className:"CopyDocModal__from",children:[p(Ye,{className:"CopyDocModal__from__label",size:"body",weight:"bold",children:"From:"}),p(Ye,{className:"CopyDocModal__from__value",size:"body-sm",children:p("code",{children:_})})]}),p("div",{className:"CopyDocModal__to",children:[p(Ye,{className:"CopyDocModal__to__label",size:"body",weight:"bold",children:"To:"}),p(aC,{className:"CopyDocModal__slug",collectionId:g,onChange:y=>{i(y.collectionId),s(y.slug)}})]}),l&&p("div",{className:"CopyDocModal__error",children:l}),p("div",{className:"CopyDocModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:f,children:u?"Overwrite?":"Submit"})]})]})})}lC.id=Yte;Pe();async function Xte(){let t=window.firebase.db,e=window.__ROOT_CTX.rootConfig.projectId||"default",r=$e(t,"Projects",e),o=await ko(r);if(!o.exists)return[];let i=(o.data()||{}).roles||{},a=[];return Object.entries(i).forEach(([s,l])=>{(l==="ADMIN"||l==="EDITOR")&&a.push(s)}),a}var ll=class t{constructor(e){this.spreadsheetId=e}static async create(e){let r=e.share??!1,o={fields:"spreadsheetId"};e?.title&&(o.resource={properties:{title:e.title}});let i=(await gapi.client.sheets.spreadsheets.create(o)).result,a=new t(i.spreadsheetId);if(a.setSpreadsheet(i),e?.parent&&await gapi.client.drive.files.update({fileId:a.spreadsheetId,addParents:e.parent,removeParents:"root",fields:"id, parents",resource:{}}),!r)return a;let s=await Xte();return await a.share(s,"writer"),a}getUrl(){return Ma({spreadsheetId:this.spreadsheetId})}async getSheet(e){if(this.sheets||await this.fetchSheets(),this.sheets){for(let r=0;r<this.sheets.length;r++)if(this.sheets[r].gid===e)return this.sheets[r]}return null}async createSheet(e){console.log("createSheet",this.spreadsheetId);let r=await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheetId,resource:{requests:[{addSheet:{properties:{title:e.title}}}]}}),o=r.result.replies||[];if(o&&o.length>0){let n=o[0].addSheet?.properties?.sheetId;if(typeof n=="number")return new cC(this,n,e.title)}throw console.error(r),new Error("failed to get gid of new tab")}async fetchSheets(){let r=(await gapi.client.sheets.spreadsheets.get({spreadsheetId:this.spreadsheetId,fields:"sheets.properties"})).result;this.setSpreadsheet(r)}setSpreadsheet(e){this.spreadsheet=e,this.spreadsheet.sheets&&this.setSheets(this.spreadsheet.sheets)}setSheets(e){let r=[];e.forEach(o=>{let n=o.properties?.sheetId,i=o.properties?.title,a=new cC(this,n??0,i);r.push(a)}),this.sheets=r}async share(e,r){await Promise.all(e.map(async o=>{let n;o.startsWith("*@")?n={type:"domain",domain:o.slice(2),role:r}:n={type:"user",emailAddress:o,role:r},await gapi.client.drive.permissions.create({fileId:this.spreadsheetId,resource:n,sendNotificationEmail:!1,fields:"id"})}))}},cC=class{constructor(e,r,o){this.spreadsheet=e,this.gid=r,this.title=o}async updateValuesMap(e,r){let o=r.keyedBy,n=r.preserveColumns||[];if(!o)throw new Error('missing "keyedBy" argument');let[i,a]=await this.getValues(),s=[...i],l=[],c=-1,u=new Set;l.push(i.map((v,C)=>(v===o&&(c=C),n.includes(v)&&u.add(C),{hasChanges:!1,value:v})));function d(v){l[0].push({hasChanges:!0,value:v}),s.push(v)}c===-1&&d(o);let f={};a.forEach((v,C)=>{let N=C+1;l.push(v.map((I,E)=>(E===c&&I&&(I in f?console.warn(`multiple rows keyed by "${I}"`):f[I]=N),{hasChanges:!1,value:I})))});function m(v){for(let N in v)s.includes(N)||d(N);return s.map(N=>v[N]??null)}e.forEach(v=>{let C=m(v),N=v[o],I=f[N];if(I){let E=l[I];C.map((w,S)=>{S>=E.length?E.push({hasChanges:!0,value:w||""}):w!==null&&E[S].value!==w&&(!u.has(S)||!E[S].value)&&(E[S]={hasChanges:!0,value:w})})}else l.push(C.map(E=>({hasChanges:!!E,value:E||""})))});let h=s.length,g=l.length,_=i.length,b=a.length+1;(h>_||g>b)&&await this.resizeSheet({numCols:h+2,numRows:g+20});let y=[];l.forEach((v,C)=>{for(;v.length>0&&v.at(-1)?.hasChanges===!1;)v.pop();if(v.length!==0){if(v.every(N=>N.hasChanges)){y.push({range:`${this.title}!A${C+1}`,majorDimension:"ROWS",values:[v.map(N=>N.value||"")]});return}v.forEach((N,I)=>{if(N.hasChanges){let E=Jte(I);y.push({range:`${this.title}!${E}${C+1}`,majorDimension:"ROWS",values:[[N.value||""]]})}})}}),y.length>0&&await gapi.client.sheets.spreadsheets.values.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{data:y,valueInputOption:"RAW"}})}async replaceSheet(e,r){let o=e.length,n=r.length+1,i=[];i.push(e),i.push(...r.map(s=>e.map(l=>s[l]||""))),await this.resizeSheet({numCols:o+2,numRows:n+20}),console.log("updating cell values");let a=Jte(o-1);await gapi.client.sheets.spreadsheets.values.update({spreadsheetId:this.spreadsheet.spreadsheetId,range:`${this.title}!A1:${a}${n}`,valueInputOption:"RAW",resource:{range:`${this.title}!A1:${a}${n}`,majorDimension:"ROWS",values:i}})}async resizeSheet(e){let r=[];e.numCols&&r.push({updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{columnCount:e.numCols}},fields:"gridProperties.columnCount"}}),e.numRows&&r.push({updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{rowCount:e.numRows}},fields:"gridProperties.rowCount"}}),r.length>0&&(console.log("resizing sheet"),await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:r}}))}async getValues(){let r=(await gapi.client.sheets.spreadsheets.values.get({spreadsheetId:this.spreadsheet.spreadsheetId,range:this.title})).result.values;if(!r||r.length===0)return[[],[]];let o=r[0],n=r.slice(1);return[o,n]}async getValuesMap(){let[e,r]=await this.getValues();return r.map(n=>{let i={};return n.forEach((a,s)=>{let l=e[s];l&&(i[l]=String(a||""))}),i})}async setTitle(e){await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:[{updateSheetProperties:{properties:{title:e,sheetId:this.gid},fields:"title"}}]}}),this.title=e}getUrl(){return Ma({spreadsheetId:this.spreadsheet.spreadsheetId,gid:this.gid})}async applyL10nTheme(){await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:[{repeatCell:{range:{sheetId:this.gid,startRowIndex:0},cell:{userEnteredFormat:{textFormat:{fontFamily:"Ubuntu",fontSize:10}}},fields:"userEnteredFormat(textFormat)"}},{repeatCell:{range:{sheetId:this.gid,startRowIndex:0,endRowIndex:1},cell:{userEnteredFormat:{textFormat:{bold:!0,fontFamily:"Ubuntu",fontSize:10}}},fields:"userEnteredFormat(textFormat)"}},{updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{frozenRowCount:1}},fields:"gridProperties.frozenRowCount"}},{updateDimensionProperties:{range:{sheetId:this.gid,dimension:"COLUMNS",startIndex:0,endIndex:1},properties:{pixelSize:320},fields:"pixelSize"}},{updateDimensionProperties:{range:{sheetId:this.gid,dimension:"COLUMNS",startIndex:1},properties:{pixelSize:320},fields:"pixelSize"}},{repeatCell:{range:{sheetId:this.gid,startRowIndex:1,startColumnIndex:0},cell:{userEnteredFormat:{wrapStrategy:"WRAP"}},fields:"userEnteredFormat(wrapStrategy)"}}]}})}};function Ma(t){let r=[`https://docs.google.com/spreadsheets/d/${t.spreadsheetId}/edit`];return typeof t.gid=="number"&&r.push(`#gid=${t.gid}`),r.join("")}function Au(t){if(!t.startsWith("https://docs.google.com/spreadsheets/d/"))return null;let e=t.split("/"),r=e[e.length-2],n=t.slice(t.indexOf("#")).match(/gid=(\d+)/),i=0;return n&&n[1]&&(i=parseInt(n[1])),{spreadsheetId:r,gid:i}}function Jte(t){let e=[];for(;t>=0;){let r=t%26;e.push(String.fromCharCode(r+65)),t=(t-r-1)/26}return e.reverse().join("")}function jL(t){if(!t)return;if(!t.startsWith("https://drive.google.com/drive/folders/")){let o=t.trim();if(o.length===33&&/^[a-zA-Z0-9_-]+$/.test(o))return o}let e=t.trim().split("/");return e[e.length-1]||void 0}function Qte(t){let e=jL(t);return e?`https://drive.google.com/drive/folders/${e}`:"https://drive.google.com/drive"}async function Zte(t,e){if(!t)throw new Error("missing data source id");let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t);await xu(n,{...e,id:t,createdAt:Cr(),createdBy:window.firebase.user.email}),Ot("datasource.create",{metadata:{datasourceId:t}})}async function uC(){let t=window.__ROOT_CTX.rootConfig.projectId,e=window.firebase.db,r=Zi(e,"Projects",t,"DataSources"),o=po(r),n=await ea(o),i=[];return n.forEach(a=>{i.push(a.data())}),i}async function Ff(t){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,o=$e(r,"Projects",e,"DataSources",t),n=await ko(o);return n.exists()?n.data():null}async function dC(t,e){let r=e?.mode||"draft",o=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,i=$e(n,"Projects",o,"DataSources",t,"Data",r),a=await ko(i);return a.exists()?a.data():null}async function ere(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t);await Mr(n,e),Ot("datasource.save",{metadata:{datasourceId:t}})}async function tre(t){let e=await Ff(t);if(!e)throw new Error(`data source not found: ${t}`);if(e.type==="http"&&e.url&&!ire(e.url)){let r=await fetch("/cms/api/data.sync",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e.id})});if(r.status!==200){let o=await r.text();throw new Error(`sync failed: ${o}`)}}else{let{data:r,headers:o}=await t4e(e),n=window.__ROOT_CTX.rootConfig.projectId,i=window.firebase.db,a=$e(i,"Projects",n,"DataSources",t),s=$e(i,"Projects",n,"DataSources",t,"Data","draft"),l={...e,syncedAt:Tt.now(),syncedBy:window.firebase.user.email},c=Ci(i);c.set(s,{dataSource:l,data:r,...o?{headers:o}:{}}),c.update(a,{syncedAt:Tt.now(),syncedBy:window.firebase.user.email}),await c.commit()}console.log(`synced data source: ${t}`),Ot("datasource.sync",{metadata:{datasourceId:t}})}async function rre(t){let e=await Ff(t);if(!e)throw new Error(`data source not found: ${t}`);let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t),i=$e(o,"Projects",r,"DataSources",t,"Data","draft"),a=$e(o,"Projects",r,"DataSources",t,"Data","published"),s=await dC(t,{mode:"draft"}),l={...e,publishedAt:Tt.now(),publishedBy:window.firebase.user.email},c=Ci(o);c.set(a,{dataSource:l,data:s?.data||null,...s?.headers?{headers:s.headers}:{}}),c.update(i,{dataSource:l}),c.update(n,{publishedAt:Tt.now(),publishedBy:window.firebase.user.email}),await c.commit(),console.log(`published data ${t}`),Ot("datasource.publish",{metadata:{datasourceId:t}})}async function ore(t,e){if(t.length===0)return;let r=window.firebase.db,o=window.__ROOT_CTX.rootConfig.projectId,n=e?.batch||Ci(r);for(let i of t){let a=await Ff(i);if(!a)throw new Error(`data source not found: ${i}`);let s=await dC(i,{mode:"draft"}),l=$e(r,"Projects",o,"DataSources",i),c=$e(r,"Projects",o,"DataSources",i,"Data","draft"),u=$e(r,"Projects",o,"DataSources",i,"Data","published"),d={...a,publishedAt:Cr(),publishedBy:window.firebase.user.email};n.set(u,{dataSource:d,data:s?.data||null,...s?.headers?{headers:s.headers}:{}}),n.update(c,{dataSource:d}),n.update(l,{publishedAt:Cr(),publishedBy:window.firebase.user.email}),Ot("datasource.publish",{metadata:{datasourceId:i}})}(!e?.batch||e?.commitBatch)&&await n.commit()}async function nre(t){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,o=$e(r,"Projects",e,"DataSources",t),n=$e(r,"Projects",e,"DataSources",t,"Data","draft"),i=$e(r,"Projects",e,"DataSources",t,"Data","published"),a=Ci(r);a.delete(n),a.delete(i),a.delete(o),await a.commit(),console.log(`deleted data source ${t}`),Ot("datasource.delete",{metadata:{datasourceId:t}})}async function t4e(t){if(t.type==="http")return{data:await o4e(t)};if(t.type==="gsheet")return await r4e(t);throw new Error(`unsupported data source: ${t.type}`)}async function r4e(t){let e=Au(t.url);if(!e?.spreadsheetId)throw new Error(`failed to parse google sheet url: ${t.url}`);let o=await new ll(e.spreadsheetId).getSheet(e.gid??0);if(!o)throw new Error(`could not find sheet: ${t.url}`);let n=t.dataFormat||"map",[i,a]=await o.getValues();return n==="array"?{data:[i,a],headers:i}:{data:a.map(l=>{let c={};return l.forEach((u,d)=>{let f=i[d];f&&(c[f]=String(u||""))}),c}),headers:i}}async function o4e(t){if(!ire(t.url))throw new Error(`unsupported url: ${t.url}`);let e=await fetch(t.url,{method:t.httpOptions?.method||"GET",headers:t.httpOptions?.headers||[],body:t.httpOptions?.body||void 0});if(e.status!==200){let o=await e.text();throw new Error(`req failed: ${o}`)}return String(e.headers.get("content-type")).includes("application/json")?await e.json():e.text()}function ire(t){return t&&t.startsWith("/")}var GL="DataSourceSelectModal";function are(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(GL,{...e,innerProps:r,size:"600px",overflow:"inside"})},close:()=>{t.closeModal(GL)}}}function fC(t){let{innerProps:e}=t,[r,o]=M(!0),[n,i]=M([]),a=e.selectedDataSourceIds||[];V(()=>{async function c(){let u=await uC();i(u),o(!1)}c()},[]);function s(c){e.onChange&&e.onChange(c,!0)}function l(c){e.onChange&&e.onChange(c,!1)}return p("div",{className:"DataSourceSelectModal",children:r?p("div",{className:"DataSourceSelectModal__loading",children:p(Ze,{color:"gray",size:"xl"})}):n.length===0?p("div",{className:"DataSourceSelectModal__empty",children:"No data sources."}):p("div",{className:"DataSourceSelectModal__list",children:n.map(c=>p("div",{className:"DataSourceSelectModal__item",children:[p("div",{className:"DataSourceSelectModal__item__info",children:[p("div",{className:"DataSourceSelectModal__item__id",children:c.id}),p("div",{className:"DataSourceSelectModal__item__description",children:c.description||""})]}),p("div",{className:"DataSourceSelectModal__item__action",children:a.includes(c.id)?p(re,{variant:"light",color:"blue",size:"xs",onClick:()=>l(c.id),children:"Unselect"}):p(re,{variant:"filled",color:"blue",size:"xs",onClick:()=>s(c.id),children:"Select"})})]},c.id))})})}fC.id=GL;Pe();Pe();async function er(t){try{await t()}catch(e){console.error(e);let r;typeof e=="object"&&e.body?r=String(e.body):r=String(e),Ae({title:"Error",message:r,color:"red",autoClose:!1})}}xo();Pe();var WL=ft(null);function Th(){let t=lt(WL);if(!t)throw new Error("useFirebase() should be called within a <FirebaseProvider>");return t}function kh(t,e){let[r,o]=M([]),[n,i]=M(!0),s=Th().db,l=window.__ROOT_CTX.rootConfig.projectId||"default",c=async()=>{i(!0);let u=Zi(s,"Projects",l,"Collections",t,"Drafts"),d=u,f=e.orderBy;if(f==="modifiedAt")d=po(u,Si("sys.modifiedAt","desc"));else if(f==="newest")d=po(u,Si("sys.createdAt","desc"));else if(f==="oldest")d=po(u,Si("sys.createdAt"));else if(f==="slug")d=po(u,Si(nb()));else if(f==="slugDesc")d=po(u,Si(nb(),"desc"));else{let h=window.__ROOT_CTX.collections[t]?.sortOptions?.find(g=>g.id===f);h&&(d=h.direction==="desc"?po(u,Si(h.field,"desc")):po(u,Si(h.field)))}await er(async()=>{let m=await ea(d),h=[];m.docs.forEach(g=>{let _=g.data(),b=g.id,y=`${t}/${b}`,v={..._,id:y,slug:b};h.push(v),Mb(y,v)}),o(h)}),i(!1)};return V(()=>{i(!0),c()},[t,e.orderBy]),[n,c,r]}function La(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}function Qo(t,e){if(Array.isArray(e)){for(let n of e){let i=Qo(t,n);if(i!=null)return i}return}let r=e.split("."),o=t;for(let n of r){if(o==null)return;o=n4e(o,n)}return o}function n4e(t,e){if(!e)return t;let r=/([^\[\]]+)|\[(\d+)\]/g,o=t,n;for(;n=r.exec(e);){if(o==null)return;let i=n[1],a=n[2];if(i!==void 0){o=o[i];continue}if(a===void 0)return;let s=Number(a);if(Array.isArray(o)){o=o[s];continue}if(La(o)&&Array.isArray(o._array)){let l=o._array[s];if(l===void 0)return;o=o[l];continue}if(La(o)&&Object.prototype.hasOwnProperty.call(o,String(s))){o=o[String(s)];continue}return}return o}function sre(t,e){return t.sort((r,o)=>{let n=r[e],i=o[e];return n<i?-1:n>i?1:0})}function qb(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!qb(t[n],e[n]))return!1;return!0}let r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(let n of r)if(!qb(t[n],e[n]))return!1;return!0}var qL="DocPickerModal";function lre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(qL,{...e,innerProps:r,size:"700px",overflow:"inside"})},close:()=>{t.closeModal(qL)}}}function Du(t){let{innerProps:e}=t,r=Object.keys(window.__ROOT_CTX.collections);e.collections?.length&&(r=r.filter(s=>e.collections?.includes(s)));let o=[{value:"",label:"Select"}];r.forEach(s=>{o.push({value:s,label:s})});let[n,i]=M(e.initialCollection||(r.length===1?r[0]:""));function a(s){e.onChange&&e.onChange(s.id)}return p("div",{className:"DocPickerModal",children:[r.length===0&&p("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),r.length>1&&p("div",{className:"DocPickerModal__collection__select",children:[p("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),p(Er,{data:o,value:n,placeholder:"Select",onChange:s=>{i(s||"")},size:"xs",radius:0,dropdownComponent:"div"})]}),n&&p(Du.DocsList,{collection:n,onDocSelected:a})]})}Du.DocsList=t=>{let[e,,r]=kh(t.collection,{orderBy:"slug"});return p("div",{className:"DocPickerModal__DocsList",children:e?p("div",{className:"DocPickerModal__DocsList__loading",children:p(Ze,{color:"gray",size:"xl"})}):r.length===0?p("div",{className:"DocPickerModal__DocsList__empty",children:"Collection is empty."}):p("div",{className:"DocPickerModal__DocsList__docs",children:r.map(o=>p(Du.DocCard,{doc:o,onDocSelected:t.onDocSelected},o.id))})})};Du.DocCard=t=>{let e=t.doc,[r,o]=e.id.split("/"),n=e.fields||{},i=window.__ROOT_CTX.collections[r],a=fs({collectionId:r,slug:o}),s=Qo(n,i.preview?.title||"meta.title"),l=Qo(n,i.preview?.image||"meta.image")||i.preview?.defaultImage;return p("div",{className:"DocPickerModal__DocCard",children:[p("div",{className:"DocPickerModal__DocCard__image",children:p(Qc,{src:l?.src,width:120,height:90,withPlaceholder:!l?.src})}),p("div",{className:"DocPickerModal__DocCard__content",children:[p("div",{className:"DocPickerModal__DocCard__content__header",children:p("div",{className:"DocPickerModal__DocCard__content__header__docId",children:e.id})}),p("div",{className:"DocPickerModal__DocCard__content__title",children:s||"[UNTITLED]"}),p("div",{className:"DocPickerModal__DocCard__content__url",children:a})]}),p("div",{className:"DocPickerModal__DocCard__controls",children:p(re,{color:"blue",size:"xs",onClick:()=>t.onDocSelected(t.doc),children:"Select"})})]})};Du.id=qL;Pe();function Nh(t){let{file:e,width:r,height:o,withPlaceholder:n,className:i,alt:a}=t,s=typeof e=="string"?e:e?.src;return i4e(e)?p(a4e,{className:i,src:s,width:r,height:o}):p(Qc,{className:i,src:s,width:r,height:o,withPlaceholder:n,alt:a})}function i4e(t){if(!t)return!1;if(typeof t=="string")return/\.mp4($|\?)/i.test(t);if(typeof t.mimeType=="string")return t.mimeType.toLowerCase()==="video/mp4";let e=t.src;return typeof e!="string"?!1:/\.mp4($|\?)/i.test(e)}function a4e(t){return p("video",{className:t.className,src:t.src,width:t.width,height:t.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${t.width}px`,height:`${t.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}var KL="DocSelectModal";function pC(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(KL,{...e,innerProps:r,size:"700px",overflow:"inside"})},close:()=>{t.closeModal(KL)}}}function Ru(t){let{innerProps:e}=t,r=Object.keys(window.__ROOT_CTX.collections);e.collections?.length&&(r=r.filter(l=>e.collections?.includes(l)));let o=[{value:"",label:"Select"}];r.forEach(l=>{o.push({value:l,label:l})});let[n,i]=M(e.initialCollection||(r.length===1?r[0]:""));function a(l){e.onChange&&e.onChange(l.id,!0)}function s(l){e.onChange&&e.onChange(l.id,!1)}return p("div",{className:"DocSelectModal",children:[r.length===0&&p("div",{className:"DocSelectModal__noCollections",children:"No collections matching schema field definition."}),r.length>1&&p("div",{className:"DocSelectModal__collection__select",children:[p("div",{className:"DocSelectModal__collection__select__label",children:"Content Type:"}),p(Er,{data:o,value:n,placeholder:"Select",onChange:l=>{i(l||"")},size:"xs",radius:0,dropdownComponent:"div"})]}),n&&p(Ru.DocsList,{collection:n,onDocSelected:a,onDocUnselected:s,selectedDocIds:e.selectedDocIds})]})}Ru.DocsList=t=>{let[e,,r]=kh(t.collection,{orderBy:"slug"}),o=t.selectedDocIds||[];return p("div",{className:"DocSelectModal__DocsList",children:e?p("div",{className:"DocSelectModal__DocsList__loading",children:p(Ze,{color:"gray",size:"xl"})}):r.length===0?p("div",{className:"DocSelectModal__DocsList__empty",children:"Collection is empty."}):p("div",{className:"DocSelectModal__DocsList__docs",children:r.map(n=>p(Ru.DocCard,{doc:n,onDocSelected:t.onDocSelected,onDocUnselected:t.onDocUnselected,selected:o.includes(n.id)},n.id))})})};Ru.DocCard=t=>{let[e,r]=M(!!t.selected),o=t.doc,[n,i]=o.id.split("/"),a=o.fields||{},s=window.__ROOT_CTX.collections[n],l=fs({collectionId:n,slug:i}),c=Qo(a,s.preview?.title||"meta.title"),u=Qo(a,s.preview?.image||"meta.image")||s.preview?.defaultImage;return p("div",{className:"DocSelectModal__DocCard",children:[p("div",{className:"DocSelectModal__DocCard__image",children:p(Nh,{file:u,width:120,height:90,withPlaceholder:!u?.src})}),p("div",{className:"DocSelectModal__DocCard__content",children:[p("div",{className:"DocSelectModal__DocCard__content__header",children:p("div",{className:"DocSelectModal__DocCard__content__header__docId",children:o.id})}),p("div",{className:"DocSelectModal__DocCard__content__title",children:c||"[UNTITLED]"}),p("div",{className:"DocSelectModal__DocCard__content__url",children:l})]}),p("div",{className:"DocSelectModal__DocCard__controls",children:e?p(re,{variant:"light",color:"blue",size:"xs",onClick:()=>{r(!1),t.onDocUnselected(t.doc)},children:"Unselect"}):p(re,{variant:"filled",color:"blue",size:"xs",onClick:()=>{r(!0),t.onDocSelected(t.doc)},children:"Select"})})]})};Ru.id=KL;Pe();var YL="EditJsonModal";function mC(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(YL,{...e,title:r.title||"Edit JSON",innerProps:r,size:"680px",centered:!0})},close:()=>{t.closeModal(YL)}}}function hC(t){let{innerProps:e,context:r,id:o}=t,n=JSON.stringify(e.data||{},null,2),[i,a]=M(n),[s,l]=M(!0),[c,u]=M(!1),[d,f]=M(!1);function m(_){a(_),u(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}f(_!==n)}function h(){navigator.clipboard.writeText(i).then(()=>u(!0))}function g(){let _=JSON.parse(i),b=_h(_);e.onSave&&e.onSave(b)}return p("div",{className:"EditJsonModal",children:[p(Zc,{value:i,onChange:m,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),p("div",{className:"EditJsonModal__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{leftIcon:p(xb,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!s,type:"button",onClick:h,children:c?"Copied!":"Copy"}),p(re,{variant:"default",size:"xs",type:"button",leftIcon:p(mb,{size:16}),disabled:!d,onClick:()=>{a(n),l(!0),f(!1)},children:"Reset"}),p(re,{leftIcon:p(bb,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!s||!d,onClick:g,children:"Save"})]})]})}hC.id=YL;Pe();function et(t){let{className:e,as:r,size:o,weight:n,color:i,children:a,...s}=t;return p(r||"h2",{...s,className:De(e,"heading",o&&`size:${o}`,n&&`weight:${n}`,i&&`color:${i}`),children:a})}var XL="EditTranslationsModal";function cre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(XL,{...e,innerProps:r,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(XL)}}}function Ph(t){let{innerProps:e,context:r,id:o}=t,n=e.strings||[],a=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],[s,l]=M({}),[c,u]=M([]),[d,f]=M(!1),[m,h]=M(!1),[g,_]=M(!0);V(()=>{Su({tags:[e.docId]}).then(v=>{let C={};Object.values(v).forEach(N=>{C[N.source]=N}),l(C),_(!1)})},[e.docId]);async function b(){h(!0),await er(async()=>{console.log("EditTranslationsModal.onSave()");let v=`edit-translations-${e.docId}`;Ae({id:v,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0});let C=[];c.forEach(N=>{let I=s[N];C.push(I)}),await Tf(e.docId,C),Ht({id:v,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),h(!1)}function y(v){l(C=>{let N={...C};return N[v.source]=v,N}),u(C=>{let N=new Set(C);return N.add(v.source),Array.from(N)}),f(!0)}return p("div",{className:"EditTranslationsModal",children:[p("div",{className:"EditTranslationsModal__header",children:p(re,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",children:"Open Translations Editor"})}),g?p(Ze,{}):p("table",{className:"EditTranslationsModal__table",children:[p("thead",{children:p("tr",{children:[p("th",{children:p(et,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),p("th",{children:p(et,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"})})]})}),p("tbody",{children:n.map(v=>p("tr",{children:[p("td",{children:p("div",{className:"EditTranslationsModal__table__source",children:v})}),p("td",{children:p(Ph.StringsEditor,{source:v,locales:a,translations:s[v]||{},onChange:y})})]}))})]}),p("div",{className:"EditTranslationsModal__footer",children:[e.l10nSheet&&p("div",{className:"EditTranslationsModal__footer__gsheet",children:[p("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",p("a",{href:Ma(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]}),p("div",{className:"EditTranslationsModal__footer__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",onClick:()=>b(),disabled:!d,loading:m,children:"Save"})]})]})]})}Ph.StringsEditor=t=>{let e=t.locales,[r,o]=M(t.translations||{}),[n,i]=M(!1);function a(s,l){i(!0),o(c=>{let u={...c,source:t.source};return u[s]=l,u})}return V(()=>{n&&t.onChange(r)},[n,r]),p("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(s=>p("div",{className:"EditTranslationsModal__StringsEditor__row",children:[p("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:s}),p("div",{className:De("EditTranslationsModal__StringsEditor__row__translation",r[s]?"hasValue":"empty"),children:p(yr,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:r[s],onChange:l=>{a(s,l.currentTarget.value)}})})]}))})};Ph.id=XL;Rl();Pe();Pe();var e2=["https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/spreadsheets"],s4e=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest","https://sheets.googleapis.com/$discovery/rest?version=v4"];function Mu(){let t=window.__ROOT_CTX.rootConfig.projectId,e=!!(window.__ROOT_CTX.gapi?.apiKey&&window.__ROOT_CTX.gapi?.clientId),[r,o]=M(e),[n,i]=M(0),[a,s]=$N({key:`root-cms::${t}::gapi-user-consent`,defaultValue:{}});async function l(){await Promise.all([c4e(),u4e()]),o(!1)}V(()=>{e&&l()},[]);function c(){return new Promise(d=>{let f=window.__ROOT_CTX.gapi.clientId,m=google.accounts.oauth2.initTokenClient({client_id:f,scope:e2.join(" "),callback:async h=>{let g=JL()+parseInt(h.expires_in);i(g),s({at:JL(),clientId:f,scopes:e2}),d()}});a&&l4e(a)?(console.log("requesting token without prompt"),m.requestAccessToken({prompt:""})):(console.log("requesting token with prompt"),m.requestAccessToken({prompt:"consent"}))})}function u(){return JL()<n}return{enabled:e,loading:r,isLoggedIn:u,login:c}}function l4e(t){if(!t||!t.at)return!1;let e=window.__ROOT_CTX.gapi?.clientId;if(t.clientId!==e)return!1;let r=t.scopes||[];return e2.every(o=>r.includes(o))}function JL(){return Math.floor(new Date().getTime()/1e3)}var QL=null;async function c4e(){return QL||(QL=new Promise((t,e)=>{let r=document.createElement("script");r.src="https://apis.google.com/js/api.js",r.onload=()=>{gapi.load("client",async()=>{try{await gapi.client.init({}),await Promise.all(s4e.map(o=>gapi.client.load(o))),console.log("gapi loaded"),t()}catch(o){console.error("Error initializing gapi:",o),e(o)}})},r.onerror=()=>{console.error("gapi script failed to load"),e(new Error("gapi script failed to load"))},document.head.appendChild(r)})),QL}var ZL=null;async function u4e(){return ZL||(ZL=new Promise((t,e)=>{let r=document.createElement("script");r.src="https://accounts.google.com/gsi/client",r.onload=()=>{t()},r.onerror=()=>{console.error("gis script failed to load"),e(new Error("gis script failed to load"))},document.head.appendChild(r)})),ZL}xo();Pe();var ure=[{name:"Google Drive Folder",key:"googleDriveFolder",placeholder:"https://drive.google.com/drive/folders/...",description:`Where Google Sheets created by Root CMS's localization process are stored. If unspecified, they will be created in your "My Drive".`,ui:t=>p(re,{disabled:!t,variant:"outline",size:"compact-sm",color:"dark",rightIcon:p(yb,{size:16}),onClick:()=>{t&&window.open(t,Qte(t))},children:"Open"})}],dre=ft(null);function fre(t){let{db:e,user:r}=Th(),o=window.__ROOT_CTX.rootConfig.projectId,[n,i]=M({});V(()=>{let s=$e(e,"Projects",o),l=bu(s,c=>{if(c.exists()){let u=c.data()||{};i(u.settings||{})}else i({})},c=>{console.error("Failed to subscribe to site settings:",c)});return()=>l()},[e,o,r.uid]);let a=qe(async(s,l)=>{let c=$e(e,"Projects",o);try{await Mr(c,new Pn("settings",s),l)}catch(u){console.error("Failed to set setting",s,u)}},[e,o,r.uid]);return p(dre.Provider,{value:{settings:n,setSettings:a},children:t.children})}function gC(){let t=lt(dre);if(!t)throw new Error("useSiteSettings must be used within a <SiteSettingsProvider>");return t}var pre="ExportSheetModal";function mre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(pre,{...e,title:"Export to Google Sheet",innerProps:r,size:"650px"})}}}function Oh(t){let{innerProps:e,context:r,id:o}=t,[n,i]=M(!1),[a,s]=M("new-sheet"),[l,c]=M(""),[u,d]=M(!1),f=Mu(),m=gC(),h=W(),g=jL(m.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],b=!1;(a==="add-tab"||a==="link-sheet")&&(b=!0,l&&Au(l)?.spreadsheetId&&(b=!1));async function y(E,w){let S=w?.isNew||!1,{headers:T,rows:A}=e.csvData;S?(await E.replaceSheet(T,A),await E.applyL10nTheme()):await E.updateValuesMap(A,{keyedBy:"source",preserveColumns:e.locales})}async function v(){f.isLoggedIn()||await f.login();let E=window.__ROOT_CTX.rootConfig,w=E.projectName||E.projectId||"Root CMS",S,T,A="create-google-sheet";try{if(Ae({id:A,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),S=await ll.create({title:`${w} Localization`,parent:g,share:h.current?.checked}),T=await S.getSheet(0),!T)throw new Error("could not find sheet gid=0");T.setTitle(e.docId)}catch(R){console.error(R);let P=R;typeof R=="object"&&R.body&&(P=String(R.body)),Ht({id:A,title:"Failed to create Google Sheet",message:String(P),color:"red",autoClose:!1});return}try{Ht({id:A,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let R={spreadsheetId:S.spreadsheetId,gid:0};await TS(e.docId,R)}catch(R){console.error(R),Ht({id:A,title:"Failed to link Google Sheet",message:String(R),color:"red",autoClose:!1});return}try{Ht({id:A,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(T,{isNew:!0})}catch(R){console.error(R);let P=R;typeof R=="object"&&R.body&&(P=String(R.body)),Ht({id:A,title:"Failed to export strings to Google Sheet",message:P,color:"red",autoClose:!1});return}c(T.getUrl()),d(!0),Ht({id:A,title:"Done! Exported strings to Google Sheet.",message:S.getUrl(),autoClose:!1})}async function C(){f.isLoggedIn()||await f.login();let E=Au(l);if(!E?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let w=new ll(E.spreadsheetId),S,T="add-tab-google-sheet";try{Ae({id:T,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),S=await w.createSheet({title:e.docId})}catch(A){console.error(A);let R=A;typeof A=="object"&&A.body&&(R=String(A.body)),Ht({id:T,title:"Failed to create Google Sheet",message:String(R),color:"red",autoClose:!1});return}try{Ht({id:T,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let A={spreadsheetId:w.spreadsheetId,gid:S.gid};await TS(e.docId,A)}catch(A){console.error(A),Ht({id:T,title:"Failed to link Google Sheet",message:String(A),color:"red",autoClose:!1});return}try{Ht({id:T,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(S,{isNew:!0})}catch(A){console.error(A);let R=A;typeof A=="object"&&A.body&&(R=String(A.body)),Ht({id:T,title:"Failed to export strings to Google Sheet",message:R,color:"red",autoClose:!1});return}d(!0),Ht({id:T,title:"Done! Exported strings to Google Sheet.",message:S.getUrl(),autoClose:!1})}async function N(){let E="link-google-sheet",w=Au(l);if(!w?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{Ae({id:E,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await TS(e.docId,w)}catch(S){console.error(S),Ht({id:E,title:"Failed to link Google Sheet",message:String(S),color:"red",autoClose:!1});return}d(!0),Ht({id:E,title:`Done! Linked ${e.docId} to Google Sheet.`,message:Ma(w),autoClose:!1})}async function I(){console.log(a),i(!0),a==="new-sheet"?await er(v):a==="add-tab"?await er(C):a==="link-sheet"&&await er(N),i(!1)}return p("div",{className:"ExportSheetModal",children:p("div",{className:"ExportSheetModal__content",children:[p("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),p("form",{className:"ExportSheetModal__form",children:[p("div",{className:"ExportSheetModal__form__section",children:[p("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),p(Er,{disabled:u||n,itemComponent:Oh.SelectItem,data:_,onChange:E=>{s(E),E==="new-sheet"&&c("")},value:a})]}),p("div",{className:"ExportSheetModal__form__section",children:[p("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),a==="new-sheet"?p(ir,{disabled:!0,placeholder:m.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):p(ir,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:u||n,onChange:E=>c(E.currentTarget.value)})]}),a==="new-sheet"&&p("div",{className:"ExportSheetModal__form__section",children:p(Se,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:p(Xc,{disabled:u||n,ref:h,name:"share",value:"true",label:"Share Google Sheet with collaborators",checked:!g})})}),p("div",{className:"ExportSheetModal__form__buttons",children:u?p(Te,{children:[p(re,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:p(yb,{size:16}),children:"Open Google Sheet"}),p(re,{variant:"filled",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):p(Te,{children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"primary",loading:n,disabled:b,onClick:()=>I(),children:a==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}Oh.SelectItem=ee(t=>{let{label:e,help:r,...o}=t;return p("div",{className:"ExportSheetModal__SelectItem",...o,children:[p(Ye,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),p(Ye,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:r})]})});Oh.id=pre;Pe();async function Ah(t){if(!window.__ROOT_CTX.collections[t])throw new Error(`collection not found: ${t}`);let r=await window.fetch("/cms/api/collection.get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collectionId:t})});if(r.status!==200){let n=await r.text();throw new Error(n)}return(await r.json()).data}async function _C(t){let e=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,n]=t.split("/",2),i=await Ah(o),a=$e(e,"Projects",r,"Collections",o,"Drafts",n),l=(await ko(a)).data()||{},c=new Set;return Kb(c,i.fields,l.fields||{},i.types||{}),Array.from(c)}function Kb(t,e,r,o={}){e.forEach(n=>{if(!n.id)return;let i=r[n.id];xC(t,n,i,o)})}function xC(t,e,r,o={}){if(!r)return;function n(i){let a=ic(i);a&&t.add(a)}if(e.type==="object")Kb(t,e.fields||[],r,o);else if(e.type==="array"){let i=r._array||[];for(let a of i)xC(t,e.of,r[a],o)}else if(e.type==="string"||e.type==="select")e.translate&&n(r);else if(e.type==="image")e.translate&&r&&r.alt&&e.alt!==!1&&n(r.alt);else if(e.type==="multiselect"){if(e.translate&&Array.isArray(r))for(let i of r)n(i)}else if(e.type==="oneof"){let i=e.types||[],a;typeof i[0]=="string"?i.includes(r._type)&&(a=o[r._type]):a=i.find(s=>s.name===r._type),a&&Kb(t,a.fields||[],r,o)}else e.type==="richtext"?e.translate&&d4e(t,r):console.log(`extract: ignoring field, id=${e.id}, type=${e.type}`)}function d4e(t,e){(e?.blocks||[]).forEach(o=>{f4e(t,o)})}function f4e(t,e){if(!e?.type)return;function r(n){if(!n)return;let i=ic(n);i&&t.add(i)}function o(n){n&&n.forEach(i=>{r(i.content),o(i.items)})}e.type==="heading"||e.type==="paragraph"?r(e.data?.text):e.type==="orderedList"||e.type==="unorderedList"?o(e.data?.items):e.type==="html"&&r(e.data?.html)}var hre="LocalizationModal";function gre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(hre,{...e,innerProps:r,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{r.draft.flush()}})}}}function oa(t){let e=t.innerProps;return p("div",{className:"LocalizationModal",children:p("div",{className:"LocalizationModal__layout",children:[p(oa.ConfigLocales,{...e}),p(oa.Translations,{...e})]})})}oa.id=hre;oa.ConfigLocales=t=>{let[e,r]=M(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},n=o.locales||["en"],i=o.groups||{default:{label:"",locales:n}};function a(c){return e.filter(u=>(i[c].locales||[]).includes(u))}function s(c,u){let d=new Set(e),f=i[c].locales||[];for(let h of f)u.includes(h)?d.add(h):d.delete(h);let m=Array.from(d.values()).sort();l(m)}function l(c){r(c),t.draft.setLocales(c)}return p("div",{className:"LocalizationModal__locales",children:p(tu,{spacing:30,children:[p(as,{children:[p(et,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[p(SM,{strokeWidth:1.5}),p("span",{children:"Locales"})]}),p(oa.AllNoneButtons,{onAllClicked:()=>l(n),onNoneClicked:()=>l([])})]}),p(tu,{spacing:40,children:Object.keys(i).map(c=>{let u=i[c],d=a(c);return p(oa.LocaleGroup,{group:u,groupEnabledLocales:d,allEnabledLocales:e,onChange:f=>s(c,f)})})})]})})};oa.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],r=t.group.locales||[],o=t.allEnabledLocales||[];function n(a){t.onChange&&t.onChange(a)}function i(a){let s=e.indexOf(a);s===-1?e.push(a):e.splice(s,1),n(e)}return p(tu,{spacing:16,children:[t.group.label&&p(as,{position:"apart",children:[p(et,{size:"h4",weight:"semi-bold",children:t.group.label}),p(oa.AllNoneButtons,{onAllClicked:()=>n(r),onNoneClicked:()=>n([])})]}),p(as,{children:r.map(a=>{let s=e.includes(a),l=o.length<=1&&s;return p(Xc,{value:a,checked:s,disabled:l,label:_re(a),onChange:()=>i(a),size:"xs"})})})]})};oa.AllNoneButtons=t=>p(as,{spacing:"8px",children:[p(re,{variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,sx:e=>({"&:hover":{backgroundColor:e.colors.gray[0]}}),children:"All"}),"/",p(re,{variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,sx:e=>({"&:hover":{backgroundColor:e.colors.gray[0]}}),children:"None"})]});oa.Translations=t=>{let[e,r]=M(!0),[o,n]=M([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],a=i.find(P=>P!=="en")||"en",[s,l]=M(a),[c,u]=M({}),[d,f]=M({}),m=Mu(),[h,g]=M(null),_=mre(),b=ve(()=>{let P={};return Object.values(d).forEach(B=>{P[B.source]=B}),P},[d]),y=i.map(P=>({value:P,label:_re(P)}));V(()=>{r(!0),Promise.all([_C(t.docId),Su(),kS(t.docId)]).then(([P,B,$])=>{n(P),f(B),g($),r(!1)})},[t.docId]),V(()=>{if(!s){u({});return}let P={};Object.values(d).forEach(B=>{P[B.source]=B[s]||""}),u(P)},[s,d]);function v(P,B){let $=b[P];return $&&$[B]||""}function C(){let P=i.filter(z=>z!=="en"),B=["source","en",...P],$=[];return o.forEach(z=>{let H={source:z,en:v(z,"en")||z};P.forEach(G=>{H[G]=v(z,G)}),$.push(H)}),{headers:B,rows:$}}async function N(){let{headers:P,rows:B}=C(),$=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:P,rows:B})});if($.status!==200){console.error("csv.download failed:");let G=await $.text();console.error(G)}let z=await $.blob(),H=window.URL.createObjectURL(z);window.location.assign(H),window.URL.revokeObjectURL(H)}async function I(){let P=document.createElement("input");P.type="file",P.accept=".csv",P.addEventListener("change",async()=>{let B=P.files?.[0];if(B){let $=new FormData;$.append("file",B);try{let z=await fetch("/cms/api/csv.import",{method:"POST",body:$});if(z.status!==200){let Y=await z.text();throw new Error(`RPCError: ${Y}`)}let H=(await z.json()).data,G=await Tf(t.docId,H);f(Y=>Object.assign({},Y,G)),Ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(z){console.error(z),Ae({title:"Failed to import CSV",message:String(z),color:"red",autoClose:!1})}}}),P.click()}async function E(){if(m.isLoggedIn()||await m.login(),!h?.spreadsheetId)throw new Error("no sheet linked");let B=await new ll(h.spreadsheetId).getSheet(h.gid??0);if(!B)throw new Error(`sheet not found: ${JSON.stringify(h)}`);await w(B),Ae({title:"Exported strings to Google Sheet",message:B.getUrl(),autoClose:!1})}async function w(P,B){let $=B?.isNew||!1,{headers:z,rows:H}=C();$?(await P.replaceSheet(z,H),await P.applyL10nTheme()):await P.updateValuesMap(H,{keyedBy:"source",preserveColumns:i}),Ot("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:P.spreadsheet.spreadsheetId,gid:P.gid}}})}async function S(){if(m.isLoggedIn()||await m.login(),!h?.spreadsheetId)throw new Error("no sheet linked");let B=await new ll(h.spreadsheetId).getSheet(h.gid??0);if(!B)throw new Error(`sheet not found: ${JSON.stringify(h)}`);console.log("importing google sheet");let $=await B.getValuesMap(),z=await Tf(t.docId,$);f(H=>Object.assign({},H,z)),Ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function T(){await OQ(t.docId),g(null),Ae({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function A(P){try{await P()}catch(B){console.error(B);let $;typeof B=="object"&&B.body?$=String(B.body):$=String(B),Ae({title:"Error",message:$,color:"red",autoClose:!1})}}function R(P){switch(P){case"EXPORT_DOWNLOAD_CSV":{A(N);return}case"EXPORT_GOOGLE_SHEET_LINKED":{A(E);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{_.open({docId:t.docId,csvData:C(),locales:i});return}case"IMPORT_CSV":{A(I);return}case"IMPORT_GOOGLE_SHEET_LINKED":{A(S);return}case"UNLINK_GOOGLE_SHEET":{A(T);return}default:console.log("unhandled action: "+P)}}return e?p("div",{className:"LocalizationModal__translations__loading",children:p(Ze,{color:"gray",size:"xl"})}):p("div",{className:"LocalizationModal__translations",children:[p("div",{className:"LocalizationModal__translations__header",children:[p("div",{className:"LocalizationModal__translations__titleWrap",children:[p(et,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[p(Eu,{strokeWidth:1.5})," ",p("span",{children:"Translations"})]}),p(re,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",children:"Open Translations Editor"})]}),p("div",{className:"LocalizationModal__translations__header__buttons",children:[m.enabled&&h?.spreadsheetId&&p(Se,{label:"Open Google Sheet",children:p(Je,{component:"a",href:Ma(h),target:"_blank",variant:"filled",color:"green",size:"sm",children:p(Sf,{size:16,strokeWidth:2.25})})}),p(p4e,{onAction:R,gapiClient:m,linkedSheet:h}),p(m4e,{onAction:R,gapiClient:m,linkedSheet:h})]})]}),p("table",{className:"LocalizationModal__translations__table",children:[p("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[p("th",{className:"LocalizationModal__translations__table__header",children:p(et,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),p("th",{className:"LocalizationModal__translations__table__header",children:p(et,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[p("span",{children:"LOCALE: "})," ",p(Er,{data:y,size:"xs",placeholder:"select locale",allowDeselect:!0,value:s,onChange:P=>l(P)})]})})]}),o.map((P,B)=>p("tr",{className:"LocalizationModal__translations__table__row",children:[p("td",{className:"LocalizationModal__translations__table__col",children:p(_e,{sx:$=>({backgroundColor:$.colors.gray[0],border:`1px solid ${$.colors.gray[3]}`,padding:"10px 20px",borderRadius:4,height:"100%"}),children:p(Gr,{size:"xs",sx:{whiteSpace:"pre-wrap"},children:P})})}),p("td",{className:"LocalizationModal__translations__table__col",children:p(_e,{sx:$=>({backgroundColor:$.colors.gray[0],border:`1px solid ${$.colors.gray[3]}`,padding:"10px 20px",borderRadius:4,height:"100%"}),children:p(Gr,{size:"xs",sx:{whiteSpace:"pre-wrap"},children:c[P]||" "})})})]},B))]})]})};function p4e(t){function e(o){t.onAction&&t.onAction(o)}let r=t.linkedSheet;return p(je,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(ol,{size:16,strokeWidth:1.75}),rightIcon:p(wu,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&p(Te,{children:[p(je.Label,{children:"Google Sheets"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",disabled:!r?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),p(Ea,{})]}),p(je.Label,{children:"File"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"})]})}function m4e(t){async function e(n){t.onAction&&t.onAction(n)}let o=!!t.linkedSheet?.spreadsheetId;return p(je,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(yf,{size:16,strokeWidth:1.75}),rightIcon:p(wu,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&p(Te,{children:[p(je.Label,{children:"Google Sheets"}),o?p(Te,{children:p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):p(Te,{children:p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),p(Ea,{})]}),p(je.Label,{children:"File"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),o&&p(Te,{children:[p(Ea,{}),p(je.Label,{children:"Danger zone"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function _re(t){let e=t.split("_"),r=e[0];if(r==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(r)||t} (${t})`}Pe();var xre="LockPublishingModal";function bre(t){let e=Ct(),r=Vt();return{open:o=>{let i={...t,...o}.unlock?`Unlock publishing for ${t.docId}`:`Lock publishing for ${t.docId}`;e.openContextModal(xre,{...r,title:i,innerProps:{...t,...o},size:"600px"})}}}function Lu(t){let{innerProps:e}=t;return e.unlock?p(Lu.Unlock,{...t}):p(Lu.Lock,{...t})}Lu.Lock=t=>{let{innerProps:e,context:r,id:o}=t,[n,i]=M(""),[a,s]=M(0),[l,c]=M(!1),u=Ct();function d(m){return m?Math.floor(new Date(m).getTime()):0}async function f(m){m.preventDefault(),c(!0),await er(async()=>{await CQ(e.docId,{reason:n,until:a}),Ae({title:"Locked!",message:`Publishing is locked for ${e.docId}.`,autoClose:1e4}),u.closeModal(o),e.onChange&&e.onChange("locked")})}return p("div",{className:"LockPublishingModal LockPublishingModal--lock",children:[p(Ye,{className:"LockPublishingModal__body",children:"Are you sure you want to lock publishing? Content editors will not be able to publish until publishing is unlocked."}),p("form",{className:"LockPublishingModal__form",onSubmit:m=>f(m),children:[p("div",{className:"LockPublishingModal__form__section",children:p(ir,{name:"reason",label:"Reason",description:"Specify a short reason so other content editors know why publishing is locked.",size:"xs",radius:0,onChange:m=>{i(m.currentTarget.value)}})}),p("div",{className:"LockPublishingModal__form__section",children:p(kn,{label:"Lock until",description:"Optional. Publishing is unlocked at the specified time. If not provided, publishing will be locked indefinitely.",size:"xs",children:p("div",{className:"DocEditor__DateTimeField",children:[p("input",{name:"until",type:"datetime-local",min:gh(),onChange:m=>{let g=m.target.value;s(d(g))}}),p("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})})}),p("div",{className:"LockPublishingModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",leftIcon:p(If,{size:14}),disabled:!n,type:"submit",loading:l,children:"Lock"})]})]})]})};Lu.Unlock=t=>{let{innerProps:e,context:r,id:o}=t,[n,i]=M(!1),a=Ct();async function s(){i(!0),await er(async()=>{await TQ(e.docId),Ae({title:"Unlocked!",message:`Publishing is unlocked for ${e.docId}.`,autoClose:1e4}),a.closeModal(o),e.onChange&&e.onChange("unlocked")})}return p("div",{className:"LockPublishingModal LockPublishingModal--unlock",children:[p(Ye,{className:"LockPublishingModal__body",children:["Are you sure you want to unlock publishing for ",e.docId,"? This will re-enable content editors to publish the doc."]}),p("div",{className:"LockPublishingModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",leftIcon:p(Sb,{size:14}),loading:n,onClick:()=>s(),children:"Unlock"})]})]})};Lu.id=xre;Pe();var n2=t=>{if(typeof t>"u"||t===null||typeof t=="bigint"||Number.isNaN(t)||t===1/0||t===-1/0)return;if(["string","number","boolean"].includes(typeof t))return t;if(Array.isArray(t))return t.map(n2).filter(r=>typeof r<"u");let e={};for(let[r,o]of Object.entries(t)){let n=n2(o);typeof n<"u"&&(e[r]=n)}return e},yre=n2,h4e=(t,e,r=!1)=>{if(!Array.isArray(t)||!Array.isArray(e))throw new Error("Both arguments should be arrays.");let o=t.length,n=e.length,i=o+n,a=new Array(i);if(r){for(let s=0;s<n;s++)a[s]=e[n-s-1];for(let s=0;s<o;s++)a[s+n]=t[s];return a}for(let s=0;s<o;s++)a[s]=t[s];for(let s=0;s<n;s++)a[s+o]=e[s];return a},kr=h4e,i2=(t,e=new Map)=>{if(typeof t!="object"||t===null)return!1;if(e.has(t))return!0;if(e.set(t,!0),Array.isArray(t)){for(let r=0;r<t.length;r++)if(i2(t[r],e))return!0;return!1}for(let r in t)if(i2(t[r],e))return!0;return!1},g4e=i2,a2=(t,e,r,o=1/0,n)=>{if(!t||typeof t!="object"){let a;if(!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&typeof t!="bigint"&&(a=JSON.stringify(t,e,r)),a===void 0)switch(n){case Jb.throw:throw new Error(`Value is not valid in JSON, got ${String(t)}`);case Jb.stringify:return _4e(t);default:throw new Error("Should not reach here, please report this bug.")}return a}let i=o<1?'"..."':Array.isArray(t)?`[${t.map(a=>a2(a,e,r,o-1,n)).join(",")}]`:`{${Object.keys(t).map(a=>`"${a}": ${a2(t[a],e,r,o-1,n)}`).join(", ")}}`;return JSON.stringify(JSON.parse(i),e,r)},_4e=t=>t===void 0?"undefined":t===1/0?"Infinity":t===-1/0?"-Infinity":Number.isNaN(t)?"NaN":typeof t=="bigint"?`${t}n`:String(t),Zo=a2,x4e=(t,e=1/0,r=!1,o=Jb.stringify)=>t===null?"null":Array.isArray(t)||typeof t=="object"?Zo(t,void 0,r?1:void 0,e,o):Zo(t,void 0,void 0,void 0,o),Fa=x4e,vre=t=>typeof t=="boolean"?0:typeof t=="number"?1:typeof t=="string"?2:t===null?3:Array.isArray(t)?4:typeof t=="object"?5:typeof t=="symbol"?6:typeof t=="function"?7:typeof t=="bigint"?8:-1,b4e=(t,e,r)=>{let o=r.keyOrdersMap?.get(t),n=r.keyOrdersMap?.get(e);if(o!==void 0&&n!==void 0)return o-n;let i=vre(t),a=vre(e);if(i!==a)return i-a;if(t===null&&e===null||Array.isArray(t)&&Array.isArray(e)||i===5&&a===5)return 0;switch(typeof t){case"number":return Number.isNaN(t)&&Number.isNaN(e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0?0:t-e;case"string":return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t<e?-1:t>e?1:0;case"boolean":return+t-+e;case"symbol":case"function":return String(t).localeCompare(String(e))}if(typeof t=="bigint"&&typeof e=="bigint"){let s=BigInt(t)-BigInt(e);return s<0?-1:s>0?1:0}return String(t).localeCompare(String(e))},Qb=b4e,y4e=t=>Array.isArray(t)?"array":t===null?"null":typeof t,ps=y4e,v4e=(t,e,r,o,n,i,a,s)=>{let l={ignoreCase:s.ignoreCase},c=Fa(n,s.maxDepth,!0,s.undefinedBehavior).split(`
68
68
  `),u=Fa(i,s.maxDepth,!0,s.undefinedBehavior).split(`
@@ -184,7 +184,7 @@ ${He.current.stack}
184
184
  -moz-user-select: none;
185
185
  -ms-user-select: none;
186
186
  overflow-anchor: none;
187
- `}}];return{always:ay(a,"always"),resting:ay(a,"resting"),dragging:ay(a,"dragging"),dropAnimating:ay(a,"dropAnimating"),userCancel:ay(a,"userCancel")}},la=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ft:V,H2=()=>{let t=document.querySelector("head");return t||ue(),t},Kne=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function w7e(t,e){let r=Wt(()=>I7e(t),[t]),o=W(null),n=W(null),i=Xe(en(d=>{let f=n.current;f||ue(),f.textContent=d}),[]),a=Xe(d=>{let f=o.current;f||ue(),f.textContent=d},[]);la(()=>{!o.current&&!n.current||ue();let d=Kne(e),f=Kne(e);return o.current=d,n.current=f,d.setAttribute(`${Kh}-always`,t),f.setAttribute(`${Kh}-dynamic`,t),H2().appendChild(d),H2().appendChild(f),a(r.always),i(r.resting),()=>{let m=h=>{let g=h.current;g||ue(),H2().removeChild(g),h.current=null};m(o),m(n)}},[e,a,i,r.always,r.resting,t]);let s=Xe(()=>i(r.dragging),[i,r.dragging]),l=Xe(d=>{if(d==="DROP"){i(r.dropAnimating);return}i(r.userCancel)},[i,r.dropAnimating,r.userCancel]),c=Xe(()=>{n.current&&i(r.resting)},[i,r.resting]);return Wt(()=>({dragging:s,dropping:l,resting:c}),[s,l,c])}function Uie(t,e){return Array.from(t.querySelectorAll(e))}var Vie=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function vy(t){return t instanceof Vie(t).HTMLElement}function Hie(t,e){let r=`[${Yh.contextId}="${t}"]`,o=Uie(document,r);if(!o.length)return null;let n=o.find(i=>i.getAttribute(Yh.draggableId)===e);return!n||!vy(n)?null:n}function E7e(t){let e=W({}),r=W(null),o=W(null),n=W(!1),i=Xe(function(f,m){let h={id:f,focus:m};return e.current[f]=h,function(){let _=e.current;_[f]!==h&&delete _[f]}},[]),a=Xe(function(f){let m=Hie(t,f);m&&m!==document.activeElement&&m.focus()},[t]),s=Xe(function(f,m){r.current===f&&(r.current=m)},[]),l=Xe(function(){o.current||n.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let f=r.current;f&&a(f)}))},[a]),c=Xe(function(f){r.current=null;let m=document.activeElement;m&&m.getAttribute(Yh.draggableId)===f&&(r.current=f)},[]);return la(()=>(n.current=!0,function(){n.current=!1;let f=o.current;f&&cancelAnimationFrame(f)}),[]),Wt(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:s}),[i,c,l,s])}function S7e(){let t={draggables:{},droppables:{}},e=[];function r(d){return e.push(d),function(){let m=e.indexOf(d);m!==-1&&e.splice(m,1)}}function o(d){e.length&&e.forEach(f=>f(d))}function n(d){return t.draggables[d]||null}function i(d){let f=n(d);return f||ue(),f}let a={register:d=>{t.draggables[d.descriptor.id]=d,o({type:"ADDITION",value:d})},update:(d,f)=>{let m=t.draggables[f.descriptor.id];m&&m.uniqueId===d.uniqueId&&(delete t.draggables[f.descriptor.id],t.draggables[d.descriptor.id]=d)},unregister:d=>{let f=d.descriptor.id,m=n(f);m&&d.uniqueId===m.uniqueId&&(delete t.draggables[f],t.droppables[d.descriptor.droppableId]&&o({type:"REMOVAL",value:d}))},getById:i,findById:n,exists:d=>!!n(d),getAllByType:d=>Object.values(t.draggables).filter(f=>f.descriptor.type===d)};function s(d){return t.droppables[d]||null}function l(d){let f=s(d);return f||ue(),f}let c={register:d=>{t.droppables[d.descriptor.id]=d},unregister:d=>{let f=s(d.descriptor.id);f&&d.uniqueId===f.uniqueId&&delete t.droppables[d.descriptor.id]},getById:l,findById:s,exists:d=>!!s(d),getAllByType:d=>Object.values(t.droppables).filter(f=>f.descriptor.type===d)};function u(){t.draggables={},t.droppables={},e.length=0}return{draggable:a,droppable:c,subscribe:r,clean:u}}function C7e(){let t=Wt(S7e,[]);return V(()=>function(){t.clean()},[t]),t}var _F=D.createContext(null),hy=()=>{let t=document.body;return t||ue(),t},T7e={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},k7e=t=>`rfd-announcement-${t}`;function N7e(t){let e=Wt(()=>k7e(t),[t]),r=W(null);return V(function(){let i=document.createElement("div");return r.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),qc(i.style,T7e),hy().appendChild(i),function(){setTimeout(function(){let l=hy();l.contains(i)&&l.removeChild(i),i===r.current&&(r.current=null)})}},[e]),Xe(n=>{let i=r.current;if(i){i.textContent=n;return}},[])}var P7e={separator:"::"};function xF(t,e=P7e){let r=D.useId();return Wt(()=>`${t}${e.separator}${r}`,[e.separator,t,r])}function O7e({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function A7e({contextId:t,text:e}){let r=xF("hidden-text",{separator:"-"}),o=Wt(()=>O7e({contextId:t,uniqueId:r}),[r,t]);return V(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",hy().appendChild(i),function(){let s=hy();s.contains(i)&&s.removeChild(i)}},[o,e]),o}var aT=D.createContext(null),D7e={react:"^18.0.0 || ^19.0.0"},R7e=/(\d+)\.(\d+)\.(\d+)/,Yne=t=>{let e=R7e.exec(t);e==null&&ue();let r=Number(e[1]),o=Number(e[2]),n=Number(e[3]);return{major:r,minor:o,patch:n,raw:t}},M7e=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,L7e=(t,e)=>{let r=Yne(t),o=Yne(e);M7e(r,o)};var F7e=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function Iy(t,e){}function B7e(){Iy(()=>{L7e(D7e.react,D.version),F7e(document)},[])}function bF(t){let e=W(t);return V(()=>{e.current=t}),e}function $7e(){let t=null;function e(){return!!t}function r(a){return a===t}function o(a){t&&ue();let s={abandon:a};return t=s,s}function n(){t||ue(),t=null}function i(){t&&(t.abandon(),n())}return{isClaimed:e,isActive:r,claim:o,release:n,tryAbandon:i}}function gy(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var z7e=9,U7e=13,yF=27,jie=32,V7e=33,H7e=34,j7e=35,G7e=36,W7e=37,q7e=38,K7e=39,Y7e=40,X7e={[U7e]:!0,[z7e]:!0},Gie=t=>{X7e[t.keyCode]&&t.preventDefault()},sT=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),Wie=0,Xne=5;function J7e(t,e){return Math.abs(e.x-t.x)>=Xne||Math.abs(e.y-t.y)>=Xne}var Jne={type:"IDLE"};function Q7e({cancel:t,completed:e,getPhase:r,setPhase:o}){return[{eventName:"mousemove",fn:n=>{let{button:i,clientX:a,clientY:s}=n;if(i!==Wie)return;let l={x:a,y:s},c=r();if(c.type==="DRAGGING"){n.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&ue();let u=c.point;if(!J7e(u,l))return;n.preventDefault();let d=c.actions.fluidLift(l);o({type:"DRAGGING",actions:d})}},{eventName:"mouseup",fn:n=>{let i=r();if(i.type!=="DRAGGING"){t();return}n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:n=>{r().type==="DRAGGING"&&n.preventDefault(),t()}},{eventName:"keydown",fn:n=>{if(r().type==="PENDING"){t();return}if(n.keyCode===yF){n.preventDefault(),t();return}Gie(n)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:n=>{let i=r();if(i.type==="IDLE"&&ue(),i.actions.shouldRespectForcePress()){t();return}n.preventDefault()}},{eventName:sT,fn:t}]}function Z7e(t){let e=W(Jne),r=W(zu),o=Wt(()=>({eventName:"mousedown",fn:function(d){if(d.defaultPrevented||d.button!==Wie||d.ctrlKey||d.metaKey||d.shiftKey||d.altKey)return;let f=t.findClosestDraggableId(d);if(!f)return;let m=t.tryGetLock(f,a,{sourceEvent:d});if(!m)return;d.preventDefault();let h={x:d.clientX,y:d.clientY};r.current(),c(m,h)}}),[t]),n=Wt(()=>({eventName:"webkitmouseforcewillbegin",fn:u=>{if(u.defaultPrevented)return;let d=t.findClosestDraggableId(u);if(!d)return;let f=t.findOptionsForDraggable(d);f&&(f.shouldRespectForcePress||t.canGetLock(d)&&u.preventDefault())}}),[t]),i=Xe(function(){let d={passive:!1,capture:!0};r.current=za(window,[n,o],d)},[n,o]),a=Xe(()=>{e.current.type!=="IDLE"&&(e.current=Jne,r.current(),i())},[i]),s=Xe(()=>{let u=e.current;a(),u.type==="DRAGGING"&&u.actions.cancel({shouldBlockNextClick:!0}),u.type==="PENDING"&&u.actions.abort()},[a]),l=Xe(function(){let d={capture:!0,passive:!1},f=Q7e({cancel:s,completed:a,getPhase:()=>e.current,setPhase:m=>{e.current=m}});r.current=za(window,f,d)},[s,a]),c=Xe(function(d,f){e.current.type!=="IDLE"&&ue(),e.current={type:"PENDING",point:f,actions:d},l()},[l]);la(function(){return i(),function(){r.current()}},[i])}function eje(){}var tje={[H7e]:!0,[V7e]:!0,[G7e]:!0,[j7e]:!0};function rje(t,e){function r(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:n=>{if(n.keyCode===yF){n.preventDefault(),r();return}if(n.keyCode===jie){n.preventDefault(),o();return}if(n.keyCode===Y7e){n.preventDefault(),t.moveDown();return}if(n.keyCode===q7e){n.preventDefault(),t.moveUp();return}if(n.keyCode===K7e){n.preventDefault(),t.moveRight();return}if(n.keyCode===W7e){n.preventDefault(),t.moveLeft();return}if(tje[n.keyCode]){n.preventDefault();return}Gie(n)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:sT,fn:r}]}function oje(t){let e=W(eje),r=Wt(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==jie)return;let a=t.findClosestDraggableId(i);if(!a)return;let s=t.tryGetLock(a,u,{sourceEvent:i});if(!s)return;i.preventDefault();let l=!0,c=s.snapLift();e.current();function u(){l||ue(),l=!1,e.current(),o()}e.current=za(window,rje(c,u),{capture:!0,passive:!1})}}),[t]),o=Xe(function(){let i={passive:!1,capture:!0};e.current=za(window,[r],i)},[r]);la(function(){return o(),function(){e.current()}},[o])}var j2={type:"IDLE"},nje=120,ije=.15;function aje({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(e().type!=="DRAGGING"){t();return}r.keyCode===yF&&r.preventDefault(),t()}},{eventName:sT,fn:t}]}function sje({cancel:t,completed:e,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let n=r();if(n.type!=="DRAGGING"){t();return}n.hasMoved=!0;let{clientX:i,clientY:a}=o.touches[0],s={x:i,y:a};o.preventDefault(),n.actions.move(s)}},{eventName:"touchend",fn:o=>{let n=r();if(n.type!=="DRAGGING"){t();return}o.preventDefault(),n.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(r().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let n=r();n.type==="IDLE"&&ue();let i=o.touches[0];if(!i||!(i.force>=ije))return;let s=n.actions.shouldRespectForcePress();if(n.type==="PENDING"){s&&t();return}if(s){if(n.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:sT,fn:t}]}function lje(t){let e=W(j2),r=W(zu),o=Xe(function(){return e.current},[]),n=Xe(function(m){e.current=m},[]),i=Wt(()=>({eventName:"touchstart",fn:function(m){if(m.defaultPrevented)return;let h=t.findClosestDraggableId(m);if(!h)return;let g=t.tryGetLock(h,s,{sourceEvent:m});if(!g)return;let _=m.touches[0],{clientX:b,clientY:y}=_,v={x:b,y};r.current(),d(g,v)}}),[t]),a=Xe(function(){let m={capture:!0,passive:!1};r.current=za(window,[i],m)},[i]),s=Xe(()=>{let f=e.current;f.type!=="IDLE"&&(f.type==="PENDING"&&clearTimeout(f.longPressTimerId),n(j2),r.current(),a())},[a,n]),l=Xe(()=>{let f=e.current;s(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[s]),c=Xe(function(){let m={capture:!0,passive:!1},h={cancel:l,completed:s,getPhase:o},g=za(window,sje(h),m),_=za(window,aje(h),m);r.current=function(){g(),_()}},[l,o,s]),u=Xe(function(){let m=o();m.type!=="PENDING"&&ue();let h=m.actions.fluidLift(m.point);n({type:"DRAGGING",actions:h,hasMoved:!1})},[o,n]),d=Xe(function(m,h){o().type!=="IDLE"&&ue();let g=setTimeout(u,nje);n({type:"PENDING",point:h,actions:m,longPressTimerId:g}),c()},[c,o,n,u]);la(function(){return a(),function(){r.current();let h=o();h.type==="PENDING"&&(clearTimeout(h.longPressTimerId),n(j2))}},[o,a,n]),la(function(){return za(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function cje(t){}var uje=["input","button","textarea","select","option","optgroup","video","audio"];function qie(t,e){if(e==null)return!1;if(uje.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:qie(t,e.parentElement)}function dje(t,e){let r=e.target;return vy(r)?qie(t,r):!1}var fje=t=>$a(t.getBoundingClientRect()).center;function pje(t){return t instanceof Vie(t).Element}var mje=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function Kie(t,e){return t==null?null:t[mje](e)?t:Kie(t.parentElement,e)}function hje(t,e){return t.closest?t.closest(e):Kie(t,e)}function gje(t){return`[${Yh.contextId}="${t}"]`}function _je(t,e){let r=e.target;if(!pje(r))return null;let o=gje(t),n=hje(r,o);return!n||!vy(n)?null:n}function xje(t,e){let r=_je(t,e);return r?r.getAttribute(Yh.draggableId):null}function bje(t,e){let r=`[${eF.contextId}="${t}"]`,n=Uie(document,r).find(i=>i.getAttribute(eF.id)===e);return!n||!vy(n)?null:n}function yje(t){t.preventDefault()}function XC({expected:t,phase:e,isLockActive:r,shouldWarn:o}){return!(!r()||t!==e)}function Yie({lockAPI:t,store:e,registry:r,draggableId:o}){if(t.isClaimed())return!1;let n=r.draggable.findById(o);return!(!n||!n.options.isEnabled||!Fie(e.getState(),o))}function vje({lockAPI:t,contextId:e,store:r,registry:o,draggableId:n,forceSensorStop:i,sourceEvent:a}){if(!Yie({lockAPI:t,store:r,registry:o,draggableId:n}))return null;let l=o.draggable.getById(n),c=bje(e,l.descriptor.id);if(!c||a&&!l.options.canDragInteractiveElements&&dje(c,a))return null;let u=t.claim(i||zu),d="PRE_DRAG";function f(){return l.options.shouldRespectForcePress}function m(){return t.isActive(u)}function h(N,I){XC({expected:N,phase:d,isLockActive:m,shouldWarn:!0})&&r.dispatch(I())}let g=h.bind(null,"DRAGGING");function _(N){function I(){t.release(),d="COMPLETED"}d!=="PRE_DRAG"&&(I(),ue()),r.dispatch(c8e(N.liftActionArgs)),d="DRAGGING";function E(w,S={shouldBlockNextClick:!1}){if(N.cleanup(),S.shouldBlockNextClick){let T=za(window,[{eventName:"click",fn:yje,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(T)}I(),r.dispatch(Nie({reason:w}))}return{isActive:()=>XC({expected:"DRAGGING",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:f,drop:w=>E("DROP",w),cancel:w=>E("CANCEL",w),...N.actions}}function b(N){let I=Wh(w=>{g(()=>kie({client:w}))});return{..._({liftActionArgs:{id:n,clientSelection:N,movementMode:"FLUID"},cleanup:()=>I.cancel(),actions:{move:I}}),move:I}}function y(){let N={moveUp:()=>g(x8e),moveRight:()=>g(y8e),moveDown:()=>g(b8e),moveLeft:()=>g(v8e)};return _({liftActionArgs:{id:n,clientSelection:fje(c),movementMode:"SNAP"},cleanup:zu,actions:N})}function v(){XC({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!0})&&t.release()}return{isActive:()=>XC({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:f,fluidLift:b,snapLift:y,abort:v}}var Ije=[Z7e,oje,lje];function wje({contextId:t,store:e,registry:r,customSensors:o,enableDefaultSensors:n}){let i=[...n?Ije:[],...o||[]],a=M(()=>$7e())[0],s=Xe(function(_,b){gy(_)&&!gy(b)&&a.tryAbandon()},[a]);la(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();s(_,y),_=y})},[a,e,s]),la(()=>a.tryAbandon,[a.tryAbandon]);let l=Xe(g=>Yie({lockAPI:a,registry:r,store:e,draggableId:g}),[a,r,e]),c=Xe((g,_,b)=>vje({lockAPI:a,registry:r,contextId:t,store:e,draggableId:g,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,a,r,e]),u=Xe(g=>xje(t,g),[t]),d=Xe(g=>{let _=r.draggable.findById(g);return _?_.options:null},[r.draggable]),f=Xe(function(){a.isClaimed()&&(a.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(uF()))},[a,e]),m=Xe(()=>a.isClaimed(),[a]),h=Wt(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:u,findOptionsForDraggable:d,tryReleaseLock:f,isLockClaimed:m}),[l,c,u,d,f,m]);cje(i);for(let g=0;g<i.length;g++)i[g](h)}var Eje=t=>({onBeforeCapture:e=>{Dl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),Sje=t=>({...my,...t.autoScrollerOptions,durationDampening:{...my.durationDampening,...t.autoScrollerOptions}});function sy(t){return t.current||ue(),t.current}function Cje(t){let{contextId:e,setCallbacks:r,sensors:o,nonce:n,dragHandleUsageInstructions:i}=t,a=W(null);B7e();let s=bF(t),l=Xe(()=>Eje(s.current),[s]),c=Xe(()=>Sje(s.current),[s]),u=N7e(e),d=A7e({contextId:e,text:i}),f=w7e(e,n),m=Xe(T=>{sy(a).dispatch(T)},[]),h=Wt(()=>T2({publishWhileDragging:d8e,updateDroppableScroll:p8e,updateDroppableIsEnabled:m8e,updateDroppableIsCombineEnabled:h8e,collectionStarting:f8e},m),[m]),g=C7e(),_=Wt(()=>t7e(g,h),[g,h]),b=Wt(()=>x7e({scrollWindow:r7e,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...T2({move:kie},m)}),[_.scrollDroppable,m,c]),y=E7e(e),v=Wt(()=>J8e({announce:u,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:f}),[u,b,_,y,l,f]);a.current=v;let C=Xe(()=>{let T=sy(a);T.getState().phase!=="IDLE"&&T.dispatch(uF())},[]),N=Xe(()=>{let T=sy(a).getState();return T.phase==="DROP_ANIMATING"?!0:T.phase==="IDLE"?!1:T.isDragging},[]),I=Wt(()=>({isDragging:N,tryAbort:C}),[N,C]);r(I);let E=Xe(T=>Fie(sy(a).getState(),T),[]),w=Xe(()=>Gf(sy(a).getState()),[]),S=Wt(()=>({marshal:_,focus:y,contextId:e,canLift:E,isMovementAllowed:w,dragHandleUsageInstructionsId:d,registry:g}),[e,_,d,y,E,w,g]);return wje({contextId:e,store:v,registry:g,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),V(()=>C,[C]),D.createElement(aT.Provider,{value:S},D.createElement(Tne,{context:_F,store:v},t.children))}function Tje(){return D.useId()}function lT(t){let e=Tje(),r=t.dragHandleUsageInstructions||QC.dragHandleUsageInstructions;return D.createElement(Y2,null,o=>D.createElement(Cje,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:r,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var Qne={dragging:5e3,dropAnimating:4500},kje=(t,e)=>e?cy.drop(e.duration):t?cy.snap:cy.fluid,Nje=(t,e)=>{if(t)return e?py.opacity.drop:py.opacity.combining},Pje=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function Oje(t){let r=t.dimension.client,{offset:o,combineWith:n,dropping:i}=t,a=!!n,s=Pje(t),l=!!i,c=l?Q2.drop(o,a):Q2.moveTo(o);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:kje(s,i),transform:c,opacity:Nje(a,l),zIndex:l?Qne.dropAnimating:Qne.dragging,pointerEvents:"none"}}function Aje(t){return{transform:Q2.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function Dje(t){return t.type==="DRAGGING"?Oje(t):Aje(t)}function Rje(t,e,r=tn){let o=window.getComputedStyle(e),n=e.getBoundingClientRect(),i=F2(n,o),a=ny(i,r),s={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:s,displaceBy:l,client:i,page:a}}function Mje(t){let e=xF("draggable"),{descriptor:r,registry:o,getDraggableRef:n,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}=t,l=Wt(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}),[i,s,a]),c=Xe(m=>{let h=n();return h||ue(),Rje(r,h,m)},[r,n]),u=Wt(()=>({uniqueId:e,descriptor:r,options:l,getDimension:c}),[r,c,l,e]),d=W(u),f=W(!0);la(()=>(o.draggable.register(d.current),()=>o.draggable.unregister(d.current)),[o.draggable]),la(()=>{if(f.current){f.current=!1;return}let m=d.current;d.current=u,o.draggable.update(u,m)},[u,o.draggable])}var vF=D.createContext(null);function Xie(t){t&&vy(t)||ue()}function Lje(t,e,r){Iy(()=>{function o(i){return`Draggable[id: ${i}]: `}let n=t.draggableId;n||ue(!1),typeof n!="string"&&ue(!1),Number.isInteger(t.index)||ue(!1),t.mapped.type!=="DRAGGING"&&(Xie(r()),t.isEnabled&&(Hie(e,n)||ue(!1)))})}function Fje(t){}function tT(t){let e=lt(t);return e||ue(),e}function Bje(t){t.preventDefault()}var $je=t=>{let e=W(null),r=Xe((I=null)=>{e.current=I},[]),o=Xe(()=>e.current,[]),{contextId:n,dragHandleUsageInstructionsId:i,registry:a}=tT(aT),{type:s,droppableId:l}=tT(vF),c=Wt(()=>({id:t.draggableId,index:t.index,type:s,droppableId:l}),[t.draggableId,t.index,s,l]),{children:u,draggableId:d,isEnabled:f,shouldRespectForcePress:m,canDragInteractiveElements:h,isClone:g,mapped:_,dropAnimationFinished:b}=t;if(Lje(t,n,o),Fje(g),!g){let I=Wt(()=>({descriptor:c,registry:a,getDraggableRef:o,canDragInteractiveElements:h,shouldRespectForcePress:m,isEnabled:f}),[c,a,o,h,m,f]);Mje(I)}let y=Wt(()=>f?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":d,"data-rfd-drag-handle-context-id":n,draggable:!1,onDragStart:Bje}:null,[n,i,d,f]),v=Xe(I=>{_.type==="DRAGGING"&&_.dropping&&I.propertyName==="transform"&&Dl(b)},[b,_]),C=Wt(()=>{let I=Dje(_),E=_.type==="DRAGGING"&&_.dropping?v:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":n,"data-rfd-draggable-id":d,style:I,onTransitionEnd:E},dragHandleProps:y}},[n,y,d,_,v,r]),N=Wt(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return D.createElement(D.Fragment,null,u(C,_.snapshot,N))},Jie=(t,e)=>t===e,Qie=t=>{let{combine:e,destination:r}=t;return r?r.droppableId:e?e.droppableId:null},zje=t=>t.combine?t.combine.draggableId:null,Uje=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function Vje(){let t=en((n,i)=>({x:n,y:i})),e=en((n,i,a=null,s=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:n,draggingOver:a,combineWith:s,combineTargetFor:null})),r=en((n,i,a,s,l=null,c=null,u=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:n,dimension:a,forceShouldAnimate:u,snapshot:e(i,s,l,c,null)}}));return(n,i)=>{if(gy(n)){if(n.critical.draggable.id!==i.draggableId)return null;let a=n.current.client.offset,s=n.dimensions.draggables[i.draggableId],l=sa(n.impact),c=Uje(n.impact),u=n.forceShouldAnimate;return r(t(a.x,a.y),n.movementMode,s,i.isClone,l,c,u)}if(n.phase==="DROP_ANIMATING"){let a=n.completed;if(a.result.draggableId!==i.draggableId)return null;let s=i.isClone,l=n.dimensions.draggables[i.draggableId],c=a.result,u=c.mode,d=Qie(c),f=zje(c),h={duration:n.dropDuration,curve:fF.drop,moveTo:n.newHomeClientOffset,opacity:f?py.opacity.drop:null,scale:f?py.scale.drop:null};return{mapped:{type:"DRAGGING",offset:n.newHomeClientOffset,dimension:l,dropping:h,draggingOver:d,combineWith:f,mode:u,forceShouldAnimate:null,snapshot:e(u,s,d,f,h)}}}return null}}function Zie(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var Hje={mapped:{type:"SECONDARY",offset:tn,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Zie(null)}};function jje(){let t=en((a,s)=>({x:a,y:s})),e=en(Zie),r=en((a,s=null,l)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:s,shouldAnimateDisplacement:l,snapshot:e(s)}})),o=a=>a?r(tn,a,!0):null,n=(a,s,l,c)=>{let u=l.displaced.visible[a],d=!!(c.inVirtualList&&c.effected[a]),f=oT(l),m=f&&f.draggableId===a?s:null;if(!u){if(!d)return o(m);if(l.displaced.invisible[a])return null;let _=Xh(c.displacedBy.point),b=t(_.x,_.y);return r(b,m,!0)}if(d)return o(m);let h=l.displacedBy.point,g=t(h.x,h.y);return r(g,m,u.shouldAnimate)};return(a,s)=>{if(gy(a))return a.critical.draggable.id===s.draggableId?null:n(s.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){let l=a.completed;return l.result.draggableId===s.draggableId?null:n(s.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var Gje=()=>{let t=Vje(),e=jje();return(o,n)=>t(o,n)||e(o,n)||Hje},Wje={dropAnimationFinished:Pie},qje=R2(Gje,Wje,null,{context:_F,areStatePropsEqual:Jie})($je);function eae(t){return tT(vF).isUsingCloneFor===t.draggableId&&!t.isClone?null:D.createElement(qje,t)}function cT(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,r=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return D.createElement(eae,qc({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:r,shouldRespectForcePress:o}))}var IF=t=>e=>t===e,Kje=IF("scroll"),Yje=IF("auto"),Xje=IF("visible"),Zne=(t,e)=>e(t.overflowX)||e(t.overflowY),Jje=(t,e)=>e(t.overflowX)&&e(t.overflowY),tae=t=>{let e=window.getComputedStyle(t),r={overflowX:e.overflowX,overflowY:e.overflowY};return Zne(r,Kje)||Zne(r,Yje)},Qje=()=>!1,rae=t=>t==null?null:t===document.body?Qje()?t:null:t===document.documentElement?null:tae(t)?t:rae(t.parentElement);var tF=t=>({x:t.scrollLeft,y:t.scrollTop}),oae=t=>t?window.getComputedStyle(t).position==="fixed"?!0:oae(t.parentElement):!1,Zje=t=>{let e=rae(t),r=oae(t);return{closestScrollable:e,isFixedOnPage:r}},eGe=({descriptor:t,isEnabled:e,isCombineEnabled:r,isFixedOnPage:o,direction:n,client:i,page:a,closest:s})=>{let l=(()=>{if(!s)return null;let{scrollSize:f,client:m}=s,h=Rie({scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,height:m.paddingBox.height,width:m.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:m,scrollSize:f,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:h,diff:{value:tn,displacement:tn}}}})(),c=n==="vertical"?iF:pie,u=qh({page:a,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:r,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:a,frame:l,subject:u}},tGe=(t,e)=>{let r=B2(t);if(!e||t!==e)return r;let o=r.paddingBox.top-e.scrollTop,n=r.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,a=n+e.scrollWidth,l=qC({top:o,right:a,bottom:i,left:n},r.border);return KC({borderBox:l,margin:r.margin,border:r.border,padding:r.padding})},rGe=({ref:t,descriptor:e,env:r,windowScroll:o,direction:n,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:s})=>{let l=r.closestScrollable,c=tGe(t,l),u=ny(c,o),d=(()=>{if(!l)return null;let m=B2(l),h={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:m,page:ny(m,o),scroll:tF(l),scrollSize:h,shouldClipSubject:s}})();return eGe({descriptor:e,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:r.isFixedOnPage,direction:n,client:c,page:u,closest:d})},oGe={passive:!1},nGe={passive:!0},eie=t=>t.shouldPublishImmediately?oGe:nGe,JC=t=>t&&t.env.closestScrollable||null;function iGe(t){let e=W(null),r=tT(aT),o=xF("droppable"),{registry:n,marshal:i}=r,a=bF(t),s=Wt(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=W(s),c=Wt(()=>en((C,N)=>{e.current||ue();let I={x:C,y:N};i.updateDroppableScroll(s.id,I)}),[s.id,i]),u=Xe(()=>{let C=e.current;return!C||!C.env.closestScrollable?tn:tF(C.env.closestScrollable)},[]),d=Xe(()=>{let C=u();c(C.x,C.y)},[u,c]),f=Wt(()=>Wh(d),[d]),m=Xe(()=>{let C=e.current,N=JC(C);if(C&&N||ue(),C.scrollOptions.shouldPublishImmediately){d();return}f()},[f,d]),h=Xe((C,N)=>{e.current&&ue();let I=a.current,E=I.getDroppableRef();E||ue();let w=Zje(E),S={ref:E,descriptor:s,env:w,scrollOptions:N};e.current=S;let T=rGe({ref:E,descriptor:s,env:w,windowScroll:C,direction:I.direction,isDropDisabled:I.isDropDisabled,isCombineEnabled:I.isCombineEnabled,shouldClipSubject:!I.ignoreContainerClipping}),A=w.closestScrollable;return A&&(A.setAttribute(qne.contextId,r.contextId),A.addEventListener("scroll",m,eie(S.scrollOptions))),T},[r.contextId,s,m,a]),g=Xe(()=>{let C=e.current,N=JC(C);return C&&N||ue(),tF(N)},[]),_=Xe(()=>{let C=e.current;C||ue();let N=JC(C);e.current=null,N&&(f.cancel(),N.removeAttribute(qne.contextId),N.removeEventListener("scroll",m,eie(C.scrollOptions)))},[m,f]),b=Xe(C=>{let N=e.current;N||ue();let I=JC(N);I||ue(),I.scrollTop+=C.y,I.scrollLeft+=C.x},[]),y=Wt(()=>({getDimensionAndWatchScroll:h,getScrollWhileDragging:g,dragStopped:_,scroll:b}),[_,h,g,b]),v=Wt(()=>({uniqueId:o,descriptor:s,callbacks:y}),[y,s,o]);la(()=>(l.current=v.descriptor,n.droppable.register(v),()=>{e.current&&_(),n.droppable.unregister(v)}),[y,s,_,v,i,n.droppable]),la(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),la(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function G2(){}var tie={width:0,height:0,margin:iHe},aGe=({isAnimatingOpenOnMount:t,placeholder:e,animate:r})=>t||r==="close"?tie:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},sGe=({isAnimatingOpenOnMount:t,placeholder:e,animate:r})=>{let o=aGe({isAnimatingOpenOnMount:t,placeholder:e,animate:r});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?cy.placeholder:null}},lGe=t=>{let e=W(null),r=Xe(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:n,onClose:i,contextId:a}=t,[s,l]=M(t.animate==="open");V(()=>s?o!=="open"?(r(),l(!1),G2):e.current?G2:(e.current=setTimeout(()=>{e.current=null,l(!1)}),r):G2,[o,s,r]);let c=Xe(d=>{d.propertyName==="height"&&(n(),o==="close"&&i())},[o,i,n]),u=sGe({isAnimatingOpenOnMount:s,animate:t.animate,placeholder:t.placeholder});return D.createElement(t.placeholder.tagName,{style:u,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:t.innerRef})},cGe=D.memo(lGe);function W2(t){return typeof t=="boolean"}function q2(t,e){e.forEach(r=>r(t))}var uGe=[function({props:e}){e.droppableId||ue(),typeof e.droppableId!="string"&&ue()},function({props:e}){W2(e.isDropDisabled)||ue(),W2(e.isCombineEnabled)||ue(),W2(e.ignoreContainerClipping)||ue()},function({getDroppableRef:e}){Xie(e())}],dGe=[function({props:e,getPlaceholderRef:r}){!e.placeholder||r()}],fGe=[function({props:e}){e.renderClone||ue()},function({getPlaceholderRef:e}){e()&&ue()}];function pGe(t){Iy(()=>{q2(t,uGe),t.props.mode==="standard"&&q2(t,dGe),t.props.mode==="virtual"&&q2(t,fGe)})}var rF=class extends D.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,r){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},mGe=t=>{let e=lt(aT);e||ue();let{contextId:r,isMovementAllowed:o}=e,n=W(null),i=W(null),{children:a,droppableId:s,type:l,mode:c,direction:u,ignoreContainerClipping:d,isDropDisabled:f,isCombineEnabled:m,snapshot:h,useClone:g,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=Xe(()=>n.current,[]),v=Xe((R=null)=>{n.current=R},[]),C=Xe(()=>i.current,[]),N=Xe((R=null)=>{i.current=R},[]);pGe({props:t,getDroppableRef:y,getPlaceholderRef:C});let I=Xe(()=>{o()&&_({maxScroll:Lie()})},[o,_]);iGe({droppableId:s,type:l,mode:c,direction:u,isDropDisabled:f,isCombineEnabled:m,ignoreContainerClipping:d,getDroppableRef:y});let E=Wt(()=>D.createElement(rF,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:R,data:P,animate:B})=>D.createElement(cGe,{placeholder:P,onClose:R,innerRef:N,animate:B,contextId:r,onTransitionEnd:I})),[r,I,t.placeholder,t.shouldAnimatePlaceholder,N]),w=Wt(()=>({innerRef:v,placeholder:E,droppableProps:{"data-rfd-droppable-id":s,"data-rfd-droppable-context-id":r}}),[r,s,E,v]),S=g?g.dragging.draggableId:null,T=Wt(()=>({droppableId:s,type:l,isUsingCloneFor:S}),[s,S,l]);function A(){if(!g)return null;let{dragging:R,render:P}=g,B=D.createElement(eae,{draggableId:R.draggableId,index:R.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},($,z)=>P($,z,R));return D.createPortal(B,b())}return D.createElement(vF.Provider,{value:T},a(w,h),A())};function hGe(){return document.body||ue(),document.body}var rie={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:hGe},nae=t=>{let e={...t},r;for(r in rie)t[r]===void 0&&(e={...e,[r]:rie[r]});return e},K2=(t,e)=>t===e.droppable.type,oie=(t,e)=>e.draggables[t.draggable.id],gGe=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},r=en(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=en((i,a,s,l,c,u)=>{let d=c.descriptor.id;if(c.descriptor.droppableId===i){let h=u?{render:u,dragging:r(c.descriptor)}:null,g={isDraggingOver:s,draggingOverWith:s?d:null,draggingFromThisWith:d,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:g,useClone:h}}if(!a)return e;if(!l)return t;let m={isDraggingOver:s,draggingOverWith:d,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:m,useClone:null}});return(i,a)=>{let s=nae(a),l=s.droppableId,c=s.type,u=!s.isDropDisabled,d=s.renderClone;if(gy(i)){let f=i.critical;if(!K2(c,f))return e;let m=oie(f,i.dimensions),h=sa(i.impact)===l;return o(l,u,h,h,m,d)}if(i.phase==="DROP_ANIMATING"){let f=i.completed;if(!K2(c,f.critical))return e;let m=oie(f.critical,i.dimensions);return o(l,u,Qie(f.result)===l,sa(f.impact)===l,m,d)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let f=i.completed;if(!K2(c,f.critical))return e;let m=sa(f.impact)===l,h=!!(f.impact.at&&f.impact.at.type==="COMBINE"),g=f.critical.droppable.id===l;return m?h?t:e:g?t:e}return e}},_Ge={updateViewportMaxScroll:_8e},uT=R2(gGe,_Ge,(t,e,r)=>({...nae(r),...t,...e}),{context:_F,areStatePropsEqual:Jie})(mGe);xo();Pe();xo();Pe();function iae(){return new URLSearchParams(window.location.search).get("deeplink")||""}var aae=ft(null);function sae(t){let[e,r]=M(iae()),o={value:e,setValue:r};return V(()=>{let n=()=>{r(iae())};return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)},[]),V(()=>{let n=i=>{let a=i.data;if(a.scrollToDeeplink){let s=a.scrollToDeeplink.deepKey,l=document.getElementById(s);if(l){r(s),wF(l,{behavior:"smooth",force:!0});let c=new URL(window.location.href);c.searchParams.set("deeplink",s),window.history.replaceState({},"",c.toString())}}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[]),p(aae.Provider,{value:o,children:t.children})}function wy(){let t=lt(aae);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function xGe(t){let e=t;for(;e&&e!==document.body;){let r=e.closest("details");if(r&&r.parentElement)r.open=!0,e=r.parentElement;else break}}function bGe(t){let e=[],r=t;for(;r&&r!==document.body;){let o=r.closest(".DocEditor__ArrayField__item");if(!o)break;let n=o.querySelector(".DocEditor__ArrayField__item__header");if(n&&!e.includes(n))e.push(n),r=o.parentElement;else break}return e}function wF(t,e={behavior:"auto"}){setTimeout(()=>{let r=document.querySelector(".DocumentPage__side");if(!r||r.scrollTop>0&&!e.force)return;xGe(t);let n=bGe(t).reduce((a,s)=>a+s.offsetHeight,0),i=t.offsetTop-n;r.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function lae(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}xo();Pe();function dT(t,e){let r;return(...o)=>{window.clearTimeout(r),r=window.setTimeout(()=>{t(...o)},e)}}var cl=class{constructor(){this.events=new Map}on(e,r){let o=ra(6),n=this.events.get(e);return n||(n=new Map,this.events.set(e,n)),n.set(o,r),()=>{this.off(e,o)}}off(e,r){let o=this.events.get(e);o&&(o.delete(r),o.size===0&&this.events.delete(e))}dispatch(e,...r){let o=this.events.get(e);o&&o.forEach(n=>n(...r))}dispose(){this.events.clear()}};var fT=class{constructor(){this.subscribers=new Set;this.children=new Map}},pT=class extends cl{constructor(r){super();this.root=new fT;this.data=r||{}}get(r){return this.getValueFromPath(r,this.data)}set(r,o){if(r===""){La(o)&&this.setData(o);return}this.update({[r]:o})}update(r){let o=new Set,n=(i,a,s)=>{o.add({path:i,value:s}),La(a)&&La(s)&&(Object.entries(s).forEach(([l,c])=>{let u=a[l];qb(u,c)||n(`${i}.${l}`,u,c)}),Object.keys(a).forEach(l=>{l in s||n(`${i}.${l}`,a[l],void 0)}))};Object.entries(r).forEach(([i,a])=>{let s=this.data,l=i.split("."),c=l.pop();for(let d of l)s[d]||(s[d]={}),s=s[d];let u=s[c];s[c]=a,this.dispatch("VALUE_CHANGE",i,a),n(i,u,a)}),o.forEach(i=>{let a=this.getTrieNode(i.path);a&&a.subscribers.size>0&&a.subscribers.forEach(s=>s(i.value))}),this.dispatch("CHANGE",this.data)}setData(r){let o=this.data;this.notifyOnUpdate(this.root,"",o,r),this.data=r,this.dispatch("CHANGE",this.data)}subscribe(r,o){let n=this.getTrieNode(r,!0);return n.subscribers.add(o),window.setTimeout(()=>{let i=this.get(r);i!==void 0&&o(i)}),()=>{n.subscribers.delete(o)}}getDataSnapshot(){return this.data}dispose(){super.dispose(),this.data={},this.root.subscribers.clear(),this.root.children.clear()}notifyOnUpdate(r,o,n,i){let a=this.getValueFromPath(o,n),s=this.getValueFromPath(o,i);qb(a,s)||r.subscribers.forEach(l=>l(s)),r.children.forEach((l,c)=>{let u=o?`${o}.${c}`:c;this.notifyOnUpdate(l,u,n,i)})}getValueFromPath(r,o){if(!r)return o;let n=r.split("."),i=o;for(let a of n){if(i===null||typeof i!="object"||!(a in i))return;i=i[a]}return i}getTrieNode(r,o=!1){if(!r)return this.root;let n=r.split("."),i=this.root;for(let a of n){if(!i.children.has(a))if(o)i.children.set(a,new fT);else return;i=i.children.get(a)}return i}};var cae=3*No.second,yGe=5*No.minute;var vGe=30*No.second,EF=class extends cl{constructor(r){super();this.pendingUpdates=new Map;this.saveState="NO_CHANGES";this.autolock=!1;this.autolockReason="autolock";this.autolockApplied=!1;this.started=!1;this.queueChanges=dT(()=>this.flush(),cae);this.projectId=window.__ROOT_CTX.rootConfig.projectId;let[o,n]=r.split("/");this.docId=r,this.collectionId=o,this.slug=n,this.db=window.firebase.db,this.docRef=$e(this.db,"Projects",this.projectId,"Collections",o,"Drafts",n),this.store=new pT({id:this.docId,collection:this.collectionId,slug:this.slug,sys:{}}),this.store.on("CHANGE",a=>{this.dispatch("CHANGE",a)}),this.store.on("VALUE_CHANGE",(a,s)=>{this.dispatch("VALUE_CHANGE",a,s)});let i=window.__ROOT_CTX.collections[o];i&&(this.autolock=!!i.autolock,i.autolockReason&&(this.autolockReason=i.autolockReason))}async start(){this.started||(this.started=!0,this.dbUnsubscribe=bu(this.docRef,r=>{if(r.metadata.hasPendingWrites)return;let o=r.data()||{};this.pendingUpdates.size>0&&uae(o,Object.fromEntries(this.pendingUpdates)),this.store.setData(o)}))}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.flush(),this.started=!1)}onChange(r){return this.on("CHANGE",r)}onSaveStateChange(r){return this.on("SAVE_STATE_CHANGE",r)}onFlush(r){return this.on("FLUSH",r)}subscribe(r,o){return this.store.subscribe(r,o)}getData(){return this.store.getDataSnapshot()}getValue(r){return this.store.get(r)}async updateKey(r,o){this.pendingUpdates.set(r,o),this.store.set(r,o),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}async updateKeys(r){for(let o in r){let n=r[o];n==null?this.pendingUpdates.set(o,$o()):this.pendingUpdates.set(o,n)}this.store.update(r),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}async removeKey(r){this.pendingUpdates.set(r,$o()),this.store.set(r,void 0),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}setSaveState(r){let o=this.saveState;r==="SAVED"&&o!=="SAVING"||(this.saveState=r,r==="SAVED"&&window.setTimeout(()=>{this.saveState==="SAVED"&&this.setSaveState("NO_CHANGES")},cae),this.dispatch("SAVE_STATE_CHANGE",r))}removePublishingLock(){this.autolockApplied=!0,this.removeKey("sys.publishingLocked"),this.flush()}async flush(){if(this.pendingUpdates.size===0)return;let r=Object.fromEntries(this.pendingUpdates);r["sys.modifiedAt"]=Cr(),r["sys.modifiedBy"]=window.firebase.user.email,this.autolock&&!this.autolockApplied&&!this.store.get("sys.publishingLocked")&&(this.autolockApplied=!0,r["sys.publishingLocked"]={lockedAt:Cr(),lockedBy:window.firebase.user.email,reason:this.autolockReason}),this.pendingUpdates.clear();try{this.setSaveState("SAVING"),await Mr(this.docRef,r),this.setSaveState("SAVED"),this.dispatch("FLUSH"),Ot("doc.save",{metadata:{docId:this.docId},throttle:yGe,throttleId:this.docId})}catch(o){console.error("failed to update doc"),console.error(o),this.setSaveState("ERROR"),Ae({title:"Failed to save",message:`Failed to save changes to ${this.slug}`,color:"red",autoClose:!1});for(let n in r)n.startsWith("sys.")||this.pendingUpdates.has(n)||(this.pendingUpdates.set(n,r[n]),this.queueChanges(),console.log("re-queued updates"))}}getLocales(){let r=this.store.get("sys.locales");return r||["en"]}setLocales(r){this.updateKey("sys.locales",r)}async dispose(){super.dispose(),this.stop()}};function uae(t,e){for(let r in e){let o=e[r];if(r.includes(".")){let[n,i]=IGe(r);t[n]??={},uae(t[n],{[i]:o})}else typeof o>"u"?delete t[r]:t[r]=o}}function IGe(t){let e=t.indexOf("."),r=t.substring(0,e),o=t.substring(e+1);return[r,o]}var dae=ft(null);function fae(t){let[e,r]=M(!0),o=ve(()=>new EF(t.docId),[t.docId]);return V(()=>(r(!0),o.onChange(n=>{r(!1),Mb(n.id,n)}),o.start(),()=>o.dispose()),[o]),V(()=>{let n=()=>{let i;document.hidden||document.visibilityState!=="visible"?i=window.setTimeout(()=>{o.stop()},vGe):(i&&(clearTimeout(i),i=void 0),o.started||(r(!0),o.start()))};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[o]),p(dae.Provider,{value:{loading:e,controller:o},children:t.children})}function Wn(){let t=lt(dae);if(!t)throw new Error("useDraftDoc() should be used within a <DraftDocProvider>");return t}function pae(t){let{controller:e}=Wn();V(()=>e.onSaveStateChange(t),[e])}function ul(t,e){let{controller:r}=Wn();V(()=>r.subscribe(t,e),[r])}function rn(t,e){let{controller:r}=Wn(),[o,n]=M(r.getValue(t)??e);return V(()=>r.subscribe(t,a=>{n(a)}),[r]),[o,a=>{n(a),a==null?r.removeKey(t):r.updateKey(t,a)}]}var wGe={get:async()=>{try{let t=await EGe();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function mae(){return wGe}async function EGe(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function Va(t,e){if(!CGe())return;let r=SGe();r&&r.contentWindow?.postMessage({highlightNode:{deepKey:t,options:e}},"*")}function SGe(){return document.querySelector('iframe[title="iframe preview"]')}function CGe(){let t=window.__ROOT_CTX.preview;return[!0,"to-preview"].includes(t.channel)}function hae(t,e){return t.replace(/\{(.+?)\}/g,(r,o)=>{let n=e(o);return n??r})}function Zh(t,e,r={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!hh(e);case"object":if(!La(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!Zh(o,e[o.id],r))return!1;return!0;case"array":if(!La(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!Zh(t.of,e[o],r))return!1;return!1;case"oneof":{if(!La(e)||!e._type)return!0;let o,n=t.types||[];if(typeof n[0]=="string"?n.includes(e._type)&&(o=r[e._type]):o=n.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!Zh(i,e[i.id],r))return!1;return!0}default:return!1}}Pe();function gae(t,e){let r=!1;return(...o)=>{r||(t(...o),r=!0,setTimeout(()=>{r=!1},e))}}var Ey=class extends cl{constructor(r){super();this.interval=0;this.timeout=0;this.interval=r}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var TGe=60*No.second,_ae=5*No.minute,SF=class extends cl{constructor(r){super();this.started=!1;this.timer=new Ey(TGe);this.idleTimer=new Ey(_ae);this.onUserInteraction=gae(()=>{this.idleTimer.reset()},5e3);this.id=r;let o=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db;this.docRef=$e(n,"Projects",o,"Viewers",r),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=bu(this.docRef,r=>{let o=r.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(r){let o=window.firebase.user,n=Tt.now(),i=Object.values(r).filter(a=>!(a.email===o.email||n.toMillis()-a.lastViewedAt.toMillis()>_ae));this.dispatch("change",i)}async onTick(){let r=window.firebase.user;if(!r.email){console.log("no user email:",r);return}await xu(this.docRef,{[r.email]:{email:r.email,photoURL:r.photoURL,lastViewedAt:Cr()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let r=window.firebase.user;if(!r.email){console.log("no user email:",r);return}let o=new Pn(r.email,"disconnectedAt");await Mr(this.docRef,o,Cr())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function xae(t){let e=Ou(t.id),[r,o]=M([]);if(V(()=>{let i=new SF(e);i.on("change",s=>o(s)),i.start();let a=()=>{document.hidden||document.visibilityState!=="visible"?i.stop():i.started||i.start()};return document.addEventListener("visibilitychange",a),()=>{i.dispose(),document.removeEventListener("visibilitychange",a)}},[e]),r.length===0)return null;function n(i){return i.disconnectedAt?i.disconnectedAt>i.lastViewedAt:!1}return p(Sw,{className:"Viewers",limit:3,size:30,children:r.map(i=>{if(!i.photoURL){let a=i.email[0].toUpperCase();return p(Ca,{alt:i.email,size:24,radius:"xl",children:a})}return p(Ca,{className:De("Viewers__viewer",n(i)&&"Viewers__viewer--disconnected"),src:i.photoURL,alt:i.email,size:24,radius:"xl"},i.email)})})}function bae(t){let r=t.field.checkboxLabel||"Enabled",[o,n]=rn(t.deepKey,!1);return p("div",{className:"DocEditor__BooleanField",children:p(Xc,{label:r,onChange:i=>{let a=i.currentTarget;n(a.checked)},checked:o,size:"xs"})})}function yae(t){let[e,r]=rn(t.deepKey);return p("div",{className:"DocEditor__DateField",children:p("input",{type:"date",value:e||"",onChange:o=>{let n=o.currentTarget;r(n.value||null)}})})}Pe();function vae(t){let[e,r]=rn(t.deepKey),o=ve(()=>e?kGe(e):"",[e]),n=i=>{if(i){let a=Math.floor(new Date(i).getTime()),s=Tt.fromMillis(a);r(s)}else r(null)};return p("div",{className:"DocEditor__DateTimeField",children:[p("input",{type:"datetime-local",value:o,onChange:i=>{let s=i.target.value;n(s)}}),p("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})}function kGe(t){try{let e=t.toDate();return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e.toISOString().slice(0,16)}catch{return console.error("failed to parse date: ",t),""}}xo();Rl();Pe();var NGe=["image/gif","image/jpeg","image/png","image/svg+xml","image/webp"],PGe=["#25262b","#868e96","#fa5252","#e64980","#be4bdb","#7950f2","#4c6ef5","#228be6","#15aabf","#12b886","#40c057","#82c91e","#fab005","#fd7e14"],Iae=ft(null);function Sy(){let t=lt(Iae);if(!t)throw new Error("useFileField() should be called within a <FileFieldContext.Provider>");return t}function fi(t){let e=t.field,r=dr(),o=W(null),[n,i]=M(!1),[a,s]=rn(t.deepKey),[l,c]=M(null),u=e.exts??(t.variant==="image"?NGe:[]),d=a?.alt||"",f=e.alt!==!1;async function m(I){try{c("loading");let E=await Pu(I,{preserveFilename:e.preserveFilename,cacheControl:e.cacheControl});!E.alt&&CF(E.filename)&&d&&(E.alt=d),s(E),c("complete")}catch(E){console.error("upload failed"),console.error(E),c("error"),Ae({title:"Upload failed",message:"Failed to upload: "+String(E),color:"red",autoClose:!1})}}function h(){s(null)}function g(I,E){if(!I)return;E?.as==="svg"&&(I=new File([new Blob([I],{type:"image/svg+xml"})],"untitled.svg",{type:"image/svg+xml"})),I=I;let w=Ch(I.name);if(u.length>0&&!u.some(S=>S.endsWith(w)||S===`*/${w}`||S==="*/*"||S===I.type)){Ae({title:"Invalid file type",message:`File type ${w} is not allowed.`,color:"red",autoClose:!0});return}m(I)}function _(){o.current?.focus()}function b(){if(a?.src)if(rC(a.src)){let I=document.createElement("a");I.href=Lte(a.src),a.filename&&(I.download=a.filename),document.body.appendChild(I),I.click(),document.body.removeChild(I)}else window.open(a.src,"_blank")}function y(){let I=document.createElement("input");I.type="file",u.length>0&&(I.accept=u.join(",")),I.onchange=E=>{let w=E.target;w.files&&w.files.length>0&&g(w.files[0])},I.click(),I.remove()}function v(){i(!0)}function C(I){a?.src&&s({...a,alt:I||""})}async function N(I){let E=a;if(!E?.src||!I)return;c("loading");let w=await I.sendPrompt(I.addMessage({sender:"user",blocks:[{type:"image",image:{src:E.src}}]}),[{text:"Generate alt text for the image above."},{media:{url:E.src}}],{mode:"altText"});w?.error?Ae({title:"Sorry, something went wrong.",message:w.error,color:"red",autoClose:!0}):w?.message&&C(w.message),c("complete")}return p(Iae.Provider,{value:{field:e,variant:t.variant,value:a,setValue:s,loadingState:l,removeFile:h,acceptedFileTypes:u,handleFile:g,focusDropZone:_,requestGenerateAltText:N,requestFileUpload:y,requestFileDownload:b,requestPlaceholderModalOpen:v,showAltText:f,altText:d,setAltText:C},children:[p(eu,{size:"sm",opened:n,onClose:()=>i(!1),title:"Placeholder image",centered:!0,overlayColor:r.colorScheme==="dark"?r.colors.dark[9]:r.colors.gray[2],children:p("form",{onSubmit:I=>{I.preventDefault();let E=new FormData(I.currentTarget),w=parseInt(E.get("width"),10),S=parseInt(E.get("height"),10),T=E.get("backgroundColor"),A=E.get("label")||`${w}x${S}`,R=`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${S}" viewBox="0 0 ${w} ${S}"><rect width="${w}" height="${S}" fill="${T}" />`;if(A){let Y=w*.5/(A.length*.6);R+=`<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-size="${Y}" fill="#fff">${A}</text>`}R+="</svg>";let B=new TextEncoder().encode(R),z={src:`data:image/svg+xml;base64,${btoa(String.fromCharCode(...B))}`,filename:"placeholder.svg",width:w,height:S,alt:""};s(z),i(!1)},children:[p(tu,{gap:"xs",children:[p(ir,{label:"Width",name:"width",type:"number",defaultValue:1600,"data-autofocus":!0}),p(ir,{label:"Height",name:"height",type:"number",defaultValue:900}),p(ir,{name:"label",label:"Label",defaultValue:"",autofocus:!0}),p(Uw,{name:"backgroundColor",label:"Background color",format:"hex",defaultValue:"#868e96",swatches:PGe})]}),p("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"1rem"},children:p(re,{variant:"filled",type:"submit",children:"Create"})})]})}),p("div",{className:"FileField",children:[p(fi.Dropzone,{ref:o}),a?.src?p(fi.Preview,{}):p(fi.InvisibleDropzone,{children:p(fi.Empty,{})})]})]})}fi.Preview=()=>{let t=Sy(),[e,r]=M(!1),[o,n]=M(!1),i=Wb(),a=window.__ROOT_CTX.experiments||{},s=CF(t.value?.filename),[l,c]=M(!s);return t.value?.src?p("div",{className:"FileField__Preview",children:[p("div",{className:"FileField__Preview__InfoButton",children:[s&&p(Se,{label:"Toggle file info",position:"top",withArrow:!0,children:p(Je,{onClick:()=>c(u=>!u),size:"sm",variant:"outline",className:"FileField__Preview__InfoButton__Icon",children:p(bM,{size:16})})}),p(je,{className:"FileField__Preview__Menu",shadow:"sm",withinPortal:!1,closeOnItemClick:!1,control:p(Je,{variant:"outline",size:"sm",radius:"sm",c:"black",className:"FileField__Preview__InfoButton__Icon",children:p(bf,{size:16})}),children:[p(je.Label,{size:"sm",children:"REPLACE"}),p(je.Item,{icon:t.variant==="image"?p(xS,{size:16}):p(ol,{size:16}),onClick:()=>t.requestFileUpload(),children:["Upload ",t.variant==="image"?"image":"file"]}),wae(t.acceptedFileTypes)&&p(je.Item,{disabled:!t.value?.src,icon:p(_S,{size:16}),onClick:()=>{t.requestPlaceholderModalOpen()},children:"Placeholder image"}),p(Ea,{}),p(je.Item,{disabled:t.value?.src?.startsWith("data:"),onClick:()=>{t?.requestFileDownload()},icon:p(dM,{size:16}),children:"Download file"}),p(je.Item,{closeOnItemClick:!1,icon:p(nc,{size:16}),onClick:()=>{n(!1),navigator.clipboard.writeText(t.value?.src||"").then(()=>n(!0)).finally(()=>setTimeout(()=>{n(!1)},2e3))},children:o?"Copied!":"Copy URL"}),p(Ea,{}),p(je.Item,{color:"red",onClick:()=>{t?.removeFile()},icon:p(Hn,{size:16}),children:"Remove file"})]})]}),p("div",{className:De("FileField__Canvas",l&&"FileField__Canvas--infoOpened",e&&"dragging"),style:OGe(t.value),onDragOver:u=>{u.preventDefault(),r(!0)},onDragLeave:u=>{u.preventDefault(),r(!1)},onDrop:u=>{u.preventDefault(),r(!1);let d=u.dataTransfer?.files[0];d&&t&&t.handleFile(d)},onPaste:u=>{u.preventDefault();let d=u.clipboardData?.files[0];if(d){t.handleFile(d);return}let f=u.clipboardData?.getData("text/plain");if(f&&Eae(f)){t.handleFile(f,{as:"svg"});return}},children:[p(ka,{visible:t.loadingState==="loading"}),l?p("div",{className:"FileField__Canvas__Info",children:[p(Tb,{size:16,className:"FileField__Canvas__Info__Icon"}),p(fo,{className:"FileField__Canvas__InfoTable",verticalSpacing:"xs",fontSize:"xs",children:p("tbody",{children:[t.value?.filename&&p("tr",{children:[p("td",{children:p("b",{children:"Name"})}),p("td",{children:t.value.filename})]}),t.value?.uploadedAt&&p("tr",{children:[p("td",{children:p("b",{children:"Uploaded"})}),p("td",{children:[new Date(parseInt(t.value.uploadedAt,10)).toLocaleString(),t.value.uploadedBy&&p(Te,{children:[" by ",t.value.uploadedBy]})]})]}),t.value?.width&&t.value?.height&&p("tr",{children:[p("td",{children:p("b",{children:"Dimensions"})}),p("td",{children:[t.value.width,"x",t.value.height]})]}),p("tr",{children:[p("td",{children:p("b",{children:"URL"})}),p("td",{children:p(yr,{readOnly:!0,value:t.value?.src,size:"xs",radius:0})})]})]})})]}):p(Te,{children:[t.value?.width&&t.value?.height&&p(_e,{radius:"sm",className:"FileField__Preview__Info",children:[t.value.width,"x",t.value.height]}),$L(t.value?.src)&&p("img",{onClick:()=>{t?.focusDropZone()},onDblClick:()=>{t?.requestFileUpload()},src:t.value.src,alt:t.value.alt||"Uploaded file preview",className:"FileField__Preview__Image"}),zL(t.value?.src)&&p(Te,{children:p("video",{className:"FileField__Preview__Image",controls:!0,muted:!0,preload:"metadata",children:p("source",{src:t.value.src,type:`video/${Ch(t.value.src)}`})})})]}),p("div",{className:"FileField__reupload",children:p(fi.UploadButton,{className:"FileField__reupload__button",compact:!0})})]}),t.showAltText&&(t.altText||CF(t.value?.filename)||t.variant==="image")&&p("div",{className:"DocEditor__ImageField__imagePreview__Image__Alt",children:[p(yr,{radius:0,className:"DocEditor__ImageField__imagePreview__Image__Alt__Textarea",value:t.altText,placeholder:"Alt text",size:"xs",autosize:!0,disabled:t.loadingState==="loading",onChange:u=>{t?.setAltText(u.currentTarget.value)}}),a.ai&&!t.altText&&t.value?.src?.startsWith("http")&&p(Se,{label:"Generate alt text with AI",position:"top",withArrow:!0,children:p(Je,{className:"DocEditor__ImageField__imagePreview__Image__Alt__AiButton",onClick:()=>{t.requestGenerateAltText(i)},disabled:t.loadingState==="loading",children:p(kb,{size:20,stroke:"1.75"})})})]})]}):null};fi.UploadButton=t=>{let e=Sy(),r=e.loadingState==="loading",o=t.compact?14:16;return p(re,{color:"black",variant:"default",disabled:r,size:t.compact?"compact-xs":"compact-md",className:De("FileField__FileUploadButton",t.compact&&"FileField__FileUploadButton--compact"),onClick:()=>{e.requestFileUpload()},leftIcon:p(Te,{children:r&&!t.compact?p(Ze,{size:o}):e?.variant==="image"?p(xS,{size:o}):p(ol,{size:o})}),children:r&&!t.compact?"Uploading...":e.value?.src?"Upload":"Paste, drop, or click to upload"})};fi.InvisibleDropzone=t=>{let[e,r]=M(!1),o=Sy();return p("div",{className:De("FileField__InvisibleDropzone",e&&"dragging"),onDragOver:n=>{n.preventDefault(),n.stopPropagation(),r(!0)},onDragLeave:n=>{n.preventDefault(),n.stopPropagation(),r(!1)},onDrop:n=>{n.preventDefault(),n.stopPropagation(),r(!1);let i=n.dataTransfer?.files[0];i&&o.handleFile(i)},children:t.children})};fi.Empty=()=>{let t=Sy(),e=ve(()=>t.acceptedFileTypes.length===0?"":t.acceptedFileTypes.map(r=>r.split("/").pop().split("+")[0].replaceAll(".","")).sort().join(", "),[t.acceptedFileTypes]);return p("div",{className:"FileField__Empty",children:[p("div",{className:"FileField__Empty__Label",children:[p(fi.UploadButton,{}),wae(t.acceptedFileTypes)&&p("div",{children:p(Se,{label:"Create placeholder image",children:p(Je,{className:"FileField__Empty__Label__PlaceholderButton",onClick:()=>{t.requestPlaceholderModalOpen()},title:"Create placeholder image",children:p(_S,{size:16})})})})]}),e&&p("div",{children:p("div",{className:"FileField__Empty__AcceptTypes",children:["Allowed file types: ",e]})})]})};fi.Dropzone=ee((t,e)=>{let[r,o]=M(!1),n=Sy();return p("button",{ref:e,className:De("FileField__Dropzone",r&&"dragging"),onDblClick:()=>{n?.requestFileUpload()},onCopy:i=>{n.value?.src&&(i.preventDefault(),i.clipboardData?.setData("text/plain",n.value.src),i.clipboardData?.setData("application/json",JSON.stringify(n.value)))},onKeyDown:i=>{((i.metaKey||i.ctrlKey)&&i.key==="Backspace"||i.key==="Delete")&&(i.preventDefault(),n.value?.src&&n.removeFile())},onDragOver:i=>{i.preventDefault(),o(!0)},onDragLeave:i=>{i.preventDefault(),o(!1)},onDrop:i=>{i.preventDefault(),o(!1);let a=i.dataTransfer?.files[0];a&&n&&n.handleFile(a)},onPaste:i=>{if(i.preventDefault(),!n)return;let a=i.clipboardData?.getData("application/json");if(a)try{let c=JSON.parse(a);if(c&&c.src&&c.filename&&n){console.log("Parsed JSON file:",c),n.setValue(c);return}}catch(c){console.error("error parsing json",c)}let s=i.clipboardData?.files[0];if(s){n.handleFile(s);return}let l=i.clipboardData?.getData("text/plain");if(l&&Eae(l)){n.handleFile(l,{as:"svg"});return}},title:"Drop or paste to upload a file"})});function CF(t){return t?$L(t)||zL(t):!1}function wae(t){return t.some(e=>e.startsWith("image/"))||t.length===0}function OGe(t){let e={};if(t.width&&t.height){e["--canvas-aspect-ratio"]=`${t.width} / ${t.height}`,e["--canvas-asset-width"]=`${t.width}px`;let r=Math.min(t.height,280);r<80&&(r=80),e["--canvas-max-height"]=`${r}px`}return t.canvasBgColor==="dark"&&(e["--canvas-bg-color"]="#000"),e}function Eae(t){return/^(?:\uFEFF)?\s*(?:<!--[\s\S]*?-->\s*)*(?:<\?xml[\s\S]*?\?>\s*)?(?:<!DOCTYPE\s+svg[\s\S]*?>\s*)?<svg\b[^>]*?(?:\/>|>[\s\S]*?<\/svg>)\s*$/.test(t)}function Sae(t){return p(fi,{...t,variant:"image"})}Pe();function Cae(t){let e=t.field,[r,o]=rn(t.deepKey,[]),n=ve(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return p("div",{className:"DocEditor__MultiSelectField",children:p(n0,{data:n,size:"xs",radius:0,placeholder:e.placeholder,value:r,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function Tae(t){let[e,r]=rn(t.deepKey,0);return p(c0,{size:"xs",radius:0,value:e,onChange:o=>r(o),hideControls:!0})}Pe();function eg(t){let e=t.field,[r,o]=rn(t.deepKey),n=r?.id||"";function i(l){o(l?NS(l):null)}let a=lre();function s(){let l=n?NS(n).collection:e.initialCollection;a.open({collections:e.collections,initialCollection:l,onChange:c=>{i(c),a.close()}})}return p("div",{className:"ReferenceField",children:[n?p("div",{className:"ReferenceField__ref",children:[p(eg.Preview,{id:n}),p("div",{className:"ReferenceField__remove",children:p(Se,{label:"Remove",children:p(Je,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:p(Hn,{size:16})})})})]}):p("div",{className:"ReferenceField__none",children:"None selected"}),p(re,{color:"dark",size:"xs",onClick:()=>s(),children:e.buttonLabel||"Select"})]})}eg.Preview=t=>{let[e,r]=M(!0),[o,n]=M(null);async function i(){r(!0),await er(async()=>{let a=await wS(t.id);n(a)}),r(!1)}return V(()=>{i()},[t.id]),p("div",{className:"ReferenceField__Preview",children:e?p("div",{className:"ReferenceField__Preview__loading",children:p(Ze,{color:"gray",size:"sm"})}):o?p(eg.DocCard,{doc:o}):p("div",{className:"ReferenceField__Preview__notfound",children:['Doc Not found: "',t.id,'" (was it deleted?). Select a new doc or remove using the trash icon to the right.']})})};eg.DocCard=t=>{let e=t.doc,r=e.id||e.sys?.id||"";if(!r)return p("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=NS(r).collection,n=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let a=Qo(n,i.preview?.title||"meta.title"),s=Qo(n,i.preview?.image||"meta.image")||i.preview?.defaultImage;return p("a",{className:"ReferenceField__DocCard",href:`/cms/content/${r}`,target:"_blank",children:[p("div",{className:"ReferenceField__DocCard__image",children:p(Qc,{src:s?.src,width:80,height:60,withPlaceholder:!s?.src})}),p("div",{className:"ReferenceField__DocCard__content",children:[p("div",{className:"ReferenceField__DocCard__content__header",children:p("div",{className:"ReferenceField__DocCard__content__header__docId",children:r})}),p("div",{className:"ReferenceField__DocCard__content__title",children:a||"[UNTITLED]"})]})]})};Pe();Pe();function tg(t){let e=t.docId,[r,o]=M(t.doc),[n,i]=M(!t.doc);async function a(){i(!0),await er(async()=>{let _=await wS(e);o(_)}),i(!1)}if(V(()=>{a()},[e]),n)return p("div",{className:De(t.className,"DocPreviewCard","DocPreviewCard--loading",t.variant&&`DocPreviewCard--${t.variant}`),children:p(Ze,{color:"gray",size:"sm"})});let[s,l]=e.split("/"),c=r.fields||{},u=window.__ROOT_CTX.collections[s];if(!u)throw new Error(`could not find collection: ${s}`);let d=Qo(c,u.preview?.title||"meta.title"),f=Qo(c,u.preview?.image||"meta.image")||u.preview?.defaultImage,m=fs({collectionId:s,slug:l}),h="div",g={};return t.clickable&&(h="a",g.href=`/cms/content/${t.docId}`,g.target="_blank"),p(h,{className:De(t.className,"DocPreviewCard",t.variant&&`DocPreviewCard--${t.variant}`),...g,children:[p("div",{className:"DocPreviewCard__image",children:p(Nh,{file:f,width:80,height:60,withPlaceholder:!f?.src})}),p("div",{className:"DocPreviewCard__content",children:[p("div",{className:"DocPreviewCard__content__header",children:[p("div",{className:"DocPreviewCard__content__header__docId",children:r.id}),t.statusBadges&&r&&p(Hh,{doc:r})]}),p("div",{className:"DocPreviewCard__content__title",children:d||"[UNTITLED]"}),t.variant!=="compact"&&m&&p("div",{className:"DocPreviewCard__content__url",children:m})]})]})}function kae(t){let e=t.field,[r,o]=M([]),n=Wn().controller;function i(c){if(c.length){let u=c.map(d=>{let[f,m]=d.split("/");return{id:d,collection:f,slug:m}});n.updateKey(t.deepKey,u)}else n.removeKey(t.deepKey);o(c)}ul(t.deepKey,c=>{Array.isArray(c)?o(c.map(u=>u.id)):o([])});let a=pC();function s(){a.open({collections:e.collections,initialCollection:e.initialCollection,selectedDocIds:r,onChange:(c,u)=>{o(d=>{let f=[...d];if(u)f.includes(c)||f.push(c);else{let m=f.indexOf(c);m>-1&&f.splice(m,1)}return i(f),f})}})}function l(c){let u=r.filter(d=>d!==c);i(u)}return p("div",{className:"ReferencesField",children:[r.length>0?p(lT,{onDragEnd:c=>{let{destination:u,source:d}=c;if(!u||u.index===d.index)return;let f=[...r],[m]=f.splice(d.index,1);f.splice(u.index,0,m),i(f)},children:p(uT,{droppableId:"ReferencesField__droppable",direction:"vertical",children:c=>p("div",{ref:c.innerRef,...c.droppableProps,className:"ReferencesField__refs",children:[r.map((u,d)=>p(cT,{draggableId:u,index:d,children:(f,m)=>p("div",{ref:f.innerRef,...f.draggableProps,className:De("ReferencesField__card",m.isDragging&&"ReferencesField__card--dragging"),children:[p("div",{className:"ReferencesField__card__handle",...f.dragHandleProps,children:p(vb,{size:16,stroke:"1.5"})}),p(tg,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0}),p("div",{className:"ReferencesField__card__controls",children:p(Se,{label:"Remove",children:p(Je,{className:"ReferencesField__card__controls__remove",onClick:()=>l(u),children:p(Hn,{size:16})})})})]})},u)),c.placeholder]})})}):p("div",{className:"ReferencesField__none",children:"None selected"}),p(re,{color:"dark",size:"xs",onClick:()=>s(),children:e.buttonLabel||"Select"})]})}Pe();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Ay=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $T(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function AGe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}),r}function TF(){}Object.assign(TF,{default:TF,register:TF,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;for(;--r>=0&&e.item(r)!==this;);return r>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(r=>{let o=r instanceof Node;e.appendChild(o?r:document.createTextNode(r))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,r=window.getComputedStyle(e,null),o=parseInt(r.getPropertyValue("border-top-width")),n=parseInt(r.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,a=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,s=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-n>e.scrollLeft+e.clientWidth,c=i&&!a;(i||a)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(s||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-n+this.clientWidth/2),(i||a||s||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var DGe=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),""),Vae=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(Vae||{}),Et={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},RGe={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function zy(t,e,r="log",o,n="color: inherit"){if(!("console"in window)||!window.console[r])return;let i=["info","log","warn","error"].includes(r),a=[];switch(zy.logLevel){case"ERROR":if(r!=="error")return;break;case"WARN":if(!["error","warn"].includes(r))return;break;case"INFO":if(!i||t)return;break}o&&a.push(o);let s="Editor.js 2.31.0-rc.7";t&&(i?(a.unshift(`line-height: 1em;
187
+ `}}];return{always:ay(a,"always"),resting:ay(a,"resting"),dragging:ay(a,"dragging"),dropAnimating:ay(a,"dropAnimating"),userCancel:ay(a,"userCancel")}},la=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ft:V,H2=()=>{let t=document.querySelector("head");return t||ue(),t},Kne=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function w7e(t,e){let r=Wt(()=>I7e(t),[t]),o=W(null),n=W(null),i=Xe(en(d=>{let f=n.current;f||ue(),f.textContent=d}),[]),a=Xe(d=>{let f=o.current;f||ue(),f.textContent=d},[]);la(()=>{!o.current&&!n.current||ue();let d=Kne(e),f=Kne(e);return o.current=d,n.current=f,d.setAttribute(`${Kh}-always`,t),f.setAttribute(`${Kh}-dynamic`,t),H2().appendChild(d),H2().appendChild(f),a(r.always),i(r.resting),()=>{let m=h=>{let g=h.current;g||ue(),H2().removeChild(g),h.current=null};m(o),m(n)}},[e,a,i,r.always,r.resting,t]);let s=Xe(()=>i(r.dragging),[i,r.dragging]),l=Xe(d=>{if(d==="DROP"){i(r.dropAnimating);return}i(r.userCancel)},[i,r.dropAnimating,r.userCancel]),c=Xe(()=>{n.current&&i(r.resting)},[i,r.resting]);return Wt(()=>({dragging:s,dropping:l,resting:c}),[s,l,c])}function Uie(t,e){return Array.from(t.querySelectorAll(e))}var Vie=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function vy(t){return t instanceof Vie(t).HTMLElement}function Hie(t,e){let r=`[${Yh.contextId}="${t}"]`,o=Uie(document,r);if(!o.length)return null;let n=o.find(i=>i.getAttribute(Yh.draggableId)===e);return!n||!vy(n)?null:n}function E7e(t){let e=W({}),r=W(null),o=W(null),n=W(!1),i=Xe(function(f,m){let h={id:f,focus:m};return e.current[f]=h,function(){let _=e.current;_[f]!==h&&delete _[f]}},[]),a=Xe(function(f){let m=Hie(t,f);m&&m!==document.activeElement&&m.focus()},[t]),s=Xe(function(f,m){r.current===f&&(r.current=m)},[]),l=Xe(function(){o.current||n.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let f=r.current;f&&a(f)}))},[a]),c=Xe(function(f){r.current=null;let m=document.activeElement;m&&m.getAttribute(Yh.draggableId)===f&&(r.current=f)},[]);return la(()=>(n.current=!0,function(){n.current=!1;let f=o.current;f&&cancelAnimationFrame(f)}),[]),Wt(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:s}),[i,c,l,s])}function S7e(){let t={draggables:{},droppables:{}},e=[];function r(d){return e.push(d),function(){let m=e.indexOf(d);m!==-1&&e.splice(m,1)}}function o(d){e.length&&e.forEach(f=>f(d))}function n(d){return t.draggables[d]||null}function i(d){let f=n(d);return f||ue(),f}let a={register:d=>{t.draggables[d.descriptor.id]=d,o({type:"ADDITION",value:d})},update:(d,f)=>{let m=t.draggables[f.descriptor.id];m&&m.uniqueId===d.uniqueId&&(delete t.draggables[f.descriptor.id],t.draggables[d.descriptor.id]=d)},unregister:d=>{let f=d.descriptor.id,m=n(f);m&&d.uniqueId===m.uniqueId&&(delete t.draggables[f],t.droppables[d.descriptor.droppableId]&&o({type:"REMOVAL",value:d}))},getById:i,findById:n,exists:d=>!!n(d),getAllByType:d=>Object.values(t.draggables).filter(f=>f.descriptor.type===d)};function s(d){return t.droppables[d]||null}function l(d){let f=s(d);return f||ue(),f}let c={register:d=>{t.droppables[d.descriptor.id]=d},unregister:d=>{let f=s(d.descriptor.id);f&&d.uniqueId===f.uniqueId&&delete t.droppables[d.descriptor.id]},getById:l,findById:s,exists:d=>!!s(d),getAllByType:d=>Object.values(t.droppables).filter(f=>f.descriptor.type===d)};function u(){t.draggables={},t.droppables={},e.length=0}return{draggable:a,droppable:c,subscribe:r,clean:u}}function C7e(){let t=Wt(S7e,[]);return V(()=>function(){t.clean()},[t]),t}var _F=D.createContext(null),hy=()=>{let t=document.body;return t||ue(),t},T7e={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},k7e=t=>`rfd-announcement-${t}`;function N7e(t){let e=Wt(()=>k7e(t),[t]),r=W(null);return V(function(){let i=document.createElement("div");return r.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),qc(i.style,T7e),hy().appendChild(i),function(){setTimeout(function(){let l=hy();l.contains(i)&&l.removeChild(i),i===r.current&&(r.current=null)})}},[e]),Xe(n=>{let i=r.current;if(i){i.textContent=n;return}},[])}var P7e={separator:"::"};function xF(t,e=P7e){let r=D.useId();return Wt(()=>`${t}${e.separator}${r}`,[e.separator,t,r])}function O7e({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function A7e({contextId:t,text:e}){let r=xF("hidden-text",{separator:"-"}),o=Wt(()=>O7e({contextId:t,uniqueId:r}),[r,t]);return V(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",hy().appendChild(i),function(){let s=hy();s.contains(i)&&s.removeChild(i)}},[o,e]),o}var aT=D.createContext(null),D7e={react:"^18.0.0 || ^19.0.0"},R7e=/(\d+)\.(\d+)\.(\d+)/,Yne=t=>{let e=R7e.exec(t);e==null&&ue();let r=Number(e[1]),o=Number(e[2]),n=Number(e[3]);return{major:r,minor:o,patch:n,raw:t}},M7e=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,L7e=(t,e)=>{let r=Yne(t),o=Yne(e);M7e(r,o)};var F7e=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function Iy(t,e){}function B7e(){Iy(()=>{L7e(D7e.react,D.version),F7e(document)},[])}function bF(t){let e=W(t);return V(()=>{e.current=t}),e}function $7e(){let t=null;function e(){return!!t}function r(a){return a===t}function o(a){t&&ue();let s={abandon:a};return t=s,s}function n(){t||ue(),t=null}function i(){t&&(t.abandon(),n())}return{isClaimed:e,isActive:r,claim:o,release:n,tryAbandon:i}}function gy(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var z7e=9,U7e=13,yF=27,jie=32,V7e=33,H7e=34,j7e=35,G7e=36,W7e=37,q7e=38,K7e=39,Y7e=40,X7e={[U7e]:!0,[z7e]:!0},Gie=t=>{X7e[t.keyCode]&&t.preventDefault()},sT=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),Wie=0,Xne=5;function J7e(t,e){return Math.abs(e.x-t.x)>=Xne||Math.abs(e.y-t.y)>=Xne}var Jne={type:"IDLE"};function Q7e({cancel:t,completed:e,getPhase:r,setPhase:o}){return[{eventName:"mousemove",fn:n=>{let{button:i,clientX:a,clientY:s}=n;if(i!==Wie)return;let l={x:a,y:s},c=r();if(c.type==="DRAGGING"){n.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&ue();let u=c.point;if(!J7e(u,l))return;n.preventDefault();let d=c.actions.fluidLift(l);o({type:"DRAGGING",actions:d})}},{eventName:"mouseup",fn:n=>{let i=r();if(i.type!=="DRAGGING"){t();return}n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:n=>{r().type==="DRAGGING"&&n.preventDefault(),t()}},{eventName:"keydown",fn:n=>{if(r().type==="PENDING"){t();return}if(n.keyCode===yF){n.preventDefault(),t();return}Gie(n)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:n=>{let i=r();if(i.type==="IDLE"&&ue(),i.actions.shouldRespectForcePress()){t();return}n.preventDefault()}},{eventName:sT,fn:t}]}function Z7e(t){let e=W(Jne),r=W(zu),o=Wt(()=>({eventName:"mousedown",fn:function(d){if(d.defaultPrevented||d.button!==Wie||d.ctrlKey||d.metaKey||d.shiftKey||d.altKey)return;let f=t.findClosestDraggableId(d);if(!f)return;let m=t.tryGetLock(f,a,{sourceEvent:d});if(!m)return;d.preventDefault();let h={x:d.clientX,y:d.clientY};r.current(),c(m,h)}}),[t]),n=Wt(()=>({eventName:"webkitmouseforcewillbegin",fn:u=>{if(u.defaultPrevented)return;let d=t.findClosestDraggableId(u);if(!d)return;let f=t.findOptionsForDraggable(d);f&&(f.shouldRespectForcePress||t.canGetLock(d)&&u.preventDefault())}}),[t]),i=Xe(function(){let d={passive:!1,capture:!0};r.current=za(window,[n,o],d)},[n,o]),a=Xe(()=>{e.current.type!=="IDLE"&&(e.current=Jne,r.current(),i())},[i]),s=Xe(()=>{let u=e.current;a(),u.type==="DRAGGING"&&u.actions.cancel({shouldBlockNextClick:!0}),u.type==="PENDING"&&u.actions.abort()},[a]),l=Xe(function(){let d={capture:!0,passive:!1},f=Q7e({cancel:s,completed:a,getPhase:()=>e.current,setPhase:m=>{e.current=m}});r.current=za(window,f,d)},[s,a]),c=Xe(function(d,f){e.current.type!=="IDLE"&&ue(),e.current={type:"PENDING",point:f,actions:d},l()},[l]);la(function(){return i(),function(){r.current()}},[i])}function eje(){}var tje={[H7e]:!0,[V7e]:!0,[G7e]:!0,[j7e]:!0};function rje(t,e){function r(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:n=>{if(n.keyCode===yF){n.preventDefault(),r();return}if(n.keyCode===jie){n.preventDefault(),o();return}if(n.keyCode===Y7e){n.preventDefault(),t.moveDown();return}if(n.keyCode===q7e){n.preventDefault(),t.moveUp();return}if(n.keyCode===K7e){n.preventDefault(),t.moveRight();return}if(n.keyCode===W7e){n.preventDefault(),t.moveLeft();return}if(tje[n.keyCode]){n.preventDefault();return}Gie(n)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:sT,fn:r}]}function oje(t){let e=W(eje),r=Wt(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==jie)return;let a=t.findClosestDraggableId(i);if(!a)return;let s=t.tryGetLock(a,u,{sourceEvent:i});if(!s)return;i.preventDefault();let l=!0,c=s.snapLift();e.current();function u(){l||ue(),l=!1,e.current(),o()}e.current=za(window,rje(c,u),{capture:!0,passive:!1})}}),[t]),o=Xe(function(){let i={passive:!1,capture:!0};e.current=za(window,[r],i)},[r]);la(function(){return o(),function(){e.current()}},[o])}var j2={type:"IDLE"},nje=120,ije=.15;function aje({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(e().type!=="DRAGGING"){t();return}r.keyCode===yF&&r.preventDefault(),t()}},{eventName:sT,fn:t}]}function sje({cancel:t,completed:e,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let n=r();if(n.type!=="DRAGGING"){t();return}n.hasMoved=!0;let{clientX:i,clientY:a}=o.touches[0],s={x:i,y:a};o.preventDefault(),n.actions.move(s)}},{eventName:"touchend",fn:o=>{let n=r();if(n.type!=="DRAGGING"){t();return}o.preventDefault(),n.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(r().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let n=r();n.type==="IDLE"&&ue();let i=o.touches[0];if(!i||!(i.force>=ije))return;let s=n.actions.shouldRespectForcePress();if(n.type==="PENDING"){s&&t();return}if(s){if(n.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:sT,fn:t}]}function lje(t){let e=W(j2),r=W(zu),o=Xe(function(){return e.current},[]),n=Xe(function(m){e.current=m},[]),i=Wt(()=>({eventName:"touchstart",fn:function(m){if(m.defaultPrevented)return;let h=t.findClosestDraggableId(m);if(!h)return;let g=t.tryGetLock(h,s,{sourceEvent:m});if(!g)return;let _=m.touches[0],{clientX:b,clientY:y}=_,v={x:b,y};r.current(),d(g,v)}}),[t]),a=Xe(function(){let m={capture:!0,passive:!1};r.current=za(window,[i],m)},[i]),s=Xe(()=>{let f=e.current;f.type!=="IDLE"&&(f.type==="PENDING"&&clearTimeout(f.longPressTimerId),n(j2),r.current(),a())},[a,n]),l=Xe(()=>{let f=e.current;s(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[s]),c=Xe(function(){let m={capture:!0,passive:!1},h={cancel:l,completed:s,getPhase:o},g=za(window,sje(h),m),_=za(window,aje(h),m);r.current=function(){g(),_()}},[l,o,s]),u=Xe(function(){let m=o();m.type!=="PENDING"&&ue();let h=m.actions.fluidLift(m.point);n({type:"DRAGGING",actions:h,hasMoved:!1})},[o,n]),d=Xe(function(m,h){o().type!=="IDLE"&&ue();let g=setTimeout(u,nje);n({type:"PENDING",point:h,actions:m,longPressTimerId:g}),c()},[c,o,n,u]);la(function(){return a(),function(){r.current();let h=o();h.type==="PENDING"&&(clearTimeout(h.longPressTimerId),n(j2))}},[o,a,n]),la(function(){return za(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function cje(t){}var uje=["input","button","textarea","select","option","optgroup","video","audio"];function qie(t,e){if(e==null)return!1;if(uje.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:qie(t,e.parentElement)}function dje(t,e){let r=e.target;return vy(r)?qie(t,r):!1}var fje=t=>$a(t.getBoundingClientRect()).center;function pje(t){return t instanceof Vie(t).Element}var mje=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function Kie(t,e){return t==null?null:t[mje](e)?t:Kie(t.parentElement,e)}function hje(t,e){return t.closest?t.closest(e):Kie(t,e)}function gje(t){return`[${Yh.contextId}="${t}"]`}function _je(t,e){let r=e.target;if(!pje(r))return null;let o=gje(t),n=hje(r,o);return!n||!vy(n)?null:n}function xje(t,e){let r=_je(t,e);return r?r.getAttribute(Yh.draggableId):null}function bje(t,e){let r=`[${eF.contextId}="${t}"]`,n=Uie(document,r).find(i=>i.getAttribute(eF.id)===e);return!n||!vy(n)?null:n}function yje(t){t.preventDefault()}function XC({expected:t,phase:e,isLockActive:r,shouldWarn:o}){return!(!r()||t!==e)}function Yie({lockAPI:t,store:e,registry:r,draggableId:o}){if(t.isClaimed())return!1;let n=r.draggable.findById(o);return!(!n||!n.options.isEnabled||!Fie(e.getState(),o))}function vje({lockAPI:t,contextId:e,store:r,registry:o,draggableId:n,forceSensorStop:i,sourceEvent:a}){if(!Yie({lockAPI:t,store:r,registry:o,draggableId:n}))return null;let l=o.draggable.getById(n),c=bje(e,l.descriptor.id);if(!c||a&&!l.options.canDragInteractiveElements&&dje(c,a))return null;let u=t.claim(i||zu),d="PRE_DRAG";function f(){return l.options.shouldRespectForcePress}function m(){return t.isActive(u)}function h(N,I){XC({expected:N,phase:d,isLockActive:m,shouldWarn:!0})&&r.dispatch(I())}let g=h.bind(null,"DRAGGING");function _(N){function I(){t.release(),d="COMPLETED"}d!=="PRE_DRAG"&&(I(),ue()),r.dispatch(c8e(N.liftActionArgs)),d="DRAGGING";function E(w,S={shouldBlockNextClick:!1}){if(N.cleanup(),S.shouldBlockNextClick){let T=za(window,[{eventName:"click",fn:yje,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(T)}I(),r.dispatch(Nie({reason:w}))}return{isActive:()=>XC({expected:"DRAGGING",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:f,drop:w=>E("DROP",w),cancel:w=>E("CANCEL",w),...N.actions}}function b(N){let I=Wh(w=>{g(()=>kie({client:w}))});return{..._({liftActionArgs:{id:n,clientSelection:N,movementMode:"FLUID"},cleanup:()=>I.cancel(),actions:{move:I}}),move:I}}function y(){let N={moveUp:()=>g(x8e),moveRight:()=>g(y8e),moveDown:()=>g(b8e),moveLeft:()=>g(v8e)};return _({liftActionArgs:{id:n,clientSelection:fje(c),movementMode:"SNAP"},cleanup:zu,actions:N})}function v(){XC({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!0})&&t.release()}return{isActive:()=>XC({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:f,fluidLift:b,snapLift:y,abort:v}}var Ije=[Z7e,oje,lje];function wje({contextId:t,store:e,registry:r,customSensors:o,enableDefaultSensors:n}){let i=[...n?Ije:[],...o||[]],a=M(()=>$7e())[0],s=Xe(function(_,b){gy(_)&&!gy(b)&&a.tryAbandon()},[a]);la(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();s(_,y),_=y})},[a,e,s]),la(()=>a.tryAbandon,[a.tryAbandon]);let l=Xe(g=>Yie({lockAPI:a,registry:r,store:e,draggableId:g}),[a,r,e]),c=Xe((g,_,b)=>vje({lockAPI:a,registry:r,contextId:t,store:e,draggableId:g,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,a,r,e]),u=Xe(g=>xje(t,g),[t]),d=Xe(g=>{let _=r.draggable.findById(g);return _?_.options:null},[r.draggable]),f=Xe(function(){a.isClaimed()&&(a.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(uF()))},[a,e]),m=Xe(()=>a.isClaimed(),[a]),h=Wt(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:u,findOptionsForDraggable:d,tryReleaseLock:f,isLockClaimed:m}),[l,c,u,d,f,m]);cje(i);for(let g=0;g<i.length;g++)i[g](h)}var Eje=t=>({onBeforeCapture:e=>{Dl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),Sje=t=>({...my,...t.autoScrollerOptions,durationDampening:{...my.durationDampening,...t.autoScrollerOptions}});function sy(t){return t.current||ue(),t.current}function Cje(t){let{contextId:e,setCallbacks:r,sensors:o,nonce:n,dragHandleUsageInstructions:i}=t,a=W(null);B7e();let s=bF(t),l=Xe(()=>Eje(s.current),[s]),c=Xe(()=>Sje(s.current),[s]),u=N7e(e),d=A7e({contextId:e,text:i}),f=w7e(e,n),m=Xe(T=>{sy(a).dispatch(T)},[]),h=Wt(()=>T2({publishWhileDragging:d8e,updateDroppableScroll:p8e,updateDroppableIsEnabled:m8e,updateDroppableIsCombineEnabled:h8e,collectionStarting:f8e},m),[m]),g=C7e(),_=Wt(()=>t7e(g,h),[g,h]),b=Wt(()=>x7e({scrollWindow:r7e,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...T2({move:kie},m)}),[_.scrollDroppable,m,c]),y=E7e(e),v=Wt(()=>J8e({announce:u,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:f}),[u,b,_,y,l,f]);a.current=v;let C=Xe(()=>{let T=sy(a);T.getState().phase!=="IDLE"&&T.dispatch(uF())},[]),N=Xe(()=>{let T=sy(a).getState();return T.phase==="DROP_ANIMATING"?!0:T.phase==="IDLE"?!1:T.isDragging},[]),I=Wt(()=>({isDragging:N,tryAbort:C}),[N,C]);r(I);let E=Xe(T=>Fie(sy(a).getState(),T),[]),w=Xe(()=>Gf(sy(a).getState()),[]),S=Wt(()=>({marshal:_,focus:y,contextId:e,canLift:E,isMovementAllowed:w,dragHandleUsageInstructionsId:d,registry:g}),[e,_,d,y,E,w,g]);return wje({contextId:e,store:v,registry:g,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),V(()=>C,[C]),D.createElement(aT.Provider,{value:S},D.createElement(Tne,{context:_F,store:v},t.children))}function Tje(){return D.useId()}function lT(t){let e=Tje(),r=t.dragHandleUsageInstructions||QC.dragHandleUsageInstructions;return D.createElement(Y2,null,o=>D.createElement(Cje,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:r,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var Qne={dragging:5e3,dropAnimating:4500},kje=(t,e)=>e?cy.drop(e.duration):t?cy.snap:cy.fluid,Nje=(t,e)=>{if(t)return e?py.opacity.drop:py.opacity.combining},Pje=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function Oje(t){let r=t.dimension.client,{offset:o,combineWith:n,dropping:i}=t,a=!!n,s=Pje(t),l=!!i,c=l?Q2.drop(o,a):Q2.moveTo(o);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:kje(s,i),transform:c,opacity:Nje(a,l),zIndex:l?Qne.dropAnimating:Qne.dragging,pointerEvents:"none"}}function Aje(t){return{transform:Q2.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function Dje(t){return t.type==="DRAGGING"?Oje(t):Aje(t)}function Rje(t,e,r=tn){let o=window.getComputedStyle(e),n=e.getBoundingClientRect(),i=F2(n,o),a=ny(i,r),s={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:s,displaceBy:l,client:i,page:a}}function Mje(t){let e=xF("draggable"),{descriptor:r,registry:o,getDraggableRef:n,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}=t,l=Wt(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}),[i,s,a]),c=Xe(m=>{let h=n();return h||ue(),Rje(r,h,m)},[r,n]),u=Wt(()=>({uniqueId:e,descriptor:r,options:l,getDimension:c}),[r,c,l,e]),d=W(u),f=W(!0);la(()=>(o.draggable.register(d.current),()=>o.draggable.unregister(d.current)),[o.draggable]),la(()=>{if(f.current){f.current=!1;return}let m=d.current;d.current=u,o.draggable.update(u,m)},[u,o.draggable])}var vF=D.createContext(null);function Xie(t){t&&vy(t)||ue()}function Lje(t,e,r){Iy(()=>{function o(i){return`Draggable[id: ${i}]: `}let n=t.draggableId;n||ue(!1),typeof n!="string"&&ue(!1),Number.isInteger(t.index)||ue(!1),t.mapped.type!=="DRAGGING"&&(Xie(r()),t.isEnabled&&(Hie(e,n)||ue(!1)))})}function Fje(t){}function tT(t){let e=lt(t);return e||ue(),e}function Bje(t){t.preventDefault()}var $je=t=>{let e=W(null),r=Xe((I=null)=>{e.current=I},[]),o=Xe(()=>e.current,[]),{contextId:n,dragHandleUsageInstructionsId:i,registry:a}=tT(aT),{type:s,droppableId:l}=tT(vF),c=Wt(()=>({id:t.draggableId,index:t.index,type:s,droppableId:l}),[t.draggableId,t.index,s,l]),{children:u,draggableId:d,isEnabled:f,shouldRespectForcePress:m,canDragInteractiveElements:h,isClone:g,mapped:_,dropAnimationFinished:b}=t;if(Lje(t,n,o),Fje(g),!g){let I=Wt(()=>({descriptor:c,registry:a,getDraggableRef:o,canDragInteractiveElements:h,shouldRespectForcePress:m,isEnabled:f}),[c,a,o,h,m,f]);Mje(I)}let y=Wt(()=>f?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":d,"data-rfd-drag-handle-context-id":n,draggable:!1,onDragStart:Bje}:null,[n,i,d,f]),v=Xe(I=>{_.type==="DRAGGING"&&_.dropping&&I.propertyName==="transform"&&Dl(b)},[b,_]),C=Wt(()=>{let I=Dje(_),E=_.type==="DRAGGING"&&_.dropping?v:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":n,"data-rfd-draggable-id":d,style:I,onTransitionEnd:E},dragHandleProps:y}},[n,y,d,_,v,r]),N=Wt(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return D.createElement(D.Fragment,null,u(C,_.snapshot,N))},Jie=(t,e)=>t===e,Qie=t=>{let{combine:e,destination:r}=t;return r?r.droppableId:e?e.droppableId:null},zje=t=>t.combine?t.combine.draggableId:null,Uje=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function Vje(){let t=en((n,i)=>({x:n,y:i})),e=en((n,i,a=null,s=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:n,draggingOver:a,combineWith:s,combineTargetFor:null})),r=en((n,i,a,s,l=null,c=null,u=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:n,dimension:a,forceShouldAnimate:u,snapshot:e(i,s,l,c,null)}}));return(n,i)=>{if(gy(n)){if(n.critical.draggable.id!==i.draggableId)return null;let a=n.current.client.offset,s=n.dimensions.draggables[i.draggableId],l=sa(n.impact),c=Uje(n.impact),u=n.forceShouldAnimate;return r(t(a.x,a.y),n.movementMode,s,i.isClone,l,c,u)}if(n.phase==="DROP_ANIMATING"){let a=n.completed;if(a.result.draggableId!==i.draggableId)return null;let s=i.isClone,l=n.dimensions.draggables[i.draggableId],c=a.result,u=c.mode,d=Qie(c),f=zje(c),h={duration:n.dropDuration,curve:fF.drop,moveTo:n.newHomeClientOffset,opacity:f?py.opacity.drop:null,scale:f?py.scale.drop:null};return{mapped:{type:"DRAGGING",offset:n.newHomeClientOffset,dimension:l,dropping:h,draggingOver:d,combineWith:f,mode:u,forceShouldAnimate:null,snapshot:e(u,s,d,f,h)}}}return null}}function Zie(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var Hje={mapped:{type:"SECONDARY",offset:tn,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Zie(null)}};function jje(){let t=en((a,s)=>({x:a,y:s})),e=en(Zie),r=en((a,s=null,l)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:s,shouldAnimateDisplacement:l,snapshot:e(s)}})),o=a=>a?r(tn,a,!0):null,n=(a,s,l,c)=>{let u=l.displaced.visible[a],d=!!(c.inVirtualList&&c.effected[a]),f=oT(l),m=f&&f.draggableId===a?s:null;if(!u){if(!d)return o(m);if(l.displaced.invisible[a])return null;let _=Xh(c.displacedBy.point),b=t(_.x,_.y);return r(b,m,!0)}if(d)return o(m);let h=l.displacedBy.point,g=t(h.x,h.y);return r(g,m,u.shouldAnimate)};return(a,s)=>{if(gy(a))return a.critical.draggable.id===s.draggableId?null:n(s.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){let l=a.completed;return l.result.draggableId===s.draggableId?null:n(s.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var Gje=()=>{let t=Vje(),e=jje();return(o,n)=>t(o,n)||e(o,n)||Hje},Wje={dropAnimationFinished:Pie},qje=R2(Gje,Wje,null,{context:_F,areStatePropsEqual:Jie})($je);function eae(t){return tT(vF).isUsingCloneFor===t.draggableId&&!t.isClone?null:D.createElement(qje,t)}function cT(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,r=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return D.createElement(eae,qc({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:r,shouldRespectForcePress:o}))}var IF=t=>e=>t===e,Kje=IF("scroll"),Yje=IF("auto"),Xje=IF("visible"),Zne=(t,e)=>e(t.overflowX)||e(t.overflowY),Jje=(t,e)=>e(t.overflowX)&&e(t.overflowY),tae=t=>{let e=window.getComputedStyle(t),r={overflowX:e.overflowX,overflowY:e.overflowY};return Zne(r,Kje)||Zne(r,Yje)},Qje=()=>!1,rae=t=>t==null?null:t===document.body?Qje()?t:null:t===document.documentElement?null:tae(t)?t:rae(t.parentElement);var tF=t=>({x:t.scrollLeft,y:t.scrollTop}),oae=t=>t?window.getComputedStyle(t).position==="fixed"?!0:oae(t.parentElement):!1,Zje=t=>{let e=rae(t),r=oae(t);return{closestScrollable:e,isFixedOnPage:r}},eGe=({descriptor:t,isEnabled:e,isCombineEnabled:r,isFixedOnPage:o,direction:n,client:i,page:a,closest:s})=>{let l=(()=>{if(!s)return null;let{scrollSize:f,client:m}=s,h=Rie({scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,height:m.paddingBox.height,width:m.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:m,scrollSize:f,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:h,diff:{value:tn,displacement:tn}}}})(),c=n==="vertical"?iF:pie,u=qh({page:a,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:r,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:a,frame:l,subject:u}},tGe=(t,e)=>{let r=B2(t);if(!e||t!==e)return r;let o=r.paddingBox.top-e.scrollTop,n=r.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,a=n+e.scrollWidth,l=qC({top:o,right:a,bottom:i,left:n},r.border);return KC({borderBox:l,margin:r.margin,border:r.border,padding:r.padding})},rGe=({ref:t,descriptor:e,env:r,windowScroll:o,direction:n,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:s})=>{let l=r.closestScrollable,c=tGe(t,l),u=ny(c,o),d=(()=>{if(!l)return null;let m=B2(l),h={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:m,page:ny(m,o),scroll:tF(l),scrollSize:h,shouldClipSubject:s}})();return eGe({descriptor:e,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:r.isFixedOnPage,direction:n,client:c,page:u,closest:d})},oGe={passive:!1},nGe={passive:!0},eie=t=>t.shouldPublishImmediately?oGe:nGe,JC=t=>t&&t.env.closestScrollable||null;function iGe(t){let e=W(null),r=tT(aT),o=xF("droppable"),{registry:n,marshal:i}=r,a=bF(t),s=Wt(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=W(s),c=Wt(()=>en((C,N)=>{e.current||ue();let I={x:C,y:N};i.updateDroppableScroll(s.id,I)}),[s.id,i]),u=Xe(()=>{let C=e.current;return!C||!C.env.closestScrollable?tn:tF(C.env.closestScrollable)},[]),d=Xe(()=>{let C=u();c(C.x,C.y)},[u,c]),f=Wt(()=>Wh(d),[d]),m=Xe(()=>{let C=e.current,N=JC(C);if(C&&N||ue(),C.scrollOptions.shouldPublishImmediately){d();return}f()},[f,d]),h=Xe((C,N)=>{e.current&&ue();let I=a.current,E=I.getDroppableRef();E||ue();let w=Zje(E),S={ref:E,descriptor:s,env:w,scrollOptions:N};e.current=S;let T=rGe({ref:E,descriptor:s,env:w,windowScroll:C,direction:I.direction,isDropDisabled:I.isDropDisabled,isCombineEnabled:I.isCombineEnabled,shouldClipSubject:!I.ignoreContainerClipping}),A=w.closestScrollable;return A&&(A.setAttribute(qne.contextId,r.contextId),A.addEventListener("scroll",m,eie(S.scrollOptions))),T},[r.contextId,s,m,a]),g=Xe(()=>{let C=e.current,N=JC(C);return C&&N||ue(),tF(N)},[]),_=Xe(()=>{let C=e.current;C||ue();let N=JC(C);e.current=null,N&&(f.cancel(),N.removeAttribute(qne.contextId),N.removeEventListener("scroll",m,eie(C.scrollOptions)))},[m,f]),b=Xe(C=>{let N=e.current;N||ue();let I=JC(N);I||ue(),I.scrollTop+=C.y,I.scrollLeft+=C.x},[]),y=Wt(()=>({getDimensionAndWatchScroll:h,getScrollWhileDragging:g,dragStopped:_,scroll:b}),[_,h,g,b]),v=Wt(()=>({uniqueId:o,descriptor:s,callbacks:y}),[y,s,o]);la(()=>(l.current=v.descriptor,n.droppable.register(v),()=>{e.current&&_(),n.droppable.unregister(v)}),[y,s,_,v,i,n.droppable]),la(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),la(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function G2(){}var tie={width:0,height:0,margin:iHe},aGe=({isAnimatingOpenOnMount:t,placeholder:e,animate:r})=>t||r==="close"?tie:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},sGe=({isAnimatingOpenOnMount:t,placeholder:e,animate:r})=>{let o=aGe({isAnimatingOpenOnMount:t,placeholder:e,animate:r});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?cy.placeholder:null}},lGe=t=>{let e=W(null),r=Xe(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:n,onClose:i,contextId:a}=t,[s,l]=M(t.animate==="open");V(()=>s?o!=="open"?(r(),l(!1),G2):e.current?G2:(e.current=setTimeout(()=>{e.current=null,l(!1)}),r):G2,[o,s,r]);let c=Xe(d=>{d.propertyName==="height"&&(n(),o==="close"&&i())},[o,i,n]),u=sGe({isAnimatingOpenOnMount:s,animate:t.animate,placeholder:t.placeholder});return D.createElement(t.placeholder.tagName,{style:u,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:t.innerRef})},cGe=D.memo(lGe);function W2(t){return typeof t=="boolean"}function q2(t,e){e.forEach(r=>r(t))}var uGe=[function({props:e}){e.droppableId||ue(),typeof e.droppableId!="string"&&ue()},function({props:e}){W2(e.isDropDisabled)||ue(),W2(e.isCombineEnabled)||ue(),W2(e.ignoreContainerClipping)||ue()},function({getDroppableRef:e}){Xie(e())}],dGe=[function({props:e,getPlaceholderRef:r}){!e.placeholder||r()}],fGe=[function({props:e}){e.renderClone||ue()},function({getPlaceholderRef:e}){e()&&ue()}];function pGe(t){Iy(()=>{q2(t,uGe),t.props.mode==="standard"&&q2(t,dGe),t.props.mode==="virtual"&&q2(t,fGe)})}var rF=class extends D.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,r){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},mGe=t=>{let e=lt(aT);e||ue();let{contextId:r,isMovementAllowed:o}=e,n=W(null),i=W(null),{children:a,droppableId:s,type:l,mode:c,direction:u,ignoreContainerClipping:d,isDropDisabled:f,isCombineEnabled:m,snapshot:h,useClone:g,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=Xe(()=>n.current,[]),v=Xe((R=null)=>{n.current=R},[]),C=Xe(()=>i.current,[]),N=Xe((R=null)=>{i.current=R},[]);pGe({props:t,getDroppableRef:y,getPlaceholderRef:C});let I=Xe(()=>{o()&&_({maxScroll:Lie()})},[o,_]);iGe({droppableId:s,type:l,mode:c,direction:u,isDropDisabled:f,isCombineEnabled:m,ignoreContainerClipping:d,getDroppableRef:y});let E=Wt(()=>D.createElement(rF,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:R,data:P,animate:B})=>D.createElement(cGe,{placeholder:P,onClose:R,innerRef:N,animate:B,contextId:r,onTransitionEnd:I})),[r,I,t.placeholder,t.shouldAnimatePlaceholder,N]),w=Wt(()=>({innerRef:v,placeholder:E,droppableProps:{"data-rfd-droppable-id":s,"data-rfd-droppable-context-id":r}}),[r,s,E,v]),S=g?g.dragging.draggableId:null,T=Wt(()=>({droppableId:s,type:l,isUsingCloneFor:S}),[s,S,l]);function A(){if(!g)return null;let{dragging:R,render:P}=g,B=D.createElement(eae,{draggableId:R.draggableId,index:R.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},($,z)=>P($,z,R));return D.createPortal(B,b())}return D.createElement(vF.Provider,{value:T},a(w,h),A())};function hGe(){return document.body||ue(),document.body}var rie={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:hGe},nae=t=>{let e={...t},r;for(r in rie)t[r]===void 0&&(e={...e,[r]:rie[r]});return e},K2=(t,e)=>t===e.droppable.type,oie=(t,e)=>e.draggables[t.draggable.id],gGe=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},r=en(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=en((i,a,s,l,c,u)=>{let d=c.descriptor.id;if(c.descriptor.droppableId===i){let h=u?{render:u,dragging:r(c.descriptor)}:null,g={isDraggingOver:s,draggingOverWith:s?d:null,draggingFromThisWith:d,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:g,useClone:h}}if(!a)return e;if(!l)return t;let m={isDraggingOver:s,draggingOverWith:d,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:m,useClone:null}});return(i,a)=>{let s=nae(a),l=s.droppableId,c=s.type,u=!s.isDropDisabled,d=s.renderClone;if(gy(i)){let f=i.critical;if(!K2(c,f))return e;let m=oie(f,i.dimensions),h=sa(i.impact)===l;return o(l,u,h,h,m,d)}if(i.phase==="DROP_ANIMATING"){let f=i.completed;if(!K2(c,f.critical))return e;let m=oie(f.critical,i.dimensions);return o(l,u,Qie(f.result)===l,sa(f.impact)===l,m,d)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let f=i.completed;if(!K2(c,f.critical))return e;let m=sa(f.impact)===l,h=!!(f.impact.at&&f.impact.at.type==="COMBINE"),g=f.critical.droppable.id===l;return m?h?t:e:g?t:e}return e}},_Ge={updateViewportMaxScroll:_8e},uT=R2(gGe,_Ge,(t,e,r)=>({...nae(r),...t,...e}),{context:_F,areStatePropsEqual:Jie})(mGe);xo();Pe();xo();Pe();function iae(){return new URLSearchParams(window.location.search).get("deeplink")||""}var aae=ft(null);function sae(t){let[e,r]=M(iae()),o={value:e,setValue:r};return V(()=>{let n=()=>{r(iae())};return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)},[]),V(()=>{let n=i=>{let a=i.data;if(a.scrollToDeeplink){let s=a.scrollToDeeplink.deepKey,l=document.getElementById(s);if(l){r(s),wF(l,{behavior:"smooth",force:!0});let c=new URL(window.location.href);c.searchParams.set("deeplink",s),window.history.replaceState({},"",c.toString())}}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[]),p(aae.Provider,{value:o,children:t.children})}function wy(){let t=lt(aae);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function xGe(t){let e=t;for(;e&&e!==document.body;){let r=e.closest("details");if(r&&r.parentElement)r.open=!0,e=r.parentElement;else break}}function bGe(t){let e=[],r=t;for(;r&&r!==document.body;){let o=r.closest(".DocEditor__ArrayField__item");if(!o)break;let n=o.querySelector(".DocEditor__ArrayField__item__header");if(n&&!e.includes(n))e.push(n),r=o.parentElement;else break}return e}function wF(t,e={behavior:"auto"}){setTimeout(()=>{let r=document.querySelector(".DocumentPage__side");if(!r||r.scrollTop>0&&!e.force)return;xGe(t);let n=bGe(t).reduce((a,s)=>a+s.offsetHeight,0),i=t.offsetTop-n;r.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function lae(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}xo();Pe();function dT(t,e){let r;return(...o)=>{window.clearTimeout(r),r=window.setTimeout(()=>{t(...o)},e)}}var cl=class{constructor(){this.events=new Map}on(e,r){let o=ra(6),n=this.events.get(e);return n||(n=new Map,this.events.set(e,n)),n.set(o,r),()=>{this.off(e,o)}}off(e,r){let o=this.events.get(e);o&&(o.delete(r),o.size===0&&this.events.delete(e))}dispatch(e,...r){let o=this.events.get(e);o&&o.forEach(n=>n(...r))}dispose(){this.events.clear()}};var fT=class{constructor(){this.subscribers=new Set;this.children=new Map}},pT=class extends cl{constructor(r){super();this.root=new fT;this.data=r||{}}get(r){return this.getValueFromPath(r,this.data)}set(r,o){if(r===""){La(o)&&this.setData(o);return}this.update({[r]:o})}update(r){let o=new Set,n=(i,a,s)=>{o.add({path:i,value:s}),La(a)&&La(s)&&(Object.entries(s).forEach(([l,c])=>{let u=a[l];qb(u,c)||n(`${i}.${l}`,u,c)}),Object.keys(a).forEach(l=>{l in s||n(`${i}.${l}`,a[l],void 0)}))};Object.entries(r).forEach(([i,a])=>{let s=this.data,l=i.split("."),c=l.pop();for(let d of l)s[d]||(s[d]={}),s=s[d];let u=s[c];s[c]=a,this.dispatch("VALUE_CHANGE",i,a),n(i,u,a)}),o.forEach(i=>{let a=this.getTrieNode(i.path);a&&a.subscribers.size>0&&a.subscribers.forEach(s=>s(i.value))}),this.dispatch("CHANGE",this.data)}setData(r){let o=this.data;this.notifyOnUpdate(this.root,"",o,r),this.data=r,this.dispatch("CHANGE",this.data)}subscribe(r,o){let n=this.getTrieNode(r,!0);return n.subscribers.add(o),window.setTimeout(()=>{let i=this.get(r);i!==void 0&&o(i)}),()=>{n.subscribers.delete(o)}}getDataSnapshot(){return this.data}dispose(){super.dispose(),this.data={},this.root.subscribers.clear(),this.root.children.clear()}notifyOnUpdate(r,o,n,i){let a=this.getValueFromPath(o,n),s=this.getValueFromPath(o,i);qb(a,s)||r.subscribers.forEach(l=>l(s)),r.children.forEach((l,c)=>{let u=o?`${o}.${c}`:c;this.notifyOnUpdate(l,u,n,i)})}getValueFromPath(r,o){if(!r)return o;let n=r.split("."),i=o;for(let a of n){if(i===null||typeof i!="object"||!(a in i))return;i=i[a]}return i}getTrieNode(r,o=!1){if(!r)return this.root;let n=r.split("."),i=this.root;for(let a of n){if(!i.children.has(a))if(o)i.children.set(a,new fT);else return;i=i.children.get(a)}return i}};var cae=3*No.second,yGe=5*No.minute;var vGe=30*No.second,EF=class extends cl{constructor(r){super();this.pendingUpdates=new Map;this.saveState="NO_CHANGES";this.autolock=!1;this.autolockReason="autolock";this.autolockApplied=!1;this.started=!1;this.queueChanges=dT(()=>this.flush(),cae);this.projectId=window.__ROOT_CTX.rootConfig.projectId;let[o,n]=r.split("/");this.docId=r,this.collectionId=o,this.slug=n,this.db=window.firebase.db,this.docRef=$e(this.db,"Projects",this.projectId,"Collections",o,"Drafts",n),this.store=new pT({id:this.docId,collection:this.collectionId,slug:this.slug,sys:{}}),this.store.on("CHANGE",a=>{this.dispatch("CHANGE",a)}),this.store.on("VALUE_CHANGE",(a,s)=>{this.dispatch("VALUE_CHANGE",a,s)});let i=window.__ROOT_CTX.collections[o];i&&(this.autolock=!!i.autolock,i.autolockReason&&(this.autolockReason=i.autolockReason))}async start(){this.started||(this.started=!0,this.dbUnsubscribe=bu(this.docRef,r=>{if(r.metadata.hasPendingWrites)return;let o=r.data()||{};this.pendingUpdates.size>0&&uae(o,Object.fromEntries(this.pendingUpdates)),this.store.setData(o)}))}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.flush(),this.started=!1)}onChange(r){return this.on("CHANGE",r)}onSaveStateChange(r){return this.on("SAVE_STATE_CHANGE",r)}onFlush(r){return this.on("FLUSH",r)}subscribe(r,o){return this.store.subscribe(r,o)}getData(){return this.store.getDataSnapshot()}getValue(r){return this.store.get(r)}async updateKey(r,o){this.pendingUpdates.set(r,o),this.store.set(r,o),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}async updateKeys(r){for(let o in r){let n=r[o];n==null?this.pendingUpdates.set(o,$o()):this.pendingUpdates.set(o,n)}this.store.update(r),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}async removeKey(r){this.pendingUpdates.set(r,$o()),this.store.set(r,void 0),this.setSaveState("UPDATE_PENDING"),this.queueChanges()}setSaveState(r){let o=this.saveState;r==="SAVED"&&o!=="SAVING"||(this.saveState=r,r==="SAVED"&&window.setTimeout(()=>{this.saveState==="SAVED"&&this.setSaveState("NO_CHANGES")},cae),this.dispatch("SAVE_STATE_CHANGE",r))}removePublishingLock(){this.autolockApplied=!0,this.removeKey("sys.publishingLocked"),this.flush()}async flush(){if(this.pendingUpdates.size===0)return;let r=Object.fromEntries(this.pendingUpdates);r["sys.modifiedAt"]=Cr(),r["sys.modifiedBy"]=window.firebase.user.email,this.autolock&&!this.autolockApplied&&!this.store.get("sys.publishingLocked")&&(this.autolockApplied=!0,r["sys.publishingLocked"]={lockedAt:Cr(),lockedBy:window.firebase.user.email,reason:this.autolockReason}),this.pendingUpdates.clear();try{this.setSaveState("SAVING"),await Mr(this.docRef,r),this.setSaveState("SAVED"),this.dispatch("FLUSH"),Ot("doc.save",{metadata:{docId:this.docId},throttle:yGe,throttleId:this.docId})}catch(o){console.error("failed to update doc"),console.error(o),this.setSaveState("ERROR"),Ae({title:"Failed to save",message:`Failed to save changes to ${this.slug}`,color:"red",autoClose:!1});for(let n in r)n.startsWith("sys.")||this.pendingUpdates.has(n)||(this.pendingUpdates.set(n,r[n]),this.queueChanges(),console.log("re-queued updates"))}}getLocales(){let r=this.store.get("sys.locales");return r||["en"]}setLocales(r){this.updateKey("sys.locales",r)}async dispose(){super.dispose(),this.stop()}};function uae(t,e){for(let r in e){let o=e[r];if(r.includes(".")){let[n,i]=IGe(r);t[n]??={},uae(t[n],{[i]:o})}else typeof o>"u"?delete t[r]:t[r]=o}}function IGe(t){let e=t.indexOf("."),r=t.substring(0,e),o=t.substring(e+1);return[r,o]}var dae=ft(null);function fae(t){let[e,r]=M(!0),o=ve(()=>new EF(t.docId),[t.docId]);return V(()=>(r(!0),o.onChange(n=>{r(!1),Mb(n.id,n)}),o.start(),()=>o.dispose()),[o]),V(()=>{let n=()=>{let i;document.hidden||document.visibilityState!=="visible"?i=window.setTimeout(()=>{o.stop()},vGe):(i&&(clearTimeout(i),i=void 0),o.started||(r(!0),o.start()))};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[o]),p(dae.Provider,{value:{loading:e,controller:o},children:t.children})}function Wn(){let t=lt(dae);if(!t)throw new Error("useDraftDoc() should be used within a <DraftDocProvider>");return t}function pae(t){let{controller:e}=Wn();V(()=>e.onSaveStateChange(t),[e])}function ul(t,e){let{controller:r}=Wn();V(()=>r.subscribe(t,e),[r])}function rn(t,e){let{controller:r}=Wn(),[o,n]=M(r.getValue(t)??e);return V(()=>r.subscribe(t,a=>{n(a)}),[r]),[o,a=>{n(a),a==null?r.removeKey(t):r.updateKey(t,a)}]}var wGe={get:async()=>{try{let t=await EGe();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function mae(){return wGe}async function EGe(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function Va(t,e){if(!CGe())return;let r=SGe();r&&r.contentWindow?.postMessage({highlightNode:{deepKey:t,options:e}},"*")}function SGe(){return document.querySelector('iframe[title="iframe preview"]')}function CGe(){let t=window.__ROOT_CTX.preview;return[!0,"to-preview"].includes(t.channel)}function hae(t,e){return t.replace(/\{(.+?)\}/g,(r,o)=>{let n=e(o);return n??r})}function Zh(t,e,r={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!hh(e);case"object":if(!La(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!Zh(o,e[o.id],r))return!1;return!0;case"array":if(!La(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!Zh(t.of,e[o],r))return!1;return!1;case"oneof":{if(!La(e)||!e._type)return!0;let o,n=t.types||[];if(typeof n[0]=="string"?n.includes(e._type)&&(o=r[e._type]):o=n.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!Zh(i,e[i.id],r))return!1;return!0}default:return!1}}Pe();function gae(t,e){let r=!1;return(...o)=>{r||(t(...o),r=!0,setTimeout(()=>{r=!1},e))}}var Ey=class extends cl{constructor(r){super();this.interval=0;this.timeout=0;this.interval=r}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var TGe=60*No.second,_ae=5*No.minute,SF=class extends cl{constructor(r){super();this.started=!1;this.timer=new Ey(TGe);this.idleTimer=new Ey(_ae);this.onUserInteraction=gae(()=>{this.idleTimer.reset()},5e3);this.id=r;let o=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db;this.docRef=$e(n,"Projects",o,"Viewers",r),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=bu(this.docRef,r=>{let o=r.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(r){let o=window.firebase.user,n=Tt.now(),i=Object.values(r).filter(a=>!(a.email===o.email||n.toMillis()-a.lastViewedAt.toMillis()>_ae));this.dispatch("change",i)}async onTick(){let r=window.firebase.user;if(!r.email){console.log("no user email:",r);return}await xu(this.docRef,{[r.email]:{email:r.email,photoURL:r.photoURL,lastViewedAt:Cr()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let r=window.firebase.user;if(!r.email){console.log("no user email:",r);return}let o=new Pn(r.email,"disconnectedAt");await Mr(this.docRef,o,Cr())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function xae(t){let e=Ou(t.id),[r,o]=M([]);if(V(()=>{let i=new SF(e);i.on("change",s=>o(s)),i.start();let a=()=>{document.hidden||document.visibilityState!=="visible"?i.stop():i.started||i.start()};return document.addEventListener("visibilitychange",a),()=>{i.dispose(),document.removeEventListener("visibilitychange",a)}},[e]),r.length===0)return null;function n(i){return i.disconnectedAt?i.disconnectedAt>i.lastViewedAt:!1}return p(Sw,{className:"Viewers",limit:3,size:30,children:r.map(i=>{if(!i.photoURL){let a=i.email[0].toUpperCase();return p(Ca,{alt:i.email,size:24,radius:"xl",children:a})}return p(Ca,{className:De("Viewers__viewer",n(i)&&"Viewers__viewer--disconnected"),src:i.photoURL,alt:i.email,size:24,radius:"xl"},i.email)})})}function bae(t){let r=t.field.checkboxLabel||"Enabled",[o,n]=rn(t.deepKey,!1);return p("div",{className:"DocEditor__BooleanField",children:p(Xc,{label:r,onChange:i=>{let a=i.currentTarget;n(a.checked)},checked:o,size:"xs"})})}function yae(t){let[e,r]=rn(t.deepKey);return p("div",{className:"DocEditor__DateField",children:p("input",{type:"date",value:e||"",onChange:o=>{let n=o.currentTarget;r(n.value||null)}})})}Pe();function vae(t){let[e,r]=rn(t.deepKey),o=ve(()=>e?kGe(e):"",[e]),n=i=>{if(i){let a=Math.floor(new Date(i).getTime()),s=Tt.fromMillis(a);r(s)}else r(null)};return p("div",{className:"DocEditor__DateTimeField",children:[p("input",{type:"datetime-local",value:o,onChange:i=>{let s=i.target.value;n(s)}}),p("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})}function kGe(t){try{let e=t.toDate();return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e.toISOString().slice(0,16)}catch{return console.error("failed to parse date: ",t),""}}xo();Rl();Pe();var NGe=["image/gif","image/jpeg","image/png","image/svg+xml","image/webp"],PGe=["#25262b","#868e96","#fa5252","#e64980","#be4bdb","#7950f2","#4c6ef5","#228be6","#15aabf","#12b886","#40c057","#82c91e","#fab005","#fd7e14"],Iae=ft(null);function Sy(){let t=lt(Iae);if(!t)throw new Error("useFileField() should be called within a <FileFieldContext.Provider>");return t}function fi(t){let e=t.field,r=dr(),o=W(null),[n,i]=M(!1),[a,s]=rn(t.deepKey),[l,c]=M(null),u=e.exts??(t.variant==="image"?NGe:[]),d=a?.alt||"",f=e.alt!==!1;async function m(I){try{c("loading");let E=await Pu(I,{preserveFilename:e.preserveFilename,cacheControl:e.cacheControl});!E.alt&&CF(E.filename)&&d&&(E.alt=d),s(E),c("complete")}catch(E){console.error("upload failed"),console.error(E),c("error"),Ae({title:"Upload failed",message:"Failed to upload: "+String(E),color:"red",autoClose:!1})}}function h(){s(null)}function g(I,E){if(!I)return;E?.as==="svg"&&(I=new File([new Blob([I],{type:"image/svg+xml"})],"untitled.svg",{type:"image/svg+xml"})),I=I;let w=Ch(I.name);if(u.length>0&&!u.some(S=>S.endsWith(w)||S===`*/${w}`||S==="*/*"||S===I.type)){Ae({title:"Invalid file type",message:`File type ${w} is not allowed.`,color:"red",autoClose:!0});return}m(I)}function _(){o.current?.focus()}function b(){if(a?.src)if(rC(a.src)){let I=document.createElement("a");I.href=Lte(a.src),a.filename&&(I.download=a.filename),document.body.appendChild(I),I.click(),document.body.removeChild(I)}else window.open(a.src,"_blank")}function y(){let I=document.createElement("input");I.type="file",u.length>0&&(I.accept=u.join(",")),I.onchange=E=>{let w=E.target;w.files&&w.files.length>0&&g(w.files[0])},I.click(),I.remove()}function v(){i(!0)}function C(I){a?.src&&s({...a,alt:I||""})}async function N(I){let E=a;if(!E?.src||!I)return;c("loading");let w=await I.sendPrompt(I.addMessage({sender:"user",blocks:[{type:"image",image:{src:E.src}}]}),[{text:"Generate alt text for the image above."},{media:{url:E.src}}],{mode:"altText"});w?.error?Ae({title:"Sorry, something went wrong.",message:w.error,color:"red",autoClose:!0}):w?.message&&C(w.message),c("complete")}return p(Iae.Provider,{value:{field:e,variant:t.variant,value:a,setValue:s,loadingState:l,removeFile:h,acceptedFileTypes:u,handleFile:g,focusDropZone:_,requestGenerateAltText:N,requestFileUpload:y,requestFileDownload:b,requestPlaceholderModalOpen:v,showAltText:f,altText:d,setAltText:C},children:[p(eu,{size:"sm",opened:n,onClose:()=>i(!1),title:"Placeholder image",centered:!0,overlayColor:r.colorScheme==="dark"?r.colors.dark[9]:r.colors.gray[2],children:p("form",{onSubmit:I=>{I.preventDefault();let E=new FormData(I.currentTarget),w=parseInt(E.get("width"),10),S=parseInt(E.get("height"),10),T=E.get("backgroundColor"),A=E.get("label")||`${w}x${S}`,R=`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${S}" viewBox="0 0 ${w} ${S}"><rect width="${w}" height="${S}" fill="${T}" />`;if(A){let Y=w*.5/(A.length*.6);R+=`<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-size="${Y}" fill="#fff">${A}</text>`}R+="</svg>";let B=new TextEncoder().encode(R),z={src:`data:image/svg+xml;base64,${btoa(String.fromCharCode(...B))}`,filename:"placeholder.svg",width:w,height:S,alt:""};s(z),i(!1)},children:[p(tu,{gap:"xs",children:[p(ir,{label:"Width",name:"width",type:"number",defaultValue:1600,"data-autofocus":!0}),p(ir,{label:"Height",name:"height",type:"number",defaultValue:900}),p(ir,{name:"label",label:"Label",defaultValue:"",autofocus:!0}),p(Uw,{name:"backgroundColor",label:"Background color",format:"hex",defaultValue:"#868e96",swatches:PGe})]}),p("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"1rem"},children:p(re,{variant:"filled",type:"submit",children:"Create"})})]})}),p("div",{className:"FileField",children:[p(fi.Dropzone,{ref:o}),a?.src?p(fi.Preview,{}):p(fi.InvisibleDropzone,{children:p(fi.Empty,{})})]})]})}fi.Preview=()=>{let t=Sy(),[e,r]=M(!1),[o,n]=M(!1),i=Wb(),a=window.__ROOT_CTX.experiments||{},s=CF(t.value?.filename),[l,c]=M(!s);return t.value?.src?p("div",{className:"FileField__Preview",children:[p("div",{className:"FileField__Preview__InfoButton",children:[s&&p(Se,{label:"Toggle file info",position:"top",withArrow:!0,children:p(Je,{onClick:()=>c(u=>!u),size:"sm",variant:"outline",className:"FileField__Preview__InfoButton__Icon",children:p(bM,{size:16})})}),p(je,{className:"FileField__Preview__Menu",shadow:"sm",withinPortal:!1,closeOnItemClick:!1,control:p(Je,{variant:"outline",size:"sm",radius:"sm",c:"black",className:"FileField__Preview__InfoButton__Icon",children:p(bf,{size:16})}),children:[p(je.Label,{size:"sm",children:"REPLACE"}),p(je.Item,{icon:t.variant==="image"?p(xS,{size:16}):p(ol,{size:16}),onClick:()=>t.requestFileUpload(),children:["Upload ",t.variant==="image"?"image":"file"]}),wae(t.acceptedFileTypes)&&p(je.Item,{disabled:!t.value?.src,icon:p(_S,{size:16}),onClick:()=>{t.requestPlaceholderModalOpen()},children:"Placeholder image"}),p(Ea,{}),p(je.Item,{disabled:t.value?.src?.startsWith("data:"),onClick:()=>{t?.requestFileDownload()},icon:p(dM,{size:16}),children:"Download file"}),p(je.Item,{closeOnItemClick:!1,icon:p(nc,{size:16}),onClick:()=>{n(!1),navigator.clipboard.writeText(t.value?.src||"").then(()=>n(!0)).finally(()=>setTimeout(()=>{n(!1)},2e3))},children:o?"Copied!":"Copy URL"}),p(Ea,{}),p(je.Item,{color:"red",onClick:()=>{t?.removeFile()},icon:p(Hn,{size:16}),children:"Remove file"})]})]}),p("div",{className:De("FileField__Canvas",l&&"FileField__Canvas--infoOpened",e&&"dragging"),style:OGe(t.value),onDragOver:u=>{u.preventDefault(),r(!0)},onDragLeave:u=>{u.preventDefault(),r(!1)},onDrop:u=>{u.preventDefault(),r(!1);let d=u.dataTransfer?.files[0];d&&t&&t.handleFile(d)},onPaste:u=>{u.preventDefault();let d=u.clipboardData?.files[0];if(d){t.handleFile(d);return}let f=u.clipboardData?.getData("text/plain");if(f&&Eae(f)){t.handleFile(f,{as:"svg"});return}},children:[p(ka,{visible:t.loadingState==="loading"}),l?p("div",{className:"FileField__Canvas__Info",children:[p(Tb,{size:16,className:"FileField__Canvas__Info__Icon"}),p(fo,{className:"FileField__Canvas__InfoTable",verticalSpacing:"xs",fontSize:"xs",children:p("tbody",{children:[t.value?.filename&&p("tr",{children:[p("td",{children:p("b",{children:"Name"})}),p("td",{children:t.value.filename})]}),t.value?.uploadedAt&&p("tr",{children:[p("td",{children:p("b",{children:"Uploaded"})}),p("td",{children:[new Date(parseInt(t.value.uploadedAt,10)).toLocaleString(),t.value.uploadedBy&&p(Te,{children:[" by ",t.value.uploadedBy]})]})]}),t.value?.width&&t.value?.height&&p("tr",{children:[p("td",{children:p("b",{children:"Dimensions"})}),p("td",{children:[t.value.width,"x",t.value.height]})]}),p("tr",{children:[p("td",{children:p("b",{children:"URL"})}),p("td",{children:p(yr,{readOnly:!0,value:t.value?.src,size:"xs",radius:0})})]})]})})]}):p(Te,{children:[t.value?.width&&t.value?.height&&p(_e,{radius:"sm",className:"FileField__Preview__Info",children:[t.value.width,"x",t.value.height]}),$L(t.value?.src)&&p("img",{onClick:()=>{t?.focusDropZone()},onDblClick:()=>{t?.requestFileUpload()},src:t.value.src,alt:t.value.alt||"Uploaded file preview",className:"FileField__Preview__Image"}),zL(t.value?.src)&&p(Te,{children:p("video",{className:"FileField__Preview__Image",controls:!0,muted:!0,preload:"metadata",children:p("source",{src:t.value.src,type:`video/${Ch(t.value.src)}`})})})]}),p("div",{className:"FileField__reupload",children:p(fi.UploadButton,{className:"FileField__reupload__button",compact:!0})})]}),t.showAltText&&(t.altText||CF(t.value?.filename)||t.variant==="image")&&p("div",{className:"DocEditor__ImageField__imagePreview__Image__Alt",children:[p(yr,{radius:0,className:"DocEditor__ImageField__imagePreview__Image__Alt__Textarea",value:t.altText,placeholder:"Alt text",size:"xs",autosize:!0,disabled:t.loadingState==="loading",onChange:u=>{t?.setAltText(u.currentTarget.value)}}),a.ai&&!t.altText&&t.value?.src?.startsWith("http")&&p(Se,{label:"Generate alt text with AI",position:"top",withArrow:!0,children:p(Je,{className:"DocEditor__ImageField__imagePreview__Image__Alt__AiButton",onClick:()=>{t.requestGenerateAltText(i)},disabled:t.loadingState==="loading",children:p(kb,{size:20,stroke:"1.75"})})})]})]}):null};fi.UploadButton=t=>{let e=Sy(),r=e.loadingState==="loading",o=t.compact?14:16;return p(re,{color:"black",variant:"default",disabled:r,size:t.compact?"compact-xs":"compact-md",className:De("FileField__FileUploadButton",t.compact&&"FileField__FileUploadButton--compact"),onClick:()=>{e.requestFileUpload()},leftIcon:p(Te,{children:r&&!t.compact?p(Ze,{size:o}):e?.variant==="image"?p(xS,{size:o}):p(ol,{size:o})}),children:r&&!t.compact?"Uploading...":e.value?.src?"Upload":"Paste, drop, or click to upload"})};fi.InvisibleDropzone=t=>{let[e,r]=M(!1),o=Sy();return p("div",{className:De("FileField__InvisibleDropzone",e&&"dragging"),onDragOver:n=>{n.preventDefault(),n.stopPropagation(),r(!0)},onDragLeave:n=>{n.preventDefault(),n.stopPropagation(),r(!1)},onDrop:n=>{n.preventDefault(),n.stopPropagation(),r(!1);let i=n.dataTransfer?.files[0];i&&o.handleFile(i)},children:t.children})};fi.Empty=()=>{let t=Sy(),e=ve(()=>t.acceptedFileTypes.length===0?"":t.acceptedFileTypes.map(r=>r.split("/").pop().split("+")[0].replaceAll(".","")).sort().join(", "),[t.acceptedFileTypes]);return p("div",{className:"FileField__Empty",children:[p("div",{className:"FileField__Empty__Label",children:[p(fi.UploadButton,{}),wae(t.acceptedFileTypes)&&p("div",{children:p(Se,{label:"Create placeholder image",children:p(Je,{className:"FileField__Empty__Label__PlaceholderButton",onClick:()=>{t.requestPlaceholderModalOpen()},title:"Create placeholder image",children:p(_S,{size:16})})})})]}),e&&p("div",{children:p("div",{className:"FileField__Empty__AcceptTypes",children:["Allowed file types: ",e]})})]})};fi.Dropzone=ee((t,e)=>{let[r,o]=M(!1),n=Sy();return p("button",{ref:e,className:De("FileField__Dropzone",r&&"dragging"),onDblClick:()=>{n?.requestFileUpload()},onCopy:i=>{n.value?.src&&(i.preventDefault(),i.clipboardData?.setData("text/plain",n.value.src),i.clipboardData?.setData("application/json",JSON.stringify(n.value)))},onKeyDown:i=>{((i.metaKey||i.ctrlKey)&&i.key==="Backspace"||i.key==="Delete")&&(i.preventDefault(),n.value?.src&&n.removeFile())},onDragOver:i=>{i.preventDefault(),o(!0)},onDragLeave:i=>{i.preventDefault(),o(!1)},onDrop:i=>{i.preventDefault(),o(!1);let a=i.dataTransfer?.files[0];a&&n&&n.handleFile(a)},onPaste:i=>{if(i.preventDefault(),!n)return;let a=i.clipboardData?.getData("application/json");if(a)try{let c=JSON.parse(a);if(c&&c.src&&c.filename&&n){console.log("Parsed JSON file:",c),n.setValue(c);return}}catch(c){console.error("error parsing json",c)}let s=i.clipboardData?.files[0];if(s){n.handleFile(s);return}let l=i.clipboardData?.getData("text/plain");if(l&&Eae(l)){n.handleFile(l,{as:"svg"});return}},title:"Drop or paste to upload a file"})});function CF(t){return t?$L(t)||zL(t):!1}function wae(t){return t.some(e=>e.startsWith("image/"))||t.length===0}function OGe(t){let e={};if(t.width&&t.height){e["--canvas-aspect-ratio"]=`${t.width} / ${t.height}`,e["--canvas-asset-width"]=`${t.width}px`;let r=Math.min(t.height,280);r<80&&(r=80),e["--canvas-max-height"]=`${r}px`}return t.canvasBgColor==="dark"&&(e["--canvas-bg-color"]="#000"),e}function Eae(t){return/^(?:\uFEFF)?\s*(?:<!--[\s\S]*?-->\s*)*(?:<\?xml[\s\S]*?\?>\s*)?(?:<!DOCTYPE\s+svg[\s\S]*?>\s*)?<svg\b[^>]*?(?:\/>|>[\s\S]*?<\/svg>)\s*$/.test(t)}function Sae(t){return p(fi,{...t,variant:"image"})}Pe();function Cae(t){let e=t.field,[r,o]=rn(t.deepKey,[]),n=ve(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return p("div",{className:"DocEditor__MultiSelectField",children:p(nE,{data:n,size:"xs",radius:0,placeholder:e.placeholder,value:r,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function Tae(t){let[e,r]=rn(t.deepKey,0);return p(cE,{size:"xs",radius:0,value:e,onChange:o=>r(o),hideControls:!0})}Pe();function eg(t){let e=t.field,[r,o]=rn(t.deepKey),n=r?.id||"";function i(l){o(l?NS(l):null)}let a=lre();function s(){let l=n?NS(n).collection:e.initialCollection;a.open({collections:e.collections,initialCollection:l,onChange:c=>{i(c),a.close()}})}return p("div",{className:"ReferenceField",children:[n?p("div",{className:"ReferenceField__ref",children:[p(eg.Preview,{id:n}),p("div",{className:"ReferenceField__remove",children:p(Se,{label:"Remove",children:p(Je,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:p(Hn,{size:16})})})})]}):p("div",{className:"ReferenceField__none",children:"None selected"}),p(re,{color:"dark",size:"xs",onClick:()=>s(),children:e.buttonLabel||"Select"})]})}eg.Preview=t=>{let[e,r]=M(!0),[o,n]=M(null);async function i(){r(!0),await er(async()=>{let a=await wS(t.id);n(a)}),r(!1)}return V(()=>{i()},[t.id]),p("div",{className:"ReferenceField__Preview",children:e?p("div",{className:"ReferenceField__Preview__loading",children:p(Ze,{color:"gray",size:"sm"})}):o?p(eg.DocCard,{doc:o}):p("div",{className:"ReferenceField__Preview__notfound",children:['Doc Not found: "',t.id,'" (was it deleted?). Select a new doc or remove using the trash icon to the right.']})})};eg.DocCard=t=>{let e=t.doc,r=e.id||e.sys?.id||"";if(!r)return p("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=NS(r).collection,n=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let a=Qo(n,i.preview?.title||"meta.title"),s=Qo(n,i.preview?.image||"meta.image")||i.preview?.defaultImage;return p("a",{className:"ReferenceField__DocCard",href:`/cms/content/${r}`,target:"_blank",children:[p("div",{className:"ReferenceField__DocCard__image",children:p(Qc,{src:s?.src,width:80,height:60,withPlaceholder:!s?.src})}),p("div",{className:"ReferenceField__DocCard__content",children:[p("div",{className:"ReferenceField__DocCard__content__header",children:p("div",{className:"ReferenceField__DocCard__content__header__docId",children:r})}),p("div",{className:"ReferenceField__DocCard__content__title",children:a||"[UNTITLED]"})]})]})};Pe();Pe();function tg(t){let e=t.docId,[r,o]=M(t.doc),[n,i]=M(!t.doc);async function a(){i(!0),await er(async()=>{let _=await wS(e);o(_)}),i(!1)}if(V(()=>{a()},[e]),n)return p("div",{className:De(t.className,"DocPreviewCard","DocPreviewCard--loading",t.variant&&`DocPreviewCard--${t.variant}`),children:p(Ze,{color:"gray",size:"sm"})});let[s,l]=e.split("/"),c=r.fields||{},u=window.__ROOT_CTX.collections[s];if(!u)throw new Error(`could not find collection: ${s}`);let d=Qo(c,u.preview?.title||"meta.title"),f=Qo(c,u.preview?.image||"meta.image")||u.preview?.defaultImage,m=fs({collectionId:s,slug:l}),h="div",g={};return t.clickable&&(h="a",g.href=`/cms/content/${t.docId}`,g.target="_blank"),p(h,{className:De(t.className,"DocPreviewCard",t.variant&&`DocPreviewCard--${t.variant}`),...g,children:[p("div",{className:"DocPreviewCard__image",children:p(Nh,{file:f,width:80,height:60,withPlaceholder:!f?.src})}),p("div",{className:"DocPreviewCard__content",children:[p("div",{className:"DocPreviewCard__content__header",children:[p("div",{className:"DocPreviewCard__content__header__docId",children:r.id}),t.statusBadges&&r&&p(Hh,{doc:r})]}),p("div",{className:"DocPreviewCard__content__title",children:d||"[UNTITLED]"}),t.variant!=="compact"&&m&&p("div",{className:"DocPreviewCard__content__url",children:m})]})]})}function kae(t){let e=t.field,[r,o]=M([]),n=Wn().controller;function i(c){if(c.length){let u=c.map(d=>{let[f,m]=d.split("/");return{id:d,collection:f,slug:m}});n.updateKey(t.deepKey,u)}else n.removeKey(t.deepKey);o(c)}ul(t.deepKey,c=>{Array.isArray(c)?o(c.map(u=>u.id)):o([])});let a=pC();function s(){a.open({collections:e.collections,initialCollection:e.initialCollection,selectedDocIds:r,onChange:(c,u)=>{o(d=>{let f=[...d];if(u)f.includes(c)||f.push(c);else{let m=f.indexOf(c);m>-1&&f.splice(m,1)}return i(f),f})}})}function l(c){let u=r.filter(d=>d!==c);i(u)}return p("div",{className:"ReferencesField",children:[r.length>0?p(lT,{onDragEnd:c=>{let{destination:u,source:d}=c;if(!u||u.index===d.index)return;let f=[...r],[m]=f.splice(d.index,1);f.splice(u.index,0,m),i(f)},children:p(uT,{droppableId:"ReferencesField__droppable",direction:"vertical",children:c=>p("div",{ref:c.innerRef,...c.droppableProps,className:"ReferencesField__refs",children:[r.map((u,d)=>p(cT,{draggableId:u,index:d,children:(f,m)=>p("div",{ref:f.innerRef,...f.draggableProps,className:De("ReferencesField__card",m.isDragging&&"ReferencesField__card--dragging"),children:[p("div",{className:"ReferencesField__card__handle",...f.dragHandleProps,children:p(vb,{size:16,stroke:"1.5"})}),p(tg,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0}),p("div",{className:"ReferencesField__card__controls",children:p(Se,{label:"Remove",children:p(Je,{className:"ReferencesField__card__controls__remove",onClick:()=>l(u),children:p(Hn,{size:16})})})})]})},u)),c.placeholder]})})}):p("div",{className:"ReferencesField__none",children:"None selected"}),p(re,{color:"dark",size:"xs",onClick:()=>s(),children:e.buttonLabel||"Select"})]})}Pe();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Ay=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $T(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function AGe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}),r}function TF(){}Object.assign(TF,{default:TF,register:TF,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;for(;--r>=0&&e.item(r)!==this;);return r>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(r=>{let o=r instanceof Node;e.appendChild(o?r:document.createTextNode(r))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,r=window.getComputedStyle(e,null),o=parseInt(r.getPropertyValue("border-top-width")),n=parseInt(r.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,a=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,s=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-n>e.scrollLeft+e.clientWidth,c=i&&!a;(i||a)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(s||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-n+this.clientWidth/2),(i||a||s||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var DGe=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),""),Vae=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(Vae||{}),Et={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},RGe={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function zy(t,e,r="log",o,n="color: inherit"){if(!("console"in window)||!window.console[r])return;let i=["info","log","warn","error"].includes(r),a=[];switch(zy.logLevel){case"ERROR":if(r!=="error")return;break;case"WARN":if(!["error","warn"].includes(r))return;break;case"INFO":if(!i||t)return;break}o&&a.push(o);let s="Editor.js 2.31.0-rc.7";t&&(i?(a.unshift(`line-height: 1em;
188
188
  color: #006FEA;
189
189
  display: inline-block;
190
190
  font-size: 11px;
@@ -244,5 +244,5 @@ ${He.current.stack}
244
244
  `}isInline(){return!1}updateDOM(){return!1}decorate(){return p(jZe,{nodeKey:this.__key})}};function GZe(){return{node:D3()}}function D3(){return Kn(new Av)}function WZe(t){return t instanceof Av}var Ck=R3,ehe=Ck.$createHorizontalRuleNode,the=Ck.$isHorizontalRuleNode,rhe=Ck.HorizontalRuleNode,SKt=Ck.INSERT_HORIZONTAL_RULE_COMMAND;var M3={};nr(M3,{DEFAULT_TRANSFORMERS:()=>ohe,MarkdownShortcutPlugin:()=>qZe});X();var ohe=[{dependencies:[rhe],export:t=>the(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,r,o)=>{let n=ehe();o||t.getNextSibling()!=null?t.replace(n):t.insertBefore(n),n.selectNext()},type:"element"},...Yme];function qZe({transformers:t=ohe}){let[e]=or();return V((()=>Jme(e,t)),[e,t]),null}var nhe=M3,OKt=nhe.DEFAULT_TRANSFORMERS,ihe=nhe.MarkdownShortcutPlugin;function ahe(){return p(ihe,{transformers:[qme,Xme,Kme]})}var L3={};nr(L3,{OnChangePlugin:()=>YZe});X();var KZe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ft:V;function YZe({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[o]=or();return KZe((()=>{if(r)return o.registerUpdateListener((({editorState:n,dirtyElements:i,dirtyLeaves:a,prevEditorState:s,tags:l})=>{e&&i.size===0&&a.size===0||t&&l.has(Bg)||s.isEmpty()||r(n,o,l)}))}),[o,t,e,r]),null}var XZe=L3,she=XZe.OnChangePlugin;Pe();function Tk(t){return t.getChildren().map(JZe).join("")}function JZe(t){if(Kr(t))return"<br>";if(_o(t))return`<a href="${t.getURL()}">${Tk(t)}</a>`;if(!Ke(t))return console.log("unhandled node"),console.log(t),"";let e=t.getTextContent();if(!e)return"";let r={s:t.hasFormat("strikethrough"),u:t.hasFormat("underline"),i:t.hasFormat("italic"),b:t.hasFormat("bold"),sup:t.hasFormat("superscript")};return QZe(e,r)}function QZe(t,e){let r=[];return Object.entries(e).forEach(([o,n])=>{n&&r.push(`<${o}>`)}),r.push(tet(t)),Object.entries(e).forEach(([o,n])=>{n&&r.push(`</${o}>`)}),r.join("")}function lhe(t){let e=[];return t.getChildren().forEach(r=>{Cv(r)&&e.push(ZZe(r))}),ret(e)}function ZZe(t){let e=t.getFirstChild();return e&&$i(e)?{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:lhe(e)}:{content:Tk(t)}}function che(){let t=[];for($r().getChildren().forEach(o=>{if(Cs(o)){let n={type:"paragraph",data:{text:Tk(o)}};t.push(n)}else if(fd(o)){let n=o.getTag().slice(1),i={type:"heading",data:{text:Tk(o),level:parseInt(n)}};t.push(i)}else if($i(o)){let n=o.getTag(),i={type:n==="ol"?"orderedList":"unorderedList",data:{style:n==="ol"?"ordered":"unordered",items:lhe(o)}};t.push(i)}});eet(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function eet(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text)}function tet(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ret(t){let e=[];return t.forEach(r=>{r.itemsType&&r.items&&e.length>0?(e.at(-1).itemsType=r.itemsType,e.at(-1).items=r.items):e.push(r)}),e}function uhe(t){let e=$r();e.clear();let r=t?.blocks||[];for(let o of r)if(o.type==="paragraph"){let n=hr();if(o.data.text){let i=F3(o.data.text);n.append(...i)}e.append(n)}else if(o.type==="heading"){let n=`h${o.data?.level||2}`,i=Jg(n);if(o.data.text){let a=F3(o.data.text);i.append(...a)}e.append(i)}else if(o.type==="orderedList"||o.type==="unorderedList"){let n=o.data.style==="ordered"?"number":"bullet",i=Sv(n);for(let a of o.data.items)i.append(...dhe(a,n));e.append(i)}}function F3(t){let e=document.createElement("template");e.innerHTML=t;let r=e.content,o=[];function n(i){if(i.nodeType===Node.TEXT_NODE)return xi(i.textContent||"");if(i.nodeType===Node.ELEMENT_NODE){let a=i,s=Array.from(a.childNodes).map(n).filter(l=>!!l).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return s.map(l=>(l.toggleFormat("bold"),l));case"i":case"em":return s.map(l=>(l.toggleFormat("italic"),l));case"u":return s.map(l=>(l.toggleFormat("underline"),l));case"s":return s.map(l=>(l.toggleFormat("strikethrough"),l));case"sup":return s.map(l=>(l.toggleFormat("superscript"),l));case"a":return[Kn(Hg(a.getAttribute("href")||"").append(...s))];default:return console.log("unhandled tag: "+a.tagName),console.log(s),s}}return null}return r.childNodes.forEach(i=>{let a=n(i);Array.isArray(a)?o.push(...a):a&&o.push(a)}),o}function dhe(t,e){let r=[];if(t.content){let o=oet(t,e);r.push(o)}if(t.items&&t.items.length>0){let o=net(t,e);r.push(o)}return r}function oet(t,e){let r=Ev();if(t.content){let o=F3(t.content);r.append(...o)}return r}function net(t,e){let r=Ev();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let n=Sv(o);for(let i of t.items)n.append(...dhe(i,o));r.append(n)}return r}function fhe(t){let[e]=or(),r=W(t.value?.time||0),o=W(!1);return V(()=>{let i=t.value?.time||0;i>r.current&&(r.current=i,e.update(()=>{o.current=!0,uhe(t.value)}))},[e,t.value]),p(she,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let a=che();r.current=a?.time||0,t.onChange&&t.onChange(a)})},ignoreSelectionChange:!0})}Pe();function phe(t){let{editor:e,setIsLinkEditMode:r}=t,{toolbarState:o}=fk();return V(()=>{let n=i=>{if(Mi(i,{}))return!1;if(Qpe(i))e_(e);else if(Zpe(i)){let{code:a}=i,s=`h${a[a.length-1]}`;hd(e,o.blockType,s)}else if(tme(i))bk(e,o.blockType);else if(eme(i))yk(e,o.blockType);else if(rme(i))e.dispatchCommand(un,"strikethrough");else if(ome(i))e.dispatchCommand(Ri,void 0);else if(nme(i))e.dispatchCommand(Xa,void 0);else if(ime(i))e.dispatchCommand(un,"subscript");else if(ame(i))e.dispatchCommand(un,"superscript");else if(sme(i))pme(e);else if(lme(i)){let a=o.isLink?null:Cp("https://");r(!o.isLink),e.dispatchCommand(Fi,a)}else return!1;return i.preventDefault(),!0};return e.registerCommand(ode,n,jue)},[e,o.isLink,o.blockType,r]),null}var iet={namespace:"RootCMS",theme:Npe,nodes:[nfe,uk,Gg,wl,dd],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function hhe(t){return p(Pfe,{initialConfig:iet,children:p(Spe,{children:p(kpe,{children:p("div",{className:De(t.className,"LexicalEditor"),children:p(aet,{placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur})})})})})}function aet(t){let{historyState:e}=Cpe(),[r]=or(),[o,n]=M(r),[i,a]=M(!1),[s,l]=M(null),c=u=>{u&&l(u)};return p(Te,{children:[p(fhe,{value:t.value,onChange:t.onChange}),p(hme,{editor:r,activeEditor:o,setActiveEditor:n,setIsLinkEditMode:a}),p(phe,{editor:o,setIsLinkEditMode:a}),p(Gfe,{externalHistoryState:e}),p(ype,{contentEditable:p("div",{className:"LexicalEditor__scroller",children:p("div",{className:"LexicalEditor__root",ref:c,children:p(Ffe,{className:"LexicalEditor__editor",placeholder:p(cet,{placeholder:t.placeholder})})})}),ErrorBoundary:$fe}),p(qfe,{}),p(Kfe,{}),p(wpe,{maxIndent:7}),p(ahe,{}),s&&p(Te,{children:[p(gme,{anchorElem:s,setIsLinkEditMode:a}),p(Ape,{anchorElem:s,isLinkEditMode:i,setIsLinkEditMode:a})]})]})}var mhe=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Your masterpiece begins here...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance..."];function set(){let t=Math.floor(Math.random()*mhe.length);return mhe[t]}function cet(t){let e=ve(()=>t.placeholder||set(),[]);return p("div",{className:"LexicalEditor__placeholder",children:e})}function ghe(t){return UC().preferences.EnableLexicalEditor?p(hhe,{...t}):p(Jse,{...t})}function _he(t){let e=t.field,[r,o]=M(null),n=Wn().controller,i=a=>{o(s=>(s?.time!==a?.time&&n.updateKey(t.deepKey,a),a))};return ul(t.deepKey,a=>{o(a)}),p(ghe,{value:r,placeholder:e.placeholder,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur})}Pe();function xhe(t){let e=t.field,[r,o]=rn(t.deepKey,""),n=ve(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return p("div",{className:"DocEditor__SelectField",children:p(Er,{data:n,placeholder:e.placeholder,value:r,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,dropdownComponent:"div"})})}function bhe(t){let e=t.field,[r,o]=rn(t.deepKey,""),n=s=>{o(s.currentTarget.value)},i=s=>{t.onFocus?.(s),Va(t.deepKey,{scroll:!0})},a=s=>{t.onBlur?.(s),Va(null)};return e.variant==="textarea"?p(yr,{size:"xs",radius:0,autosize:!1,minRows:4,maxRows:e.maxRows||12,value:r,onChange:n,onFocus:i,onBlur:a}):p(ir,{size:"xs",radius:0,value:r,onChange:n,onFocus:i,onBlur:a})}var vhe=ft({});function Nk(){return lt(vhe)}function wr(t){let e=t.docId.split("/")[0],r=HC(e),o=Wn(),n=r.loading||o.loading,i=r.schema?.fields||[];return p(vhe.Provider,{value:r?.schema?.types||{},children:p(sae,{children:p("div",{className:"DocEditor",children:[p(ka,{visible:n,loaderProps:{color:"gray",size:"xl"}}),!n&&p(wr.StatusBar,{...t,draft:o,collection:r.schema}),p("div",{className:"DocEditor__fields",children:i.map(a=>p(wr.Field,{field:a,deepKey:`fields.${a.id}`},a.id))})]})})})}wr.StatusBar=t=>{let e=t.draft,[r,o]=M(e.controller.getData());ul("sys",l=>{o({sys:l})});let n=qe(l=>{if(l.action==="delete"){let c=t.docId.split("/")[0];mo(`/cms/content/${c}`)}else l.action==="unlocked"&&e.controller.removePublishingLock()},[t.docId]),i=Ooe({docId:t.docId}),a=gre(),s=!r?.sys;return s?null:p("div",{className:"DocEditor__statusBar",children:[p("div",{className:"DocEditor__statusBar__viewers",children:p(xae,{id:`doc/${t.docId}`})}),p(wr.SaveState,{}),r?.sys&&p("div",{className:"DocEditor__statusBar__statusBadges",children:p(Hh,{doc:r})}),p("div",{className:"DocEditor__statusBar__i18n",children:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(TM,{size:16}),onClick:()=>a.open({docId:t.docId,collection:t.collection,draft:e.controller}),children:"Localization"})}),p("div",{className:"DocEditor__statusBar__publishButton",children:s?p(re,{color:"dark",size:"xs",onClick:()=>i.open(),loading:!0,disabled:!0,children:"Publish"}):CS(r)?p(Se,{label:`Scheduled ${IS(r.sys.scheduledAt)} by ${r.sys.scheduledBy}`,transition:"pop",children:p(re,{color:"dark",size:"xs",leftIcon:p(mh,{size:16}),disabled:!0,children:"Publish"})}):Cf(r)?p(Se,{label:`Locked by ${r.sys.publishingLocked.lockedBy}: "${r.sys.publishingLocked.reason}"`,transition:"pop",children:p(re,{color:"dark",size:"xs",leftIcon:p(If,{size:16}),disabled:!0,children:"Publish"})}):p(re,{color:"dark",size:"xs",leftIcon:p(mh,{size:16}),onClick:()=>i.open(),children:"Publish"})}),p("div",{className:"DocEditor__statusBar__actionsMenu",children:p(VC,{docId:t.docId,data:r,onAction:n})})]})};wr.SaveState=()=>{let[t,e]=M("NO_CHANGES");return pae(r=>{e(r)}),p("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};wr.Field=t=>{let e=t.field,r=t.level??0,n=wy().value===t.deepKey,i=W(null),[a,s]=M(!0),l=Nk(),c=ve(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return ul(t.deepKey,u=>{s(Zh(e,u,l))}),V(()=>{n&&wF(i.current)},[n]),e.deprecated&&a?null:p("div",{className:De("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",n&&"deeplink-target"),"data-type":e.type,"data-level":r,id:t.deepKey,ref:i,children:[c&&p(wr.FieldHeader,{...t}),p("div",{className:"DocEditor__field__input",children:e.type==="array"?p(wr.ArrayField,{...t}):e.type==="boolean"?p(bae,{...t}):e.type==="date"?p(yae,{...t}):e.type==="datetime"?p(vae,{...t}):e.type==="file"?p(fi,{...t}):e.type==="image"?p(Sae,{...t}):e.type==="multiselect"?p(Cae,{...t}):e.type==="number"?p(Tae,{...t}):e.type==="object"?p(wr.ObjectField,{...t}):e.type==="oneof"?p(wr.OneOfField,{...t}):e.type==="reference"?p(eg,{...t}):e.type==="references"?p(kae,{...t}):e.type==="richtext"?p(_he,{...t}):e.type==="select"?p(xhe,{...t}):e.type==="string"?p(bhe,{...t}):p("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};wr.FieldHeader=t=>{let e=t.field,r=e.label||e.id,[o,n]=M(null),i=wy(),a=ve(()=>lae(t.deepKey||""),[t.deepKey]);return ul(t.deepKey,s=>{n(s)}),p("div",{className:De(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?p("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",r]}):p("div",{className:"DocEditor__FieldHeader__label",children:[p("span",{children:r}),t.deepKey&&p("a",{className:"DocEditor__FieldHeader__label__deeplink",href:a,title:"Link to field",onClick:s=>{s.preventDefault(),window.history.replaceState({},"",a),i.setValue(t.deepKey)},children:"#"})]}),e.help&&p("div",{className:"DocEditor__FieldHeader__help",children:e.help}),p(wr.FieldHeaderTranslationsActionIcon,{field:e,value:o})]})};wr.FieldHeaderTranslationsActionIcon=t=>{let e=t.field,r=t.value,o=!!e.translate,i=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],a=cre(),s=Wn(),l=Nk(),c=ve(()=>!o||Zh(e,r,l),[e,r]);return!o||i.length<=1?null:p("div",{className:"DocEditor__FieldHeader__translate",children:c?p("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:p(Eu,{size:16})}):p(Se,{label:"Show translations",children:p(Je,{size:"xs",onClick:()=>{let u=s.controller.getData();if(!u)return;let d=new Set;xC(d,e,r,l);let f=Array.from(d);a.open({docId:s.controller.docId,strings:f,l10nSheet:u?.sys?.l10nSheet})},children:p(Eu,{size:16})})})})};wr.ObjectField=t=>{let e=t.field,r=e.variant;return r||(t.isArrayChild?r="inline":r="drawer"),r==="drawer"?p(wr.ObjectFieldDrawer,{...t}):p("div",{className:"DocEditor__ObjectField",children:p("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>p(wr.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};wr.ObjectFieldDrawer=t=>{let e=t.field,r=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,n=o?"left":"right",i=wy(),a=!r||i.value.includes(t.deepKey);return p("div",{className:De("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:p("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:a,children:[p("summary",{className:De("DocEditor__ObjectFieldDrawer__drawer__toggle",`DocEditor__ObjectFieldDrawer__drawer__toggle--icon-${n}`),children:[p(wr.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),p("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:p(wu,{size:16})})]}),p("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(s=>p(wr.Field,{field:s,deepKey:`${t.deepKey}.${s.id}`},s.id))})]})})};function uet(t,e){switch(e.type){case"update":{let r=t._new||[];return{...e.newValue,_new:r}}case"updateItem":{let r=t??{},n=[...r._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${n}`,i),{...r,[n]:i}}case"add":{let r=t??{},o=ra(),n=[...r._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:n,[`${e.deepKey}.${o}`]:{}});let i=t._new||[];return{...r,[o]:{},_array:n,_new:[...i,o]}}case"insertBefore":{let r=t??{},o=[...r._array||[]],n=ra();o.splice(e.index,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:{}});let i=t._new||[];return{...r,[n]:{},_array:o,_new:[...i,n]}}case"insertAfter":{let r=t??{},o=[...r._array||[]],n=ra();o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:{}});let i=t._new||[];return{...r,[n]:{},_array:o,_new:[...i,n]}}case"duplicate":{let r=t??{},o=[...r._array||[]],n=ra(),i=structuredClone(e.value);o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}case"moveUp":{if(e.index===0)return t;let r=t??{},o=[...r._array||[]];return yhe(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:o[e.index-1]}}case"moveDown":{let r=t??{},o=[...r._array||[]];return e.index>=o.length-1?t:(yhe(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:o[e.index+1]})}case"moveTo":{let r=t??{},o=[...r._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let n=o[e.fromIndex];return det(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:n}}case"removeAt":{let r={...t??{}},n=[...r._array||[]],i=n[e.index];return delete r[i],n.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:n}),e.draft.removeKey(`${e.deepKey}.${i}`),{...r,_array:n}}case"pasteAfter":{let r=t??{},o=[...r._array||[]],n=ra(),i=e.data;if(!i)return Ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}case"pasteBefore":{let r=t??{},o=[...r._array||[]],n=ra(),i=e.data;if(!i)return Ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}default:return console.error("unknown action",e),t}}wr.ArrayField=t=>{let e=Wn().controller,r=t.field,[o,n]=Qn(uet,{_array:[]}),i=wy(),a=mae(),s=window.__ROOT_CTX.experiments||{},c=(o??{})._array||[],u=o._new||[];ul(t.deepKey,B=>{n({type:"update",newValue:B})}),V(()=>{o._moved&&v(t.deepKey,c.indexOf(o._moved))},[o]);let d=B=>{let $=c[B],z=`${t.deepKey}.${$}`;return e.getValue(z)||{}},f=()=>{n({type:"add",draft:e,deepKey:t.deepKey})},m=(B,$)=>{n({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:B,data:$})},h=(B,$)=>{n({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:B,data:$})},g=B=>{n({type:"insertBefore",draft:e,deepKey:t.deepKey,index:B})},_=B=>{n({type:"insertAfter",draft:e,deepKey:t.deepKey,index:B})},b=B=>{n({type:"duplicate",draft:e,deepKey:t.deepKey,index:B,value:d(B)})},y=B=>{n({type:"removeAt",draft:e,deepKey:t.deepKey,index:B})},v=(B,$)=>{document.getElementById(`summary-for-${B}.${c[$]}`)?.focus()},C=B=>{B>0&&n({type:"moveUp",draft:e,deepKey:t.deepKey,index:B})},N=B=>{B<c.length-1&&n({type:"moveDown",draft:e,deepKey:t.deepKey,index:B})},I=B=>{let $=d(B);a.set($)},E=mC(),w=qte(),S=B=>{let $=d(B);E.open({data:$,onSave:z=>{console.log("[edit json] onSave()",z),n({type:"updateItem",draft:e,index:B,newValue:z,deepKey:t.deepKey}),E.close()}})},T=B=>{let $=d(B);w.open({data:$,onSave:z=>{console.log("[ai edit] onSave()",z),n({type:"updateItem",draft:e,index:B,newValue:z,deepKey:t.deepKey}),w.close()}})};function A(B){return!!i.value.startsWith(`${t.deepKey}.${B}`)}let R=qe((B,$)=>{B.target&&(B.key==="ArrowUp"?(B.preventDefault(),C(c.indexOf($))):B.key==="ArrowDown"?(B.preventDefault(),N(c.indexOf($))):B.key==="ArrowLeft"?B.target.closest("details").open=!1:B.key==="ArrowRight"&&(B.target.closest("details").open=!0))},[t.deepKey]),P=p("div",{className:"DocEditor__ArrayField__add",children:p(re,{color:"dark",size:"xs",leftIcon:p(ph,{size:16}),onClick:()=>f(),children:r.buttonLabel||"Add"})});return c.length===0&&!o._new?p("div",{className:"DocEditor__ArrayField",children:[p("div",{className:"DocEditor__ArrayField__items",children:p("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),P]}):p("div",{className:"DocEditor__ArrayField",children:[p(lT,{onDragEnd:B=>{let{source:$,destination:z}=B;z&&n({type:"moveTo",fromIndex:$.index,toIndex:z.index,draft:e,deepKey:t.deepKey})},children:p(uT,{droppableId:"dnd-list",direction:"vertical",children:B=>p("div",{...B.droppableProps,ref:B.innerRef,className:"DocEditor__ArrayField__items",children:[c.map(($,z)=>p(cT,{index:z,draggableId:$,children:(H,G)=>p("div",{ref:H.innerRef,...H.draggableProps,className:De("DocEditor__ArrayField__item__wrapper",G.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging"),children:[p("div",{className:"DocEditor__ArrayField__item__handle",...H.dragHandleProps,children:p(vb,{size:18,stroke:"1.5"})}),p("details",{className:"DocEditor__ArrayField__item",open:u.includes($)||A($),onToggle:Y=>{Y.target.open?Va(`${t.deepKey}.${c[z]}`,{scroll:!0}):Va(null)},onMouseEnter:()=>{Va(`${t.deepKey}.${c[z]}`)},onMouseLeave:()=>{Va(null)},children:[p("summary",{id:`summary-for-${t.deepKey}.${c[z]}`,className:"DocEditor__ArrayField__item__header",onKeyDown:Y=>R(Y,$),tabIndex:0,children:[p("div",{className:"DocEditor__ArrayField__item__header__icon",children:p(PM,{size:6})}),p(wr.ArrayFieldPreview,{field:r,deepKey:`${t.deepKey}.${$}`,index:z}),p("div",{className:"DocEditor__ArrayField__item__header__controls",children:[p("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[p("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>C(z),children:p(oM,{size:20,strokeWidth:1.75})}),p("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>N(z),children:p(rM,{size:20,strokeWidth:1.75})})]}),p(je,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:p(Je,{className:"DocEditor__ArrayField__item__header__controls__dots",children:p(bf,{size:16})}),children:[p(je.Label,{children:"INSERT"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(vS,{size:18}),onClick:()=>g(z),children:"Add before"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(yS,{size:18}),onClick:()=>_(z),children:"Add after"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(nc,{size:18}),onClick:()=>b(z),children:"Duplicate"}),p(je.Label,{children:"CLIPBOARD"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(iM,{size:18}),onClick:()=>I(z),children:"Copy"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(vS,{size:18}),onClick:async()=>m(z,await a.get()),children:"Paste before"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(yS,{size:18}),onClick:async()=>h(z,await a.get()),children:"Paste after"}),p(je.Label,{children:"CODE"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(gb,{size:18}),onClick:()=>S(z),children:"Edit JSON"}),s.ai&&p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(kb,{size:18,stroke:"1.75"}),onClick:()=>T(z),children:"Edit with AI"}),p(je.Label,{children:"REMOVE"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(Hn,{size:18}),onClick:()=>y(z),children:"Remove"})]})]})]}),p("div",{className:"DocEditor__ArrayField__item__body",children:p(wr.Field,{field:r.of,deepKey:`${t.deepKey}.${$}`,hideHeader:!0,isArrayChild:!0,onFocus:()=>{Va(`${t.deepKey}.${$}`,{scroll:!0})},onBlur:()=>{Va(null)}},`${t.deepKey}.${$}`)})]},$)]})},$)),B.placeholder]})})}),P]})};wr.ArrayFieldPreview=t=>{let e=Wn().controller,[r,o]=M(e.getValue(t.deepKey)),n=ve(()=>pet(t.field,r),[r]),i=ve(()=>met(t.field,r,t.index),[r,t.index]),a=qe(dT(()=>{let s=e.getValue(t.deepKey);o({...s})},250),[t.deepKey,e]);return V(()=>e.on("VALUE_CHANGE",(s,l)=>{s===t.deepKey?o(l):s.startsWith(t.deepKey)&&a()}),[t.deepKey,e]),p("div",{className:"DocEditor__ArrayField__item__header__preview",children:[n&&p("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:p("img",{src:n,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),p("div",{className:"DocEditor__ArrayField__item__header__preview__title",children:i})]})};wr.OneOfField=t=>{let e=t.field,[r,o]=M(""),n=Nk(),i={},a=[{value:"",label:e.placeholder||"Select type"}];e.types.forEach(f=>{typeof f=="string"?(i[f]=n[f],a.push({value:f,label:f})):(i[f.name]=f,a.push({value:f.name,label:f.name}))});let s=i[r||""],l=Wn().controller,c=ve(()=>({}),[]);async function u(f){let m={};if(f){if(f in c){let h=c[f];Object.assign(m,h)}else if(f in i){let h=ty(i[f]);Object.assign(m,h)}}m._type=f,await l.updateKey(t.deepKey,m),o(f)}ul(t.deepKey,f=>{f?._type&&(o(f._type||""),c[f._type]=f)});function d(f){let m=f.target;m&&m.select&&m.select()}return p("div",{className:"DocEditor__OneOfField",children:[p("div",{className:"DocEditor__OneOfField__select",children:[p("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),p(Er,{data:a,value:r,placeholder:e.placeholder,onChange:f=>u(f||""),onFocus:d,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),s&&p("div",{className:"DocEditor__OneOfField__fields",children:s.fields.map(f=>p(wr.Field,{field:f,deepKey:`${t.deepKey}.${f.id}`,onBlur:()=>{Va(null)},onFocus:()=>{Va(`${t.deepKey}.${f.id}`,{scroll:!0})}},`${r}::${f.id}`))})]})};function yhe(t,e,r){if(t.length<=1)return t;let o=t[e];return t[e]=t[r],t[r]=o,t}function det(t,e,r){let[o]=t.splice(e,1);t.splice(r,0,o)}function Ihe(t,e,r="title"){let o=Nk();if(t.type==="oneof"){let n=t,i=e?._type;if(i){let a,s=n.types||[];return typeof s[0]=="string"?a=o[i]:a=s.find(l=>l.name===i),a?.preview?.[r]||null}}return null}function fet(t){let e=t?.blocks||[];for(let r of e)if(r.type==="paragraph"){let o=r.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
245
245
  `),o=o.replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ");let n=o.split(/\r?\n/)[0].trim();if(n)return n}}var kk=class extends Error{};function B3(t,e,r){let o=Array.isArray(t)?t:[t],n=i=>{if(r!==void 0){if(i==="_index"||i==="_index0")return String(r);if(i==="_index1")return String(r+1);if(i==="_index:02")return String(r).padStart(2,"0");if(i==="_index:03")return String(r).padStart(3,"0")}let a=Qo(e,i);if(!a)throw new kk(i);if(hh(a)){let s=fet(a);if(s)return s}return String(a)};for(let i of o)try{return hae(i,n)}catch(a){if(a instanceof kk)continue;throw a}}function pet(t,e){let r=Ihe(t.of,e,"image");if(r)return B3(r,e)}function met(t,e,r){let o=Ihe(t.of,e,"title");if(o){let n=B3(o,e,r);if(n)return n}return t.preview?B3(t.preview,e,r)??`item ${r}`:`item ${r}`}function Pk(t,e,r=""){let o=iC({collectionId:t,slug:e}),n=new URLSearchParams(window.location.search);n.set("preview","true"),n.has("locale")&&n.delete("locale");let i=`${n.toString()}${window.location.hash}`;return r?`${iC({collectionId:t,slug:e,locale:r})}?${i}`:`${o}?${i}`}function Ok(t){let e=t.collection,r=t.slug,o=`${e}/${r}`;return p(fae,{docId:o,children:p(het,{...t})})}function het(t){let e=t.collection,r=t.slug,o=`${e}/${r}`,n=window.__ROOT_CTX.collections[e],i=Wn(),[a,s]=Hf(`root::DocumentPage::previewVisible::${e}`,!0);if(!n)return p("div",{children:"Could not find collection."});function l(){let f=Pk(e,r),m=window.open(f,"_blank","noopener,noreferrer");m&&m.focus()}let c=qe(()=>{i.controller&&i.controller.flush()},[i.controller]),u=mC(),d=qe(()=>{let f=i.controller?.getData()?.fields||{};u.open({data:f,onSave:m=>{i.controller&&m&&typeof m=="object"&&(i.controller.updateKey("fields",m),i.controller.flush()),u.close()}})},[i.controller]);return VN([["mod+S",c]]),p(Fe,{children:p(fc,{className:"DocumentPage",localStorageId:"DocumentPage",children:[p(fc.Item,{className:De("DocumentPage__side",!a&&"DocumentPage__side--expanded"),children:[p("div",{className:"DocumentPage__side__header",children:[p("div",{className:"DocumentPage__side__header__nav",children:[p("a",{href:`/cms/content/${e}`,children:p(Je,{className:"DocumentPage__side__header__back",children:p(ZR,{size:16})})}),p("div",{className:"DocumentPage__side__header__docId",children:o})]}),p("div",{className:"DocumentPage__side__header__buttons",children:[p(re,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:p(bb,{size:16}),onClick:()=>c(),children:"Save"}),p(Se,{label:"Edit JSON",children:p(Je,{className:"DocumentPage__side__header__editJson",onClick:()=>d(),children:p(gb,{size:14})})}),p(Se,{label:a?"Hide preview":"Show preview",children:p(Je,{className:"DocumentPage__side__header__previewToggle",onClick:()=>s(!a),children:a?p(vM,{size:16}):p(IM,{size:16})})}),!a&&p(Se,{label:"Open preview in new tab",children:p(Je,{className:"DocumentPage__side__header__openNewTab",onClick:l,children:p(Iu,{size:16})})})]})]}),p("div",{className:De("DocumentPage__side__editor",!a&&"DocumentPage__side__editor--centered"),children:p(wr,{docId:o})})]}),p(fc.Item,{className:De("DocumentPage__main",!a&&"DocumentPage__main--hidden"),fluid:!0,children:a&&p(Ok.Preview,{docId:o},o)})]})})}var whe={mobile:[360,800],tablet:[768,1024],desktop:[1440,800]};function get(t){let e=new Intl.DisplayNames(["en"],{type:"language"}),o=t.split("_")[0];return`${e.of(o)||t} (${t})`}Ok.Preview=t=>{let e=Wn();if(e.loading)return null;let[r,o]=t.docId.split("/"),i=window.__ROOT_CTX.collections[r];if(!i)throw new Error(`collection not found: ${r}`);let a=i.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",s=HL({collectionId:r,slug:o}),l=iC({collectionId:r,slug:o}),c=`${a}${s}`,[u,d]=M(c),[f,m]=Hf("root::DocumentPage::preview::device",""),[h,g]=M({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[_,b]=sne("locale",""),y=W(null),v=e.controller.getLocales()||[],C=rne(),N=Pk(r,o),I=Pk(r,o,_),E=[{value:"",label:"Select locale"},...v.map(P=>({value:P,label:get(P)}))];function w(){let P=y.current;P.src="about:blank",window.setTimeout(()=>{P.src!==I?P.src=I:P.contentWindow.location.reload()},30)}V(()=>{let P=y.current;function B(){let z=P.contentWindow;if(z&&l===s&&!z.location.href.startsWith("about:blank")){let H=z.location.pathname;d(`${a}${H}`)}}P.addEventListener("load",B);let $=e.controller?.onFlush(()=>{w()});return()=>{$(),P.removeEventListener("load",B)}},[]),V(()=>{let P=y.current;P.src=I},[_]);function S(P){m(B=>B===P?"":P)}function T(){e.controller&&e.controller.flush().then(()=>w())}function A(){let P=Pk(r,o,_),B=window.open(P,"_blank","noopener,noreferrer");B&&B.focus()}function R(){if(f===""){g({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"});return}let $=y.current.parentElement.parentElement.getBoundingClientRect(),[z,H]=whe[f],G=20,Y=1;(z>$.width-2*G||H>$.height-2*G)&&(Y=Math.min(($.width-2*G)/z,($.height-2*G)/H)),g({"--iframe-width":`${z}px`,"--iframe-height":`${H}px`,"--iframe-scale":String(Y)})}return V(()=>{R();let P=C.onResize(R);return window.addEventListener("resize",R),()=>{P(),window.removeEventListener("resize",R)}},[f,C]),p("div",{className:"DocumentPage__main__preview",children:[p("div",{className:"DocumentPage__main__previewBar",children:[p("div",{className:"DocumentPage__main__previewBar__devices",children:[p(Se,{label:"Mobile",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="mobile"&&"active"),onClick:()=>S("mobile"),children:p(uM,{size:16})})}),p(Se,{label:"Tablet",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="tablet"&&"active"),onClick:()=>S("tablet"),children:p(cM,{size:16})})}),p(Se,{label:"Desktop",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="desktop"&&"active"),onClick:()=>S("desktop"),children:p(lM,{size:16})})})]}),p("div",{className:"DocumentPage__main__previewBar__navbar",children:p("div",{className:"DocumentPage__main__previewBar__navbar__url",children:u})}),p("div",{className:"DocumentPage__main__previewBar__locales",children:p(Er,{data:E,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:p(OM,{size:16,strokeWidth:1.5}),value:_,onChange:P=>{b(P)}})}),p("div",{className:"DocumentPage__main__previewBar__buttons",children:[p(Se,{label:"Reload",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--reload",onClick:()=>T(),children:p(kM,{size:16})})}),p(Se,{label:"Open new tab",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--openNewTab",onClick:()=>A(),children:p(Iu,{size:16})})})]})]}),p("div",{className:"DocumentPage__main__previewFrame","data-device":f||"full",style:h,children:[f&&p("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${f}: ${whe[f].join("x")}`}),p("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:p("iframe",{ref:y,src:N,title:"iframe preview"})})]})]})};Pe();var _et="Enter the URL to make the HTTP request.",xet="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ak(t){let e=W(null),r=Mu(),[o,n]=M(!1),[i,a]=M(r.enabled?"gsheet":"http"),[s,l]=M("map"),[c,u]=M("GET"),[d,f]=M(""),[m,h]=M(!!t.dataSourceId),[g,_]=M(null),b="";i==="http"?b=_et:i==="gsheet"&&(b=xet);async function y(N){await er(async()=>{let I=await Ff(N);_(I),a(I?.type||"http"),l(I?.dataFormat||"map")}),h(!1)}V(()=>{t.dataSourceId&&(h(!0),y(t.dataSourceId))},[t.dataSourceId]);async function v(){f("");let N=e.current;function I(T){let A=N.elements[T];return A?A.value.trim():""}let E=t.dataSourceId||I("id");if(!E){f("missing id");return}if(!sl(E)){f("id is invalid (alphanumeric characters and dashes only)");return}let w=I("url");if(!w){f("missing url");return}let S={id:E,description:I("description"),type:i,url:w,previewUrl:I("previewUrl")};if(i==="http"){if(!bet(w)){f("invalid url");return}S.httpOptions={method:c};let T=I("httpHeaders");if(T&&(S.httpOptions.headers=yet(T)),c==="POST"){let A=I("httpBody");A&&(S.httpOptions.body=A)}}else if(i==="gsheet"){if(!Au(w)?.spreadsheetId){f("failed to parse spreadsheet url");return}S.dataFormat=s||"map"}try{_(S),n(!0),t.dataSourceId?(await ere(t.dataSourceId,S),Ae({title:"Saved data source",message:`Successfully updated ${E}`,autoClose:5e3}),n(!1)):(await Zte(E,S),Ae({title:"Added data source",message:`Successfully added ${E}`,autoClose:5e3}),n(!1),mo(`/cms/data/${E}`))}catch(T){console.error(T),Ae({title:"Failed to save data source",message:String(T),color:"red",autoClose:!1}),n(!1)}}let C=[{value:"http",label:"HTTP"}];return(r.enabled||i==="gsheet")&&C.push({value:"gsheet",label:"Google Sheet"}),p("form",{className:"DataSourceForm",ref:e,onSubmit:N=>{N.preventDefault(),v()},children:[p(ka,{visible:m}),p("div",{className:"DataSourceForm__input",children:p(Er,{name:"type",label:"Type",data:C,value:i,onChange:N=>a(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(ir,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.dataSourceId,disabled:!!t.dataSourceId}),p(yr,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:g?.description}),p(ir,{className:"DataSourceForm__input",name:"url",label:"URL",description:b,size:"xs",radius:0,value:g?.url}),i==="http"&&p(Te,{children:[p("div",{className:"DataSourceForm__input",children:p(Er,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:c,onChange:N=>u(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(yr,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:vet(g?.httpOptions?.headers||{})}),c==="POST"&&p(yr,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:g?.httpOptions?.body})]}),i==="gsheet"&&p("div",{className:"DataSourceForm__input",children:[p(Er,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:s,onChange:N=>l(N),size:"xs",radius:0,dropdownComponent:"div"}),s==="array"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",p("code",{children:"[[header1, header2], [foo, bar]]"})]}),s==="map"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",p("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),p(ir,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:g?.previewUrl}),p(re,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:o,children:t.buttonLabel||"Save"}),d&&p("div",{className:"DataSourceForm__error",children:["Error: ",d]})]})}function bet(t){let e,r=t.startsWith("/")?"http://localhost":void 0;try{e=new URL(t,r)}catch(o){return console.error(o),!1}return e.protocol==="http:"||e.protocol==="https:"}function yet(t){let e={};return t.split(`
246
246
  `).forEach(o=>{let n=o.indexOf(":");if(n===-1)return;let i=o.slice(0,n).trim(),a=o.slice(n+1).trim();i&&a&&(e[i]=a)}),e}function vet(t){let e=[];for(let r in t){let o=t[r];e.push(`${r}: ${o}`)}return e.join(`
247
- `)}function Ehe(t){let e=Ct(),r=Vt();function o(){let n=`delete-data-source-${t.id}`,i=e.openConfirmModal({...r,title:"Delete data source",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",p("code",{children:t.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting data source",message:`Deleting ${t.id} and synced data...`,loading:!0,autoClose:!1}),await nre(t.id),Ht({id:n,title:"Deleted data source",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/data")}})}return p(Fe,{children:p("div",{className:"EditDataSourcePage",children:[p("div",{className:"EditDataSourcePage__header",children:[p(Io,{className:"EditDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("a",{href:`/cms/data/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditDataSourcePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Data Source: ",t.id]}),p("div",{className:"EditDataSourcePage__header__controls",children:p(Se,{label:"Delete",children:p(Je,{onClick:o,children:p(Ob,{size:20,stroke:"1.5"})})})})]})]}),p(Ak,{dataSourceId:t.id})]})})}Pe();function _d(t){let e=W(null),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(!!t.releaseId),[l,c]=M(null),[u,d]=M([]),[f,m]=M([]),h=pC(),g=are();async function _(I){console.log(I),await er(async()=>{let E=await Vf(I);c(E),d(E?.docIds||[]),m(E?.dataSourceIds||[])}),s(!1)}V(()=>{t.releaseId&&(s(!0),_(t.releaseId))},[t.releaseId]);async function b(){i("");let I=e.current;function E(T){let A=I.elements[T];return A?A.value.trim():""}let w=t.releaseId||E("id");if(!w){i("missing id");return}if(!sl(w)){i("id is invalid (alphanumeric characters and dashes only)");return}let S={id:w,description:E("description"),docIds:u,dataSourceIds:f};try{c(S),o(!0),t.releaseId?(await Roe(t.releaseId,S),Ae({title:"Saved release",message:`Updated ${w}`,autoClose:5e3}),o(!1)):(await Aoe(w,S),Ae({title:"Added release",message:`Successfully added ${w}`,autoClose:5e3}),o(!1)),mo(`/cms/releases/${w}`)}catch(T){console.error(T),Ae({title:"Failed to save release",message:String(T),color:"red",autoClose:!1}),o(!1)}}function y(){h.open({selectedDocIds:u,onChange:(I,E)=>{d(w=>{let S=[...w];if(E)S.push(I);else{let T=S.findIndex(A=>A===I);T>-1&&S.splice(T,1)}return console.log(S),S.sort()})}})}function v(){g.open({selectedDataSourceIds:f,onChange:(I,E)=>{m(w=>{let S=[...w];if(E)S.push(I);else{let T=S.indexOf(I);T>-1&&S.splice(T,1)}return S.sort()})}})}function C(I){console.log("onRemoveDoc()",I),d(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),console.log(w),w})}function N(I){m(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),w})}return p("form",{className:"ReleaseForm",ref:e,onSubmit:I=>{I.preventDefault(),b()},children:[p(ka,{visible:a}),p(ir,{className:"ReleaseForm__input",name:"id",label:"ID",description:"Unique identifier for the release. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.releaseId,disabled:!!t.releaseId}),p(yr,{className:"ReleaseForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:l?.description}),p(kn,{className:"ReleaseForm__input",label:"Docs",description:"Select one or more docs to add to the release. Note: you can add or edit this list at a later time, if needed.",size:"xs",children:[u.length>0&&p(_d.DocPreviewCards,{docIds:u,onRemoveDoc:C}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>y(),children:"Select"})]}),p(kn,{className:"ReleaseForm__input",label:"Data Sources",description:"Optional. Data sources to publish with the release.",size:"xs",children:[f.length>0&&p(_d.DataSourceIds,{ids:f,onRemove:N}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>v(),children:"Select"})]}),p("div",{className:"ReleaseForm__submit__buttons",children:p(re,{className:"ReleaseForm__submit",color:"blue",size:"xs",type:"submit",loading:r,children:t.buttonLabel||"Save"})}),n&&p("div",{className:"ReleaseForm__error",children:["Error: ",n]})]})}_d.DocPreviewCards=t=>p("div",{className:"ReleaseForm__DocPreviewCards",children:t.docIds.map(e=>p("div",{className:"ReleaseForm__DocPreviewCards__card",children:[p(tg,{className:"ReleaseForm__DocPreviewCards__card__preview",docId:e}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls",children:[p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__remove",children:p(Se,{label:"Remove",children:p(Je,{className:"ReleaseForm__DocPreviewCards__card__controls__remove__icon",onClick:()=>t.onRemoveDoc(e),children:p(Hn,{size:16})})})}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__open",children:p(Se,{label:"Open",children:p(Je,{component:"a",className:"ReleaseForm__DocPreviewCards__card__controls__open__icon",href:`/cms/content/${e}`,target:"_blank",children:p(Iu,{size:16})})})})]})]},e))});_d.DataSourceIds=t=>p("div",{className:"ReleaseForm__DataSourceIds",children:t.ids.map(e=>p("div",{className:"ReleaseForm__DataSourceIds__item",children:[p("span",{className:"ReleaseForm__DataSourceIds__item__id",children:e}),p(Je,{className:"ReleaseForm__DataSourceIds__item__remove",onClick:()=>t.onRemove(e),children:p(Hn,{size:16})})]},e))});function She(t){let e=Ct(),r=Vt();function o(){let n=`delete-release-${t.id}`,i=e.openConfirmModal({...r,title:"Delete release",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete release ",p("code",{children:t.id}),"? There is no undo. This will only delete the release; the docs in the release will remain unchanged."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting release",message:`Deleting ${t.id}...`,loading:!0,autoClose:!1}),await Moe(t.id),Ht({id:n,title:"Deleted release",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/releases")}})}return p(Fe,{children:p("div",{className:"EditReleasePage",children:[p("div",{className:"EditReleasePage__header",children:[p(Io,{className:"EditReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("a",{href:`/cms/releases/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Release: ",t.id]}),p("div",{className:"EditReleasePage__header__controls",children:p(Se,{label:"Delete",children:p(Je,{onClick:o,children:p(Ob,{size:20,stroke:"1.5"})})})})]})]}),p(_d,{releaseId:t.id})]})})}Pe();function Dk(t){let e=t.limit||40,[r,o]=M(!0),[n,i]=M([]);async function a(){let s=await gQ({limit:e});i(s),o(!1)}return V(()=>{a()},[]),r?p("div",{className:"ActionsLog ActionsLog--loading",children:p(Ze,{color:"gray",size:"xl"})}):p("div",{className:"ActionsLog",children:p(fo,{className:"ActionsLog__table",children:[p("thead",{children:p("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[p("th",{className:"ActionsLogs__table__header",children:"timestamp"}),p("th",{className:"ActionsLogs__table__header",children:"user"}),p("th",{className:"ActionsLogs__table__header",children:"action"}),p("th",{className:"ActionsLogs__table__header",children:"quick links"})]})}),p("tbody",{children:n.map(s=>p("tr",{className:"ActionsLogs__table__row",children:[p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:Iet(s.timestamp)}),p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:s.by}),p("td",{className:"ActionsLogs__table__col",children:[s.action," ",wet(s.metadata)]}),p("td",{className:"ActionsLogs__table__col",children:p("div",{className:"ActionsLogs__table__buttons",children:[s.action!=="doc.delete"&&s.metadata?.docId&&p(Se,{transition:"pop",label:s.metadata.docId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${s.metadata?.docId}`,children:"Open doc"})}),s.action!=="datasource.delete"&&s.metadata?.datasourceId&&p(Se,{transition:"pop",label:s.metadata.datasourceId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${s.metadata?.datasourceId}`,children:"Open release"})}),s.action!=="release.delete"&&s.metadata?.releaseId&&p(Se,{transition:"pop",label:s.metadata.releaseId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${s.metadata?.releaseId}`,children:"Open release"})}),s.metadata?.sheetId&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:Ma(s.metadata.sheetId),target:"_blank",children:"Open sheet"}),s.action.startsWith("acls.")&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:"Open settings"})]})})]}))})]})})}function Iet(t){return t.toDate().toLocaleString("sv-SE",{dateStyle:"short",timeStyle:"medium"})}function wet(t){function e(r){return r===null?"null":typeof r>"u"?"undefined":typeof r=="string"?`"${r.replaceAll('"','\\"')}"`:typeof r!="object"?String(r):Array.isArray(r)?`[${r.map(e).join(", ")}]`:`{${Object.entries(r).map(([n,i])=>`${n}: ${e(i)}`).join(", ")}}`}return e(t)}var Che=250;function The(){return p(Fe,{children:p("div",{className:"LogsPage",children:[p("div",{className:"LogsPage__header",children:[p(et,{size:"h1",children:"Action Logs"}),p(Ye,{as:"p",children:["The latest ",Che," actions are displayed here. View all past actions in the"," ",p("a",{href:Eet(),target:"_blank",children:"Firebase Console"}),"."]})]}),p(Dk,{limit:Che})]})})}function Eet(){let t=window.__ROOT_CTX.firebaseConfig,e=t.projectId,r=window.__ROOT_CTX.rootConfig.projectId,o=t.databaseId||"-default-",n=`/Projects/${r}/ActionLogs`.replaceAll("/","~2F");return`https://console.firebase.google.com/project/${e}/firestore/databases/${o}/data/${n}`}function khe(){return p(Fe,{children:p("div",{className:"NewDataSourcePage",children:[p("div",{className:"NewDataSourcePage__header",children:[p(Io,{className:"NewDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Data Source"})]}),p(Ak,{buttonLabel:"Create data source"})]})})}function Nhe(){return p(Fe,{children:p("div",{className:"NewReleasePage",children:[p("div",{className:"NewReleasePage__header",children:[p(Io,{className:"NewReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Release"})]}),p(_d,{buttonLabel:"Create release"})]})})}function Phe(){return p(Fe,{children:p("div",{className:"NotFoundPage",children:[p("div",{className:"NotFoundPage__icon",children:p(Cb,{size:60})}),p("h2",{className:"NotFoundPage__title",children:"Not Found"}),p("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",p("a",{href:"/cms",children:"go home"}),"."]})]})})}function Rk(){let t=window.__ROOT_CTX.rootConfig.projectName||"Root CMS";return p(Fe,{children:p("div",{className:"ProjectPage",children:[p("div",{className:"ProjectPage__headline",children:p(et,{className:"ProjectPage__title",size:"h1",children:t})}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title",size:"h2",children:"Content"}),p(Rk.CollectionList,{})]}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title ProjectPage__section__title--flex",size:"h2",children:[p("div",{children:"Recent actions"}),p("div",{children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})})]}),p(Dk,{limit:20})]})]})})}Rk.CollectionList=()=>{let t=Object.keys(window.__ROOT_CTX.collections).map(e=>({...window.__ROOT_CTX.collections[e],id:e}));return p("div",{className:"ProjectPage__collectionList",children:[t.map(e=>p("a",{className:"ProjectPage__collectionList__collection",href:`/cms/content/${e.id}`,children:[p("div",{className:"ProjectPage__collectionList__collection__icon",children:p(vf,{size:20,strokeWidth:"1.75"})}),p("div",{className:"ProjectPage__collectionList__collection__name",children:e.name||e.id}),e.description&&p("div",{className:"ProjectPage__collectionList__collection__desc",children:e.description})]},e.id)),t.length===0&&p("div",{className:"ProjectPage__collectionList__collections__empty",children:"No collections match your query."})]})};Pe();var Ohe={transition:"pop"};function Mk(t){let e=t.release;return e.scheduledAt?p(Se,{...Ohe,label:`Scheduled ${Tet(e.scheduledAt)} by ${e.scheduledBy}`,wrapLines:!0,width:240,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}):e.publishedAt?p(Se,{...Ohe,label:`Published ${Cet(e.publishedAt)} by ${e.publishedBy}`,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):p(is,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function Cet(t){return t?Da(t.toMillis()):Da(new Date().getTime())}function Tet(t){return new Date(t.toMillis()).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xd(t){let[e,r]=M(!0),[o,n]=M(null),[i,a]=M(0),s=t.id;async function l(){r(!0),await er(async()=>{let u=await Vf(s);n(u),a(Rb())}),r(!1)}V(()=>{l()},[]);function c(u){console.log("onAction()",u),l()}return p(Fe,{children:p("div",{className:"ReleasePage",children:[p("div",{className:"ReleasePage__header",children:[p(Io,{className:"ReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:s})]}),p("div",{className:"ReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Release: ",s]}),p("div",{className:"ReleasePage__header__controls",children:p(Se,{label:"Configure",children:p(Je,{component:"a",href:`/cms/releases/${t.id}/edit`,children:p(Ef,{size:24,stroke:"1.5"})})})})]}),o?.description&&p(Ye,{as:"p",children:o.description})]}),e?p(Ze,{color:"gray",size:"xl"}):p(Te,{children:[o&&p(xd.PublishStatus,{release:o,onAction:c}),o&&o.docIds&&o.docIds.length>0&&p(xd.DocsList,{release:o},`docs-list-${i}`),o&&o.dataSourceIds&&o.dataSourceIds.length>0&&p(xd.DataSourcesList,{release:o},`data-sources-${i}`)]})]})})}xd.PublishStatus=t=>{let e=t.release,[r,o]=M(!1),n=Ct(),i=Vt(),a=zoe({releaseId:e.id,onScheduled:()=>{t.onAction("scheduled")}});function s(){let d=e.docIds||[],f=e.dataSourceIds||[],m=d.length+f.length;if(m===0){Ae({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}n.openConfirmModal({...i,title:`Publish release: ${e.id}`,children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",m," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{l()}})}async function l(){o(!0),await er(async()=>{let d=`publish-release-${e.id}`,f=e.docIds?.length||0,m=e.dataSourceIds?.length||0,h=f+m;Ae({id:d,title:"Publishing release",message:`Publishing ${h} items...`,loading:!0,autoClose:!1}),await Loe(e.id),Ht({id:d,title:"Published release!",message:`Successfully published ${h} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),o(!1)}function c(){a.open()}async function u(){await Boe(e.id),t.onAction("cancel-schedule")}return p("div",{className:"ReleasePage__PublishStatus",children:[p(et,{size:"h2",children:"Status"}),p(fo,{verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"status"}),p("th",{children:"actions"})]})}),p("tbody",{children:p("tr",{children:[p("td",{children:p(Mk,{release:e})}),p("td",{children:p("div",{className:"ReleasePage__PublishStatus__actions",children:[!e.scheduledAt&&p(Se,{label:"Publish the release immediately",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>s(),loading:r,children:e.publishedAt?"Re-publish":"Publish"})}),e.scheduledAt?p(Se,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>u(),children:"Cancel Schedule"})}):p(Se,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>c(),children:"Schedule"})})]})})]})})]})]})};xd.DocsList=t=>{let e=t.release,r=e.docIds||[];return p("div",{className:"ReleasePage__DocsList",children:[p("div",{className:"ReleasePage__DocsList__header",children:[p(et,{size:"h2",children:"Docs"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DocsList__cards",children:r.map(o=>p("div",{className:"ReleasePage__DocsList__card",children:p("a",{href:`/cms/content/${o}`,children:p(tg,{docId:o,statusBadges:!0})})},o))})]})};xd.DataSourcesList=t=>{let e=t.release,r=e.dataSourceIds||[];return p("div",{className:"ReleasePage__DataSourcesList",children:[p("div",{className:"ReleasePage__DataSourcesList__header",children:[p(et,{size:"h2",children:"Data Sources"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DataSourcesList__items",children:r.map(o=>p("div",{className:"ReleasePage__DataSourcesList__item",children:p("a",{href:`/cms/data/${o}`,children:o})},o))})]})};Pe();function Lk(){return p(Fe,{children:p("div",{className:"ReleasesPage",children:[p("div",{className:"ReleasesPage__header",children:[p(et,{size:"h1",children:"Releases"}),p(Ye,{as:"p",children:"Create a release for publishing content in a batch."}),p("div",{className:"ReleasesPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",children:"New release"})})]}),p(Lk.ReleasesTable,{})]})})}Lk.ReleasesTable=()=>{let[t,e]=M(!0),[r,o]=M([]);async function n(){let i=await Doe();o(i),e(!1)}return V(()=>{n()},[]),p("div",{className:"ReleasesPage__ReleasesTable",children:[t&&p(Ze,{color:"gray",size:"xl"}),r.length>0&&p(fo,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"id"}),p("th",{children:"description"}),p("th",{children:"content"}),p("th",{children:"status"})]})}),p("tbody",{children:r.map(i=>p("tr",{children:[p("td",{children:p("a",{href:`/cms/releases/${i.id}`,children:i.id})}),p("td",{children:i.description||""}),p("td",{children:(i.docIds||[]).map(a=>p("div",{children:p("a",{href:`/cms/content/${a}`,children:a})}))}),p("td",{children:p("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:p(Mk,{release:i})})})]},i.id))})]})]})};Pe();function ket(t){let e=window.firebase.user.email;if(!e)return null;if(e in t)return t[e];let o=`*@${e.split("@").at(-1)}`;return o in t?t[o]:null}function Net(t){return ket(t)==="ADMIN"}function Fk(t){let[e,r]=M(!0),[o,n]=M({}),[i,a]=M(""),s=window.firebase.db,l=window.__ROOT_CTX.rootConfig.projectId||"default",c=$e(s,"Projects",l),u=Net(o);V(()=>{ko(c).then(h=>{let g=h.data()||{};n(g.roles||{}),r(!1)})},[]);async function d(h,g){r(!0),await er(async()=>{g==="REMOVE"?(await Mr(c,new Pn("roles",h),$o()),n(_=>{let b={..._};return delete b[h],b}),Ot("acls.remove_user",{metadata:{user:h}})):(await Mr(c,new Pn("roles",h),g),n(_=>({..._,[h]:g})),Ot("acls.update_user",{metadata:{user:h,role:g}}))}),r(!1)}async function f(h){a(""),r(!0),await er(async()=>{await Mr(c,new Pn("roles",h),"EDITOR"),n(g=>({...g,[h]:"VIEWER"}))}),Ot("acls.add_user",{metadata:{user:h,role:"VIEWER"}}),r(!1)}let m=sre(Object.keys(o).map(h=>({email:h,role:o[h]})),"email");return p("div",{className:De(t.className,"ShareBox"),children:[e&&p(ka,{visible:!0,loaderProps:{color:"gray",size:"xl"}}),p("form",{className:"ShareBox__addUser",onSubmit:h=>{h.preventDefault(),f(i)},children:[p(ir,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:i,onChange:h=>a(h.target.value),radius:0,size:"xs"}),p(re,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!u,children:"Add user"})]}),p("div",{className:"ShareBox__users",children:m.map(h=>p(Fk.User,{...h,currentUserIsAdmin:u,onChange:d},h.email))})]})}Fk.User=t=>{let e=t.email===window.firebase.user.email;return p("div",{className:"ShareBox__user",children:[p(Ye,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[t.email,e&&" (you)"]}),p("div",{className:"ShareBox__user__roleSelect",children:p(Er,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:t.role,radius:0,size:"xs",disabled:e||!t.currentUserIsAdmin,onChange:r=>{t.onChange(t.email,r)}})})]})};function Ahe(){let t=UC(),e=gC();return p(Fe,{children:p("div",{className:"SettingsPage",children:[p("div",{className:"SettingsPage__section SettingsPage__section__users",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Share"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[p("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),p("ul",{children:[p("li",{children:"VIEWER: view docs but not edit"}),p("li",{children:"EDITOR: view and edit docs"}),p("li",{children:"ADMIN: all of the above and change sharing settings"})]})]})]}),p("div",{className:"SettingsPage__section__right",children:[p(et,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),p(Fk,{className:"SettingsPage__section__users__sharebox"})]})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Site Settings"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings apply to the project. Only admins can change them."})})]}),p("div",{className:"SettingsPage__section__right",children:ure.map(r=>p("div",{className:"SettingsPage__section__setting",children:[p(Ye,{size:"body",weight:"semi-bold",children:r.name}),p(Ye,{size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:r.description})}),p(yr,{autosize:!0,minRows:2,maxRows:4,value:e.settings[r.key]||"",placeholder:r.placeholder,onChange:o=>e.setSettings(r.key,o.currentTarget.value)}),r.ui&&p("div",{children:r.ui(e.settings[r.key])})]},r.key))})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"User Preferences"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings are for you only."})})]}),p("div",{className:"SettingsPage__section__right",children:p("div",{className:"SettingsPage__section__userPref",children:[p("div",{className:"SettingsPage__section__userPref__description",children:[p(Ye,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable Lexical Editor (experimental)"}),p(Ye,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:["Replaces the"," ",p("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","rich text editor with the"," ",p("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","version. The data saved by the Lexical version is backwards compatible but the editor may be missing a few features."]})})]}),p("div",{className:"SettingsPage__section__userPref__input",children:p(m0,{color:"dark",checked:t.preferences.EnableLexicalEditor,onChange:r=>{let o=r.currentTarget.checked;t.setPreference("EnableLexicalEditor",o)}})})]})})]})]})})}Pe();function Dhe(t){let r=(window.__ROOT_CTX.sidebar?.tools||{})[t.id],o=r?.cmsUrl,n=r?.externalUrl;return V(()=>{o?.startsWith("/cms/")&&window.location.replace(o)},[o]),V(()=>{n&&window.open(n,"_blank","noopener,noreferrer")?.focus()},[n]),r?n?p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:p("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||t.id," in a new tab"]})})}):o?.startsWith("/cms/")?p(Fe,{children:p("div",{className:"SidebarToolsPage",children:"redirecting..."})}):o?p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",t.id]})}):r.iframeUrl?p(Fe,{children:p("div",{className:"SidebarToolsPage",children:p("iframe",{src:r.iframeUrl})})}):p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",t.id]})}):p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",t.id]})})}Rl();var Bk=class{constructor(){this.data={}}setMeta(e){Object.entries(e).forEach(([r,o])=>{r.startsWith("@@")||(r=`@@${r}`),this.data[r]=o})}add(e,r,o){this.data[e]=r,o&&(this.data[`@${e}`]=o)}get(e){let r=this.data[e];return r?{source:r,meta:this.data[`@${e}`]}:null}list(){let e=[];return Object.entries(this.data).forEach(([r])=>{if(r.startsWith("@@"))return;let o=this.data[r],n=this.data[`@${r}`];e.push({key:r,source:o,meta:n})}),e}toJson(){return{...this.data}}toString(){return JSON.stringify(this.toJson(),null,2)}};function t_(){return p(Fe,{children:p("div",{className:"TranslationsArbPage",children:[p("div",{className:"TranslationsArbPage__header",children:[p(Io,{className:"TranslationsArbPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:"ARB"})]}),p(et,{size:"h1",children:"ARB Translations"}),p(Ye,{as:"p",children:"Enter doc ids below (separated by newlines) to include in an ARB file."})]}),p(t_.RequestForm,{})]})})}t_.RequestForm=()=>{let[t,e]=M(""),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(null);async function l(d){let f=await LM(d),m=new Bk,h=window.__ROOT_CTX.rootConfig,g=[h.domain];h.base&&h.base!=="/"&&g.push(h.base);let _=g.join("");m.setMeta({locale:"en",context:_,last_modified:new Date().toISOString()}),console.log(f);for(let b in f){let y=f[b],v=new Set,C=b.split("/")[0],N=await Ah(C);Kb(v,N.fields,y.fields||{},N.types||{});for(let I of v){let E=await ES(I),w=m.get(E)?.meta;if(w){let S=w.context.split(", ");S.push(b),S.sort(),w.context=S.join(", ")}else w={context:b};m.add(E,I,w)}}return m}async function c(){try{let d=Rhe(t),f=await l(d);s(f)}catch(d){console.error(d),i(`failed to preview arb: ${d}`)}}async function u(){try{o(!0),console.log("download arb");let d=Rhe(t),m=(await l(d)).toString(),g=await new Response(m).blob(),_=document.createElement("a");_.href=window.URL.createObjectURL(g),_.download=Oet(d),document.body.appendChild(_),_.click(),document.body.removeChild(_),window.URL.revokeObjectURL(_.href),o(!1)}catch(d){console.error(d),i(`failed to download arb: ${d}`)}}return p("form",{className:"TranslationsArbPage__RequestForm",onSubmit:d=>{d.preventDefault(),u()},children:[p("div",{className:"TranslationsArbPage__RequestForm__textareaWrapper",children:p(yr,{required:!0,size:"xs",radius:0,autosize:!0,minRows:8,maxRows:20,value:t,placeholder:"Pages/index",onChange:d=>{e(d.currentTarget.value||"")}})}),p("div",{className:"TranslationsArbPage__RequestForm__submit",children:[p(re,{variant:"default",color:"dark",size:"xs",onClick:c,children:"Preview"}),p(re,{color:"blue",size:"xs",loading:r,type:"submit",leftIcon:p(yf,{size:16,strokeWidth:1.75}),children:"Download ARB"})]}),n&&p(Ye,{as:"p",className:"TranslationsArbPage__RequestForm__error",children:n}),a&&p(t_.Preview,{arb:a})]})};t_.Preview=t=>{let e=t.arb.list().filter(r=>!!r.meta);return console.log(e),p(fo,{verticalSpacing:"xs",highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"source"}),p("th",{children:"context"})]})}),p("tbody",{children:e.map(r=>p("tr",{class:"TranslationsArbPage__Preview__Table__row",children:[p("td",{children:r.source}),p("td",{children:[r.meta?.context,r.meta?.description&&p(Te,{children:["/ ",r.meta.description]})]})]},r.source))})]})};function Rhe(t){return t.split(`
248
- `).map(e=>e.trim()).filter(e=>Pet(e))}function Pet(t){return!!t&&t.includes("/")&&t.split("/").length===2}function Oet(t){let e=new Date,r=a=>a.toString().padStart(2,"0"),o=`${e.getFullYear()}${r(e.getMonth()+1)}${r(e.getDate())}t${r(e.getHours())}${r(e.getMinutes())}`,n=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId,i=[Mhe(n)];return t.length===1&&i.push(Mhe(t[0])),i.push(o),`${i.join("_")}.arb`}function Mhe(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}Pe();function $k(t){let e=t.hash,[r,o]=M(!1),[n,i]=M(!1),[a,s]=M({source:""});async function l(){o(!0);let u=await xQ(e);if(o(!1),!u?.source){i(!0);return}s(u)}async function c(u){console.log(u),o(!0),await bQ(e,u),s(d=>({...d,...u})),o(!1),Ae({title:"Saved translations",message:`Updated translations for ${e}.`,autoClose:5e3})}return V(()=>{l()},[t.hash]),p(Fe,{children:p("div",{className:"TranslationsEditPage",children:[p("div",{className:"TranslationsEditPage__header",children:[p(Io,{className:"TranslationsEditPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:t.hash})]}),p(et,{size:"h1",children:"Edit Translations"})]}),r?p(Ze,{color:"gray",size:"xl"}):n?p("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):p($k.Form,{hash:t.hash,translations:a,onChange:c})]})})}$k.Form=t=>{let e=t.translations,o=(window.__ROOT_CTX.rootConfig.i18n.locales||[]).filter(n=>n!=="en");return p("form",{className:"TranslationsEditPage__Form",onSubmit:n=>{n.preventDefault();let i=n.currentTarget,a=["en",...o],s={};a.forEach(l=>{let c=i.elements[l].value;s[l]=ic(c)}),t.onChange(s)},children:[p(ir,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"hash",label:"hash",value:t.hash,disabled:!0}),p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"source",label:"source",value:e.source,disabled:!0}),p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"en",label:"en",value:e.en}),o.map(n=>p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:n,label:n,value:e[n]||""},n)),p(re,{className:"TranslationsEditPage__Form__input__submit",color:"blue",size:"xs",type:"submit",children:"Save"})]})};Pe();function zk(){return p(Fe,{children:p("div",{className:"TranslationsPage",children:[p("div",{className:"TranslationsPage__header",children:[p(et,{size:"h1",children:"Translations"}),p("div",{className:"TranslationsPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/translations/arb",children:"Download ARB"})})]}),p(zk.TranslationsTable,{})]})})}function Aet(t){return t?Array.isArray(t)?t.sort():[t]:[]}zk.TranslationsTable=()=>{let[t,e]=M(!0),[r,o]=M([]),[n,i]=M({}),a=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=["en",...a.filter(b=>b!=="en").sort()],[l,c]=GC("locale",s),u=window.__ROOT_CTX.collections;async function d(){e(!0),await er(async()=>{i(await Su())}),e(!1)}async function f(){let b=[];Object.entries(n).forEach(([y,v])=>{b.push({hash:y,source:v.source,locales:l.map(C=>v[C]||""),tags:v.tags})}),b.sort((y,v)=>y.source.toLowerCase().localeCompare(v.source.toLowerCase())),o(b)}V(()=>{d()},[]),V(()=>{f()},[n,l]);function m(b){l.length===a.length?c([b]):c(a)}if(t)return p(Ze,{color:"gray",size:"xl"});if(r.length===0)return p("div",{className:"TranslationsPage__TranslationsTable",children:p("div",{className:"TranslationsPage__TranslationsTable__empty",children:"No translations in the system yet."})});let _=["hash","source",...r[0].locales.map((b,y)=>l[y]),"tags"];return p("div",{className:"TranslationsPage__TranslationsTable",children:p(fo,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:_.map((b,y)=>{let v=b;return p("th",{"data-col":_[y],className:"TranslationsPage__TranslationsTable__cell",children:p(Se,{className:"TranslationsPage__TranslationsTable__headerTooltip",placement:"start",withArrow:!0,label:l.length===s.length?`Show only ${v}`:"Show all locales",children:p("div",{className:"TranslationsPage__TranslationsTable__localeHeader",onClick:()=>{m(v)},children:v})})},_[y])})})}),p("tbody",{children:r.map(b=>p("tr",{children:[p("td",{"data-col":"hash","data-string-cell":!1,class:"TranslationsPage__TranslationsTable__cell",children:p("a",{href:`/cms/translations/${b.hash}`,children:b.hash})},"hash"),p("td",{"data-col":"source","data-string-cell":!0,class:"TranslationsPage__TranslationsTable__cell",children:b.source},"source"),b.locales.map((y,v)=>p("td",{"data-col":l[v],"data-string-cell":!0,class:"TranslationsPage__TranslationsTable__cell",children:y},l[v])),p("td",{"data-col":"tags","data-string-cell":!1,class:"TranslationsPage__TranslationsTable__cell",children:p(Te,{children:Aet(b.tags).map(y=>{let v={},C="div";if(y.includes("/")){let[N,I]=y.split("/");u[N]&&(C="a",Object.assign(v,{target:"_blank",href:`/cms/content/${N}/${I}`}))}else u[y]&&(C="a",Object.assign(v,{target:"_blank",href:`/cms/content/${y}`}));return p("div",{children:p(C,{...v,className:"TranslationsPage__TranslationsTable__Tag",children:y})},y)})})},"tags")]},b.hash))})]})})};function Det(){return p(II,{theme:{fontFamily:"Inter, sans-serif",fontSizes:{xs:12,sm:14,md:16,lg:18,xl:20}},children:p(S0,{children:p(WL.Provider,{value:window.firebase,children:p(qoe,{children:p(fre,{children:p(Xoe,{children:p(XP,{modals:{[nC.id]:nC,[lC.id]:lC,[Du.id]:Du,[Ru.id]:Ru,[fC.id]:fC,[hC.id]:hC,[Ph.id]:Ph,[Oh.id]:Oh,[oa.id]:oa,[Lu.id]:Lu,[FC.id]:FC,[BC.id]:BC,[$C.id]:$C},children:p(YR,{children:[p(Wr,{path:"/cms",component:Rk}),p(Wr,{path:"/cms/ai",component:Ute}),p(Wr,{path:"/cms/assets",component:Joe}),p(Wr,{path:"/cms/compare",component:nne}),p(Wr,{path:"/cms/content/:collection?",component:jh}),p(Wr,{path:"/cms/content/:collection/:slug",component:Ok}),p(Wr,{path:"/cms/data",component:jC}),p(Wr,{path:"/cms/data/new",component:khe}),p(Wr,{path:"/cms/data/:id",component:ia}),p(Wr,{path:"/cms/data/:id/edit",component:Ehe}),p(Wr,{path:"/cms/logs",component:The}),p(Wr,{path:"/cms/releases",component:Lk}),p(Wr,{path:"/cms/releases/new",component:Nhe}),p(Wr,{path:"/cms/releases/:id",component:xd}),p(Wr,{path:"/cms/releases/:id/edit",component:She}),p(Wr,{path:"/cms/settings",component:Ahe}),p(Wr,{path:"/cms/tools/:id",component:Dhe}),p(Wr,{path:"/cms/translations",component:zk}),p(Wr,{path:"/cms/translations/arb",component:t_}),p(Wr,{path:"/cms/translations/:hash",component:$k}),p(Wr,{path:"/cms/translations/:collection/:slug",component:$u}),p(Wr,{default:!0,component:Phe})]})})})})})})})})}function Ret(){let t=window.location.pathname;window.location.search&&(t=`${t}?${window.location.search}`);let e=new URLSearchParams({continue:t});window.location.replace(`/cms/login?${e.toString()}`)}var Uk=kO(window.__ROOT_CTX.firebaseConfig),Met=window.__ROOT_CTX.firebaseConfig.databaseId||"(default)",Let=IJ(Uk,{experimentalForceLongPolling:!0,useFetchStreams:!1},Met),Lhe=iA(Uk),Fet=nQ(Uk);Lhe.onAuthStateChanged(t=>{if(!t){Ret();return}window.firebase={app:Uk,auth:Lhe,db:Let,storage:Fet,user:t};let e=document.getElementById("root");e.innerHTML="",$c(p(Det,{}),e),Bet(t)});async function Bet(t){let e=await t.getIdToken(),r=await fetch("/cms/login",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:e})});if(r.status!==200){console.error("login failed"),console.log(r);return}if(!(await r.json()).success){console.error("login failed"),console.log(r);return}}})();
247
+ `)}function Ehe(t){let e=Ct(),r=Vt();function o(){let n=`delete-data-source-${t.id}`,i=e.openConfirmModal({...r,title:"Delete data source",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",p("code",{children:t.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting data source",message:`Deleting ${t.id} and synced data...`,loading:!0,autoClose:!1}),await nre(t.id),Ht({id:n,title:"Deleted data source",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/data")}})}return p(Fe,{children:p("div",{className:"EditDataSourcePage",children:[p("div",{className:"EditDataSourcePage__header",children:[p(Io,{className:"EditDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("a",{href:`/cms/data/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditDataSourcePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Data Source: ",t.id]}),p("div",{className:"EditDataSourcePage__header__controls",children:p(Se,{label:"Delete",children:p(Je,{onClick:o,children:p(Ob,{size:20,stroke:"1.5"})})})})]})]}),p(Ak,{dataSourceId:t.id})]})})}Pe();function _d(t){let e=W(null),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(!!t.releaseId),[l,c]=M(null),[u,d]=M([]),[f,m]=M([]),h=pC(),g=are();async function _(I){console.log(I),await er(async()=>{let E=await Vf(I);c(E),d(E?.docIds||[]),m(E?.dataSourceIds||[])}),s(!1)}V(()=>{t.releaseId&&(s(!0),_(t.releaseId))},[t.releaseId]);async function b(){i("");let I=e.current;function E(T){let A=I.elements[T];return A?A.value.trim():""}let w=t.releaseId||E("id");if(!w){i("missing id");return}if(!sl(w)){i("id is invalid (alphanumeric characters and dashes only)");return}let S={id:w,description:E("description"),docIds:u,dataSourceIds:f};try{c(S),o(!0),t.releaseId?(await Roe(t.releaseId,S),Ae({title:"Saved release",message:`Updated ${w}`,autoClose:5e3}),o(!1)):(await Aoe(w,S),Ae({title:"Added release",message:`Successfully added ${w}`,autoClose:5e3}),o(!1)),mo(`/cms/releases/${w}`)}catch(T){console.error(T),Ae({title:"Failed to save release",message:String(T),color:"red",autoClose:!1}),o(!1)}}function y(){h.open({selectedDocIds:u,onChange:(I,E)=>{d(w=>{let S=[...w];if(E)S.push(I);else{let T=S.findIndex(A=>A===I);T>-1&&S.splice(T,1)}return console.log(S),S.sort()})}})}function v(){g.open({selectedDataSourceIds:f,onChange:(I,E)=>{m(w=>{let S=[...w];if(E)S.push(I);else{let T=S.indexOf(I);T>-1&&S.splice(T,1)}return S.sort()})}})}function C(I){console.log("onRemoveDoc()",I),d(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),console.log(w),w})}function N(I){m(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),w})}return p("form",{className:"ReleaseForm",ref:e,onSubmit:I=>{I.preventDefault(),b()},children:[p(ka,{visible:a}),p(ir,{className:"ReleaseForm__input",name:"id",label:"ID",description:"Unique identifier for the release. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.releaseId,disabled:!!t.releaseId}),p(yr,{className:"ReleaseForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:l?.description}),p(kn,{className:"ReleaseForm__input",label:"Docs",description:"Select one or more docs to add to the release. Note: you can add or edit this list at a later time, if needed.",size:"xs",children:[u.length>0&&p(_d.DocPreviewCards,{docIds:u,onRemoveDoc:C}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>y(),children:"Select"})]}),p(kn,{className:"ReleaseForm__input",label:"Data Sources",description:"Optional. Data sources to publish with the release.",size:"xs",children:[f.length>0&&p(_d.DataSourceIds,{ids:f,onRemove:N}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>v(),children:"Select"})]}),p("div",{className:"ReleaseForm__submit__buttons",children:p(re,{className:"ReleaseForm__submit",color:"blue",size:"xs",type:"submit",loading:r,children:t.buttonLabel||"Save"})}),n&&p("div",{className:"ReleaseForm__error",children:["Error: ",n]})]})}_d.DocPreviewCards=t=>p("div",{className:"ReleaseForm__DocPreviewCards",children:t.docIds.map(e=>p("div",{className:"ReleaseForm__DocPreviewCards__card",children:[p(tg,{className:"ReleaseForm__DocPreviewCards__card__preview",docId:e}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls",children:[p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__remove",children:p(Se,{label:"Remove",children:p(Je,{className:"ReleaseForm__DocPreviewCards__card__controls__remove__icon",onClick:()=>t.onRemoveDoc(e),children:p(Hn,{size:16})})})}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__open",children:p(Se,{label:"Open",children:p(Je,{component:"a",className:"ReleaseForm__DocPreviewCards__card__controls__open__icon",href:`/cms/content/${e}`,target:"_blank",children:p(Iu,{size:16})})})})]})]},e))});_d.DataSourceIds=t=>p("div",{className:"ReleaseForm__DataSourceIds",children:t.ids.map(e=>p("div",{className:"ReleaseForm__DataSourceIds__item",children:[p("span",{className:"ReleaseForm__DataSourceIds__item__id",children:e}),p(Je,{className:"ReleaseForm__DataSourceIds__item__remove",onClick:()=>t.onRemove(e),children:p(Hn,{size:16})})]},e))});function She(t){let e=Ct(),r=Vt();function o(){let n=`delete-release-${t.id}`,i=e.openConfirmModal({...r,title:"Delete release",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete release ",p("code",{children:t.id}),"? There is no undo. This will only delete the release; the docs in the release will remain unchanged."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting release",message:`Deleting ${t.id}...`,loading:!0,autoClose:!1}),await Moe(t.id),Ht({id:n,title:"Deleted release",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/releases")}})}return p(Fe,{children:p("div",{className:"EditReleasePage",children:[p("div",{className:"EditReleasePage__header",children:[p(Io,{className:"EditReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("a",{href:`/cms/releases/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Release: ",t.id]}),p("div",{className:"EditReleasePage__header__controls",children:p(Se,{label:"Delete",children:p(Je,{onClick:o,children:p(Ob,{size:20,stroke:"1.5"})})})})]})]}),p(_d,{releaseId:t.id})]})})}Pe();function Dk(t){let e=t.limit||40,[r,o]=M(!0),[n,i]=M([]);async function a(){let s=await gQ({limit:e});i(s),o(!1)}return V(()=>{a()},[]),r?p("div",{className:"ActionsLog ActionsLog--loading",children:p(Ze,{color:"gray",size:"xl"})}):p("div",{className:"ActionsLog",children:p(fo,{className:"ActionsLog__table",children:[p("thead",{children:p("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[p("th",{className:"ActionsLogs__table__header",children:"timestamp"}),p("th",{className:"ActionsLogs__table__header",children:"user"}),p("th",{className:"ActionsLogs__table__header",children:"action"}),p("th",{className:"ActionsLogs__table__header",children:"quick links"})]})}),p("tbody",{children:n.map(s=>p("tr",{className:"ActionsLogs__table__row",children:[p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:Iet(s.timestamp)}),p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:s.by}),p("td",{className:"ActionsLogs__table__col",children:[s.action," ",wet(s.metadata)]}),p("td",{className:"ActionsLogs__table__col",children:p("div",{className:"ActionsLogs__table__buttons",children:[s.action!=="doc.delete"&&s.metadata?.docId&&p(Se,{transition:"pop",label:s.metadata.docId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${s.metadata?.docId}`,children:"Open doc"})}),s.action!=="datasource.delete"&&s.metadata?.datasourceId&&p(Se,{transition:"pop",label:s.metadata.datasourceId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${s.metadata?.datasourceId}`,children:"Open release"})}),s.action!=="release.delete"&&s.metadata?.releaseId&&p(Se,{transition:"pop",label:s.metadata.releaseId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${s.metadata?.releaseId}`,children:"Open release"})}),s.metadata?.sheetId&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:Ma(s.metadata.sheetId),target:"_blank",children:"Open sheet"}),s.action.startsWith("acls.")&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:"Open settings"})]})})]}))})]})})}function Iet(t){return t.toDate().toLocaleString("sv-SE",{dateStyle:"short",timeStyle:"medium"})}function wet(t){function e(r){return r===null?"null":typeof r>"u"?"undefined":typeof r=="string"?`"${r.replaceAll('"','\\"')}"`:typeof r!="object"?String(r):Array.isArray(r)?`[${r.map(e).join(", ")}]`:`{${Object.entries(r).map(([n,i])=>`${n}: ${e(i)}`).join(", ")}}`}return e(t)}var Che=250;function The(){return p(Fe,{children:p("div",{className:"LogsPage",children:[p("div",{className:"LogsPage__header",children:[p(et,{size:"h1",children:"Action Logs"}),p(Ye,{as:"p",children:["The latest ",Che," actions are displayed here. View all past actions in the"," ",p("a",{href:Eet(),target:"_blank",children:"Firebase Console"}),"."]})]}),p(Dk,{limit:Che})]})})}function Eet(){let t=window.__ROOT_CTX.firebaseConfig,e=t.projectId,r=window.__ROOT_CTX.rootConfig.projectId,o=t.databaseId||"-default-",n=`/Projects/${r}/ActionLogs`.replaceAll("/","~2F");return`https://console.firebase.google.com/project/${e}/firestore/databases/${o}/data/${n}`}function khe(){return p(Fe,{children:p("div",{className:"NewDataSourcePage",children:[p("div",{className:"NewDataSourcePage__header",children:[p(Io,{className:"NewDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Data Source"})]}),p(Ak,{buttonLabel:"Create data source"})]})})}function Nhe(){return p(Fe,{children:p("div",{className:"NewReleasePage",children:[p("div",{className:"NewReleasePage__header",children:[p(Io,{className:"NewReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Release"})]}),p(_d,{buttonLabel:"Create release"})]})})}function Phe(){return p(Fe,{children:p("div",{className:"NotFoundPage",children:[p("div",{className:"NotFoundPage__icon",children:p(Cb,{size:60})}),p("h2",{className:"NotFoundPage__title",children:"Not Found"}),p("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",p("a",{href:"/cms",children:"go home"}),"."]})]})})}function Rk(){let t=window.__ROOT_CTX.rootConfig.projectName||"Root CMS";return p(Fe,{children:p("div",{className:"ProjectPage",children:[p("div",{className:"ProjectPage__headline",children:p(et,{className:"ProjectPage__title",size:"h1",children:t})}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title",size:"h2",children:"Content"}),p(Rk.CollectionList,{})]}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title ProjectPage__section__title--flex",size:"h2",children:[p("div",{children:"Recent actions"}),p("div",{children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})})]}),p(Dk,{limit:20})]})]})})}Rk.CollectionList=()=>{let t=Object.keys(window.__ROOT_CTX.collections).map(e=>({...window.__ROOT_CTX.collections[e],id:e}));return p("div",{className:"ProjectPage__collectionList",children:[t.map(e=>p("a",{className:"ProjectPage__collectionList__collection",href:`/cms/content/${e.id}`,children:[p("div",{className:"ProjectPage__collectionList__collection__icon",children:p(vf,{size:20,strokeWidth:"1.75"})}),p("div",{className:"ProjectPage__collectionList__collection__name",children:e.name||e.id}),e.description&&p("div",{className:"ProjectPage__collectionList__collection__desc",children:e.description})]},e.id)),t.length===0&&p("div",{className:"ProjectPage__collectionList__collections__empty",children:"No collections match your query."})]})};Pe();var Ohe={transition:"pop"};function Mk(t){let e=t.release;return e.scheduledAt?p(Se,{...Ohe,label:`Scheduled ${Tet(e.scheduledAt)} by ${e.scheduledBy}`,wrapLines:!0,width:240,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}):e.publishedAt?p(Se,{...Ohe,label:`Published ${Cet(e.publishedAt)} by ${e.publishedBy}`,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):p(is,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function Cet(t){return t?Da(t.toMillis()):Da(new Date().getTime())}function Tet(t){return new Date(t.toMillis()).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xd(t){let[e,r]=M(!0),[o,n]=M(null),[i,a]=M(0),s=t.id;async function l(){r(!0),await er(async()=>{let u=await Vf(s);n(u),a(Rb())}),r(!1)}V(()=>{l()},[]);function c(u){console.log("onAction()",u),l()}return p(Fe,{children:p("div",{className:"ReleasePage",children:[p("div",{className:"ReleasePage__header",children:[p(Io,{className:"ReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:s})]}),p("div",{className:"ReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Release: ",s]}),p("div",{className:"ReleasePage__header__controls",children:p(Se,{label:"Configure",children:p(Je,{component:"a",href:`/cms/releases/${t.id}/edit`,children:p(Ef,{size:24,stroke:"1.5"})})})})]}),o?.description&&p(Ye,{as:"p",children:o.description})]}),e?p(Ze,{color:"gray",size:"xl"}):p(Te,{children:[o&&p(xd.PublishStatus,{release:o,onAction:c}),o&&o.docIds&&o.docIds.length>0&&p(xd.DocsList,{release:o},`docs-list-${i}`),o&&o.dataSourceIds&&o.dataSourceIds.length>0&&p(xd.DataSourcesList,{release:o},`data-sources-${i}`)]})]})})}xd.PublishStatus=t=>{let e=t.release,[r,o]=M(!1),n=Ct(),i=Vt(),a=zoe({releaseId:e.id,onScheduled:()=>{t.onAction("scheduled")}});function s(){let d=e.docIds||[],f=e.dataSourceIds||[],m=d.length+f.length;if(m===0){Ae({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}n.openConfirmModal({...i,title:`Publish release: ${e.id}`,children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",m," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{l()}})}async function l(){o(!0),await er(async()=>{let d=`publish-release-${e.id}`,f=e.docIds?.length||0,m=e.dataSourceIds?.length||0,h=f+m;Ae({id:d,title:"Publishing release",message:`Publishing ${h} items...`,loading:!0,autoClose:!1}),await Loe(e.id),Ht({id:d,title:"Published release!",message:`Successfully published ${h} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),o(!1)}function c(){a.open()}async function u(){await Boe(e.id),t.onAction("cancel-schedule")}return p("div",{className:"ReleasePage__PublishStatus",children:[p(et,{size:"h2",children:"Status"}),p(fo,{verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"status"}),p("th",{children:"actions"})]})}),p("tbody",{children:p("tr",{children:[p("td",{children:p(Mk,{release:e})}),p("td",{children:p("div",{className:"ReleasePage__PublishStatus__actions",children:[!e.scheduledAt&&p(Se,{label:"Publish the release immediately",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>s(),loading:r,children:e.publishedAt?"Re-publish":"Publish"})}),e.scheduledAt?p(Se,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>u(),children:"Cancel Schedule"})}):p(Se,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>c(),children:"Schedule"})})]})})]})})]})]})};xd.DocsList=t=>{let e=t.release,r=e.docIds||[];return p("div",{className:"ReleasePage__DocsList",children:[p("div",{className:"ReleasePage__DocsList__header",children:[p(et,{size:"h2",children:"Docs"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DocsList__cards",children:r.map(o=>p("div",{className:"ReleasePage__DocsList__card",children:p("a",{href:`/cms/content/${o}`,children:p(tg,{docId:o,statusBadges:!0})})},o))})]})};xd.DataSourcesList=t=>{let e=t.release,r=e.dataSourceIds||[];return p("div",{className:"ReleasePage__DataSourcesList",children:[p("div",{className:"ReleasePage__DataSourcesList__header",children:[p(et,{size:"h2",children:"Data Sources"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DataSourcesList__items",children:r.map(o=>p("div",{className:"ReleasePage__DataSourcesList__item",children:p("a",{href:`/cms/data/${o}`,children:o})},o))})]})};Pe();function Lk(){return p(Fe,{children:p("div",{className:"ReleasesPage",children:[p("div",{className:"ReleasesPage__header",children:[p(et,{size:"h1",children:"Releases"}),p(Ye,{as:"p",children:"Create a release for publishing content in a batch."}),p("div",{className:"ReleasesPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",children:"New release"})})]}),p(Lk.ReleasesTable,{})]})})}Lk.ReleasesTable=()=>{let[t,e]=M(!0),[r,o]=M([]);async function n(){let i=await Doe();o(i),e(!1)}return V(()=>{n()},[]),p("div",{className:"ReleasesPage__ReleasesTable",children:[t&&p(Ze,{color:"gray",size:"xl"}),r.length>0&&p(fo,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"id"}),p("th",{children:"description"}),p("th",{children:"content"}),p("th",{children:"status"})]})}),p("tbody",{children:r.map(i=>p("tr",{children:[p("td",{children:p("a",{href:`/cms/releases/${i.id}`,children:i.id})}),p("td",{children:i.description||""}),p("td",{children:(i.docIds||[]).map(a=>p("div",{children:p("a",{href:`/cms/content/${a}`,children:a})}))}),p("td",{children:p("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:p(Mk,{release:i})})})]},i.id))})]})]})};Pe();function ket(t){let e=window.firebase.user.email;if(!e)return null;if(e in t)return t[e];let o=`*@${e.split("@").at(-1)}`;return o in t?t[o]:null}function Net(t){return ket(t)==="ADMIN"}function Fk(t){let[e,r]=M(!0),[o,n]=M({}),[i,a]=M(""),s=window.firebase.db,l=window.__ROOT_CTX.rootConfig.projectId||"default",c=$e(s,"Projects",l),u=Net(o);V(()=>{ko(c).then(h=>{let g=h.data()||{};n(g.roles||{}),r(!1)})},[]);async function d(h,g){r(!0),await er(async()=>{g==="REMOVE"?(await Mr(c,new Pn("roles",h),$o()),n(_=>{let b={..._};return delete b[h],b}),Ot("acls.remove_user",{metadata:{user:h}})):(await Mr(c,new Pn("roles",h),g),n(_=>({..._,[h]:g})),Ot("acls.update_user",{metadata:{user:h,role:g}}))}),r(!1)}async function f(h){a(""),r(!0),await er(async()=>{await Mr(c,new Pn("roles",h),"EDITOR"),n(g=>({...g,[h]:"VIEWER"}))}),Ot("acls.add_user",{metadata:{user:h,role:"VIEWER"}}),r(!1)}let m=sre(Object.keys(o).map(h=>({email:h,role:o[h]})),"email");return p("div",{className:De(t.className,"ShareBox"),children:[e&&p(ka,{visible:!0,loaderProps:{color:"gray",size:"xl"}}),p("form",{className:"ShareBox__addUser",onSubmit:h=>{h.preventDefault(),f(i)},children:[p(ir,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:i,onChange:h=>a(h.target.value),radius:0,size:"xs"}),p(re,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!u,children:"Add user"})]}),p("div",{className:"ShareBox__users",children:m.map(h=>p(Fk.User,{...h,currentUserIsAdmin:u,onChange:d},h.email))})]})}Fk.User=t=>{let e=t.email===window.firebase.user.email;return p("div",{className:"ShareBox__user",children:[p(Ye,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[t.email,e&&" (you)"]}),p("div",{className:"ShareBox__user__roleSelect",children:p(Er,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:t.role,radius:0,size:"xs",disabled:e||!t.currentUserIsAdmin,onChange:r=>{t.onChange(t.email,r)}})})]})};function Ahe(){let t=UC(),e=gC();return p(Fe,{children:p("div",{className:"SettingsPage",children:[p("div",{className:"SettingsPage__section SettingsPage__section__users",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Share"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[p("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),p("ul",{children:[p("li",{children:"VIEWER: view docs but not edit"}),p("li",{children:"EDITOR: view and edit docs"}),p("li",{children:"ADMIN: all of the above and change sharing settings"})]})]})]}),p("div",{className:"SettingsPage__section__right",children:[p(et,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),p(Fk,{className:"SettingsPage__section__users__sharebox"})]})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Site Settings"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings apply to the project. Only admins can change them."})})]}),p("div",{className:"SettingsPage__section__right",children:ure.map(r=>p("div",{className:"SettingsPage__section__setting",children:[p(Ye,{size:"body",weight:"semi-bold",children:r.name}),p(Ye,{size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:r.description})}),p(yr,{autosize:!0,minRows:2,maxRows:4,value:e.settings[r.key]||"",placeholder:r.placeholder,onChange:o=>e.setSettings(r.key,o.currentTarget.value)}),r.ui&&p("div",{children:r.ui(e.settings[r.key])})]},r.key))})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"User Preferences"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings are for you only."})})]}),p("div",{className:"SettingsPage__section__right",children:p("div",{className:"SettingsPage__section__userPref",children:[p("div",{className:"SettingsPage__section__userPref__description",children:[p(Ye,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable Lexical Editor (experimental)"}),p(Ye,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:["Replaces the"," ",p("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","rich text editor with the"," ",p("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","version. The data saved by the Lexical version is backwards compatible but the editor may be missing a few features."]})})]}),p("div",{className:"SettingsPage__section__userPref__input",children:p(mE,{color:"dark",checked:t.preferences.EnableLexicalEditor,onChange:r=>{let o=r.currentTarget.checked;t.setPreference("EnableLexicalEditor",o)}})})]})})]})]})})}Pe();function Dhe(t){let r=(window.__ROOT_CTX.sidebar?.tools||{})[t.id],o=r?.cmsUrl,n=r?.externalUrl;return V(()=>{o?.startsWith("/cms/")&&window.location.replace(o)},[o]),V(()=>{n&&window.open(n,"_blank","noopener,noreferrer")?.focus()},[n]),r?n?p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:p("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||t.id," in a new tab"]})})}):o?.startsWith("/cms/")?p(Fe,{children:p("div",{className:"SidebarToolsPage",children:"redirecting..."})}):o?p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",t.id]})}):r.iframeUrl?p(Fe,{children:p("div",{className:"SidebarToolsPage",children:p("iframe",{src:r.iframeUrl})})}):p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",t.id]})}):p(Fe,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",t.id]})})}Rl();var Bk=class{constructor(){this.data={}}setMeta(e){Object.entries(e).forEach(([r,o])=>{r.startsWith("@@")||(r=`@@${r}`),this.data[r]=o})}add(e,r,o){this.data[e]=r,o&&(this.data[`@${e}`]=o)}get(e){let r=this.data[e];return r?{source:r,meta:this.data[`@${e}`]}:null}list(){let e=[];return Object.entries(this.data).forEach(([r])=>{if(r.startsWith("@@"))return;let o=this.data[r],n=this.data[`@${r}`];e.push({key:r,source:o,meta:n})}),e}toJson(){return{...this.data}}toString(){return JSON.stringify(this.toJson(),null,2)}};function t_(){return p(Fe,{children:p("div",{className:"TranslationsArbPage",children:[p("div",{className:"TranslationsArbPage__header",children:[p(Io,{className:"TranslationsArbPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:"ARB"})]}),p(et,{size:"h1",children:"ARB Translations"}),p(Ye,{as:"p",children:"Enter doc ids below (separated by newlines) to include in an ARB file."})]}),p(t_.RequestForm,{})]})})}t_.RequestForm=()=>{let[t,e]=M(""),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(null);async function l(d){let f=await LM(d),m=new Bk,h=window.__ROOT_CTX.rootConfig,g=[h.domain];h.base&&h.base!=="/"&&g.push(h.base);let _=g.join("");m.setMeta({locale:"en",context:_,last_modified:new Date().toISOString()}),console.log(f);for(let b in f){let y=f[b],v=new Set,C=b.split("/")[0],N=await Ah(C);Kb(v,N.fields,y.fields||{},N.types||{});for(let I of v){let E=await ES(I),w=m.get(E)?.meta;if(w){let S=w.context.split(", ");S.push(b),S.sort(),w.context=S.join(", ")}else w={context:b};m.add(E,I,w)}}return m}async function c(){try{let d=Rhe(t),f=await l(d);s(f)}catch(d){console.error(d),i(`failed to preview arb: ${d}`)}}async function u(){try{o(!0),console.log("download arb");let d=Rhe(t),m=(await l(d)).toString(),g=await new Response(m).blob(),_=document.createElement("a");_.href=window.URL.createObjectURL(g),_.download=Oet(d),document.body.appendChild(_),_.click(),document.body.removeChild(_),window.URL.revokeObjectURL(_.href),o(!1)}catch(d){console.error(d),i(`failed to download arb: ${d}`)}}return p("form",{className:"TranslationsArbPage__RequestForm",onSubmit:d=>{d.preventDefault(),u()},children:[p("div",{className:"TranslationsArbPage__RequestForm__textareaWrapper",children:p(yr,{required:!0,size:"xs",radius:0,autosize:!0,minRows:8,maxRows:20,value:t,placeholder:"Pages/index",onChange:d=>{e(d.currentTarget.value||"")}})}),p("div",{className:"TranslationsArbPage__RequestForm__submit",children:[p(re,{variant:"default",color:"dark",size:"xs",onClick:c,children:"Preview"}),p(re,{color:"blue",size:"xs",loading:r,type:"submit",leftIcon:p(yf,{size:16,strokeWidth:1.75}),children:"Download ARB"})]}),n&&p(Ye,{as:"p",className:"TranslationsArbPage__RequestForm__error",children:n}),a&&p(t_.Preview,{arb:a})]})};t_.Preview=t=>{let e=t.arb.list().filter(r=>!!r.meta);return console.log(e),p(fo,{verticalSpacing:"xs",highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"source"}),p("th",{children:"context"})]})}),p("tbody",{children:e.map(r=>p("tr",{class:"TranslationsArbPage__Preview__Table__row",children:[p("td",{children:r.source}),p("td",{children:[r.meta?.context,r.meta?.description&&p(Te,{children:["/ ",r.meta.description]})]})]},r.source))})]})};function Rhe(t){return t.split(`
248
+ `).map(e=>e.trim()).filter(e=>Pet(e))}function Pet(t){return!!t&&t.includes("/")&&t.split("/").length===2}function Oet(t){let e=new Date,r=a=>a.toString().padStart(2,"0"),o=`${e.getFullYear()}${r(e.getMonth()+1)}${r(e.getDate())}t${r(e.getHours())}${r(e.getMinutes())}`,n=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId,i=[Mhe(n)];return t.length===1&&i.push(Mhe(t[0])),i.push(o),`${i.join("_")}.arb`}function Mhe(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}Pe();function $k(t){let e=t.hash,[r,o]=M(!1),[n,i]=M(!1),[a,s]=M({source:""});async function l(){o(!0);let u=await xQ(e);if(o(!1),!u?.source){i(!0);return}s(u)}async function c(u){console.log(u),o(!0),await bQ(e,u),s(d=>({...d,...u})),o(!1),Ae({title:"Saved translations",message:`Updated translations for ${e}.`,autoClose:5e3})}return V(()=>{l()},[t.hash]),p(Fe,{children:p("div",{className:"TranslationsEditPage",children:[p("div",{className:"TranslationsEditPage__header",children:[p(Io,{className:"TranslationsEditPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:t.hash})]}),p(et,{size:"h1",children:"Edit Translations"})]}),r?p(Ze,{color:"gray",size:"xl"}):n?p("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):p($k.Form,{hash:t.hash,translations:a,onChange:c})]})})}$k.Form=t=>{let e=t.translations,o=(window.__ROOT_CTX.rootConfig.i18n.locales||[]).filter(n=>n!=="en");return p("form",{className:"TranslationsEditPage__Form",onSubmit:n=>{n.preventDefault();let i=n.currentTarget,a=["en",...o],s={};a.forEach(l=>{let c=i.elements[l].value;s[l]=ic(c)}),t.onChange(s)},children:[p(ir,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"hash",label:"hash",value:t.hash,disabled:!0}),p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"source",label:"source",value:e.source,disabled:!0}),p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"en",label:"en",value:e.en}),o.map(n=>p(yr,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:n,label:n,value:e[n]||""},n)),p(re,{className:"TranslationsEditPage__Form__input__submit",color:"blue",size:"xs",type:"submit",children:"Save"})]})};Pe();function zk(){return p(Fe,{children:p("div",{className:"TranslationsPage",children:[p("div",{className:"TranslationsPage__header",children:[p(et,{size:"h1",children:"Translations"}),p("div",{className:"TranslationsPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/translations/arb",children:"Download ARB"})})]}),p(zk.TranslationsTable,{})]})})}function Aet(t){return t?Array.isArray(t)?t.sort():[t]:[]}zk.TranslationsTable=()=>{let[t,e]=M(!0),[r,o]=M([]),[n,i]=M({}),a=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=["en",...a.filter(b=>b!=="en").sort()],[l,c]=GC("locale",s),u=window.__ROOT_CTX.collections;async function d(){e(!0),await er(async()=>{i(await Su())}),e(!1)}async function f(){let b=[];Object.entries(n).forEach(([y,v])=>{b.push({hash:y,source:v.source,locales:l.map(C=>v[C]||""),tags:v.tags})}),b.sort((y,v)=>y.source.toLowerCase().localeCompare(v.source.toLowerCase())),o(b)}V(()=>{d()},[]),V(()=>{f()},[n,l]);function m(b){l.length===a.length?c([b]):c(a)}if(t)return p(Ze,{color:"gray",size:"xl"});if(r.length===0)return p("div",{className:"TranslationsPage__TranslationsTable",children:p("div",{className:"TranslationsPage__TranslationsTable__empty",children:"No translations in the system yet."})});let _=["hash","source",...r[0].locales.map((b,y)=>l[y]),"tags"];return p("div",{className:"TranslationsPage__TranslationsTable",children:p(fo,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:_.map((b,y)=>{let v=b;return p("th",{"data-col":_[y],className:"TranslationsPage__TranslationsTable__cell",children:p(Se,{className:"TranslationsPage__TranslationsTable__headerTooltip",placement:"start",withArrow:!0,label:l.length===s.length?`Show only ${v}`:"Show all locales",children:p("div",{className:"TranslationsPage__TranslationsTable__localeHeader",onClick:()=>{m(v)},children:v})})},_[y])})})}),p("tbody",{children:r.map(b=>p("tr",{children:[p("td",{"data-col":"hash","data-string-cell":!1,class:"TranslationsPage__TranslationsTable__cell",children:p("a",{href:`/cms/translations/${b.hash}`,children:b.hash})},"hash"),p("td",{"data-col":"source","data-string-cell":!0,class:"TranslationsPage__TranslationsTable__cell",children:b.source},"source"),b.locales.map((y,v)=>p("td",{"data-col":l[v],"data-string-cell":!0,class:"TranslationsPage__TranslationsTable__cell",children:y},l[v])),p("td",{"data-col":"tags","data-string-cell":!1,class:"TranslationsPage__TranslationsTable__cell",children:p(Te,{children:Aet(b.tags).map(y=>{let v={},C="div";if(y.includes("/")){let[N,I]=y.split("/");u[N]&&(C="a",Object.assign(v,{target:"_blank",href:`/cms/content/${N}/${I}`}))}else u[y]&&(C="a",Object.assign(v,{target:"_blank",href:`/cms/content/${y}`}));return p("div",{children:p(C,{...v,className:"TranslationsPage__TranslationsTable__Tag",children:y})},y)})})},"tags")]},b.hash))})]})})};function Det(){return p(II,{theme:{fontFamily:"Inter, sans-serif",fontSizes:{xs:12,sm:14,md:16,lg:18,xl:20}},children:p(SE,{children:p(WL.Provider,{value:window.firebase,children:p(qoe,{children:p(fre,{children:p(Xoe,{children:p(XP,{modals:{[nC.id]:nC,[lC.id]:lC,[Du.id]:Du,[Ru.id]:Ru,[fC.id]:fC,[hC.id]:hC,[Ph.id]:Ph,[Oh.id]:Oh,[oa.id]:oa,[Lu.id]:Lu,[FC.id]:FC,[BC.id]:BC,[$C.id]:$C},children:p(YR,{children:[p(Wr,{path:"/cms",component:Rk}),p(Wr,{path:"/cms/ai",component:Ute}),p(Wr,{path:"/cms/assets",component:Joe}),p(Wr,{path:"/cms/compare",component:nne}),p(Wr,{path:"/cms/content/:collection?",component:jh}),p(Wr,{path:"/cms/content/:collection/:slug",component:Ok}),p(Wr,{path:"/cms/data",component:jC}),p(Wr,{path:"/cms/data/new",component:khe}),p(Wr,{path:"/cms/data/:id",component:ia}),p(Wr,{path:"/cms/data/:id/edit",component:Ehe}),p(Wr,{path:"/cms/logs",component:The}),p(Wr,{path:"/cms/releases",component:Lk}),p(Wr,{path:"/cms/releases/new",component:Nhe}),p(Wr,{path:"/cms/releases/:id",component:xd}),p(Wr,{path:"/cms/releases/:id/edit",component:She}),p(Wr,{path:"/cms/settings",component:Ahe}),p(Wr,{path:"/cms/tools/:id",component:Dhe}),p(Wr,{path:"/cms/translations",component:zk}),p(Wr,{path:"/cms/translations/arb",component:t_}),p(Wr,{path:"/cms/translations/:hash",component:$k}),p(Wr,{path:"/cms/translations/:collection/:slug",component:$u}),p(Wr,{default:!0,component:Phe})]})})})})})})})})}function Ret(){let t=window.location.pathname;window.location.search&&(t=`${t}?${window.location.search}`);let e=new URLSearchParams({continue:t});window.location.replace(`/cms/login?${e.toString()}`)}var Uk=kO(window.__ROOT_CTX.firebaseConfig),Met=window.__ROOT_CTX.firebaseConfig.databaseId||"(default)",Let=IJ(Uk,{experimentalForceLongPolling:!0,useFetchStreams:!1},Met),Lhe=iA(Uk),Fet=nQ(Uk);Lhe.onAuthStateChanged(t=>{if(!t){Ret();return}window.firebase={app:Uk,auth:Lhe,db:Let,storage:Fet,user:t};let e=document.getElementById("root");e.innerHTML="",$c(p(Det,{}),e),Bet(t)});async function Bet(t){let e=await t.getIdToken(),r=await fetch("/cms/login",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:e})});if(r.status!==200){console.error("login failed"),console.log(r);return}if(!(await r.json()).success){console.error("login failed"),console.log(r);return}}})();