pwa-auth 3.6.0 → 3.7.0

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.
Files changed (90) hide show
  1. package/README.md +139 -484
  2. package/base/export/drawer.d.ts +2 -0
  3. package/base/export/drawer.d.ts.map +1 -0
  4. package/base/export/drawer.js +2 -0
  5. package/base/export/drawer.js.map +1 -0
  6. package/base/export/icon.d.ts +2 -0
  7. package/base/export/icon.d.ts.map +1 -0
  8. package/base/export/icon.js +2 -0
  9. package/base/export/icon.js.map +1 -0
  10. package/base/export/login.d.ts +2 -0
  11. package/base/export/login.d.ts.map +1 -0
  12. package/base/export/login.js +2 -0
  13. package/base/export/login.js.map +1 -0
  14. package/base/export/reset.d.ts +2 -0
  15. package/base/export/reset.d.ts.map +1 -0
  16. package/base/export/reset.js +2 -0
  17. package/base/export/reset.js.map +1 -0
  18. package/base/export/settings.d.ts +2 -0
  19. package/base/export/settings.d.ts.map +1 -0
  20. package/base/export/settings.js +2 -0
  21. package/base/export/settings.js.map +1 -0
  22. package/base/webcomponents/css/animation.d.ts.map +1 -1
  23. package/base/webcomponents/css/animation.js +35 -63
  24. package/base/webcomponents/css/animation.js.map +1 -1
  25. package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -1
  26. package/base/webcomponents/drawer/css/drawer.js +11 -7
  27. package/base/webcomponents/drawer/css/drawer.js.map +1 -1
  28. package/base/webcomponents/drawer/css/exit.js +1 -1
  29. package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -1
  30. package/base/webcomponents/drawer/css/paragraph.js +10 -3
  31. package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
  32. package/base/webcomponents/drawer/drawer.d.ts +24 -0
  33. package/base/webcomponents/drawer/drawer.d.ts.map +1 -1
  34. package/base/webcomponents/drawer/drawer.js +265 -17
  35. package/base/webcomponents/drawer/drawer.js.map +1 -1
  36. package/base/webcomponents/form/css/button.d.ts.map +1 -1
  37. package/base/webcomponents/form/css/button.js +15 -16
  38. package/base/webcomponents/form/css/button.js.map +1 -1
  39. package/base/webcomponents/form/css/input.d.ts.map +1 -1
  40. package/base/webcomponents/form/css/input.js +10 -1
  41. package/base/webcomponents/form/css/input.js.map +1 -1
  42. package/base/webcomponents/form/css/label.d.ts.map +1 -1
  43. package/base/webcomponents/form/css/label.js +19 -1
  44. package/base/webcomponents/form/css/label.js.map +1 -1
  45. package/base/webcomponents/form/css/list.d.ts.map +1 -1
  46. package/base/webcomponents/form/css/list.js +2 -1
  47. package/base/webcomponents/form/css/list.js.map +1 -1
  48. package/base/webcomponents/form/css/notice.js +3 -3
  49. package/base/webcomponents/form/css/status.d.ts.map +1 -1
  50. package/base/webcomponents/form/css/status.js +18 -5
  51. package/base/webcomponents/form/css/status.js.map +1 -1
  52. package/base/webcomponents/form/css/toggle.d.ts.map +1 -1
  53. package/base/webcomponents/form/css/toggle.js +7 -0
  54. package/base/webcomponents/form/css/toggle.js.map +1 -1
  55. package/base/webcomponents/form/forgot.d.ts.map +1 -1
  56. package/base/webcomponents/form/forgot.js +5 -4
  57. package/base/webcomponents/form/forgot.js.map +1 -1
  58. package/base/webcomponents/form/login.js +1 -1
  59. package/base/webcomponents/form/signup.js +1 -1
  60. package/base/webcomponents/icon/css/icon.d.ts.map +1 -1
  61. package/base/webcomponents/icon/css/icon.js +9 -0
  62. package/base/webcomponents/icon/css/icon.js.map +1 -1
  63. package/base/webcomponents/login/css/auth.d.ts.map +1 -1
  64. package/base/webcomponents/login/css/auth.js +9 -4
  65. package/base/webcomponents/login/css/auth.js.map +1 -1
  66. package/base/webcomponents/login/page.d.ts +20 -1
  67. package/base/webcomponents/login/page.d.ts.map +1 -1
  68. package/base/webcomponents/login/page.js +182 -6
  69. package/base/webcomponents/login/page.js.map +1 -1
  70. package/base/webcomponents/settings/css/navigation.js +3 -3
  71. package/base/webcomponents/settings/input/delete.d.ts.map +1 -1
  72. package/base/webcomponents/settings/input/delete.js +7 -1
  73. package/base/webcomponents/settings/input/delete.js.map +1 -1
  74. package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
  75. package/base/webcomponents/settings/input/uploader.js +8 -4
  76. package/base/webcomponents/settings/input/uploader.js.map +1 -1
  77. package/base/webcomponents/settings/input/verify.d.ts.map +1 -1
  78. package/base/webcomponents/settings/input/verify.js +24 -7
  79. package/base/webcomponents/settings/input/verify.js.map +1 -1
  80. package/base/webcomponents/settings/settings.d.ts +19 -1
  81. package/base/webcomponents/settings/settings.d.ts.map +1 -1
  82. package/base/webcomponents/settings/settings.js +177 -12
  83. package/base/webcomponents/settings/settings.js.map +1 -1
  84. package/docs/drawer-slide.md +206 -0
  85. package/docs/sliders.md +38 -31
  86. package/package.json +48 -10
  87. package/source/pwa-auth.js +400 -260
  88. package/source/pwa-styles.css +0 -7
  89. package/firebase.md +0 -125
  90. package/intro.md +0 -19
@@ -4,7 +4,12 @@
4
4
  * Licensed under MIT
5
5
  */
6
6
 
7
- const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),s=new WeakMap;let r=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const n=this.t;if(t&&void 0===e){const t=void 0!==n&&1===n.length;t&&(e=s.get(n)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&s.set(n,e))}return e}toString(){return this.cssText}};const i=(e,...t)=>{const s=1===e.length?e[0]:t.reduce((t,n,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[s+1],e[0]);return new r(s,e,n)},a=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,n))(t)})(e):e,{is:o,defineProperty:B,getOwnPropertyDescriptor:c,getOwnPropertyNames:l,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,p=globalThis,d=p.trustedTypes,f=d?d.emptyScript:"",C=p.reactiveElementPolyfillSupport,g=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},w=(e,t)=>!o(e,t),E={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let y=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=E){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(e,n,t);void 0!==s&&B(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){const{get:s,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const i=s?.call(this);r?.call(this,t),this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??E}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const e=h(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const e=this.properties,t=[...l(e),...u(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,s)=>{if(t)n.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of s){const s=document.createElement("style"),r=e.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,n.appendChild(s)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(void 0!==s&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:m).toAttribute(t,n.type);this._$Em=e,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,s=n._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=n.getPropertyOptions(s),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:m;this._$Em=s;const i=r.fromAttribute(t,e.type);this[s]=i??this._$Ej?.get(s)??i,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const s=this.constructor,r=this[e];if(n??=s.getPropertyOptions(e),!((n.hasChanged??w)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:s,wrapped:r},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??t??this[e]),!0!==r||void 0!==i)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,n,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[g("elementProperties")]=new Map,y[g("finalized")]=new Map,C?.({ReactiveElement:y}),(p.reactiveElementVersions??=[]).push("2.1.1");const D=globalThis,_=D.trustedTypes,b=_?_.createPolicy("lit-html",{createHTML:e=>e}):void 0,v="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+I,A=`<${T}>`,O=document,S=()=>O.createComment(""),N=e=>null===e||"object"!=typeof e&&"function"!=typeof e,R=Array.isArray,k="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,x=/-->/g,F=/>/g,P=RegExp(`>|${k}(?:([^\\s"'>=/]+)(${k}*=${k}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,G=/"/g,U=/^(?:script|style|textarea|title)$/i,H=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),V=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),$=new WeakMap,J=O.createTreeWalker(O,129);function q(e,t){if(!R(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(t):t}const z=(e,t)=>{const n=e.length-1,s=[];let r,i=2===t?"<svg>":3===t?"<math>":"",a=L;for(let t=0;t<n;t++){const n=e[t];let o,B,c=-1,l=0;for(;l<n.length&&(a.lastIndex=l,B=a.exec(n),null!==B);)l=a.lastIndex,a===L?"!--"===B[1]?a=x:void 0!==B[1]?a=F:void 0!==B[2]?(U.test(B[2])&&(r=RegExp("</"+B[2],"g")),a=P):void 0!==B[3]&&(a=P):a===P?">"===B[0]?(a=r??L,c=-1):void 0===B[1]?c=-2:(c=a.lastIndex-B[2].length,o=B[1],a=void 0===B[3]?P:'"'===B[3]?G:M):a===G||a===M?a=P:a===x||a===F?a=L:(a=P,r=void 0);const u=a===P&&e[t+1].startsWith("/>")?" ":"";i+=a===L?n+A:c>=0?(s.push(o),n.slice(0,c)+v+n.slice(c)+I+u):n+I+(-2===c?t:u)}return[q(e,i+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class K{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,i=0;const a=e.length-1,o=this.parts,[B,c]=z(e,t);if(this.el=K.createElement(B,n),J.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=J.nextNode())&&o.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(v)){const t=c[i++],n=s.getAttribute(e).split(I),a=/([.?@])?(.*)/.exec(t);o.push({type:1,index:r,name:a[2],strings:n,ctor:"."===a[1]?Z:"?"===a[1]?ee:"@"===a[1]?te:X}),s.removeAttribute(e)}else e.startsWith(I)&&(o.push({type:6,index:r}),s.removeAttribute(e));if(U.test(s.tagName)){const e=s.textContent.split(I),t=e.length-1;if(t>0){s.textContent=_?_.emptyScript:"";for(let n=0;n<t;n++)s.append(e[n],S()),J.nextNode(),o.push({type:2,index:++r});s.append(e[t],S())}}}else if(8===s.nodeType)if(s.data===T)o.push({type:2,index:r});else{let e=-1;for(;-1!==(e=s.data.indexOf(I,e+1));)o.push({type:7,index:r}),e+=I.length-1}r++}}static createElement(e,t){const n=O.createElement("template");return n.innerHTML=e,n}}function Q(e,t,n=e,s){if(t===V)return t;let r=void 0!==s?n._$Co?.[s]:n._$Cl;const i=N(t)?void 0:t._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(e),r._$AT(e,n,s)),void 0!==s?(n._$Co??=[])[s]=r:n._$Cl=r),void 0!==r&&(t=Q(e,r._$AS(e,t.values),r,s)),t}let W=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,s=(e?.creationScope??O).importNode(t,!0);J.currentNode=s;let r=J.nextNode(),i=0,a=0,o=n[0];for(;void 0!==o;){if(i===o.index){let t;2===o.type?t=new Y(r,r.nextSibling,this,e):1===o.type?t=new o.ctor(r,o.name,o.strings,this,e):6===o.type&&(t=new ne(r,this,e)),this._$AV.push(t),o=n[++a]}i!==o?.index&&(r=J.nextNode(),i++)}return J.currentNode=O,s}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Y=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Q(this,e,t),N(e)?e===j||null==e||""===e?(this._$AH!==j&&this._$AR(),this._$AH=j):e!==this._$AH&&e!==V&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>R(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==j&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,s="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new W(s,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=$.get(e.strings);return void 0===t&&$.set(e.strings,t=new K(e)),t}k(t){R(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,r=0;for(const i of t)r===n.length?n.push(s=new e(this.O(S()),this.O(S()),this,this.options)):s=n[r],s._$AI(i),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},X=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=j,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(e,t=this,n,s){const r=this.strings;let i=!1;if(void 0===r)e=Q(this,e,t,0),i=!N(e)||e!==this._$AH&&e!==V,i&&(this._$AH=e);else{const s=e;let a,o;for(e=r[0],a=0;a<r.length-1;a++)o=Q(this,s[n+a],t,a),o===V&&(o=this._$AH[a]),i||=!N(o)||o!==this._$AH[a],o===j?e=j:e!==j&&(e+=(o??"")+r[a+1]),this._$AH[a]=o}i&&!s&&this.j(e)}j(e){e===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}};class Z extends X{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===j?void 0:e}}let ee=class extends X{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==j)}},te=class extends X{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=Q(this,e,t,0)??j)===V)return;const n=this._$AH,s=e===j&&n!==j||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==j&&(n===j||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}};class ne{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Q(this,e)}}const se=D.litHtmlPolyfillSupport;se?.(K,Y),(D.litHtmlVersions??=[]).push("3.3.1");const re=globalThis;let ie=class extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const s=n?.renderBefore??t;let r=s._$litPart$;if(void 0===r){const e=n?.renderBefore??null;s._$litPart$=r=new Y(t.insertBefore(S(),e),e,void 0,n??{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};ie._$litElement$=!0,ie.finalized=!0,re.litElementHydrateSupport?.({LitElement:ie});const ae=re.litElementPolyfillSupport;ae?.({LitElement:ie}),(re.litElementVersions??=[]).push("4.2.1");const oe=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},Be={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:w},ce=(e=Be,t,n)=>{const{kind:s,metadata:r}=n;let i=globalThis.litPropertyMetadata.get(r);if(void 0===i&&globalThis.litPropertyMetadata.set(r,i=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),"accessor"===s){const{name:s}=n;return{set(n){const r=t.get.call(this);t.set.call(this,n),this.requestUpdate(s,r,e)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=n;return function(n){const r=this[s];t.call(this,n),this.requestUpdate(s,r,e)}}throw Error("Unsupported decorator location: "+s)};function le(e){return(t,n)=>"object"==typeof n?ce(e,t,n):((e,t,n)=>{const s=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),s?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function ue(e){return le({...e,state:!0,attribute:!1})}const he=e=>t=>class extends t{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=e.subscribe(()=>this.stateChanged(e.getState())),this.stateChanged(e.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(e){}};function pe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var de=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),fe=()=>Math.random().toString(36).substring(7).split("").join("."),Ce={INIT:`@@redux/INIT${fe()}`,REPLACE:`@@redux/REPLACE${fe()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${fe()}`};function ge(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function me(e,t,n){if("function"!=typeof e)throw new Error(pe(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(pe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(pe(1));return n(me)(e,t)}let s=e,r=t,i=new Map,a=i,o=0,B=!1;function c(){a===i&&(a=new Map,i.forEach((e,t)=>{a.set(t,e)}))}function l(){if(B)throw new Error(pe(3));return r}function u(e){if("function"!=typeof e)throw new Error(pe(4));if(B)throw new Error(pe(5));let t=!0;c();const n=o++;return a.set(n,e),function(){if(t){if(B)throw new Error(pe(6));t=!1,c(),a.delete(n),i=null}}}function h(e){if(!ge(e))throw new Error(pe(7));if(void 0===e.type)throw new Error(pe(8));if("string"!=typeof e.type)throw new Error(pe(17));if(B)throw new Error(pe(9));try{B=!0,r=s(r,e)}finally{B=!1}return(i=a).forEach(e=>{e()}),e}h({type:Ce.INIT});return{dispatch:h,subscribe:u,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error(pe(10));s=e,h({type:Ce.REPLACE})},[de]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(pe(11));function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[de](){return this}}}}}function we(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const r=t[s];"function"==typeof e[r]&&(n[r]=e[r])}const s=Object.keys(n);let r;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:Ce.INIT}))throw new Error(pe(12));if(void 0===n(void 0,{type:Ce.PROBE_UNKNOWN_ACTION()}))throw new Error(pe(13))})}(n)}catch(e){r=e}return function(e={},t){if(r)throw r;let i=!1;const a={};for(let r=0;r<s.length;r++){const o=s[r],B=n[o],c=e[o],l=B(c,t);if(void 0===l)throw t&&t.type,new Error(pe(14));a[o]=l,i=i||l!==c}return i=i||s.length!==Object.keys(e).length,i?a:e}}function Ee(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}var ye=Symbol.for("immer-nothing"),De=Symbol.for("immer-draftable"),_e=Symbol.for("immer-state");function be(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ve=Object,Ie=ve.getPrototypeOf,Te="constructor",Ae="prototype",Oe="configurable",Se="enumerable",Ne="writable",Re="value",ke=e=>!!e&&!!e[_e];function Le(e){return!!e&&(Pe(e)||je(e)||!!e[De]||!!e[Te]?.[De]||$e(e)||Je(e))}var xe=ve[Ae][Te].toString(),Fe=new WeakMap;function Pe(e){if(!e||!qe(e))return!1;const t=Ie(e);if(null===t||t===ve[Ae])return!0;const n=ve.hasOwnProperty.call(t,Te)&&t[Te];if(n===Object)return!0;if(!ze(n))return!1;let s=Fe.get(n);return void 0===s&&(s=Function.toString.call(n),Fe.set(n,s)),s===xe}function Me(e,t,n=!0){if(0===Ge(e)){(n?Reflect.ownKeys(e):ve.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,s)=>t(s,n,e))}function Ge(e){const t=e[_e];return t?t.type_:je(e)?1:$e(e)?2:Je(e)?3:0}var Ue=(e,t,n=Ge(e))=>2===n?e.has(t):ve[Ae].hasOwnProperty.call(e,t),He=(e,t,n=Ge(e))=>2===n?e.get(t):e[t],Ve=(e,t,n,s=Ge(e))=>{2===s?e.set(t,n):3===s?e.add(n):e[t]=n};var je=Array.isArray,$e=e=>e instanceof Map,Je=e=>e instanceof Set,qe=e=>"object"==typeof e,ze=e=>"function"==typeof e,Ke=e=>"boolean"==typeof e;var Qe=e=>e.copy_||e.base_,We=e=>e.modified_?e.copy_:e.base_;function Ye(e,t){if($e(e))return new Map(e);if(Je(e))return new Set(e);if(je(e))return Array[Ae].slice.call(e);const n=Pe(e);if(!0===t||"class_only"===t&&!n){const t=ve.getOwnPropertyDescriptors(e);delete t[_e];let n=Reflect.ownKeys(t);for(let s=0;s<n.length;s++){const r=n[s],i=t[r];!1===i[Ne]&&(i[Ne]=!0,i[Oe]=!0),(i.get||i.set)&&(t[r]={[Oe]:!0,[Ne]:!0,[Se]:i[Se],[Re]:e[r]})}return ve.create(Ie(e),t)}{const t=Ie(e);if(null!==t&&n)return{...e};const s=ve.create(t);return ve.assign(s,e)}}function Xe(e,t=!1){return et(e)||ke(e)||!Le(e)||(Ge(e)>1&&ve.defineProperties(e,{set:Ze,add:Ze,clear:Ze,delete:Ze}),ve.freeze(e),t&&Me(e,(e,t)=>{Xe(t,!0)},!1)),e}var Ze={[Re]:function(){be(2)}};function et(e){return null===e||!qe(e)||ve.isFrozen(e)}var tt="MapSet",nt="Patches",st="ArrayMethods",rt={};function it(e){const t=rt[e];return t||be(0),t}var at,ot=e=>!!rt[e],Bt=()=>at;function ct(e,t){t&&(e.patchPlugin_=it(nt),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function lt(e){ut(e),e.drafts_.forEach(pt),e.drafts_=null}function ut(e){e===at&&(at=e.parent_)}var ht=e=>at={drafts_:[],parent_:at,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ot(tt)?it(tt):void 0,arrayMethodsPlugin_:ot(st)?it(st):void 0};function pt(e){const t=e[_e];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function dt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[_e].modified_&&(lt(t),be(4)),Le(e)&&(e=ft(t,e));const{patchPlugin_:s}=t;s&&s.generateReplacementPatches_(n[_e].base_,e,t)}else e=ft(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xe(t,n)}(t,e,!0),lt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ye?e:void 0}function ft(e,t){if(et(t))return t;const n=t[_e];if(!n){return yt(t,e.handledSet_,e)}if(!gt(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}Et(n,e)}return n.copy_}function Ct(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var gt=(e,t)=>e.scope_===t,mt=[];function wt(e,t,n,s){const r=Qe(e),i=e.type_;if(void 0!==s){if(He(r,s,i)===t)return void Ve(r,s,n,i)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Me(r,(e,n)=>{if(ke(n)){const s=t.get(n)||[];s.push(e),t.set(n,s)}})}const a=e.draftLocations_.get(t)??mt;for(const e of a)Ve(r,e,n,i)}function Et(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const s=n.getPath(e);s&&n.generatePatches_(e,s,t)}Ct(e)}}function yt(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ke(e)||t.has(e)||!Le(e)||et(e)||(t.add(e),Me(e,(s,r)=>{if(ke(r)){const t=r[_e];if(gt(t,n)){const n=We(t);Ve(e,s,n,e.type_),Ct(t)}}else Le(r)&&yt(r,t,n)})),e}var Dt={get(e,t){if(t===_e)return e;let n=e.scope_.arrayMethodsPlugin_;const s=1===e.type_&&"string"==typeof t;if(s&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const r=Qe(e);if(!Ue(r,t,e.type_))return function(e,t,n){const s=vt(t,n);return s?Re in s?s[Re]:s.get?.call(e.draft_):void 0}(e,r,t);const i=r[t];if(e.finalized_||!Le(i))return i;if(s&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return i;if(i===bt(e.base_,t)){Tt(e);const n=1===e.type_?+t:t,s=At(e.scope_,i,e,n);return e.copy_[n]=s}return i},has:(e,t)=>t in Qe(e),ownKeys:e=>Reflect.ownKeys(Qe(e)),set(e,t,n){const s=vt(Qe(e),t);if(s?.set)return s.set.call(e.draft_,n),!0;if(!e.modified_){const s=bt(Qe(e),t),r=s?.[_e];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,s)&&(void 0!==n||Ue(e.base_,t,e.type_)))return!0;Tt(e),It(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:s}=e;if(ke(n)){const r=n[_e];gt(r,s)&&r.callbacks_.push(function(){Tt(e);const s=We(r);wt(e,n,s,t)})}else Le(n)&&e.callbacks_.push(function(){const r=Qe(e);3===e.type_?r.has(n)&&yt(n,s.handledSet_,s):He(r,t,e.type_)===n&&s.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&yt(He(e.copy_,t,e.type_),s.handledSet_,s)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Tt(e),void 0!==bt(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),It(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Qe(e),s=Reflect.getOwnPropertyDescriptor(n,t);return s?{[Ne]:!0,[Oe]:1!==e.type_||"length"!==t,[Se]:s[Se],[Re]:n[t]}:s},defineProperty(){be(11)},getPrototypeOf:e=>Ie(e.base_),setPrototypeOf(){be(12)}},_t={};for(let e in Dt){let t=Dt[e];_t[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function bt(e,t){const n=e[_e];return(n?Qe(n):e)[t]}function vt(e,t){if(!(t in e))return;let n=Ie(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ie(n)}}function It(e){e.modified_||(e.modified_=!0,e.parent_&&It(e.parent_))}function Tt(e){e.copy_||(e.assigned_=new Map,e.copy_=Ye(e.base_,e.scope_.immer_.useStrictShallowCopy_))}_t.deleteProperty=function(e,t){return _t.set.call(this,e,t,void 0)},_t.set=function(e,t,n){return Dt.set.call(this,e[0],t,n,e[0])};function At(e,t,n,s){const[r,i]=$e(t)?it(tt).proxyMap_(t,n):Je(t)?it(tt).proxySet_(t,n):function(e,t){const n=je(e),s={type_:n?1:0,scope_:t?t.scope_:Bt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=s,i=Dt;n&&(r=[s],i=_t);const{revoke:a,proxy:o}=Proxy.revocable(r,i);return s.draft_=o,s.revoke_=a,[o,s]}(t,n);return(n?.scope_??Bt()).drafts_.push(r),i.callbacks_=n?.callbacks_??[],i.key_=s,n&&void 0!==s?function(e,t,n){e.callbacks_.push(function(s){const r=t;if(!r||!gt(r,s))return;s.mapSetPlugin_?.fixSetContents(r);const i=We(r);wt(e,r.draft_??r,i,n),Et(r,s)})}(n,i,s):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),r}function Ot(e){if(!Le(e)||et(e))return e;const t=e[_e];let n,s=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ye(e,t.scope_.immer_.useStrictShallowCopy_),s=t.scope_.immer_.shouldUseStrictIteration()}else n=Ye(e,!0);return Me(n,(e,t)=>{Ve(n,e,Ot(t))},s),t&&(t.finalized_=!1),n}var St=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(ze(e)&&!ze(t)){const n=t;t=e;const s=this;return function(e=n,...r){return s.produce(e,e=>t.call(this,e,...r))}}let s;if(ze(t)||be(6),void 0===n||ze(n)||be(7),Le(e)){const r=ht(this),i=At(r,e,void 0);let a=!0;try{s=t(i),a=!1}finally{a?lt(r):ut(r)}return ct(r,n),dt(s,r)}if(!e||!qe(e)){if(s=t(e),void 0===s&&(s=e),s===ye&&(s=void 0),this.autoFreeze_&&Xe(s,!0),n){const t=[],r=[];it(nt).generateReplacementPatches_(e,s,{patches_:t,inversePatches_:r}),n(t,r)}return s}be(1)},this.produceWithPatches=(e,t)=>{if(ze(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,s;const r=this.produce(e,t,(e,t)=>{n=e,s=t});return[r,n,s]},Ke(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ke(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ke(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Le(e)||be(8),ke(e)&&(e=function(e){ke(e)||be(10);return Ot(e)}(e));const t=ht(this),n=At(t,e,void 0);return n[_e].isManual_=!0,ut(t),n}finishDraft(e,t){const n=e&&e[_e];n&&n.isManual_||be(9);const{scope_:s}=n;return ct(s,t),dt(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const s=t[n];if(0===s.path.length&&"replace"===s.op){e=s.value;break}}n>-1&&(t=t.slice(n+1));const s=it(nt).applyPatches_;return ke(e)?s(e,t):this.produce(e,e=>s(e,t))}},Nt=St.produce;function Rt(e){return({dispatch:t,getState:n})=>s=>r=>"function"==typeof r?r(t,n,e):s(r)}var kt=Rt(),Lt=Rt;const xt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ee:Ee.apply(null,arguments)};function Ft(e,t){function n(...n){if(t){let s=t(...n);if(!s)throw new Error(Qt(0));return{type:e,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return ge(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Pt=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Mt(e){return Le(e)?Nt(e,()=>{}):e}function Gt(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}const Ut=e=>t=>{setTimeout(t,e)},Ht=(e={type:"raf"})=>t=>(...n)=>{const s=t(...n);let r=!0,i=!1,a=!1;const o=new Set,B="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,l=100,e=>{let t,n,s=!1;const r=()=>{s||(s=!0,cancelAnimationFrame(t),clearTimeout(n),e())};t=c(r),n=setTimeout(r,l)}):Ut(10):"callback"===e.type?e.queueNotification:Ut(e.timeout);var c,l;const u=()=>{a=!1,i&&(i=!1,o.forEach(e=>e()))};return Object.assign({},s,{subscribe(e){const t=s.subscribe(()=>r&&e());return o.add(e),()=>{t(),o.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(a||(a=!0,B(u))),s.dispatch(e)}finally{r=!0}}})};function Vt(e){const t={},n=[];let s;const r={addCase(e,n){const s="string"==typeof e?e:e.type;if(!s)throw new Error(Qt(28));if(s in t)throw new Error(Qt(29));return t[s]=n,r},addAsyncThunk:(e,s)=>(s.pending&&(t[e.pending.type]=s.pending),s.rejected&&(t[e.rejected.type]=s.rejected),s.fulfilled&&(t[e.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:e.settled,reducer:s.settled}),r),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),r),addDefaultCase:e=>(s=e,r)};return e(r),[t,n,s]}const jt=Symbol.for("rtk-slice-createasyncthunk");function $t(e,t){return`${e}/${t}`}function Jt({creators:e}={}){const t=e?.asyncThunk?.[jt];return function(e){const{name:n,reducerPath:s=n}=e;if(!n)throw new Error(Qt(11));const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},o={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Qt(12));if(n in a.sliceCaseReducersByType)throw new Error(Qt(13));return a.sliceCaseReducersByType[n]=t,o},addMatcher:(e,t)=>(a.sliceMatchers.push({matcher:e,reducer:t}),o),exposeAction:(e,t)=>(a.actionCreators[e]=t,o),exposeCaseReducer:(e,t)=>(a.sliceCaseReducersByName[e]=t,o)};function B(){const[t={},n=[],s]="function"==typeof e.extraReducers?Vt(e.extraReducers):[e.extraReducers],r={...t,...a.sliceCaseReducersByType};return function(e,t){let n,[s,r,i]=Vt(t);if(function(e){return"function"==typeof e}(e))n=()=>Mt(e());else{const t=Mt(e);n=()=>t}function a(e=n(),t){let a=[s[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===a.filter(e=>!!e).length&&(a=[i]),a.reduce((e,n)=>{if(n){if(ke(e)){const s=n(e,t);return void 0===s?e:s}if(Le(e))return Nt(e,e=>n(e,t));{const s=n(e,t);if(void 0===s){if(null===e)return e;throw new Error(Qt(9))}return s}}return e},e)}return a.getInitialState=n,a}(e.initialState,e=>{for(let t in r)e.addCase(t,r[t]);for(let t of a.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);s&&e.addDefaultCase(s)})}i.forEach(s=>{const i=r[s],a={reducerName:s,type:$t(n,s),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},s,r){let i,a;if("reducer"in s){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(s))throw new Error(Qt(17));i=s.reducer,a=s.prepare}else i=s;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?Ft(e,a):Ft(e))}(a,i,o):function({type:e,reducerName:t},n,s,r){if(!r)throw new Error(Qt(18));const{payloadCreator:i,fulfilled:a,pending:o,rejected:B,settled:c,options:l}=n,u=r(e,i,l);s.exposeAction(t,u),a&&s.addCase(u.fulfilled,a);o&&s.addCase(u.pending,o);B&&s.addCase(u.rejected,B);c&&s.addMatcher(u.settled,c);s.exposeCaseReducer(t,{fulfilled:a||Kt,pending:o||Kt,rejected:B||Kt,settled:c||Kt})}(a,i,o,t)});const c=e=>e,l=new Map,u=new WeakMap;let h;function p(e,t){return h||(h=B()),h(e,t)}function d(){return h||(h=B()),h.getInitialState()}function f(t,n=!1){function s(e){let r=e[t];return void 0===r&&n&&(r=Gt(u,s,d)),r}function r(t=c){return Gt(Gt(l,n,()=>new WeakMap),t,()=>{const s={};for(const[r,i]of Object.entries(e.selectors??{}))s[r]=qt(i,t,()=>Gt(u,t,d),n);return s})}return{reducerPath:t,getSelectors:r,get selectors(){return r(s)},selectSlice:s}}const C={name:n,reducer:p,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:d,...f(s),injectInto(e,{reducerPath:t,...n}={}){const r=t??s;return e.inject({reducerPath:r,reducer:p},n),{...C,...f(r,!0)}}};return C}}function qt(e,t,n,s){function r(r,...i){let a=t(r);return void 0===a&&s&&(a=n()),e(a,...i)}return r.unwrapped=e,r}const zt=Jt();function Kt(){}function Qt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Wt=zt({name:"user",initialState:{settings:"profile",login:!1,drawer:!1,registerOne:!1,registerTwo:!1,userId:"user",customer:"",profileChoice:"unChosen",name:"",photoURL:"",phone:"(...) ... - ....",email:""},reducers:{navigateAuth:(e,t)=>{switch(t.payload){case"profile":case"verification":case"password":case"delete":break;default:t.payload="profile"}e.settings=t.payload},userAuth:(e,t)=>{e.login=t.payload},toggleSign:e=>{!0===e.drawer?e.drawer=!1:e.drawer=!0},openSign:e=>{e.drawer=!0},closeSign:e=>{e.drawer=!1},signUpAction:e=>{!1===e.registerOne?e.registerOne=!0:e.registerOne=!1},universalToggle:(e,t)=>{"drawer"===t.payload?!1===e.registerOne?e.registerOne=!0:e.registerOne=!1:!1===e.registerTwo?e.registerTwo=!0:e.registerTwo=!1},signUpClose:(e,t)=>{e.registerOne=t.payload},iconAuth:(e,t)=>{e.photoURL=t.payload},nameAuth:(e,t)=>{e.name=t.payload}}}),{universalToggle:Yt,navigateAuth:Xt,iconAuth:Zt,nameAuth:en,userAuth:tn,toggleSign:nn,openSign:sn,closeSign:rn,signUpAction:an,signUpClose:on}=Wt.actions,Bn=zt({name:"backend",initialState:{verified:!1,anon:!1,userId:"",name:"",email:"",photoURL:"",phone:"",msgToken:""},reducers:{accVerified:(e,t)=>{e.verified=t.payload},accAnon:(e,t)=>{e.anon=t.payload},accID:(e,t)=>{e.userId=t.payload},accName:(e,t)=>{e.name=t.payload},accPhone:(e,t)=>{e.phone=t.payload},accEmail:(e,t)=>{e.email=t.payload},accImage:(e,t)=>{e.photoURL=t.payload},messageId:(e,t)=>{e.msgToken=t.payload}}}),{accVerified:cn,accID:ln,accName:un,accPhone:hn,accEmail:pn,accImage:dn,accAnon:fn,messageId:Cn}=Bn.actions,gn=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:r=!0}=e??{};let i=new Pt;return t&&(function(e){return"boolean"==typeof e}(t)?i.push(kt):i.push(Lt(t.extraArgument))),i},{reducer:n,middleware:s,devTools:r=!0,preloadedState:i,enhancers:a}=e||{};let o,B;if("function"==typeof n)o=n;else{if(!ge(n))throw new Error(Qt(1));o=we(n)}B="function"==typeof s?s(t):t();let c=Ee;r&&(c=xt({trace:!1,..."object"==typeof r&&r}));const l=function(...e){return t=>(n,s)=>{const r=t(n,s);let i=()=>{throw new Error(pe(15))};const a={getState:r.getState,dispatch:(e,...t)=>i(e,...t)},o=e.map(e=>e(a));return i=Ee(...o)(r.dispatch),{...r,dispatch:i}}}(...B),u=(e=>function(t){const{autoBatch:n=!0}=t??{};let s=new Pt(e);return n&&s.push(Ht("object"==typeof n?n:void 0)),s})(l);return me(o,i,c(..."function"==typeof a?a(u):u()))}({reducer:{frontend:Wt.reducer,backend:Bn.reducer},devTools:!0}),mn=i`
7
+ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),s=new WeakMap;let r=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=s.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(n,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[s+1],t[0]);return new r(s,t,n)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:a,defineProperty:B,getOwnPropertyDescriptor:c,getOwnPropertyNames:l,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,d=globalThis,p=d.trustedTypes,f=p?p.emptyScript:"",C=d.reactiveElementPolyfillSupport,g=(t,e)=>t,m={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},w=(t,e)=>!a(t,e),y={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),d.litPropertyMetadata??=new WeakMap;let E=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(t,n,e);void 0!==s&&B(this.prototype,t,s)}}static getPropertyDescriptor(t,e,n){const{get:s,set:r}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const i=s?.call(this);r?.call(this,e),this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...l(t),...u(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,s)=>{if(e)n.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=e.cssText,n.appendChild(s)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,n);if(void 0!==s&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:m).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,s=n._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=n.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:m;this._$Em=s;const i=r.fromAttribute(e,t.type);this[s]=i??this._$Ej?.get(s)??i,this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){const s=this.constructor,r=this[t];if(n??=s.getPropertyOptions(t),!((n.hasChanged??w)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:s,wrapped:r},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,n,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[g("elementProperties")]=new Map,E[g("finalized")]=new Map,C?.({ReactiveElement:E}),(d.reactiveElementVersions??=[]).push("2.1.1");const D=globalThis,_=D.trustedTypes,b=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,v="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+I,O=`<${T}>`,A=document,S=()=>A.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,x="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,F=/>/g,P=RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,G=/"/g,H=/^(?:script|style|textarea|title)$/i,U=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),V=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),$=new WeakMap,J=A.createTreeWalker(A,129);function q(t,e){if(!N(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(e):e}const z=(t,e)=>{const n=t.length-1,s=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=k;for(let e=0;e<n;e++){const n=t[e];let a,B,c=-1,l=0;for(;l<n.length&&(o.lastIndex=l,B=o.exec(n),null!==B);)l=o.lastIndex,o===k?"!--"===B[1]?o=L:void 0!==B[1]?o=F:void 0!==B[2]?(H.test(B[2])&&(r=RegExp("</"+B[2],"g")),o=P):void 0!==B[3]&&(o=P):o===P?">"===B[0]?(o=r??k,c=-1):void 0===B[1]?c=-2:(c=o.lastIndex-B[2].length,a=B[1],o=void 0===B[3]?P:'"'===B[3]?G:M):o===G||o===M?o=P:o===L||o===F?o=k:(o=P,r=void 0);const u=o===P&&t[e+1].startsWith("/>")?" ":"";i+=o===k?n+O:c>=0?(s.push(a),n.slice(0,c)+v+n.slice(c)+I+u):n+I+(-2===c?e:u)}return[q(t,i+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class K{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let r=0,i=0;const o=t.length-1,a=this.parts,[B,c]=z(t,e);if(this.el=K.createElement(B,n),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=J.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(v)){const e=c[i++],n=s.getAttribute(t).split(I),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:n,ctor:"."===o[1]?Z:"?"===o[1]?tt:"@"===o[1]?et:X}),s.removeAttribute(t)}else t.startsWith(I)&&(a.push({type:6,index:r}),s.removeAttribute(t));if(H.test(s.tagName)){const t=s.textContent.split(I),e=t.length-1;if(e>0){s.textContent=_?_.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],S()),J.nextNode(),a.push({type:2,index:++r});s.append(t[e],S())}}}else if(8===s.nodeType)if(s.data===T)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(I,t+1));)a.push({type:7,index:r}),t+=I.length-1}r++}}static createElement(t,e){const n=A.createElement("template");return n.innerHTML=t,n}}function Q(t,e,n=t,s){if(e===V)return e;let r=void 0!==s?n._$Co?.[s]:n._$Cl;const i=R(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,n,s)),void 0!==s?(n._$Co??=[])[s]=r:n._$Cl=r),void 0!==r&&(e=Q(t,r._$AS(t,e.values),r,s)),e}let W=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??A).importNode(e,!0);J.currentNode=s;let r=J.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Y(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new nt(r,this,t)),this._$AV.push(e),a=n[++o]}i!==a?.index&&(r=J.nextNode(),i++)}return J.currentNode=A,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},Y=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,s){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),R(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>N(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==j&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new W(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=$.get(t.strings);return void 0===e&&$.set(t.strings,e=new K(t)),e}k(e){N(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,r=0;for(const i of e)r===n.length?n.push(s=new t(this.O(S()),this.O(S()),this,this.options)):s=n[r],s._$AI(i),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},X=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,r){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(t,e=this,n,s){const r=this.strings;let i=!1;if(void 0===r)t=Q(this,t,e,0),i=!R(t)||t!==this._$AH&&t!==V,i&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=Q(this,s[n+o],e,o),a===V&&(a=this._$AH[o]),i||=!R(a)||a!==this._$AH[o],a===j?t=j:t!==j&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!s&&this.j(t)}j(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}};class Z extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===j?void 0:t}}let tt=class extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==j)}},et=class extends X{constructor(t,e,n,s,r){super(t,e,n,s,r),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??j)===V)return;const n=this._$AH,s=t===j&&n!==j||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==j&&(n===j||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}};class nt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const st=D.litHtmlPolyfillSupport;st?.(K,Y),(D.litHtmlVersions??=[]).push("3.3.1");const rt=globalThis;let it=class extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const s=n?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=n?.renderBefore??null;s._$litPart$=r=new Y(e.insertBefore(S(),t),t,void 0,n??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};it._$litElement$=!0,it.finalized=!0,rt.litElementHydrateSupport?.({LitElement:it});const ot=rt.litElementPolyfillSupport;ot?.({LitElement:it}),(rt.litElementVersions??=[]).push("4.2.1");const at=t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},Bt={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:w},ct=(t=Bt,e,n)=>{const{kind:s,metadata:r}=n;let i=globalThis.litPropertyMetadata.get(r);if(void 0===i&&globalThis.litPropertyMetadata.set(r,i=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),i.set(n.name,t),"accessor"===s){const{name:s}=n;return{set(n){const r=e.get.call(this);e.set.call(this,n),this.requestUpdate(s,r,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=n;return function(n){const r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+s)};function lt(t){return(e,n)=>"object"==typeof n?ct(t,e,n):((t,e,n)=>{const s=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),s?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function ut(t){return lt({...t,state:!0,attribute:!1})}const ht=1,dt=t=>(...e)=>({_$litDirective$:t,values:e});let pt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const ft=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const n=t.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return V}}),Ct="important",gt=" !"+Ct,mt=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,n)=>{const s=t[n];return null==s?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const s=e[t];if(null!=s){this.ft.add(t);const e="string"==typeof s&&s.endsWith(gt);t.includes("-")||e?n.setProperty(t,e?s.slice(0,-11):s,e?Ct:""):n[t]=s}}return V}}),wt=t=>e=>class extends e{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=t.subscribe(()=>this.stateChanged(t.getState())),this.stateChanged(t.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(t){}};function yt(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Et=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Dt=()=>Math.random().toString(36).substring(7).split("").join("."),_t={INIT:`@@redux/INIT${Dt()}`,REPLACE:`@@redux/REPLACE${Dt()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Dt()}`};function bt(t){if("object"!=typeof t||null===t)return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||null===Object.getPrototypeOf(t)}function vt(t,e,n){if("function"!=typeof t)throw new Error(yt(2));if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(yt(0));if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error(yt(1));return n(vt)(t,e)}let s=t,r=e,i=new Map,o=i,a=0,B=!1;function c(){o===i&&(o=new Map,i.forEach((t,e)=>{o.set(e,t)}))}function l(){if(B)throw new Error(yt(3));return r}function u(t){if("function"!=typeof t)throw new Error(yt(4));if(B)throw new Error(yt(5));let e=!0;c();const n=a++;return o.set(n,t),function(){if(e){if(B)throw new Error(yt(6));e=!1,c(),o.delete(n),i=null}}}function h(t){if(!bt(t))throw new Error(yt(7));if(void 0===t.type)throw new Error(yt(8));if("string"!=typeof t.type)throw new Error(yt(17));if(B)throw new Error(yt(9));try{B=!0,r=s(r,t)}finally{B=!1}return(i=o).forEach(t=>{t()}),t}h({type:_t.INIT});return{dispatch:h,subscribe:u,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error(yt(10));s=t,h({type:_t.REPLACE})},[Et]:function(){const t=u;return{subscribe(e){if("object"!=typeof e||null===e)throw new Error(yt(11));function n(){const t=e;t.next&&t.next(l())}n();return{unsubscribe:t(n)}},[Et](){return this}}}}}function It(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const r=e[s];"function"==typeof t[r]&&(n[r]=t[r])}const s=Object.keys(n);let r;try{!function(t){Object.keys(t).forEach(e=>{const n=t[e];if(void 0===n(void 0,{type:_t.INIT}))throw new Error(yt(12));if(void 0===n(void 0,{type:_t.PROBE_UNKNOWN_ACTION()}))throw new Error(yt(13))})}(n)}catch(t){r=t}return function(t={},e){if(r)throw r;let i=!1;const o={};for(let r=0;r<s.length;r++){const a=s[r],B=n[a],c=t[a],l=B(c,e);if(void 0===l)throw e&&e.type,new Error(yt(14));o[a]=l,i=i||l!==c}return i=i||s.length!==Object.keys(t).length,i?o:t}}function Tt(...t){return 0===t.length?t=>t:1===t.length?t[0]:t.reduce((t,e)=>(...n)=>t(e(...n)))}var Ot=Symbol.for("immer-nothing"),At=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Rt(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Nt=Object,xt=Nt.getPrototypeOf,kt="constructor",Lt="prototype",Ft="configurable",Pt="enumerable",Mt="writable",Gt="value",Ht=t=>!!t&&!!t[St];function Ut(t){return!!t&&($t(t)||Wt(t)||!!t[At]||!!t[kt]?.[At]||Yt(t)||Xt(t))}var Vt=Nt[Lt][kt].toString(),jt=new WeakMap;function $t(t){if(!t||!Zt(t))return!1;const e=xt(t);if(null===e||e===Nt[Lt])return!0;const n=Nt.hasOwnProperty.call(e,kt)&&e[kt];if(n===Object)return!0;if(!te(n))return!1;let s=jt.get(n);return void 0===s&&(s=Function.toString.call(n),jt.set(n,s)),s===Vt}function Jt(t,e,n=!0){if(0===qt(t)){(n?Reflect.ownKeys(t):Nt.keys(t)).forEach(n=>{e(n,t[n],t)})}else t.forEach((n,s)=>e(s,n,t))}function qt(t){const e=t[St];return e?e.type_:Wt(t)?1:Yt(t)?2:Xt(t)?3:0}var zt=(t,e,n=qt(t))=>2===n?t.has(e):Nt[Lt].hasOwnProperty.call(t,e),Kt=(t,e,n=qt(t))=>2===n?t.get(e):t[e],Qt=(t,e,n,s=qt(t))=>{2===s?t.set(e,n):3===s?t.add(n):t[e]=n};var Wt=Array.isArray,Yt=t=>t instanceof Map,Xt=t=>t instanceof Set,Zt=t=>"object"==typeof t,te=t=>"function"==typeof t,ee=t=>"boolean"==typeof t;var ne=t=>t.copy_||t.base_,se=t=>t.modified_?t.copy_:t.base_;function re(t,e){if(Yt(t))return new Map(t);if(Xt(t))return new Set(t);if(Wt(t))return Array[Lt].slice.call(t);const n=$t(t);if(!0===e||"class_only"===e&&!n){const e=Nt.getOwnPropertyDescriptors(t);delete e[St];let n=Reflect.ownKeys(e);for(let s=0;s<n.length;s++){const r=n[s],i=e[r];!1===i[Mt]&&(i[Mt]=!0,i[Ft]=!0),(i.get||i.set)&&(e[r]={[Ft]:!0,[Mt]:!0,[Pt]:i[Pt],[Gt]:t[r]})}return Nt.create(xt(t),e)}{const e=xt(t);if(null!==e&&n)return{...t};const s=Nt.create(e);return Nt.assign(s,t)}}function ie(t,e=!1){return ae(t)||Ht(t)||!Ut(t)||(qt(t)>1&&Nt.defineProperties(t,{set:oe,add:oe,clear:oe,delete:oe}),Nt.freeze(t),e&&Jt(t,(t,e)=>{ie(e,!0)},!1)),t}var oe={[Gt]:function(){Rt(2)}};function ae(t){return null===t||!Zt(t)||Nt.isFrozen(t)}var Be="MapSet",ce="Patches",le="ArrayMethods",ue={};function he(t){const e=ue[t];return e||Rt(0),e}var de,pe=t=>!!ue[t],fe=()=>de;function Ce(t,e){e&&(t.patchPlugin_=he(ce),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function ge(t){me(t),t.drafts_.forEach(ye),t.drafts_=null}function me(t){t===de&&(de=t.parent_)}var we=t=>de={drafts_:[],parent_:de,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:pe(Be)?he(Be):void 0,arrayMethodsPlugin_:pe(le)?he(le):void 0};function ye(t){const e=t[St];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Ee(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(void 0!==t&&t!==n){n[St].modified_&&(ge(e),Rt(4)),Ut(t)&&(t=De(e,t));const{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(n[St].base_,t,e)}else t=De(e,n);return function(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&ie(e,n)}(e,t,!0),ge(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ot?t:void 0}function De(t,e){if(ae(e))return e;const n=e[St];if(!n){return Oe(e,t.handledSet_,t)}if(!be(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:e}=n;if(e)for(;e.length>0;){e.pop()(t)}Te(n,t)}return n.copy_}function _e(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var be=(t,e)=>t.scope_===e,ve=[];function Ie(t,e,n,s){const r=ne(t),i=t.type_;if(void 0!==s){if(Kt(r,s,i)===e)return void Qt(r,s,n,i)}if(!t.draftLocations_){const e=t.draftLocations_=new Map;Jt(r,(t,n)=>{if(Ht(n)){const s=e.get(n)||[];s.push(t),e.set(n,s)}})}const o=t.draftLocations_.get(e)??ve;for(const t of o)Qt(r,t,n,i)}function Te(t,e){if(t.modified_&&!t.finalized_&&(3===t.type_||1===t.type_&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:n}=e;if(n){const s=n.getPath(t);s&&n.generatePatches_(t,s,e)}_e(t)}}function Oe(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ht(t)||e.has(t)||!Ut(t)||ae(t)||(e.add(t),Jt(t,(s,r)=>{if(Ht(r)){const e=r[St];if(be(e,n)){const n=se(e);Qt(t,s,n,t.type_),_e(e)}}else Ut(r)&&Oe(r,e,n)})),t}var Ae={get(t,e){if(e===St)return t;let n=t.scope_.arrayMethodsPlugin_;const s=1===t.type_&&"string"==typeof e;if(s&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const r=ne(t);if(!zt(r,e,t.type_))return function(t,e,n){const s=Ne(e,n);return s?Gt in s?s[Gt]:s.get?.call(t.draft_):void 0}(t,r,e);const i=r[e];if(t.finalized_||!Ut(i))return i;if(s&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&function(t){const e=+t;return Number.isInteger(e)&&String(e)===t}(e))return i;if(i===Re(t.base_,e)){ke(t);const n=1===t.type_?+e:e,s=Le(t.scope_,i,t,n);return t.copy_[n]=s}return i},has:(t,e)=>e in ne(t),ownKeys:t=>Reflect.ownKeys(ne(t)),set(t,e,n){const s=Ne(ne(t),e);if(s?.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const s=Re(ne(t),e),r=s?.[St];if(r&&r.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(n,s)&&(void 0!==n||zt(t.base_,e,t.type_)))return!0;ke(t),xe(t)}return t.copy_[e]===n&&(void 0!==n||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),function(t,e,n){const{scope_:s}=t;if(Ht(n)){const r=n[St];be(r,s)&&r.callbacks_.push(function(){ke(t);const s=se(r);Ie(t,n,s,e)})}else Ut(n)&&t.callbacks_.push(function(){const r=ne(t);3===t.type_?r.has(n)&&Oe(n,s.handledSet_,s):Kt(r,e,t.type_)===n&&s.drafts_.length>1&&!0===(t.assigned_.get(e)??!1)&&t.copy_&&Oe(Kt(t.copy_,e,t.type_),s.handledSet_,s)})}(t,e,n)),!0},deleteProperty:(t,e)=>(ke(t),void 0!==Re(t.base_,e)||e in t.base_?(t.assigned_.set(e,!1),xe(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const n=ne(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s?{[Mt]:!0,[Ft]:1!==t.type_||"length"!==e,[Pt]:s[Pt],[Gt]:n[e]}:s},defineProperty(){Rt(11)},getPrototypeOf:t=>xt(t.base_),setPrototypeOf(){Rt(12)}},Se={};for(let t in Ae){let e=Ae[t];Se[t]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}function Re(t,e){const n=t[St];return(n?ne(n):t)[e]}function Ne(t,e){if(!(e in t))return;let n=xt(t);for(;n;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=xt(n)}}function xe(t){t.modified_||(t.modified_=!0,t.parent_&&xe(t.parent_))}function ke(t){t.copy_||(t.assigned_=new Map,t.copy_=re(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Se.deleteProperty=function(t,e){return Se.set.call(this,t,e,void 0)},Se.set=function(t,e,n){return Ae.set.call(this,t[0],e,n,t[0])};function Le(t,e,n,s){const[r,i]=Yt(e)?he(Be).proxyMap_(e,n):Xt(e)?he(Be).proxySet_(e,n):function(t,e){const n=Wt(t),s={type_:n?1:0,scope_:e?e.scope_:fe(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=s,i=Ae;n&&(r=[s],i=Se);const{revoke:o,proxy:a}=Proxy.revocable(r,i);return s.draft_=a,s.revoke_=o,[a,s]}(e,n);return(n?.scope_??fe()).drafts_.push(r),i.callbacks_=n?.callbacks_??[],i.key_=s,n&&void 0!==s?function(t,e,n){t.callbacks_.push(function(s){const r=e;if(!r||!be(r,s))return;s.mapSetPlugin_?.fixSetContents(r);const i=se(r);Ie(t,r.draft_??r,i,n),Te(r,s)})}(n,i,s):i.callbacks_.push(function(t){t.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:e}=t;i.modified_&&e&&e.generatePatches_(i,[],t)}),r}function Fe(t){if(!Ut(t)||ae(t))return t;const e=t[St];let n,s=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=re(t,e.scope_.immer_.useStrictShallowCopy_),s=e.scope_.immer_.shouldUseStrictIteration()}else n=re(t,!0);return Jt(n,(t,e)=>{Qt(n,t,Fe(e))},s),e&&(e.finalized_=!1),n}var Pe=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,e,n)=>{if(te(t)&&!te(e)){const n=e;e=t;const s=this;return function(t=n,...r){return s.produce(t,t=>e.call(this,t,...r))}}let s;if(te(e)||Rt(6),void 0===n||te(n)||Rt(7),Ut(t)){const r=we(this),i=Le(r,t,void 0);let o=!0;try{s=e(i),o=!1}finally{o?ge(r):me(r)}return Ce(r,n),Ee(s,r)}if(!t||!Zt(t)){if(s=e(t),void 0===s&&(s=t),s===Ot&&(s=void 0),this.autoFreeze_&&ie(s,!0),n){const e=[],r=[];he(ce).generateReplacementPatches_(t,s,{patches_:e,inversePatches_:r}),n(e,r)}return s}Rt(1)},this.produceWithPatches=(t,e)=>{if(te(t))return(e,...n)=>this.produceWithPatches(e,e=>t(e,...n));let n,s;const r=this.produce(t,e,(t,e)=>{n=t,s=e});return[r,n,s]},ee(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ee(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ee(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ut(t)||Rt(8),Ht(t)&&(t=function(t){Ht(t)||Rt(10);return Fe(t)}(t));const e=we(this),n=Le(e,t,void 0);return n[St].isManual_=!0,me(e),n}finishDraft(t,e){const n=t&&t[St];n&&n.isManual_||Rt(9);const{scope_:s}=n;return Ce(s,e),Ee(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(0===s.path.length&&"replace"===s.op){t=s.value;break}}n>-1&&(e=e.slice(n+1));const s=he(ce).applyPatches_;return Ht(t)?s(t,e):this.produce(t,t=>s(t,e))}},Me=Pe.produce;function Ge(t){return({dispatch:e,getState:n})=>s=>r=>"function"==typeof r?r(e,n,t):s(r)}var He=Ge(),Ue=Ge;const Ve="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Tt:Tt.apply(null,arguments)};function je(t,e){function n(...n){if(e){let s=e(...n);if(!s)throw new Error(nn(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:n[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=e=>function(t){return bt(t)&&"type"in t&&"string"==typeof t.type}(e)&&e.type===t,n}var $e=class t extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,t.prototype)}static get[Symbol.species](){return t}concat(...t){return super.concat.apply(this,t)}prepend(...e){return 1===e.length&&Array.isArray(e[0])?new t(...e[0].concat(this)):new t(...e.concat(this))}};function Je(t){return Ut(t)?Me(t,()=>{}):t}function qe(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}const ze=t=>e=>{setTimeout(e,t)},Ke=(t={type:"raf"})=>e=>(...n)=>{const s=e(...n);let r=!0,i=!1,o=!1;const a=new Set,B="tick"===t.type?queueMicrotask:"raf"===t.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,l=100,t=>{let e,n,s=!1;const r=()=>{s||(s=!0,cancelAnimationFrame(e),clearTimeout(n),t())};e=c(r),n=setTimeout(r,l)}):ze(10):"callback"===t.type?t.queueNotification:ze(t.timeout);var c,l;const u=()=>{o=!1,i&&(i=!1,a.forEach(t=>t()))};return Object.assign({},s,{subscribe(t){const e=s.subscribe(()=>r&&t());return a.add(t),()=>{e(),a.delete(t)}},dispatch(t){try{return r=!t?.meta?.RTK_autoBatch,i=!r,i&&(o||(o=!0,B(u))),s.dispatch(t)}finally{r=!0}}})};function Qe(t){const e={},n=[];let s;const r={addCase(t,n){const s="string"==typeof t?t:t.type;if(!s)throw new Error(nn(28));if(s in e)throw new Error(nn(29));return e[s]=n,r},addAsyncThunk:(t,s)=>(s.pending&&(e[t.pending.type]=s.pending),s.rejected&&(e[t.rejected.type]=s.rejected),s.fulfilled&&(e[t.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:t.settled,reducer:s.settled}),r),addMatcher:(t,e)=>(n.push({matcher:t,reducer:e}),r),addDefaultCase:t=>(s=t,r)};return t(r),[e,n,s]}const We=Symbol.for("rtk-slice-createasyncthunk");function Ye(t,e){return`${t}/${e}`}function Xe({creators:t}={}){const e=t?.asyncThunk?.[We];return function(t){const{name:n,reducerPath:s=n}=t;if(!n)throw new Error(nn(11));const r=("function"==typeof t.reducers?t.reducers(function(){function t(t,e){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...e}}return t.withTypes=()=>t,{reducer:t=>Object.assign({[t.name]:(...e)=>t(...e)}[t.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(t,e)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:e}),asyncThunk:t}}()):t.reducers)||{},i=Object.keys(r),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(t,e){const n="string"==typeof t?t:t.type;if(!n)throw new Error(nn(12));if(n in o.sliceCaseReducersByType)throw new Error(nn(13));return o.sliceCaseReducersByType[n]=e,a},addMatcher:(t,e)=>(o.sliceMatchers.push({matcher:t,reducer:e}),a),exposeAction:(t,e)=>(o.actionCreators[t]=e,a),exposeCaseReducer:(t,e)=>(o.sliceCaseReducersByName[t]=e,a)};function B(){const[e={},n=[],s]="function"==typeof t.extraReducers?Qe(t.extraReducers):[t.extraReducers],r={...e,...o.sliceCaseReducersByType};return function(t,e){let n,[s,r,i]=Qe(e);if(function(t){return"function"==typeof t}(t))n=()=>Je(t());else{const e=Je(t);n=()=>e}function o(t=n(),e){let o=[s[e.type],...r.filter(({matcher:t})=>t(e)).map(({reducer:t})=>t)];return 0===o.filter(t=>!!t).length&&(o=[i]),o.reduce((t,n)=>{if(n){if(Ht(t)){const s=n(t,e);return void 0===s?t:s}if(Ut(t))return Me(t,t=>n(t,e));{const s=n(t,e);if(void 0===s){if(null===t)return t;throw new Error(nn(9))}return s}}return t},t)}return o.getInitialState=n,o}(t.initialState,t=>{for(let e in r)t.addCase(e,r[e]);for(let e of o.sliceMatchers)t.addMatcher(e.matcher,e.reducer);for(let e of n)t.addMatcher(e.matcher,e.reducer);s&&t.addDefaultCase(s)})}i.forEach(s=>{const i=r[s],o={reducerName:s,type:Ye(n,s),createNotation:"function"==typeof t.reducers};!function(t){return"asyncThunk"===t._reducerDefinitionType}(i)?function({type:t,reducerName:e,createNotation:n},s,r){let i,o;if("reducer"in s){if(n&&!function(t){return"reducerWithPrepare"===t._reducerDefinitionType}(s))throw new Error(nn(17));i=s.reducer,o=s.prepare}else i=s;r.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,o?je(t,o):je(t))}(o,i,a):function({type:t,reducerName:e},n,s,r){if(!r)throw new Error(nn(18));const{payloadCreator:i,fulfilled:o,pending:a,rejected:B,settled:c,options:l}=n,u=r(t,i,l);s.exposeAction(e,u),o&&s.addCase(u.fulfilled,o);a&&s.addCase(u.pending,a);B&&s.addCase(u.rejected,B);c&&s.addMatcher(u.settled,c);s.exposeCaseReducer(e,{fulfilled:o||en,pending:a||en,rejected:B||en,settled:c||en})}(o,i,a,e)});const c=t=>t,l=new Map,u=new WeakMap;let h;function d(t,e){return h||(h=B()),h(t,e)}function p(){return h||(h=B()),h.getInitialState()}function f(e,n=!1){function s(t){let r=t[e];return void 0===r&&n&&(r=qe(u,s,p)),r}function r(e=c){return qe(qe(l,n,()=>new WeakMap),e,()=>{const s={};for(const[r,i]of Object.entries(t.selectors??{}))s[r]=Ze(i,e,()=>qe(u,e,p),n);return s})}return{reducerPath:e,getSelectors:r,get selectors(){return r(s)},selectSlice:s}}const C={name:n,reducer:d,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:p,...f(s),injectInto(t,{reducerPath:e,...n}={}){const r=e??s;return t.inject({reducerPath:r,reducer:d},n),{...C,...f(r,!0)}}};return C}}function Ze(t,e,n,s){function r(r,...i){let o=e(r);return void 0===o&&s&&(o=n()),t(o,...i)}return r.unwrapped=t,r}const tn=Xe();function en(){}function nn(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}const sn=tn({name:"user",initialState:{settings:"profile",login:!1,drawer:!1,registerOne:!1,registerTwo:!1,userId:"user",customer:"",profileChoice:"unChosen",name:"",photoURL:"",phone:"(...) ... - ....",email:""},reducers:{navigateAuth:(t,e)=>{switch(e.payload){case"profile":case"verification":case"password":case"delete":break;default:e.payload="profile"}t.settings=e.payload},userAuth:(t,e)=>{t.login=e.payload},toggleSign:t=>{!0===t.drawer?t.drawer=!1:t.drawer=!0},openSign:t=>{t.drawer=!0},closeSign:t=>{t.drawer=!1},signUpAction:t=>{!1===t.registerOne?t.registerOne=!0:t.registerOne=!1},universalToggle:(t,e)=>{"drawer"===e.payload?!1===t.registerOne?t.registerOne=!0:t.registerOne=!1:!1===t.registerTwo?t.registerTwo=!0:t.registerTwo=!1},signUpClose:(t,e)=>{t.registerOne=e.payload},iconAuth:(t,e)=>{t.photoURL=e.payload},nameAuth:(t,e)=>{t.name=e.payload}}}),{universalToggle:rn,navigateAuth:on,iconAuth:an,nameAuth:Bn,userAuth:cn,toggleSign:ln,openSign:un,closeSign:hn,signUpAction:dn,signUpClose:pn}=sn.actions,fn=tn({name:"backend",initialState:{verified:!1,anon:!1,userId:"",name:"",email:"",photoURL:"",phone:"",msgToken:""},reducers:{accVerified:(t,e)=>{t.verified=e.payload},accAnon:(t,e)=>{t.anon=e.payload},accID:(t,e)=>{t.userId=e.payload},accName:(t,e)=>{t.name=e.payload},accPhone:(t,e)=>{t.phone=e.payload},accEmail:(t,e)=>{t.email=e.payload},accImage:(t,e)=>{t.photoURL=e.payload},messageId:(t,e)=>{t.msgToken=e.payload}}}),{accVerified:Cn,accID:gn,accName:mn,accPhone:wn,accEmail:yn,accImage:En,accAnon:Dn,messageId:_n}=fn.actions,bn=function(t){const e=function(t){const{thunk:e=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:r=!0}=t??{};let i=new $e;return e&&(function(t){return"boolean"==typeof t}(e)?i.push(He):i.push(Ue(e.extraArgument))),i},{reducer:n,middleware:s,devTools:r=!0,preloadedState:i,enhancers:o}=t||{};let a,B;if("function"==typeof n)a=n;else{if(!bt(n))throw new Error(nn(1));a=It(n)}B="function"==typeof s?s(e):e();let c=Tt;r&&(c=Ve({trace:!1,..."object"==typeof r&&r}));const l=function(...t){return e=>(n,s)=>{const r=e(n,s);let i=()=>{throw new Error(yt(15))};const o={getState:r.getState,dispatch:(t,...e)=>i(t,...e)},a=t.map(t=>t(o));return i=Tt(...a)(r.dispatch),{...r,dispatch:i}}}(...B),u=(t=>function(e){const{autoBatch:n=!0}=e??{};let s=new $e(t);return n&&s.push(Ke("object"==typeof n?n:void 0)),s})(l);return vt(a,i,c(..."function"==typeof o?o(u):u()))}({reducer:{frontend:sn.reducer,backend:fn.reducer},devTools:!0}),vn=i`
8
+
9
+ :host {
10
+ /* Required - this host's clock. It does not inherit onto a sibling component. */
11
+ --pwa_slide: 2s;
12
+ }
8
13
 
9
14
  .wrapper {
10
15
  display: grid;
@@ -37,12 +42,9 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
37
42
 
38
43
  backface-visibility: hidden;
39
44
 
40
- transition-property: transform;
41
- -webkit-transition-property: transform;
42
- transition-timing-function: ease-in-out;
43
- -webkit-transition-timing-function: ease-in-out;
44
- transition-duration: 2s;
45
- -webkit-transition-duration: 2s;
45
+ /* Required - no transition on the first paint. .motion on .inner arms it after boot. */
46
+ transition: none;
47
+ -webkit-transition: none;
46
48
 
47
49
  position:relative;
48
50
  z-index: 1;
@@ -62,96 +64,71 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
62
64
  z-index: 3;
63
65
  }
64
66
 
67
+ /* Required - arm the swap only after the first paint. Closed stays put until then.
68
+ The class lives on this component's .inner, so another component cannot set it. */
69
+ .motion .content {
70
+ transition: transform var(--pwa_slide, 2s) ease-in-out, visibility 0s linear var(--pwa_slide, 2s);
71
+ -webkit-transition: transform var(--pwa_slide, 2s) ease-in-out, visibility 0s linear var(--pwa_slide, 2s);
72
+ }
73
+
74
+ .motion .opened {
75
+ /* Required - show the arriving form immediately. The duration matches --pwa_slide. */
76
+ transition: transform var(--pwa_slide, 2s) ease-in-out, visibility 0s linear 0s;
77
+ -webkit-transition: transform var(--pwa_slide, 2s) ease-in-out, visibility 0s linear 0s;
78
+ }
79
+
65
80
  .closed {
66
- /* Required - max-height slide-out runs with the transform. */
67
- transform: translate3d(0, -102%, 0);
68
- animation: slide-out 2s ease-out forwards;
69
- visibility: visible;
81
+ /* Required - same cell, full width, slid up. Absolute so the row does not stretch and the transform can run. */
82
+ transform: translate3d(0, -100%, 0);
83
+ visibility: hidden;
70
84
  pointer-events: none;
71
- position: relative;
72
- overflow: hidden;
85
+ position: absolute;
86
+ top: 0;
87
+ left: 0;
73
88
  width: 100%;
74
- height: auto;
89
+ height: auto; /* Required - a stretched row pulls Update to the top */
75
90
  align-self: start;
76
91
  justify-self: start;
77
92
  z-index: 2;
78
93
  }
79
94
 
80
95
  @media (prefers-reduced-motion: reduce) {
81
- :host,
82
- .content,
83
- .opened,
84
- .closed {
85
- transition-duration: 0s;
86
- animation-duration: 0s;
96
+ :host {
97
+ --pwa_slide: 0s;
87
98
  }
88
99
  }
89
100
 
90
- `,wn=i`
101
+ `,In=i`
91
102
 
92
103
  :host {
93
104
  max-height: 0px;
94
- transition: max-height 1.4s ease-in-out;
95
- }
96
-
97
- :host([drawer]) {
98
- max-height: 100%;
99
- transition: max-height 1.4s ease-in-out;
100
- }
101
-
102
- .in {
103
- max-height: 0px;
105
+ min-height: 0px; /* Required - the box must be allowed to grow from 0 */
104
106
  visibility: hidden;
105
- transition: max-height 1.4s ease-in-out, visibility 0s linear 1.4s;
106
- }
107
-
108
- .spec-in {
109
- transform: translate3d(0, -100%, 0);
110
- transition: transform 1.5s;
111
- z-index: -1;
112
- animation-timing-function: linear;
107
+ pointer-events: none;
113
108
  }
114
109
 
115
- .out {
116
- max-height: 100%;
110
+ :host([sliding]) {
111
+ max-height: none;
117
112
  visibility: visible;
118
- transition: max-height 1.4s ease-in-out, visibility 0s;
119
- }
120
-
121
- .spec-out {
122
- transform: translate3d(0, 0, 0);
123
- transition: transform 2.2s;
124
- z-index: -1;
125
- animation-timing-function: linear;
126
- }
127
-
128
- @media (prefers-reduced-motion: reduce) {
129
- :host,
130
- .in,
131
- .out,
132
- .spec-in,
133
- .spec-out {
134
- transition-duration: 0s;
135
- animation-duration: 0s;
136
- }
113
+ pointer-events: auto;
137
114
  }
138
115
 
139
- `,En=[i`
140
-
141
- :host {
142
- transition: max-height 1.4s ease-in-out;
143
- }
116
+ `,Tn=[i`
144
117
 
145
118
  :host([animation]) {
146
119
  max-height: 100%;
147
- transition: max-height 1.4s ease-in-out;
148
120
  }
149
121
 
150
122
  `,i`
151
123
 
152
124
  :host {
153
- overflow: hidden;
154
- display: grid;
125
+ overflow: hidden; /* Required - clip the roll. Height eases on the host. */
126
+ display: block;
127
+ box-sizing: border-box;
128
+ width: 100%;
129
+ min-width: 0; /* Required - shrink inside a flex or grid track */
130
+ max-width: 100%;
131
+ background-color: var(--pwa_background, var(--section_background_color, #fff));
155
132
  }
156
133
 
157
134
  .spec[on] {
@@ -166,18 +143,18 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
166
143
  display: grid;
167
144
  overflow: hidden;
168
145
  color: var(--pwa_drawer_text_color, #1c2430);
169
- background-color: var(--section_background_color, #fffdf8);
146
+ background-color: var(--pwa_background, var(--section_background_color, #fff));
170
147
  }
171
148
 
172
149
  h3 {
173
150
  margin: 0;
174
- padding: 18px 16px 14px;
151
+ padding: 18px var(--pwa_inset, 0px) 14px;
175
152
  font-size: 1.15rem;
176
153
  font-weight: 600;
177
154
  border-bottom: 1px solid var(--pwa_line_color, #e3daca);
178
155
  }
179
156
 
180
- `],yn=i`
157
+ `],On=i`
181
158
 
182
159
  a {
183
160
  font-size: 0.95rem;
@@ -186,7 +163,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
186
163
  text-decoration: none;
187
164
  }
188
165
 
189
- `,Dn=i`
166
+ `,An=i`
190
167
 
191
168
  .setLog > p {
192
169
  margin: 12px;
@@ -194,7 +171,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
194
171
  text-align: center;
195
172
  }
196
173
 
197
- `,_n=i`
174
+ `,Sn=i`
198
175
 
199
176
  ul {
200
177
  list-style-type: none;
@@ -204,16 +181,17 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
204
181
 
205
182
  li {
206
183
  display: grid;
184
+ min-width: 0;
207
185
  }
208
186
 
209
187
  .divider {
210
188
  border-top: 2px dotted black;
211
189
  border-bottom: 2px dotted black;
212
190
  text-align: center;
213
- margin: 0 16px;
191
+ margin: 0;
214
192
  }
215
193
 
216
- `,bn=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++s)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},vn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const r=e[t],i=t+1<e.length,a=i?e[t+1]:0,o=t+2<e.length,B=o?e[t+2]:0,c=r>>2,l=(3&r)<<4|a>>4;let u=(15&a)<<2|B>>6,h=63&B;o||(h=64,i||(u=64)),s.push(n[c],n[l],n[u],n[h])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(bn(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const r=e[n++];if(r<128)t[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=e[n++];t[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(i>>10)),t[s++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const o=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==i||null==a||null==o)throw new In;const B=r<<2|i>>4;if(s.push(B),64!==a){const e=i<<4&240|a>>2;if(s.push(e),64!==o){const e=a<<6&192|o;s.push(e)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class In extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Tn=function(e){return function(e){const t=bn(e);return vn.encodeByteArray(t,!0)}(e).replace(/\./g,"")},An=function(e){try{return vn.decodeString(e,!0)}catch(e){}return null};const On=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Sn=()=>{try{return On()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&An(e[1]);return t&&JSON.parse(t)})()}catch(e){return}},Nn=e=>Sn()?.emulatorHosts?.[e],Rn=e=>{const t=Nn(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]},kn=()=>Sn()?.config,Ln=e=>Sn()?.[`_${e}`];class xn{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}function Fn(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",s=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...e};return[Tn(JSON.stringify({alg:"none",type:"JWT"})),Tn(JSON.stringify(i)),""].join(".")}function Pn(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Mn(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function Gn(){return!function(){const e=Sn()?.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Un(){try{return"object"==typeof indexedDB}catch(e){return!1}}function Hn(){return new Promise((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{t(r.error?.message||"")}}catch(e){t(e)}})}function Vn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class jn extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,jn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,$n.prototype.create)}}class $n{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},s=`${this.service}/${e}`,r=this.errors[e],i=r?function(e,t){try{let n=0,s="";for(;n<e.length;){const r=e.indexOf("{$",n);if(-1===r){s+=e.substring(n);break}const i=e.indexOf("}",r+2);if(-1===i){s+=e.substring(n);break}const a=e.substring(r+2,i),o=t[a];s+=e.substring(n,r)+(null!=o?String(o):`<${a}?>`),n=i+1}return s}catch(t){return e}}(r,n):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new jn(s,a,n)}}function Jn(e,t){if(e===t)return!0;const n=Object.keys(e),s=Object.keys(t);for(const r of n){if(!s.includes(r))return!1;const n=e[r],i=t[r];if(qn(n)&&qn(i)){if(!Jn(n,i))return!1}else if(n!==i)return!1}for(const e of s)if(!n.includes(e))return!1;return!0}function qn(e){return null!==e&&"object"==typeof e}function zn(e){const t=[];for(const[n,s]of Object.entries(e))Array.isArray(s)?s.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return t.length?"&"+t.join("&"):""}function Kn(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,s]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(s)}}),t}function Qn(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class Wn{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let s;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");s=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===s.next&&(s.next=Yn),void 0===s.error&&(s.error=Yn),void 0===s.complete&&(s.complete=Yn);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(e){}}),this.observers.push(s),r}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Yn(){}function Xn(e,t=1e3,n=2){const s=t*Math.pow(n,e),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function Zn(e){return e&&e._delegate?e._delegate:e}function es(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function ts(e){return(await fetch(e,{credentials:"include"})).ok}class ns{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const ss="[DEFAULT]";class rs{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new xn;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}}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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:ss})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=ss){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=ss){return this.instances.has(e)}getOptions(e=ss){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){const n=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(n)??new Set;s.add(e),this.onInitCallbacks.set(n,s);const r=this.instances.get(n);return r&&e(r,n),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===ss?void 0:s),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}var s;return n||null}normalizeInstanceIdentifier(e=ss){return this.component?this.component.multipleInstances?e:ss:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class is{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new rs(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var as;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(as||(as={}));const os={debug:as.DEBUG,verbose:as.VERBOSE,info:as.INFO,warn:as.WARN,error:as.ERROR,silent:as.SILENT},Bs=as.INFO,cs={[as.DEBUG]:"log",[as.VERBOSE]:"log",[as.INFO]:"info",[as.WARN]:"warn",[as.ERROR]:"error"},ls=(e,t,...n)=>{if(t<e.logLevel)return;(new Date).toISOString();if(!cs[t])throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class us{constructor(e){this.name=e,this._logLevel=Bs,this._logHandler=ls,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in as))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?os[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,as.DEBUG,...e),this._logHandler(this,as.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,as.VERBOSE,...e),this._logHandler(this,as.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,as.INFO,...e),this._logHandler(this,as.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,as.WARN,...e),this._logHandler(this,as.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,as.ERROR,...e),this._logHandler(this,as.ERROR,...e)}}let hs,ps;const ds=new WeakMap,fs=new WeakMap,Cs=new WeakMap,gs=new WeakMap,ms=new WeakMap;let ws={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return fs.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Cs.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ds(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Es(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ps||(ps=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(_s(this),t),Ds(ds.get(this))}:function(...t){return Ds(e.apply(_s(this),t))}:function(t,...n){const s=e.call(_s(this),t,...n);return Cs.set(s,t.sort?t.sort():[t]),Ds(s)}}function ys(e){return"function"==typeof e?Es(e):(e instanceof IDBTransaction&&function(e){if(fs.has(e))return;const t=new Promise((t,n)=>{const s=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",i),e.removeEventListener("abort",i)},r=()=>{t(),s()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",r),e.addEventListener("error",i),e.addEventListener("abort",i)});fs.set(e,t)}(e),t=e,(hs||(hs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,ws):e);var t}function Ds(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const s=()=>{e.removeEventListener("success",r),e.removeEventListener("error",i)},r=()=>{t(Ds(e.result)),s()},i=()=>{n(e.error),s()};e.addEventListener("success",r),e.addEventListener("error",i)});return t.then(t=>{t instanceof IDBCursor&&ds.set(t,e)}).catch(()=>{}),ms.set(t,e),t}(e);if(gs.has(e))return gs.get(e);const t=ys(e);return t!==e&&(gs.set(e,t),ms.set(t,e)),t}const _s=e=>ms.get(e);function bs(e,t,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const a=indexedDB.open(e,t),o=Ds(a);return s&&a.addEventListener("upgradeneeded",e=>{s(Ds(a.result),e.oldVersion,e.newVersion,Ds(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{i&&e.addEventListener("close",()=>i()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}const vs=["get","getKey","getAll","getAllKeys","count"],Is=["put","add","delete","clear"],Ts=new Map;function As(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ts.get(t))return Ts.get(t);const n=t.replace(/FromIndex$/,""),s=t!==n,r=Is.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!vs.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,r?"readwrite":"readonly");let a=i.store;return s&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),r&&i.done]))[0]};return Ts.set(t,i),i}ws=(e=>({...e,get:(t,n,s)=>As(t,n)||e.get(t,n,s),has:(t,n)=>!!As(t,n)||e.has(t,n)}))(ws);class Os{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===t?.type}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const Ss="@firebase/app",Ns="0.16.2",Rs=new us("@firebase/app"),ks="@firebase/app-compat",Ls="@firebase/analytics-compat",xs="@firebase/analytics",Fs="@firebase/app-check-compat",Ps="@firebase/app-check",Ms="@firebase/auth",Gs="@firebase/auth-compat",Us="@firebase/database",Hs="@firebase/data-connect",Vs="@firebase/database-compat",js="@firebase/functions",$s="@firebase/functions-compat",Js="@firebase/installations",qs="@firebase/installations-compat",zs="@firebase/messaging",Ks="@firebase/messaging-compat",Qs="@firebase/performance",Ws="@firebase/performance-compat",Ys="@firebase/remote-config",Xs="@firebase/remote-config-compat",Zs="@firebase/storage",er="@firebase/storage-compat",tr="@firebase/firestore",nr="@firebase/ai",sr="@firebase/firestore-compat",rr="firebase",ir="[DEFAULT]",ar={[Ss]:"fire-core",[ks]:"fire-core-compat",[xs]:"fire-analytics",[Ls]:"fire-analytics-compat",[Ps]:"fire-app-check",[Fs]:"fire-app-check-compat",[Ms]:"fire-auth",[Gs]:"fire-auth-compat",[Us]:"fire-rtdb",[Hs]:"fire-data-connect",[Vs]:"fire-rtdb-compat",[js]:"fire-fn",[$s]:"fire-fn-compat",[Js]:"fire-iid",[qs]:"fire-iid-compat",[zs]:"fire-fcm",[Ks]:"fire-fcm-compat",[Qs]:"fire-perf",[Ws]:"fire-perf-compat",[Ys]:"fire-rc",[Xs]:"fire-rc-compat",[Zs]:"fire-gcs",[er]:"fire-gcs-compat",[tr]:"fire-fst",[sr]:"fire-fst-compat",[nr]:"fire-vertex","fire-js":"fire-js",[rr]:"fire-js-all"},or=new Map,Br=new Map,cr=new Map;function lr(e,t){try{e.container.addComponent(t)}catch(n){Rs.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function ur(e){const t=e.name;if(cr.has(t))return Rs.debug(`There were multiple attempts to register component ${t}.`),!1;cr.set(t,e);for(const t of or.values())lr(t,e);for(const t of Br.values())lr(t,e);return!0}function hr(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function pr(e){return null!=e&&void 0!==e.settings}const dr=new $n("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class fr{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new ns("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 dr.create("app-deleted",{appName:this._name})}}const Cr="12.19.0";function gr(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const s={name:ir,automaticDataCollectionEnabled:!0,...t},r=s.name;if("string"!=typeof r||!r)throw dr.create("bad-app-name",{appName:String(r)});if(n||(n=kn()),!n)throw dr.create("no-options");const i=or.get(r);if(i){if(Jn(n,i.options)){if(Jn(s,i.config))return i;throw dr.create("duplicate-app",{appName:r,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(s)})}throw dr.create("duplicate-app",{appName:r,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(n)})}const a=new is(r);for(const e of cr.values())a.addComponent(e);const o=new fr(n,s,a);return or.set(r,o),o}function mr(e=ir){const t=or.get(e);if(!t&&e===ir&&kn())return gr();if(!t)throw dr.create("no-app",{appName:e});return t}function wr(e,t,n){let s=ar[e]??e;n&&(s+=`-${n}`);const r=s.match(/\s|\//),i=t.match(/\s|\//);if(r||i){const e=[`Unable to register library "${s}" with version "${t}":`];return r&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Rs.warn(e.join(" "))}ur(new ns(`${s}-version`,()=>({library:s,version:t}),"VERSION"))}const Er="firebase-heartbeat-store";let yr=null;function Dr(){return yr||(yr=bs("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Er)}catch(e){}}}).catch(e=>{throw dr.create("idb-open",{originalErrorMessage:e.message})})),yr}async function _r(e,t){try{const n=(await Dr()).transaction(Er,"readwrite"),s=n.objectStore(Er);await s.put(t,br(e)),await n.done}catch(e){if(e instanceof jn)Rs.warn(e.message);else{const t=dr.create("idb-set",{originalErrorMessage:e?.message});Rs.warn(t.message)}}}function br(e){return`${e.name}!${e.options.appId}`}class vr{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Tr(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Ir();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let s=1;s<e.length;s++)e[s].date<n&&(n=e[s].date,t=s);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Rs.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const e=Ir(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let s=e.slice();for(const r of e){const e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),Ar(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Ar(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=Tn(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return Rs.warn(e),""}}}function Ir(){return(new Date).toISOString().substring(0,10)}class Tr{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Un()&&Hn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Dr()).transaction(Er),n=await t.objectStore(Er).get(br(e));return await t.done,n}catch(e){if(e instanceof jn)Rs.warn(e.message);else{const t=dr.create("idb-get",{originalErrorMessage:e?.message});Rs.warn(t.message)}}}(this.app);return e?.heartbeats?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return _r(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return _r(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function Ar(e){return Tn(JSON.stringify({version:2,heartbeats:e})).length}var Or;function Sr(){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."}}Or="",ur(new ns("platform-logger",e=>new Os(e),"PRIVATE")),ur(new ns("heartbeat",e=>new vr(e),"PRIVATE")),wr(Ss,Ns,Or),wr(Ss,Ns,"esm2020"),wr("fire-js","");const Nr=Sr,Rr=new $n("auth","Firebase",{"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."}),kr=new us("@firebase/auth");function Lr(e,...t){kr.logLevel<=as.WARN&&kr.warn(`Auth (${Cr}): ${e}`,...t)}function xr(e,...t){kr.logLevel<=as.ERROR&&kr.error(`Auth (${Cr}): ${e}`,...t)}function Fr(e,...t){throw Hr(e,...t)}function Pr(e,...t){return Hr(e,...t)}function Mr(e,t,n){const s={...Nr(),[t]:n};return new $n("auth","Firebase",s).create(t,{appName:e.name})}function Gr(e){return Mr(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ur(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&Fr(e,"argument-error"),Mr(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Hr(e,...t){if("string"!=typeof e){const n=t[0],s=[...t.slice(1)];return s[0]&&(s[0].appName=e.name),e._errorFactory.create(n,...s)}return Rr.create(e,...t)}function Vr(e,t,...n){if(!e)throw Hr(t,...n)}function jr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw xr(t),new Error(t)}function $r(e,t){e||jr(t)}function Jr(){return"undefined"!=typeof self&&self.location?.href||""}function qr(){return"undefined"!=typeof self&&self.location?.protocol||null}function zr(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==qr()&&"https:"!==qr()&&!Mn()&&!("connection"in navigator)||navigator.onLine}class Kr{constructor(e,t){this.shortDelay=e,this.longDelay=t,$r(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Pn())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return zr()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Qr(e,t){$r(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class Wr{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void jr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void jr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void jr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Yr={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"},Xr=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Zr=new Kr(3e4,6e4);function ei(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function ti(e,t,n,s,r={}){return ni(e,r,async()=>{let r={},i={};s&&("GET"===t?i=s:r={body:JSON.stringify(s)});const a=zn({...i,key:e.config.apiKey}).slice(1),o=await e._getAdditionalHeaders();o["Content-Type"]="application/json",e.languageCode&&(o["X-Firebase-Locale"]=e.languageCode);const B={method:t,headers:o,...r};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(B.referrerPolicy="strict-origin-when-cross-origin"),e.emulatorConfig&&es(e.emulatorConfig.host)&&(B.credentials="include"),Wr.fetch()(await ri(e,e.config.apiHost,n,a),B)})}async function ni(e,t,n){e._canInitEmulator=!1;const s={...Yr,...t};try{const t=new ai(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw oi(e,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const t=r.ok?i.errorMessage:i.error.message,[n,a]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw oi(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw oi(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw oi(e,"user-disabled",i);const o=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw Mr(e,o,a);Fr(e,o)}}catch(t){if(t instanceof jn)throw t;Fr(e,"network-request-failed",{message:String(t)})}}async function si(e,t,n,s,r={}){const i=await ti(e,t,n,s,r);return"mfaPendingCredential"in i&&Fr(e,"multi-factor-auth-required",{_serverResponse:i}),i}async function ri(e,t,n,s){const r=`${t}${n}?${s}`,i=e,a=i.config.emulator?Qr(e.config,r):`${e.config.apiScheme}://${r}`;if(Xr.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(a).toString()}return a}function ii(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class ai{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Pr(this.auth,"network-request-failed")),Zr.get())})}}function oi(e,t,n){const s={appName:e.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=Pr(e,t,s);return r.customData._tokenResponse=n,r}function Bi(e){return void 0!==e&&void 0!==e.enterprise}class ci{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return ii(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function li(e,t){return ti(e,"POST","/v1/accounts:lookup",t)}function ui(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function hi(e){return 1e3*Number(e)}function pi(e){const[t,n,s]=e.split(".");if(void 0===t||void 0===n||void 0===s)return xr("JWT malformed, contained fewer than 3 sections"),null;try{const e=An(n);return e?JSON.parse(e):(xr("Failed to decode base64 JWT payload"),null)}catch(e){return xr("Caught error parsing JWT payload as JSON",e?.toString()),null}}function di(e){const t=pi(e);return Vr(t,"internal-error"),Vr(void 0!==t.exp,"internal-error"),Vr(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function fi(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof jn&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class Ci{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===e?.code&&this.schedule(!0))}this.schedule()}}class gi{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ui(this.lastLoginAt),this.creationTime=ui(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function mi(e){const t=e.auth,n=await e.getIdToken(),s=await fi(e,li(t,{idToken:n}));Vr(s?.users.length,t,"internal-error");const r=s.users[0];e._notifyReloadListener(r);const i=r.providerUserInfo?.length?wi(r.providerUserInfo):[],a=function(e,t){const n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,i),o=e.isAnonymous,B=!(e.email&&r.passwordHash||a?.length),c=!!o&&B,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new gi(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(e,l)}function wi(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}class Ei{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Vr(e.idToken,"internal-error"),Vr(void 0!==e.idToken,"internal-error"),Vr(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):di(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Vr(0!==e.length,"internal-error");const t=di(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Vr(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:s,expiresIn:r}=await async function(e,t){const n=await ni(e,{},async()=>{const n=zn({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:r}=e.config,i=await ri(e,s,"/v1/token",`key=${r}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const o={method:"POST",headers:a,body:n};return e.emulatorConfig&&es(e.emulatorConfig.host)&&(o.credentials="include"),Wr.fetch()(i,o)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:s,expirationTime:r}=t,i=new Ei;return n&&(Vr("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),s&&(Vr("string"==typeof s,"internal-error",{appName:e}),i.accessToken=s),r&&(Vr("number"==typeof r,"internal-error",{appName:e}),i.expirationTime=r),i}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 Ei,this.toJSON())}_performRefresh(){return jr("not implemented")}}function yi(e,t){Vr("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Di{constructor({uid:e,auth:t,stsTokenManager:n,...s}){this.providerId="firebase",this.proactiveRefresh=new Ci(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new gi(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await fi(this,this.stsTokenManager.getToken(this.auth,e));return Vr(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=Zn(e),s=await n.getIdToken(t),r=pi(s);Vr(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,a=i?.sign_in_provider;return{claims:r,token:s,authTime:ui(hi(r.auth_time)),issuedAtTime:ui(hi(r.iat)),expirationTime:ui(hi(r.exp)),signInProvider:a||null,signInSecondFactor:i?.sign_in_second_factor||null}}(this,e)}reload(){return async function(e){const t=Zn(e);await mi(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Vr(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new Di({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Vr(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await mi(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(pr(this.auth.app))return Promise.reject(Gr(this.auth));const e=await this.getIdToken();return await fi(this,async function(e,t){return ti(e,"POST","/v1/accounts:delete",t)}(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,t){const n=t.displayName??void 0,s=t.email??void 0,r=t.phoneNumber??void 0,i=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,B=t.createdAt??void 0,c=t.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:h,providerData:p,stsTokenManager:d}=t;Vr(l&&d,e,"internal-error");const f=Ei.fromJSON(this.name,d);Vr("string"==typeof l,e,"internal-error"),yi(n,e.name),yi(s,e.name),Vr("boolean"==typeof u,e,"internal-error"),Vr("boolean"==typeof h,e,"internal-error"),yi(r,e.name),yi(i,e.name),yi(a,e.name),yi(o,e.name),yi(B,e.name),yi(c,e.name);const C=new Di({uid:l,auth:e,email:s,emailVerified:u,displayName:n,isAnonymous:h,photoURL:i,phoneNumber:r,tenantId:a,stsTokenManager:f,createdAt:B,lastLoginAt:c});return p&&Array.isArray(p)&&(C.providerData=p.map(e=>({...e}))),o&&(C._redirectEventId=o),C}static async _fromIdTokenResponse(e,t,n=!1){const s=new Ei;s.updateFromServerResponse(t);const r=new Di({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:n});return await mi(r),r}static async _fromGetAccountInfoResponse(e,t,n){const s=t.users[0];Vr(void 0!==s.localId,"internal-error");const r=void 0!==s.providerUserInfo?wi(s.providerUserInfo):[],i=!(s.email&&s.passwordHash||r?.length),a=new Ei;a.updateFromIdToken(n);const o=new Di({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:i}),B={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:r,metadata:new gi(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash||r?.length)};return Object.assign(o,B),o}}const _i=new Map;function bi(e){$r(e instanceof Function,"Expected a class definition");let t=_i.get(e);return t?($r(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,_i.set(e,t),t)}class vi{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}vi.type="NONE";const Ii=vi;function Ti(e,t,n){return`firebase:${e}:${t}:${n}`}class Ai{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=Ti(this.userKey,s.apiKey,r),this.fullPersistenceKey=Ti("persistence",s.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await li(this.auth,{idToken:e}).catch(()=>{});return t?Di._fromGetAccountInfoResponse(this.auth,t,e):null}return Di._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(e,t,n="authUser"){if(!t.length)return new Ai(bi(Ii),e,n);const s=(await Promise.all(t.map(async e=>{try{if(await e._isAvailable())return e}catch{return}}))).filter(e=>e);let r=s[0]||bi(Ii);const i=Ti(n,e.config.apiKey,e.name);let a=null;for(const n of t)try{const t=await n._get(i);if(t){let s;if("string"==typeof t){const n=await li(e,{idToken:t}).catch(()=>{});if(!n)break;s=await Di._fromGetAccountInfoResponse(e,n,t)}else s=Di._fromJSON(e,t);n!==r&&(a=s),r=n;break}}catch{}const o=s.filter(e=>e._shouldAllowMigration);return r._shouldAllowMigration&&o.length?(r=o[0],a&&await r._set(i,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==r)try{await e._remove(i)}catch{}})),new Ai(r,e,n)):new Ai(r,e,n)}}function Oi(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ki(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Si(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(xi(t))return"Blackberry";if(Fi(t))return"Webos";if(Ni(t))return"Safari";if((t.includes("chrome/")||Ri(t))&&!t.includes("edge/"))return"Chrome";if(Li(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===n?.length)return n[1]}return"Other"}function Si(e=Pn()){return/firefox\//i.test(e)}function Ni(e=Pn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ri(e=Pn()){return/crios\//i.test(e)}function ki(e=Pn()){return/iemobile/i.test(e)}function Li(e=Pn()){return/android/i.test(e)}function xi(e=Pn()){return/blackberry/i.test(e)}function Fi(e=Pn()){return/webos/i.test(e)}function Pi(e=Pn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Mi(){return function(){const e=Pn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Gi(e=Pn()){return Pi(e)||Li(e)||Fi(e)||xi(e)||/windows phone/i.test(e)||ki(e)}function Ui(e,t=[]){let n;switch(e){case"Browser":n=Oi(Pn());break;case"Worker":n=`${Oi(Pn())}-${e}`;break;default:n=e}const s=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Cr}/${s}`}class Hi{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,s)=>{try{n(e(t))}catch(e){s(e)}});n.onAbort=t,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}class Vi{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let s=0;s<e.length;s++)n=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,s,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}class ji{constructor(e,t,n,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ji(this),this.idTokenSubscription=new Ji(this),this.beforeStateQueue=new Hi(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=Rr,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=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=bi(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){try{this.persistenceManager=await Ai.create(this,e)}catch(e){Lr(`Failed to initialize persistence: ${e}`),this.persistenceManager=await Ai.create(this,[])}finally{this._resolvePersistenceManagerAvailable?.()}if(!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}try{await this.initializeCurrentUser(t)}catch(e){Lr(`Failed to initialize current user: ${e}`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await li(this,{idToken:e}),n=await Di._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(pr(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let n=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const t=this.redirectUser?._redirectEventId,r=n?._redirectEventId,i=await this.tryRedirectSignIn(e);t&&t!==r||!i?.user||(n=i.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Vr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await mi(e)}catch(e){if("auth/network-request-failed"!==e?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(pr(this.app))return Promise.reject(Gr(this));const t=e?Zn(e):null;return t&&Vr(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Vr(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return pr(this.app)?Promise.reject(Gr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return pr(this.app)?Promise.reject(Gr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(bi(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return ti(e,"GET","/v2/passwordPolicy",ei(e,t))}(this),t=new Vi(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new $n("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return ti(e,"POST","/v2/accounts:revokeToken",ei(e,t))}(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&bi(e)||this._popupRedirectResolver;Vr(t,this,"argument-error"),this.redirectPersistenceManager=await Ai.create(this,[bi(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,s){if(this._deleted)return()=>{};const r="function"==typeof t?t:t.next.bind(t);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Vr(a,this,"internal-error"),a.then(()=>{i||r(this.currentUser)}).catch(e=>{if(!i)if("function"!=typeof t&&t.error)t.error(e);else{if(!n)throw e;n(e)}}),"function"==typeof t){const r=e.addObserver(t,n,s);return()=>{i=!0,r()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}async directlySetCurrentUser(e){if(this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,this.persistenceManager)try{e?await this.persistenceManager.setCurrentUser(e):await this.persistenceManager.removeCurrentUser()}catch(e){const t=Mr(this,"internal-error",`An internal AuthError has occurred: ${e?.message||String(e)}`);throw t.customData={originalError:e},t}}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Vr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ui(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const n=await this._getAppCheckToken();return n&&(e["X-Firebase-AppCheck"]=n),e}async _getAppCheckToken(){if(pr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return e?.error&&Lr(`Error while retrieving App Check token: ${e.error}`),e?.token}}function $i(e){return Zn(e)}class Ji{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new Wn(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Vr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let qi={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function zi(e){return qi.loadJS(e)}class Ki{constructor(){this.enterprise=new Qi}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Qi{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Wi="NO_RECAPTCHA",Yi="onFirebaseAuthREInstanceReady";class Xi{constructor(e){this.type="recaptcha-enterprise",this.auth=$i(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{(async function(e,t){return ti(e,"GET","/v2/recaptchaConfig",ei(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(s=>{if(void 0!==s.recaptchaKey){const n=new ci(s);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})}function s(t,n,s){const r=window.grecaptcha;Bi(r)?r.enterprise.ready(()=>{r.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(Wi)})}):s(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Ki).execute("siteKey",{action:"verify"})}return new Promise((e,r)=>{n(this.auth).then(async n=>{if(!t&&Bi(window.grecaptcha)&&Xi.scriptInjectionDeferred)await Xi.scriptInjectionDeferred.promise,s(n,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=qi.recaptchaEnterpriseScript;0!==t.length&&(t+=n+`&onload=${Yi}`),Xi.scriptInjectionDeferred=new xn,window[Yi]=()=>{Xi.scriptInjectionDeferred?.resolve()},zi(t).then(()=>Xi.scriptInjectionDeferred?.promise).then(()=>{s(n,e,r)}).catch(e=>{r(e)})}}).catch(e=>{r(e)})})}}async function Zi(e,t,n,s=!1,r=!1){const i=new Xi(e);let a;if(r)a=Wi;else try{a=await i.verify(n)}catch(e){a=await i.verify(n,!0)}const o={...t};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in o){const e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){const e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return s?Object.assign(o,{captchaResp:a}):Object.assign(o,{captchaResponse:a}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function ea(e,t,n,s,r){if(e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Zi(e,t,n,"getOobCode"===n);return s(e,r)}return s(e,t).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){const r=await Zi(e,t,n,"getOobCode"===n);return s(e,r)}return Promise.reject(r)})}function ta(e,t,n){const s=$i(e);Vr(/^https?:\/\//.test(t),s,"invalid-emulator-scheme");const r=na(t),{host:i,port:a}=function(e){const t=na(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const e=r[1];return{host:e,port:sa(s.substr(e.length+1))}}{const[e,t]=s.split(":");return{host:e,port:sa(t)}}}(t),o=null===a?"":`:${a}`,B={url:`${r}//${i}${o}/`},c=Object.freeze({host:i,port:a,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!s._canInitEmulator)return Vr(s.config.emulator&&s.emulatorConfig,s,"emulator-config-failed"),void Vr(Jn(B,s.config.emulator)&&Jn(c,s.emulatorConfig),s,"emulator-config-failed");s.config.emulator=B,s.emulatorConfig=c,s.settings.appVerificationDisabledForTesting=!0,es(i)?ts(`${r}//${i}${o}`):function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function na(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function sa(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}Xi.scriptInjectionDeferred=null;class ra{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return jr("not implemented")}_getIdTokenResponse(e){return jr("not implemented")}_linkToIdToken(e,t){return jr("not implemented")}_getReauthenticationResolver(e){return jr("not implemented")}}async function ia(e,t){return ti(e,"POST","/v1/accounts:signUp",t)}async function aa(e,t){return si(e,"POST","/v1/accounts:signInWithPassword",ei(e,t))}async function oa(e,t){return ti(e,"POST","/v1/accounts:sendOobCode",ei(e,t))}async function Ba(e,t){return oa(e,t)}class ca extends ra{constructor(e,t,n,s=null){super("password",n),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new ca(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new ca(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if(t?.email&&t?.password){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return ea(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",aa);case"emailLink":return async function(e,t){return si(e,"POST","/v1/accounts:signInWithEmailLink",ei(e,t))}(e,{email:this._email,oobCode:this._password});default:Fr(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return ea(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ia);case"emailLink":return async function(e,t){return si(e,"POST","/v1/accounts:signInWithEmailLink",ei(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Fr(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function la(e,t){return si(e,"POST","/v1/accounts:signInWithIdp",ei(e,t))}class ua extends ra{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new ua(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Fr("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:s,...r}=t;if(!n||!s)return null;const i=new ua(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(e){return la(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,la(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,la(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=zn(t)}return e}}class ha{constructor(e){const t=Kn(Qn(e)),n=t.apiKey??null,s=t.oobCode??null,r=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(t.mode??null);Vr(n&&s&&r,"argument-error"),this.apiKey=n,this.operation=r,this.code=s,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=function(e){const t=Kn(Qn(e)).link,n=t?Kn(Qn(t)).deep_link_id:null,s=Kn(Qn(e)).deep_link_id;return(s?Kn(Qn(s)).link:null)||s||n||t||e}(e);try{return new ha(t)}catch{return null}}}class pa{constructor(){this.providerId=pa.PROVIDER_ID}static credential(e,t){return ca._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=ha.parseLink(t);return Vr(n,"argument-error"),ca._fromEmailAndCode(e,n.code,n.tenantId)}}pa.PROVIDER_ID="password",pa.EMAIL_PASSWORD_SIGN_IN_METHOD="password",pa.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class da{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class fa extends da{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Ca extends fa{constructor(){super("facebook.com")}static credential(e){return ua._fromParams({providerId:Ca.PROVIDER_ID,signInMethod:Ca.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ca.credentialFromTaggedObject(e)}static credentialFromError(e){return Ca.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Ca.credential(e.oauthAccessToken)}catch{return null}}}Ca.FACEBOOK_SIGN_IN_METHOD="facebook.com",Ca.PROVIDER_ID="facebook.com";class ga extends fa{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ua._fromParams({providerId:ga.PROVIDER_ID,signInMethod:ga.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ga.credentialFromTaggedObject(e)}static credentialFromError(e){return ga.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return ga.credential(t,n)}catch{return null}}}ga.GOOGLE_SIGN_IN_METHOD="google.com",ga.PROVIDER_ID="google.com";class ma extends fa{constructor(){super("github.com")}static credential(e){return ua._fromParams({providerId:ma.PROVIDER_ID,signInMethod:ma.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ma.credentialFromTaggedObject(e)}static credentialFromError(e){return ma.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ma.credential(e.oauthAccessToken)}catch{return null}}}ma.GITHUB_SIGN_IN_METHOD="github.com",ma.PROVIDER_ID="github.com";class wa extends fa{constructor(){super("twitter.com")}static credential(e,t){return ua._fromParams({providerId:wa.PROVIDER_ID,signInMethod:wa.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return wa.credentialFromTaggedObject(e)}static credentialFromError(e){return wa.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return wa.credential(t,n)}catch{return null}}}async function Ea(e,t){return si(e,"POST","/v1/accounts:signUp",ei(e,t))}wa.TWITTER_SIGN_IN_METHOD="twitter.com",wa.PROVIDER_ID="twitter.com";class ya{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,s=!1){const r=await Di._fromIdTokenResponse(e,n,s),i=Da(n);return new ya({user:r,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const s=Da(n);return new ya({user:e,providerId:s,_tokenResponse:n,operationType:t})}}function Da(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class _a extends jn{constructor(e,t,n,s){super(t.code,t.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,_a.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,s){return new _a(e,t,n,s)}}function ba(e,t,n,s){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw _a._fromErrorAndOperation(e,n,t,s);throw n})}async function va(e,t,n=!1){const{auth:s}=e;if(pr(s.app))return Promise.reject(Gr(s));const r="reauthenticate";try{const i=await fi(e,ba(s,r,t,e),n);Vr(i.idToken,s,"internal-error");const a=pi(i.idToken);Vr(a,s,"internal-error");const{sub:o}=a;return Vr(e.uid===o,s,"user-mismatch"),ya._forOperation(e,r,i)}catch(e){throw"auth/user-not-found"===e?.code&&Fr(s,"user-mismatch"),e}}async function Ia(e,t,n=!1){if(pr(e.app))return Promise.reject(Gr(e));const s="signIn",r=await ba(e,s,t),i=await ya._fromIdTokenResponse(e,s,r);return n||await e._updateCurrentUser(i.user),i}function Ta(e,t,n){Vr(n.url?.length>0,e,"invalid-continue-uri"),Vr(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),Vr(void 0===n.linkDomain||n.linkDomain.length>0,e,"invalid-hosting-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.linkDomain=n.linkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Vr(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(Vr(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function Aa(e){const t=$i(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function Oa(e,t,n){const s=$i(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await ea(s,r,"getOobCode",Ba)}function Sa(e,t,n){return pr(e.app)?Promise.reject(Gr(e)):async function(e,t){return Ia($i(e),t)}(Zn(e),pa.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&Aa(e),t})}async function Na(e,t){const n=Zn(e),s={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Ta(n.auth,s,t);const{email:r}=await async function(e,t){return oa(e,t)}(n.auth,s);r!==e.email&&await e.reload()}async function Ra(e,t,n){const s=Zn(e),r={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&Ta(s.auth,r,n);const{email:i}=await async function(e,t){return oa(e,t)}(s.auth,r);i!==e.email&&await e.reload()}async function ka(e,t){const{displayName:n,photoURL:s}=t;if(void 0===n&&void 0===s)return;const r=Zn(e),i={idToken:await r.getIdToken(),displayName:n,photoUrl:s,returnSecureToken:!0},a=await fi(r,async function(e,t){return ti(e,"POST","/v1/accounts:update",t)}(r.auth,i));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;const o=r.providerData.find(({providerId:e})=>"password"===e);o&&(o.displayName=r.displayName,o.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function La(e,t){return async function(e,t,n){const{auth:s}=e,r=await e.getIdToken(),i={idToken:r,returnSecureToken:!0};n&&(i.password=n);const a=await fi(e,async function(e,t){return ti(e,"POST","/v1/accounts:update",t)}(s,i));await e._updateTokensIfNecessary(a,!0)}(Zn(e),0,t)}function xa(e,t,n,s){return Zn(e).onAuthStateChanged(t,n,s)}const Fa="__sak";class Pa{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Fa,"1"),this.storage.removeItem(Fa),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Ma extends Pa{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Gi(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),s=this.localCache[t];n!==s&&e(t,s,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});const n=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},r=this.storage.getItem(n);Mi()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,10):s()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Ma.type="LOCAL";const Ga=Ma;class Ua extends Pa{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Ua.type="SESSION";const Ha=Ua;class Va{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new Va(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:s,data:r}=t.data,i=this.handlersMap[s];if(!i?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const a=Array.from(i).map(async e=>e(t.origin,r)),o=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(a);t.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:o})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function ja(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Va.receivers=[];class $a{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise((a,o)=>{const B=ja("",20);s.port1.start();const c=setTimeout(()=>{o(new Error("unsupported_event"))},n);i={messageChannel:s,onMessage(e){const t=e;if(t.data.eventId===B)switch(t.data.status){case"ack":clearTimeout(c),r=setTimeout(()=>{o(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),a(t.data.response);break;default:clearTimeout(c),clearTimeout(r),o(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:B,data:t},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function Ja(){return window}function qa(){return void 0!==Ja().WorkerGlobalScope&&"function"==typeof Ja().importScripts}const za="firebaseLocalStorageDb",Ka="firebaseLocalStorage",Qa="fbase_key";class Wa{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Ya(e,t){return e.transaction([Ka],t?"readwrite":"readonly").objectStore(Ka)}function Xa(){const e=indexedDB.open(za,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Ka,{keyPath:Qa})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Ka)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(za);return new Wa(e).toPromise()}(),t(await Xa()))})})}async function Za(e,t,n){const s=Ya(e,!0).put({[Qa]:t,value:n});return new Wa(s).toPromise()}function eo(e,t){const n=Ya(e,!0).delete(t);return new Wa(n).toPromise()}class to{registerLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.removeEventListener&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise||(this.dbPromise=Xa(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;if(this.dbPromise){const e=this.dbPromise;this.dbPromise=null;try{(await e).close()}catch{}}}}async initializeServiceWorkerMessaging(){return qa()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Va._getInstance(qa()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new $a(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return!!indexedDB&&(await this._withRetries(async e=>{await Za(e,Fa,"1"),await eo(e,Fa)}),!0)}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Za(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=Ya(e,!1).get(t),s=await new Wa(n).toPromise();return void 0===s?null:s.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>eo(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isClosing)return[];try{const e=await this._withRetries(e=>{const t=Ya(e,!1).getAll();return new Wa(t).toPromise()});if(this.isClosing)return[];if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:s,value:r}of e)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),t.push(s));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}catch(e){return this.isClosing||Lr(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.stopPolling(),this.unregisterLifecycleListeners())}}to.type="LOCAL";const no=to;function so(e,t){return t?bi(t):(Vr(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}new Kr(3e4,6e4);class ro extends ra{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return la(e,this._buildIdpRequest())}_linkToIdToken(e,t){return la(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return la(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function io(e){return Ia(e.auth,new ro(e),e.bypassAuthState)}function ao(e){const{auth:t,user:n}=e;return Vr(n,t,"internal-error"),va(n,new ro(e),e.bypassAuthState)}async function oo(e){const{auth:t,user:n}=e;return Vr(n,t,"internal-error"),async function(e,t,n=!1){const s=await fi(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ya._forOperation(e,"link",s)}(n,new ro(e),e.bypassAuthState)}class Bo{constructor(e,t,n,s,r=!1){this.auth=e,this.resolver=n,this.user=s,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:s,tenantId:r,error:i,type:a}=e;if(i)return void this.reject(i);const o={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return io;case"linkViaPopup":case"linkViaRedirect":return oo;case"reauthViaPopup":case"reauthViaRedirect":return ao;default:Fr(this.auth,"internal-error")}}resolve(e){$r(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){$r(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()}}const co=new Kr(2e3,1e4);class lo extends Bo{constructor(e,t,n,s,r){super(e,t,s,r),this.provider=n,this.authWindow=null,this.pollId=null,lo.currentPopupAction&&lo.currentPopupAction.cancel(),lo.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Vr(e,this.auth,"internal-error"),e}async onExecution(){$r(1===this.filter.length,"Popup operations only handle one event");const e=ja();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(Pr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Pr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,lo.currentPopupAction=null}pollUserCancellation(){const e=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Pr(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,co.get())};e()}}lo.currentPopupAction=null;const uo=new Map;class ho extends Bo{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=uo.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=Co(t),s=fo(e);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}uo.set(this.auth._key(),e)}return this.bypassAuthState||uo.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function po(e,t){uo.set(e._key(),t)}function fo(e){return bi(e._redirectPersistence)}function Co(e){return Ti("pendingRedirect",e.config.apiKey,e.name)}function go(e,t,n){return async function(e,t,n){if(pr(e.app))return Promise.reject(Gr(e));const s=$i(e);Ur(e,t,da),await s._initializationPromise;const r=so(s,n);return await async function(e,t){return fo(e)._set(Co(t),"true")}(r,s),r._openRedirect(s,t,"signInViaRedirect")}(e,t,n)}async function mo(e,t,n=!1){if(pr(e.app))return Promise.reject(Gr(e));const s=$i(e),r=so(s,t),i=new ho(s,r,n),a=await i.execute();return a&&!n&&(delete a.user._redirectEventId,await s._persistUserIfCurrent(a.user),await s._setRedirectUser(null,t)),a}class wo{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return yo(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!yo(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(Pr(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Eo(e))}saveEventToCache(e){this.cachedEventUids.add(Eo(e)),this.lastProcessedEventTime=Date.now()}}function Eo(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function yo({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===t?.code}const Do=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,_o=/^https?/;async function bo(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return ti(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(vo(e))return}catch{}Fr(e,"unauthorized-domain")}function vo(e){const t=Jr(),{protocol:n,hostname:s}=new URL(t);if(e.startsWith("chrome-extension://")){const r=new URL(e);return""===r.hostname&&""===s?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!_o.test(n))return!1;if(Do.test(e))return s===e;const r=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}const Io=new Kr(3e4,6e4);function To(){const e=Ja().___jsl;if(e?.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function Ao(e){return new Promise((t,n)=>{function s(){To(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{To(),n(Pr(e,"network-request-failed"))},timeout:Io.get()})}if(Ja().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else{if(!Ja().gapi?.load){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Ja()[t]=()=>{gapi.load?s():n(Pr(e,"network-request-failed"))},zi(`${qi.gapiScript}?onload=${t}`).catch(e=>n(e))}s()}}).catch(e=>{throw Oo=null,e})}let Oo=null;const So=new Kr(5e3,15e3),No={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ro=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ko(e){const t=e.config;Vr(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Qr(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,s={apiKey:t.apiKey,appName:e.name,v:Cr},r=Ro.get(e.config.apiHost);r&&(s.eid=r);const i=e._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${zn(s).slice(1)}`}async function Lo(e){const t=await function(e){return Oo=Oo||Ao(e),Oo}(e),n=Ja().gapi;return Vr(n,e,"internal-error"),t.open({where:document.body,url:ko(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:No,dontclear:!0},t=>new Promise(async(n,s)=>{await t.restyle({setHideOnLeave:!1});const r=Pr(e,"network-request-failed"),i=Ja().setTimeout(()=>{s(r)},So.get());function a(){Ja().clearTimeout(i),n(t)}t.ping(a).then(a,()=>{s(r)})}))}const xo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Fo{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Po(e,t,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),a=Math.max((window.screen.availWidth-s)/2,0).toString();let o="";const B={...xo,width:s.toString(),height:r.toString(),top:i,left:a},c=Pn().toLowerCase();n&&(o=Ri(c)?"_blank":n),Si(c)&&(t=t||"http://localhost",B.scrollbars="yes");const l=Object.entries(B).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=Pn()){return Pi(e)&&!!window.navigator?.standalone}(c)&&"_self"!==o)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}(t||"",o),new Fo(null);const u=window.open(t||"",o,l);Vr(u,e,"popup-blocked");try{u.focus()}catch(e){}return new Fo(u)}const Mo="__/auth/handler",Go="emulator/auth/handler",Uo=encodeURIComponent("fac");async function Ho(e,t,n,s,r,i){Vr(e.config.authDomain,e,"auth-domain-config-required"),Vr(e.config.apiKey,e,"invalid-api-key");const a={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:s,v:Cr,eventId:r};if(t instanceof da){t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))a[e]=t}if(t instanceof fa){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(a.scopes=e.join(","))}e.tenantId&&(a.tid=e.tenantId);const o=a;for(const e of Object.keys(o))void 0===o[e]&&delete o[e];const B=await e._getAppCheckToken(),c=B?`#${Uo}=${encodeURIComponent(B)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${Mo}`;return Qr(e,Go)}(e)}?${zn(o).slice(1)}${c}`}const Vo="webStorageSupport";const jo=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ha,this._completeRedirectFn=mo,this._overrideRedirectResult=po}async _openPopup(e,t,n,s){$r(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");return Po(e,await Ho(e,t,n,Jr(),s),ja())}async _openRedirect(e,t,n,s){await this._originValidation(e);return function(e){Ja().location.href=e}(await Ho(e,t,n,Jr(),s)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):($r(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await Lo(e),n=new wo(e);return t.register("authEvent",t=>{Vr(t?.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Vo,{type:Vo},n=>{const s=n?.[0]?.[Vo];void 0!==s&&t(!!s),Fr(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=bo(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Gi()||Ni()||Pi()}};var $o="@firebase/auth",Jo="1.13.6";class qo{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Vr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const zo=Ln("authIdTokenMaxAge")||300;let Ko=null;function Qo(e=mr()){const t=hr(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=hr(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(Jn(n.getOptions(),t??{}))return e;Fr(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:jo,persistence:[no,Ga,Ha]}),s=Ln("authTokenSyncURL");if(s&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(s,location.origin);if(location.origin===e.origin){const t=(r=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>zo)return;const s=t?.token;Ko!==s&&(Ko=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(e,t,n){Zn(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,s){Zn(e).onIdTokenChanged(t,n,s)}(n,e=>t(e))}}var r;const i=Nn("auth");return i&&ta(n,`http://${i}`),n}var Wo;!function(e){qi=e}({loadJS:e=>new Promise((t,n)=>{const s=document.createElement("script");s.setAttribute("src",e),s.onload=t,s.onerror=e=>{const t=Pr("internal-error");t.customData=e,n(t)},s.type="text/javascript",s.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(s)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Wo="Browser",ur(new ns("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options;Vr(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const o={apiKey:i,authDomain:a,clientPlatform:Wo,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ui(Wo)},B=new ji(n,s,r,o);return function(e,t){const n=t?.persistence||[],s=(Array.isArray(n)?n:[n]).map(bi);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(s,t?.popupRedirectResolver)}(B,t),B},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),ur(new ns("auth-internal",e=>(e=>new qo(e))($i(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),wr($o,Jo,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Wo)),wr($o,Jo,"esm2020");wr("firebase","12.19.0","app");var Yo,Xo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(e,t,n){n||(n=0);const s=Array(16);if("string"==typeof t)for(var r=0;r<16;++r)s[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;r<16;++r)s[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];let i,a=e.g[3];i=t+(a^n&(r^a))+s[0]+3614090360&4294967295,i=a+(r^(t=n+(i<<7&4294967295|i>>>25))&(n^r))+s[1]+3905402710&4294967295,a=t+(i<<12&4294967295|i>>>20),i=r+(n^a&(t^n))+s[2]+606105819&4294967295,i=n+(t^(r=a+(i<<17&4294967295|i>>>15))&(a^t))+s[3]+3250441966&4294967295,i=t+(a^(n=r+(i<<22&4294967295|i>>>10))&(r^a))+s[4]+4118548399&4294967295,i=a+(r^(t=n+(i<<7&4294967295|i>>>25))&(n^r))+s[5]+1200080426&4294967295,a=t+(i<<12&4294967295|i>>>20),i=r+(n^a&(t^n))+s[6]+2821735955&4294967295,i=n+(t^(r=a+(i<<17&4294967295|i>>>15))&(a^t))+s[7]+4249261313&4294967295,i=t+(a^(n=r+(i<<22&4294967295|i>>>10))&(r^a))+s[8]+1770035416&4294967295,i=a+(r^(t=n+(i<<7&4294967295|i>>>25))&(n^r))+s[9]+2336552879&4294967295,a=t+(i<<12&4294967295|i>>>20),i=r+(n^a&(t^n))+s[10]+4294925233&4294967295,i=n+(t^(r=a+(i<<17&4294967295|i>>>15))&(a^t))+s[11]+2304563134&4294967295,i=t+(a^(n=r+(i<<22&4294967295|i>>>10))&(r^a))+s[12]+1804603682&4294967295,i=a+(r^(t=n+(i<<7&4294967295|i>>>25))&(n^r))+s[13]+4254626195&4294967295,a=t+(i<<12&4294967295|i>>>20),i=r+(n^a&(t^n))+s[14]+2792965006&4294967295,i=n+(t^(r=a+(i<<17&4294967295|i>>>15))&(a^t))+s[15]+1236535329&4294967295,i=t+(r^a&((n=r+(i<<22&4294967295|i>>>10))^r))+s[1]+4129170786&4294967295,i=a+(n^r&((t=n+(i<<5&4294967295|i>>>27))^n))+s[6]+3225465664&4294967295,a=t+(i<<9&4294967295|i>>>23),i=r+(t^n&(a^t))+s[11]+643717713&4294967295,i=n+(a^t&((r=a+(i<<14&4294967295|i>>>18))^a))+s[0]+3921069994&4294967295,i=t+(r^a&((n=r+(i<<20&4294967295|i>>>12))^r))+s[5]+3593408605&4294967295,i=a+(n^r&((t=n+(i<<5&4294967295|i>>>27))^n))+s[10]+38016083&4294967295,a=t+(i<<9&4294967295|i>>>23),i=r+(t^n&(a^t))+s[15]+3634488961&4294967295,i=n+(a^t&((r=a+(i<<14&4294967295|i>>>18))^a))+s[4]+3889429448&4294967295,i=t+(r^a&((n=r+(i<<20&4294967295|i>>>12))^r))+s[9]+568446438&4294967295,i=a+(n^r&((t=n+(i<<5&4294967295|i>>>27))^n))+s[14]+3275163606&4294967295,a=t+(i<<9&4294967295|i>>>23),i=r+(t^n&(a^t))+s[3]+4107603335&4294967295,i=n+(a^t&((r=a+(i<<14&4294967295|i>>>18))^a))+s[8]+1163531501&4294967295,i=t+(r^a&((n=r+(i<<20&4294967295|i>>>12))^r))+s[13]+2850285829&4294967295,i=a+(n^r&((t=n+(i<<5&4294967295|i>>>27))^n))+s[2]+4243563512&4294967295,a=t+(i<<9&4294967295|i>>>23),i=r+(t^n&(a^t))+s[7]+1735328473&4294967295,i=n+(a^t&((r=a+(i<<14&4294967295|i>>>18))^a))+s[12]+2368359562&4294967295,i=t+((n=r+(i<<20&4294967295|i>>>12))^r^a)+s[5]+4294588738&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^r)+s[8]+2272392833&4294967295,a=t+(i<<11&4294967295|i>>>21),i=r+(a^t^n)+s[11]+1839030562&4294967295,i=n+((r=a+(i<<16&4294967295|i>>>16))^a^t)+s[14]+4259657740&4294967295,i=t+((n=r+(i<<23&4294967295|i>>>9))^r^a)+s[1]+2763975236&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^r)+s[4]+1272893353&4294967295,a=t+(i<<11&4294967295|i>>>21),i=r+(a^t^n)+s[7]+4139469664&4294967295,i=n+((r=a+(i<<16&4294967295|i>>>16))^a^t)+s[10]+3200236656&4294967295,i=t+((n=r+(i<<23&4294967295|i>>>9))^r^a)+s[13]+681279174&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^r)+s[0]+3936430074&4294967295,a=t+(i<<11&4294967295|i>>>21),i=r+(a^t^n)+s[3]+3572445317&4294967295,i=n+((r=a+(i<<16&4294967295|i>>>16))^a^t)+s[6]+76029189&4294967295,i=t+((n=r+(i<<23&4294967295|i>>>9))^r^a)+s[9]+3654602809&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^r)+s[12]+3873151461&4294967295,a=t+(i<<11&4294967295|i>>>21),i=r+(a^t^n)+s[15]+530742520&4294967295,i=n+((r=a+(i<<16&4294967295|i>>>16))^a^t)+s[2]+3299628645&4294967295,i=t+(r^((n=r+(i<<23&4294967295|i>>>9))|~a))+s[0]+4096336452&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~r))+s[7]+1126891415&4294967295,a=t+(i<<10&4294967295|i>>>22),i=r+(t^(a|~n))+s[14]+2878612391&4294967295,i=n+(a^((r=a+(i<<15&4294967295|i>>>17))|~t))+s[5]+4237533241&4294967295,i=t+(r^((n=r+(i<<21&4294967295|i>>>11))|~a))+s[12]+1700485571&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~r))+s[3]+2399980690&4294967295,a=t+(i<<10&4294967295|i>>>22),i=r+(t^(a|~n))+s[10]+4293915773&4294967295,i=n+(a^((r=a+(i<<15&4294967295|i>>>17))|~t))+s[1]+2240044497&4294967295,i=t+(r^((n=r+(i<<21&4294967295|i>>>11))|~a))+s[8]+1873313359&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~r))+s[15]+4264355552&4294967295,a=t+(i<<10&4294967295|i>>>22),i=r+(t^(a|~n))+s[6]+2734768916&4294967295,i=n+(a^((r=a+(i<<15&4294967295|i>>>17))|~t))+s[13]+1309151649&4294967295,i=t+(r^((n=r+(i<<21&4294967295|i>>>11))|~a))+s[4]+4149444226&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~r))+s[11]+3174756917&4294967295,a=t+(i<<10&4294967295|i>>>22),i=r+(t^(a|~n))+s[2]+718787259&4294967295,i=n+(a^((r=a+(i<<15&4294967295|i>>>17))|~t))+s[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(i<<21&4294967295|i>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+a&4294967295}function s(e,t){this.h=t;const n=[];let s=!0;for(let r=e.length-1;r>=0;r--){const i=0|e[r];s&&i==t||(n[r]=i,s=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return t.prototype[n].apply(e,r)}}(t,function(){this.blockSize=-1}),t.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.v=function(e,t){void 0===t&&(t=e.length);const s=t-this.blockSize,r=this.C;let i=this.h,a=0;for(;a<t;){if(0==i)for(;a<=s;)n(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(r[i++]=e.charCodeAt(a++),i==this.blockSize){n(this,r),i=0;break}}else for(;a<t;)if(r[i++]=e[a++],i==this.blockSize){n(this,r),i=0;break}}this.h=i,this.o+=t},t.prototype.A=function(){var e=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=8*this.o;for(var n=e.length-8;n<e.length;++n)e[n]=255&t,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let s=0;s<32;s+=8)e[t++]=this.g[n]>>>s&255;return e};var r={};function i(e){return-128<=e&&e<128?function(e,t){var n=r;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new s([0|e],e<0?-1:0)}):new s([0|e],e<0?-1:0)}function a(e){if(isNaN(e)||!isFinite(e))return o;if(e<0)return h(a(-e));const t=[];let n=1;for(let s=0;e>=n;s++)t[s]=e/n|0,n*=4294967296;return new s(t,0)}var o=i(0),B=i(1),c=i(16777216);function l(e){if(0!=e.h)return!1;for(let t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function u(e){return-1==e.h}function h(e){const t=e.g.length,n=[];for(let s=0;s<t;s++)n[s]=~e.g[s];return new s(n,~e.h).add(B)}function p(e,t){return e.add(h(t))}function d(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function f(e,t){this.g=e,this.h=t}function C(e,t){if(l(t))throw Error("division by zero");if(l(e))return new f(o,o);if(u(e))return t=C(h(e),t),new f(h(t.g),h(t.h));if(u(t))return t=C(e,h(t)),new f(h(t.g),t.h);if(e.g.length>30){if(u(e)||u(t))throw Error("slowDivide_ only works with positive integers.");for(var n=B,s=t;s.l(e)<=0;)n=g(n),s=g(s);var r=m(n,1),i=m(s,1);for(s=m(s,2),n=m(n,2);!l(s);){var c=i.add(s);c.l(e)<=0&&(r=r.add(n),i=c),s=m(s,1),n=m(n,1)}return t=p(e,r.j(t)),new f(r,t)}for(r=o;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),s=(s=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,s-48),c=(i=a(n)).j(t);u(c)||c.l(e)>0;)c=(i=a(n-=s)).j(t);l(i)&&(i=B),r=r.add(i),e=p(e,c)}return new f(r,e)}function g(e){const t=e.g.length+1,n=[];for(let s=0;s<t;s++)n[s]=e.i(s)<<1|e.i(s-1)>>>31;return new s(n,e.h)}function m(e,t){const n=t>>5;t%=32;const r=e.g.length-n,i=[];for(let s=0;s<r;s++)i[s]=t>0?e.i(s+n)>>>t|e.i(s+n+1)<<32-t:e.i(s+n);return new s(i,e.h)}(e=s.prototype).m=function(){if(u(this))return-h(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){const s=this.i(n);e+=(s>=0?s:4294967296+s)*t,t*=4294967296}return e},e.toString=function(e){if((e=e||10)<2||36<e)throw Error("radix out of range: "+e);if(l(this))return"0";if(u(this))return"-"+h(this).toString(e);const t=a(Math.pow(e,6));var n=this;let s="";for(;;){const r=C(n,t).g;let i=(((n=p(n,r.j(t))).g.length>0?n.g[0]:n.h)>>>0).toString(e);if(l(n=r))return i+s;for(;i.length<6;)i="0"+i;s=i+s}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return u(e=p(this,e))?-1:l(e)?0:1},e.abs=function(){return u(this)?h(this):this},e.add=function(e){const t=Math.max(this.g.length,e.g.length),n=[];let r=0;for(let s=0;s<=t;s++){let t=r+(65535&this.i(s))+(65535&e.i(s)),i=(t>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=i>>>16,t&=65535,i&=65535,n[s]=i<<16|t}return new s(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(l(this)||l(e))return o;if(u(this))return u(e)?h(this).j(h(e)):h(h(this).j(e));if(u(e))return h(this.j(h(e)));if(this.l(c)<0&&e.l(c)<0)return a(this.m()*e.m());const t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){const s=this.i(r)>>>16,i=65535&this.i(r),a=e.i(t)>>>16,o=65535&e.i(t);n[2*r+2*t]+=i*o,d(n,2*r+2*t),n[2*r+2*t+1]+=s*o,d(n,2*r+2*t+1),n[2*r+2*t+1]+=i*a,d(n,2*r+2*t+1),n[2*r+2*t+2]+=s*a,d(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new s(n,0)},e.B=function(e){return C(this,e).h},e.and=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let s=0;s<t;s++)n[s]=this.i(s)&e.i(s);return new s(n,this.h&e.h)},e.or=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let s=0;s<t;s++)n[s]=this.i(s)|e.i(s);return new s(n,this.h|e.h)},e.xor=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let s=0;s<t;s++)n[s]=this.i(s)^e.i(s);return new s(n,this.h^e.h)},t.prototype.digest=t.prototype.A,t.prototype.reset=t.prototype.u,t.prototype.update=t.prototype.v,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.B,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=a,s.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return h(e(t.substring(1),n));if(t.indexOf("-")>=0)throw Error('number format error: interior "-" character');const s=a(Math.pow(n,8));let r=o;for(let e=0;e<t.length;e+=8){var i=Math.min(8,t.length-e);const o=parseInt(t.substring(e,e+i),n);i<8?(i=a(Math.pow(n,i)),r=r.j(i).add(a(o))):(r=r.j(s),r=r.add(a(o)))}return r},Yo=s}).apply(void 0!==Xo?Xo:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Zo,eB,tB,nB,sB,rB,iB,aB,oB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e,t=Object.defineProperty;var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof oB&&oB];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(e,s){if(s)e:{var r=n;e=e.split(".");for(var i=0;i<e.length-1;i++){var a=e[i];if(!(a in r))break e;r=r[a]}(s=s(i=r[e=e[e.length-1]]))!=i&&null!=s&&t(r,e,{configurable:!0,writable:!0,value:s})}}s("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push([t,e[t]]);return n}});var r=r||{},i=this||self;function a(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function o(e,t,n){return e.call.apply(e.bind,arguments)}function B(e,t,n){return(B=o).apply(null,arguments)}function c(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function l(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return t.prototype[n].apply(e,r)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function h(e){const t=e.length;if(t>0){const n=Array(t);for(let s=0;s<t;s++)n[s]=e[s];return n}return[]}function p(e,t){for(let t=1;t<arguments.length;t++){const s=arguments[t];var n=typeof s;if("array"==(n="object"!=n?n:s?Array.isArray(s)?"array":n:"null")||"object"==n&&"number"==typeof s.length){n=e.length||0;const t=s.length||0;e.length=n+t;for(let r=0;r<t;r++)e[n+r]=s[r]}else e.push(s)}}function d(e){i.setTimeout(()=>{throw e},0)}function f(){var e=E;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var C=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new g,e=>e.reset());class g{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let m,w=!1,E=new class{constructor(){this.h=this.g=null}add(e,t){const n=C.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},y=()=>{const e=Promise.resolve(void 0);m=()=>{e.then(D)}};function D(){for(var e;e=f();){try{e.h.call(e.g)}catch(e){d(e)}var t=C;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}w=!1}function _(){this.u=this.u,this.C=this.C}function b(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}_.prototype.u=!1,_.prototype.dispose=function(){this.u||(this.u=!0,this.N())},_.prototype[Symbol.dispose]=function(){this.dispose()},_.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},b.prototype.h=function(){this.defaultPrevented=!0};var v=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};i.addEventListener("test",e,t),i.removeEventListener("test",e,t)}catch(e){}return e}();function I(e){return/^[\s\xa0]*$/.test(e)}function T(e,t){b.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e&&this.init(e,t)}l(T,b),T.prototype.init=function(e,t){const n=this.type=e.type,s=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement)),this.relatedTarget=t,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&T.Z.h.call(this)},T.prototype.h=function(){T.Z.h.call(this);const e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var A="closure_listenable_"+(1e6*Math.random()|0),O=0;function S(e,t,n,s,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!s,this.ha=r,this.key=++O,this.da=this.fa=!1}function N(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function R(e,t,n){for(const s in e)t.call(n,e[s],s,e)}function k(e){const t={};for(const n in e)t[n]=e[n];return t}const L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function x(e,t){let n,s;for(let t=1;t<arguments.length;t++){for(n in s=arguments[t],s)e[n]=s[n];for(let t=0;t<L.length;t++)n=L[t],Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}}function F(e){this.src=e,this.g={},this.h=0}function P(e,t){const n=t.type;if(n in e.g){var s,r=e.g[n],i=Array.prototype.indexOf.call(r,t,void 0);(s=i>=0)&&Array.prototype.splice.call(r,i,1),s&&(N(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function M(e,t,n,s){for(let r=0;r<e.length;++r){const i=e[r];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==s)return r}return-1}F.prototype.add=function(e,t,n,s,r){const i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);const a=M(e,t,s,r);return a>-1?(t=e[a],n||(t.fa=!1)):((t=new S(t,this.src,i,!!s,r)).fa=n,e.push(t)),t};var G="closure_lm_"+(1e6*Math.random()|0),U={};function H(e,t,n,s,r){if(Array.isArray(t)){for(let i=0;i<t.length;i++)H(e,t[i],n,s,r);return null}return n=K(n),e&&e[A]?e.J(t,n,!!a(s)&&!!s.capture,r):function(e,t,n,s,r,i){if(!t)throw Error("Invalid event type");const o=a(r)?!!r.capture:!!r;let B=q(e);if(B||(e[G]=B=new F(e)),n=B.add(t,n,s,o,i),n.proxy)return n;if(s=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=s,s.src=e,s.listener=n,e.addEventListener)v||(r=o),void 0===r&&(r=!1),e.addEventListener(t.toString(),s,r);else if(e.attachEvent)e.attachEvent($(t.toString()),s);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(s)}return n}(e,t,n,!1,s,r)}function V(e,t,n,s,r){if(Array.isArray(t))for(var i=0;i<t.length;i++)V(e,t[i],n,s,r);else s=a(s)?!!s.capture:!!s,n=K(n),e&&e[A]?(e=e.i,(i=String(t).toString())in e.g&&((n=M(t=e.g[i],n,s,r))>-1&&(N(t[n]),Array.prototype.splice.call(t,n,1),0==t.length&&(delete e.g[i],e.h--)))):e&&(e=q(e))&&(t=e.g[t.toString()],e=-1,t&&(e=M(t,n,s,r)),(n=e>-1?t[e]:null)&&j(n))}function j(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[A])P(t.i,e);else{var n=e.type,s=e.proxy;t.removeEventListener?t.removeEventListener(n,s,e.capture):t.detachEvent?t.detachEvent($(n),s):t.addListener&&t.removeListener&&t.removeListener(s),(n=q(t))?(P(n,e),0==n.h&&(n.src=null,t[G]=null)):N(e)}}}function $(e){return e in U?U[e]:U[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new T(t,this);const n=e.listener,s=e.ha||e.src;e.fa&&j(e),e=n.call(s,t)}return e}function q(e){return(e=e[G])instanceof F?e:null}var z="__closure_events_fn_"+(1e9*Math.random()>>>0);function K(e){return"function"==typeof e?e:(e[z]||(e[z]=function(t){return e.handleEvent(t)}),e[z])}function Q(){_.call(this),this.i=new F(this),this.M=this,this.G=null}function W(e,t){var n,s=e.G;if(s)for(n=[];s;s=s.G)n.push(s);if(e=e.M,s=t.type||t,"string"==typeof t)t=new b(t,e);else if(t instanceof b)t.target=t.target||e;else{var r=t;x(t=new b(s,e),r)}let i,a;if(r=!0,n)for(a=n.length-1;a>=0;a--)i=t.g=n[a],r=Y(i,s,!0,t)&&r;if(i=t.g=e,r=Y(i,s,!0,t)&&r,r=Y(i,s,!1,t)&&r,n)for(a=0;a<n.length;a++)i=t.g=n[a],r=Y(i,s,!1,t)&&r}function Y(e,t,n,s){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let r=!0;for(let i=0;i<t.length;++i){const a=t[i];if(a&&!a.da&&a.capture==n){const t=a.listener,n=a.ha||a.src;a.fa&&P(e.i,a),r=!1!==t.call(n,s)&&r}}return r&&!s.defaultPrevented}function X(e){e.g=function(e,t){if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=B(e.handleEvent,e)}return Number(t)>2147483647?-1:i.setTimeout(e,t||0)}(()=>{e.g=null,e.i&&(e.i=!1,X(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(Q,_),Q.prototype[A]=!0,Q.prototype.removeEventListener=function(e,t,n,s){V(this,e,t,n,s)},Q.prototype.N=function(){if(Q.Z.N.call(this),this.i){var e=this.i;for(const t in e.g){const n=e.g[t];for(let e=0;e<n.length;e++)N(n[e]);delete e.g[t],e.h--}}this.G=null},Q.prototype.J=function(e,t,n,s){return this.i.add(String(e),t,!1,n,s)},Q.prototype.K=function(e,t,n,s){return this.i.add(String(e),t,!0,n,s)};class Z extends _{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:X(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ee(e){_.call(this),this.h=e,this.g={}}l(ee,_);var te=[];function ne(e){R(e.g,function(e,t){this.g.hasOwnProperty(t)&&j(e)},e),e.g={}}ee.prototype.N=function(){ee.Z.N.call(this),ne(this)},ee.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var se=i.JSON.stringify,re=i.JSON.parse,ie=class{stringify(e){return i.JSON.stringify(e,void 0)}parse(e){return i.JSON.parse(e,void 0)}};function ae(){}function oe(){}var Be={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ce(){b.call(this,"d")}function le(){b.call(this,"c")}l(ce,b),l(le,b);var ue={},he=null;function pe(){return he=he||new Q}function de(e){b.call(this,ue.Ia,e)}function fe(e){const t=pe();W(t,new de(t))}function Ce(e,t){b.call(this,ue.STAT_EVENT,e),this.stat=t}function ge(e){const t=pe();W(t,new Ce(t,e))}function me(e,t){b.call(this,ue.Ja,e),this.size=t}function we(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){e()},t)}function Ee(){this.g=!0}function ye(e,t,n,s){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{const i=JSON.parse(t);if(i)for(e=0;e<i.length;e++)if(Array.isArray(i[e])){var n=i[e];if(!(n.length<2)){var s=n[1];if(Array.isArray(s)&&!(s.length<1)){var r=s[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(let e=1;e<s.length;e++)s[e]=""}}}return se(i)}catch(e){return t}}(e,n)+(s?" "+s:"")})}ue.Ia="serverreachability",l(de,b),ue.STAT_EVENT="statevent",l(Ce,b),ue.Ja="timingevent",l(me,b),Ee.prototype.ua=function(){this.g=!1},Ee.prototype.info=function(){};var De,_e={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},be={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function ve(){}function Ie(e){return encodeURIComponent(String(e))}function Te(e){var t=1;e=e.split(":");const n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Ae(e,t,n,s){this.j=e,this.i=t,this.l=n,this.S=s||1,this.V=new ee(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Oe}function Oe(){this.i=null,this.g="",this.h=!1}l(ve,ae),ve.prototype.g=function(){return new XMLHttpRequest},De=new ve;var Se={},Ne={};function Re(e,t,n){e.M=1,e.A=st(Xe(t)),e.u=n,e.R=!0,ke(e,null)}function ke(e,t){e.F=Date.now(),Fe(e),e.B=Xe(e.A);var n=e.B,s=e.S;Array.isArray(s)||(s=[String(s)]),gt(n.i,"t",s),e.C=0,n=e.j.L,e.h=new Oe,e.g=sn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Z(B(e.Y,e,e.g),e.P)),t=e.V,n=e.g,s=e.ba;var r="readystatechange";Array.isArray(r)||(r&&(te[0]=r.toString()),r=te);for(let e=0;e<r.length;e++){const i=H(n,r[e],s||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}t=e.J?k(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),fe(),function(e,t,n,s,r,i){e.info(function(){if(e.g)if(i){var a="",o=i.split("&");for(let e=0;e<o.length;e++){var B=o[e].split("=");if(B.length>1){const e=B[0];B=B[1];const t=e.split("_");a=t.length>=2&&"type"==t[1]?a+(e+"=")+B+"&":a+(e+"=redacted&")}}}else a=null;else a=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+t+"\n"+n+"\n"+a})}(e.i,e.v,e.B,e.l,e.S,e.u)}function Le(e){return!!e.g&&("GET"==e.v&&2!=e.M&&e.j.Aa)}function xe(e,t){var n=e.C,s=t.indexOf("\n",n);return-1==s?Ne:(n=Number(t.substring(n,s)),isNaN(n)?Se:(s+=1)+n>t.length?Ne:(t=t.slice(s,s+n),e.C=s+n,t))}function Fe(e){e.T=Date.now()+e.H,Pe(e,e.H)}function Pe(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=we(B(e.aa,e),t)}function Me(e){e.D&&(i.clearTimeout(e.D),e.D=null)}function Ge(e){0==e.j.I||e.K||Xt(e.j,e)}function Ue(e){Me(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,ne(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function He(e,t){try{var n=e.j;if(0!=n.I&&(n.g==e||qe(n.h,e)))if(!e.L&&qe(n.h,e)&&3==n.I){try{var s=n.Ba.g.parse(t)}catch(e){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){e:if(!n.v){if(n.g){if(!(n.g.F+3e3<e.F))break e;Yt(n),Ht(n)}Kt(n),ge(18)}}else n.xa=r[1],0<n.xa-n.K&&r[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=we(B(n.Va,n),6e3));Je(n.h)<=1&&n.ta&&(n.ta=void 0)}else en(n,11)}else if((e.L||n.g==e)&&Yt(n),!I(t))for(r=n.Ba.g.parse(t),t=0;t<r.length;t++){let B=r[t];const l=B[0];if(!(l<=n.K))if(n.K=l,B=B[1],2==n.I)if("c"==B[0]){n.M=B[1],n.ba=B[2];const t=B[3];null!=t&&(n.ka=t,n.j.info("VER="+n.ka));const r=B[4];null!=r&&(n.za=r,n.j.info("SVER="+n.za));const l=B[5];null!=l&&"number"==typeof l&&l>0&&(s=1.5*l,n.O=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;const u=e.g;if(u){const e=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var i=s.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(ze(i,i.h),i.h=null))}if(s.G){const e=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(s.wa=e,nt(s.J,s.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info("Handshake RTT: "+n.T+"ms"));var a=e;if((s=n).na=nn(s,s.L?s.ba:null,s.W),a.L){Ke(s.h,a);var o=a,c=s.O;c&&(o.H=c),o.D&&(Me(o),Fe(o)),s.g=a}else zt(s);n.i.length>0&&jt(n)}else"stop"!=B[0]&&"close"!=B[0]||en(n,7);else 3==n.I&&("stop"==B[0]||"close"==B[0]?"stop"==B[0]?en(n,7):Ut(n):"noop"!=B[0]&&n.l&&n.l.qa(B),n.A=0)}fe()}catch(e){}}Ae.prototype.ba=function(e){e=e.target;const t=this.O;t&&3==Ft(e)?t.j():this.Y(e)},Ae.prototype.Y=function(e){try{if(e==this.g)e:{const B=Ft(this.g),c=this.g.ya();this.g.ca();if(!(B<3)&&(3!=B||this.g&&(this.h.h||this.g.la()||Pt(this.g)))){this.K||4!=B||7==c||fe(),Me(this);var t=this.g.ca();this.X=t;var n=function(e){if(!Le(e))return e.g.la();const t=Pt(e.g);if(""===t)return"";let n="";const s=t.length,r=4==Ft(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return Ue(e),Ge(e),"";e.h.i=new i.TextDecoder}for(let i=0;i<s;i++)e.h.h=!0,n+=e.h.i.decode(t[i],{stream:!(r&&i==s-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}(this);if(this.o=200==t,function(e,t,n,s,r,i,a){e.info(function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+i+" "+a})}(this.i,this.v,this.B,this.l,this.S,B,t),this.o){if(this.U&&!this.L){t:{if(this.g){var s,r=this.g;if((s=r.g?r.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(s)){var a=s;break t}}a=null}if(!(e=a)){this.o=!1,this.m=3,ge(12),Ue(this),Ge(this);break e}ye(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,He(this,e)}if(this.R){let t;for(e=!0;!this.K&&this.C<n.length;){if(t=xe(this,n),t==Ne){4==B&&(this.m=4,ge(14),e=!1),ye(this.i,this.l,null,"[Incomplete Response]");break}if(t==Se){this.m=4,ge(15),ye(this.i,this.l,n,"[Invalid Chunk]"),e=!1;break}ye(this.i,this.l,t,null),He(this,t)}if(Le(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=B||0!=n.length||this.h.h||(this.m=1,ge(16),e=!1),this.o=this.o&&e,e){if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Qt(o),o.P=!0,ge(11))}}else ye(this.i,this.l,n,"[Invalid Chunked Response]"),Ue(this),Ge(this)}else ye(this.i,this.l,n,null),He(this,n);4==B&&Ue(this),this.o&&!this.K&&(4==B?Xt(this.j,this):(this.o=!1,Fe(this)))}else(function(e){const t={};e=(e.g&&Ft(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<e.length;s++){if(I(e[s]))continue;var n=Te(e[s]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[r]||[];t[r]=i,i.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==t&&n.indexOf("Unknown SID")>0?(this.m=3,ge(12)):(this.m=0,ge(13)),Ue(this),Ge(this)}}}catch(e){}},Ae.prototype.cancel=function(){this.K=!0,Ue(this)},Ae.prototype.aa=function(){this.D=null;const e=Date.now();e-this.T>=0?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.B),2!=this.M&&(fe(),ge(17)),Ue(this),this.m=2,Ge(this)):Pe(this,this.T-e)};var Ve=class{constructor(e,t){this.g=e,this.map=t}};function je(e){this.l=e||10,i.PerformanceNavigationTiming?e=(e=i.performance.getEntriesByType("navigation")).length>0&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function $e(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function qe(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function ze(e,t){e.g?e.g.add(t):e.h=t}function Ke(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Qe(e){if(null!=e.h)return e.i.concat(e.h.G);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.G);return t}return h(e.i)}je.prototype.cancel=function(){if(this.i=Qe(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var We=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Ye(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof Ye?(this.l=e.l,Ze(this,e.j),this.o=e.o,this.g=e.g,et(this,e.u),this.h=e.h,tt(this,mt(e.i)),this.m=e.m):e&&(t=String(e).match(We))?(this.l=!1,Ze(this,t[1]||"",!0),this.o=rt(t[2]||""),this.g=rt(t[3]||"",!0),et(this,t[4]),this.h=rt(t[5]||"",!0),tt(this,t[6]||"",!0),this.m=rt(t[7]||"")):(this.l=!1,this.i=new ht(null,this.l))}function Xe(e){return new Ye(e)}function Ze(e,t,n){e.j=n?rt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function et(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function tt(e,t,n){t instanceof ht?(e.i=t,function(e,t){t&&!e.j&&(pt(e),e.i=null,e.g.forEach(function(e,t){const n=t.toLowerCase();t!=n&&(dt(this,t),gt(this,n,e))},e)),e.j=t}(e.i,e.l)):(n||(t=it(t,lt)),e.i=new ht(t,e.l))}function nt(e,t,n){e.i.set(t,n)}function st(e){return nt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function rt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function it(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,at),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function at(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Ye.prototype.toString=function(){const e=[];var t=this.j;t&&e.push(it(t,ot,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(it(t,ot,!0),"@"),e.push(Ie(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&e.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(it(n,"/"==n.charAt(0)?ct:Bt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",it(n,ut)),e.join("")},Ye.prototype.resolve=function(e){const t=Xe(this);let n=!!e.j;n?Ze(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=null!=e.u;var s=e.h;if(n)et(t,e.u);else if(n=!!e.h){if("/"!=s.charAt(0))if(this.g&&!this.h)s="/"+s;else{var r=t.h.lastIndexOf("/");-1!=r&&(s=t.h.slice(0,r+1)+s)}if(".."==(r=s)||"."==r)s="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){s=0==r.lastIndexOf("/",0),r=r.split("/");const e=[];for(let t=0;t<r.length;){const n=r[t++];"."==n?s&&t==r.length&&e.push(""):".."==n?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),s&&t==r.length&&e.push("")):(e.push(n),s=!0)}s=e.join("/")}else s=r}return n?t.h=s:n=""!==e.i.toString(),n?tt(t,mt(e.i)):n=!!e.m,n&&(t.m=e.m),t};var ot=/[#\/\?@]/g,Bt=/[#\?:]/g,ct=/[#\?]/g,lt=/[#\?@]/g,ut=/#/g;function ht(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function pt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(let n=0;n<e.length;n++){const s=e[n].indexOf("=");let r,i=null;s>=0?(r=e[n].substring(0,s),i=e[n].substring(s+1)):r=e[n],t(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function dt(e,t){pt(e),t=wt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function ft(e,t){return pt(e),t=wt(e,t),e.g.has(t)}function Ct(e,t){pt(e);let n=[];if("string"==typeof t)ft(e,t)&&(n=n.concat(e.g.get(wt(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}function gt(e,t,n){dt(e,t),n.length>0&&(e.i=null,e.g.set(wt(e,t),h(n)),e.h+=n.length)}function mt(e){const t=new ht;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function wt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Et(e,t,n,s,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),s(n)}catch(e){}}function yt(){this.g=new ie}function Dt(e){this.i=e.Sb||null,this.h=e.ab||!1}function _t(e,t){Q.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function bt(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function vt(e){e.readyState=4,e.l=null,e.j=null,e.B=null,It(e)}function It(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Tt(e){let t="";return R(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function At(e,t,n){e:{for(s in n){var s=!1;break e}s=!0}s||(n=Tt(n),"string"==typeof e?null!=n&&Ie(n):nt(e,t,n))}function Ot(e){Q.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=ht.prototype).add=function(e,t){pt(this),this.i=null,e=wt(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){pt(this),this.g.forEach(function(n,s){n.forEach(function(n){e.call(t,n,s,this)},this)},this)},e.set=function(e,t){return pt(this),this.i=null,ft(this,e=wt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&(e=Ct(this,e)).length>0?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(let s=0;s<t.length;s++){var n=t[s];const r=Ie(n);n=Ct(this,n);for(let t=0;t<n.length;t++){let s=r;""!==n[t]&&(s+="="+Ie(n[t])),e.push(s)}}return this.i=e.join("&")},l(Dt,ae),Dt.prototype.g=function(){return new _t(this.i,this.h)},l(_t,Q),(e=_t.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,It(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||i).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,vt(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,It(this)),this.g&&(this.readyState=3,It(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;bt(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?vt(this):It(this),3==this.readyState&&bt(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,vt(this))},e.Na=function(e){this.g&&(this.response=e,vt(this))},e.ga=function(){this.g&&vt(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(_t.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),l(Ot,Q);var St=/^https?$/i,Nt=["POST","PUT"];function Rt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,kt(e),xt(e)}function kt(e){e.A||(e.A=!0,W(e,"complete"),W(e,"error"))}function Lt(e){if(e.h&&void 0!==r)if(e.v&&4==Ft(e))setTimeout(e.Ca.bind(e),0);else if(W(e,"readystatechange"),4==Ft(e)){e.h=!1;try{const r=e.ca();e:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===r){let t=String(e.D).match(We)[1]||null;!t&&i.self&&i.self.location&&(t=i.self.location.protocol.slice(0,-1)),s=!St.test(t?t.toLowerCase():"")}n=s}if(n)W(e,"complete"),W(e,"success");else{e.o=6;try{var a=Ft(e)>2?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.ca()+"]",kt(e)}}finally{xt(e)}}}function xt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);const n=e.g;e.g=null,t||W(e,"ready");try{n.onreadystatechange=null}catch(e){}}}function Ft(e){return e.g?e.g.readyState:0}function Pt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function Mt(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Gt(e){this.za=0,this.i=[],this.j=new Ee,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Mt("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Mt("baseRetryDelayMs",5e3,e),this.Za=Mt("retryDelaySeedMs",1e4,e),this.Ta=Mt("forwardChannelMaxRetries",2,e),this.va=Mt("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new je(e&&e.concurrentRequestLimit),this.Ba=new yt,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function Ut(e){if(Vt(e),3==e.I){var t=e.V++,n=Xe(e.J);if(nt(n,"SID",e.M),nt(n,"RID",t),nt(n,"TYPE","terminate"),Jt(e,n),(t=new Ae(e,e.j,t)).M=2,t.A=st(Xe(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!n&&i.Image&&((new Image).src=t.A,n=!0),n||(t.g=sn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),Fe(t)}tn(e)}function Ht(e){e.g&&(Qt(e),e.g.cancel(),e.g=null)}function Vt(e){Ht(e),e.v&&(i.clearTimeout(e.v),e.v=null),Yt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&i.clearTimeout(e.m),e.m=null)}function jt(e){if(!$e(e.h)&&!e.m){e.m=!0;var t=e.Ea;m||y(),w||(m(),w=!0),E.add(t,e),e.D=0}}function $t(e,t){var n;n=t?t.l:e.V++;const s=Xe(e.J);nt(s,"SID",e.M),nt(s,"RID",n),nt(s,"AID",e.K),Jt(e,s),e.u&&e.o&&At(s,e.u,e.o),n=new Ae(e,e.j,n,e.D+1),null===e.u&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=qt(e,n,1e3),n.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),ze(e.h,n),Re(n,s,t)}function Jt(e,t){e.H&&R(e.H,function(e,n){nt(t,n,e)}),e.l&&R({},function(e,n){nt(t,n,e)})}function qt(e,t,n){n=Math.min(e.i.length,n);const s=e.l?B(e.l.Ka,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?n>0?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let B=!0;for(let c=0;c<n;c++){var i=r[c].g;const n=r[c].map;if((i-=t)<0)t=Math.max(0,r[c].g-100),B=!1;else try{i="req"+i+"_"||"";try{var o=n instanceof Map?n:Object.entries(n);for(const[t,n]of o){let s=n;a(n)&&(s=se(n)),e.push(i+t+"="+encodeURIComponent(s))}}catch(t){throw e.push(i+"type="+encodeURIComponent("_badmap")),t}}catch(e){s&&s(n)}}if(B){o=e.join("&");break e}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function zt(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;m||y(),w||(m(),w=!0),E.add(t,e),e.A=0}}function Kt(e){return!(e.g||e.v||e.A>=3)&&(e.Y++,e.v=we(B(e.Da,e),Zt(e,e.A)),e.A++,!0)}function Qt(e){null!=e.B&&(i.clearTimeout(e.B),e.B=null)}function Wt(e){e.g=new Ae(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=Xe(e.na);nt(t,"RID","rpc"),nt(t,"SID",e.M),nt(t,"AID",e.K),nt(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&nt(t,"TO",e.ia),nt(t,"TYPE","xmlhttp"),Jt(e,t),e.u&&e.o&&At(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=st(Xe(t)),n.u=null,n.R=!0,ke(n,e)}function Yt(e){null!=e.C&&(i.clearTimeout(e.C),e.C=null)}function Xt(e,t){var n=null;if(e.g==t){Yt(e),Qt(e),e.g=null;var s=2}else{if(!qe(e.h,t))return;n=t.G,Ke(e.h,t),s=1}if(0!=e.I)if(t.o)if(1==s){n=t.u?t.u.length:0,t=Date.now()-t.F;var r=e.D;W(s=pe(),new me(s,n)),jt(e)}else zt(e);else if(3==(r=t.m)||0==r&&t.X>0||!(1==s&&function(e,t){return!(Je(e.h)>=e.h.j-(e.m?1:0)||(e.m?(e.i=t.G.concat(e.i),0):1==e.I||2==e.I||e.D>=(e.Sa?0:e.Ta)||(e.m=we(B(e.Ea,e,t),Zt(e,e.D)),e.D++,0)))}(e,t)||2==s&&Kt(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),r){case 1:en(e,5);break;case 4:en(e,10);break;case 3:en(e,6);break;default:en(e,2)}}function Zt(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function en(e,t){if(e.j.info("Error code "+t),2==t){var n=B(e.bb,e),s=e.Ua;const t=!s;s=new Ye(s||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||Ze(s,"https"),st(s),t?function(e,t){const n=new Ee;if(i.Image){const s=new Image;s.onload=c(Et,n,"TestLoadImage: loaded",!0,t,s),s.onerror=c(Et,n,"TestLoadImage: error",!1,t,s),s.onabort=c(Et,n,"TestLoadImage: abort",!1,t,s),s.ontimeout=c(Et,n,"TestLoadImage: timeout",!1,t,s),i.setTimeout(function(){s.ontimeout&&s.ontimeout()},1e4),s.src=e}else t(!1)}(s.toString(),n):function(e,t){new Ee;const n=new AbortController,s=setTimeout(()=>{n.abort(),Et(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(s),e.ok?Et(0,0,!0,t):Et(0,0,!1,t)}).catch(()=>{clearTimeout(s),Et(0,0,!1,t)})}(s.toString(),n)}else ge(2);e.I=0,e.l&&e.l.pa(t),tn(e),Vt(e)}function tn(e){if(e.I=0,e.ja=[],e.l){const t=Qe(e.h);0==t.length&&0==e.i.length||(p(e.ja,t),p(e.ja,e.i),e.h.i.length=0,h(e.i),e.i.length=0),e.l.oa()}}function nn(e,t,n){var s=n instanceof Ye?Xe(n):new Ye(n);if(""!=s.g)t&&(s.g=t+"."+s.g),et(s,s.u);else{var r=i.location;s=r.protocol,t=t?t+"."+r.hostname:r.hostname,r=+r.port;const e=new Ye(null);s&&Ze(e,s),t&&(e.g=t),r&&et(e,r),n&&(e.h=n),s=e}return n=e.G,t=e.wa,n&&t&&nt(s,n,t),nt(s,"VER",e.ka),Jt(e,s),s}function sn(e,t,n){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new Ot(new Dt({ab:n})):new Ot(e.ma)).Fa(e.L),t}function rn(){}function an(){}function on(e,t){Q.call(this),this.g=new Gt(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!I(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!I(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new ln(this)}function Bn(e){ce.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function cn(){le.call(this),this.status=1}function ln(e){this.g=e}(e=Ot.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():De.g(),this.g.onreadystatechange=u(B(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Rt(this,e)}if(e=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var r in s)n.set(r,s[r]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const e of s.keys())n.set(e,s.get(e))}s=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),r=i.FormData&&e instanceof i.FormData,!(Array.prototype.indexOf.call(Nt,t,void 0)>=0)||s||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){Rt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,W(this,"complete"),W(this,"abort"),xt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),xt(this,!0)),Ot.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Lt(this):this.Xa())},e.Xa=function(){Lt(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return Ft(this)>2?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),re(t)}},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Gt.prototype).ka=8,e.I=1,e.connect=function(e,t,n,s){ge(0),this.W=e,this.H=t||{},n&&void 0!==s&&(this.H.OSID=n,this.H.OAID=s),this.F=this.X,this.J=nn(this,null,this.W),jt(this)},e.Ea=function(e){if(this.m)if(this.m=null,1==this.I){if(!e){this.V=Math.floor(1e5*Math.random()),e=this.V++;const r=new Ae(this,this.j,e);let i=this.o;if(this.U&&(i?(i=k(i),x(i,this.U)):i=this.U),null!==this.u||this.R||(r.J=i,i=null),this.S)e:{for(var t=0,n=0;n<this.i.length;n++){var s=this.i[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if((t+=s)>4096){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=qt(this,r,t),nt(n=Xe(this.J),"RID",e),nt(n,"CVER",22),this.G&&nt(n,"X-HTTP-Session-Id",this.G),Jt(this,n),i&&(this.R?t="headers="+Ie(Tt(i))+"&"+t:this.u&&At(n,this.u,i)),ze(this.h,r),this.Ra&&nt(n,"TYPE","init"),this.S?(nt(n,"$req",t),nt(n,"SID","null"),r.U=!0,Re(r,n,null)):Re(r,n,t),this.I=2}}else 3==this.I&&(e?$t(this,e):0==this.i.length||$e(this.h)||$t(this))},e.Da=function(){if(this.v=null,Wt(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var e=4*this.T;this.j.info("BP detection timer enabled: "+e),this.B=we(B(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,ge(10),Ht(this),Wt(this))},e.Va=function(){null!=this.C&&(this.C=null,Ht(this),Kt(this),ge(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),ge(2)):(this.j.info("Failed to ping google.com"),ge(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=rn.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},an.prototype.g=function(e,t){return new on(e,t)},l(on,Q),on.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},on.prototype.close=function(){Ut(this.g)},on.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=se(e),e=n);t.i.push(new Ve(t.Ya++,e)),3==t.I&&jt(t)},on.prototype.N=function(){this.g.l=null,delete this.j,Ut(this.g),delete this.g,on.Z.N.call(this)},l(Bn,ce),l(cn,le),l(ln,rn),ln.prototype.ra=function(){W(this.g,"a")},ln.prototype.qa=function(e){W(this.g,new Bn(e))},ln.prototype.pa=function(e){W(this.g,new cn)},ln.prototype.oa=function(){W(this.g,"b")},an.prototype.createWebChannel=an.prototype.g,on.prototype.send=on.prototype.o,on.prototype.open=on.prototype.m,on.prototype.close=on.prototype.close,aB=function(){return new an},iB=function(){return pe()},rB=ue,sB={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},_e.NO_ERROR=0,_e.TIMEOUT=8,_e.HTTP_ERROR=6,nB=_e,be.COMPLETE="complete",tB=be,oe.EventType=Be,Be.OPEN="a",Be.CLOSE="b",Be.ERROR="c",Be.MESSAGE="d",Q.prototype.listen=Q.prototype.J,eB=oe,Ot.prototype.listenOnce=Ot.prototype.K,Ot.prototype.getLastError=Ot.prototype.Ha,Ot.prototype.getLastErrorCode=Ot.prototype.ya,Ot.prototype.getStatus=Ot.prototype.ca,Ot.prototype.getResponseJson=Ot.prototype.La,Ot.prototype.getResponseText=Ot.prototype.la,Ot.prototype.send=Ot.prototype.ea,Ot.prototype.setWithCredentials=Ot.prototype.Fa,Zo=Ot}).apply(void 0!==oB?oB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var BB=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static LOOKBEHIND=512;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2};const cB=1,lB=2,uB=4,hB=8,pB=16,dB=512,fB=128,CB=new Int32Array(fB),gB=new Int32Array(fB),mB=65535;for(let e=0;e<fB;e++)CB[e]=e>=97&&e<=122?e-32:e,gB[e]=e>=65&&e<=90?e+32:e;var wB=class{static CODES=Object.freeze({"":7,"\b":8,"\t":9,"\n":10,"\v":11,"\f":12,"\r":13," ":32,'"':34,$:36,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,"-":45,".":46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,"<":60,">":62,"?":63,A:65,B:66,C:67,F:70,P:80,Q:81,U:85,Z:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,a:97,b:98,f:102,i:105,m:109,n:110,r:114,s:115,t:116,v:118,x:120,z:122,"{":123,"|":124,"}":125});static toUpperCase(e){if(e<fB)return CB[e];const t=String.fromCodePoint(e).toUpperCase(),n=t.codePointAt(0)>mB?2:1;if(t.length>n)return e;const s=String.fromCodePoint(t.codePointAt(0)).toLowerCase(),r=s.codePointAt(0)>mB?2:1;return s.length>r||s.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){if(e<fB)return gB[e];const t=String.fromCodePoint(e).toLowerCase(),n=t.codePointAt(0)>mB?2:1;if(t.length>n)return e;const s=String.fromCodePoint(t.codePointAt(0)).toUpperCase(),r=s.codePointAt(0)>mB?2:1;return s.length>r||s.codePointAt(0)!==e?e:t.codePointAt(0)}},EB=class{constructor(e,t=!1){this.data=e,this.isStride1=t,this.SIZE=t?2:3}getLo(e){return this.data[e*this.SIZE]}getHi(e){return this.data[e*this.SIZE+1]}getStride(e){return this.isStride1?1:this.data[e*this.SIZE+2]}get length(){return this.data.length/this.SIZE}};const yB=new Uint8Array(256);for(let e=0;e<64;e++)yB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-".charCodeAt(e)]=e;const DB=e=>{const t=[];let n=0,s=0;for(let r=0;r<e.length;r++){const i=yB[e.charCodeAt(r)];n|=(31&i)<<s,32&i?s+=5:(t.push(n),n=0,s=0)}return t},_B=(e,t)=>{const n=DB(e),s=t?n.length/2:n.length/3,r=new Uint32Array(3*s);let i=0,a=0;for(let e=0;e<s;e++)i+=n[a++],r[3*e]=i,i+=n[a++],r[3*e+1]=i,r[3*e+2]=t?1:n[a++];return r};var bB=class{constructor(e){this.initializer=e,this.cache=new Map}has(e){return e in this.initializer}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.initializer[e],n=t?t():null;return this.cache.set(e,n),n}},vB=class{static _CASE_ORBIT=null;static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=(e=>{const t=DB(e),n=new Map;let s=0;for(let e=0;e<t.length;e+=2){s+=t[e];const r=t[e+1],i=r>>>1^-(1&r);n.set(s,s+i)}return n})("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0NDCBBB0NBCBBByNByNBCBBBCBBB2NBCBBDCBBCwDFCBCBDBCBCBDBCBCBDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB9EBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBCBDBCBBBhGBvDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBjICCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBH2iVBCBBBlKBwiVB+jVB+jVBCBBBlMBqEBuEBCBBBCBBBCBBBCBBBCBBB+hVB4hVB8hVBjNB7MC5MB5MCzMC1MB+0yCE5MB20yCC9MBu2yCBwyyCBo0yCChNBlNBo0yCBu-UBi0yCDlNC6-UBpNDrNIu+UDzNCm0yCBzNE0yyCBzNBpEBxNBxNBtEG1NLqxyCBkxyCnFoFrBCBBBCBBDCBBEkIBkIBkICoHHsCCqCBqCBqCCgEC+DB+DBmkOBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCC+BBgCBgCBgCBgCBgCBgCBgCBgCBrCBpCBpCBpCBmjOB-BB8BB-BB-BBgEB-BB-BByBBqgOBsDB-BBtwBB-BB-BB-BBsBBgDBCB-BB-BB-BBeB-BB-BB61OB-BB-BB-DB9DB9DBQB7DBmCE9CBrDBPBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBrFB-EBOBnHB3FB-FCCBBBNBCBBCjIBjIBjIBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB8kMB-BB6kMB-BB-BB-BB-BB-BB-BB-BB-BB-BBokMB-BB-BBkkMBkkMB-BB-BB-BB-BB-BB-BB-BB4jMB-BB-BB-BB-BB-BB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EBCBBBCBoiMBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBJCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBeBCBBBCBBBCBBBCBBBCBBBCBBBCBBBdBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDL-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-C64CgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOCgmOGgmODg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FDg8FBg8FBg8FhVg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBQBQBQBQBQBQDPBPBPBPBPBPjkC7mMB5mMBnmMBjmMBCBlmMB3lMBpiMBk8kCBCBBG-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FD-7FB-7FB-7F6FoglCEsuHRwjlCyDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCB0DBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBG1DD97OCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPEQCQCQCQCPCPCPCPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPB0EB0EBsFBsFBsFBsFBoGBoGBgIBgIBgHBgHB8HB8HDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQCSFPBPBzEBzEBRCxnOFSFrFBrFBrFBrFBREQBQClkOFPBPBnGBnGFQBQCljOCODPBPB-GB-GBNHSF-HB-HB7HB7HBRqJ53OE9tQBrmQH4Bc3BSgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfECBByZ0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzB34BgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CBCBBBt-UBruHBt+UB1iVBviVBCBBBCBBBCBBB3hVB5-UB9hVB7hVCCBBCCBBI9jVB9jVBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBICBBBCBBECBBN-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOC-lOG-lOzoeCBBBCBBBCBBBCBBBCBBBCBl8kCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBTCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBnECBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBKCBBBCBBBnglCBCBBBCBBBCBBBCBBBCBBECBBBvyyCDCBBBCBBBgDCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBn0yCB90yCB10yCBh0yCBn0yCCjxyCBzyyCBpxyCBg6BBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB-CBl0yCBvjlCBCBBBCBBBt2yCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBhkzCZCBB9a-5Bd-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCm6TCBB7gBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCH-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BmlBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvChDwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCFvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvC1DuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCCuCBuCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCCtCBtCk2BgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEO-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-D+CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCL-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-B74CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhrVgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BD1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BtxekCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjC")),this._CASE_ORBIT}static _Print=null;static get Print(){return this._Print||(this._Print=new EB(_B("hB9CBjBLBCpWBDFBFGBCCCBSBCsMBClBBDxBBDCBC2BBJaBFFBSVBC-FBCvBBD6BBDkDBP6BBDwBBDOBCbBDCCBJBGfBIqCBCgFBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYBDCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPBLCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGBCCBCHBDBBDVBCGBCBBCEBDIBDBBDCBICBFBBCEBDRBLBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBGMBCCBCWBCPBDIBCCBCDBIBBCCBCBBDDBDJBIVBCCBCWBCJBCEBDIBCCBCDBIBBGCBCDBDJBCCBNMBCCBCyBBCCBCFBFPBDZBCCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBN5BBFcBmBBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDBhBnCBCjBBFmBBCjBBCOBCMBmBlGBCGGD4LBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBH1CBDFBD-TBCbBE4CBIVBKXBKTBNMBCCBCBBN9CBDJBHJBHNBCKBH4CBIqBBGlCBLeBCLBFLBFEEBoBBDEBMrBBFZBHKBE9BBDgCBCcBDKBHJBHNBDtBBDLBVsCBClFBJ7BBEOBE9BBGqBBDKBJqBBG1QBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBSXBJuBBSBBDaBCMBEhBBPgBBQrEBF5UBXKBWz4BBD9LBGsBBCGGD3BBIBBPXBKGBCGBCGBCGBCGBCGBCGBCGBC9DBjBZBC4CBN1GBbPBC+BBC1CBDmDBGqBBC9CBC1CBKvBBCszcBE2BBK7KBV3FBJ8GBV7BBEJBH3BBJlCBJLBHzDBMdBEtCBCKBFgBBC2BBKNBDJBDmDBZbBLFBDFBDFBKGBCGBC7BBF9DBDJBHj9KBNWBFwBBloItLBDpDBnBGBNEBGZBCEBCCCBCCBCCBoUBhBpBBHyBBCSBCDBFEBCmEBF9FBEFBDFBDFBDCBEGBCGBOBBDLBCZBCSBCBBCOBDNBjB6DBGCBFsBBE3CBCMBEwBwBBsBBjEcBEwBBQbBFjBBKdBGqBBGdBCkBBFNBrB9EBDJBHjBBFjBBFnBBJzBBMLBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBCnCBJIBxBSBCBBGgBBEaBGaBnB3BBFTBDxBBCBBGHBCCBCcBDCBFJBIIBI-BBhBmBBFLBK1BBEcBDaBGZBIDBNGBxCoCB4ByBBOyBBItBBJJBHlBBEcBJBBxGeBCpBBCCBDBBRFBJIBiBtBBJpBBXZBnBbBVWBKtCBFjBBK9BBCEBOYBIJBH0BBCRBJmBBK-CBCTBMRBCuBB-BGBCCCBCBCOBCKBH6BBGJBHDBCHBDBBDVBCGBCBBCEBCJBDBBDCBDHHGGBDGBEEBMJBCDDClBBCJBCDDCDBCJBCBBJBBe7CBCEBfnCBJJBnF1BBDlBBjBkCBMJBHMBU5BBHJBHTBdaBDOBFWB6F7BBlDyCBNHBDDDBGBCBBCdBCBBDLBKJBnCHBDtBBDKBcnCBJyCBOoCBIJB3CHB5ChBBPJBHIBCsBBCNBLcBEfBDVBCNBqCGBCBBCrBBECCBCCBHBJJBHFBCBBCkBBCBBCFBIJBHrBBFJB3HYBIQBCoBBEcB2CQQBwBBO6cBnDuDBCEBMjGBtyCiDBOvhBBRVBL68DBGmSB61G5BBn2B4RBIeBCJBFwCBCJBHdBDFBLlCBLJBCGBCUBGSBxN5BBnG6CBGYBDYBtBqCBF4BBIQBhCEBMGBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBDDBh7D8HBEzNBHWBQQBQtBBDWBKzDB9B1HBLmBBDpCBJvDBWlCB7DTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBD9VBQEBCOBxiBeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBENBDJBFBBhKeBS5BBGxOxOBoBB3GqBBFhGhGBdBCVBJBBhHGBCDBCBBCOBCkGBDPBqBrCBFJBFBByYjCBtC8BBjGDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBBvIrBBFjDBNOBDOBCOBCkBBLtFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBmgB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIBnkzVvHB",!1))),this._Print}static CATEGORIES=new bB({C:()=>new EB(_B("AfBgDgBBOrWrWBHHBCBICCVuMuMnBBBzBBBE4B4BBGBcDBHQBXhGhGxBBB8BBBmDNB8BBByBBBQddBCCMEBhBGBsCiFiFJBBDBBXIICCBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBPMMBEB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKMMBDBbEByBPBDBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCB-FCBHBBHBBHBBECBIIIBLBDBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIB-BGGBLBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMBxhBPBXJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBF-6DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBrCHBxDUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIlkzVBxHvw-FB",!1)),Cc:()=>new EB(_B("AfgDgB",!0)),Cf:()=>new EB(_B("tFzqBzqBBEBXhGhGyBhMhMBxCxCs5D9-B9-BBDBbEByBEBCJBw03B6H6HBBBimEQQj7IPBhjiBDBwmFHBn0rYffB+CB",!1)),Cn:()=>new EB(_B("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBDBvzIBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-BB---BBB---BBB",!1)),Co:()=>new EB(_B("gg4B-nGh4hc9--BD9--B",!0)),Cs:()=>new EB(_B("gg2B--B",!0)),L:()=>new EB(_B("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICCiEEBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoCaBFDBuBqBBkBBBCiDBCQQBIIBLLBBBDRRCdBe4CBMZZBfBKBBFGGBUBFKKEYYBXBIKBGXBCGBRpBB7B1BBETTIJBQPBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNGB7BBBCCCBDBCXBCCCBIBCBBKDDBDBCWWBCBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNSSBkBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBkBFFkC4CBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBzC+C+CBtBBSHB3BdBOBBLrBBbjBBqBCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBhC1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBF1B1BB8zC8zCBjHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBxC2O2OBrBrBBDBGBBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBReBDlCByBIBDmDBDxCBVQBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBdRRBDBCJBLEBCoBBYCBCHBVWBEEEBwBBCEEBDDBDBDCCZCBDKBICBNFBDFBDFBKGBCGBCqBBCNBHyDBej9KBNWBFwBBloItLBDpDBnBGBNEBGCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBxB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOjBBnBbBKWB7HpBBHBBRFB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB1D-BBgBHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBqBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBGjCjCBLBhCBBCPPBNNB0mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBn7F0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFBmI9BBzEsBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCCBCBBCGBDEBKBBhHGBCDBCBBCOBCkGB8BjCBI1lB1lBBCBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),LC:()=>new EB(_B("hCZBHZB7BLLBVBCeBCiGBCDBFvGBDZBhGDBDBBECBCHHCCBCCCBSBCyCBCqEBJlFBClBBKoBB44ClBBCGGDqBBDCBhV1CBDFBjkCKBGqBBDCBhCrBBgCMBChBBmD1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGBmIFFDJBCEEBDBHGCBCBCFBFDDBCBGEBF1B1BB8zC8zCB6DBDmDBHDBEBBNlBBCGGzoetBBTbBnEtCBCWBEDBCsCBZBBE2Z2ZBpBBGIBIvCBh6TGBNEBqgBZBHZBmlBvCBhDjBBFjBB1DKBCOBCGBCBBCKBCOBCGBCBBk2ByBBOyBB+CVBLVB74C-BBhrV-BBhBYBDYBtpZ0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BJBCTBHFB2uCjCB",!1)),Ll:()=>new EB(_B("hDZB7BqBqBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDZBiGCCEEEBBBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBDCB5XFBjkCIBC2D2DBqBBgCMBChBBnD0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBBzIEEBEEcKFDBBJDBF2B2Bs1CvBBCEEBGCFCCBCCBEBGiDCBIICFFNlBBCGG0oesBCUaCoEMCBBBC+BCBGBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCbEE2ZqBBGIBIvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFB4vChBB",!1)),Lm:()=>new EB(_B("wVRBFLBPEBICCmEGG-OnHnHlFBBuIBBFgBgBKEEhFoFoF1mBgEgE2R72B72BsDkTkTxOFBvF+BBOjBjBBjBByVOORMBg-CBByHgGgG2OsBsBBDBGiDiDB+C+CBBB34bjnBjnBBEBvIzDzDdBB6DIBxCYYpDDBEBB2OXXqEtDtDWBBoDDBKngVngVuBBBh-BFBCpBBCIB0sBhBhB2K04D04DnrTDB9PCBpBBBnRMBhCBBCPPB9-P9-PBCBCGBCBByhM9BBqGGBud0Q0QsSAB",!1)),Lo:()=>new EB(_B("qFQQhIFFBCBxGBB7ZaBFDBuBfBCJBkBBBCiDBCZZBLLBBBDRRCdBe4CBMZZBfBWVBrBYBIKBGXBCGBRoBB8B1BBETTIJBROBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNFB8BBBCCCBDBCXBCCCBIBCBBKDDBDBYDBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNyDyDBnKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPByDrTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBpBkCkCBhBBC0BBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBxFuBBSHB3BdBOBBLrBBbjBBqBCBLdByDDBCFBCBBE7hB7hBBCB4-C3BBZWBKGBCGBCGBCGBCGBCGBCGBCGBoR2B2BF1CBJCCB4CBFGGBpBBC9CBSfBxBPBhQ-tGBhC0wUBC2jBBkCnBBJrIBFPBLBBjCyByBBkCBqFoDoDEGBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBuBEBDIBLEBCoBBYCBCHBVPBCFBEEEBwBBCEEBDDBDBDCCZBBEKBIPPBEBDFBDFBKGBCGByEiBBej9KBNWBFwBBloItLBDpDBkCCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBqDJBCsBBDeBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBhEtCBjDnBBJzBB9CzBBN2JBKVBLHB5EFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4FjBBnBDBCxJxJBoBBHBBRCBCBB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB0GHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBnBBCBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBB0BUBGSB0NnBB2MqCBGwFwFB0mHBqBfBiDyDBuwIiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBxzI2P2PBrBBiBiKiKBcBTrBBlPaBmHdBDwGwGBdBCCBCBBCGBDEBKiHiHBFBCDBCBBCOBCkGB8pBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Lt:()=>new EB(_B("lOGDnB2sH2sHBGBJHBJHBNQQwBAB",!1)),Lu:()=>new EB(_B("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBG+B+B9zCvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBB",!1)),M:()=>new EB(_B("gYvDB0IGBoIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCgBB3BCBCRBCGBLBBeCB5BCCBFBDBBDCBKLLBbbDCB5BCCBDBFBBDCBEffBEEMCB5BCCBGBCCBCCBVBBXFBCCB5BCCBFBDBBDCBICBLBBf8B8BBDBECBCDBKpBpBBDB4BCCBFBCCBCDBIBBMBBeCB5BCCBFBCCBCDBIBBMBBQNNBCB4BBBCGBCCBCDBKLLBeeBBBnCFFBEBCCCBGBTBB+BDDBFBNHBjDDDBHBMGBqCBBcECFBByBTBCBBGKBCjBBKlDlDBSBYDBFCBCCBDGBEDBOLBCLLBCBgWCBzdDBdCBeBBfBBhCfBKuBuBBBBC2D2DBjBjB3DLBFLB8GEB6BJBCcBDxBxBBsBBDLBVEBwBQBnBIBNCBfMB5BNBxBTB5ECBCUBFHHDCBnG-BBxWgBB--CCBuEhDhDBeBrRFBqDBB1udDBCJBhBBBxCBBxIEEFYYBDBF0C0CBzBzBBQBbRBOnBnBBGBaMBtBDBwBNBlBkCkCBMBNJJBuBuBBBBzBCCBBBDBBGBBCqBqBBDBGBBtHHBCBBx5TiXiXBOBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB7DCB2BOBqBDDBLLBCBuBKBI+B+BBBBlBNBRBBtBNNBBBxBNBJDBCBB9CLBHDD+ELBWDB4BBBCGBDBBDCBKLLBDDBFBEEBkCIBCDDCDBCEBCPPBzCzCBQBYyCyCBSBsHGBDIBcBBzCQBrDMBmDOBhIOB2HFBCBBDDBCCCBuEuEBFBDGBEddBIBpBGBCDBJKKBJBvBPBnGHBoGHBCHBzCVBCNB7DFBECCBCCBFBCjCjCBDBCBBCEB8KDBKBBCxBxBBFBEEBYmnFmnFHOBpmLRBhuCEB8BGB5gBCCB1BBIDByCMMBslTslTBizEizEBsBBDWB-QEBEFBJHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),Mc:()=>new EB(_B("joC4B4BDCBJDBCBBzBBB7BCBHBBDBBLsBsB7BCBjC7B7BBBBJCCB2B2BB7B7BCHHBDDBLLnDBBCBBECBCCBLqBqBBBB+BDB+BBB7BCCBDBDBBCBBKBBdPPB7B7BBBBGCBCCBLrBrBBsCsCBBBHHBTBBrKBBgCsFsFBFFHDDBaaBLLBBBDGBWBBDFBDLLBBB5zBffiEIIBGBCBB7KDBDCBFBBCFBhHBB7BCCKCCBJJBEByExBxBGCCBDBCBB+BffFBBD9B9BDCBCEEBxBxBBGBJBBsFWW35EBB0-dBBD5C5CBzBzBBOBvEBBwBxBxBBFFBDDBBBvDBBDBBZuBuBCuDuDDBBGuHuHBCCBCCBCC0gZCCgEuBuBBBBFBB0DZZB8B8BxBCBKBBO+C+CBBBEBBCrFrFBBBgBBB7BBBCDBDBBDCBKLLB1C1CBBBIDDCDBCBBCmDmDBBBJBBErDrDBBBHCCBCBDuHuHBBBHDBDyDyDBBBJBBCuDuDCBBHoDoDCBBFmImIBBBK4H4HBEBCBBFDDCvEvEBBBJDBF1C1CeBB-BqGqGECCoGPPrDIID2G2GBDBFBBC-K-KBNNxBBBJBBCpvQpvQBBBlxD2BBpDBB0rYBBHFB",!1)),Me:()=>new EB(_B("okBBB1xF-wB-wBBCBCCBsshBCB",!1)),Mn:()=>new EB(_B("gYvDB0IEBqIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCfB4BCCFHBFEEBFBLBBe7B7BFDBJVVBbbDBB6BFFBFFBDDBBBEffBEEMBB6BFFBDBCBBFVVBXXBEBC7B7BDCCBCBJIIBMMBff+BNNzBEE4BCCBBBGCBCDBIBBMBBe7B7BDHHGBBVBBdBB6BBBFDBJVVBeepCIIBBBC7C7CDGBNHBjDDDBHBMGBqCBBcEC4BNBCEBCBBGKBCjBBKnDnDBCBCFBCBBDBBaBBFCBRDBODDBHHQgWgWBBBzdCBeBBfBBfBBhCBBCGBJDDBJBKuBuBBBBC2D2DBjBjB3DCBFBBKHHBBB8GBBD7B7BCGBCCCDHBHJBDxBxBBMBCeBDLBVDBxBCCBDBCGGpBIBNBBhBDBDBBCCB5BCCBEECCB7BHBDBB5ECBCMBCGBFHHEBBnG-BBxWMBFEEBKB--CCBuEhDhDBeBrRDBsDBB1udFFBIBhBBBxCBBxIEEFaaBGG4EBBbRBOnBnBBGBaKBvBCBxBDDBCBDBBoBkCkCBEBDBBDBBNJJwB0B0BCCBDBBGBBCrBrBBJJvHDDFx5Tx5TiXPBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB8D3B3BBNBqBDDBLLBBByBDBDBBI+B+BBBBlBEBCHB-BNNB1B1BBHBLDBDgDgDBBBDCCBHHD+E+EEHBWBB6BBBEmBmBBFBEEBnCFBOECPBB2CHBDCBCYY1CFBCFFBCCBvHvHBCBHBBCBBcBB2CHBDCCBrDrDCDDBEBCmDmDCDDBCBCEBkIIBCBBhIBBCFFxEDBDBBFhBhBBIBpBFBDDBJKKBEBDCBvBMBCBBnGCCBBBCqGqGBFBCFBCzCzCBUBDGBCBBCBB7DFBECCBCCBFBCpCpCBEEC8K8KBMMB1B1BBDBGCCYmnFmnFHOBpmLLBECBhuCEB8BGB5gBgCgCBCByC5lT5lTBizEizEBsBBDWBhRCBSHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),N:()=>new EB(_B("wBJB5DBBGDDBBBitBJBnEJBnGJB9MJB3DJBFFBtDJB3DJB3DJBDFBvDMB0DJBJGBoDJBpDGBISBuDJBhDJB3DJBnCTBtIJBnCJBwWTBybCBwHJBHJBXJBtJJBhEKBmFJBHJB3FJB3CJBnEJBHJB3gBEEBEBHJBnGyBBDEB3W7BBvCVB3TdBqrBqYqYaIBPCB4KDBrEJBfHBCOBhBJBoBOBh7cJB9FJBhKFB7EJBnBJBnGJBXJB3CJB3MJB34UJBuPsBBN4BBSBB2KaBlBDBeJJnEEBrGJBvdHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBxBJBHJB3IeB-EJBrBDBxDGBnEdBhEJB9BJBxEJBITB8HJB3KJB3DJB3LJBnDJBHTBtCLBlNSB+CJB3UJB3CcBkHJBnCJB3BJBnLJBnDUBshBuDBimPJBnpCJB3CJBnEJBCGBvQJBnIWB+KCB6nXJBnuBTBNTBtDYB2iBxBBhqCJBnNJB3PJB4HJBtWIBhEJB4Y6BBCCBCDBtCsBBCOBjeMBk3CJB",!1)),Nd:()=>new EB(_B("wBJnxBJnEJnGJ9MJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJhDJ3DJnCJ3IJnCJn6BJnBJtJJhEJnFJHJ3FJ3CJnEJHJnuiBJnVJnBJnGJXJ3CJ3MJ34UJnsBJnkCJHJ9YJhEJ9BJxEJ3IJ3KJ3DJ3LJnDJHTtCJnNJnDJ3UJ3CJ3HJnCJ3BJnLJ3uQJnpCJ3CJnEJ3QJ37XJ12CxBhqCJnNJ3PJ4HJ2aJ30EJ",!0)),Nl:()=>new EB(_B("u3FCBwzCiBBDDB-zDaaBHBPCBs1dJBxyW0BBtOJJnEEBrhIuDBm8SCB",!1)),No:()=>new EB(_B("yFBBGDDBBB2pCFB5LFB5DCBmEGB6GGBSIByNJB2hBTB0jBJBhP20B20BEFBHJBnGPBqB3W3WB6BBvCVB3TdBqrB1kB1kBBCBrEJBfHBCOBhBJBoBOBxrdFBymWsBBiCDBSBB2KaBlBDB1pBHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBhLeB-EJBrBDBxDGBnETB8LTBmqBBBvNIBobSB0aUBn8SGB-YWBqhZTBNTBtDYBvqFIBid6BBCCBCDBtCsBBCOBjeMB",!1)),P:()=>new EB(_B("hBCBCFBCDBLBBEBBbCBCccCkBkBGEELBBEEE-VJJzOFBqBBB0BCCDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCmBmBBCBoCrCrCBDBFBBwDFBsFlTlTBHB4EuTuTtBBBvCCBoCBB+ECBCCBmBKB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBM9Z9ZBWBJTBCMBCLBfBBPBB6TDBeBB+hBNBwCBBgBJB0MVBgCDBhBBB8XDBCBBxDwEwEBtBBCfBDLBkNCBFJBDLBRNNjD7C7CjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HzqUzqUBxGxGBIBXiBBCNBCFFCBB2ECBCFBCDBLBBEBBbCBCccCCCBFB7MCB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDByO-J-JjBlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Pc:()=>new EB(_B("-Cg-Hg-HBUU-u3BBBZCBwHAB",!1)),Pd:()=>new EB(_B("tB9qB9qB0BiyDiyDmgBqgCqgCBEBiwDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Pe:()=>new EB(_B("pB0B0BgB+1D+1DC-6B-6BqtC4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECtBGCtNICEGCDBB-ozB6G6GeOCESSCCCrF0B0BgBGD",!1)),Pf:()=>new EB(_B("7F+6H+6HEddpuDCCFDDQEE",!1)),Pi:()=>new EB(_B("rFt7Ht7HDBBDaapuDCCFDDQEE",!1)),Po:()=>new EB(_B("hBCBCCBDECBLLBEEBcclCGGPBBI-V-VJzOzOBEBqB3B3BDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCxDxDrCEBFBBwDFBsFlTlTBHBmY9D9DBBBoCBB+ECBCCBmBFBCDB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBMjajaBJJBGBJIBDDBDCBEKBCCCBIB7kDDBCBBxDwEwEBFFBBBDDDBHBCBBCDDBLLBDBCJBDDBCCCBLBDCBtNCB6B+F+FjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HlxUlxUBFBDXXVBBDDBECBCDBICBHCCB2E2EBBBCCBDECBLLBEEBcclBDDB7M7MBBB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDB0ZlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Ps:()=>new EB(_B("oBzBzBgB-1D-1DC-6B-6B-rCEEnB4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECaTTCECtNICEGCDipzBipzB4GeeCMCESSCCCrFzBzBgBEEDAB",!1)),S:()=>new EB(_B("kBHHRCBgBCCcCCkBEBCBBDCCBCBDEEfgBgBrODBNNBGGBCCCBPB2DPPBxDxDsErIrIBBB3DCBDDDBvGvGLUUB4H4HIBBpEqLqLBHHB2H2H-DjEjEBGBlEwGwGqBmGmGiGCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WuLuLlL+E+EBgBBiLJBKIBhiBCCBBBMCBOCBOCBOBBmCOOoBCBOCBUhBB-BBBCDBCBBLCCBBBGFBCECFMMBFFBDBGDBC7B7BBFFB2LBFcBD+HBXKByCtCBXnTBtBwBBDeBLyMBX+BBFfBD1LBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBB8CBB0HBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BB6RWBKBBoDBB+EDBLDB+RCBiHPPB+9T+9TpEgBBuLPBhCBB3BHBtBDBjDCCBBBD7E7EHRRBBBgBCCcCCiEGBCGBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSmWmWBiKiKBGBnjC2kC2kCBbBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQQBgDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBrbaagBaagBaagBaagBaa9B-PB4BDBzBHBCNBCBBp2BwNwNttCEE+DiOiOBvIvIBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Sc:()=>new EB(_B("kB+D+DBCBqnB8D8DzPBBzPBBI2H2HoImSmS8sClmClmCBgBB37hBkuVkuVtD7E7E8GBBEBB3-HDB-4wBxtCxtC",!1)),Sk:()=>new EB(_B("+CCCoCHHFEEqQDBNNBGGBCCCBPB2DPPBjoBjoB15FCCBBBMCBOCBOCBOBB9kEBBkzdWBKBBoDBBxePPBniUniUBPB8bCCjF4g9B4g9BBDB",!1)),Sm:()=>new EB(_B("rBRRBBB+BCCuBFFmBgBgB-XwQwQBBB8xGOOoBCBOCBsEoBoBBDBHlClCBDBGBBFGDIgBgBBDDCgBgBBqIBhBBB7CffBXBpBFB2OKK3BHBwDxKxKBDBDeBLPBhIiEBX+BBFfBDhIBxBUBDFB9+zB5Z5ZCCBlFRRBBB+BCCkEHHBCBitDBBhrwBx+Bx+BagBgBagBgBagBgBagBgBat5Ft5FB-uC-uCBHB",!1)),So:()=>new EB(_B("mFDDFCCyerIrIBgEgEBvGvGLUUB4H4HkQ2L2LjEFBClElEwGqBqBoMCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WzWzW+EhBBiLJBKIBksBBBCDBCBBLCCBHHBEBCECFMMBPPCBBC7B7BBKKBDBDDBCBBCBBCGBCeBDBBCCCBdBtIHBFTBDGBDwCBCdBanBBHnCBXKByCtCBX2FBCIBC1BBJuDBC3HBtBrBBhC-HBhQvBBWBBHmBBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBBxKBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BBibDBLBBC+R+RBBBqqUPBuLPBhCBB3BHBuBCBlPEEFBBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSpgBpgBBGBnjC2kC2kCBGBFQBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQPBhDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBqlB-PB4BDBzBHBCNBCBBp2B96C96CiEyWyWBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E6HBG4WBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBB-B3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Z:()=>new EB(_B("gBgEgEgvFgsCgsCBJBeBBGwBwBh9DAB",!1)),Zl:()=>new EB(_B("ohIA",!0)),Zp:()=>new EB(_B("phIA",!0)),Zs:()=>new EB(_B("gBgEgEgvFgsCgsCBJBlBwBwBh9DAB",!1)),ASCII_Hex_Digit:()=>new EB(_B("wBJIFbF",!0)),Alphabetic:()=>new EB(_B("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICC3CeeBQBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoBNBCCCBCCBCCJaBFDBeKBG3BBCGBPlDBCHBFHBFCBLCBDRRBuBBOkDBZgBBKBBFGGBWBDSBUYBIKBGXBCGBIJJBoBBLLBEGBHrCBCPBCCBFOBOSBCHBDBBDVBCGBCEEBCBEHBDBBDBBCJJFBBCEBNBBLFFBBBCFBFBBDVBCGBCBBCBBCBBFEBFBBDBBFIIBCBCSSBEBMCBCIBCCBCVBCGBCBBCEBEIBCCBCBBEQQBCBWDBFCBCHBDBBDVBCGBCBBCEBEHBDBBDBBKBBFBBCEBORRBCCBEBECBCDBEBBCCCBEEBEEBBBELBFEBECBCCBEHHpBMBCCBCWBCPBEHBCCBCCBJBBCCBCBBDDBdDBCHBCCBCWBCJBCEBEHBCCBCCBJBBGCBCDBOCBNMBCCBCoBBDHBCCBCCBCGGBCBIEBXFBCCBCRBEXBCIBCDDBFBJFBCCCBGBTBBO5BBGGBH0B0BBECBDBCXBCCCBRBCCBDEBCHHPDBhBgCgCBGBCjBBFSBFPBCjBBkC2BBCDDBDBR-BBLDBDlBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBEKBITBMUBNTBNMBCCBCBBNzBBDSBPFFkC4CBIqBBGlCBLeBCLBFIBYdBDEBMrBBFZB3BbBF+BBDTBzBYYBMMBBByBzBBCOBCHB0BpBBDDBLrBBCKBP2BBXCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBUhBBM1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBFSSBnBBuZzBB34BkHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBCfBwB2O2OBBBaIBIEBDEBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBGHBEwDBoBIBDmDBDxCBVUBCgBBZzBBNjCBCtBtBBEBECCBBBLgBBGiBBOcBEyBBCLBQRRBOBLEBC2BBKNBTWBEkCBCCCZCBDPBDDBMFBDFBDFBKGBCGBCqBBCNBH6DBWj9KBNWBFwBBloItLBDpDBnBGBNEBGLBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmC0BBsIcBEwBBwBfBOdBGqBBGdBDjBBFHBCEBrB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCDBCBBGHBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOnBBjBbBEGGBVB7HpBBCBBEBBRFBzBCBEcBLJJBUBrBRBvBUBcWBKlCBsBEBL4BBKOOBXBYyBBSDBJiBBEKKB+BBCDBKBBLCCkBRBChBBDHHBCB-BGBCCCBCBCOBCJBI4BBYDBCHBDBBDVBCGBCBBCEBEHBDBBDBBEHHGGBdJBCDDClBBCJBCDDCDBCBBECCtBhCBCCBCDBVCBfhCBDBBC5F5FB0BBDGBaFBjB+BBCEE8B1BBDoCoCBZBDNBWGB6F4BBoD-BBgBHBDDDBGBCBBCdBCBBDBBDDB+CHBDtBBDFBCCCBccBxBBDJBSnCBGTTBnCBoDHB5CgBBgBIBCsBBCGBCyByBBcBDVBCNBqCGBCBBCrBBECCBCCBBBCDDBZZBEBCBBCkBBCBBCDBCYYBqBBlIWBKQBCoBBECBwDwCwCB4cBnDuDBSjGBtyCgDBQvhBBSFBa68DBGmSB61GuBBy2B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBF4BBIQBhCBBCNNBFBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBFi7Fi7FBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCVBJBBhHGBCDBCBBCOBCkGB8BjCBEEE1lBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1TZBHZBHZB3zD-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Dash:()=>new EB(_B("tB9qB9qB0BiyDiyDmgBqgCqgCBEB+BoBoBQnMnMlgDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Emoji:()=>new EB(_B("jBHHGJBwDFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDrGrGhFBBNBBPDDBIBsCZBCBBYVVDIBWBBvFhBBDvDBDBBCCBDyCBDCBCmIBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDDBEJBECCBEEDJBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Emoji_Component:()=>new EB(_B("jBHHGJB0+H2G2Gsp3B3+8B3+8BBYB8PEBxtBDBtzhY-CB",!1)),Emoji_Modifier:()=>new EB(_B("7-8DE",!0)),Emoji_Modifier_Base:()=>new EB(_B("9wJ8G8GRDB4jzD9B9BBBBDDDBBB2DBBDKBWSBEFFBBBCCBICCZqGqGBFFWFFBvFvFBBBEEB0CRRBBBKMMgSDDJHBHKKBIBDCB5B+B+BBCCBCCSCBCMBmHCBrBIB",!1)),Emoji_Presentation:()=>new EB(_B("64IBBuGDBEDDqQBBWBBzBLBsBUUOJJBSSBGGBJJGWWIBBCFFDIIFBBdkBkBCFFBBBC+B+BBBBZPP8aBB0BFFvlxDrGrG-FDDBIBsCZBCZZVDDBDBCCBWBBvFgBBNIBClCBCVBNqBBFEBNQBEEEBlCBCCCB5FBD+BBODBCXBTbbBOO3C0CBxBlCBHEEBBBDDBEDBMBBIIBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Extended_Pictographic:()=>new EB(_B("pFFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDoBoBBCBlDLBQBBQPPBmBmBBIBxDBBNBBPDDBIBU3BBcOBLVVDIBCDBKWBH7FBDvDBDBBCCBDyCBDCBCDBG9HBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDQBECCBEBDMB7GlBBNDB5BHBLFBpBHBfBBNDBDNBKmBBNuBBCJBC4FB5CHBPxEBhI9fB",!1)),Hex_Digit:()=>new EB(_B("wBJIFbFq1-BJIFbF",!0)),Lowercase:()=>new EB(_B("hDZBwBLLFlBlBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDiBBIBBfEBhDsBsBCEEDDBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBCDB5XFBjkCIBC2D2DB+FBiC0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBB6DOORMBuDEEBEEcKFDBBJDBFiBiBBOBFsasaBYBn6BvBBCEEBGCFCCBCCBGBEiDCBIICFFNlBBCGG0oesBCUaCBBBmEMCBBBC8BCBIBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCWDBCCCBBB2ZqBBCNBHvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBkODDBBBCpBBCIBmoByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFBmI9BB1lChBB",!1)),Math:()=>new EB(_B("rBRRBBBgBeeCuBuBFmBmBgB5W5WBBBDbbBDDBBBwQCBuwGccBBBMEEOPPBCBWEBMEBiCMBFEEBFFBDBTFFDJBCDDBEBHEEBDDBCCBBBCFBENBClClCBWBCFBCBBFBBFfBCHHBPPBqIBJDBVBB7CffBZBCZZMGB+NBBNJBFFBFBBDBBEEBPCCDFBMHBGBB6BCCeDBKCBxK-BBhI-PBxBUBDFB9+zB4Z4ZBEBCjFjFRCBeCCeCCkEHHBCBitDBBhrwBwoBwoBBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBBhwFDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB-uCIB",!1)),Quotation_Mark:()=>new EB(_B("iBFFkEQQ96HHBaBBowDqOqOBCBOCBixzBDB+FFF7CBB",!1)),Terminal_Punctuation:()=>new EB(_B("hBLLCMMBEE-ZJJiQ6B6BpCPPCCB1FsBsBBJBCsHsHB3B3BBEBCHBgBmImIB1nB1nBBtFtFFFB4JBB2YHBmY9D9DBBBoCBB+ECBEoBoBBCBDBB7JBBjLDBjFBBLBBCCBeCB8FEB-BBBldYYBKKBBBwlDCBzJOOFLLCBBEBBtNBB8ndBBuICBkHEB-LBB3CBBgD4E4EBBB0ECBgERRB6H6HnxUDDB6B6BBBBCDBqFLLCMMBEEiCDD7hBxBxBnkBoGoG3JBB5EFBlCFB6CDB5dEBtBDB+FGBxDDBgECBiEBBHRRB5C5CBDBtDrJrJB2D2DBBBNBBnLDBEOBqDBB6HCBmQCC8HBB4CBBFBB-MCBuBmUmUBrCrCBspBspBBDB6vRBBmEiCiCBBBLqRqRBoJoJBnwTnwTovHDB",!1)),Uppercase:()=>new EB(_B("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBGbbBOBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new EB(_B("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))});static SCRIPTS=new bB({Adlam:()=>new EB(_B("go6DrCFJFB",!0)),Ahom:()=>new EB(_B("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new EB(_B("ggxCmS",!0)),Arabic:()=>new EB(_B("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!1)),Armenian:()=>new EB(_B("xpBlBDxBDCks9BE",!0)),Avestan:()=>new EB(_B("g4iC1BEG",!0)),Balinese:()=>new EB(_B("g4GsCCxB",!0)),Bamum:()=>new EB(_B("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new EB(_B("w26CdDF",!0)),Batak:()=>new EB(_B("g+GzBJD",!0)),Bengali:()=>new EB(_B("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new EB(_B("g17CYDY",!0)),Bhaiksuki:()=>new EB(_B("ggnCICsBCNLc",!0)),Bopomofo:()=>new EB(_B("qXB6wLqBxDf",!0)),Brahmi:()=>new EB(_B("ggkCtCFjBKA",!0)),Braille:()=>new EB(_B("ggK-H",!0)),Buginese:()=>new EB(_B("gwGbDB",!0)),Buhid:()=>new EB(_B("g6FT",!0)),Canadian_Aboriginal:()=>new EB(_B("ggF-TxRlC7tgCP",!0)),Carian:()=>new EB(_B("g1gCwB",!0)),Caucasian_Albanian:()=>new EB(_B("wphCzBMA",!0)),Chakma:()=>new EB(_B("gokC0BCR",!0)),Cham:()=>new EB(_B("gwqB2BKNDJDD",!0)),Cherokee:()=>new EB(_B("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new EB(_B("w9jCb",!0)),Common:()=>new EB(_B("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new EB(_B("ifNxkKzDGG",!0)),Cuneiform:()=>new EB(_B("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new EB(_B("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new EB(_B("w8rCiD",!0)),Cyrillic:()=>new EB(_B("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new EB(_B("gghCvC",!0)),Devanagari:()=>new EB(_B("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new EB(_B("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new EB(_B("ggmC7B",!0)),Duployan:()=>new EB(_B("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new EB(_B("ggsC1iBL68D",!0)),Elbasan:()=>new EB(_B("gohCnB",!0)),Elymaic:()=>new EB(_B("g-jCW",!0)),Ethiopic:()=>new EB(_B("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCDBCBBCOB",!1)),Garay:()=>new EB(_B("gqjClBEcJB",!0)),Georgian:()=>new EB(_B("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new EB(_B("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new EB(_B("w5gCa",!0)),Grantha:()=>new EB(_B("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new EB(_B("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new EB(_B("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new EB(_B("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new EB(_B("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new EB(_B("go4C5B",!0)),Han:()=>new EB(_B("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new EB(_B("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new EB(_B("gojCnBJJ",!0)),Hanunoo:()=>new EB(_B("g5FU",!0)),Hatran:()=>new EB(_B("gniCSCBGE",!0)),Hebrew:()=>new EB(_B("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new EB(_B("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new EB(_B("giiCVCI",!0)),Inherited:()=>new EB(_B("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new EB(_B("g7iCSGH",!0)),Inscriptional_Parthian:()=>new EB(_B("g6iCVDH",!0)),Javanese:()=>new EB(_B("gsqBtCDJFB",!0)),Kaithi:()=>new EB(_B("gkkCiCLA",!0)),Kannada:()=>new EB(_B("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new EB(_B("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new EB(_B("g4nCQCoBEc",!0)),Kayah_Li:()=>new EB(_B("goqBtBCA",!0)),Kharoshthi:()=>new EB(_B("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new EB(_B("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new EB(_B("g8F9CDJHJnPf",!0)),Khojki:()=>new EB(_B("gwkCRCuB",!0)),Khudawadi:()=>new EB(_B("w1kC6BGJ",!0)),Kirat_Rai:()=>new EB(_B("gq7C5B",!0)),Lao:()=>new EB(_B("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new EB(_B("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new EB(_B("ggH3BEOEC",!0)),Limbu:()=>new EB(_B("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new EB(_B("gwhC2JKVLH",!0)),Linear_B:()=>new EB(_B("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new EB(_B("wmpBvBx1eA",!0)),Lycian:()=>new EB(_B("g0gCc",!0)),Lydian:()=>new EB(_B("gpiCZGA",!0)),Mahajani:()=>new EB(_B("wqkCmB",!0)),Makasar:()=>new EB(_B("g3nCY",!0)),Malayalam:()=>new EB(_B("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new EB(_B("giCbDA",!0)),Manichaean:()=>new EB(_B("g2iCmBFL",!0)),Marchen:()=>new EB(_B("wjnCfDVCN",!0)),Masaram_Gondi:()=>new EB(_B("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new EB(_B("gy7C6C",!0)),Meetei_Mayek:()=>new EB(_B("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new EB(_B("gg6DkGDP",!0)),Meroitic_Cursive:()=>new EB(_B("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new EB(_B("gsiCf",!0)),Miao:()=>new EB(_B("g47CqCF4BIQ",!0)),Modi:()=>new EB(_B("gwlCkCMJ",!0)),Mongolian:()=>new EB(_B("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new EB(_B("gy6CeCJFB",!0)),Multani:()=>new EB(_B("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>new EB(_B("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new EB(_B("gkiCeJI",!0)),Nag_Mundari:()=>new EB(_B("wm5DpB",!0)),Nandinagari:()=>new EB(_B("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new EB(_B("gsGrBFZHKEB",!0)),Newa:()=>new EB(_B("gglC7CCE",!0)),Nko:()=>new EB(_B("g+B6BDC",!0)),Nushu:()=>new EB(_B("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new EB(_B("go4DsBENDJFB",!0)),Ogham:()=>new EB(_B("g0Fc",!0)),Ol_Chiki:()=>new EB(_B("wiHvB",!0)),Ol_Onal:()=>new EB(_B("wu5DqBFA",!0)),Old_Hungarian:()=>new EB(_B("gkjCyBOyBIF",!0)),Old_Italic:()=>new EB(_B("g4gCjBKC",!0)),Old_North_Arabian:()=>new EB(_B("g0iCf",!0)),Old_Permic:()=>new EB(_B("w6gCqB",!0)),Old_Persian:()=>new EB(_B("g9gCjBFN",!0)),Old_Sogdian:()=>new EB(_B("g4jCnB",!0)),Old_South_Arabian:()=>new EB(_B("gziCf",!0)),Old_Turkic:()=>new EB(_B("ggjCoC",!0)),Old_Uyghur:()=>new EB(_B("w7jCZ",!0)),Oriya:()=>new EB(_B("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new EB(_B("wlhCjBFjB",!0)),Osmanya:()=>new EB(_B("gkhCdDJ",!0)),Pahawh_Hmong:()=>new EB(_B("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new EB(_B("gjiCf",!0)),Pau_Cin_Hau:()=>new EB(_B("g2mC4B",!0)),Phags_Pa:()=>new EB(_B("giqB3B",!0)),Phoenician:()=>new EB(_B("goiCbEA",!0)),Psalter_Pahlavi:()=>new EB(_B("g8iCRIDNG",!0)),Rejang:()=>new EB(_B("wpqBjBMA",!0)),Runic:()=>new EB(_B("g1FqCEK",!0)),Samaritan:()=>new EB(_B("ggCtBDO",!0)),Saurashtra:()=>new EB(_B("gkqBlCJL",!0)),Sharada:()=>new EB(_B("gskC-ChsCH",!0)),Shavian:()=>new EB(_B("wihCvB",!0)),Siddham:()=>new EB(_B("gslC1BDlB",!0)),Sidetic:()=>new EB(_B("gqiCZ",!0)),SignWriting:()=>new EB(_B("gg2DrUQECO",!0)),Sinhala:()=>new EB(_B("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new EB(_B("w5jCpB",!0)),Sora_Sompeng:()=>new EB(_B("wmkCYIJ",!0)),Soyombo:()=>new EB(_B("wymCyC",!0)),Sundanese:()=>new EB(_B("g8G-BhIH",!0)),Sunuwar:()=>new EB(_B("g+mChBPJ",!0)),Syloti_Nagri:()=>new EB(_B("ggqBsB",!0)),Syriac:()=>new EB(_B("g4BNC7BDCxIK",!0)),Tagalog:()=>new EB(_B("g4FVKA",!0)),Tagbanwa:()=>new EB(_B("g7FMCCCB",!0)),Tai_Le:()=>new EB(_B("wqGdDE",!0)),Tai_Tham:()=>new EB(_B("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new EB(_B("g0qBiCZE",!0)),Tai_Yo:()=>new EB(_B("g25DeCVJB",!0)),Takri:()=>new EB(_B("g0lC5BHJ",!0)),Tamil:()=>new EB(_B("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new EB(_B("wz6CuCCJ",!0)),Tangut:()=>new EB(_B("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new EB(_B("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new EB(_B("g8BxB",!0)),Thai:()=>new EB(_B("hwD5BGb",!0)),Tibetan:()=>new EB(_B("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new EB(_B("wpL3BIBPA",!0)),Tirhuta:()=>new EB(_B("gklCnCJJ",!0)),Todhri:()=>new EB(_B("guhCzB",!0)),Tolong_Siki:()=>new EB(_B("wtnCrBFJ",!0)),Toto:()=>new EB(_B("w04De",!0)),Tulu_Tigalari:()=>new EB(_B("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new EB(_B("g8gCdCA",!0)),Unknown:()=>new EB(_B("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new EB(_B("gopBrJ",!0)),Vithkuqi:()=>new EB(_B("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new EB(_B("g24D5BGA",!0)),Warang_Citi:()=>new EB(_B("glmCyCNA",!0)),Yezidi:()=>new EB(_B("g0jCpBCCDB",!0)),Yi:()=>new EB(_B("ggoBskBE2B",!0)),Zanabazar_Square:()=>new EB(_B("gwmCnC",!0))});static FOLD_CATEGORIES=new bB({L:()=>new EB(_B("laA",!0)),LC:()=>new EB(_B("laA",!0)),Ll:()=>new EB(_B("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Lt:()=>new EB(_B("kOCCBCCBCClBCCtsHHBJHBJHBMQQwBAB",!1)),Lu:()=>new EB(_B("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpL2B2Bs1CvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1)),M:()=>new EB(_B("5cgBgBlgHAB",!1)),Mn:()=>new EB(_B("5cgBgBlgHAB",!1)),Emoji:()=>new EB(_B("8mJA",!0)),Extended_Pictographic:()=>new EB(_B("8mJA",!0)),Lowercase:()=>new EB(_B("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHuBPBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Math:()=>new EB(_B("ycGDCHHFMMDDDCHHFAB",!1)),Uppercase:()=>new EB(_B("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpLiBiBBOBFsasaBYBn6BvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1))});static FOLD_SCRIPT=new bB({Common:()=>new EB(_B("8cgBgB",!1)),Greek:()=>new EB(_B("1FwUwU",!1)),Inherited:()=>new EB(_B("5cgBgBlgHAB",!1))})},IB=class e{static MAX_RUNE=1114111;static RUNE_ERROR=65533;static isUnsearchable(t){return t===e.RUNE_ERROR||t>=e.MIN_HIGH_SURROGATE&&t<=e.MAX_LOW_SURROGATE}static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static MIN_HIGH_SURROGATE=55296;static MAX_HIGH_SURROGATE=56319;static MIN_LOW_SURROGATE=56320;static MAX_LOW_SURROGATE=57343;static MIN_SUPPLEMENTARY_CODE_POINT=65536;static is32(e,t){let n=0,s=e.length;for(;n<s;){const r=n+Math.floor((s-n)/2),i=e.getLo(r),a=e.getHi(r);if(i<=t&&t<=a){return(t-i)%e.getStride(r)===0}t<i?s=r:n=r+1}return!1}static is(t,n){if(n<=e.MAX_LATIN1){for(let e=0;e<t.length;e++){if(n>t.getHi(e))continue;const s=t.getLo(e);if(n<s)return!1;return(n-s)%t.getStride(e)===0}return!1}return t.length>0&&n>=t.getLo(0)&&e.is32(t,n)}static isPrint(t){return t<=e.MAX_LATIN1?t>=32&&t<e.MAX_ASCII||t>=161&&173!==t:e.is(vB.Print,t)}static simpleFold(t){if(vB.CASE_ORBIT.has(t))return vB.CASE_ORBIT.get(t);if(t<=e.MAX_ASCII){const e=wB.toLowerCase(t);return e!==t?e:wB.toUpperCase(t)}return t}static equalsIgnoreCase(t,n){if(t===n)return!0;if(t<0||n<0)return!1;if(t<=e.MAX_ASCII&&n<=e.MAX_ASCII)return 65<=t&&t<=90&&(t|=32),65<=n&&n<=90&&(n|=32),t===n;for(let s=e.simpleFold(t);s!==t;s=e.simpleFold(s))if(s===n)return!0;return!1}};const TB=new Uint8Array(256);for(let e=0;e<256;e++)TB[e]=97<=e&&e<=122||65<=e&&e<=90||48<=e&&e<=57||95===e?1:0;let AB=null,OB=null;var SB=class e{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isByteArray(e){return Array.isArray(e)||"[object Uint8Array]"===Object.prototype.toString.call(e)}static isalnum(e){return wB.CODES[0]<=e&&e<=wB.CODES[9]||wB.CODES.a<=e&&e<=wB.CODES.z||wB.CODES.A<=e&&e<=wB.CODES.Z}static unhex(e){return wB.CODES[0]<=e&&e<=wB.CODES[9]?e-wB.CODES[0]:wB.CODES.a<=e&&e<=wB.CODES.f?e-wB.CODES.a+10:wB.CODES.A<=e&&e<=wB.CODES.F?e-wB.CODES.A+10:-1}static escapeRune(t){let n="";if(IB.isPrint(t))e.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case wB.CODES['"']:n+='\\"';break;case wB.CODES["\\"]:n+="\\\\";break;case wB.CODES["\t"]:n+="\\t";break;case wB.CODES["\n"]:n+="\\n";break;case wB.CODES["\r"]:n+="\\r";break;case wB.CODES["\b"]:n+="\\b";break;case wB.CODES["\f"]:n+="\\f";break;default:{let e=t.toString(16);t<256?(n+="\\x",1===e.length&&(n+="0"),n+=e):n+=`\\x{${e}}`;break}}return n}static stringToRunes(e){const t=String(e),n=[];let s=0;for(;s<t.length;){const e=t.codePointAt(s);n.push(e),s+=e>IB.MAX_BMP?2:1}return new Int32Array(n)}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return e<256&&1===TB[e]}static emptyOpContext(t,n){let s=0;return t<0&&(s|=e.EMPTY_BEGIN_TEXT|e.EMPTY_BEGIN_LINE),10===t&&(s|=e.EMPTY_BEGIN_LINE),n<0&&(s|=e.EMPTY_END_TEXT|e.EMPTY_END_LINE),10===n&&(s|=e.EMPTY_END_LINE),e.isWordRune(t)!==e.isWordRune(n)?s|=e.EMPTY_WORD_BOUNDARY:s|=e.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(t){return t.split("").map(t=>e.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>IB.MAX_BMP?2:1}static toArray(e){const t=e.length,n=new Array(t);for(let s=0;s<t;s++)n[s]=e[s];return n}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return AB||(AB=new TextEncoder),AB.encode(e);{let t=[],n=0;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):(64512&r)===IB.MIN_HIGH_SURROGATE&&s+1<e.length&&(64512&e.charCodeAt(s+1))===IB.MIN_LOW_SURROGATE?(r=IB.MIN_SUPPLEMENTARY_CODE_POINT+((1023&r)<<10)+(1023&e.charCodeAt(++s)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder){OB||(OB=new TextDecoder("utf-8"));const t=e instanceof Uint8Array?e:new Uint8Array(e);return OB.decode(t)}{let t=[],n=0,s=0;for(;n<e.length;){let r=e[n++];if(r<128)t[s++]=String.fromCharCode(r);else if(r>191&&r<224){let i=e[n++];t[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){let i=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-IB.MIN_SUPPLEMENTARY_CODE_POINT;t[s++]=String.fromCharCode(IB.MIN_HIGH_SURROGATE+(i>>10)),t[s++]=String.fromCharCode(IB.MIN_LOW_SURROGATE+(1023&i))}else{let i=e[n++],a=e[n++];t[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&a)}}return t.join("")}}};const NB=(e=[],t=0)=>{const n=Object.create(null);for(let s=0;s<e.length;s++){const r=e[s],i=t+s;n[r]=i,n[i]=r}return Object.freeze(n)};var RB=class e{static Encoding=NB(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},kB=class extends RB{constructor(e=null){super(),this.bytes=e}getEncoding(){return RB.Encoding.UTF_8}asCharSequence(){return SB.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},LB=class extends RB{constructor(e=null){super(),this.charSequence=e}getEncoding(){return RB.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return SB.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},xB=class{static utf16(e){return new LB(e)}static utf8(e){return SB.isByteArray(e)?new kB(e):new kB(SB.stringToUtf8ByteArray(e))}},FB=class{static EOF(){return-8}constructor(){this.start=0,this.end=0}canCheckPrefix(){return!0}endPos(){return this.end-this.start}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},PB=class e extends FB{static RUNE_ERROR_STEP=IB.RUNE_ERROR<<3|1;constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}hasString(e,t){const n=e.bytes;if(0===n.length)return!0;const s=this.indexOf(this.bytes,n,this.start+t);return-1!==s&&s<=this.end-n.length}hasAnyString(e,t){return e.automaton8().searchUTF8(this.bytes,this.start+t,this.end)}step(t){if((t+=this.start)>=this.end)return FB.EOF();const n=255&this.bytes[t];if(n<128)return n<<3|1;let s,r,i=128,a=191;if(n>=194&&n<=223)s=2,r=31&n;else if(n>=224&&n<=239)s=3,r=15&n,224===n?i=160:237===n&&(a=159);else{if(!(n>=240&&n<=244))return e.RUNE_ERROR_STEP;s=4,r=7&n,240===n?i=144:244===n&&(a=143)}if(t+s>this.end)return e.RUNE_ERROR_STEP;const o=255&this.bytes[t+1];if(o<i||o>a)return e.RUNE_ERROR_STEP;if(r=r<<6|63&o,s>2){const n=255&this.bytes[t+2];if(128!=(192&n))return e.RUNE_ERROR_STEP;if(r=r<<6|63&n,s>3){const n=255&this.bytes[t+3];if(128!=(192&n))return e.RUNE_ERROR_STEP;r=r<<6|63&n}}return r<<3|s}index(e,t){t+=this.start;const n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){let t=-1;if((e+=this.start)>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let s=e-4;for(s<this.start&&(s=this.start);n>=s&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start);const r=this.step(n-this.start);t=n+(7&r)===e?r>>3:IB.RUNE_ERROR}}const n=e<this.end?this.step(e-this.start)>>3:-1;return SB.emptyOpContext(t,n)}indexOf(e,t,n=0){let s=t.length;if(0===s)return n<=this.end?n:-1;const r=t[0];let i=this.end-s;const a="function"==typeof e.indexOf;let o=n;for(;o<=i;){if(a){if(o=e.indexOf(r,o),-1===o||o>i)return-1}else{for(;o<=i&&e[o]!==r;)o++;if(o>i)return-1}let n=!0;for(let r=1;r<s;r++)if(e[o+r]!==t[r]){n=!1;break}if(n)return o;o++}return-1}prefixLength(e){return e.prefixUTF8.length}},MB=class extends FB{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}hasString(e,t){const n=this.charSequence.indexOf(e.str,this.start+t);return-1!==n&&n<=this.end-e.str.length}hasAnyString(e,t){return e.automaton16().searchUTF16(this.charSequence,this.start+t,this.end)}step(e){if((e+=this.start)>=this.end)return FB.EOF();const t=this.charSequence.charCodeAt(e);if(t<IB.MIN_HIGH_SURROGATE||t>IB.MAX_HIGH_SURROGATE||e+1>=this.end)return t<<3|1;const n=this.charSequence.charCodeAt(e+1);return n>=IB.MIN_LOW_SURROGATE&&n<=IB.MAX_LOW_SURROGATE?1024*(t-IB.MIN_HIGH_SURROGATE)+(n-IB.MIN_LOW_SURROGATE)+IB.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:t<<3|1}index(e,t){t+=this.start;const n=this.charSequence.indexOf(e.prefix,t);return n<0||n>this.end-e.prefix.length?-1:n-t}context(e){const t=(e+=this.start)>this.start&&e<=this.end?this.charSequence.charCodeAt(e-1):-1,n=e<this.end?this.charSequence.charCodeAt(e):-1;return SB.emptyOpContext(t,n)}prefixLength(e){return e.prefix.length}},GB=class{static fromUTF8(e,t=0,n=e.length){return new PB(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new MB(e,t,n)}},UB=class extends Error{constructor(e){super(e),this.name="RE2JSException"}},HB=class extends UB{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},VB=class extends UB{constructor(e){super(e),this.name="RE2JSCompileException"}},jB=class extends UB{constructor(e){super(e),this.name="RE2JSGroupException"}},$B=class extends UB{constructor(e){super(e),this.name="RE2JSFlagsException"}},JB=class extends UB{constructor(e){super(e),this.name="RE2JSInternalException"}},qB=class e{static MAX_REPLACER_ARGS=65535;static quoteReplacement(e,t=!1){return t?e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(e=>{const t=e.codePointAt(0);return t===wB.CODES["\\"]||t===wB.CODES.$?`\\${e}`:e}).join(""):e.indexOf("$")<0?e:e.split("").map(e=>e.codePointAt(0)===wB.CODES.$?"$$":e).join("")}constructor(e,t){if(null===e)throw new Error("pattern is null");this.patternInput=e;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.hasNamedGroups=Object.keys(this.namedGroups).length>0,this.numberOfInstructions=n.numberOfInstructions(),this.lookbehindState=null,t instanceof RB?this.resetMatcherInput(t):SB.isByteArray(t)?this.resetMatcherInput(xB.utf8(t)):this.resetMatcherInput(xB.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(null===e)throw new Error("input is null");return e instanceof RB||(e=SB.isByteArray(e)?xB.utf8(e):xB.utf16(e)),this.matcherInput=e,null!==this.lookbehindState?this.lookbehindState.reset():this.lookbehindState=this.patternInput.re2().createLookbehindState(),this.reset(),this}start(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new jB(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new jB(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}programSize(){return this.numberOfInstructions}group(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new jB(`group '${e}' not found`);e=t}const t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}getNamedGroups(){if(!this.hasMatch)throw new jB("perhaps no match attempted");const e=Object.create(null);for(const t of Object.keys(this.namedGroups))e[t]=this.group(t);return e}groupCount(){return this.patternGroupCount}loadGroup(e){if(!Number.isInteger(e)||e<0||e>this.patternGroupCount)throw new jB(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new jB("perhaps no match attempted");if(0===e||this.hasGroups)return;const t=this.matcherInputLength,n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount,this.lookbehindState);if(!n[0])throw new jB("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,BB.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,BB.ANCHOR_START)}find(e=null){if(null!==e){if(!Number.isInteger(e)||e<0||e>this.matcherInputLength)throw new jB(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}if(e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1])){const t=(this.matcherInput.isUTF16Encoding()?GB.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):GB.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(e);t<0?e++:e+=7&t}return this.genMatch(e,BB.UNANCHORED)}genMatch(e,t){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1,this.lookbehindState);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=0===this.patternGroupCount,this.anchorFlag=t,!0):(this.hasMatch=!1,!1)}substring(e,t){return this.matcherInput.isUTF8Encoding()?SB.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n="";const s=this.start(),r=this.end();return this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r,n+=t?this.appendReplacementInternalJava(e):this.appendReplacementInternalJs(e),n}appendReplacementInternalJava(e){let t="",n=0;const s=e.length;let r=0;for(;r<s;){const i=e.codePointAt(r);if(i!==wB.CODES["\\"]){if(i===wB.CODES.$){if(n<r&&(t+=e.substring(n,r)),r+1>=s)throw new jB("Illegal group reference: group index is missing");const i=e.codePointAt(r+1);if(wB.CODES[0]<=i&&i<=wB.CODES[9]){let a=i-wB.CODES[0],o=r+2;for(;o<s;o++){const t=e.codePointAt(o);if(t<wB.CODES[0]||t>wB.CODES[9]||10*a+t-wB.CODES[0]>this.patternGroupCount)break;a=10*a+t-wB.CODES[0]}if(a>this.patternGroupCount)throw new jB(`n > number of groups: ${a}`);const B=this.group(a);null!==B&&(t+=B),r=o,n=r}else{if(i!==wB.CODES["{"])throw new jB("Illegal group reference");{let i=r+2;for(;i<s&&e.codePointAt(i)!==wB.CODES["}"];)i++;if(i>=s)throw new jB("named capture group is missing trailing '}'");const a=e.substring(r+2,i),o=this.group(a);null!==o&&(t+=o),r=i+1,n=r}}continue}r++}else{if(n<r&&(t+=e.substring(n,r)),r++,r>=s)throw new jB("character to be escaped is missing");n=r,r++}}return n<s&&(t+=e.substring(n,s)),t}appendReplacementInternalJs(e){const t=e=>e>=48&&e<=57,n=this.patternGroupCount;let s="",r=0;for(;r<e.length;){const i=e.indexOf("$",r);if(i<0)break;s+=e.substring(r,i),r=i;const a=e.charCodeAt(r+1);if(a===wB.CODES.$)s+="$",r+=2;else if(a===wB.CODES["&"])s+=this.group(0),r+=2;else if(a===wB.CODES["`"])s+=this.substring(0,this.start(0)),r+=2;else if(a===wB.CODES["'"])s+=this.substring(this.end(0),this.matcherInputLength),r+=2;else if(t(a)){let i=1,o=a-48;const B=e.charCodeAt(r+2);if(t(B)&&10*o+B-48<=n&&(i=2,o=10*o+B-48),o>=1&&o<=n){const e=this.group(o);null!==e&&(s+=e)}else s+=e.substring(r,r+1+i);r+=1+i}else if(a===wB.CODES["<"]&&this.hasNamedGroups){const t=e.indexOf(">",r+2);if(t<0)s+="$<",r+=2;else{const n=e.substring(r+2,t);if(Object.prototype.hasOwnProperty.call(this.namedGroups,n)){const e=this.group(n);null!==e&&(s+=e)}r=t+1}}else s+="$",r+=1}return s+e.substring(r)}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(t,n=!0,s=!1){let r="";this.reset();const i="function"==typeof t;let a=null;if(i){if(this.groupCount()>=e.MAX_REPLACER_ARGS)throw new jB("Too many capture groups to safely invoke replacer function");a=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(r+=i?this.appendReplacementFunc(t,a):this.appendReplacement(t,s),n););return r+=this.appendTail(),r}appendReplacementFunc(e,t){let n="";const s=this.start(),r=this.end();this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r;const i=this.matchArray();return i.push(s,t),this.hasNamedGroups&&i.push(this.namedGroupsObject()),n+=String(e(...i)),n}matchArray(){const e=[this.group(0)];for(let t=1;t<=this.patternGroupCount;t++){const n=this.group(t);e.push(null===n?void 0:n)}return e}namedGroupsObject(){if(!this.hasNamedGroups)return;const e=this.getNamedGroups();for(const t in e)null===e[t]&&(e[t]=void 0);return e}},zB=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static LB_WRITE=12;static LB_CHECK=13;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let n of e)t+=SB.escapeRune(n);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=new Int32Array(0),this.next=null}matchRune(e){if(1===this.runes.length){const t=this.runes[0];return 0!==(this.arg&BB.FOLD_CASE)?IB.equalsIgnoreCase(t,e):e===t}const t=this.runes.length;if(0===t)return!1;if(2===t||4===t||6===t||8===t){for(let n=0;n<t;n+=2){if(e<this.runes[n])return!1;if(e<=this.runes[n+1])return!0}return!1}let n=0,s=t>>1;for(;s>1;){const t=s>>1;n+=this.runes[n+t<<1]<=e?t:0,s-=t}n+=this.runes[n<<1]<=e?1:0;const r=n-1;return r>=0&&e<=this.runes[r<<1|1]}matchRunePos(e){if(1===this.runes.length){const t=this.runes[0];return 0!==(this.arg&BB.FOLD_CASE)?IB.equalsIgnoreCase(t,e)?0:-1:e===t?0:-1}const t=this.runes.length;if(0===t)return-1;if(2===t||4===t||6===t||8===t){for(let n=0;n<t;n+=2){if(e<this.runes[n])return-1;if(e<=this.runes[n+1])return Math.floor(n/2)}return-1}let n=0,s=t>>1;for(;s>1;){const t=s>>1;n+=this.runes[n+t<<1]<=e?t:0,s-=t}n+=this.runes[n<<1]<=e?1:0;const r=n-1;return r>=0&&e<=this.runes[r<<1|1]?r:-1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return"match"+(0!==this.arg?` ${this.arg}`:"");case e.FAIL:return"fail";case e.NOP:return`nop -> ${this.out}`;case e.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case e.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case e.RUNE:return null===this.runes?"rune <null>":["rune ",e.escapeRunes(this.runes),0!==(this.arg&BB.FOLD_CASE)?"/i":""," -> ",this.out].join("");case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},KB=class e{constructor(e){this.sparse=new Int32Array(e),this.densePcs=new Int32Array(e),this.denseCaps=null,this.size=0,this.ncap=0,this.mainThreads=0}static INITIAL_THREADS=32;init(t){this.ncap=t;const n=Math.min(this.densePcs.length,e.INITIAL_THREADS)*t;(!this.denseCaps||this.denseCaps.length<n)&&(this.denseCaps=new Int32Array(n))}growCaps(e){const t=this.densePcs.length*this.ncap,n=new Int32Array(Math.min(t,Math.max(e,2*this.denseCaps.length)));n.set(this.denseCaps),this.denseCaps=n}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return 0===this.size}add(e){const t=this.size++;return this.sparse[e]=t,this.densePcs[t]=e,t}clear(){this.size=0,this.mainThreads=0}toString(){let e="{";for(let t=0;t<this.size;t++)0!==t&&(e+=", "),e+=this.densePcs[t];return e+="}",e}},QB=class{constructor(e){this.pos=-1,this.pcs=new Int32Array(e.numInst()),this.size=0,this.lbTable=new Int32Array(e.numLb+1)}reset(){this.pos=-1,this.size=0}},WB=class e{static fromRE2(t){const n=new e;return n.prog=t.prog,n.re2=t,n.q0=new KB(n.prog.numInst()),n.q1=new KB(n.prog.numInst()),n.addStack=new Int32Array(2*(n.prog.numInst()+1)),n.matched=!1,n.matchcap=new Int32Array(n.prog.numCap<2?2:n.prog.numCap),n.ncap=0,n}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.addStack=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(e){this.ncap=e,e>this.matchcap.length?this.matchcap=new Int32Array(e).fill(-1):this.matchcap.fill(-1),this.q0.init(e),this.q1.init(e),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return 0===this.ncap?SB.emptyInts():SB.toArray(this.matchcap.subarray(0,this.ncap))}match(e,t,n,s=null){const r=this.re2.cond;if(r===SB.EMPTY_ALL)return!1;if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==t)return!1;this.matched=!1,this.matchcap.fill(-1);const i=this.prog.numLb>0,a=t;let o=t,B=!1;i&&(null!==s&&s.pos>=0&&s.pos<=t?(o=s.pos,B=!0):o=0);let c,l=i&&null!==s,u=this.q0,h=this.q1,p=e.step(o),d=p>>3,f=7&p,C=-1,g=0;for(p!==FB.EOF()&&(p=e.step(o+f),C=p>>3,g=7&p),c=0===o?SB.emptyOpContext(-1,d):e.context(o),i&&(B?this.restoreLookbehinds(s,u,c):this.spawnLookbehinds(u,o,c));;){if(0===u.mainThreads){if(0!==(r&SB.EMPTY_BEGIN_TEXT)&&0!==o)break;if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==o)break;if(this.matched)break;if(0===this.prog.numLb&&u.isEmpty()&&0!==this.re2.prefix.length&&C!==this.re2.prefixRune&&e.canCheckPrefix()){const t=e.index(this.re2,o);if(t<0)break;o+=t,p=e.step(o),d=p>>3,f=7&p,p=e.step(o+f),C=p>>3,g=7&p,c=e.context(o)}}o>=a&&(l&&(this.saveLookbehinds(s,u,o),l=!1),this.matched||0!==o&&n!==BB.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=o),this.add(u,this.prog.start,o,this.matchcap,0,c)));const t=o+f;if(c=e.context(t),this.step(u,h,o,t,d,c,n,o===e.endPos()),0===f)break;if(0===this.ncap&&this.matched)break;o+=f,d=C,f=g,-1!==d&&(p=e.step(o+f),C=p>>3,g=7&p);const i=u;u=h,h=i}return u.clear(),h.clear(),this.matched}matchSet(e,t,n){const s=this.re2.cond;if(s===SB.EMPTY_ALL)return[];if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==t)return[];let r=this.prog.numLb>0?0:t,i=t,a=this.q0,o=this.q1,B=e.step(r),c=B>>3,l=7&B,u=-1,h=0;B!==FB.EOF()&&(B=e.step(r+l),u=B>>3,h=7&B);let p=0===r?SB.emptyOpContext(-1,c):e.context(r);const d=new Set;for(this.prog.numLb>0&&this.spawnLookbehinds(a,r,p);;){if(0===a.mainThreads){if(0!==(s&SB.EMPTY_BEGIN_TEXT)&&0!==r)break;if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==r)break}0!==r&&n!==BB.UNANCHORED||r>=i&&this.add(a,this.prog.start,r,this.matchcap,0,p);const t=r+l;p=e.context(t);for(let s=0;s<a.size;s++){const i=a.densePcs[s],B=this.prog.inst[i],l=s*this.ncap;let u=!1;switch(B.op){case zB.MATCH:if(n===BB.ANCHOR_BOTH&&r!==e.endPos())break;d.add(B.arg);break;case zB.RUNE:u=B.matchRune(c);break;case zB.RUNE1:u=c===B.runes[0];break;case zB.RUNE_ANY:u=!0;break;case zB.RUNE_ANY_NOT_NL:u=10!==c;break;default:continue}u&&this.add(o,B.out,t,a.denseCaps,l,p)}if(a.clear(),0===l)break;r+=l,c=u,l=h,-1!==c&&(B=e.step(r+l),u=B>>3,h=7&B);const f=a;a=o,o=f}return o.clear(),Array.from(d).sort((e,t)=>e-t)}step(e,t,n,s,r,i,a,o){const B=this.re2.longest;for(let c=0;c<e.size;c++){const l=e.densePcs[c],u=c*this.ncap;if(B&&this.matched&&this.ncap>0&&this.matchcap[0]<e.denseCaps[u])continue;const h=this.prog.inst[l];let p=!1;switch(h.op){case zB.MATCH:if(a===BB.ANCHOR_BOTH&&!o)break;if(this.ncap>0&&(!B||!this.matched||this.matchcap[1]<n)){e.denseCaps[u+1]=n;for(let t=0;t<this.ncap;t++)this.matchcap[t]=e.denseCaps[u+t]}B||(e.size=0),this.matched=!0;break;case zB.RUNE:p=h.matchRune(r);break;case zB.RUNE1:p=r===h.runes[0];break;case zB.RUNE_ANY:p=!0;break;case zB.RUNE_ANY_NOT_NL:p=10!==r;break;default:continue}p&&this.add(t,h.out,s,e.denseCaps,u,i)}e.clear()}spawnLookbehinds(e,t,n){for(let s=0;s<this.prog.lbStarts.length;s++)this.add(e,this.prog.lbStarts[s],t,this.matchcap,0,n)}restoreLookbehinds(e,t,n){this.lbTable.set(e.lbTable);for(let s=0;s<e.size;s++)this.add(t,e.pcs[s],e.pos,this.matchcap,0,n)}saveLookbehinds(e,t,n){let s=0;for(let n=0;n<t.size;n++){const r=t.densePcs[n];1===this.prog.lbInst[r]&&zB.isRuneOp(this.prog.inst[r].op)&&(e.pcs[s++]=r)}e.size=s,e.pos=n,e.lbTable.set(this.lbTable)}add(e,t,n,s,r,i){const a=this.addStack;let o=0;for(;;){for(;0!==t&&!e.contains(t);){const B=e.add(t),c=this.prog.inst[t];switch(c.op){case zB.FAIL:t=0;break;case zB.ALT:case zB.ALT_MATCH:a[o++]=c.arg,a[o++]=0,t=c.out;break;case zB.EMPTY_WIDTH:t=0===(c.arg&~i)?c.out:0;break;case zB.NOP:t=c.out;break;case zB.CAPTURE:c.arg<this.ncap&&(a[o++]=-c.arg-1,a[o++]=s[r+c.arg],s[r+c.arg]=n),t=c.out;break;case zB.LB_WRITE:this.lbTable[Math.abs(c.arg)]=n,t=c.out;break;case zB.LB_CHECK:t=c.arg>0?this.lbTable[c.arg]===n?c.out:0:this.lbTable[-c.arg]!==n?c.out:0;break;case zB.MATCH:case zB.RUNE:case zB.RUNE1:case zB.RUNE_ANY:case zB.RUNE_ANY_NOT_NL:if(0===this.prog.lbInst[t]&&e.mainThreads++,this.ncap>0){const t=B*this.ncap;t+this.ncap>e.denseCaps.length&&e.growCaps(t+this.ncap);for(let n=0;n<this.ncap;n++)e.denseCaps[t+n]=s[r+n]}t=0;break;default:throw new JB("unhandled")}}if(0===o)return;o-=2;const B=a[o];B<0?(s[r-B-1]=a[o+1],t=0):t=B}}};const YB=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},XB=(e,t,n,s)=>e.flag===n&&YB(e.nfaStates,t)&&YB(e.matchIDs,s),ZB=[];var ec=class{constructor(e,t,n){this.nfaStates=e,this.flag=t,this.isMatch=0!==(t&tc.FLAG_MATCH),this.matchIDs=n,this.next=null,this.nextAnchored=null}},tc=class e{static FLAG_EMPTY_MASK=255;static FLAG_MATCH=256;static FLAG_LAST_WORD=512;static FLAG_NEED_SHIFT=16;static STATE_OVERHEAD=150;static ARRAY_OVERHEAD=40;static ELEMENT_SIZE=8;static TABLE_OVERHEAD=48;static PROGRESS_PER_STATE=10;constructor(e,t=8388608){this.prog=e,this.maxMem=t,this.stateCache=new Map,this.stateCount=0,this.startStates=new Map,this.failed=!1;for(let t=0;t<e.numInst();t++){const n=e.getInst(t).op;if(n===zB.LB_WRITE||n===zB.LB_CHECK){this.failed=!0;break}}this.computeRuneClasses(),this.stateBudget=t,this.memBudget=t}computeRuneClasses(){const e=new Set,t=(t,n)=>{e.add(t),e.add(n+1)};for(let e=0;e<this.prog.numInst();e++){const n=this.prog.getInst(e);switch(n.op){case zB.RUNE:case zB.RUNE1:if(1===n.runes.length){if(t(n.runes[0],n.runes[0]),0!==(n.arg&BB.FOLD_CASE))for(let e=IB.simpleFold(n.runes[0]);e!==n.runes[0];e=IB.simpleFold(e))t(e,e)}else for(let e=0;e<n.runes.length;e+=2)t(n.runes[e],n.runes[e+1]);break;case zB.RUNE_ANY_NOT_NL:t(10,10);break;case zB.EMPTY_WIDTH:0!==(n.arg&(SB.EMPTY_BEGIN_LINE|SB.EMPTY_END_LINE))&&t(10,10),0!==(n.arg&(SB.EMPTY_WORD_BOUNDARY|SB.EMPTY_NO_WORD_BOUNDARY))&&(t(48,57),t(65,90),t(95,95),t(97,122))}}e.delete(0),this.classBounds=Int32Array.from(e).sort(),this.numClasses=this.classBounds.length+1;const n=new Int32Array(IB.MAX_LATIN1+1);for(let e=0;e<=IB.MAX_LATIN1;e++)n[e]=this.searchClass(e);this.latin1Class=n}runeClass(e){return e<=IB.MAX_LATIN1?this.latin1Class[e]:this.searchClass(e)}searchClass(e){const t=this.classBounds;let n=0,s=t.length;for(;n<s;){const r=n+s>>1;t[r]<=e?n=r+1:s=r}return n}closure(e,t){const n=new Set,s=Array.from(e);let r=0;for(;s.length>0;){const e=s.pop();if(0===e||n.has(e))continue;n.add(e);const i=this.prog.getInst(e);switch(i.op){case zB.ALT:case zB.ALT_MATCH:s.push(i.out),s.push(i.arg);break;case zB.NOP:case zB.CAPTURE:s.push(i.out);break;case zB.EMPTY_WIDTH:r|=i.arg,0===(i.arg&~t)&&s.push(i.out)}}return{pcs:Array.from(n).sort((e,t)=>e-t),needflags:r}}getState(t,n,s){const r=((e,t,n)=>{let s=-2128831035;for(let t=0;t<e.length;t++)s^=e[t],s=Math.imul(s,16777619);s^=t,s=Math.imul(s,16777619);for(let e=0;e<n.length;e++)s^=n[e],s=Math.imul(s,16777619);return s})(t,n,s),i=this.stateCache.get(r);if(i instanceof ec){if(XB(i,t,n,s))return i}else if(void 0!==i)for(let e=0;e<i.length;e++)if(XB(i[e],t,n,s))return i[e];const a=e.stateCost(t,s);if(this.memBudget<a)return null;this.memBudget-=a;const o=new ec(t,n,s);return void 0===i?this.stateCache.set(r,o):i instanceof ec?this.stateCache.set(r,[i,o]):i.push(o),this.stateCount++,o}static stateCost(t,n){const s=0===n.length?0:e.ARRAY_OVERHEAD+e.ELEMENT_SIZE*n.length;return e.STATE_OVERHEAD+e.ELEMENT_SIZE*t.length+s}*cachedStates(){for(const e of this.stateCache.values())e instanceof ec?yield e:yield*e}makeState(t,n,s){const r=this.closure(t,n&e.FLAG_EMPTY_MASK);let i=n;return 0===r.needflags&&(i&=e.FLAG_MATCH),i|=r.needflags<<e.FLAG_NEED_SHIFT,this.getState(r.pcs,i,s)}allocTable(t,n){const s=this.numClasses+1,r=e.TABLE_OVERHEAD+e.ELEMENT_SIZE*s;if(this.memBudget<r)return null;this.memBudget-=r;const i=new Array(s).fill(null);return n===BB.UNANCHORED?t.next=i:t.nextAnchored=i,i}clearCache(){this.stateCache.clear(),this.stateCount=0,this.startStates.clear(),this.memBudget=this.stateBudget}resetCache(e){return this.clearCache(),this.getState(e.nfaStates,e.flag,e.matchIDs)}step(t,n,s,r){let i=r===BB.UNANCHORED?t.next:t.nextAnchored;if(null!==i){const e=i[n];if(null!==e)return e}else if(i=this.allocTable(t,r),null===i)return null;const a=t.flag>>>e.FLAG_NEED_SHIFT,o=t.flag&e.FLAG_EMPTY_MASK;let B=o,c=0;10===s&&(B|=SB.EMPTY_END_LINE,c|=SB.EMPTY_BEGIN_LINE),-1===s&&(B|=SB.EMPTY_END_LINE|SB.EMPTY_END_TEXT);const l=0!==(t.flag&e.FLAG_LAST_WORD),u=-1!==s&&SB.isWordRune(s);B|=u===l?SB.EMPTY_NO_WORD_BOUNDARY:SB.EMPTY_WORD_BOUNDARY;let h=t.nfaStates;0!==(B&~o&a)&&(h=this.closure(h,B).pcs);const p=[];let d=!1,f=ZB;for(let e=0;e<h.length;e++){const t=this.prog.getInst(h[e]);t.op===zB.MATCH?(d||(d=!0,f=[]),f.push(t.arg)):-1!==s&&zB.isRuneOp(t.op)&&t.matchRune(s)&&p.push(t.out)}f.length>1&&f.sort((e,t)=>e-t),r===BB.UNANCHORED&&-1!==s&&p.push(this.prog.start);let C=c;d&&(C|=e.FLAG_MATCH),u&&(C|=e.FLAG_LAST_WORD);const g=this.makeState(p,C,f);return null===g?null:(i[n]=g,g)}start(t,n){const s=t.context(n);let r;if(0!==(s&SB.EMPTY_BEGIN_TEXT))r=SB.EMPTY_BEGIN_TEXT|SB.EMPTY_BEGIN_LINE;else if(0!==(s&SB.EMPTY_BEGIN_LINE))r=SB.EMPTY_BEGIN_LINE;else{const i=t.step(n),a=i>=0&&SB.isWordRune(i>>3);r=0!==(s&SB.EMPTY_WORD_BOUNDARY)!==a?e.FLAG_LAST_WORD:0}let i=this.startStates.get(r);if(void 0===i){if(i=this.makeState([this.prog.start],r,ZB),null===i&&(this.clearCache(),i=this.makeState([this.prog.start],r,ZB),null===i))return null;this.startStates.set(r,i)}return i}stepOrReset(t,n,s,r,i,a){let o=this.step(t,n,s,r);if(null!==o)return o;if(a.resetPos>=0&&i-a.resetPos<e.PROGRESS_PER_STATE*this.stateCount)return null;a.resetPos=i;const B=this.resetCache(t);return null===B?null:(o=this.step(B,n,s,r),o)}run(e,t,n,s,r){const i=e.endPos(),a=this.latin1Class,o=n===BB.UNANCHORED,B={resetPos:-1};let c=t;for(;c<i;){const t=e.step(c),i=t>>3,l=7&t;if(0===l)break;const u=i<=IB.MAX_LATIN1?a[i]:this.runeClass(i);let h=o&&null!==s.next?s.next[u]:null;if(null===h&&(h=this.stepOrReset(s,u,i,n,c,B),null===h))return null;if((s=h).isMatch&&r(s,!1))return!0;if(!o&&0===s.nfaStates.length)return!1;c+=l}return null===(s=this.stepOrReset(s,this.numClasses,-1,n,c,B))?null:s.isMatch&&r(s,!0)}match(e,t,n){if(this.failed)return null;if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==t)return!1;const s=this.start(e,t);return null===s?null:this.run(e,t,n,s,(e,t)=>n!==BB.ANCHOR_BOTH||t)}matchSet(e,t,n){if(this.failed)return null;if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==t)return[];const s=this.start(e,t);if(null===s)return null;const r=new Set;return null===this.run(e,t,n,s,(e,t)=>{if(n!==BB.ANCHOR_BOTH||t)for(let t=0;t<e.matchIDs.length;t++)r.add(e.matchIDs[t]);return!1})?null:Array.from(r).sort((e,t)=>e-t)}};var nc=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(256),this.jobArg=new Uint8Array(256),this.jobPos=new Int32Array(256),this.jobLen=0,this.visited=new Uint32Array(0)}reset(e,t,n){this.end=t,this.jobLen=0,this.ncap=n;const s=e.numInst()*(t+1)+32-1>>>5;this.visited.length<s?this.visited=new Uint32Array(s):this.visited.fill(0,0,s),this.cap.length<n?this.cap=new Int32Array(n).fill(-1):this.cap.fill(-1,0,n),this.matchcap.length<n?this.matchcap=new Int32Array(n).fill(-1):this.matchcap.fill(-1,0,n)}shouldVisit(e,t){const n=e*(this.end+1)+t,s=n>>>5,r=1<<(31&n);return 0===(this.visited[s]&r)&&(this.visited[s]|=r,!0)}push(e,t,n,s){if(e.prog.getInst(t).op!==zB.FAIL&&(s||this.shouldVisit(t,n))){if(this.jobLen>=this.jobPc.length){const e=2*this.jobPc.length,t=new Int32Array(e);t.set(this.jobPc),this.jobPc=t;const n=new Uint8Array(e);n.set(this.jobArg),this.jobArg=n;const s=new Int32Array(e);s.set(this.jobPos),this.jobPos=s}this.jobPc[this.jobLen]=t,this.jobArg[this.jobLen]=s?1:0,this.jobPos[this.jobLen]=n,this.jobLen++}}tryBacktrack(e,t,n,s,r){const i=e.longest;for(this.push(e,n,s,!1);this.jobLen>0;){this.jobLen--;let n=this.jobPc[this.jobLen],s=1===this.jobArg[this.jobLen],a=this.jobPos[this.jobLen],o=!0;for(;o||this.shouldVisit(n,a);){o=!1;const B=e.prog.getInst(n);switch(B.op){case zB.FAIL:break;case zB.ALT:if(s){s=!1,n=B.arg;continue}this.push(e,n,a,!0),n=B.out;continue;case zB.ALT_MATCH:{const t=e.prog.getInst(B.out);if(zB.isRuneOp(t.op)){this.push(e,B.arg,a,!1),n=B.arg,a=this.end;continue}this.push(e,B.out,this.end,!1),n=B.out;continue}case zB.RUNE:{const e=t.step(a);if(e===FB.EOF())break;if(!B.matchRune(e>>3))break;a+=7&e,n=B.out;continue}case zB.RUNE1:{const e=t.step(a);if(e===FB.EOF())break;if(e>>3!==B.runes[0])break;a+=7&e,n=B.out;continue}case zB.RUNE_ANY_NOT_NL:{const e=t.step(a);if(e===FB.EOF())break;if(e>>3==10)break;a+=7&e,n=B.out;continue}case zB.RUNE_ANY:{const e=t.step(a);if(e===FB.EOF())break;a+=7&e,n=B.out;continue}case zB.CAPTURE:if(s){this.cap[B.arg]=a;break}B.arg<this.ncap&&(this.push(e,n,this.cap[B.arg],!0),this.cap[B.arg]=a),n=B.out;continue;case zB.EMPTY_WIDTH:{const e=t.context(a);if(0!==(B.arg&~e))break;n=B.out;continue}case zB.NOP:n=B.out;continue;case zB.MATCH:{if(r===BB.ANCHOR_BOTH&&a!==this.end)break;if(0===this.ncap)return!0;this.ncap>1&&(this.cap[1]=a);const e=this.matchcap[1];if((-1===e||i&&a>0&&a>e)&&this.matchcap.set(this.cap),!i)return!0;if(a===this.end)return!0;break}case zB.LB_WRITE:case zB.LB_CHECK:throw new JB("Backtracker cannot evaluate Lookbehind instructions");default:throw new JB("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}};const sc=[];var rc=class e{static shouldBacktrack(e){return e.numInst()<=500}static maxBitStateLen(t){return e.shouldBacktrack(t)?Math.floor(262144/t.numInst()):0}static execute(e,t,n,s,r){const i=e.cond;if(i===SB.EMPTY_ALL)return null;if((s===BB.ANCHOR_START||s===BB.ANCHOR_BOTH)&&0!==n)return null;if(0!==(i&SB.EMPTY_BEGIN_TEXT)&&0!==n)return null;const a=sc.length>0?sc.pop():new nc,o=t.endPos();a.reset(e.prog,o,r);let B=!1;if(0!==(i&SB.EMPTY_BEGIN_TEXT)||s===BB.ANCHOR_START||s===BB.ANCHOR_BOTH)a.ncap>0&&(a.cap[0]=n),a.tryBacktrack(e,t,e.prog.start,n,s)&&(B=!0);else{let r=-1;for(;n<=o&&0!==r;n+=r){if(e.prefix.length>0){const s=t.index(e,n);if(s<0)break;n+=s}if(a.ncap>0&&(a.cap[0]=n),a.tryBacktrack(e,t,e.prog.start,n,s)){B=!0;break}const i=t.step(n);r=i===FB.EOF()?0:7&i}}if(!B)return sc.push(a),null;const c=0===r?[]:SB.toArray(a.matchcap.subarray(0,r));return sc.push(a),c}},ic=class{constructor(e){this.sparse=new Uint32Array(e),this.dense=new Uint32Array(e),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(e){return e<this.sparse.length&&this.sparse[e]<this.size&&this.dense[this.sparse[e]]===e}insert(e){this.contains(e)||this.insertNew(e)}insertNew(e){e>=this.sparse.length||(this.sparse[e]=this.size,this.dense[this.size]=e,this.size++)}};var ac=class{constructor(e){this.start=e.start,this.numCap=e.numCap,this.inst=new Array(e.inst.length);for(let t=0;t<e.inst.length;t++){const n=e.inst[t],s=new zB(n.op);s.out=n.out,s.arg=n.arg,s.runes=n.runes?new Int32Array(n.runes):new Int32Array(0),s.next=null,this.inst[t]=s}}};var oc=class e{static compile(e){if(0===e.start)return null;if(e.numLb>0)return null;const t=e.inst[e.start];if(t.op!==zB.EMPTY_WIDTH||0===(t.arg&SB.EMPTY_BEGIN_TEXT))return null;let n=!1;for(let t=0;t<e.inst.length;t++)if(e.inst[t].op===zB.ALT||e.inst[t].op===zB.ALT_MATCH){n=!0;break}for(let t=0;t<e.inst.length;t++){const s=e.inst[t],r=e.inst[s.out].op;switch(s.op){case zB.ALT:case zB.ALT_MATCH:if(r===zB.MATCH||e.inst[s.arg].op===zB.MATCH)return null;break;case zB.EMPTY_WIDTH:if(r===zB.MATCH){if((s.arg&SB.EMPTY_END_TEXT)===SB.EMPTY_END_TEXT)continue;return null}break;default:if(r===zB.MATCH&&n)return null}}let s=(e=>{const t=new ac(e);for(let e=0;e<t.inst.length;e++){const n=t.inst[e];if(n.op!==zB.ALT&&n.op!==zB.ALT_MATCH)continue;let s="out",r="arg",i=t.inst[n[r]];if(i.op!==zB.ALT&&i.op!==zB.ALT_MATCH&&(s="arg",r="out",i=t.inst[n[r]],i.op!==zB.ALT&&i.op!==zB.ALT_MATCH))continue;const a=t.inst[n[s]];if(a.op===zB.ALT||a.op===zB.ALT_MATCH)continue;let o="out",B="arg",c=!1;i.out===e?c=!0:i.arg===e&&(c=!0,o="arg",B="out"),c&&(i[o]=n[s]),n[s]===i[o]&&(n[r]=i[B])}return t})(e);return s=(e=>{if(e.inst.length>=1e3)return null;const t=new ic(e.inst.length),n=new ic(e.inst.length),s=new Array(e.inst.length),r=new Array(e.inst.length).fill(!1),i=a=>{let o=!0;const B=e.inst[a];if(n.contains(a))return!0;switch(n.insert(a),B.op){case zB.ALT:case zB.ALT_MATCH:{o=i(B.out)&&i(B.arg);let e=r[B.out],t=r[B.arg];if(e&&t)return!1;if(t){const n=B.out;B.out=B.arg,B.arg=n;const s=e;e=t,t=s}e&&(r[a]=!0,B.op=zB.ALT_MATCH);const n=((e,t,n,s)=>{const r=e.length,i=t.length;let a=0,o=0;const B=[],c=[];let l=!0,u=-1;const h=r=>{const i=r?e:t,l=r?a:o,h=r?n:s;return!(u>0&&i[l]<=B[u]||(B.push(i[l],i[l+1]),r?a+=2:o+=2,u+=2,c.push(h),0))};for(;a<r||o<i;)if(l=o>=i?h(!0):a>=r||t[o]<e[a]?h(!1):h(!0),!l)return null;return{merged:B,next:c}})(s[B.out]||[],s[B.arg]||[],B.out,B.arg);if(!n)return!1;s[a]=new Int32Array(n.merged),B.next=new Uint32Array(n.next);break}case zB.CAPTURE:case zB.EMPTY_WIDTH:case zB.NOP:o=i(B.out),r[a]=r[B.out],s[a]=s[B.out]?new Int32Array(s[B.out]):new Int32Array(0),B.next=new Uint32Array(Math.floor(s[a].length/2)+1).fill(B.out);break;case zB.MATCH:case zB.FAIL:r[a]=B.op===zB.MATCH;break;case zB.RUNE:{if(r[a]=!1,B.next&&B.next.length>0)break;if(t.insert(B.out),!B.runes||0===B.runes.length){s[a]=new Int32Array(0),B.next=new Uint32Array([B.out]);break}let e=[];if(1===B.runes.length&&0!==(B.arg&BB.FOLD_CASE)){const t=B.runes[0];e.push(t,t);for(let n=IB.simpleFold(t);n!==t;n=IB.simpleFold(n))e.push(n,n);e.sort((e,t)=>e-t)}else for(let t=0;t<B.runes.length;t++)e.push(B.runes[t]);s[a]=new Int32Array(e),B.next=new Uint32Array(Math.floor(e.length/2)+1).fill(B.out),B.op=zB.RUNE;break}case zB.RUNE1:{if(r[a]=!1,B.next&&B.next.length>0)break;t.insert(B.out);let e=[];if(0!==(B.arg&BB.FOLD_CASE)){const t=B.runes[0];e.push(t,t);for(let n=IB.simpleFold(t);n!==t;n=IB.simpleFold(n))e.push(n,n);e.sort((e,t)=>e-t)}else e.push(B.runes[0],B.runes[0]);s[a]=new Int32Array(e),B.next=new Uint32Array(Math.floor(e.length/2)+1).fill(B.out),B.op=zB.RUNE;break}case zB.RUNE_ANY:if(r[a]=!1,B.next&&B.next.length>0)break;t.insert(B.out),s[a]=new Int32Array([0,IB.MAX_RUNE]),B.next=new Uint32Array([B.out]);break;case zB.RUNE_ANY_NOT_NL:if(r[a]=!1,B.next&&B.next.length>0)break;t.insert(B.out),s[a]=new Int32Array([0,9,11,IB.MAX_RUNE]),B.next=new Uint32Array(Math.floor(s[a].length/2)+1).fill(B.out)}return o};for(t.clear(),t.insert(e.start);!t.empty();)if(n.clear(),!i(t.next()))return null;for(let t=0;t<e.inst.length;t++)s[t]&&(e.inst[t].runes=s[t]);return e})(s),null!==s&&((e,t)=>{for(let n=0;n<t.inst.length;n++){const s=t.inst[n];switch(s.op){case zB.ALT:case zB.ALT_MATCH:case zB.RUNE:break;case zB.CAPTURE:case zB.EMPTY_WIDTH:case zB.NOP:case zB.MATCH:case zB.FAIL:e.inst[n].next=null;break;case zB.RUNE1:case zB.RUNE_ANY:case zB.RUNE_ANY_NOT_NL:e.inst[n].next=null,e.inst[n].op=s.op,e.inst[n].runes=s.runes?new Int32Array(s.runes):new Int32Array(0)}}})(s,e),s}static next(e,t){const n=e.matchRunePos(t);return n>=0?e.next[n]:e.op===zB.ALT_MATCH?e.out:0}static execute(t,n,s,r,i){const a=t.onepass;if(!a)return null;const o=new Int32Array(i).fill(-1);let B=!1,c=n.step(s),l=c>>3,u=7&c,h=FB.EOF(),p=-1,d=0;c!==FB.EOF()&&(h=n.step(s+u),h!==FB.EOF()&&(p=h>>3,d=7&h));let f,C=0===s?SB.emptyOpContext(-1,l):n.context(s),g=a.start;for(;;){switch(f=a.inst[g],g=f.out,f.op){case zB.MATCH:return r===BB.ANCHOR_BOTH&&s!==n.endPos()?null:(B=!0,o.length>0&&(o[0]=0,o[1]=s),0===i?[]:SB.toArray(o));case zB.RUNE:if(!f.matchRune(l))return null;break;case zB.RUNE1:if(l!==f.runes[0])return null;break;case zB.RUNE_ANY:break;case zB.RUNE_ANY_NOT_NL:if(10===l)return null;break;case zB.ALT:case zB.ALT_MATCH:g=e.next(f,l);continue;case zB.FAIL:return null;case zB.NOP:continue;case zB.EMPTY_WIDTH:if(0!==(f.arg&~C))return null;continue;case zB.CAPTURE:f.arg<o.length&&(o[f.arg]=s);continue;default:throw new JB("bad inst")}if(0===u)break;C=SB.emptyOpContext(l,p),s+=u,l=p,u=d,-1!==l&&(h=n.step(s+u),h!==FB.EOF()?(p=h>>3,d=7&h):(p=-1,d=0))}return B?0===i?[]:SB.toArray(o):null}},Bc=class e{static Op=NB(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===wB.CODES["-"]?"\\":""}static fromRegexp(t){const n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n.lb=t.lb,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=new Int32Array(0),this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=new Int32Array(0),this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case e.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case e.Op.EMPTY_MATCH:t+="(?:)";break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{const n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+="*";break;case e.Op.PLUS:t+="+";break;case e.Op.QUEST:t+="?";break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}"}0!==(this.flags&BB.NON_GREEDY)&&(t+="?");break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e="";for(let n of this.subs)t+=e,e="|",t+=n.appendTo();break}case e.Op.LITERAL:0!==(this.flags&BB.FOLD_CASE)&&(t+="(?i:");for(let e of this.runes)t+=SB.escapeRune(e);0!==(this.flags&BB.FOLD_CASE)&&(t+=")");break;case e.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case e.Op.ANY_CHAR:t+="(?s:.)";break;case e.Op.PLB:t+=`(?<=${this.subs[0].appendTo()})`;break;case e.Op.NLB:t+=`(?<!${this.subs[0].appendTo()})`;break;case e.Op.CAPTURE:null===this.name||0===this.name.length?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case e.Op.BEGIN_TEXT:t+="\\A";break;case e.Op.END_TEXT:0!==(this.flags&BB.WAS_DOLLAR)?t+="(?-m:$)":t+="\\z";break;case e.Op.BEGIN_LINE:t+="^";break;case e.Op.END_LINE:t+="$";break;case e.Op.WORD_BOUNDARY:t+="\\b";break;case e.Op.NO_WORD_BOUNDARY:t+="\\B";break;case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+="[invalid char class]";break}if(t+="[",0===this.runes.length)t+="^\\x00-\\x{10FFFF}";else if(0===this.runes[0]&&this.runes[this.runes.length-1]===IB.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){const s=this.runes[n]+1,r=this.runes[n+1]-1;t+=e.quoteIfHyphen(s),t+=SB.escapeRune(s),s!==r&&(t+="-",t+=e.quoteIfHyphen(r),t+=SB.escapeRune(r))}}else for(let n=0;n<this.runes.length;n+=2){const s=this.runes[n],r=this.runes[n+1];t+=e.quoteIfHyphen(s),t+=SB.escapeRune(s),s!==r&&(t+="-",t+=e.quoteIfHyphen(r),t+=SB.escapeRune(r))}t+="]";break;default:t+=this.op}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),null!==this.subs)for(let e of this.subs){const n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(null!==t&&t instanceof e))return!1;if(this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&BB.WAS_DOLLAR)!==(t.flags&BB.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if((this.flags&BB.FOLD_CASE)!==(t.flags&BB.FOLD_CASE))return!1;if(null===this.runes&&null===t.runes)break;if(null===this.runes||null===t.runes)return!1;if(this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&BB.NON_GREEDY)!==(t.flags&BB.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&BB.NON_GREEDY)!==(t.flags&BB.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(null===this.name?null!==t.name:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.PLB:case e.Op.NLB:if(this.lb!==t.lb||!this.subs[0].equals(t.subs[0]))return!1}return!0}},cc=class{static walk(e,t){const n=[];let s,r=e;for(;;){if(0===r.subs.length)s=t.leaf(r);else{const e=t.enter(r);if(void 0===e.result){n.push({re:r,state:e,i:0}),r=r.subs[0];continue}s=e.result}for(;;){if(0===n.length)return s;const e=n[n.length-1];if(t.child(e.re,e.state,s,e.i),e.i++,void 0===e.state.result&&e.i<e.re.subs.length){r=e.re.subs[e.i];break}n.pop(),s=void 0!==e.state.result?e.state.result:t.leave(e.re,e.state)}}}},lc=class{constructor(e,t){const n=new Map,s=[0],r=[0],i=[0],a=[0];for(const o of e){let e=0;for(let B=0;B<o.length;B++){const c=e*t+o[B];let l=n.get(c);void 0===l&&(l=s.length,n.set(c,l),s.push(e),r.push(o[B]),i.push(i[e]+1),a.push(0)),e=l}a[e]=1}const o=s.length,B=new Int32Array(o-1);for(let e=1;e<o;e++)B[e-1]=e;B.sort((e,t)=>s[e]-s[t]||r[e]-r[t]);const c=new Int32Array(o+1);for(let e=1;e<o;e++)c[s[e]+1]++;for(let e=0;e<o;e++)c[e+1]+=c[e];const l=new Int32Array(o-1);for(let e=0;e<B.length;e++)l[e]=r[B[e]];this.childStart=c,this.childUnit=l,this.childNode=B;const u=new Int32Array(o);for(let e=0;e<o;e++)u[e]=e;u.sort((e,t)=>i[e]-i[t]);const h=new Int32Array(o),p=Uint8Array.from(a);for(let e=1;e<o;e++){const t=u[e],n=s[t];if(0!==n){let e=h[n],s=this.next(e,r[t]);for(;s<0&&0!==e;)e=h[e],s=this.next(e,r[t]);h[t]=s>=0?s:0}p[t]|=p[h[t]]}this.fail=h,this.match=p}next(e,t){let n=this.childStart[e],s=this.childStart[e+1];const r=this.childUnit;for(;n<s;){const e=n+s>>1,i=r[e];if(i===t)return this.childNode[e];i<t?n=e+1:s=e}return-1}advance(e,t){for(;;){const n=this.next(e,t);if(n>=0)return n;if(0===e)return 0;e=this.fail[e]}}searchUTF16(e,t,n){let s=0;for(let r=t;r<n;r++)if(s=this.advance(s,e.charCodeAt(r)),1===this.match[s])return!0;return!1}searchUTF8(e,t,n){let s=0;for(let r=t;r<n;r++)if(s=this.advance(s,e[r]),1===this.match[s])return!0;return!1}},uc=class e{static Type={NONE:0,EXACT:1,AND:2,OR:3};static MAX_SCANS=32;static MAX_AC_UNITS=1<<18;constructor(t){this.type=t,this.subs=[],this.str="",this.bytes=null,this.cost=t===e.Type.EXACT?1:0,this.allExact=!1,this.ac16=null,this.ac8=null}automaton16(){if(null===this.ac16){const e=this.subs.map(e=>{const t=new Array(e.str.length);for(let n=0;n<e.str.length;n++)t[n]=e.str.charCodeAt(n);return t});this.ac16=new lc(e,65536)}return this.ac16}automaton8(){return null===this.ac8&&(this.ac8=new lc(this.subs.map(e=>e.bytes),256)),this.ac8}eval(t,n){switch(this.type){case e.Type.NONE:return!0;case e.Type.EXACT:return t.hasString(this,n);case e.Type.AND:for(let e=0;e<this.subs.length;e++)if(!this.subs[e].eval(t,n))return!1;return!0;case e.Type.OR:if(this.allExact)return t.hasAnyString(this,n);for(let e=0;e<this.subs.length;e++)if(this.subs[e].eval(t,n))return!0;return!1;default:return!0}}},hc=class e{static build(t){return t?cc.walk(t,e.WALKER):new uc(uc.Type.NONE)}static WALKER={leaf:t=>e.leaf(t),enter:t=>e.enter(t),child:(t,n,s)=>e.child(t,n,s),leave:(t,n)=>e.leave(t,n)};static leaf(e){if(e.op!==Bc.Op.LITERAL)return new uc(uc.Type.NONE);if(0===e.runes.length||0!==(e.flags&BB.FOLD_CASE))return new uc(uc.Type.NONE);let t="";for(let n=0;n<e.runes.length;n++){if(IB.isUnsearchable(e.runes[n]))return new uc(uc.Type.NONE);t+=String.fromCodePoint(e.runes[n])}const n=new uc(uc.Type.EXACT);return n.str=t,n.bytes=SB.stringToUtf8ByteArray(n.str),n}static enter(e){switch(e.op){case Bc.Op.CAPTURE:case Bc.Op.PLUS:return{sub:null};case Bc.Op.REPEAT:return e.min>=1?{sub:null}:{result:new uc(uc.Type.NONE)};case Bc.Op.CONCAT:return{pf:new uc(uc.Type.AND),subs:[]};case Bc.Op.ALTERNATE:return{pf:new uc(uc.Type.OR),subs:[]};default:return{result:new uc(uc.Type.NONE)}}}static child(e,t,n){if(void 0!==t.subs)if(t.pf.type!==uc.Type.AND)if(n.type!==uc.Type.NONE)if(n.type!==uc.Type.OR)t.subs.push(n);else for(let e=0;e<n.subs.length;e++)t.subs.push(n.subs[e]);else t.result=new uc(uc.Type.NONE);else{if(n.type===uc.Type.NONE)return;if(n.type===uc.Type.AND){for(let e=0;e<n.subs.length;e++)t.subs.push(n.subs[e]);return}t.subs.push(n)}else t.sub=n}static leave(e,t){if(void 0===t.subs)return t.sub;const n=t.pf,s=new Set,r=[];for(const e of t.subs){if(e.type===uc.Type.EXACT){if(s.has(e.str))continue;s.add(e.str)}r.push(e)}if(n.type===uc.Type.AND){const e=[];let t=0;for(const n of r)t+n.cost>uc.MAX_SCANS||(e.push(n),t+=n.cost);return 0===e.length?new uc(uc.Type.NONE):1===e.length?e[0]:(n.subs=e,n.cost=t,n)}if(0===r.length)return new uc(uc.Type.NONE);if(1===r.length)return r[0];n.subs=r;let i=!0,a=0,o=0;for(const e of r)e.type!==uc.Type.EXACT?i=!1:o+=e.bytes.length,a+=e.cost;return i?o>uc.MAX_AC_UNITS?new uc(uc.Type.NONE):(n.allExact=!0,n.cost=1,n):a>uc.MAX_SCANS?new uc(uc.Type.NONE):(n.cost=a,n)}},pc=class{constructor(e=0,t=0){this.head=e,this.tail=t}},dc=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0,this.lbInst=null}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new zB(e))}markLookbehindInsts(){const e=new Uint8Array(this.inst.length),t=this.lbStarts.slice();for(;t.length>0;){const n=t.pop();if(0===n||1===e[n])continue;e[n]=1;const s=this.inst[n];switch(s.op){case zB.ALT:case zB.ALT_MATCH:t.push(s.out,s.arg);break;case zB.MATCH:case zB.FAIL:break;default:t.push(s.out)}}this.lbInst=e}skipNop(e){let t=this.inst[e];for(;t.op===zB.NOP||t.op===zB.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!zB.isRuneOp(t.op)||1!==t.runes.length)return[t.op===zB.MATCH,e];for(;zB.isRuneOp(t.op)&&1===t.runes.length&&0===(t.arg&BB.FOLD_CASE)&&!IB.isUnsearchable(t.runes[0]);)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===zB.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const n=this.inst[t];switch(n.op){case zB.EMPTY_WIDTH:e|=n.arg;break;case zB.FAIL:return-1;case zB.CAPTURE:case zB.NOP:break;default:break e}t=n.out}return e}patch(e,t){let n=e.head;for(;0!==n;){const e=this.inst[n>>1];1&n?(n=e.arg,e.arg=t):(n=e.out,e.out=t)}}append(e,t){if(0===e.head)return t;if(0===t.head)return e;const n=this.inst[e.tail>>1];return 1&e.tail?n.arg=t.head:n.out=t.head,new pc(e.head,t.tail)}toString(){let e="";for(let t=0;t<this.inst.length;t++){const n=e.length;e+=t,t===this.start&&(e+="*"),e+=" ".substring(e.length-n),e+=this.inst[t],e+="\n"}return e}};const fc=new Int32Array([0,wB.CODES["\n"]-1,wB.CODES["\n"]+1,IB.MAX_RUNE]),Cc=new Int32Array([0,IB.MAX_RUNE]);var gc=class{constructor(e=0,t=new pc,n=!1){this.i=e,this.out=t,this.nullable=n}},mc=class e{static compileRegexp(t){const n=new e,s=n.compile(t);return n.prog.patch(s.out,n.newInst(zB.MATCH).i),n.prog.start=s.i,n.prog.markLookbehindInsts(),n.prog}static compileSet(t){const n=new e;if(0===t.length)return n.prog.start=n.newInst(zB.FAIL).i,n.prog.markLookbehindInsts(),n.prog;let s=[];for(let e=0;e<t.length;e++){n.lbOffset=n.prog.numLb;const r=n.compile(t[e]),i=n.newInst(zB.MATCH);n.prog.getInst(i.i).arg=e,n.prog.patch(r.out,i.i),s.push(r.i)}let r=s[0];for(let e=1;e<s.length;e++){const t=n.newInst(zB.ALT),i=n.prog.getInst(t.i);i.out=r,i.arg=s[e],r=t.i}return n.prog.start=r,n.prog.markLookbehindInsts(),n.prog}constructor(){this.prog=new dc,this.newInst(zB.FAIL),this.lbOffset=0,this.runeCache=new Map,this.walker={leaf:e=>this.leaf(e),enter:e=>this.enter(e),child:(e,t,n)=>this.child(e,t,n),leave:(e,t)=>this.leave(e,t)}}newInst(e){return this.prog.addInst(e),new gc(this.prog.numInst()-1,new pc,!0)}nop(){const e=this.newInst(zB.NOP);return e.out=new pc(e.i<<1,e.i<<1),e}fail(){return new gc}cap(e){const t=this.newInst(zB.CAPTURE);return t.out=new pc(t.i<<1,t.i<<1),this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return 0===e.i||0===t.i?(this.prog.patch(e.out,0),this.prog.patch(t.out,0),this.fail()):(this.prog.patch(e.out,t.i),new gc(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(0===e.i)return t;if(0===t.i)return e;const n=this.newInst(zB.ALT),s=this.prog.getInst(n.i);return s.out=e.i,s.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){const n=this.newInst(zB.ALT),s=this.prog.getInst(n.i);return t?(s.arg=e.i,n.out=new pc(n.i<<1,n.i<<1)):(s.out=e.i,n.out=new pc(n.i<<1|1,n.i<<1|1)),this.prog.patch(e.out,n.i),n}quest(e,t){if(0===e.i)return this.nop();const n=this.newInst(zB.ALT),s=this.prog.getInst(n.i);return t?(s.arg=e.i,n.out=new pc(n.i<<1,n.i<<1)):(s.out=e.i,n.out=new pc(n.i<<1|1,n.i<<1|1)),n.out=this.prog.append(n.out,e.out),n}star(e,t){return 0===e.i?this.nop():e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return 0===e.i?this.fail():new gc(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(zB.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=new pc(t.i<<1,t.i<<1),t}rune(e,t){const n=this.newInst(zB.RUNE);n.nullable=!1;const s=this.prog.getInst(n.i);return s.runes=e,t&=BB.FOLD_CASE,1===e.length&&IB.simpleFold(e[0])!==e[0]||(t&=-2),s.arg=t,n.out=new pc(n.i<<1,n.i<<1),0===(t&BB.FOLD_CASE)&&1===e.length||2===e.length&&e[0]===e[1]?s.op=zB.RUNE1:2===e.length&&0===e[0]&&e[1]===IB.MAX_RUNE?s.op=zB.RUNE_ANY:4===e.length&&0===e[0]&&e[1]===wB.CODES["\n"]-1&&e[2]===wB.CODES["\n"]+1&&e[3]===IB.MAX_RUNE&&(s.op=zB.RUNE_ANY_NOT_NL),n}lookBehind(e,t){const n=Math.sign(t)*(Math.abs(t)+this.lbOffset),s=this.newInst(zB.LB_WRITE);this.prog.getInst(s.i).arg=n;const r=this.rune(Cc,0),i=this.star(r,!0),a=this.cat(i,e);this.prog.patch(a.out,s.i);const o=this.newInst(zB.LB_CHECK);return this.prog.getInst(o.i).arg=n,this.prog.lbStarts.push(a.i),Math.abs(n)>this.prog.numLb&&(this.prog.numLb=Math.abs(n)),o.out=new pc(o.i<<1,o.i<<1),o}compile(e){return cc.walk(e,this.walker)}leaf(e){switch(e.op){case Bc.Op.NO_MATCH:return this.fail();case Bc.Op.EMPTY_MATCH:return this.nop();case Bc.Op.LITERAL:{if(0===e.runes.length)return this.nop();let t=null;for(let n of e.runes){let s=this.runeCache.get(n);void 0===s&&(s=new Int32Array([n]),this.runeCache.set(n,s));const r=this.rune(s,e.flags);t=null===t?r:this.cat(t,r)}return t}case Bc.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case Bc.Op.ANY_CHAR_NOT_NL:return this.rune(fc,0);case Bc.Op.ANY_CHAR:return this.rune(Cc,0);case Bc.Op.BEGIN_LINE:return this.empty(SB.EMPTY_BEGIN_LINE);case Bc.Op.END_LINE:return this.empty(SB.EMPTY_END_LINE);case Bc.Op.BEGIN_TEXT:return this.empty(SB.EMPTY_BEGIN_TEXT);case Bc.Op.END_TEXT:return this.empty(SB.EMPTY_END_TEXT);case Bc.Op.WORD_BOUNDARY:return this.empty(SB.EMPTY_WORD_BOUNDARY);case Bc.Op.NO_WORD_BOUNDARY:return this.empty(SB.EMPTY_NO_WORD_BOUNDARY);case Bc.Op.CONCAT:case Bc.Op.ALTERNATE:return this.nop();default:throw new VB("regexp: unhandled case in compile")}}enter(e){switch(e.op){case Bc.Op.PLB:case Bc.Op.NLB:case Bc.Op.STAR:case Bc.Op.PLUS:case Bc.Op.QUEST:return{sub:null};case Bc.Op.CAPTURE:return{bra:this.cap(e.cap<<1),sub:null};case Bc.Op.CONCAT:case Bc.Op.ALTERNATE:return{f:null};default:throw new VB("regexp: unhandled case in compile")}}child(e,t,n){e.op===Bc.Op.CONCAT?t.f=null===t.f?n:this.cat(t.f,n):e.op===Bc.Op.ALTERNATE?t.f=null===t.f?n:this.alt(t.f,n):t.sub=n}leave(e,t){switch(e.op){case Bc.Op.PLB:case Bc.Op.NLB:return this.lookBehind(t.sub,e.lb);case Bc.Op.CAPTURE:{const n=this.cap(e.cap<<1|1);return this.cat(this.cat(t.bra,t.sub),n)}case Bc.Op.STAR:return this.star(t.sub,0!==(e.flags&BB.NON_GREEDY));case Bc.Op.PLUS:return this.plus(t.sub,0!==(e.flags&BB.NON_GREEDY));case Bc.Op.QUEST:return this.quest(t.sub,0!==(e.flags&BB.NON_GREEDY));case Bc.Op.CONCAT:case Bc.Op.ALTERNATE:return t.f;default:throw new VB("regexp: unhandled case in compile")}}},wc=class e{static simplify(t){return null===t?null:cc.walk(t,e.WALKER)}static WALKER={leaf:t=>e.leaf(t),enter:t=>e.enter(t),child:(t,n,s,r)=>e.child(t,n,s,r),leave:(t,n)=>e.leave(t,n)};static leaf(e){if(e.op===Bc.Op.CHAR_CLASS){if(null===e.runes)return e;if(0===e.runes.length)return new Bc(Bc.Op.NO_MATCH);if(2===e.runes.length&&0===e.runes[0]&&e.runes[1]===IB.MAX_RUNE)return new Bc(Bc.Op.ANY_CHAR);if(4===e.runes.length&&0===e.runes[0]&&e.runes[1]===wB.CODES["\n"]-1&&e.runes[2]===wB.CODES["\n"]+1&&e.runes[3]===IB.MAX_RUNE)return new Bc(Bc.Op.ANY_CHAR_NOT_NL)}return e}static enter(e){switch(e.op){case Bc.Op.PLB:case Bc.Op.NLB:case Bc.Op.CAPTURE:case Bc.Op.STAR:case Bc.Op.PLUS:case Bc.Op.QUEST:return{sub:null};case Bc.Op.CONCAT:case Bc.Op.ALTERNATE:return{subs:[],changed:!1};case Bc.Op.REPEAT:return 0===e.min&&0===e.max?{result:new Bc(Bc.Op.EMPTY_MATCH)}:{sub:null};default:return{result:e}}}static child(e,t,n,s){if(void 0!==t.subs){if(n!==e.subs[s]&&(t.changed=!0),e.op===Bc.Op.CONCAT){if(n.op===Bc.Op.NO_MATCH)return void(t.result=new Bc(Bc.Op.NO_MATCH));if(n.op===Bc.Op.EMPTY_MATCH)return void(t.changed=!0);if(n.op===Bc.Op.CONCAT){t.changed=!0;for(let e=0;e<n.subs.length;e++)t.subs.push(n.subs[e]);return}}else{if(n.op===Bc.Op.NO_MATCH)return void(t.changed=!0);if(n.op===Bc.Op.ALTERNATE){t.changed=!0;for(let e=0;e<n.subs.length;e++)t.subs.push(n.subs[e]);return}}t.subs.push(n)}else t.sub=n}static leave(t,n){switch(t.op){case Bc.Op.PLB:case Bc.Op.NLB:case Bc.Op.CAPTURE:{const e=n.sub;if(e!==t.subs[0]){const n=Bc.fromRegexp(t);return n.runes=new Int32Array(0),n.subs=[e],n}return t}case Bc.Op.CONCAT:case Bc.Op.ALTERNATE:if(n.changed){const e=n.subs;if(0===e.length)return new Bc(t.op===Bc.Op.CONCAT?Bc.Op.EMPTY_MATCH:Bc.Op.NO_MATCH);if(1===e.length)return e[0];const s=Bc.fromRegexp(t);return s.runes=new Int32Array(0),s.subs=e,s}return t;case Bc.Op.STAR:case Bc.Op.PLUS:case Bc.Op.QUEST:return e.simplify1(t.op,t.flags,n.sub,t);case Bc.Op.REPEAT:return e.simplifyRepeat(t,n.sub);default:return t}}static simplifyRepeat(t,n){if(-1===t.max){if(0===t.min)return e.simplify1(Bc.Op.STAR,t.flags,n,null);if(1===t.min)return e.simplify1(Bc.Op.PLUS,t.flags,n,null);const s=[];for(let e=0;e<t.min-1;e++)s.push(n);return s.push(e.simplify1(Bc.Op.PLUS,t.flags,n,null)),e.concat(s)}if(1===t.min&&1===t.max)return n;let s=null;if(t.min>0){s=[];for(let e=0;e<t.min;e++)s.push(n)}if(t.max>t.min){let r=e.simplify1(Bc.Op.QUEST,t.flags,n,null);for(let s=t.min+1;s<t.max;s++)r=e.simplify1(Bc.Op.QUEST,t.flags,e.concat([n,r]),null);if(null===s)return r;s.push(r)}return null!==s?e.concat(s):new Bc(Bc.Op.NO_MATCH)}static concat(e){const t=[];for(let n=0;n<e.length;n++){const s=e[n];if(s.op===Bc.Op.NO_MATCH)return new Bc(Bc.Op.NO_MATCH);if(s.op!==Bc.Op.EMPTY_MATCH)if(s.op!==Bc.Op.CONCAT)t.push(s);else for(let e=0;e<s.subs.length;e++)t.push(s.subs[e])}if(0===t.length)return new Bc(Bc.Op.EMPTY_MATCH);if(1===t.length)return t[0];const n=new Bc(Bc.Op.CONCAT);return n.subs=t,n}static simplify1(e,t,n,s){if(n.op===Bc.Op.EMPTY_MATCH)return n;if(n.op===Bc.Op.NO_MATCH)return e===Bc.Op.PLUS?n:new Bc(Bc.Op.EMPTY_MATCH);if(e===n.op&&(t&BB.NON_GREEDY)===(n.flags&BB.NON_GREEDY))return n;if(null!==s&&s.op===e&&(s.flags&BB.NON_GREEDY)===(t&BB.NON_GREEDY)&&n===s.subs[0])return s;const r=new Bc(e);return r.flags=t,r.subs=[n],r}},Ec=class{constructor(e,t){this.sign=e,this.cls=t}};const yc=[48,57],Dc=[9,10,12,13,32,32],_c=[48,57,65,90,95,95,97,122],bc=new Map([["\\d",new Ec(1,yc)],["\\D",new Ec(-1,yc)],["\\s",new Ec(1,Dc)],["\\S",new Ec(-1,Dc)],["\\w",new Ec(1,_c)],["\\W",new Ec(-1,_c)]]),vc=[48,57,65,90,97,122],Ic=[65,90,97,122],Tc=[0,127],Ac=[9,9,32,32],Oc=[0,31,127,127],Sc=[48,57],Nc=[33,126],Rc=[97,122],kc=[32,126],Lc=[33,47,58,64,91,96,123,126],xc=[9,13,32,32],Fc=[65,90],Pc=[48,57,65,90,95,95,97,122],Mc=[48,57,65,70,97,102],Gc=new Map([["[:alnum:]",new Ec(1,vc)],["[:^alnum:]",new Ec(-1,vc)],["[:alpha:]",new Ec(1,Ic)],["[:^alpha:]",new Ec(-1,Ic)],["[:ascii:]",new Ec(1,Tc)],["[:^ascii:]",new Ec(-1,Tc)],["[:blank:]",new Ec(1,Ac)],["[:^blank:]",new Ec(-1,Ac)],["[:cntrl:]",new Ec(1,Oc)],["[:^cntrl:]",new Ec(-1,Oc)],["[:digit:]",new Ec(1,Sc)],["[:^digit:]",new Ec(-1,Sc)],["[:graph:]",new Ec(1,Nc)],["[:^graph:]",new Ec(-1,Nc)],["[:lower:]",new Ec(1,Rc)],["[:^lower:]",new Ec(-1,Rc)],["[:print:]",new Ec(1,kc)],["[:^print:]",new Ec(-1,kc)],["[:punct:]",new Ec(1,Lc)],["[:^punct:]",new Ec(-1,Lc)],["[:space:]",new Ec(1,xc)],["[:^space:]",new Ec(-1,xc)],["[:upper:]",new Ec(1,Fc)],["[:^upper:]",new Ec(-1,Fc)],["[:word:]",new Ec(1,Pc)],["[:^word:]",new Ec(-1,Pc)],["[:xdigit:]",new Ec(1,Mc)],["[:^xdigit:]",new Ec(-1,Mc)]]);var Uc=class e{static charClassToString(e,t){let n="[";for(let s=0;s<t;s+=2){s>0&&(n+=" ");const t=e[s],r=e[s+1];n+=t===r?`0x${t.toString(16)}`:`0x${t.toString(16)}-0x${r.toString(16)}`}return n+="]",n}static sortRanges(e,t){const n=t>>1,s=new Array(n);for(let e=0;e<n;e++)s[e]=e;s.sort((t,n)=>e[2*t]-e[2*n]||e[2*n+1]-e[2*t+1]);const r=e.slice(0,t);for(let t=0;t<n;t++)e[2*t]=r[2*s[t]],e[2*t+1]=r[2*s[t]+1]}constructor(e=SB.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.r instanceof Int32Array?this.len===this.r.length?this.r:this.r.subarray(0,this.len):new Int32Array(this.len===this.r.length?this.r:this.r.slice(0,this.len))}toGrowableArray(){return Array.isArray(this.r)?(this.r.length=this.len,this.r):Array.from(this.r.subarray(0,this.len))}cleanClass(){if(this.len<4)return this;e.sortRanges(this.r,this.len);let t=2;for(let e=2;e<this.len;e+=2){const n=this.r[e],s=this.r[e+1];n<=this.r[t-1]+1?s>this.r[t-1]&&(this.r[t-1]=s):(this.r[t]=n,this.r[t+1]=s,t+=2)}return this.len=t,this}appendLiteral(e,t){return 0!==(t&BB.FOLD_CASE)?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const s=this.r[this.len-n],r=this.r[this.len-n+1];if(e<=r+1&&s<=t+1)return e<s&&(this.r[this.len-n]=e),t>r&&(this.r[this.len-n+1]=t),this}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=IB.MIN_FOLD&&t>=IB.MAX_FOLD)return this.appendRange(e,t);if(t<IB.MIN_FOLD||e>IB.MAX_FOLD)return this.appendRange(e,t);e<IB.MIN_FOLD&&(this.appendRange(e,IB.MIN_FOLD-1),e=IB.MIN_FOLD),t>IB.MAX_FOLD&&(this.appendRange(IB.MAX_FOLD+1,t),t=IB.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=IB.simpleFold(n);e!==n;e=IB.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){const s=e[n],r=e[n+1];t<=s-1&&this.appendRange(t,s-1),t=r+1}return t<=IB.MAX_RUNE&&this.appendRange(t,IB.MAX_RUNE),this}appendTable(e){for(let t=0;t<e.length;++t){const n=e.getLo(t),s=e.getHi(t),r=e.getStride(t);if(1!==r)for(let e=n;e<=s;e+=r)this.appendRange(e,e);else this.appendRange(n,s)}return this}appendNegatedTable(e){let t=0;for(let n=0;n<e.length;++n){const s=e.getLo(n),r=e.getHi(n),i=e.getStride(n);if(1!==i)for(let e=s;e<=r;e+=i)t<=e-1&&this.appendRange(t,e-1),t=e+1;else t<=s-1&&this.appendRange(t,s-1),t=r+1}return t<=IB.MAX_RUNE&&this.appendRange(t,IB.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){const s=this.r[n],r=this.r[n+1];e<=s-1&&(this.r[t]=e,this.r[t+1]=s-1,t+=2),e=r+1}return this.len=t,e<=IB.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=IB.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let s=t.cls;return n&&(s=(new e).appendFoldedClass(s).cleanClass().toArray()),this.appendClassWithSign(s,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},Hc=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=SB.charCount(e),e}lookingAt(e){return this.str.startsWith(e,this.position)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},Vc=class e{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static ERR_INVALID_CAPTURE_IN_LOOKBEHIND="invalid capture in lookbehind";static MAX_HEIGHT=1e3;static MAX_SIZE=1398101;static MAX_RUNES=33554432;static ANY_TABLE=new EB(new Uint32Array([0,IB.MAX_RUNE,1]));static ASCII_TABLE=new EB(new Uint32Array([0,127,1]));static ASCII_FOLD_TABLE=new EB(new Uint32Array([0,127,1,383,383,1,8490,8490,1]));static unicodeTable(t){return"Any"===t?{tab:e.ANY_TABLE,fold:e.ANY_TABLE,sign:1}:"Ascii"===t?{tab:e.ASCII_TABLE,fold:e.ASCII_FOLD_TABLE,sign:1}:"Assigned"===t?{tab:vB.CATEGORIES.get("Cn"),fold:vB.CATEGORIES.get("Cn"),sign:-1}:"Lc"===t?{tab:vB.CATEGORIES.get("LC"),fold:vB.FOLD_CATEGORIES.get("LC"),sign:1}:vB.CATEGORIES.has(t)?{tab:vB.CATEGORIES.get(t),fold:vB.FOLD_CATEGORIES.get(t),sign:1}:vB.SCRIPTS.has(t)?{tab:vB.SCRIPTS.get(t),fold:vB.FOLD_SCRIPT.get(t),sign:1}:null}static minFoldRune(e){if(e<IB.MIN_FOLD||e>IB.MAX_FOLD)return e;let t=e;const n=e;for(e=IB.simpleFold(e);e!==n;e=IB.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===Bc.Op.EMPTY_MATCH)return null;if(e.op===Bc.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===Bc.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const n=new Bc(Bc.Op.LITERAL);return n.flags=t,n.runes=SB.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){const n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);const s=e.parseInt(t);if(-1===s)return-1;if(!t.more())return-1;let r;if(t.lookingAt(",")){if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))r=-1;else if(-1===(r=e.parseInt(t)))return-1}else r=s;if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),s<0||s>1e3||-2===r||r>1e3||r>=0&&s>r)throw new HB(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return s<<16|r&IB.MAX_BMP}static isValidCaptureName(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const n=e.codePointAt(t);if(n!==wB.CODES._&&!SB.isalnum(n))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=wB.CODES[0]&&e.peek()<=wB.CODES[9];)e.skip(1);const n=e.from(t);return 0===n.length||n.length>1&&n.codePointAt(0)===wB.CODES[0]?-1:n.length>8?-2:parseInt(n,10)}static isCharClass(e){return e.op===Bc.Op.LITERAL&&1===e.runes.length||e.op===Bc.Op.CHAR_CLASS||e.op===Bc.Op.ANY_CHAR_NOT_NL||e.op===Bc.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case Bc.Op.LITERAL:return 1===e.runes.length&&e.runes[0]===t;case Bc.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case Bc.Op.ANY_CHAR_NOT_NL:return t!==wB.CODES["\n"];case Bc.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case Bc.Op.ANY_CHAR:break;case Bc.Op.ANY_CHAR_NOT_NL:e.matchRune(n,wB.CODES["\n"])&&(t.op=Bc.Op.ANY_CHAR);break;case Bc.Op.CHAR_CLASS:{const e=new Uc(Array.isArray(t.runes)?t.runes:Array.from(t.runes));n.op===Bc.Op.LITERAL?e.appendLiteral(n.runes[0],n.flags):e.appendClass(n.runes),t.runes=e.toGrowableArray();break}case Bc.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=Bc.Op.CHAR_CLASS,t.runes=(new Uc).appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toGrowableArray()}}static parseEscape(t){const n=t.pos();if(t.skip(1),!t.more())throw new HB(e.ERR_TRAILING_BACKSLASH);let s=t.pop();e:switch(s){case wB.CODES[1]:case wB.CODES[2]:case wB.CODES[3]:case wB.CODES[4]:case wB.CODES[5]:case wB.CODES[6]:case wB.CODES[7]:if(!t.more()||t.peek()<wB.CODES[0]||t.peek()>wB.CODES[7])break;case wB.CODES[0]:{let e=s-wB.CODES[0];for(let n=1;n<3&&!(!t.more()||t.peek()<wB.CODES[0]||t.peek()>wB.CODES[7]);n++)e=8*e+t.peek()-wB.CODES[0],t.skip(1);return e}case wB.CODES.x:{if(!t.more())break;if(s=t.pop(),s===wB.CODES["{"]){let e=0,n=0;for(;;){if(!t.more())break e;if(s=t.pop(),s===wB.CODES["}"])break;const r=SB.unhex(s);if(r<0)break e;if(n=16*n+r,n>IB.MAX_RUNE)break e;e++}if(0===e)break e;return n}const e=SB.unhex(s);if(!t.more())break;s=t.pop();const n=SB.unhex(s);if(e<0||n<0)break;return 16*e+n}case wB.CODES.a:return wB.CODES[""];case wB.CODES.f:return wB.CODES["\f"];case wB.CODES.n:return wB.CODES["\n"];case wB.CODES.r:return wB.CODES["\r"];case wB.CODES.t:return wB.CODES["\t"];case wB.CODES.v:return wB.CODES["\v"];default:if(s<=IB.MAX_ASCII&&!SB.isalnum(s))return s}throw new HB(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new HB(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static hasCapture(t){if(null===t)return!1;if(t.op===Bc.Op.CAPTURE)return!0;if(t.subs)for(let n of t.subs)if(e.hasCapture(n))return!0;return!1}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(e){let t=this.free;return null!==t&&null!==t.subs&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):(t=new Bc(e),this.numRegexp+=1),t}reuse(e){null!==this.height&&this.height.has(e)&&this.height.delete(e),null!==e.subs&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new HB(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(null===this.size){if(0===this.repeats&&(this.repeats=1),t.op===Bc.Op.REPEAT){let n=t.max;-1===n&&(n=t.min),n<=0&&(n=1),n>Math.floor(e.MAX_SIZE/this.repeats)?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<Math.floor(e.MAX_SIZE/this.repeats))return;this.size=new Map;for(let e of this.stack)this.checkSize(e)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new HB(e.ERR_LARGE)}calcSize(e,t=!1){if(!t&&null!==this.size&&this.size.has(e))return this.size.get(e);let n=0;switch(e.op){case Bc.Op.LITERAL:n=e.runes.length;break;case Bc.Op.PLB:case Bc.Op.NLB:case Bc.Op.CAPTURE:case Bc.Op.STAR:n=2+this.calcSize(e.subs[0]);break;case Bc.Op.PLUS:case Bc.Op.QUEST:n=1+this.calcSize(e.subs[0]);break;case Bc.Op.CONCAT:for(let t of e.subs)n+=this.calcSize(t);break;case Bc.Op.ALTERNATE:for(let t of e.subs)n+=this.calcSize(t);e.subs.length>1&&(n=n+e.subs.length-1);break;case Bc.Op.REPEAT:{let t=this.calcSize(e.subs[0]);if(-1===e.max){n=0===e.min?2+t:1+e.min*t;break}n=e.max*t+(e.max-e.min);break}}return n=Math.max(1,n),null===this.size&&(this.size=new Map),this.size.set(e,n),n}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(null===this.height){this.height=new Map;for(let e of this.stack)this.checkHeight(e)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new HB(e.ERR_NESTING_DEPTH)}}calcHeight(e,t=!1){if(!t&&null!==this.height&&this.height.has(e))return this.height.get(e);let n=1;for(let t of e.subs){const e=this.calcHeight(t);n<1+e&&(n=1+e)}return null===this.height&&(this.height=new Map),this.height.set(e,n),n}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!Bc.isPseudoOp(this.stack[t-1].op);)t--;return this.stack.splice(t,e-t)}push(e){if(this.numRunes+=e.runes.length,e.op===Bc.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],-2&this.flags))return null;e.op=Bc.Op.LITERAL,e.runes=[e.runes[0]],e.flags=-2&this.flags}else if(e.op===Bc.Op.CHAR_CLASS&&4===e.runes.length&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&IB.simpleFold(e.runes[0])===e.runes[2]&&IB.simpleFold(e.runes[2])===e.runes[0]||e.op===Bc.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]+1===e.runes[1]&&IB.simpleFold(e.runes[0])===e.runes[1]&&IB.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|BB.FOLD_CASE))return null;e.op=Bc.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|BB.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),this.checkLimits(e),e}maybeConcat(e,t){const n=this.stack.length;if(n<2)return!1;const s=this.stack[n-1],r=this.stack[n-2];if(s.op!==Bc.Op.LITERAL||r.op!==Bc.Op.LITERAL||(s.flags&BB.FOLD_CASE)!==(r.flags&BB.FOLD_CASE))return!1;Array.isArray(r.runes)||(r.runes=Array.from(r.runes));for(let e=0;e<s.runes.length;e++)r.runes.push(s.runes[e]);return e>=0?(s.runes=[e],s.flags=t,!0):(this.pop(),this.reuse(s),!1)}newLiteral(t,n){const s=this.newRegexp(Bc.Op.LITERAL);return s.flags=n,0!==(n&BB.FOLD_CASE)&&(t=e.minFoldRune(t)),s.runes=[t],s}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,s,r,i,a){let o=this.flags;if(0!==(o&BB.PERL_X)&&(i.more()&&i.lookingAt("?")&&(i.skip(1),o^=BB.NON_GREEDY),-1!==a))throw new HB(e.ERR_INVALID_REPEAT_OP,i.from(a));const B=this.stack.length;if(0===B)throw new HB(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const c=this.stack[B-1];if(Bc.isPseudoOp(c.op))throw new HB(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const l=this.newRegexp(t);if(l.min=n,l.max=s,l.flags=o,l.subs=[c],this.stack[B-1]=l,this.checkLimits(l),t===Bc.Op.REPEAT&&(n>=2||s>=2)&&!this.repeatIsValid(l,1e3))throw new HB(e.ERR_INVALID_REPEAT_SIZE,i.from(r))}repeatIsValid(e,t){if(e.op===Bc.Op.REPEAT){let n=e.max;if(0===n)return!0;if(n<0&&(n=e.min),n>t)return!1;n>0&&(t=Math.trunc(t/n))}for(let n of e.subs)if(!this.repeatIsValid(n,t))return!1;return!0}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return 0===e.length?this.push(this.newRegexp(Bc.Op.EMPTY_MATCH)):this.push(this.collapse(e,Bc.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),0===e.length?this.push(this.newRegexp(Bc.Op.NO_MATCH)):this.push(this.collapse(e,Bc.Op.ALTERNATE))}cleanAlt(e){e.op===Bc.Op.CHAR_CLASS&&(e.runes=new Uc(Array.from(e.runes)).cleanClass().toArray(),2===e.runes.length&&0===e.runes[0]&&e.runes[1]===IB.MAX_RUNE?(e.runes=new Int32Array(0),e.op=Bc.Op.ANY_CHAR):4===e.runes.length&&0===e.runes[0]&&e.runes[1]===wB.CODES["\n"]-1&&e.runes[2]===wB.CODES["\n"]+1&&e.runes[3]===IB.MAX_RUNE&&(e.runes=new Int32Array(0),e.op=Bc.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(1===e.length)return e[0];let n=0;for(let s of e)n+=s.op===t?s.subs.length:1;let s=new Array(n).fill(null),r=0;for(let n of e)if(n.op===t){for(let e=0;e<n.subs.length;e++)s[r++]=n.subs[e];this.reuse(n)}else s[r++]=n;let i=this.newRegexp(t);if(i.subs=s,t===Bc.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const e=i;i=i.subs[0],this.reuse(e)}return i}factor(t){if(t.length<2)return t;let n=0,s=t.length,r=0,i=null,a=0,o=0,B=0;for(let e=0;e<=s;e++){let c=null,l=0,u=0;if(e<s){let s=t[n+e];if(s.op===Bc.Op.CONCAT&&s.subs.length>0&&(s=s.subs[0]),s.op===Bc.Op.LITERAL&&(c=s.runes,l=s.runes.length,u=s.flags&BB.FOLD_CASE),u===o){let e=0;for(;e<a&&e<l&&i[e]===c[e];)e++;if(e>0){a=e;continue}}}if(e===B);else if(e===B+1)t[r++]=t[n+B];else{const s=this.newRegexp(Bc.Op.LITERAL);s.flags=o,s.runes=i.slice(0,a);for(let s=B;s<e;s++)t[n+s]=this.removeLeadingString(t[n+s],a),this.checkLimits(t[n+s]);const c=this.collapse(t.slice(n+B,n+e),Bc.Op.ALTERNATE),l=this.newRegexp(Bc.Op.CONCAT);l.subs=[s,c],t[r++]=l}B=e,i=c,a=l,o=u}s=r,n=0,B=0,r=0;let c=null;for(let i=0;i<=s;i++){let a=null;if(!(i<s&&(a=e.leadingRegexp(t[n+i]),null!==c&&c.equals(a)&&(e.isCharClass(c)||c.op===Bc.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(i===B);else if(i===B+1)t[r++]=t[n+B];else{const e=c;for(let e=B;e<i;e++){const s=e!==B;t[n+e]=this.removeLeadingRegexp(t[n+e],s),this.checkLimits(t[n+e])}const s=this.collapse(t.slice(n+B,n+i),Bc.Op.ALTERNATE),a=this.newRegexp(Bc.Op.CONCAT);a.subs=[e,s],t[r++]=a}B=i,c=a}}s=r,n=0,B=0,r=0;for(let i=0;i<=s;i++)if(!(i<s&&e.isCharClass(t[n+i]))){if(i===B);else if(i===B+1)t[r++]=t[n+B];else{let s=B;for(let e=B+1;e<i;e++){const r=t[n+s],i=t[n+e];(r.op<i.op||r.op===i.op&&(null!==r.runes?r.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(s=e)}const a=t[n+B];t[n+B]=t[n+s],t[n+s]=a;for(let s=B+1;s<i;s++)e.mergeCharClass(t[n+B],t[n+s]),this.reuse(t[n+s]);this.cleanAlt(t[n+B]),t[r++]=t[n+B]}i<s&&(t[r++]=t[n+i]),B=i+1}s=r,n=0,B=0,r=0;for(let e=0;e<s;++e)e+1<s&&t[n+e].op===Bc.Op.EMPTY_MATCH&&t[n+e+1].op===Bc.Op.EMPTY_MATCH||(t[r++]=t[n+e]);return s=r,n=0,t.slice(n,s)}removeLeadingString(e,t){if(e.op===Bc.Op.CONCAT&&e.subs.length>0){const n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===Bc.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=Bc.Op.EMPTY_MATCH,e.subs=Bc.emptySubs();break;case 2:{const t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length)}return e}return e.op===Bc.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),0===e.runes.length&&(e.op=Bc.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===Bc.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=Bc.Op.EMPTY_MATCH,e.subs=Bc.emptySubs();break;case 1:{const t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(Bc.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&BB.LITERAL))return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,s=-1;const r=new Hc(this.wholeRegexp);for(;r.more();){let i=-1;e:switch(r.peek()){case wB.CODES["("]:if(0!==(this.flags&BB.LOOKBEHIND)){if(r.lookingAt("(?<=")){this.parsePosLookBehind(),r.skip(4);break}if(r.lookingAt("(?<!")){this.parseNegLookBehind(),r.skip(4);break}}if(0!==(this.flags&BB.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(Bc.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case wB.CODES["|"]:this.parseVerticalBar(),r.skip(1);break;case wB.CODES[")"]:this.parseRightParen(),r.skip(1);break;case wB.CODES["^"]:0!==(this.flags&BB.ONE_LINE)?this.op(Bc.Op.BEGIN_TEXT):this.op(Bc.Op.BEGIN_LINE),r.skip(1);break;case wB.CODES.$:0!==(this.flags&BB.ONE_LINE)?this.op(Bc.Op.END_TEXT).flags|=BB.WAS_DOLLAR:this.op(Bc.Op.END_LINE),r.skip(1);break;case wB.CODES["."]:0!==(this.flags&BB.DOT_NL)?this.op(Bc.Op.ANY_CHAR):this.op(Bc.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case wB.CODES["["]:this.parseClass(r);break;case wB.CODES["*"]:case wB.CODES["+"]:case wB.CODES["?"]:{i=r.pos();let e=null;switch(r.pop()){case wB.CODES["*"]:e=Bc.Op.STAR;break;case wB.CODES["+"]:e=Bc.Op.PLUS;break;case wB.CODES["?"]:e=Bc.Op.QUEST}this.repeat(e,n,s,i,r,t);break}case wB.CODES["{"]:{const a=r.pos(),o=e.parseRepeat(r);if(o<0){r.rewindTo(a),this.literal(r.pop());break}i=a,n=o>>16,s=(o&IB.MAX_BMP)<<16>>16,this.repeat(Bc.Op.REPEAT,n,s,i,r,t);break}case wB.CODES["\\"]:{const t=r.pos();if(r.skip(1),0!==(this.flags&BB.PERL_X)&&r.more())switch(r.pop()){case wB.CODES.A:this.op(Bc.Op.BEGIN_TEXT);break e;case wB.CODES.b:this.op(Bc.Op.WORD_BOUNDARY);break e;case wB.CODES.B:this.op(Bc.Op.NO_WORD_BOUNDARY);break e;case wB.CODES.C:throw new HB(e.ERR_INVALID_ESCAPE,"\\C");case wB.CODES.Q:{let e=r.rest();const t=e.indexOf("\\E");t>=0?(e=e.substring(0,t),r.skipString(e),r.skipString("\\E")):r.skipString(e);let n=0;for(;n<e.length;){const t=e.codePointAt(n);this.literal(t),n+=SB.charCount(t)}break e}case wB.CODES.z:this.op(Bc.Op.END_TEXT);break e;default:r.rewindTo(t)}else r.rewindTo(t);const n=this.newRegexp(Bc.Op.CHAR_CLASS);if(n.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const e=new Uc;if(this.parseUnicodeClass(r,e)){n.runes=e.toArray(),this.push(n);break e}}const s=new Uc;if(this.parsePerlClassEscape(r,s)){n.runes=s.toArray(),this.push(n);break e}r.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(r));break}default:this.literal(r.pop())}t=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),1!==this.stack.length)throw new HB(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){const n=t.pos(),s=t.rest();if(s.startsWith("(?P<")||s.startsWith("(?<")){const n="P"===s.charAt(2)?4:3,r=s.indexOf(">");if(r<0)throw new HB(e.ERR_INVALID_NAMED_CAPTURE,s);const i=s.substring(n,r);if(t.skipString(i),t.skip(n+1),!e.isValidCaptureName(i))throw new HB(e.ERR_INVALID_NAMED_CAPTURE,s.substring(0,r+1));const a=this.op(Bc.Op.LEFT_PAREN);if(a.cap=++this.numCap,this.namedGroups[i])throw new HB(e.ERR_DUPLICATE_NAMED_CAPTURE,i);return this.namedGroups[i]=this.numCap,void(a.name=i)}t.skip(2);let r=this.flags,i=1,a=!1;e:for(;t.more();){const e=t.pop();switch(e){case wB.CODES.i:r|=BB.FOLD_CASE,a=!0;break;case wB.CODES.m:r&=-17,a=!0;break;case wB.CODES.s:r|=BB.DOT_NL,a=!0;break;case wB.CODES.U:r|=BB.NON_GREEDY,a=!0;break;case wB.CODES["-"]:if(i<0)break e;i=-1,r=~r,a=!1;break;case wB.CODES[":"]:case wB.CODES[")"]:if(i<0){if(!a)break e;r=~r}return e===wB.CODES[":"]&&this.op(Bc.Op.LEFT_PAREN),void(this.flags=r);default:break e}}throw new HB(e.ERR_INVALID_PERL_OP,t.from(n))}parsePosLookBehind(){const e=this.newRegexp(Bc.Op.LEFT_PAREN);return e.flags=this.flags,e.lb=++this.nlb,this.push(e)}parseNegLookBehind(){const e=this.newRegexp(Bc.Op.LEFT_PAREN);return e.flags=this.flags,e.lb=-++this.nlb,this.push(e)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(Bc.Op.VERTICAL_BAR)}swapVerticalBar(){const t=this.stack.length;if(t>=3&&this.stack[t-2].op===Bc.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],s=this.stack[t-3];if(n.op>s.op){const e=s;s=n,n=e,this.stack[t-3]=s}return e.mergeCharClass(s,n),this.reuse(n),this.pop(),!0}if(t>=2){const e=this.stack[t-1],n=this.stack[t-2];if(n.op===Bc.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new HB(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const t=this.pop(),n=this.pop();if(n.op!==Bc.Op.LEFT_PAREN)throw new HB(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=n.flags,0!==n.lb){if(e.hasCapture(t))throw new HB(e.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);return n.lb>0?n.op=Bc.Op.PLB:n.op=Bc.Op.NLB,n.subs=[t],void this.push(n)}0===n.cap?this.push(t):(n.op=Bc.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){const n=e.pos();if(0===(this.flags&BB.PERL_X)||!e.more()||e.pop()!==wB.CODES["\\"]||!e.more())return!1;e.pop();const s=e.from(n),r=bc.has(s)?bc.get(s):null;return null!==r&&(t.appendGroup(r,0!==(this.flags&BB.FOLD_CASE)),!0)}parseNamedClass(t,n){const s=t.rest(),r=s.indexOf(":]");if(r<0)return!1;const i=s.substring(0,r+2);t.skipString(i);const a=Gc.has(i)?Gc.get(i):null;if(null===a)throw new HB(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(a,0!==(this.flags&BB.FOLD_CASE)),!0}parseUnicodeClass(t,n){const s=t.pos();if(0===(this.flags&BB.UNICODE_GROUPS)||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let r,i=1,a=t.pop();if(a===wB.CODES.P&&(i=-1),!t.more())throw t.rewindTo(s),new HB(e.ERR_INVALID_CHAR_RANGE,t.rest());if(a=t.pop(),a!==wB.CODES["{"])r=SB.runeToString(a);else{const n=t.rest(),i=n.indexOf("}");if(i<0)throw t.rewindTo(s),new HB(e.ERR_INVALID_CHAR_RANGE,t.rest());r=n.substring(0,i),t.skipString(r),t.skip(1)}0!==r.length&&r.codePointAt(0)===wB.CODES["^"]&&(i=0-i,r=r.substring(1));const o=e.unicodeTable(r);if(null===o)throw new HB(e.ERR_INVALID_CHAR_RANGE,t.from(s));o.sign<0&&(i=0-i);const B=o.tab,c=o.fold;if(0===(this.flags&BB.FOLD_CASE)||null===c)n.appendTableWithSign(B,i);else{const e=(new Uc).appendTable(B).appendTable(c).cleanClass().toArray();n.appendClassWithSign(Array.from(e),i)}return!0}parseClass(t){const n=t.pos();t.skip(1);const s=this.newRegexp(Bc.Op.CHAR_CLASS);s.flags=this.flags;const r=new Uc;let i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),0===(this.flags&BB.CLASS_NL)&&r.appendRange(wB.CODES["\n"],wB.CODES["\n"]));let a=!0;for(;!t.more()||t.peek()!==wB.CODES["]"]||a;){if(t.more()&&t.lookingAt("-")&&0===(this.flags&BB.PERL_X)&&!a){const s=t.rest();if("-"===s||!s.startsWith("-]"))throw t.rewindTo(n),new HB(e.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;const s=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,r))continue;t.rewindTo(s)}if(this.parseUnicodeClass(t,r))continue;if(this.parsePerlClassEscape(t,r))continue;t.rewindTo(s);const i=e.parseClassChar(t,n);let o=i;if(t.more()&&t.lookingAt("-"))if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(o=e.parseClassChar(t,n),o<i)throw new HB(e.ERR_INVALID_CHAR_RANGE,t.from(s));0===(this.flags&BB.FOLD_CASE)?r.appendRange(i,o):r.appendFoldedRange(i,o)}t.skip(1),r.cleanClass(),i<0&&r.negateClass(),s.runes=r.toArray(),this.push(s)}},jc=class e{static initTest(t){const n=e.compile(t),s=new e(n.expr,n.prog,n.numSubexp,n.longest);return s.cond=n.cond,s.prefix=n.prefix,s.prefixUTF8=n.prefixUTF8,s.prefixComplete=n.prefixComplete,s.prefixRune=n.prefixRune,s.prefilter=n.prefilter,s.namedGroups=n.namedGroups,s}static compile(t){return e.compileImpl(t,BB.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,BB.POSIX,!0)}static compileImpl(t,n,s){let r=Vc.parse(t,n);const i=r.maxCap(),a=r.namedGroups;r=wc.simplify(r);const o=hc.build(r),B=mc.compileRegexp(r),c=new e(t,B,i,s);c.prefilter=o.type===uc.Type.NONE?null:o;const[l,u]=B.prefix();return c.prefixComplete=l,c.prefix=u,c.prefixUTF8=SB.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=a,c}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,s=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=s,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.namedGroups=Object.create(null),this.machinePool=[],this.lazyDFA=null,this.onepass=oc.compile(this.prog),this.prefilter=null}get dfa(){return null===this.lazyDFA&&(this.lazyDFA=new tc(this.prog)),this.lazyDFA}matchPrefixComplete(e,t,n,s){if((n===BB.ANCHOR_START||n===BB.ANCHOR_BOTH)&&0!==t)return null;let r=-1,i=-1;const a=e.prefixLength(this);if(n===BB.UNANCHORED){const n=e.index(this,t);if(n<0)return null;r=t+n,i=r+a}else if(n===BB.ANCHOR_BOTH){if(e.endPos()!==a)return null;if(0!==e.index(this,0))return null;r=0,i=a}else if(n===BB.ANCHOR_START){if(0!==e.index(this,0))return null;r=0,i=a}if(r<0)return null;if(s>0){const e=new Int32Array(s).fill(-1);return e[0]=r,e[1]=i,Array.from(e)}return[]}createLookbehindState(){return this.prog.numLb>0?new QB(this.prog):null}executeEngine(e,t,n,s,r=null){if(this.prefixComplete&&(0===s||0===this.numSubexp))return this.matchPrefixComplete(e,t,n,s);if(null!==this.prefilter&&n===BB.UNANCHORED&&!this.prefilter.eval(e,t))return null;if(null!==this.onepass)return oc.execute(this,e,t,n,s);if(s>0)return 0===this.prog.numLb&&e.endPos()<=rc.maxBitStateLen(this.prog)?rc.execute(this,e,t,n,s):this.doExecuteNFA(e,t,n,s,r);if(0===this.prog.numLb){const r=this.dfa.match(e,t,n);if(null!==r)return r?[]:null;if(e.endPos()<=rc.maxBitStateLen(this.prog))return rc.execute(this,e,t,n,s)}return this.doExecuteNFA(e,t,n,s,r)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(e){this.machinePool.push(e)}toString(){return this.expr}doExecuteNFA(e,t,n,s,r=null){let i=this.get();i||(i=WB.fromRE2(this)),i.init(s);const a=i.match(e,t,n,r)?i.submatches():null;return this.put(i),a}match(e){return null!==this.executeEngine(GB.fromUTF16(e),0,BB.UNANCHORED,0)}matchWithGroup(e,t,n,s,r,i=null){return e instanceof RB||(e=SB.isByteArray(e)?xB.utf8(e):xB.utf16(e)),this.matchMachineInput(e,t,n,s,r,i)}matchMachineInput(e,t,n,s,r,i=null){if(t>n)return[!1,null];const a=e.isUTF16Encoding()?GB.fromUTF16(e.asCharSequence(),0,n):GB.fromUTF8(e.asBytes(),0,n),o=this.executeEngine(a,t,s,2*r,i);return null===o?[!1,null]:[!0,o]}matchUTF8(e){return null!==this.executeEngine(GB.fromUTF8(e),0,BB.UNANCHORED,0)}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let s=0,r=0,i="";const a=GB.fromUTF16(e),o=this.createLookbehindState();let B=0;for(;r<=e.length;){const c=this.executeEngine(a,r,BB.UNANCHORED,2,o);if(null===c||0===c.length)break;i+=e.substring(s,c[0]),(c[1]>s||0===c[0])&&(i+=t(e.substring(c[0],c[1])),B++),s=c[1];const l=7&a.step(r);if(r+l>c[1]?r+=l:r+1>c[1]?r++:r=c[1],B>=n)break}return i+=e.substring(s),i}pad(e){if(null===e)return null;let t=2*(1+this.numSubexp);if(e.length<t){let n=new Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let s=[];const r=e.endPos();t<0&&(t=r+1);let i=0,a=0,o=-1;const B=this.createLookbehindState();for(;a<t&&i<=r;){const t=this.executeEngine(e,i,BB.UNANCHORED,this.prog.numCap,B);if(null===t||0===t.length)break;let c=!0;if(t[1]===i){t[0]===o&&(c=!1);const n=e.step(i);n<0?i=r+1:i+=7&n}else i=t[1];o=t[1],c&&(s.push(n(this.pad(t))),a++)}return s}findUTF8(e){const t=this.executeEngine(GB.fromUTF8(e),0,BB.UNANCHORED,2);return null===t?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.executeEngine(GB.fromUTF8(e),0,BB.UNANCHORED,2);return null===t?null:t.slice(0,2)}find(e){const t=this.executeEngine(GB.fromUTF16(e),0,BB.UNANCHORED,2);return null===t?"":e.substring(t[0],t[1])}findIndex(e){return this.executeEngine(GB.fromUTF16(e),0,BB.UNANCHORED,2)}findUTF8Submatch(e){const t=this.executeEngine(GB.fromUTF8(e),0,BB.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<t.length&&t[2*s]>=0&&(n[s]=e.slice(t[2*s],t[2*s+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.executeEngine(GB.fromUTF8(e),0,BB.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.executeEngine(GB.fromUTF16(e),0,BB.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<t.length&&t[2*s]>=0&&(n[s]=e.substring(t[2*s],t[2*s+1]));return n}findSubmatchIndex(e){return this.pad(this.executeEngine(GB.fromUTF16(e),0,BB.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const n=this.allMatches(GB.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return 0===n.length?null:n}findAllUTF8Index(e,t){const n=this.allMatches(GB.fromUTF8(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAll(e,t){const n=this.allMatches(GB.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return 0===n.length?null:n}findAllIndex(e,t){const n=this.allMatches(GB.fromUTF16(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(e,t){const n=this.allMatches(GB.fromUTF8(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let s=0;s<n.length;s++)t[2*s]>=0&&(n[s]=e.slice(t[2*s],t[2*s+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(e,t){const n=this.allMatches(GB.fromUTF8(e),t);return 0===n.length?null:n}findAllSubmatch(e,t){const n=this.allMatches(GB.fromUTF16(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let s=0;s<n.length;s++)t[2*s]>=0&&(n[s]=e.substring(t[2*s],t[2*s+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(e,t){const n=this.allMatches(GB.fromUTF16(e),t);return 0===n.length?null:n}},$c=class e{static isHexadecimal(e){return"0"<=e&&e<="9"||"A"<=e&&e<="F"||"a"<=e&&e<="f"}static translate(t){let n="";if(t instanceof RegExp&&(t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t=t.source),"string"!=typeof t)return t;let s="",r=!1,i=t.length;0===i&&(s="(?:)",r=!0);let a=!1,o=0;for(;o<i;){let n=t[o];if("\\"===n){if(o+1<i)switch(n=t[o+1],n){case"\\":s+="\\\\",o+=2;continue;case"c":if(o+2<i){let e=t[o+2].charCodeAt(0);if(e>=65&&e<=90||e>=97&&e<=122){let t=e%32;s+="\\x",s+=(t>>4).toString(16).toUpperCase(),s+=(15&t).toString(16).toUpperCase(),o+=3,r=!0;continue}}s+="c",o+=2,r=!0;continue;case"u":if(o+2<i)if("{"===t[o+2]){let n=o+3,a=!1,B=!1;for(;n<i;){const s=t[n];if("}"===s){B=!0;break}if(!e.isHexadecimal(s))break;a=!0,n++}if(B&&a){s+="\\x",o+=2,r=!0;continue}}else if(o+5<i){let n=!0;for(let s=0;s<4;s++)if(!e.isHexadecimal(t[o+2+s])){n=!1;break}if(n){s+="\\x{"+t.substring(o+2,o+6)+"}",o+=6,r=!0;continue}}s+="u",o+=2,r=!0;continue;case"x":{let n=!1;if(o+2<i&&"{"===t[o+2]){let s=o+3,r=!1,a=!1;for(;s<i;){const n=t[s];if("}"===n){a=!0;break}if(!e.isHexadecimal(n))break;r=!0,s++}a&&r&&(n=!0)}else o+3<i&&e.isHexadecimal(t[o+2])&&e.isHexadecimal(t[o+3])&&(n=!0);n?(s+="\\x",o+=2):(s+="x",o+=2,r=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":s+="\\"+n,o+=2;continue;default:{let e=t.codePointAt(o+1);if(e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122){let n=SB.charCount(e);s+=t.substring(o+1,o+1+n),o+=n+1,r=!0}else{s+="\\";let n=SB.charCount(e);s+=t.substring(o+1,o+1+n),o+=n+1}continue}}}else{if("/"===n){s+="\\/",o+=1,r=!0;continue}if("["===n){if(!a&&"]"===t[o+1]){s+="[^\\x00-\\x{10FFFF}]",o+=2,r=!0;continue}if(!a&&"^"===t[o+1]&&"]"===t[o+2]){s+="[\\x00-\\x{10FFFF}]",o+=3,r=!0;continue}a=!0}else if("]"===n)a=!1;else if(!a&&"("===n&&o+2<i&&"?"===t[o+1]&&"<"===t[o+2]&&o+3<i&&!"=!>)".includes(t[o+3])){s+="(?P<",o+=3,r=!0;continue}}let B=t.codePointAt(o),c=SB.charCount(B);s+=t.substring(o,o+c),o+=c}const B=r?s:t;return n.length>0?`(?${n})${B}`:B}};const Jc=(e,t)=>{const n=e.matchArray();return n.index=e.start(0),n.input=t,n.groups=e.namedGroupsObject(),n};var qc=class e{static CASE_INSENSITIVE=cB;static DOTALL=lB;static MULTILINE=uB;static DISABLE_UNICODE_GROUPS=hB;static LONGEST_MATCH=pB;static LOOKBEHINDS=dB;static quote(e){return SB.quoteMeta(e)}static quoteReplacement(e,t=!1){return qB.quoteReplacement(e,t)}static translateRegExp(e){return $c.translate(e)}static compile(t,n=0){let s=t;if(0!==(n&e.CASE_INSENSITIVE)&&(s=`(?i)${s}`),0!==(n&e.DOTALL)&&(s=`(?s)${s}`),0!==(n&e.MULTILINE)&&(s=`(?m)${s}`),-544&n)throw new $B("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let r=BB.PERL;0!==(n&e.DISABLE_UNICODE_GROUPS)&&(r&=-129),0!==(n&e.LOOKBEHINDS)&&(r|=BB.LOOKBEHIND);const i=new e(t,n);return i.re2Input=jc.compileImpl(s,r,0!==(n&e.LONGEST_MATCH)),i}static matches(t,n){return e.compile(t).testExact(n)}static initTest(t,n,s){if(null==t)throw new Error("pattern is null");if(null==s)throw new Error("re2 is null");const r=new e(t,n);return r.re2Input=s,r}constructor(e,t){this.patternInput=e,this.flagsInput=t,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.testExact(e)}matcher(e){return SB.isByteArray(e)&&(e=xB.utf8(e)),new qB(this,e)}test(e){return SB.isByteArray(e)?this.re2Input.matchUTF8(e):this.re2Input.match(e)}testExact(e){const t=SB.isByteArray(e)?GB.fromUTF8(e):GB.fromUTF16(e);return null!==this.re2Input.executeEngine(t,0,BB.ANCHOR_BOTH,0)}exec(e){const t=this.matcher(e);return t.find()?Jc(t,e):null}split(e,t=0){const n=this.matcher(e),s=[];let r=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(t>0&&s.length===t-1)break;if(i===n.start()){if(0===t){r+=1,i=n.end();continue}}else for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===t&&i!==n.inputLength()){for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.inputLength()))}return 0===t&&(0!==s.length||i===n.inputLength()&&i>0)||s.push(n.substring(i,n.inputLength())),s}*matchAll(e){const t=this.matcher(e);for(;t.find();)yield Jc(t,e)}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e||null!==e&&this.constructor===e.constructor&&(this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput)}};let zc="12.19.0";const Kc=new us("@firebase/firestore");function Qc(){return Kc.logLevel}function Wc(e,...t){if(Kc.logLevel<=as.DEBUG){const n=t.map(Zc);Kc.debug(`Firestore (${zc}): ${e}`,...n)}}function Yc(e,...t){if(Kc.logLevel<=as.ERROR){const n=t.map(Zc);Kc.error(`Firestore (${zc}): ${e}`,...n)}}function Xc(e,...t){if(Kc.logLevel<=as.WARN){const n=t.map(Zc);Kc.warn(`Firestore (${zc}): ${e}`,...n)}}function Zc(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function el(e,t,n){let s="Unexpected state";"string"==typeof t?s=t:n=t,tl(e,s,n)}function tl(e,t,n){let s=`FIRESTORE (${zc}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{s+=" CONTEXT: "+JSON.stringify(n)}catch(e){s+=" CONTEXT: "+n}throw Yc(s),new Error(s)}function nl(e,t,n,s){let r="Unexpected state";"string"==typeof n?r=n:s=n,e||tl(t,r,s)}function sl(e,t){return e}function rl(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}class il{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=rl(40);for(let s=0;s<n.length;++s)t.length<20&&n[s]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[s]%62))}return t}}function al(e,t){return e<t?-1:e>t?1:0}function ol(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++){const n=e.charAt(s),r=t.charAt(s);if(n!==r)return ll(n)===ll(r)?al(n,r):ll(n)?1:-1}return al(e.length,t.length)}const Bl=55296,cl=57343;function ll(e){const t=e.charCodeAt(0);return t>=Bl&&t<=cl}function ul(e,t,n){return e.length===t.length&&e.every((e,s)=>n(e,t[s]))}class hl{constructor(e,t){this.comparator=e,this.root=t||dl.EMPTY}insert(e,t){return new hl(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,dl.BLACK,null,null))}remove(e){return new hl(this.comparator,this.root.remove(e,this.comparator).copy(null,null,dl.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(e,n.key);if(0===s)return t+n.left.size;s<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){const e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new pl(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new pl(this.root,e,this.comparator,!1)}getReverseIterator(){return new pl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new pl(this.root,e,this.comparator,!0)}}class pl{constructor(e,t,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&s&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class dl{constructor(e,t,n,s,r){this.key=e,this.value=t,this.color=null!=n?n:dl.RED,this.left=null!=s?s:dl.EMPTY,this.right=null!=r?r:dl.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,s,r){return new dl(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let s=this;const r=n(e,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(e,t,n),null):0===r?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return dl.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,t){let n,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===t(e,s.key)){if(s.right.isEmpty())return dl.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,dl.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,dl.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw el(43730,{key:this.key,value:this.value});if(this.right.isRed())throw el(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw el(27949);return e+(this.isRed()?0:1)}}dl.EMPTY=null,dl.RED=!0,dl.BLACK=!1,dl.EMPTY=new class{constructor(){this.size=0}get key(){throw el(57766)}get value(){throw el(16141)}get color(){throw el(16727)}get left(){throw el(29726)}get right(){throw el(36894)}copy(e,t,n,s,r){return this}insert(e,t,n){return new dl(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class fl{constructor(e){this.comparator=e,this.data=new hl(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Cl(this.data.getIterator())}getIteratorFrom(e){return new Cl(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof fl))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,s=n.getNext().key;if(0!==this.comparator(e,s))return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new fl(this.comparator);return t.data=e,t}}class Cl{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}const gl={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class ml extends jn{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}const wl="__name__";class El{constructor(e,t,n){void 0===t?t=0:t>e.length&&el(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&el(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===El.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof El?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++){const n=El.compareSegments(e.get(s),t.get(s));if(0!==n)return n}return al(e.length,t.length)}static compareSegments(e,t){const n=El.isNumericId(e),s=El.isNumericId(t);return n&&!s?-1:!n&&s?1:n&&s?El.extractNumericId(e).compare(El.extractNumericId(t)):ol(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Yo.fromString(e.substring(4,e.length-2))}}class yl extends El{construct(e,t,n){return new yl(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new ml(gl.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new yl(t)}static emptyPath(){return new yl([])}}const Dl=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let _l=class e extends El{construct(t,n,s){return new e(t,n,s)}static isValidIdentifier(e){return Dl.test(e)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===wl}static keyField(){return new e([wl])}static fromServerFormat(t){const n=[];let s="",r=0;const i=()=>{if(0===s.length)throw new ml(gl.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(s),s=""};let a=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new ml(gl.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new ml(gl.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);s+=e,r+=2}else"`"===e?(a=!a,r++):"."!==e||a?(s+=e,r++):(i(),r++)}if(i(),a)throw new ml(gl.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)}static emptyPath(){return new e([])}};class bl{constructor(e){this.fields=e,e.sort(_l.comparator)}static empty(){return new bl([])}unionWith(e){let t=new fl(_l.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new bl(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return ul(this.fields,e.fields,(e,t)=>e.isEqual(t))}}function vl(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Il(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Tl(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class Al{constructor(e){this.path=e}static fromPath(e){return new Al(yl.fromString(e))}static fromName(e){return new Al(yl.fromString(e).popFirst(5))}static empty(){return new Al(yl.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===yl.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return yl.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Al(new yl(e.slice()))}}function Ol(e){if(!Al.isDocumentKey(e))throw new ml(gl.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Sl(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function Nl(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":el(12329,{type:typeof e})}function Rl(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new ml(gl.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Nl(e);throw new ml(gl.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function kl(e,t){const n={typeString:e};return t&&(n.value=t),n}function Ll(e,t){if(!Sl(e))throw new ml(gl.INVALID_ARGUMENT,"JSON must be an object");let n;for(const s in t)if(t[s]){const r=t[s].typeString,i="value"in t[s]?{value:t[s].value}:void 0;if(!(s in e)){n=`JSON missing required field: '${s}'`;break}const a=e[s];if(r&&typeof a!==r){n=`JSON field '${s}' must be a ${r}.`;break}if(void 0!==i&&a!==i.value){n=`Expected '${s}' field to equal '${i.value}'`;break}}if(n)throw new ml(gl.INVALID_ARGUMENT,n);return!0}const xl=-62135596800,Fl=1e6;class Pl{static now(){return Pl.fromMillis(Date.now())}static fromDate(e){return Pl.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*Fl);return new Pl(t,n)}static fromInstant(e){if(!e||"bigint"!=typeof e.t)throw new ml(gl.INVALID_ARGUMENT,"Invalid Temporal.Instant object provided.");return Pl._fromEpochNanoseconds(e.t)}static _fromEpochNanoseconds(e){let t,n;if(e>=0n)t=Number(e/1000000000n),n=Number(e%1000000000n);else{const s=e%1000000000n;0n===s?(t=Number(e/1000000000n),n=0):(t=Number(e/1000000000n-1n),n=Number(s+1000000000n))}return new Pl(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new ml(gl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new ml(gl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<xl)throw new ml(gl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new ml(gl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Fl}toInstant(){if("undefined"==typeof Temporal||!Temporal.Instant)throw new ml(gl.FAILED_PRECONDITION,"The Temporal object is not available in the current environment.");const e=1000000000n*BigInt(this.seconds)+BigInt(this.nanoseconds);return Temporal.Instant.__PRIVATE_fromEpochNanoseconds(e)}_compareTo(e){return this.seconds===e.seconds?al(this.nanoseconds,e.nanoseconds):al(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:Pl._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ll(e,Pl._jsonSchema))return new Pl(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-xl;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Pl._jsonSchemaVersion="firestore/timestamp/1.0",Pl._jsonSchema={type:kl("string",Pl._jsonSchemaVersion),seconds:kl("number"),nanoseconds:kl("number")};class Ml extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class Gl{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Ml("Invalid base64 string: "+e):e}}(e);return new Gl(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new Gl(t)}[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(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return al(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Gl.EMPTY_BYTE_STRING=new Gl("");const Ul=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Hl(e){if(nl(!!e,39018),"string"==typeof e){let t=0;const n=Ul.exec(e);if(nl(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const s=new Date(e);return{seconds:Math.floor(s.getTime()/1e3),nanos:t}}return{seconds:Vl(e.seconds),nanos:Vl(e.nanos)}}function Vl(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function jl(e){return"string"==typeof e?Gl.fromBase64String(e):Gl.fromUint8Array(e)}const $l="server_timestamp",Jl="__type__",ql="__previous_value__",zl="__local_write_time__";function Kl(e){const t=(e?.mapValue?.fields||{})[Jl]?.stringValue;return t===$l}function Ql(e){const t=e.mapValue.fields[ql];return Kl(t)?Ql(t):t}function Wl(e){const t=Hl(e.mapValue.fields[zl].timestampValue);return new Pl(t.seconds,t.nanos)}class Yl{constructor(e,t,n,s,r,i,a,o,B,c,l,u,h){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=B,this.isUsingEmulator=c,this.apiKey=l,this._customHeaders=u,this.grpcFlowControlWindow=h}}const Xl="(default)";class Zl{constructor(e,t){this.projectId=e,this.database=t||Xl}static empty(){return new Zl("","")}get isDefaultDatabase(){return this.database===Xl}isEqual(e){return e instanceof Zl&&e.projectId===this.projectId&&e.database===this.database}}function eu(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new ml(gl.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Zl(e.options.projectId,t)}function tu(e){return null==e}function nu(e){return 0===e&&1/e==-1/0}const su="__type__",ru="__max__",iu={},au="__vector__",ou="value",Bu={nullValue:"NULL_VALUE"},cu={booleanValue:!0},lu={booleanValue:!1};function uu(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?Kl(e)?4:function(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===ru}(e)?9007199254740991:Tu(e)?10:11:el(28295,{value:e})}function hu(e,t,n){if(e===t)return!0;const s=uu(e);if(s!==uu(t))return!1;switch(s){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Wl(e).isEqual(Wl(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Hl(e.timestampValue),s=Hl(t.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return jl(e.bytesValue).isEqual(jl(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Vl(e.geoPointValue.latitude)===Vl(t.geoPointValue.latitude)&&Vl(e.geoPointValue.longitude)===Vl(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if("integerValue"in e&&"integerValue"in t)return Vl(e.integerValue)===Vl(t.integerValue);let s,r;if("doubleValue"in e&&"doubleValue"in t)s=Vl(e.doubleValue),r=Vl(t.doubleValue);else{if(!n?.i)return!1;s=Vl(e.integerValue??e.doubleValue),r=Vl(t.integerValue??t.doubleValue)}return s===r?!!n?.o||nu(s)===nu(r):!(void 0!==n&&!n.u)&&isNaN(s)&&isNaN(r)}(e,t,n);case 9:return ul(e.arrayValue.values||[],t.arrayValue.values||[],(e,t)=>hu(e,t,n));case 10:case 11:return function(e,t,n){const s=e.mapValue.fields||{},r=t.mapValue.fields||{};if(vl(s)!==vl(r))return!1;for(const e in s)if(s.hasOwnProperty(e)&&(void 0===r[e]||!hu(s[e],r[e],n)))return!1;return!0}(e,t,n);default:return el(52216,{left:e})}}function pu(e,t){return void 0!==(e.values||[]).find(e=>hu(e,t))}function du(e,t){if(e===t)return 0;const n=uu(e),s=uu(t);if(n!==s)return al(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return al(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vl(e.integerValue||e.doubleValue),s=Vl(t.integerValue||t.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(e,t);case 3:return fu(e.timestampValue,t.timestampValue);case 4:return fu(Wl(e),Wl(t));case 5:return ol(e.stringValue,t.stringValue);case 6:return function(e,t){const n=jl(e),s=jl(t);return n.compareTo(s)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),s=t.split("/");for(let e=0;e<n.length&&e<s.length;e++){const t=al(n[e],s[e]);if(0!==t)return t}return al(n.length,s.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=al(Vl(e.latitude),Vl(t.latitude));return 0!==n?n:al(Vl(e.longitude),Vl(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return Cu(e.arrayValue,t.arrayValue);case 10:return function(e,t){const n=e.fields||{},s=t.fields||{},r=n[ou]?.arrayValue,i=s[ou]?.arrayValue,a=al(r?.values?.length||0,i?.values?.length||0);return 0!==a?a:Cu(r,i)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===iu&&t===iu)return 0;if(e===iu)return 1;if(t===iu)return-1;const n=e.fields||{},s=Object.keys(n),r=t.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let e=0;e<s.length&&e<i.length;++e){const t=ol(s[e],i[e]);if(0!==t)return t;const a=du(n[s[e]],r[i[e]]);if(0!==a)return a}return al(s.length,i.length)}(e.mapValue,t.mapValue);default:throw el(23264,{l:n})}}function fu(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return al(e,t);const n=Hl(e),s=Hl(t),r=al(n.seconds,s.seconds);return 0!==r?r:al(n.nanos,s.nanos)}function Cu(e,t){const n=e.values||[],s=t.values||[];for(let e=0;e<n.length&&e<s.length;++e){const t=du(n[e],s[e]);if(void 0!==t&&0!==t)return t}return al(n.length,s.length)}function gu(e){return mu(e)}function mu(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Hl(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return jl(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return Al.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const s of e.values||[])n?n=!1:t+=",",t+=mu(s);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",s=!0;for(const r of t)s?s=!1:n+=",",n+=`${r}:${mu(e.fields[r])}`;return n+"}"}(e.mapValue):el(61005,{value:e})}function wu(e){switch(uu(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Ql(e);return t?16+wu(t):16;case 5:return 2*e.stringValue.length;case 6:return jl(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+wu(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return Il(e.fields,(e,n)=>{t+=e.length+wu(n)}),t}(e.mapValue);default:throw el(13486,{value:e})}}function Eu(e){return!!e&&"integerValue"in e}function yu(e){return!!e&&"doubleValue"in e}function Du(e){return Eu(e)||yu(e)}function _u(e){return!!e&&"arrayValue"in e}function bu(e){return!!e&&"nullValue"in e}function vu(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Iu(e){return!!e&&"mapValue"in e}function Tu(e){const t=(e?.mapValue?.fields||{})[su]?.stringValue;return t===au}function Au(e){return(e?.mapValue?.fields||{})[ou]?.arrayValue}function Ou(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:{...e.timestampValue}};if(e.mapValue){const t={mapValue:{fields:{}}};return Il(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=Ou(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=Ou(e.arrayValue.values[n]);return t}return{...e}}class Su{constructor(e){this.value=e}static empty(){return new Su({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Iu(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ou(t)}setAll(e){let t=_l.emptyPath(),n={},s=[];e.forEach((e,r)=>{if(!t.isImmediateParentOf(r)){const e=this.getFieldsMap(t);this.applyChanges(e,n,s),n={},s=[],t=r.popLast()}e?n[r.lastSegment()]=Ou(e):s.push(r.lastSegment())});const r=this.getFieldsMap(t);this.applyChanges(r,n,s)}delete(e){const t=this.field(e.popLast());Iu(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return hu(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let s=t.mapValue.fields[e.get(n)];Iu(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){Il(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new Su(Ou(this.value))}}function Nu(e){const t=[];return Il(e.fields,(e,n)=>{const s=new _l([e]);if(Iu(n)){const e=Nu(n.mapValue).fields;if(0===e.length)t.push(s);else for(const n of e)t.push(s.child(n))}else t.push(s)}),new bl(t)}function Ru(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:nu(t)?"-0":t}}function ku(e){return{integerValue:""+e}}function Lu(e,t,n){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!nu(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}(t)?ku(t):Ru(e,t)}class xu{constructor(){this._=void 0}}function Fu(e,t,n){return e instanceof Gu?function(e,t){const n={fields:{[Jl]:{stringValue:$l},[zl]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Kl(t)&&(t=Ql(t)),t&&(n.fields[ql]=t),{mapValue:n}}(n,t):e instanceof Uu?Hu(e,t):e instanceof Vu?ju(e,t):e instanceof Ju?function(e,t){const n=Mu(e,t),s=Qu(n)+Qu(e.h);return Eu(n)&&Eu(e.h)?ku(s):Ru(e.serializer,s)}(e,t):e instanceof qu?function(e,t){return Ku(e,t,Math.min)}(e,t):e instanceof zu?function(e,t){return Ku(e,t,Math.max)}(e,t):void 0}function Pu(e,t,n){return e instanceof Uu?Hu(e,t):e instanceof Vu?ju(e,t):n}function Mu(e,t){return e instanceof Ju?Du(t)?t:{integerValue:0}:null}class Gu extends xu{}class Uu extends xu{constructor(e){super(),this.elements=e}}function Hu(e,t){const n=Wu(t);for(const t of e.elements)n.some(e=>hu(e,t))||n.push(t);return{arrayValue:{values:n}}}class Vu extends xu{constructor(e){super(),this.elements=e}}function ju(e,t){let n=Wu(t);for(const t of e.elements)n=n.filter(e=>!hu(e,t));return{arrayValue:{values:n}}}class $u extends xu{constructor(e,t){super(),this.serializer=e,this.h=t}}class Ju extends $u{}class qu extends $u{}class zu extends $u{}function Ku(e,t,n){if(!Du(t))return e.h;const s=n(Qu(t),Qu(e.h));return Eu(t)&&Eu(e.h)?ku(s):Ru(e.serializer,s)}function Qu(e){return Vl(e.integerValue||e.doubleValue)}function Wu(e){return _u(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Yu{constructor(e,t){this.version=e,this.transformResults=t}}class Xu{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Xu}static exists(e){return new Xu(void 0,e)}static updateTime(e){return new Xu(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Zu(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class eh{}function th(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new uh(e.key,Xu.none()):new ah(e.key,e.data,Xu.none());{const n=e.data,s=Su.empty();let r=new fl(_l.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?s.delete(e):s.set(e,t),r=r.add(e)}return new oh(e.key,s,new bl(r.toArray()),Xu.none())}}function nh(e,t,n){e instanceof ah?function(e,t,n){const s=e.value.clone(),r=ch(e.fieldTransforms,t,n.transformResults);s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):e instanceof oh?function(e,t,n){if(!Zu(e.precondition,t))return void t.convertToUnknownDocument(n.version);const s=ch(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(Bh(e)),r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function sh(e,t,n,s){return e instanceof ah?function(e,t,n,s){if(!Zu(e.precondition,t))return n;const r=e.value.clone(),i=lh(e.fieldTransforms,s,t);return r.setAll(i),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,s):e instanceof oh?function(e,t,n,s){if(!Zu(e.precondition,t))return n;const r=lh(e.fieldTransforms,s,t),i=t.data;return i.setAll(Bh(e)),i.setAll(r),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,s):function(e,t,n){return Zu(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function rh(e,t){let n=null;for(const s of e.fieldTransforms){const e=t.data.field(s.field),r=Mu(s.transform,e||null);null!=r&&(null===n&&(n=Su.empty()),n.set(s.field,r))}return n||null}function ih(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&ul(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Uu&&t instanceof Uu||e instanceof Vu&&t instanceof Vu?ul(e.elements,t.elements,hu):e instanceof Ju&&t instanceof Ju||e instanceof qu&&t instanceof qu||e instanceof zu&&t instanceof zu?hu(e.h,t.h):e instanceof Gu&&t instanceof Gu}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class ah extends eh{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class oh extends eh{constructor(e,t,n,s,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function Bh(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const s=e.data.field(n);t.set(n,s)}}),t}function ch(e,t,n){const s=new Map;nl(e.length===n.length,32656,{T:n.length,P:e.length});for(let r=0;r<n.length;r++){const i=e[r],a=i.transform,o=t.data.field(i.field);s.set(i.field,Pu(a,o,n[r]))}return s}function lh(e,t,n){const s=new Map;for(const r of e){const e=r.transform,i=n.data.field(r.field);s.set(r.field,Fu(e,i,t))}return s}class uh extends eh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class hh extends eh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class ph{constructor(e,t){this.position=e,this.inclusive=t}}function dh(e,t,n){let s=0;for(let r=0;r<e.position.length;r++){const i=t[r],a=e.position[r];if(s=i.field.isKeyField()?Al.comparator(Al.fromName(a.referenceValue),n.key):du(a,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function fh(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!hu(e.position[n],t.position[n]))return!1;return!0}class Ch{}class gh extends Ch{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new bh(e,t,n):"array-contains"===t?new Ah(e,n):"in"===t?new Oh(e,n):"not-in"===t?new Sh(e,n):"array-contains-any"===t?new Nh(e,n):new gh(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new vh(e,n):new Ih(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(du(t,this.value)):null!==t&&uu(this.value)===uu(t)&&this.matchesComparison(du(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return el(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class mh extends Ch{constructor(e,t){super(),this.filters=e,this.op=t,this.I=null}static create(e,t){return new mh(e,t)}matches(e){return wh(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.I||(this.I=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.I}getFilters(){return Object.assign([],this.filters)}}function wh(e){return"and"===e.op}function Eh(e){return function(e){for(const t of e.filters)if(t instanceof mh)return!1;return!0}(e)&&wh(e)}function yh(e){if(e instanceof gh)return e.field.canonicalString()+e.op.toString()+gu(e.value);if(Eh(e))return e.filters.map(e=>yh(e)).join(",");{const t=e.filters.map(e=>yh(e)).join(",");return`${e.op}(${t})`}}function Dh(e,t){return e instanceof gh?function(e,t){return t instanceof gh&&e.op===t.op&&e.field.isEqual(t.field)&&hu(e.value,t.value)}(e,t):e instanceof mh?function(e,t){return t instanceof mh&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,s)=>e&&Dh(n,t.filters[s]),!0)}(e,t):void el(19439)}function _h(e){return e instanceof gh?function(e){return`${e.field.canonicalString()} ${e.op} ${gu(e.value)}`}(e):e instanceof mh?function(e){return e.op.toString()+" {"+e.getFilters().map(_h).join(" ,")+"}"}(e):"Filter"}class bh extends gh{constructor(e,t,n){super(e,t,n),this.key=Al.fromName(n.referenceValue)}matches(e){const t=Al.comparator(e.key,this.key);return this.matchesComparison(t)}}class vh extends gh{constructor(e,t){super(e,"in",t),this.keys=Th("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Ih extends gh{constructor(e,t){super(e,"not-in",t),this.keys=Th("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Th(e,t){return(t.arrayValue?.values||[]).map(e=>Al.fromName(e.referenceValue))}class Ah extends gh{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return _u(t)&&pu(t.arrayValue,this.value)}}class Oh extends gh{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&pu(this.value.arrayValue,t)}}class Sh extends gh{constructor(e,t){super(e,"not-in",t)}matches(e){if(pu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!pu(this.value.arrayValue,t)}}class Nh extends gh{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!_u(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>pu(this.value.arrayValue,e))}}class Rh{constructor(e,t="asc"){this.field=e,this.dir=t}}function kh(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class Lh{static fromTimestamp(e){return new Lh(e)}static min(){return new Lh(new Pl(0,0))}static max(){return new Lh(new Pl(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}}class xh{constructor(e,t,n,s,r,i,a){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=a}static newInvalidDocument(e){return new xh(e,0,Lh.min(),Lh.min(),Lh.min(),Su.empty(),0)}static newFoundDocument(e,t,n,s){return new xh(e,1,t,Lh.min(),n,s,0)}static newNoDocument(e,t){return new xh(e,2,t,Lh.min(),Lh.min(),Su.empty(),0)}static newUnknownDocument(e,t){return new xh(e,3,t,Lh.min(),Lh.min(),Su.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Lh.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Su.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Su.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Lh.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof xh&&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 xh(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}})`}}function Fh(e){return new Ph(e.readTime,e.key,-1)}class Ph{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new Ph(Lh.min(),Al.empty(),-1)}static max(){return new Ph(Lh.max(),Al.empty(),-1)}}function Mh(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=Al.comparator(e.documentKey,t.documentKey),0!==n?n:al(e.largestBatchId,t.largestBatchId))}class Gh{constructor(e,t=null,n=[],s=[],r=null,i=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=a,this.R=null}}function Uh(e,t=null,n=[],s=[],r=null,i=null,a=null){return new Gh(e,t,n,s,r,i,a)}function Hh(e){const t=sl(e);if(null===t.R){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>yh(e)).join(","),e+="|ob:",e+=t.orderBy.map(e=>function(e){return e.field.canonicalString()+e.dir}(e)).join(","),tu(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(e=>gu(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>gu(e)).join(",")),t.R=e}return t.R}function Vh(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!kh(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Dh(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!fh(e.startAt,t.startAt)&&fh(e.endAt,t.endAt)}class jh{constructor(e,t=null,n=[],s=[],r=null,i="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=a,this.endAt=o,this.A=null,this.V=null,this.m=null,this.startAt,this.endAt}}function $h(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Jh(e){const t=sl(e);if(null===t.A){t.A=[];const e=new Set;for(const n of t.explicitOrderBy)t.A.push(n),e.add(n.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",s=function(e){let t=new fl(_l.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);s.forEach(s=>{e.has(s.canonicalString())||s.isKeyField()||t.A.push(new Rh(s,n))}),e.has(_l.keyField().canonicalString())||t.A.push(new Rh(_l.keyField(),n))}return t.A}function qh(e){const t=sl(e);return t.V||(t.V=function(e,t){if("F"===e.limitType)return Uh(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{const t="desc"===e.dir?"asc":"desc";return new Rh(e.field,t)});const n=e.endAt?new ph(e.endAt.position,e.endAt.inclusive):null,s=e.startAt?new ph(e.startAt.position,e.startAt.inclusive):null;return Uh(e.path,e.collectionGroup,t,e.filters,e.limit,n,s)}}(t,Jh(e))),t.V}function zh(e,t,n){return new jh(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Kh(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map(e=>_h(e)).join(", ")}]`),tu(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map(e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e)).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>gu(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>gu(e)).join(",")),`Target(${t})`}(qh(e))}; limitType=${e.limitType})`}function Qh(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Al.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Jh(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const s=dh(e,t,n);return e.inclusive?s<=0:s<0}(e.startAt,Jh(e),t))&&!(e.endAt&&!function(e,t,n){const s=dh(e,t,n);return e.inclusive?s>=0:s>0}(e.endAt,Jh(e),t))}(e,t)}function Wh(e){return(t,n)=>{let s=!1;for(const r of Jh(e)){const e=Yh(r,t,n);if(0!==e)return e;s=s||r.field.isKeyField()}return 0}}function Yh(e,t,n){const s=e.field.isKeyField()?Al.comparator(t.key,n.key):function(e,t,n){const s=t.data.field(e),r=n.data.field(e);return null!==s&&null!==r?du(s,r):el(42886)}(e.field,t,n);switch(e.dir){case"asc":return s;case"desc":return-1*s;default:return el(19790,{direction:e.dir})}}var Xh,Zh;function ep(e){if(void 0===e)return Yc("GRPC error has no .code"),gl.UNKNOWN;switch(e){case Xh.OK:return gl.OK;case Xh.CANCELLED:return gl.CANCELLED;case Xh.UNKNOWN:return gl.UNKNOWN;case Xh.DEADLINE_EXCEEDED:return gl.DEADLINE_EXCEEDED;case Xh.RESOURCE_EXHAUSTED:return gl.RESOURCE_EXHAUSTED;case Xh.INTERNAL:return gl.INTERNAL;case Xh.UNAVAILABLE:return gl.UNAVAILABLE;case Xh.UNAUTHENTICATED:return gl.UNAUTHENTICATED;case Xh.INVALID_ARGUMENT:return gl.INVALID_ARGUMENT;case Xh.NOT_FOUND:return gl.NOT_FOUND;case Xh.ALREADY_EXISTS:return gl.ALREADY_EXISTS;case Xh.PERMISSION_DENIED:return gl.PERMISSION_DENIED;case Xh.FAILED_PRECONDITION:return gl.FAILED_PRECONDITION;case Xh.ABORTED:return gl.ABORTED;case Xh.OUT_OF_RANGE:return gl.OUT_OF_RANGE;case Xh.UNIMPLEMENTED:return gl.UNIMPLEMENTED;case Xh.DATA_LOSS:return gl.DATA_LOSS;default:return el(39323,{code:e})}}(Zh=Xh||(Xh={}))[Zh.OK=0]="OK",Zh[Zh.CANCELLED=1]="CANCELLED",Zh[Zh.UNKNOWN=2]="UNKNOWN",Zh[Zh.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Zh[Zh.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Zh[Zh.NOT_FOUND=5]="NOT_FOUND",Zh[Zh.ALREADY_EXISTS=6]="ALREADY_EXISTS",Zh[Zh.PERMISSION_DENIED=7]="PERMISSION_DENIED",Zh[Zh.UNAUTHENTICATED=16]="UNAUTHENTICATED",Zh[Zh.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Zh[Zh.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Zh[Zh.ABORTED=10]="ABORTED",Zh[Zh.OUT_OF_RANGE=11]="OUT_OF_RANGE",Zh[Zh.UNIMPLEMENTED=12]="UNIMPLEMENTED",Zh[Zh.INTERNAL=13]="INTERNAL",Zh[Zh.UNAVAILABLE=14]="UNAVAILABLE",Zh[Zh.DATA_LOSS=15]="DATA_LOSS";class tp{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,s]of n)if(this.equalsFn(t,e))return s}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),s=this.inner[n];if(void 0===s)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],e))return void(s[n]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return 1===n.length?delete this.inner[t]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Il(this.inner,(t,n)=>{for(const[t,s]of n)e(t,s)})}isEmpty(){return Tl(this.inner)}size(){return this.innerSize}}const np=new hl(Al.comparator);function sp(){return np}const rp=new hl(Al.comparator);function ip(...e){let t=rp;for(const n of e)t=t.insert(n.key,n);return t}function ap(e){let t=rp;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function op(){return cp()}function Bp(){return cp()}function cp(){return new tp(e=>e.toString(),(e,t)=>e.isEqual(t))}const lp=new hl(Al.comparator),up=new fl(Al.comparator);function hp(...e){let t=up;for(const n of e)t=t.add(n);return t}const pp=new fl(al);new Yo([4294967295,4294967295],0);class dp{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function fp(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Cp(e){const t=Hl(e);return new Pl(t.seconds,t.nanos)}function gp(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function mp(e,t){return fp(e,t.toTimestamp())}function wp(e){return nl(!!e,49232),Lh.fromTimestamp(Cp(e))}function Ep(e,t){return yp(e,t).canonicalString()}function yp(e,t){const n=function(e){return new yl(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Dp(e,t){return Ep(e.databaseId,t.path)}function _p(e){const t=function(e){const t=yl.fromString(e);return nl(function(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}(t),10190,{key:t.toString()}),t}(e);return 4===t.length?yl.emptyPath():function(e){return nl(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}(t)}function bp(e,t,n){return{name:Dp(e,t),fields:n.value.mapValue.fields}}function vp(e){let t=_p(e.parent);const n=e.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){nl(1===s,65062);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=Ip(e);return t instanceof mh&&Eh(t)?t.getFilters():[t]}(n.where));let a=[];n.orderBy&&(a=function(e){return e.map(e=>function(e){return new Rh(Tp(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let o=null;n.limit&&(o=function(e){let t;return t="object"==typeof e?e.value:e,tu(t)?null:t}(n.limit));let B=null;n.startAt&&(B=function(e){const t=!!e.before,n=e.values||[];return new ph(n,t)}(n.startAt));let c=null;return n.endAt&&(c=function(e){const t=!e.before,n=e.values||[];return new ph(n,t)}(n.endAt)),function(e,t,n,s,r,i,a,o){return new jh(e,t,n,s,r,i,a,o)}(t,r,a,i,o,"F",B,c)}function Ip(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Tp(e.unaryFilter.field);return gh.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Tp(e.unaryFilter.field);return gh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=Tp(e.unaryFilter.field);return gh.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=Tp(e.unaryFilter.field);return gh.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return el(61313);default:return el(60726)}}(e):void 0!==e.fieldFilter?function(e){return gh.create(Tp(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return el(58110);default:return el(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return mh.create(e.compositeFilter.filters.map(e=>Ip(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return el(1026)}}(e.compositeFilter.op))}(e):el(30097,{filter:e})}function Tp(e){return _l.fromServerFormat(e.fieldPath)}function Ap(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Op(e){return!!e&&"function"==typeof e._toProto&&"ProtoValue"===e._protoValueType}function Sp(e,t){const n={fields:{}};return t.forEach((t,s)=>{if("string"!=typeof s)throw new Error(`Cannot encode map with non-string key: ${s}`);n.fields[s]=t._toProto(e)}),{mapValue:n}}function Np(e){return{stringValue:e}}function Rp(e){return new dp(e,!0)}class kp{constructor(e){this._byteString=e}static fromBase64String(e){try{return new kp(Gl.fromBase64String(e))}catch(e){throw new ml(gl.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new kp(Gl.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:kp._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ll(e,kp._jsonSchema))return kp.fromBase64String(e.bytes)}}kp._jsonSchemaVersion="firestore/bytes/1.0",kp._jsonSchema={type:kl("string",kp._jsonSchemaVersion),bytes:kl("string")};class Lp{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new ml(gl.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new _l(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class xp{constructor(e){this._methodName=e}}class Fp{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new ml(gl.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new ml(gl.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return al(this._lat,e._lat)||al(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Fp._jsonSchemaVersion}}static fromJSON(e){if(Ll(e,Fp._jsonSchema))return new Fp(e.latitude,e.longitude)}}Fp._jsonSchemaVersion="firestore/geoPoint/1.0",Fp._jsonSchema={type:kl("string",Fp._jsonSchemaVersion),latitude:kl("number"),longitude:kl("number")};class Pp{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Pp.UNAUTHENTICATED=new Pp(null),Pp.GOOGLE_CREDENTIALS=new Pp("google-credentials-uid"),Pp.FIRST_PARTY=new Pp("first-party-uid"),Pp.MOCK_USER=new Pp("mock-user");class Mp{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class Gp{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Up{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Pp.UNAUTHENTICATED))}shutdown(){}}class Hp{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Vp{constructor(e){this.De=e,this.currentUser=Pp.UNAUTHENTICATED,this.xe=0,this.forceRefresh=!1,this.auth=null}start(e,t){nl(void 0===this.Ce,42304);let n=this.xe;const s=e=>this.xe!==n?(n=this.xe,t(e)):Promise.resolve();let r=new Mp;this.Ce=()=>{this.xe++,this.currentUser=this.Fe(),r.resolve(),r=new Mp,e.enqueueRetryable(()=>s(this.currentUser))};const i=()=>{const t=r;e.enqueueRetryable(async()=>{await t.promise,await s(this.currentUser)})},a=e=>{Wc("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.Ce&&(this.auth.addAuthTokenListener(this.Ce),i())};this.De.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){const e=this.De.getImmediate({optional:!0});e?a(e):(Wc("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Mp)}},0),i()}getToken(){const e=this.xe,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.xe!==e?(Wc("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(nl("string"==typeof t.accessToken,31837,{Oe:t}),new Gp(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.Ce&&this.auth.removeAuthTokenListener(this.Ce),this.Ce=void 0}Fe(){const e=this.auth&&this.auth.getUid();return nl(null===e||"string"==typeof e,2055,{Me:e}),new Pp(e)}}class jp{constructor(e,t,n){this.Ne=e,this.Le=t,this.Be=n,this.type="FirstParty",this.user=Pp.FIRST_PARTY,this.Ue=new Map}ke(){return this.Be?this.Be():null}get headers(){this.Ue.set("X-Goog-AuthUser",this.Ne);const e=this.ke();return e&&this.Ue.set("Authorization",e),this.Le&&this.Ue.set("X-Goog-Iam-Authorization-Token",this.Le),this.Ue}}class $p{constructor(e,t,n){this.Ne=e,this.Le=t,this.Be=n}getToken(){return Promise.resolve(new jp(this.Ne,this.Le,this.Be))}start(e,t){e.enqueueRetryable(()=>t(Pp.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Jp{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class qp{constructor(e,t){this.qe=t,this.forceRefresh=!1,this.appCheck=null,this.$e=null,this.Ke=null,pr(e)&&e.settings.appCheckToken&&(this.Ke=e.settings.appCheckToken)}start(e,t){nl(void 0===this.Ce,3512);const n=e=>{null!=e.error&&Wc("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.$e;return this.$e=e.token,Wc("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.Ce=t=>{e.enqueueRetryable(()=>n(t))};const s=e=>{Wc("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.Ce&&this.appCheck.addTokenListener(this.Ce)};this.qe.onInit(e=>s(e)),setTimeout(()=>{if(!this.appCheck){const e=this.qe.getImmediate({optional:!0});e?s(e):Wc("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.Ke)return Promise.resolve(new Jp(this.Ke));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(nl("string"==typeof e.token,44558,{tokenResult:e}),this.$e=e.token,new Jp(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.Ce&&this.appCheck.removeTokenListener(this.Ce),this.Ce=void 0}}function zp(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}class Kp{Qe(e){}shutdown(){}}const Qp="ConnectivityMonitor";class Wp{constructor(){this.We=()=>this.Ge(),this.ze=()=>this.je(),this.He=[],this.Je()}Qe(e){this.He.push(e)}shutdown(){window.removeEventListener("online",this.We),window.removeEventListener("offline",this.ze)}Je(){window.addEventListener("online",this.We),window.addEventListener("offline",this.ze)}Ge(){Wc(Qp,"Network connectivity changed: AVAILABLE");for(const e of this.He)e(0)}je(){Wc(Qp,"Network connectivity changed: UNAVAILABLE");for(const e of this.He)e(1)}static Ye(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let Yp=null;function Xp(){return null===Yp?Yp=268435456+Math.round(2147483648*Math.random()):Yp++,"0x"+Yp.toString(16)}const Zp="RestConnection",ed={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class td{get Ze(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Xe=t+"://"+e.host,this.et=`projects/${n}/databases/${s}`,this.tt=this.databaseId.database===Xl?`project_id=${n}`:`project_id=${n}&database_id=${s}`}nt(e,t,n,s,r){const i=Xp(),a=this.rt(e,t.toUriEncodedString());Wc(Zp,`Sending RPC '${e}' ${i}:`,a,n);const o={"google-cloud-resource-prefix":this.et,"x-goog-request-params":this.tt};this.it(o,s,r);const{host:B}=new URL(a),c=es(B);return this.st(e,a,o,n,c).then(t=>(Wc(Zp,`Received RPC '${e}' ${i}: `,t),t),t=>{throw Xc(Zp,`RPC '${e}' ${i} failed with error: `,t,"url: ",a,"request:",n),t})}_t(e,t,n,s,r,i){return this.nt(e,t,n,s,r)}it(e,t,n){if(e["X-Goog-Api-Client"]="gl-js/ fire/"+zc,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t),this.databaseInfo._customHeaders)for(const t of Object.keys(this.databaseInfo._customHeaders))e[t]=this.databaseInfo._customHeaders[t]}rt(e,t){const n=ed[e];let s=`${this.Xe}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}class nd{constructor(e){this.ot=e.ot,this.ut=e.ut}ct(e){this.lt=e}Et(e){this.ht=e}Tt(e){this.Pt=e}onMessage(e){this.It=e}close(){this.ut()}send(e){this.ot(e)}Rt(){this.lt()}At(){this.ht()}Vt(e){this.Pt(e)}dt(e){this.It(e)}}const sd="WebChannelConnection",rd=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};class id extends td{constructor(e){super(e),this.ft=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static gt(){if(!id.yt){const e=iB();rd(e,rB.STAT_EVENT,e=>{e.stat===sB.PROXY?Wc(sd,"STAT_EVENT: detected buffering proxy"):e.stat===sB.NOPROXY&&Wc(sd,"STAT_EVENT: detected no buffering proxy")}),id.yt=!0}}st(e,t,n,s,r){const i=Xp();return new Promise((r,a)=>{const o=new Zo;o.setWithCredentials(!0),o.listenOnce(tB.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case nB.NO_ERROR:const t=o.getResponseJson();Wc(sd,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),r(t);break;case nB.TIMEOUT:Wc(sd,`RPC '${e}' ${i} timed out`),a(new ml(gl.DEADLINE_EXCEEDED,"Request time out"));break;case nB.HTTP_ERROR:const n=o.getStatus();if(Wc(sd,`RPC '${e}' ${i} failed with status:`,n,"response text:",o.getResponseText()),n>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=e?.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(gl).indexOf(t)>=0?t:gl.UNKNOWN}(t.status);a(new ml(e,t.message))}else a(new ml(gl.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new ml(gl.UNAVAILABLE,"Connection failed."));break;default:el(9055,{wt:e,streamId:i,bt:o.getLastErrorCode(),St:o.getLastError()})}}finally{Wc(sd,`RPC '${e}' ${i} completed.`)}});const B=JSON.stringify(s);Wc(sd,`RPC '${e}' ${i} sending request:`,s),o.send(t,"POST",B,n,15)})}vt(e,t,n){const s=Xp(),r=[this.Xe,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=this.createWebChannelTransport(),a={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},o=this.longPollingOptions.timeoutSeconds;void 0!==o&&(a.longPollingTimeout=Math.round(1e3*o)),this.useFetchStreams&&(a.useFetchStreams=!0),this.it(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const B=r.join("");Wc(sd,`Creating RPC '${e}' stream ${s}: ${B}`,a);const c=i.createWebChannel(B,a);this.Dt(c);let l=!1,u=!1;const h=new nd({ot:t=>{u?Wc(sd,`Not sending because RPC '${e}' stream ${s} is closed:`,t):(l||(Wc(sd,`Opening RPC '${e}' stream ${s} transport.`),c.open(),l=!0),Wc(sd,`RPC '${e}' stream ${s} sending:`,t),c.send(t))},ut:()=>c.close()});return rd(c,eB.EventType.OPEN,()=>{u||(Wc(sd,`RPC '${e}' stream ${s} transport opened.`),h.Rt())}),rd(c,eB.EventType.CLOSE,()=>{u||(u=!0,Wc(sd,`RPC '${e}' stream ${s} transport closed`),h.Vt(),this.xt(c))}),rd(c,eB.EventType.ERROR,t=>{u||(u=!0,Xc(sd,`RPC '${e}' stream ${s} transport errored. Name:`,t.name,"Message:",t.message),h.Vt(new ml(gl.UNAVAILABLE,"The operation could not be completed")))}),rd(c,eB.EventType.MESSAGE,t=>{if(!u){const n=t.data[0];nl(!!n,16349);const r=n,i=r?.error||r[0]?.error;if(i){Wc(sd,`RPC '${e}' stream ${s} received error:`,i);const t=i.status;let n=function(e){const t=Xh[e];if(void 0!==t)return ep(t)}(t),r=i.message;"NOT_FOUND"===t&&r.includes("database")&&r.includes("does not exist")&&r.includes(this.databaseId.database)&&Xc(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=gl.INTERNAL,r="Unknown error status: "+t+" with message "+i.message),u=!0,h.Vt(new ml(n,r)),c.close()}else Wc(sd,`RPC '${e}' stream ${s} received:`,n),h.dt(n)}}),id.gt(),setTimeout(()=>{h.At()},0),h}terminate(){this.ft.forEach(e=>e.close()),this.ft=[]}Dt(e){this.ft.push(e)}xt(e){this.ft=this.ft.filter(t=>t===e)}it(e,t,n){super.it(e,t,n),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return aB()}}id.yt=!1;class ad{constructor(e,t,n=1e3,s=1.5,r=6e4){this.Ct=e,this.timerId=t,this.Ft=n,this.Ot=s,this.Mt=r,this.Nt=0,this.Lt=null,this.Bt=Date.now(),this.reset()}reset(){this.Nt=0}Ut(){this.Nt=this.Mt}kt(e){this.cancel();const t=Math.floor(this.Nt+this.qt()),n=Math.max(0,Date.now()-this.Bt),s=Math.max(0,t-n);s>0&&Wc("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Nt} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Lt=this.Ct.enqueueAfterDelay(this.timerId,s,()=>(this.Bt=Date.now(),e())),this.Nt*=this.Ot,this.Nt<this.Ft&&(this.Nt=this.Ft),this.Nt>this.Mt&&(this.Nt=this.Mt)}$t(){null!==this.Lt&&(this.Lt.skipDelay(),this.Lt=null)}cancel(){null!==this.Lt&&(this.Lt.cancel(),this.Lt=null)}qt(){return(Math.random()-.5)*this.Nt}}const od="PersistentStream";class Bd{constructor(e,t,n,s,r,i,a,o){this.Ct=e,this.Kt=n,this.Qt=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.Wt=0,this.Gt=null,this.zt=null,this.stream=null,this.jt=0,this.Ht=new ad(e,t)}Jt(){return 1===this.state||5===this.state||this.Yt()}Yt(){return 2===this.state||3===this.state}start(){this.jt=0,4!==this.state?this.auth():this.Zt()}async stop(){this.Jt()&&await this.close(0)}Xt(){this.state=0,this.Ht.reset()}en(){this.Yt()&&null===this.Gt&&(this.Gt=this.Ct.enqueueAfterDelay(this.Kt,6e4,()=>this.tn()))}nn(e){this.rn(),this.stream.send(e)}async tn(){if(this.Yt())return this.close(0)}rn(){this.Gt&&(this.Gt.cancel(),this.Gt=null)}sn(){this.zt&&(this.zt.cancel(),this.zt=null)}async close(e,t){this.rn(),this.sn(),this.Ht.cancel(),this.Wt++,4!==e?this.Ht.reset():t&&t.code===gl.RESOURCE_EXHAUSTED?(Yc(t.toString()),Yc("Using maximum backoff delay to prevent overloading the backend."),this.Ht.Ut()):t&&t.code===gl.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this._n(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Tt(t)}_n(){}auth(){this.state=1;const e=this.an(this.Wt),t=this.Wt;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.Wt===t&&this.un(e,n)},t=>{e(()=>{const e=new ml(gl.UNKNOWN,"Fetching auth token failed: "+t.message);return this.cn(e)})})}un(e,t){const n=this.an(this.Wt);this.stream=this.En(e,t),this.stream.ct(()=>{n(()=>this.listener.ct())}),this.stream.Et(()=>{n(()=>(this.state=2,this.zt=this.Ct.enqueueAfterDelay(this.Qt,1e4,()=>(this.Yt()&&(this.state=3),Promise.resolve())),this.listener.Et()))}),this.stream.Tt(e=>{n(()=>this.cn(e))}),this.stream.onMessage(e=>{n(()=>1==++this.jt?this.hn(e):this.onNext(e))})}Zt(){this.state=5,this.Ht.kt(async()=>{this.state=0,this.start()})}cn(e){return Wc(od,`close with error: ${e}`),this.stream=null,this.close(4,e)}an(e){return t=>{this.Ct.enqueueAndForget(()=>this.Wt===e?t():(Wc(od,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class cd extends Bd{constructor(e,t,n,s,r,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,s,i),this.serializer=r}get Rn(){return this.jt>0}start(){this.lastStreamToken=void 0,super.start()}_n(){this.Rn&&this.An([])}En(e,t){return this.connection.vt("Write",e,t)}hn(e){return nl(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,nl(!e.writeResults||0===e.writeResults.length,55816),this.listener.Vn()}onNext(e){nl(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.Ht.reset();const t=function(e,t){return e&&e.length>0?(nl(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?wp(e.updateTime):wp(t);return n.isEqual(Lh.min())&&(n=wp(t)),new Yu(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=wp(e.commitTime);return this.listener.dn(n,t)}fn(){const e={};e.database=function(e){return new yl(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}(this.serializer),this.nn(e)}An(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof ah)n={update:bp(e,t.key,t.value)};else if(t instanceof uh)n={delete:Dp(e,t.key)};else if(t instanceof oh)n={update:bp(e,t.key,t.data),updateMask:Ap(t.fieldMask)};else{if(!(t instanceof hh))return el(16599,{be:t.type});n={verify:Dp(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Gu)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Uu)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Vu)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ju)return{fieldPath:t.field.canonicalString(),increment:n.h};if(n instanceof qu)return{fieldPath:t.field.canonicalString(),minimum:n.h};if(n instanceof zu)return{fieldPath:t.field.canonicalString(),maximum:n.h};throw el(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:mp(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:el(27497)}(e,t.precondition)),n}(this.serializer,e))};this.nn(t)}}class ld{}class ud extends ld{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.mn=!1}pn(){if(this.mn)throw new ml(gl.FAILED_PRECONDITION,"The client has already been terminated.")}nt(e,t,n,s){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,i])=>this.connection.nt(e,yp(t,n),s,r,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===gl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new ml(gl.UNKNOWN,e.toString())})}_t(e,t,n,s,r){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection._t(e,yp(t,n),s,i,a,r)).catch(e=>{throw"FirebaseError"===e.name?(e.code===gl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new ml(gl.UNKNOWN,e.toString())})}terminate(){this.mn=!0,this.connection.terminate()}}const hd=new Map;const pd={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},dd=41943040;class fd{static withCacheSize(e){return new fd(e,fd.DEFAULT_COLLECTION_PERCENTILE,fd.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}fd.DEFAULT_COLLECTION_PERCENTILE=10,fd.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,fd.DEFAULT=new fd(dd,fd.DEFAULT_COLLECTION_PERCENTILE,fd.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),fd.DISABLED=new fd(-1,0,0);class Cd{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.gn(e),this.yn=e=>t.writeSequenceNumber(e))}gn(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.yn&&this.yn(e),e}}Cd.wn=-1;class gd{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function md(e){if(e.code!==gl.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;Wc("LocalStore","Unexpectedly lost primary lease")}class wd{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&el(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new wd((n,s)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,s)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,s)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof wd?t:wd.resolve(t)}catch(e){return wd.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):wd.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):wd.reject(t)}static resolve(e){return new wd((t,n)=>{t(e)})}static reject(e){return new wd((t,n)=>{n(e)})}static waitFor(e){return new wd((t,n)=>{let s=0,r=0,i=!1;e.forEach(e=>{++s,e.next(()=>{++r,i&&r===s&&t()},e=>n(e))}),i=!0,r===s&&t()})}static or(e){let t=wd.resolve(!1);for(const n of e)t=t.next(e=>e?wd.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,s)=>{n.push(t.call(this,e,s))}),this.waitFor(n)}static mapArray(e,t){return new wd((n,s)=>{const r=e.length,i=new Array(r);let a=0;for(let o=0;o<r;o++){const B=o;t(e[B]).next(e=>{i[B]=e,++a,a===r&&n(i)},e=>s(e))}})}static doWhile(e,t){return new wd((n,s)=>{const r=()=>{!0===e()?t().next(()=>{r()},s):n()};r()})}}function Ed(e){return"IndexedDbTransactionError"===e.name}const yd="LruGarbageCollector";function Dd([e,t],[n,s]){const r=al(e,n);return 0===r?al(t,s):r}class _d{constructor(e){this.Yn=e,this.buffer=new fl(Dd),this.Zn=0}Xn(){return++this.Zn}er(e){const t=[e,this.Xn()];if(this.buffer.size<this.Yn)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();Dd(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class bd{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.tr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.nr(6e4)}stop(){this.tr&&(this.tr.cancel(),this.tr=null)}get started(){return null!==this.tr}nr(e){Wc(yd,`Garbage collection scheduled in ${e}ms`),this.tr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.tr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){Ed(e)?Wc(yd,"Ignoring IndexedDB error during garbage collection: ",e):await md(e)}await this.nr(3e5)})}}class vd{constructor(e,t){this.rr=e,this.params=t}calculateTargetCount(e,t){return this.rr.ir(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return wd.resolve(Cd.wn);const n=new _d(t);return this.rr.forEachTarget(e,e=>n.er(e.sequenceNumber)).next(()=>this.rr.sr(e,e=>n.er(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.rr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.rr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(Wc("LruGarbageCollector","Garbage collection skipped; disabled"),wd.resolve(pd)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(Wc("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),pd):this._r(e,t))}getCacheSize(e){return this.rr.getCacheSize(e)}_r(e,t){let n,s,r,i,a,o,B;const c=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(Wc("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),s=this.params.maximumSequenceNumbersToCollect):s=t,i=Date.now(),this.nthSequenceNumber(e,s))).next(s=>(n=s,a=Date.now(),this.removeTargets(e,n,t))).next(t=>(r=t,o=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(B=Date.now(),Qc()<=as.DEBUG&&Wc("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-c}ms\n\tDetermined least recently used ${s} in `+(a-i)+"ms\n"+`\tRemoved ${r} targets in `+(o-a)+"ms\n"+`\tRemoved ${e} documents in `+(B-o)+"ms\n"+`Total Duration: ${B-c}ms`),wd.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:r,documentsRemoved:e})))}}const Id="firestore.googleapis.com",Td=!0;class Ad{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new ml(gl.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Id,this.ssl=Td}else this.host=e.host,this.ssl=e.ssl??Td;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e._customHeaders&&(this._customHeaders={...e._customHeaders}),void 0===e.cacheSizeBytes)this.cacheSizeBytes=dd;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new ml(gl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}if(function(e,t,n,s){if(!0===t&&!0===s)throw new ml(gl.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=zp(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new ml(gl.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new ml(gl.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new ml(gl.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams,void 0!==e.grpcFlowControlWindow){if("number"!=typeof e.grpcFlowControlWindow||e.grpcFlowControlWindow<=0||e.grpcFlowControlWindow>2147483647||!Number.isInteger(e.grpcFlowControlWindow))throw new ml(gl.INVALID_ARGUMENT,"grpcFlowControlWindow must be a positive integer and cannot exceed 2147483647");this.grpcFlowControlWindow=e.grpcFlowControlWindow}}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(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams&&this.grpcFlowControlWindow===e.grpcFlowControlWindow&&function(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const s of n)if(e[s]!==t[s])return!1;return!0}(this._customHeaders,e._customHeaders)}}let Od=class{constructor(e,t,n,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ad({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new ml(gl.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new ml(gl.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 Ad(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Up;switch(e.type){case"firstParty":return new $p(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new ml(gl.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"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=hd.get(e);t&&(Wc("ComponentProvider","Removing Datastore"),hd.delete(e),t.terminate())}(this),Promise.resolve()}};function Sd(e,t,n,s={}){e=Rl(e,Od);const r=es(t),i=e._getSettings(),a={...i,emulatorOptions:e._getEmulatorOptions()},o=`${t}:${n}`;r&&ts(`https://${o}`),i.host!==Id&&i.host!==o&&Xc("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const B={...i,host:o,ssl:r,emulatorOptions:s};if(!Jn(B,a)&&(e._setSettings(B),s.mockUserToken)){let t,n;if("string"==typeof s.mockUserToken)t=s.mockUserToken,n=Pp.MOCK_USER;else{t=Fn(s.mockUserToken,e._app?.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new ml(gl.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Pp(r)}e._authCredentials=new Hp(new Gp(t,n))}}class Nd{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Nd(this.firestore,e,this._query)}}class Rd{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new kd(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Rd(this.firestore,e,this._key)}toJSON(){return{type:Rd._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(Ll(t,Rd._jsonSchema))return new Rd(e,n||null,new Al(yl.fromString(t.referencePath)))}}Rd._jsonSchemaVersion="firestore/documentReference/1.0",Rd._jsonSchema={type:kl("string",Rd._jsonSchemaVersion),referencePath:kl("string")};class kd extends Nd{constructor(e,t,n){super(e,t,function(e){return new jh(e)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Rd(this.firestore,null,new Al(e))}withConverter(e){return new kd(this.firestore,e,this._path)}}function Ld(e,t,...n){if(e=Zn(e),1===arguments.length&&(t=il.newId()),function(e,t,n){if(!n)throw new ml(gl.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}("doc","path",t),e instanceof Od){const s=yl.fromString(t,...n);return Ol(s),new Rd(e,null,new Al(s))}{if(!(e instanceof Rd||e instanceof kd))throw new ml(gl.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=e._path.child(yl.fromString(t,...n));return Ol(s),new Rd(e.firestore,e instanceof kd?e.converter:null,new Al(s))}}class xd{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:xd._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ll(e,xd._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new xd(e.vectorValues);throw new ml(gl.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}function Fd(e,t,n){if(Md(e=Zn(e)))return function(e,t,n){if(!Md(n)||!Sl(n)){const s=Nl(n);throw"an object"===s?t.createError(e+" a custom object"):t.createError(e+" "+s)}}("Unsupported field value:",t,e),function(e,t){const n={};return Tl(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Il(e,(e,s)=>{const r=Fd(s,t.childContextForField(e));null!=r&&(n[e]=r)}),{mapValue:{fields:n}}}(e,t);if(e instanceof xp)return function(e,t){if(!function(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw el(40011,{dataSource:e})}}(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&4!==t.dataSource)throw t.createError("Nested arrays are not supported");return function(e,t){const n=[];let s=0;for(const r of e){let e=Fd(r,t.childContextForArray(s));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),s++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=Zn(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Lu(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=Pl.fromDate(e);return{timestampValue:fp(t.serializer,n)}}if(e instanceof Pl){const n=new Pl(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:fp(t.serializer,n)}}if(Pd(e)){const n=Pl.fromInstant(e),s=new Pl(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:fp(t.serializer,s)}}if(e instanceof Fp)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof kp)return{bytesValue:gp(t.serializer,e._byteString)};if(e instanceof Rd){const n=t.databaseId,s=e.firestore._databaseId;if(!s.isEqual(n))throw t.createError(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ep(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof xd)return function(e,t){const n=e instanceof xd?e.toArray():e,s={fields:{[su]:{stringValue:au},[ou]:{arrayValue:{values:n.map(e=>{if("number"!=typeof e)throw t.createError("VectorValues must only contain numeric values.");return Ru(t.serializer,e)})}}}};return{mapValue:s}}(e,t);if(Op(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${Nl(e)}`)}(e,t)}function Pd(e){if("object"!=typeof e||null===e)return!1;if("undefined"!=typeof Temporal&&"function"==typeof Temporal.Instant&&e instanceof Temporal.Instant)return!0;const t=e;return"Temporal.Instant"===t[Symbol.toStringTag]&&"bigint"==typeof t.t}function Md(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof Pl||e instanceof Fp||e instanceof kp||e instanceof Rd||e instanceof xp||e instanceof xd||Pd(e)||Op(e))}function Gd(e,t,n){if((t=Zn(t))instanceof Lp)return t._internalPath;if("string"==typeof t)return function(e,t){if(t.search(Ud)>=0)throw Hd(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e);try{return new Lp(...t.split("."))._internalPath}catch(n){throw Hd(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e)}}(e,t);throw Hd("Field path arguments must be of type string or ",e)}xd._jsonSchemaVersion="firestore/vectorValue/1.0",xd._jsonSchema={type:kl("string",xd._jsonSchemaVersion),vectorValues:kl("object")};const Ud=new RegExp("[~\\*/\\[\\]]");function Hd(e,t,n,s,r){let i=`Function ${t}() called with invalid data`;i+=". ";return new ml(gl.INVALID_ARGUMENT,i+e+"")}class Vd{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const n=Su.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const r=this.optionDefinitions[s];if(s in e){const i=e[s];let a;r.nestedOptions&&Sl(i)?a={mapValue:{fields:new Vd(r.nestedOptions).getOptionsProto(t,i)}}:i&&(a=Fd(i,t)??void 0),a&&n.set(_l.fromServerFormat(r.serverName),a)}}return n}getOptionsProto(e,t,n){const s=this._getKnownOptions(t,e);if(n){const t=new Map(function(e,t){const n=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&n.push(t(e[s],s,e));return n}(n,(t,n)=>[_l.fromServerFormat(n),void 0!==t?Fd(t,e):null]));s.setAll(t)}return s.value.mapValue.fields??{}}}function jd(e){let t;return e instanceof qd?e:(t=Sl(e)?function(e){const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const s=e[n];t.push(Zd(n)),t.push(jd(s))}return new tf("map",t,"map")}(e):e instanceof Array?function(e){return function(e,t){return new tf("array",e.map(e=>jd(e)),t)}(e,"array")}(e):ef(e,void 0),t)}function $d(e){if(e instanceof qd)return e;if(e instanceof xd)return Zd(e);if(Array.isArray(e))return Zd(function(e){return new xd(e)}(e));throw new Error("Unsupported value: "+typeof e)}function Jd(e){return function(e){return"string"==typeof e}(e)?function(e){return function(e,t){return new Yd("string"==typeof e?wl===e?new Lp(wl)._internalPath:Gd("field",e):e._internalPath,t)}(e,"field")}(e):jd(e)}class qd{constructor(){this._protoValueType="ProtoValue"}add(e){return new tf("add",[this,jd(e)],"add")}asBoolean(){if(this instanceof nf)return this;if(this instanceof Xd)return new rf(this);if(this instanceof Yd)return new af(this);if(this instanceof tf)return new sf(this);throw new ml("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new tf("subtract",[this,jd(e)],"subtract")}multiply(e){return new tf("multiply",[this,jd(e)],"multiply")}divide(e){return new tf("divide",[this,jd(e)],"divide")}mod(e){return new tf("mod",[this,jd(e)],"mod")}equal(e){return new tf("equal",[this,jd(e)],"equal").asBoolean()}notEqual(e){return new tf("not_equal",[this,jd(e)],"notEqual").asBoolean()}lessThan(e){return new tf("less_than",[this,jd(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new tf("less_than_or_equal",[this,jd(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new tf("greater_than",[this,jd(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new tf("greater_than_or_equal",[this,jd(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const n=[e,...t].map(e=>jd(e));return new tf("array_concat",[this,...n],"arrayConcat")}arrayContains(e){return new tf("array_contains",[this,jd(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new Wd(e.map(jd),"arrayContainsAll"):e;return new tf("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new Wd(e.map(jd),"arrayContainsAny"):e;return new tf("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new tf("array_reverse",[this])}arrayLength(){return new tf("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new Wd(e.map(jd),"equalAny"):e;return new tf("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new Wd(e.map(jd),"notEqualAny"):e;return new tf("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new tf("exists",[this],"exists").asBoolean()}charLength(){return new tf("char_length",[this],"charLength")}like(e){return new tf("like",[this,jd(e)],"like").asBoolean()}regexContains(e){return new tf("regex_contains",[this,jd(e)],"regexContains").asBoolean()}regexFind(e){return new tf("regex_find",[this,jd(e)],"regexFind")}regexFindAll(e){return new tf("regex_find_all",[this,jd(e)],"regexFindAll")}regexMatch(e){return new tf("regex_match",[this,jd(e)],"regexMatch").asBoolean()}stringContains(e){return new tf("string_contains",[this,jd(e)],"stringContains").asBoolean()}startsWith(e){return new tf("starts_with",[this,jd(e)],"startsWith").asBoolean()}endsWith(e){return new tf("ends_with",[this,jd(e)],"endsWith").asBoolean()}toLower(){return new tf("to_lower",[this],"toLower")}toUpper(){return new tf("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(jd(e)),new tf("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(jd(e)),new tf("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(jd(e)),new tf("rtrim",t,"rtrim")}type(){return new tf("type",[this])}isType(e){return new tf("is_type",[this,Zd(e)],"isType").asBoolean()}stringConcat(e,...t){const n=[e,...t].map(jd);return new tf("string_concat",[this,...n],"stringConcat")}stringIndexOf(e){return new tf("string_index_of",[this,jd(e)],"stringIndexOf")}stringRepeat(e){return new tf("string_repeat",[this,jd(e)],"stringRepeat")}stringReplaceAll(e,t){return new tf("string_replace_all",[this,jd(e),jd(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new tf("string_replace_one",[this,jd(e),jd(t)],"stringReplaceOne")}concat(e,...t){const n=[e,...t].map(jd);return new tf("concat",[this,...n],"concat")}reverse(){return new tf("reverse",[this],"reverse")}arrayFilter(e,t){return new tf("array_filter",[this,jd(e),t],"arrayFilter")}arrayTransform(e,t){return new tf("array_transform",[this,jd(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,n){return new tf("array_transform",[this,jd(e),jd(t),n],"arrayTransformWithIndex")}arraySlice(e,t){const n=[this,jd(e)];return void 0!==t&&n.push(jd(t)),new tf("array_slice",n,"arraySlice")}arrayFirst(){return new tf("array_first",[this],"arrayFirst")}arrayFirstN(e){return new tf("array_first_n",[this,jd(e)],"arrayFirstN")}arrayLast(){return new tf("array_last",[this],"arrayLast")}arrayLastN(e){return new tf("array_last_n",[this,jd(e)],"arrayLastN")}arrayMaximum(){return new tf("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new tf("maximum_n",[this,jd(e)],"arrayMaximumN")}arrayMinimum(){return new tf("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new tf("minimum_n",[this,jd(e)],"arrayMinimumN")}arrayIndexOf(e){return new tf("array_index_of",[this,jd(e),jd("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new tf("array_index_of",[this,jd(e),jd("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new tf("array_index_of_all",[this,jd(e)],"arrayIndexOfAll")}byteLength(){return new tf("byte_length",[this],"byteLength")}ceil(){return new tf("ceil",[this])}floor(){return new tf("floor",[this])}abs(){return new tf("abs",[this])}exp(){return new tf("exp",[this])}mapGet(e){return new tf("map_get",[this,Zd(e)],"mapGet")}mapSet(e,t,...n){const s=[this,jd(e),jd(t),...n.map(jd)];return new tf("map_set",s,"mapSet")}mapKeys(){return new tf("map_keys",[this],"mapKeys")}mapValues(){return new tf("map_values",[this],"mapValues")}mapEntries(){return new tf("map_entries",[this],"mapEntries")}getField(e){return new tf("get_field",[this,jd(e)],"get_field")}count(){return zd._create("count",[this],"count")}sum(){return zd._create("sum",[this],"sum")}average(){return zd._create("average",[this],"average")}minimum(){return zd._create("minimum",[this],"minimum")}maximum(){return zd._create("maximum",[this],"maximum")}first(){return zd._create("first",[this],"first")}last(){return zd._create("last",[this],"last")}arrayAgg(){return zd._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return zd._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return zd._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const n=[e,...t];return new tf("maximum",[this,...n.map(jd)],"logicalMaximum")}logicalMinimum(e,...t){const n=[e,...t];return new tf("minimum",[this,...n.map(jd)],"minimum")}vectorLength(){return new tf("vector_length",[this],"vectorLength")}cosineDistance(e){return new tf("cosine_distance",[this,$d(e)],"cosineDistance")}dotProduct(e){return new tf("dot_product",[this,$d(e)],"dotProduct")}euclideanDistance(e){return new tf("euclidean_distance",[this,$d(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new tf("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new tf("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new tf("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new tf("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new tf("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new tf("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new tf("timestamp_add",[this,jd(e),jd(t)],"timestampAdd")}timestampSubtract(e,t){return new tf("timestamp_subtract",[this,jd(e),jd(t)],"timestampSubtract")}timestampDiff(e,t){return new tf("timestamp_diff",[this,Jd(e),jd(t)],"timestampDiff")}timestampExtract(e,t){const n=[this,jd(e)];return t&&n.push(jd(t)),new tf("timestamp_extract",n,"timestampExtract")}documentId(){return new tf("document_id",[this],"documentId")}parent(){return new tf("parent",[this],"parent")}substring(e,t){const n=jd(e);return new tf("substring",void 0===t?[this,n]:[this,n,jd(t)],"substring")}arrayGet(e){return new tf("array_get",[this,jd(e)],"arrayGet")}isError(){return new tf("is_error",[this],"isError").asBoolean()}ifError(e){const t=new tf("if_error",[this,jd(e)],"ifError");return e instanceof nf?t.asBoolean():t}isAbsent(){return new tf("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new tf("map_remove",[this,jd(e)],"mapRemove")}mapMerge(e,...t){const n=jd(e),s=t.map(jd);return new tf("map_merge",[this,n,...s],"mapMerge")}pow(e){return new tf("pow",[this,jd(e)])}trunc(e){return void 0===e?new tf("trunc",[this]):new tf("trunc",[this,jd(e)],"trunc")}round(e){return void 0===e?new tf("round",[this]):new tf("round",[this,jd(e)],"round")}collectionId(){return new tf("collection_id",[this])}length(){return new tf("length",[this])}ln(){return new tf("ln",[this])}sqrt(){return new tf("sqrt",[this])}stringReverse(){return new tf("string_reverse",[this])}ifAbsent(e){return new tf("if_absent",[this,jd(e)],"ifAbsent")}ifNull(e){return new tf("if_null",[this,jd(e)],"ifNull")}coalesce(e,...t){return new tf("coalesce",[this,jd(e),...t.map(jd)],"coalesce")}join(e){return new tf("join",[this,jd(e)],"join")}log10(){return new tf("log10",[this])}arraySum(){return new tf("sum",[this])}split(e){return new tf("split",[this,jd(e)])}timestampTruncate(e,t){const n=[this,jd(e)];return t&&n.push(jd(t)),new tf("timestamp_trunc",n)}ascending(){return function(e){return new of(Jd(e),"ascending","ascending")}(this)}descending(){return function(e){return new of(Jd(e),"descending","descending")}(this)}as(e){return new Qd(this,e,"as")}}class zd{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,n){const s=new zd(e,t);return s._methodName=n,s}as(e){return new Kd(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e))}}class Kd{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}}class Qd{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class Wd extends qd{constructor(e,t){super(),this.cr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.cr.map(t=>t._toProto(e))}}}_readUserData(e){this.cr.forEach(t=>t._readUserData(e))}}class Yd extends qd{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new tf("geo_distance",[this,jd(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}class Xd extends qd{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new Xd(e,void 0);return t._protoValue=e,t}_toProto(e){return nl(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,function(e){return"object"==typeof e&&null!==e&&!!("nullValue"in e&&(null===e.nullValue||"NULL_VALUE"===e.nullValue)||"booleanValue"in e&&(null===e.booleanValue||"boolean"==typeof e.booleanValue)||"integerValue"in e&&(null===e.integerValue||"number"==typeof e.integerValue||"string"==typeof e.integerValue)||"doubleValue"in e&&(null===e.doubleValue||"number"==typeof e.doubleValue)||"timestampValue"in e&&(null===e.timestampValue||function(e){return"object"==typeof e&&null!==e&&"seconds"in e&&(null===e.seconds||"number"==typeof e.seconds||"string"==typeof e.seconds)&&"nanos"in e&&(null===e.nanos||"number"==typeof e.nanos)}(e.timestampValue))||"stringValue"in e&&(null===e.stringValue||"string"==typeof e.stringValue)||"bytesValue"in e&&(null===e.bytesValue||e.bytesValue instanceof Uint8Array)||"referenceValue"in e&&(null===e.referenceValue||"string"==typeof e.referenceValue)||"geoPointValue"in e&&(null===e.geoPointValue||function(e){return"object"==typeof e&&null!==e&&"latitude"in e&&(null===e.latitude||"number"==typeof e.latitude)&&"longitude"in e&&(null===e.longitude||"number"==typeof e.longitude)}(e.geoPointValue))||"arrayValue"in e&&(null===e.arrayValue||function(e){return"object"==typeof e&&null!==e&&!(!("values"in e)||null!==e.values&&!Array.isArray(e.values))}(e.arrayValue))||"mapValue"in e&&(null===e.mapValue||function(e){return"object"==typeof e&&null!==e&&!(!("fields"in e)||null!==e.fields&&!Sl(e.fields))}(e.mapValue))||"fieldReferenceValue"in e&&(null===e.fieldReferenceValue||"string"==typeof e.fieldReferenceValue)||"functionValue"in e&&(null===e.functionValue||function(e){return"object"==typeof e&&null!==e&&!(!("name"in e)||null!==e.name&&"string"!=typeof e.name||!("args"in e)||null!==e.args&&!Array.isArray(e.args))}(e.functionValue))||"pipelineValue"in e&&(null===e.pipelineValue||function(e){return"object"==typeof e&&null!==e&&!(!("stages"in e)||null!==e.stages&&!Array.isArray(e.stages))}(e.pipelineValue)))}(this._protoValue)||(this._protoValue=Fd(this.value,e))}}function Zd(e,t){return ef(e,"constant")}function ef(e,t){const n=new Xd(e,t);return"boolean"==typeof e?new rf(n):n}class tf extends qd{constructor(e,t,n,s){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==s&&(this._options=s)}get _optionsUtil(){return new Vd({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class nf extends qd{get _methodName(){return this._expr._methodName}countIf(){return zd._create("count_if",[this],"countIf")}not(){return new tf("not",[this],"not").asBoolean()}conditional(e,t){return new tf("conditional",[this,e,t],"conditional")}ifError(e){const t=jd(e),n=new tf("if_error",[this,t],"ifError");return t instanceof nf?n.asBoolean():n}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class sf extends nf{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class rf extends nf{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class af extends nf{constructor(e){super(),this._expr=e,this.expressionType="Field"}}class of{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:Np(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}class Bf{constructor(e){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=e)}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class cf extends Bf{get _name(){return"add_fields"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[Sp(e,this.fields)]}}_readUserData(e){super._readUserData(e),Df(this.fields,e)}}class lf extends Bf{get _name(){return"aggregate"}get _optionsUtil(){return new Vd({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[Sp(e,this.accumulators),Sp(e,this.groups)]}}_readUserData(e){super._readUserData(e),Df(this.groups,e),Df(this.accumulators,e)}}class uf extends Bf{get _name(){return"distinct"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[Sp(e,this.groups)]}}_readUserData(e){super._readUserData(e),Df(this.groups,e)}}class hf extends Bf{get _name(){return"collection"}get _optionsUtil(){return new Vd({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.hr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.hr}]}}_readUserData(e){super._readUserData(e)}}class pf extends Bf{get _name(){return"collection_group"}get _optionsUtil(){return new Vd({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class df extends Bf{get _name(){return"database"}get _optionsUtil(){return new Vd({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class ff extends Bf{get _name(){return"documents"}get _optionsUtil(){return new Vd({})}constructor(e,t){if(super(t),!e||0===e.length)throw new ml(gl.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=e.map(e=>e.startsWith("/")?e:"/"+e),s=new Set(n);if(s.size!==n.length)throw new ml(gl.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.Tr=n,this.Pr=s}_toProto(e){return{...super._toProto(e),args:this.Tr.map(e=>({referenceValue:e}))}}_readUserData(e){super._readUserData(e)}}class Cf extends Bf{get _name(){return"where"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Df(this.condition,e)}}class gf extends Bf{get _name(){return"limit"}get _optionsUtil(){return new Vd({})}constructor(e,t){nl(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[Lu(e,this.limit)]}}}class mf extends Bf{get _name(){return"offset"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[Lu(e,this.offset)]}}}class wf extends Bf{get _name(){return"select"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[Sp(e,this.selections)]}}_readUserData(e){super._readUserData(e),Df(this.selections,e)}}class Ef extends Bf{get _name(){return"sort"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map(t=>t._toProto(e))}}_readUserData(e){super._readUserData(e),Df(this.orderings,e)}}class yf extends Bf{get _name(){return"replace_with"}get _optionsUtil(){return new Vd({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),Np(yf.Ir)]}}_readUserData(e){super._readUserData(e),Df(this.map,e)}}function Df(e,t){return function(e){return"function"==typeof e._readUserData}(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach(e=>e._readUserData(t)):Object.values(e).forEach(e=>e._readUserData(t)),e}yf.Ir="full_replace";class _f{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return vf(this)}getPipelineCollectionGroup(){return If(this)}getPipelineCollectionId(){return function(e){switch(bf(e)){case"collection":return yl.fromString(vf(e)).lastSegment();case"collection_group":return If(e);default:return}}(this)}getPipelineDocuments(){return Tf(this)}getPipelineFlavor(){return function(e){let t="exact";return e.stages.forEach((n,s)=>{n._name!==uf.name&&n._name!==lf.name||(t="keyless"),n._name===wf.name&&"exact"===t&&(t="augmented"),n._name===cf.name&&s<e.stages.length-1&&"exact"===t&&(t="augmented")}),t}(this)}getPipelineSourceType(){return bf(this)}}function bf(e){const t=e.stages[0];return t instanceof hf||t instanceof pf||t instanceof df||t instanceof ff?t._name:"unknown"}function vf(e){if("collection"===bf(e))return e.stages[0].hr}function If(e){if("collection_group"===bf(e))return e.stages[0].collectionId}function Tf(e){if("documents"===bf(e))return e.stages[0].Tr}class Af{constructor(e,t){this.type=e,this.value=t}static mr(){return new Af("ERROR",void 0)}static pr(){return new Af("UNSET",void 0)}static gr(){return new Af("NULL",Bu)}static newValue(e){return bu(e)?new Af("NULL",Bu):function(e){return!!e&&"booleanValue"in e}(e)?new Af("BOOLEAN",e):Eu(e)?new Af("INT",e):yu(e)?new Af("DOUBLE",e):function(e){return!!e&&"timestampValue"in e&&!!e.timestampValue}(e)?new Af("TIMESTAMP",e):function(e){return!!e&&"stringValue"in e}(e)?new Af("STRING",e):function(e){return!!e&&"bytesValue"in e}(e)?new Af("BYTES",e):e.referenceValue?new Af("REFERENCE",e):e.geoPointValue?new Af("GEO_POINT",e):_u(e)?new Af("ARRAY",e):Tu(e)?new Af("VECTOR",e):Iu(e)?new Af("MAP",e):new Af("ERROR",void 0)}yr(){return"ERROR"===this.type||"UNSET"===this.type}wr(){return"NULL"===this.type}}function Of(e){if(!e.yr())return e.value}function Sf(e){return e instanceof nf?e._expr:e}function Nf(e){if((e=Sf(e))instanceof Yd)return new Rf(e);if(e instanceof Xd)return new kf(e);if(e instanceof Wd)return new Lf(e);if(e instanceof tf){if("add"===e.name)return new Hf(e);if("subtract"===e.name)return new Vf(e);if("multiply"===e.name)return new jf(e);if("divide"===e.name)return new $f(e);if("mod"===e.name)return new Jf(e);if("and"===e.name)return new qf(e);if("equal"===e.name)return new BC(e);if("not_equal"===e.name)return new cC(e);if("less_than"===e.name)return new lC(e);if("less_than_or_equal"===e.name)return new uC(e);if("greater_than"===e.name)return new hC(e);if("greater_than_or_equal"===e.name)return new pC(e);if("array_concat"===e.name)return new dC(e);if("array_reverse"===e.name)return new fC(e);if("array_contains"===e.name)return new CC(e);if("array_contains_all"===e.name)return new gC(e);if("array_contains_any"===e.name)return new mC(e);if("array_length"===e.name)return new wC(e);if("array_element"===e.name)return new EC(e);if("equal_any"===e.name)return new Wf(e);if("not_equal_any"===e.name)return new Yf(e);if("is_nan"===e.name)return new Xf(e);if("is_not_nan"===e.name)return new Zf(e);if("is_null"===e.name)return new eC(e);if("is_not_null"===e.name)return new tC(e);if("is_error"===e.name)return new nC(e);if("exists"===e.name)return new sC(e);if("not"===e.name)return new zf(e);if("or"===e.name)return new Kf(e);if("xor"===e.name)return new Qf(e);if("conditional"===e.name)return new rC(e);if("maximum"===e.name)return new iC(e);if("minimum"===e.name)return new aC(e);if("reverse"===e.name)return new yC(e);if("replace_first"===e.name)return new DC(e);if("replace_all"===e.name)return new _C(e);if("char_length"===e.name)return new bC(e);if("byte_length"===e.name)return new vC(e);if("like"===e.name)return new TC(e);if("regex_contains"===e.name)return new AC(e);if("regex_match"===e.name)return new OC(e);if("string_contains"===e.name)return new SC(e);if("starts_with"===e.name)return new NC(e);if("ends_with"===e.name)return new RC(e);if("to_lower"===e.name)return new kC(e);if("to_upper"===e.name)return new LC(e);if("trim"===e.name)return new xC(e);if("string_concat"===e.name)return new FC(e);if("map_get"===e.name)return new PC(e);if("cosine_distance"===e.name)return new GC(e);if("dot_product"===e.name)return new UC(e);if("euclidean_distance"===e.name)return new HC(e);if("vector_length"===e.name)return new VC(e);if("unix_micros_to_timestamp"===e.name)return new sg(e);if("timestamp_to_unix_micros"===e.name)return new og(e);if("unix_millis_to_timestamp"===e.name)return new rg(e);if("timestamp_to_unix_millis"===e.name)return new Bg(e);if("unix_seconds_to_timestamp"===e.name)return new ig(e);if("timestamp_to_unix_seconds"===e.name)return new cg(e);if("timestamp_add"===e.name)return new ug(e);if("timestamp_subtract"===e.name)return new hg(e)}throw new Error(`Unknown Expr : ${e}`)}class Rf{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===wl)return Af.newValue({referenceValue:Dp(e.serializer,t.key)});if("__update_time__"===this.expr.fieldName)return Af.newValue({timestampValue:mp(e.serializer,t.version)});if("__create_time__"===this.expr.fieldName)return Af.newValue({timestampValue:mp(e.serializer,t.createTime)});const n=t.data.field(this.expr._fieldPath);return n?Kl(n)?Af.newValue(function(e,t){if("estimate"===e.serverTimestampBehavior)return{timestampValue:mp(e.serializer,Lh.fromTimestamp(Wl(t)))};if("previous"===e.serverTimestampBehavior){const e=Ql(t);if(e)return e}return{nullValue:"NULL_VALUE"}}(e,n)):Af.newValue(n):Af.pr()}}class kf{constructor(e){this.expr=e}evaluate(e,t){return Af.newValue(this.expr._getValue())}}class Lf{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.cr.map(n=>Nf(n).evaluate(e,t));return n.some(e=>e.yr())?Af.mr():Af.newValue({arrayValue:{values:n.map(e=>e.value)}})}}function xf(e){return yu(e)?Number(e.doubleValue):Number(e.integerValue)}function Ff(e){return BigInt(e.integerValue)}const Pf=BigInt("0x7fffffffffffffff"),Mf=-BigInt("0x8000000000000000");class Gf{constructor(e){this.expr=e}evaluate(e,t){nl(this.expr.params.length>=2,24778);const n=Nf(this.expr.params[0]).evaluate(e,t),s=Nf(this.expr.params[1]).evaluate(e,t);let r=this.br(n,s);for(const n of this.expr.params.slice(2)){const s=Nf(n).evaluate(e,t);r=this.br(r,s)}return r}br(e,t){if(e.yr()||t.yr())return Af.mr();if(e.wr()||t.wr())return Af.gr();const n=e.value,s=t.value;if(!yu(n)&&!Eu(n)||!yu(s)&&!Eu(s))return Af.mr();if(yu(n)||yu(s)){const e=this.Sr(n,s);return e?Af.newValue(e):Af.mr()}if(Eu(n)&&Eu(s)){const e=this.vr(n,s);return void 0===e?Af.mr():"number"==typeof e?Af.newValue({doubleValue:e}):e<Mf||e>Pf?Af.mr():Af.newValue({integerValue:`${e}`})}return Af.mr()}}function Uf(e,t){return uu(e)!==uu(t)?"TYPE_MISMATCH":vu(e)||vu(t)?"NOT_EQ":bu(e)&&bu(t)?"EQ":bu(e)||bu(t)?"NULL":_u(e)&&_u(t)?function(e,t){if(e.values?.length!==t.values?.length)return"NOT_EQ";let n=!1;for(let s=0;s<(e.values?.length??0);s++){const r=e.values[s],i=t.values[s];switch(Uf(r,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:el(44609,{Dr:r,Cr:i})}}return n?"NULL":"EQ"}(e.arrayValue,t.arrayValue):Tu(e)&&Tu(t)||Iu(e)&&Iu(t)?function(e,t){const n=e.fields||{},s=t.fields||{};if(vl(n)!==vl(s))return"NOT_EQ";let r=!1;for(const e in n)if(n.hasOwnProperty(e)){if(void 0===s[e])return"NOT_EQ";switch(Uf(n[e],s[e])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":r=!0}}return r?"NULL":"EQ"}(e.mapValue,t.mapValue):function(e,t){return hu(e,t,{u:!1,i:!0,o:!0})}(e,t)?"EQ":"NOT_EQ"}class Hf extends Gf{vr(e,t){return Ff(e)+Ff(t)}Sr(e,t){return{doubleValue:xf(e)+xf(t)}}}class Vf extends Gf{constructor(e){super(e),this.expr=e}vr(e,t){return Ff(e)-Ff(t)}Sr(e,t){return{doubleValue:xf(e)-xf(t)}}}class jf extends Gf{constructor(e){super(e),this.expr=e}vr(e,t){return Ff(e)*Ff(t)}Sr(e,t){return{doubleValue:xf(e)*xf(t)}}}class $f extends Gf{constructor(e){super(e),this.expr=e}vr(e,t){const n=Ff(t);if(n!==BigInt(0))return Ff(e)/n}Sr(e,t){const n=xf(t);return 0===n?{doubleValue:nu(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:xf(e)/n}}}class Jf extends Gf{constructor(e){super(e),this.expr=e}vr(e,t){const n=Ff(t);if(n!==BigInt(0))return Ff(e)%n}Sr(e,t){const n=xf(t);if(0!==n)return{doubleValue:xf(e)%n}}}class qf{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const r of this.expr.params){const i=Nf(r).evaluate(e,t);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return Af.newValue(lu);break;case"NULL":s=!0;break;default:n=!0}}return n?Af.mr():s?Af.gr():Af.newValue(cu)}}class zf{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,9634);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return Af.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return Af.gr();default:return Af.mr()}}}class Kf{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const r of this.expr.params){const i=Nf(r).evaluate(e,t);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return Af.newValue(cu);break;case"NULL":s=!0;break;default:n=!0}}return n?Af.mr():s?Af.gr():Af.newValue(lu)}}class Qf{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const r of this.expr.params){const i=Nf(r).evaluate(e,t);switch(i.type){case"BOOLEAN":n=Qf.xor(n,!!i.value?.booleanValue);break;case"NULL":s=!0;break;default:return Af.mr()}}return s?Af.gr():Af.newValue({booleanValue:n})}static xor(e,t){return(e||t)&&!(e&&t)}}class Wf{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,55094);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Af.mr()}if(n)return Af.gr();for(const e of r.value?.arrayValue?.values??[])switch(bu(s.value)&&bu(e)?"EQ":Uf(s.value,e)){case"EQ":return Af.newValue(cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:el(44608,{value:s.value,candidate:e})}return n?Af.gr():Af.newValue(lu)}}class Yf{constructor(e){this.expr=e}evaluate(e,t){return new zf(new tf("not",[new tf("equal_any",this.expr.params)])).evaluate(e,t)}}class Xf{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,23322);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return Af.newValue(lu);case"DOUBLE":return Af.newValue({booleanValue:isNaN(xf(n.value))});case"NULL":return Af.gr();default:return Af.mr()}}}class Zf{constructor(e){this.expr=e}evaluate(e,t){return nl(1===this.expr.params.length,50406),new zf(new tf("not",[new tf("is_nan",this.expr.params)])).evaluate(e,t)}}class eC{constructor(e){this.expr=e}evaluate(e,t){switch(nl(1===this.expr.params.length,23123),Nf(this.expr.params[0]).evaluate(e,t).type){case"NULL":return Af.newValue(cu);case"UNSET":case"ERROR":return Af.mr();default:return Af.newValue(lu)}}}class tC{constructor(e){this.expr=e}evaluate(e,t){return nl(1===this.expr.params.length,23167),new zf(new tf("not",[new tf("is_null",this.expr.params)])).evaluate(e,t)}}class nC{constructor(e){this.expr=e}evaluate(e,t){return nl(1===this.expr.params.length,5228),"ERROR"===Nf(this.expr.params[0]).evaluate(e,t).type?Af.newValue(cu):Af.newValue(lu)}}class sC{constructor(e){this.expr=e}evaluate(e,t){switch(nl(1===this.expr.params.length,6877),Nf(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return Af.mr();case"UNSET":return Af.newValue(lu);default:return Af.newValue(cu)}}}class rC{constructor(e){this.expr=e}evaluate(e,t){nl(3===this.expr.params.length,11706);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?Nf(this.expr.params[1]).evaluate(e,t):Nf(this.expr.params[2]).evaluate(e,t);case"NULL":return Nf(this.expr.params[2]).evaluate(e,t);default:return Af.mr()}}}class iC{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Nf(n).evaluate(e,t));let s;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||du(e.value,s.value)>0?e:s}return void 0===s?Af.gr():s}}class aC{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Nf(n).evaluate(e,t));let s;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||du(e.value,s.value)<0?e:s}return void 0===s?Af.gr():s}}class oC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"ERROR":case"UNSET":return Af.mr()}const s=Nf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ERROR":case"UNSET":return Af.mr()}return this.Fr(n,s)}}class BC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){if(e.wr()&&t.wr())return Af.newValue(cu);if(e.wr()||t.wr())return Af.newValue(lu);if(vu(e.value)||vu(t.value))return Af.newValue(lu);if(uu(e.value)!==uu(t.value))return Af.newValue(lu);switch(Uf(e.value,t.value)){case"EQ":return Af.newValue(cu);case"NOT_EQ":return Af.newValue(lu);case"NULL":return Af.gr();default:el(44615,{left:e,right:t})}}}class cC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){switch(Uf(e.value,t.value)){case"EQ":return Af.newValue(lu);case"NOT_EQ":case"TYPE_MISMATCH":return Af.newValue(cu);case"NULL":return Af.gr();default:el(44614,{left:e,right:t})}}}class lC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){return uu(e.value)!==uu(t.value)||vu(e.value)||vu(t.value)?Af.newValue(lu):Af.newValue({booleanValue:du(e.value,t.value)<0})}}class uC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){return uu(e.value)!==uu(t.value)||vu(e.value)||vu(t.value)?Af.newValue(lu):"EQ"===Uf(e.value,t.value)?Af.newValue(cu):Af.newValue({booleanValue:du(e.value,t.value)<0})}}class hC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){return uu(e.value)!==uu(t.value)||vu(e.value)||vu(t.value)?Af.newValue(lu):Af.newValue({booleanValue:du(e.value,t.value)>0})}}class pC extends oC{constructor(e){super(e),this.expr=e}Fr(e,t){return uu(e.value)!==uu(t.value)||vu(e.value)||vu(t.value)?Af.newValue(lu):"EQ"===Uf(e.value,t.value)?Af.newValue(cu):Af.newValue({booleanValue:du(e.value,t.value)>0})}}class dC{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class fC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,216);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Af.gr();case"ARRAY":{const e=n.value.arrayValue?.values??[];return Af.newValue({arrayValue:{values:[...e].reverse()}})}default:return Af.mr()}}}class CC{constructor(e){this.expr=e}evaluate(e,t){return nl(2===this.expr.params.length,52884),new Wf(new tf("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class gC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,1392);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Af.mr()}if(n)return Af.gr();const i=r.value?.arrayValue?.values??[],a=s.value?.arrayValue?.values??[];for(const e of i){let t=!1;n=!1;for(const s of a){switch(bu(e)&&bu(s)?"EQ":Uf(e,s)){case"EQ":t=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:el(44613,{value:s,search:e})}if(t)break}if(!t)return Af.newValue(lu)}return Af.newValue(cu)}}class mC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,2680);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Af.mr()}if(n)return Af.gr();const i=r.value?.arrayValue?.values??[],a=s.value?.arrayValue?.values??[];for(const e of a)for(const t of i)switch(bu(e)&&bu(t)?"EQ":Uf(e,t)){case"EQ":return Af.newValue(cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:el(60403,{value:e,search:t})}return n?Af.gr():Af.newValue(lu)}}class wC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,38605);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Af.gr();case"ARRAY":return Af.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Af.mr()}}}class EC{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class yC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,1508);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Af.gr();case"BYTES":{const e=n.value?.bytesValue;if("string"==typeof e){const t=Gl.fromBase64String(e).toUint8Array();return t.reverse(),Af.newValue({bytesValue:Gl.fromUint8Array(t).toBase64()})}return Af.newValue({bytesValue:new Uint8Array(e).reverse()})}case"STRING":{const e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(e),s=Array.from(t,e=>e.segment).reverse();return Af.newValue({stringValue:s.join("")})}default:return Af.mr()}}}class DC{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class _C{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class bC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,19400);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Af.gr();case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const s=e.codePointAt(n);if(void 0===s)return;if(s<=65535)if(s>=55296&&s<=57343)if(s<=56319){const s=e.codePointAt(n+1);void 0!==s&&s>=56320&&s<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(s<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return void 0===e?Af.mr():Af.newValue({integerValue:e})}default:return Af.mr()}}}class vC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,8486);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BYTES":{const e=n.value?.bytesValue;return"string"==typeof e?Af.newValue({integerValue:Gl.fromBase64String(e).toUint8Array().length}):Af.newValue({integerValue:new Uint8Array(e).length})}case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const s=e.codePointAt(n);if(void 0===s)return;if(s>=55296&&s<=57343){if(!(s<=56319))return;{const s=e.codePointAt(n+1);if(void 0===s||!(s>=56320&&s<=57343))return;t+=4,n++}}else if(s<=127)t+=1;else if(s<=2047)t+=2;else if(s<=65535)t+=3;else{if(!(s<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return void 0===e?Af.mr():Af.newValue({integerValue:e})}case"NULL":return Af.gr();default:return Af.mr()}}}class IC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return Af.mr()}return n?Af.gr():this.Or(s.value?.stringValue,r.value?.stringValue)}}class TC extends IC{Or(e,t){try{const n=function(e){let t="";for(let n=0;n<e.length;n++){const s=e.charAt(n);switch(s){case"_":t+=".";break;case"%":t+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":t+="\\"+s;break;default:t+=s}}return"^"+t+"$"}(t),s=qc.compile(n);return Af.newValue({booleanValue:s.matches(e)})}catch(e){return Xc(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),Af.mr()}}}class AC extends IC{Or(e,t){try{const n=qc.compile(t);return Af.newValue({booleanValue:n.test(e)})}catch(e){return Xc(`Invalid regex pattern found in regex_contains: ${t}, returning error`),Af.mr()}}}class OC extends IC{Or(e,t){try{return Af.newValue({booleanValue:qc.compile(t).matches(e)})}catch(e){return Xc(`Invalid regex pattern found in regex_match: ${t}, returning error`),Af.mr()}}}class SC extends IC{Or(e,t){return Af.newValue({booleanValue:e.includes(t)})}}class NC extends IC{Or(e,t){return Af.newValue({booleanValue:e.startsWith(t)})}}class RC extends IC{Or(e,t){return Af.newValue({booleanValue:e.endsWith(t)})}}class kC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,29079);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Af.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return Af.gr();default:return Af.mr()}}}class LC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,60487);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Af.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return Af.gr();default:return Af.mr()}}}class xC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,28544);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Af.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return Af.gr();default:return Af.mr()}}}class FC{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Nf(n).evaluate(e,t));let s="",r=!1;for(const e of n)switch(e.type){case"STRING":s+=e.value.stringValue;break;case"NULL":r=!0;break;default:return Af.mr()}return r?Af.gr():Af.newValue({stringValue:s})}}class PC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,4483);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"UNSET":return Af.pr();case"MAP":break;default:return Af.mr()}const s=Nf(this.expr.params[1]).evaluate(e,t);if("STRING"!==s.type)return Af.mr();const r=n.value?.mapValue?.fields?.[s.value?.stringValue];return void 0===r?Af.pr():Af.newValue(r)}}class MC{constructor(e){this.expr=e}evaluate(e,t){nl(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Af.mr()}if(n)return Af.gr();const i=Au(s.value),a=Au(r.value);if(void 0===i||void 0===a||i.values?.length!==a.values?.length)return Af.mr();const o=this.Mr(i,a);return void 0===o||isNaN(o)?Af.mr():Af.newValue({doubleValue:o})}}class GC extends MC{Mr(e,t){const n=e?.values??[],s=t?.values??[];if(0===n.length)return;let r=0,i=0,a=0;for(let e=0;e<n.length;e++){if(!Du(n[e])||!Du(s[e]))return;const t=xf(n[e]),o=xf(s[e]);r+=t*o,i+=t*t,a+=o*o}const o=Math.sqrt(i)*Math.sqrt(a);return 0!==o?1-Math.max(-1,Math.min(1,r/o)):void 0}}class UC extends MC{Mr(e,t){const n=e?.values??[],s=t?.values??[];if(0===n.length)return 0;let r=0;for(let e=0;e<n.length;e++){if(!Du(n[e])||!Du(s[e]))return;r+=xf(n[e])*xf(s[e])}return r}}class HC extends MC{Mr(e,t){const n=e?.values??[],s=t?.values??[];if(0===n.length)return 0;let r=0;for(let e=0;e<n.length;e++){if(!Du(n[e])||!Du(s[e]))return;const t=xf(n[e]),i=xf(s[e]);r+=Math.pow(t-i,2)}return Math.sqrt(r)}}class VC{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,39044);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"VECTOR":{const e=Au(n.value);return Af.newValue({integerValue:e?.values?.length??0})}case"NULL":return Af.gr();default:return Af.mr()}}}const jC=BigInt(-62135596800),$C=BigInt(253402300799),JC=BigInt(1e3),qC=BigInt(1e6),zC=jC*JC,KC=$C*JC+BigInt(999),QC=jC*qC,WC=$C*qC+BigInt(999999);function YC(e){return e>=QC&&e<=WC}function XC(e){return e>=jC&&e<=$C}function ZC(e,t){const n=BigInt(e);return!(n<jC||n>$C||t<0||t>=1e9||n===jC&&0!==t||n===$C&&t>999999999)}function eg(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function tg(e){return BigInt(e.seconds)*qC+BigInt(Math.trunc(e.nanoseconds/1e3))}class ng{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return Af.gr();default:return Af.mr()}}}class sg extends ng{toTimestamp(e){if(!YC(e))return Af.mr();let t=Number(e/qC),n=Number(e%qC*BigInt(1e3));const s=eg(t,n);return t=s.seconds,n=s.nanos,ZC(t,n)?Af.newValue({timestampValue:{seconds:t,nanos:n}}):Af.mr()}}class rg extends ng{toTimestamp(e){if(!function(e){return e>=zC&&e<=KC}(e))return Af.mr();let t=Number(e/JC),n=Number(e%JC*BigInt(1e6));const s=eg(t,n);return t=s.seconds,n=s.nanos,ZC(t,n)?Af.newValue({timestampValue:{seconds:t,nanos:n}}):Af.mr()}}class ig extends ng{toTimestamp(e){if(!XC(e))return Af.mr();const t=Number(e);return Af.newValue({timestampValue:{seconds:t,nanos:0}})}}class ag{constructor(e){this.expr=e}evaluate(e,t){nl(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=Nf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"TIMESTAMP":break;case"NULL":return Af.gr();default:return Af.mr()}const s=Cp(n.value.timestampValue);return ZC(s.seconds,s.nanoseconds)?this.Nr(s):Af.mr()}}class og extends ag{Nr(e){const t=tg(e);return YC(t)?Af.newValue({integerValue:`${t.toString()}`}):Af.mr()}}class Bg extends ag{Nr(e){const t=tg(e),n=t/BigInt(1e3),s=t%BigInt(1e3);return n>BigInt(0)||s===BigInt(0)?Af.newValue({integerValue:n.toString()}):Af.newValue({integerValue:(n-BigInt(1)).toString()})}}class cg extends ag{Nr(e){const t=BigInt(e.seconds);return XC(t)?Af.newValue({integerValue:t.toString()}):Af.mr()}}class lg{constructor(e){this.expr=e}evaluate(e,t){nl(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const s=Nf(this.expr.params[0]).evaluate(e,t);switch(s.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return Af.mr()}const r=Nf(this.expr.params[1]).evaluate(e,t);let i;switch(r.type){case"STRING":if(i=function(e){switch(e){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}}(r.value.stringValue),void 0===i)return Af.mr();break;case"NULL":n=!0;break;default:return Af.mr()}const a=Nf(this.expr.params[2]).evaluate(e,t);switch(a.type){case"INT":break;case"NULL":n=!0;break;default:return Af.mr()}if(n)return Af.gr();const o=BigInt(a.value.integerValue);let B;try{switch(i){case"microsecond":B=o;break;case"millisecond":B=o*BigInt(1e3);break;case"second":B=o*BigInt(1e6);break;case"minute":B=o*BigInt(6e7);break;case"hour":B=o*BigInt(36e8);break;case"day":B=o*BigInt(864e8);break;default:return Af.mr()}if("microsecond"!==i&&o!==BigInt(0)&&B/o!==BigInt(this.Lr(i)))return Af.mr()}catch(e){return Xc(`Error during timestamp arithmetic: ${e}`),Af.mr()}const c=Cp(s.value.timestampValue);if(!ZC(c.seconds,c.nanoseconds))return Af.mr();const l=tg(c),u=this.Br(l,B);if(!YC(u))return Af.mr();const h=Number(u/qC),p=u%qC,d=Number((p<0?p+qC:p)*BigInt(1e3)),f=p<0?h-1:h;return ZC(f,d)?Af.newValue({timestampValue:{seconds:f,nanos:d}}):Af.mr()}Lr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class ug extends lg{Br(e,t){return e+t}}class hg extends lg{Br(e,t){return e-t}}function pg(e){if((e=Sf(e))instanceof Yd)return`fld(${e.fieldName})`;if(e instanceof Xd)return`cst(${function(e){return null===e?"null":"number"==typeof e?e.toString():"string"==typeof e?`"${e}"`:e instanceof Rd?`ref(${e.path})`:e instanceof xd?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof tf)return`fn(${e.name},[${e.params.map(pg).join(",")}])`;if("ListOfExpressions"===e.expressionType)return`list([${e.cr.map(pg).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function dg(e){return`${Array.from(e.entries()).sort().map(([e,t])=>`${e}=${pg(t)}`).join(",")}`}function fg(e){return e.stages.map(e=>function(e){if(e instanceof cf)return`${e._name}(${dg(e.fields)})`;if(e instanceof lf){let t=`${e._name}(${dg(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${dg(e.groups)})`),t}if(e instanceof uf)return`${e._name}(${dg(e.groups)})`;if(e instanceof hf)return`${e._name}(${e.hr})`;if(e instanceof pf)return`${e._name}(${e.collectionId})`;if(e instanceof df)return`${e._name}()`;if(e instanceof ff)return`${e._name}(${e.Tr.sort()})`;if(e instanceof Cf)return`${e._name}(${pg(e.condition)})`;if(e instanceof gf)return`${e._name}(${e.limit})`;if(e instanceof Ef)return`${e._name}(${function(e){return e.map(e=>`${pg(e.expr)}${e.direction}`).join(",")}(e.orderings)})`;throw new Error(`Unrecognized stage ${e._name}`)}(e)).join("|")}function Cg(e,t){return fg(e)===fg(t)}function gg(e){return e instanceof _f}function mg(e){return gg(e)?fg(e):Kh(e)}function wg(e){return gg(e)?fg(e):function(e){return`${Hh(qh(e))}|lt:${e.limitType}`}(e)}function Eg(e,t){return e instanceof _f&&t instanceof _f?Cg(e,t):!(e instanceof _f&&!(t instanceof _f)||!(e instanceof _f)&&t instanceof _f)&&function(e,t){return Vh(qh(e),qh(t))&&e.limitType===t.limitType}(e,t)}function yg(e){return function(e){return!!e.isCorePipeline}(e)?fg(e):Hh(e)}function Dg(e,t){return e instanceof _f&&t instanceof _f?Cg(e,t):!(e instanceof _f&&!(t instanceof _f)||!(e instanceof _f)&&t instanceof _f)&&Vh(e,t)}class _g{constructor(e,t,n,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const s=this.mutations[t];s.key.isEqual(e.key)&&nh(s,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=sh(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=sh(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=Bp();return this.mutations.forEach(s=>{const r=e.get(s.key),i=r.overlayedDocument;let a=this.applyToLocalView(i,r.mutatedFields);a=t.has(s.key)?null:a;const o=th(i,a);null!==o&&n.set(s.key,o),i.isValidDocument()||i.convertToNoDocument(Lh.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),hp())}isEqual(e){return this.batchId===e.batchId&&ul(this.mutations,e.mutations,(e,t)=>ih(e,t))&&ul(this.baseMutations,e.baseMutations,(e,t)=>ih(e,t))}}class bg{constructor(e,t,n,s){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=s}static from(e,t,n){nl(e.mutations.length===n.length,58842,{Ur:e.mutations.length,kr:n.length});let s=lp;const r=e.mutations;for(let e=0;e<r.length;e++)s=s.insert(r[e].key,n[e].version);return new bg(e,t,n,s)}}function vg(e,t){let n=t;const s=e.length;for(let t=0;t<s;t++){const s=e.charAt(t);switch(s){case"\0":n+="";break;case"":n+="";break;default:n+=s}}return n}function Ig(e){return e+""}class Tg{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class Ag{constructor(e){this.$r=e}}function Og(e){const t=vp({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?zh(t,t.limit,"L"):t}class Sg{constructor(){this.Zi=new Ng}addToCollectionParentIndex(e,t){return this.Zi.add(t),wd.resolve()}getCollectionParents(e,t){return wd.resolve(this.Zi.getEntries(t))}addFieldIndex(e,t){return wd.resolve()}deleteFieldIndex(e,t){return wd.resolve()}deleteAllFieldIndexes(e){return wd.resolve()}createTargetIndexes(e,t){return wd.resolve()}getDocumentsMatchingTarget(e,t){return wd.resolve(null)}getIndexType(e,t){return wd.resolve(0)}getFieldIndexes(e,t){return wd.resolve([])}getNextCollectionGroupToUpdate(e){return wd.resolve(null)}getMinOffset(e,t){return wd.resolve(Ph.min())}getMinOffsetFromCollectionGroup(e,t){return wd.resolve(Ph.min())}updateCollectionGroup(e,t,n){return wd.resolve()}updateIndexEntries(e,t){return wd.resolve()}}class Ng{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new fl(yl.comparator),r=!s.has(n);return this.index[t]=s.add(n),r}has(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t];return s&&s.has(n)}getEntries(e){return(this.index[e]||new fl(yl.comparator)).toArray()}}class Rg{constructor(e){this.ys=e}next(){return this.ys+=2,this.ys}static ws(){return new Rg(0)}static bs(){return new Rg(-1)}}function kg(e,t){return function(e,t){let n=t;for(const t of e.stages)n=Lg({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}(e,[t]).length>0}function Lg(e,t,n){if(t instanceof hf)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.hr)}(0,t,n);if(t instanceof Cf)return function(e,t,n){return n.filter(n=>{const s=Of(Nf(t.condition).evaluate(e,n));return void 0!==s&&hu(s,cu)})}(e,t,n);if(t instanceof pf)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId)}(0,t,n);if(t instanceof df)return function(e,t,n){return n.filter(e=>e.isFoundDocument())}(0,0,n);if(t instanceof ff)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&t.Pr.has(e.key.path.toStringWithLeadingSlash()))}(0,t,n);if(t instanceof gf)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof Ef)return function(e,t,n){const s=t.orderings.map(e=>({Ms:Nf(e.expr),direction:e.direction}));return[...n].sort((t,n)=>{for(const{Ms:r,direction:i}of s){const s=Of(r.evaluate(e,t)),a=Of(r.evaluate(e,n)),o=du(s??Bu,a??Bu);if(0!==o)return"ascending"===i?o:-o}return 0})}(e,t,n);throw new Error(`Unknown stage: ${t._name}`)}class xg{constructor(){this.changes=new tp(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,xh.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?wd.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class Fg{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Pg{constructor(e,t,n,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=s}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(s=>(n=s,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&sh(n.mutation,e,bl.empty(),Pl.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,hp()).next(()=>t))}getLocalViewOfDocuments(e,t,n=hp()){const s=op();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,n).next(e=>{let t=ip();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=op();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,hp()))}populateOverlays(e,t,n){const s=[];return n.forEach(e=>{t.has(e)||s.push(e)}),this.documentOverlayCache.getOverlays(e,s).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,s){let r=sp();const i=cp(),a=cp();return t.forEach((e,t)=>{const a=n.get(t.key);s.has(t.key)&&(void 0===a||a.mutation instanceof oh)?r=r.insert(t.key,t):void 0!==a?(i.set(t.key,a.mutation.getFieldMask()),sh(a.mutation,t,a.mutation.getFieldMask(),Pl.now())):i.set(t.key,bl.empty())}),this.recalculateAndSaveOverlays(e,r).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>a.set(e,new Fg(t,i.get(e)??null))),a))}recalculateAndSaveOverlays(e,t){const n=cp();let s=new hl((e,t)=>e-t),r=hp();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const r of e)r.keys().forEach(e=>{const i=t.get(e);if(null===i)return;let a=n.get(e)||bl.empty();a=r.applyToLocalView(i,a),n.set(e,a);const o=(s.get(r.batchId)||hp()).add(e);s=s.insert(r.batchId,o)})}).next(()=>{const i=[],a=s.getReverseIterator();for(;a.hasNext();){const s=a.getNext(),o=s.key,B=s.value,c=Bp();B.forEach(e=>{if(!r.has(e)){const s=th(t.get(e),n.get(e));null!==s&&c.set(e,s),r=r.add(e)}}),i.push(this.documentOverlayCache.saveOverlays(e,o,c))}return wd.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,s){return gg(t)?this.getDocumentsMatchingPipeline(e,t,n,s):function(e){return Al.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):function(e){return null!==e.collectionGroup}(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,s):this.getDocumentsMatchingCollectionQuery(e,t,n,s)}getNextDocuments(e,t,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,s).next(r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-r.size):wd.resolve(op());let a=-1,o=r;return i.next(t=>wd.forEach(t,(t,n)=>(a<n.largestBatchId&&(a=n.largestBatchId),r.get(t)?wd.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,r)).next(()=>this.computeViews(e,o,t,hp())).next(e=>({batchId:a,changes:ap(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Al(t)).next(e=>{let t=ip();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,s){const r=t.collectionGroup;let i=ip();return this.indexManager.getCollectionParents(e,r).next(a=>wd.forEach(a,a=>{const o=function(e,t){return new jh(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,a.child(r));return this.getDocumentsMatchingCollectionQuery(e,o,n,s).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,n,s){let r;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(i=>(r=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,s))).next(e=>this.retrieveMatchingLocalDocuments(r,e,e=>Qh(t,e)))}getDocumentsMatchingPipeline(e,t,n,s){if("collection_group"===bf(t)){const r=If(t);let i=ip();return this.indexManager.getCollectionParents(e,r).next(a=>wd.forEach(a,a=>{const o=function(e,t){const n=e.stages.map(e=>e instanceof pf?new hf(t.canonicalString(),{}):e);return new _f(e.serializer,n)}(t,a.child(r));return this.getDocumentsMatchingPipeline(e,o,n,s).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}{let r;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next(i=>{switch(r=i,bf(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,s);case"documents":let i=hp();for(const e of Tf(t))i=i.add(Al.fromPath(e));return this.remoteDocumentCache.getEntries(e,i);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new ml("invalid-argument",`Invalid pipeline source to execute offline: ${fg(t)}`)}}).next(e=>this.retrieveMatchingLocalDocuments(r,e,e=>kg(t,e)))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach((e,n)=>{const s=n.getKey();null===t.get(s)&&(t=t.insert(s,xh.newInvalidDocument(s)))});let s=ip();return t.forEach((t,r)=>{const i=e.get(t);void 0!==i&&sh(i.mutation,r,bl.empty(),Pl.now()),n(r)&&(s=s.insert(t,r))}),s}getOverlaysForPipeline(e,t,n){switch(bf(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,yl.fromString(vf(t)),n);case"collection_group":throw new ml("invalid-argument",`Unexpected collection group pipeline: ${fg(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,Tf(t).map(e=>Al.fromPath(e)));case"database":return this.documentOverlayCache.getAllOverlays(e,n);default:throw new ml("invalid-argument",`Failed to get overlays for pipeline: ${fg(t)}`)}}}class Mg{constructor(e){this.serializer=e,this.Qs=new Map,this.Ws=new Map}getBundleMetadata(e,t){return wd.resolve(this.Qs.get(t))}saveBundleMetadata(e,t){return this.Qs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:wp(e.createTime)}}(t)),wd.resolve()}getNamedQuery(e,t){return wd.resolve(this.Ws.get(t))}saveNamedQuery(e,t){return this.Ws.set(t.name,function(e){return{name:e.name,query:Og(e.bundledQuery),readTime:wp(e.readTime)}}(t)),wd.resolve()}}class Gg{constructor(){this.overlays=new hl(Al.comparator),this.Gs=new Map}getOverlay(e,t){return wd.resolve(this.overlays.get(t))}getOverlays(e,t){const n=op();return wd.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}getAllOverlays(e,t){const n=op();return this.overlays.forEach((e,s)=>{s.largestBatchId>t&&n.set(e,s)}),wd.resolve(n)}saveOverlays(e,t,n){return n.forEach((n,s)=>{this.Zr(e,t,s)}),wd.resolve()}removeOverlaysForBatchId(e,t,n){const s=this.Gs.get(n);return void 0!==s&&(s.forEach(e=>this.overlays=this.overlays.remove(e)),this.Gs.delete(n)),wd.resolve()}getOverlaysForCollection(e,t,n){const s=op(),r=t.length+1,i=new Al(t.child("")),a=this.overlays.getIteratorFrom(i);for(;a.hasNext();){const e=a.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===r&&e.largestBatchId>n&&s.set(e.getKey(),e)}return wd.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let r=new hl((e,t)=>e-t);const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=op(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const a=op(),o=r.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=s)););return wd.resolve(a)}Zr(e,t,n){const s=this.overlays.get(n.key);if(null!==s){const e=this.Gs.get(s.largestBatchId).delete(n.key);this.Gs.set(s.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Tg(t,n));let r=this.Gs.get(t);void 0===r&&(r=hp(),this.Gs.set(t,r)),this.Gs.set(t,r.add(n.key))}}class Ug{constructor(){this.sessionToken=Gl.EMPTY_BYTE_STRING}getSessionToken(e){return wd.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,wd.resolve()}}class Hg{constructor(){this.zs=new fl(Vg.js),this.Hs=new fl(Vg.Js)}isEmpty(){return this.zs.isEmpty()}addReference(e,t){const n=new Vg(e,t);this.zs=this.zs.add(n),this.Hs=this.Hs.add(n)}Ys(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Zs(new Vg(e,t))}Xs(e,t){e.forEach(e=>this.removeReference(e,t))}e_(e){const t=new Al(new yl([])),n=new Vg(t,e),s=new Vg(t,e+1),r=[];return this.Hs.forEachInRange([n,s],e=>{this.Zs(e),r.push(e.key)}),r}t_(){this.zs.forEach(e=>this.Zs(e))}Zs(e){this.zs=this.zs.delete(e),this.Hs=this.Hs.delete(e)}n_(e){const t=new Al(new yl([])),n=new Vg(t,e),s=new Vg(t,e+1);let r=hp();return this.Hs.forEachInRange([n,s],e=>{r=r.add(e.key)}),r}containsKey(e){const t=new Vg(e,0),n=this.zs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Vg{constructor(e,t){this.key=e,this.r_=t}static js(e,t){return Al.comparator(e.key,t.key)||al(e.r_,t.r_)}static Js(e,t){return al(e.r_,t.r_)||Al.comparator(e.key,t.key)}}class jg{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Gr=1,this.i_=new fl(Vg.js)}checkEmpty(e){return wd.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,s){const r=this.Gr;this.Gr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new _g(r,t,n,s);this.mutationQueue.push(i);for(const t of s)this.i_=this.i_.add(new Vg(t.key,r)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return wd.resolve(i)}lookupMutationBatch(e,t){return wd.resolve(this.s_(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,s=this.__(n),r=s<0?0:s;return wd.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return wd.resolve(0===this.mutationQueue.length?-1:this.Gr-1)}getAllMutationBatches(e){return wd.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Vg(t,0),s=new Vg(t,Number.POSITIVE_INFINITY),r=[];return this.i_.forEachInRange([n,s],e=>{const t=this.s_(e.r_);r.push(t)}),wd.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new fl(al);return t.forEach(e=>{const t=new Vg(e,0),s=new Vg(e,Number.POSITIVE_INFINITY);this.i_.forEachInRange([t,s],e=>{n=n.add(e.r_)})}),wd.resolve(this.o_(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,s=n.length+1;let r=n;Al.isDocumentKey(r)||(r=r.child(""));const i=new Vg(new Al(r),0);let a=new fl(al);return this.i_.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===s&&(a=a.add(e.r_)),!0)},i),wd.resolve(this.o_(a))}o_(e){const t=[];return e.forEach(e=>{const n=this.s_(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){nl(0===this.a_(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.i_;return wd.forEach(t.mutations,s=>{const r=new Vg(s.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.i_=n})}Hr(e){}containsKey(e,t){const n=new Vg(t,0),s=this.i_.firstAfterOrEqual(n);return wd.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,wd.resolve()}a_(e,t){return this.__(e)}__(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}s_(e){const t=this.__(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class $g{constructor(e){this.u_=e,this.docs=new hl(Al.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,s=this.docs.get(n),r=s?s.size:0,i=this.u_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return wd.resolve(n?n.document.mutableCopy():xh.newInvalidDocument(t))}getEntries(e,t){let n=sp();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():xh.newInvalidDocument(e))}),wd.resolve(n)}getAllEntries(e){let t=sp();return this.docs.forEach((e,n)=>{t=t.insert(e,n.document)}),wd.resolve(t)}getDocumentsMatchingQuery(e,t,n,s){let r,i;gg(t)?(r=yl.fromString(vf(t)),i=e=>kg(t,e)):(r=t.path,i=e=>Qh(t,e));let a=sp();const o=new Al(r.child("__id-9223372036854775808__")),B=this.docs.getIteratorFrom(o);for(;B.hasNext();){const{key:e,value:{document:t}}=B.getNext();if(!r.isPrefixOf(e.path))break;e.path.length>r.length+1||Mh(Fh(t),n)<=0||(s.has(t.key)||i(t))&&(a=a.insert(t.key,t.mutableCopy()))}return wd.resolve(a)}getAllFromCollectionGroup(e,t,n,s){el(9500)}c_(e,t){return wd.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new Jg(this)}getSize(e){return wd.resolve(this.size)}}class Jg extends xg{constructor(e){super(),this.$s=e}applyChanges(e){const t=[];return this.changes.forEach((n,s)=>{s.isValidDocument()?t.push(this.$s.addEntry(e,s)):this.$s.removeEntry(n)}),wd.waitFor(t)}getFromCache(e,t){return this.$s.getEntry(e,t)}getAllFromCache(e,t){return this.$s.getEntries(e,t)}}class qg{constructor(e){this.persistence=e,this.l_=new tp(e=>yg(e),Dg),this.lastRemoteSnapshotVersion=Lh.min(),this.highestTargetId=0,this.E_=0,this.h_=new Hg,this.targetCount=0,this.T_=Rg.ws()}forEachTarget(e,t){return this.l_.forEach((e,n)=>t(n)),wd.resolve()}getLastRemoteSnapshotVersion(e){return wd.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return wd.resolve(this.E_)}allocateTargetId(e){return this.highestTargetId=this.T_.next(),wd.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.E_&&(this.E_=t),wd.resolve()}Ds(e){this.l_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.T_=new Rg(t),this.highestTargetId=t),e.sequenceNumber>this.E_&&(this.E_=e.sequenceNumber)}addTargetData(e,t){return this.Ds(t),this.targetCount+=1,wd.resolve()}updateTargetData(e,t){return this.Ds(t),wd.resolve()}removeTargetData(e,t){return this.l_.delete(t.target),this.h_.e_(t.targetId),this.targetCount-=1,wd.resolve()}removeTargets(e,t,n){let s=0;const r=[];return this.l_.forEach((i,a)=>{a.sequenceNumber<=t&&null===n.get(a.targetId)&&(this.l_.delete(i),r.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)}),wd.waitFor(r).next(()=>s)}getTargetCount(e){return wd.resolve(this.targetCount)}getTargetData(e,t){const n=this.l_.get(t)||null;return wd.resolve(n)}addMatchingKeys(e,t,n){return this.h_.Ys(t,n),wd.resolve()}removeMatchingKeys(e,t,n){this.h_.Xs(t,n);const s=this.persistence.referenceDelegate,r=[];return s&&t.forEach(t=>{r.push(s.markPotentiallyOrphaned(e,t))}),wd.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.h_.e_(t),wd.resolve()}getMatchingKeysForTargetId(e,t){const n=this.h_.n_(t);return wd.resolve(n)}containsKey(e,t){return wd.resolve(this.h_.containsKey(t))}}class zg{constructor(e,t){this.P_={},this.overlays={},this.I_=new Cd(0),this.R_=!1,this.R_=!0,this.A_=new Ug,this.referenceDelegate=e(this),this.V_=new qg(this),this.indexManager=new Sg,this.remoteDocumentCache=function(e){return new $g(e)}(e=>this.referenceDelegate.d_(e)),this.serializer=new Ag(t),this.f_=new Mg(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.R_=!1,Promise.resolve()}get started(){return this.R_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Gg,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.P_[e.toKey()];return n||(n=new jg(t,this.referenceDelegate),this.P_[e.toKey()]=n),n}getGlobalsCache(){return this.A_}getTargetCache(){return this.V_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.f_}runTransaction(e,t,n){Wc("MemoryPersistence","Starting transaction:",e);const s=new Kg(this.I_.next());return this.referenceDelegate.m_(),n(s).next(e=>this.referenceDelegate.p_(s).next(()=>e)).toPromise().then(e=>(s.raiseOnCommittedEvent(),e))}g_(e,t){return wd.or(Object.values(this.P_).map(n=>()=>n.containsKey(e,t)))}}class Kg extends gd{constructor(e){super(),this.currentSequenceNumber=e}}class Qg{constructor(e){this.persistence=e,this.y_=new Hg,this.w_=null}static b_(e){return new Qg(e)}get S_(){if(this.w_)return this.w_;throw el(60996)}addReference(e,t,n){return this.y_.addReference(n,t),this.S_.delete(n.toString()),wd.resolve()}removeReference(e,t,n){return this.y_.removeReference(n,t),this.S_.add(n.toString()),wd.resolve()}markPotentiallyOrphaned(e,t){return this.S_.add(t.toString()),wd.resolve()}removeTarget(e,t){this.y_.e_(t.targetId).forEach(e=>this.S_.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.S_.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}m_(){this.w_=new Set}p_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return wd.forEach(this.S_,n=>{const s=Al.fromPath(n);return this.v_(e,s).next(e=>{e||t.removeEntry(s,Lh.min())})}).next(()=>(this.w_=null,t.apply(e)))}updateLimboDocument(e,t){return this.v_(e,t).next(e=>{e?this.S_.delete(t.toString()):this.S_.add(t.toString())})}d_(e){return 0}v_(e,t){return wd.or([()=>wd.resolve(this.y_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.g_(e,t)])}}class Wg{constructor(e,t){this.persistence=e,this.D_=new tp(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=Ig(t)),t=vg(e.get(n),t);return Ig(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new vd(e,t)}(this,t)}static b_(e,t){return new Wg(e,t)}m_(){}p_(e){return wd.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}ir(e){const t=this.Cs(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}Cs(e){let t=0;return this.sr(e,e=>{t++}).next(()=>t)}sr(e,t){return wd.forEach(this.D_,(n,s)=>this.Os(e,n,s).next(e=>e?wd.resolve():t(s)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const s=this.persistence.getRemoteDocumentCache(),r=s.newChangeBuffer();return s.c_(e,s=>this.Os(e,s,t).next(e=>{e||(n++,r.removeEntry(s,Lh.min()))})).next(()=>r.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.D_.set(t,e.currentSequenceNumber),wd.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.D_.set(n,e.currentSequenceNumber),wd.resolve()}removeReference(e,t,n){return this.D_.set(n,e.currentSequenceNumber),wd.resolve()}updateLimboDocument(e,t){return this.D_.set(t,e.currentSequenceNumber),wd.resolve()}d_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=wu(e.data.value)),t}Os(e,t,n){return wd.or([()=>this.persistence.g_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.D_.get(t);return wd.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class Yg{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.Vo=n,this.fo=s}static mo(e,t){let n=hp(),s=hp();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:s=s.add(e.doc.key)}return new Yg(e,t.fromCache,n,s)}}function Xg(e,t){return Al.comparator(e.key,t.key)}class Zg{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class em{constructor(){this.po=!1,this.yo=!1,this.wo=100,this.bo=Gn()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(Pn())>0?6:4}initialize(e,t){this.So=e,this.indexManager=t,this.po=!0}getDocumentsMatchingQuery(e,t,n,s){const r={result:null};return this.vo(e,t).next(e=>{r.result=e}).next(()=>{if(!r.result)return this.Do(e,t,s,n).next(e=>{r.result=e})}).next(()=>{if(r.result)return;const n=new Zg;return this.xo(e,t,n).next(s=>{if(r.result=s,this.yo)return this.Co(e,t,n,s.size)})}).next(()=>r.result)}Co(e,t,n,s){return gg(t)?wd.resolve():n.documentReadCount<this.wo?(Qc()<=as.DEBUG&&Wc("QueryEngine","SDK will not create cache indexes for query:",Kh(t),"since it only creates cache indexes for collection contains","more than or equal to",this.wo,"documents"),wd.resolve()):(Qc()<=as.DEBUG&&Wc("QueryEngine","Query:",Kh(t),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.bo*s?(Qc()<=as.DEBUG&&Wc("QueryEngine","The SDK decides to create cache indexes for query:",Kh(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,qh(t))):wd.resolve())}vo(e,t){if(gg(t))return wd.resolve(null);let n=t;if($h(n))return wd.resolve(null);let s=qh(n);return this.indexManager.getIndexType(e,s).next(t=>0===t?null:(null!==n.limit&&1===t&&(n=zh(n,null,"F"),s=qh(n)),this.indexManager.getDocumentsMatchingTarget(e,s).next(t=>{const r=hp(...t);return this.So.getDocuments(e,r).next(t=>this.indexManager.getMinOffset(e,s).next(s=>{const i=this.Fo(n,t);return this.Oo(n,i,r,s.readTime)?this.vo(e,zh(n,null,"F")):this.Mo(e,i,n,s)}))})))}Do(e,t,n,s){return(gg(t)?function(e){for(const t of e.stages){if(t instanceof gf||t instanceof mf)return!1;if(t instanceof Cf){if(t.condition instanceof sf&&"exists"===t.condition._expr.name&&t.condition._expr.params[0]instanceof Yd&&t.condition._expr.params[0].fieldName===wl)continue;return!1}}return!0}(t):$h(t))||s.isEqual(Lh.min())?wd.resolve(null):this.So.getDocuments(e,n).next(r=>{const i=this.Fo(t,r);return this.Oo(t,i,n,s)?wd.resolve(null):(Qc()<=as.DEBUG&&Wc("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),mg(t)),this.Mo(e,i,t,function(e,t){const n=e.toTimestamp().seconds,s=e.toTimestamp().nanoseconds+1,r=Lh.fromTimestamp(1e9===s?new Pl(n+1,0):new Pl(n,s));return new Ph(r,Al.empty(),t)}(s,-1)).next(e=>e))})}Fo(e,t){let n,s;return gg(e)?(n=new fl(Xg),s=t=>kg(e,t)):(n=new fl(Wh(e)),s=t=>Qh(e,t)),t.forEach((e,t)=>{s(t)&&(n=n.add(t))}),n}Oo(e,t,n,s){if(gg(e))return function(e){return e.stages.some(e=>e instanceof gf||e instanceof mf)}(e);if(null===e.limit)return!1;if(n.size!==t.size)return!0;const r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}xo(e,t,n){return Qc()<=as.DEBUG&&Wc("QueryEngine","Using full collection scan to execute query:",mg(t)),this.So.getDocumentsMatchingQuery(e,t,Ph.min(),n)}Mo(e,t,n,s){return this.So.getDocumentsMatchingQuery(e,n,s).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class tm{constructor(e,t,n,s){this.persistence=e,this.No=t,this.serializer=s,this.Lo=new hl(al),this.Bo=new tp(e=>yg(e),Dg),this.Uo=new Map,this.ko=e.getRemoteDocumentCache(),this.V_=e.getTargetCache(),this.f_=e.getBundleCache(),this.qo(n)}qo(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Pg(this.ko,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ko.setIndexManager(this.indexManager),this.No.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Lo))}}async function nm(e,t){const n=sl(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let s;return n.mutationQueue.getAllMutationBatches(e).next(r=>(s=r,n.qo(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const r=[],i=[];let a=hp();for(const e of s){r.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}return n.localDocuments.getDocuments(e,a).next(e=>({$o:e,removedBatchIds:r,addedBatchIds:i}))})})}function sm(e,t){const n=sl(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}class rm{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.Yo=0,this.Zo=null,this.Xo=!0}ea(){0===this.Yo&&(this.ta("Unknown"),this.Zo=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.Zo=null,this.na("Backend didn't respond within 10 seconds."),this.ta("Offline"),Promise.resolve())))}ra(e){"Online"===this.state?this.ta("Unknown"):(this.Yo++,this.Yo>=1&&(this.ia(),this.na(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ta("Offline")))}set(e){this.ia(),this.Yo=0,"Online"===e&&(this.Xo=!1),this.ta(e)}ta(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}na(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis 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.Xo?(Yc(t),this.Xo=!1):Wc("OnlineStateTracker",t)}ia(){null!==this.Zo&&(this.Zo.cancel(),this.Zo=null)}}const im="RemoteStore";class am{constructor(e,t,n,s,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.sa=[],this._a=new Map,this.oa=new Map,this.aa=new Map,this.ua=new Rg(1e3),this.ca=new Rg(1001),this.la=new Set,this.Ea=[],this.ha=r,this.ha.Qe(e=>{n.enqueueAndForget(async()=>{cm(this)&&(Wc(im,"Restarting streams for network reachability change."),await async function(e){const t=sl(e);t.la.add(4),await Bm(t),t.Ta.set("Unknown"),t.la.delete(4),await om(t)}(this))})}),this.Ta=new rm(n,s)}}async function om(e){if(cm(e))for(const t of e.Ea)await t(!0)}async function Bm(e){for(const t of e.Ea)await t(!1)}function cm(e){return 0===sl(e).la.size}async function lm(e,t,n){if(!Ed(t))throw t;e.la.add(1),await Bm(e),e.Ta.set("Offline"),n||(n=()=>function(e){const t=sl(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.V_.getLastRemoteSnapshotVersion(e))}(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Wc(im,"Retrying IndexedDB access"),await n(),e.la.delete(1),await om(e)})}function um(e,t){return t().catch(n=>lm(e,n,t))}async function hm(e){const t=sl(e),n=Dm(t);let s=t.sa.length>0?t.sa[t.sa.length-1].batchId:-1;for(;pm(t);)try{const e=await sm(t.localStore,s);if(null===e){0===t.sa.length&&n.en();break}s=e.batchId,dm(t,e)}catch(e){await lm(t,e)}fm(t)&&Cm(t)}function pm(e){return cm(e)&&e.sa.length<10}function dm(e,t){e.sa.push(t);const n=Dm(e);n.Yt()&&n.Rn&&n.An(t.mutations)}function fm(e){return cm(e)&&!Dm(e).Jt()&&e.sa.length>0}function Cm(e){Dm(e).start()}async function gm(e){Dm(e).fn()}async function mm(e){const t=Dm(e);for(const n of e.sa)t.An(n.mutations)}async function wm(e,t,n){const s=e.sa.shift(),r=bg.from(s,t,n);await um(e,()=>e.remoteSyncer.applySuccessfulWrite(r)),await hm(e)}async function Em(e,t){t&&Dm(e).Rn&&await async function(e,t){if(function(e){return function(e){switch(e){case gl.OK:return el(64938);case gl.CANCELLED:case gl.UNKNOWN:case gl.DEADLINE_EXCEEDED:case gl.RESOURCE_EXHAUSTED:case gl.INTERNAL:case gl.UNAVAILABLE:case gl.UNAUTHENTICATED:return!1;case gl.INVALID_ARGUMENT:case gl.NOT_FOUND:case gl.ALREADY_EXISTS:case gl.PERMISSION_DENIED:case gl.FAILED_PRECONDITION:case gl.ABORTED:case gl.OUT_OF_RANGE:case gl.UNIMPLEMENTED:case gl.DATA_LOSS:return!0;default:return el(15467,{code:e})}}(e)&&e!==gl.ABORTED}(t.code)){const n=e.sa.shift();Dm(e).Xt(),await um(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await hm(e)}}(e,t),fm(e)&&Cm(e)}async function ym(e,t){const n=sl(e);n.asyncQueue.verifyOperationInProgress(),Wc(im,"RemoteStore received new credentials");const s=cm(n);n.la.add(3),await Bm(n),s&&n.Ta.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.la.delete(3),await om(n)}function Dm(e){return e.Ra||(e.Ra=function(e,t,n){const s=sl(e);return s.pn(),new cd(t,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(e.datastore,e.asyncQueue,{ct:()=>Promise.resolve(),Et:gm.bind(null,e),Tt:Em.bind(null,e),Vn:mm.bind(null,e),dn:wm.bind(null,e)}),e.Ea.push(async t=>{t?(e.Ra.Xt(),await hm(e)):(await e.Ra.stop(),e.sa.length>0&&(Wc(im,`Stopping write stream with ${e.sa.length} pending writes`),e.sa=[]))})),e.Ra}class _m{constructor(e,t,n,s,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new Mp,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,s,r){const i=Date.now()+n,a=new _m(e,t,i,s,r);return a.start(n),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new ml(gl.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function bm(e,t){if(Yc("AsyncQueue",`${t}: ${e}`),Ed(e))return new ml(gl.UNAVAILABLE,`${t}: ${e}`);throw e}class vm{constructor(){this.activeTargetIds=pp}Ba(e){this.activeTargetIds=this.activeTargetIds.add(e)}Ua(e){this.activeTargetIds=this.activeTargetIds.delete(e)}La(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Im{constructor(){this.fu=new vm,this.mu={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.fu.Ba(e),this.mu[e]||"not-current"}updateQueryState(e,t,n){this.mu[e]=t}removeLocalQueryTarget(e){this.fu.Ua(e)}isLocalQueryTarget(e){return this.fu.activeTargetIds.has(e)}clearQueryState(e){delete this.mu[e]}getAllActiveQueryTargets(){return this.fu.activeTargetIds}isActiveQueryTarget(e){return this.fu.activeTargetIds.has(e)}start(){return this.fu=new vm,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function Tm(){return"undefined"!=typeof document?document:null}class Am{constructor(){this.queries=Om(),this.onlineState="Unknown",this.Du=new Set}terminate(){!function(e,t){const n=sl(e),s=n.queries;n.queries=Om(),s.forEach((e,n)=>{for(const e of n.bu)e.onError(t)})}(this,new ml(gl.ABORTED,"Firestore shutting down"))}}function Om(){return new tp(e=>wg(e),Eg)}var Sm;!function(e){e.Default="default",e.Cache="cache"}(Sm||(Sm={}));class Nm{constructor(e,t,n,s,r,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.hc={},this.Tc=new tp(e=>wg(e),Eg),this.Pc=new Map,this.Ic=new Set,this.Rc=new hl(Al.comparator),this.Ac=new Map,this.Vc=new Hg,this.dc={},this.fc=new Map,this.mc=Rg.bs(),this.onlineState="Unknown",this.gc=void 0}get isPrimaryClient(){return!0===this.gc}}async function Rm(e,t,n){const s=function(e){const t=sl(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Lm.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=xm.bind(null,t),t}(e);try{const e=await function(e,t){const n=sl(e),s=Pl.now(),r=t.reduce((e,t)=>e.add(t.key),hp());let i,a;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let o=sp(),B=hp();return n.ko.getEntries(e,r).next(e=>{o=e,o.forEach((e,t)=>{t.isValidDocument()||(B=B.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,o)).next(r=>{i=r;const a=[];for(const e of t){const t=rh(e,i.get(e.key).overlayedDocument);null!=t&&a.push(new oh(e.key,t,Nu(t.value.mapValue),Xu.exists(!0)))}return n.mutationQueue.addMutationBatch(e,s,a,t)}).next(t=>{a=t;const s=t.applyToLocalDocumentSet(i,B);return n.documentOverlayCache.saveOverlays(e,t.batchId,s)})}).then(()=>({batchId:a.batchId,changes:ap(i)}))}(s.localStore,t);s.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let s=e.dc[e.currentUser.toKey()];s||(s=new hl(al)),s=s.insert(t,n),e.dc[e.currentUser.toKey()]=s}(s,e.batchId,n),await Mm(s,e.changes),await hm(s.remoteStore)}catch(e){const t=bm(e,"Failed to persist write");n.reject(t)}}function km(e,t,n){const s=sl(e);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const e=[];s.Tc.forEach((n,s)=>{const r=s.view.xu(t);r.snapshot&&e.push(r.snapshot)}),function(e,t){const n=sl(e);n.onlineState=t;let s=!1;n.queries.forEach((e,n)=>{for(const e of n.bu)e.xu(t)&&(s=!0)}),s&&function(e){e.Du.forEach(e=>{e.next()})}(n)}(s.eventManager,t),e.length&&s.hc.Tn(e),s.onlineState=t,s.isPrimaryClient&&s.sharedClientState.setOnlineState(t)}}async function Lm(e,t){const n=sl(e),s=t.batch.batchId;try{const e=await function(e,t){const n=sl(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const s=t.batch.keys(),r=n.ko.newChangeBuffer({trackRemovals:!0});return function(e,t,n,s){const r=n.batch,i=r.keys();let a=wd.resolve();return i.forEach(e=>{a=a.next(()=>s.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);nl(null!==i,48541),t.version.compareTo(i)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),s.addEntry(t)))})}),a.next(()=>e.mutationQueue.removeMutationBatch(t,r))}(n,e,t,r).next(()=>r.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,s,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=hp();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,s))})}(n.localStore,t);Pm(n,s,null),Fm(n,s),n.sharedClientState.updateMutationState(s,"acknowledged"),await Mm(n,e)}catch(e){await md(e)}}async function xm(e,t,n){const s=sl(e);try{const e=await function(e,t){const n=sl(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let s;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(nl(null!==t,37113),s=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,s,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,s)).next(()=>n.localDocuments.getDocuments(e,s))})}(s.localStore,t);Pm(s,t,n),Fm(s,t),s.sharedClientState.updateMutationState(t,"rejected",n),await Mm(s,e)}catch(n){await md(n)}}function Fm(e,t){(e.fc.get(t)||[]).forEach(e=>{e.resolve()}),e.fc.delete(t)}function Pm(e,t,n){const s=sl(e);let r=s.dc[s.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),s.dc[s.currentUser.toKey()]=r}}async function Mm(e,t,n){const s=sl(e),r=[],i=[],a=[];s.Tc.isEmpty()||(s.Tc.forEach((e,o)=>{a.push(s.yc(o,t,n).then(e=>{if((e||n)&&s.isPrimaryClient){const t=e?!e.fromCache:n?.targetChanges.get(o.targetId)?.current;s.sharedClientState.updateQueryState(o.targetId,t?"current":"not-current")}if(e){r.push(e);const t=Yg.mo(o.targetId,e);i.push(t)}}))}),await Promise.all(a),s.hc.Tn(r),await async function(e,t){const n=sl(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>wd.forEach(t,t=>wd.forEach(t.Vo,s=>n.persistence.referenceDelegate.addReference(e,t.targetId,s)).next(()=>wd.forEach(t.fo,s=>n.persistence.referenceDelegate.removeReference(e,t.targetId,s)))))}catch(e){if(!Ed(e))throw e;Wc("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Lo.get(t),s=e.snapshotVersion,r=e.withLastLimboFreeSnapshotVersion(s);n.Lo=n.Lo.insert(t,r)}}}(s.localStore,i))}async function Gm(e,t){const n=sl(e);if(!n.currentUser.isEqual(t)){Wc("SyncEngine","User change. New user:",t.toKey());const e=await nm(n.localStore,t);n.currentUser=t,function(e,t){e.fc.forEach(e=>{e.forEach(e=>{e.reject(new ml(gl.CANCELLED,t))})}),e.fc.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Mm(n,e.$o)}}class Um{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Rp(e.databaseInfo.databaseId),this.sharedClientState=this.vc(e),this.persistence=this.Dc(e),await this.persistence.start(),this.localStore=this.xc(e),this.gcScheduler=this.Cc(e,this.localStore),this.indexBackfillerScheduler=this.Fc(e,this.localStore)}Cc(e,t){return null}Fc(e,t){return null}xc(e){return function(e,t,n,s){return new tm(e,t,n,s)}(this.persistence,new em,e.initialUser,this.serializer)}Dc(e){return new zg(Qg.b_,this.serializer)}vc(e){return new Im}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Um.provider={build:()=>new Um};class Hm extends Um{constructor(e){super(),this.cacheSizeBytes=e}Cc(e,t){nl(this.persistence.referenceDelegate instanceof Wg,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new bd(n,e.asyncQueue,t)}Dc(e){const t=void 0!==this.cacheSizeBytes?fd.withCacheSize(this.cacheSizeBytes):fd.DEFAULT;return new zg(e=>Wg.b_(e,t),this.serializer)}}class Vm{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>km(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Gm.bind(null,this.syncEngine),await async function(e,t){const n=sl(e);t?(n.la.delete(2),await om(n)):t||(n.la.add(2),await Bm(n),n.Ta.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Am}createDatastore(e){const t=Rp(e.databaseInfo.databaseId),n=function(e){return new id(e)}(e.databaseInfo);return function(e,t,n,s){return new ud(e,t,n,s)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,s,r){return new am(e,t,n,s,r)}(this.localStore,this.datastore,e.asyncQueue,e=>km(this.syncEngine,e,0),Wp.Ye()?new Wp:new Kp)}createSyncEngine(e,t){return function(e,t,n,s,r,i,a){const o=new Nm(e,t,n,s,r,i);return a&&(o.gc=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){const t=sl(e);Wc(im,"RemoteStore shutting down."),t.la.add(5),await Bm(t),t.ha.shutdown(),t.Ta.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Vm.provider={build:()=>new Vm};const jm="FirestoreClient";class $m{constructor(e,t,n,s,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=s,this.user=Pp.UNAUTHENTICATED,this.clientId=il.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async e=>{Wc(jm,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Wc(jm,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Mp;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(t){const n=bm(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Jm(e,t){e.asyncQueue.verifyOperationInProgress(),Wc(jm,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let s=n.initialUser;e.setCredentialChangeListener(async e=>{s.isEqual(e)||(await nm(t.localStore,e),s=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function qm(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Wc(jm,"Using user provided OfflineComponentProvider");try{await Jm(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===gl.FAILED_PRECONDITION||e.code===gl.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;Xc("Error using user provided cache. Falling back to memory cache: "+n),await Jm(e,new Um)}}else Wc(jm,"Using default OfflineComponentProvider"),await Jm(e,new Hm(void 0));return e._offlineComponents}(e);Wc(jm,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>ym(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>ym(t.remoteStore,n)),e._onlineComponents=t}function zm(e){return async function(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Wc(jm,"Using user provided OnlineComponentProvider"),await qm(e,e._uninitializedComponentsProvider._online)):(Wc(jm,"Using default OnlineComponentProvider"),await qm(e,new Vm))),e._onlineComponents}(e).then(e=>e.syncEngine)}let Km=class{constructor(e,t,n,s,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Rd(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Qm(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const t=this._document.data.field(Gd("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}},Qm=class extends Km{data(){return super.data()}};const Wm="AsyncQueue";class Ym{constructor(e=Promise.resolve()){this.$c=[],this.Kc=!1,this.Qc=[],this.Wc=null,this.Gc=!1,this.zc=!1,this.jc=[],this.Ht=new ad(this,"async_queue_retry"),this.Hc=()=>{const e=Tm();e&&Wc(Wm,"Visibility state changed to "+e.visibilityState),this.Ht.$t()},this.Jc=e;const t=Tm();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Hc)}get isShuttingDown(){return this.Kc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Yc(),this.Zc(e)}enterRestrictedMode(e){if(!this.Kc){this.Kc=!0,this.zc=e||!1;const t=Tm();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Hc)}}enqueue(e){if(this.Yc(),this.Kc)return new Promise(()=>{});const t=new Mp;return this.Zc(()=>this.Kc&&this.zc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.$c.push(e),this.Xc()))}async Xc(){if(0!==this.$c.length){try{await this.$c[0](),this.$c.shift(),this.Ht.reset()}catch(e){if(!Ed(e))throw e;Wc(Wm,"Operation failed with retryable error: "+e)}this.$c.length>0&&this.Ht.kt(()=>this.Xc())}}Zc(e){const t=this.Jc.then(()=>(this.Gc=!0,e().catch(e=>{throw this.Wc=e,this.Gc=!1,Yc("INTERNAL UNHANDLED ERROR: ",Xm(e)),e}).then(e=>(this.Gc=!1,e))));return this.Jc=t,t}enqueueAfterDelay(e,t,n){this.Yc(),this.jc.indexOf(e)>-1&&(t=0);const s=_m.createAndSchedule(this,e,t,n,e=>this.el(e));return this.Qc.push(s),s}Yc(){this.Wc&&el(47125,{tl:Xm(this.Wc)})}verifyOperationInProgress(){}async nl(){let e;do{e=this.Jc,await e}while(e!==this.Jc)}rl(e){for(const t of this.Qc)if(t.timerId===e)return!0;return!1}il(e){return this.nl().then(()=>{this.Qc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.Qc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.nl()})}sl(e){this.jc.push(e)}el(e){const t=this.Qc.indexOf(e);this.Qc.splice(t,1)}}function Xm(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class Zm extends Od{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new Ym,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Ym(e),this._firestoreClient=void 0,await e}}}function ew(e){if(e._terminated)throw new ml(gl.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){const t=e._freezeSettings(),n=function(e,t,n,s,r){return new Yl(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,zp(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator,s,r._customHeaders,r.grpcFlowControlWindow)}(e._databaseId,e._app?.options.appId||"",e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new $m(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){const t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}(e),e._firestoreClient}class tw{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class nw extends Km{constructor(e,t,n,s,r,i){super(e,t,n,s,i),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new sw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(Gd("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new ml(gl.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=nw._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}nw._jsonSchemaVersion="firestore/documentSnapshot/1.0",nw._jsonSchema={type:kl("string",nw._jsonSchemaVersion),bundleSource:kl("string","DocumentSnapshot"),bundleName:kl("string"),bundle:kl("string")};class sw extends nw{data(e={}){return super.data(e)}}class rw{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new tw(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new sw(this._firestore,this._userDataWriter,n.key,n,new tw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new ml(gl.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{gg(e._snapshot.query)?function(e){const t=function(e){for(let t=e.stages.length-1;t>=0;t--){const n=e.stages[t];if(n instanceof Ef)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(e)}(e._snapshot.query):Wh(e.query._query);const s=new sw(e._firestore,e._userDataWriter,n.doc.key,n.doc,new tw(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const s=new sw(e._firestore,e._userDataWriter,t.doc.key,t.doc,new tw(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,i=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:iw(t.type),doc:s,oldIndex:r,newIndex:i}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new ml(gl.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=rw._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=il.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],s=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),s.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function iw(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return el(61501,{type:e})}}function aw(e){return function(e,t){const n=ew(e);return function(e,t){const n=new Mp;return e.asyncQueue.enqueueAndForget(async()=>Rm(await zm(e),t,n)),n.promise}(n,t)}(Rl(e.firestore,Zm),[new uh(e._key,Xu.none())])}rw._jsonSchemaVersion="firestore/querySnapshot/1.0",rw._jsonSchema={type:kl("string",rw._jsonSchemaVersion),bundleSource:kl("string","QuerySnapshot"),bundleName:kl("string"),bundle:kl("string")};const ow="@firebase/firestore",Bw="4.17.2";!function(e,t=!0){(function(e){zc=e})(Cr),ur(new ns("firestore",(e,{instanceIdentifier:n,options:s})=>{const r=e.getProvider("app").getImmediate(),i=new Zm(new Vp(e.getProvider("auth-internal")),new qp(r,e.getProvider("app-check-internal")),eu(r,n),r);return s={useFetchStreams:t,...s},i._setSettings(s),i},"PUBLIC").setMultipleInstances(!0)),wr(ow,Bw,e),wr(ow,Bw,"esm2020")}();const cw="firebasestorage.googleapis.com",lw="storageBucket";class uw extends jn{constructor(e,t,n=0){super(dw(e),`Firebase Storage: ${t} (${dw(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,uw.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return dw(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var hw,pw;function dw(e){return"storage/"+e}function fw(){return new uw(hw.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function Cw(){return new uw(hw.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function gw(){return new uw(hw.CANCELED,"User canceled the upload/download.")}function mw(){return new uw(hw.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function ww(e){return new uw(hw.INVALID_ARGUMENT,e)}function Ew(){return new uw(hw.APP_DELETED,"The Firebase app was deleted.")}function yw(e,t){return new uw(hw.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function Dw(e){throw new uw(hw.INTERNAL_ERROR,"Internal error: "+e)}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(hw||(hw={}));class _w{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=_w.makeFromUrl(e,t)}catch(t){return new _w(e,"")}if(""===n.path)return n;throw s=e,new uw(hw.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+s+"'.");var s}static makeFromUrl(e,t){let n=null;const s="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(e){e.path_=decodeURIComponent(e.path)}const a=t.replace(/[.]/g,"\\."),o=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${a}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${t===cw?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let t=0;t<o.length;t++){const s=o[t],r=s.regex.exec(e);if(r){const e=r[s.indices.bucket];let t=r[s.indices.path];t||(t=""),n=new _w(e,t),s.postModify(n);break}}if(null==n)throw function(e){return new uw(hw.INVALID_URL,"Invalid URL '"+e+"'.")}(e);return n}}class bw{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function vw(e){return"string"==typeof e||e instanceof String}function Iw(e){return Tw()&&e instanceof Blob}function Tw(){return"undefined"!=typeof Blob}function Aw(e,t,n,s){if(s<t)throw ww(`Invalid value for '${e}'. Expected ${t} or greater.`);if(s>n)throw ww(`Invalid value for '${e}'. Expected ${n} or less.`)}function Ow(e,t,n){let s=t;return null==n&&(s=`https://${t}`),`${n}://${s}/v0${e}`}function Sw(e){const t=encodeURIComponent;let n="?";for(const s in e)if(e.hasOwnProperty(s)){n=n+(t(s)+"="+t(e[s]))+"&"}return n=n.slice(0,-1),n}function Nw(e,t){const n=e>=500&&e<600,s=-1!==[408,429].indexOf(e),r=-1!==t.indexOf(e);return n||s||r}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(pw||(pw={}));class Rw{constructor(e,t,n,s,r,i,a,o,B,c,l,u=!0,h=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=s,this.successCodes_=r,this.additionalRetryCodes_=i,this.callback_=a,this.errorCallback_=o,this.timeout_=B,this.progressCallback_=c,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){const e=(e,t)=>{if(t)return void e(!1,new kw(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const s=e=>{const t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(s),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(s),this.pendingConnection_=null;const t=n.getErrorCode()===pw.NO_ERROR,r=n.getStatus();if(!t||Nw(r,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===pw.ABORT;return void e(!1,new kw(!1,null,t))}const i=-1!==this.successCodes_.indexOf(r);e(!0,new kw(i,n))})},t=(e,t)=>{const n=this.resolve_,s=this.reject_,r=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(r,r.getResponse());!function(e){return void 0!==e}(e)?n():n(e)}catch(e){s(e)}else if(null!==r){const e=fw();e.serverResponse=r.getErrorText(),this.errorCallback_?s(this.errorCallback_(r,e)):s(e)}else if(t.canceled){s(this.appDelete_?Ew():gw())}else{s(Cw())}};this.canceled_?t(0,new kw(!1,null,!0)):this.backoffId_=function(e,t,n){let s=1,r=null,i=null,a=!1,o=0;function B(){return 2===o}let c=!1;function l(...e){c||(c=!0,t.apply(null,e))}function u(t){r=setTimeout(()=>{r=null,e(p,B())},t)}function h(){i&&clearTimeout(i)}function p(e,...t){if(c)return void h();if(e)return h(),void l.call(null,e,...t);if(B()||a)return h(),void l.call(null,e,...t);let n;s<64&&(s*=2),1===o?(o=2,n=0):n=1e3*(s+Math.random()),u(n)}let d=!1;function f(e){d||(d=!0,h(),c||(null!==r?(e||(o=2),clearTimeout(r),u(0)):e||(o=1)))}return u(0),i=setTimeout(()=>{a=!0,f(!0)},n),f}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class kw{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function Lw(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function xw(...e){const t=Lw();if(void 0!==t){const n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}if(Tw())return new Blob(e);throw new uw(hw.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function Fw(e){if("undefined"==typeof atob)throw t="base-64",new uw(hw.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.`);var t;return atob(e)}const Pw="raw",Mw="base64",Gw="base64url",Uw="data_url";class Hw{constructor(e,t){this.data=e,this.contentType=t||null}}function Vw(e,t){switch(e){case Pw:return new Hw(jw(t));case Mw:case Gw:return new Hw($w(e,t));case Uw:return new Hw(function(e){const t=new Jw(e);return t.base64?$w(Mw,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw yw(Uw,"Malformed data URL.")}return jw(t)}(t.rest)}(t),new Jw(t).contentType)}throw fw()}function jw(e){const t=[];for(let n=0;n<e.length;n++){let s=e.charCodeAt(n);if(s<=127)t.push(s);else if(s<=2047)t.push(192|s>>6,128|63&s);else if(55296==(64512&s)){if(n<e.length-1&&56320==(64512&e.charCodeAt(n+1))){s=65536|(1023&s)<<10|1023&e.charCodeAt(++n),t.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s)}else t.push(239,191,189)}else 56320==(64512&s)?t.push(239,191,189):t.push(224|s>>12,128|s>>6&63,128|63&s)}return new Uint8Array(t)}function $w(e,t){switch(e){case Mw:{const n=-1!==t.indexOf("-"),s=-1!==t.indexOf("_");if(n||s){throw yw(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case Gw:{const n=-1!==t.indexOf("+"),s=-1!==t.indexOf("/");if(n||s){throw yw(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Fw(t)}catch(t){if(t.message.includes("polyfill"))throw t;throw yw(e,"Invalid character found")}const s=new Uint8Array(n.length);for(let e=0;e<n.length;e++)s[e]=n.charCodeAt(e);return s}class Jw{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(null===t)throw yw(Uw,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=t[1]||null;null!=n&&(this.base64=function(e,t){const n=e.length>=t.length;if(!n)return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(",")+1)}}class qw{constructor(e,t){let n=0,s="";Iw(e)?(this.data_=e,n=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(Iw(this.data_)){const n=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,e,t);return null===n?null:new qw(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new qw(n,!0)}}static getBlob(...e){if(Tw()){const t=e.map(e=>e instanceof qw?e.data_:e);return new qw(xw.apply(null,t))}{const t=e.map(e=>vw(e)?Vw(Pw,e).data:e.data_);let n=0;t.forEach(e=>{n+=e.byteLength});const s=new Uint8Array(n);let r=0;return t.forEach(e=>{for(let t=0;t<e.length;t++)s[r++]=e[t]}),new qw(s,!0)}}uploadData(){return this.data_}}function zw(e){let t;try{t=JSON.parse(e)}catch(e){return null}return function(e){return"object"==typeof e&&!Array.isArray(e)}(t)?t:null}function Kw(e){const t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function Qw(e,t){return t}class Ww{constructor(e,t,n,s){this.server=e,this.local=t||e,this.writable=!!n,this.xform=s||Qw}}let Yw=null;function Xw(){if(Yw)return Yw;const e=[];e.push(new Ww("bucket")),e.push(new Ww("generation")),e.push(new Ww("metageneration")),e.push(new Ww("name","fullPath",!0));const t=new Ww("name");t.xform=function(e,t){return function(e){return!vw(e)||e.length<2?e:Kw(e)}(t)},e.push(t);const n=new Ww("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new Ww("timeCreated")),e.push(new Ww("updated")),e.push(new Ww("md5Hash",null,!0)),e.push(new Ww("cacheControl",null,!0)),e.push(new Ww("contentDisposition",null,!0)),e.push(new Ww("contentEncoding",null,!0)),e.push(new Ww("contentLanguage",null,!0)),e.push(new Ww("contentType",null,!0)),e.push(new Ww("metadata","customMetadata",!0)),Yw=e,Yw}function Zw(e,t,n){const s={type:"file"},r=n.length;for(let e=0;e<r;e++){const r=n[e];s[r.local]=r.xform(s,t[r.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){const n=e.bucket,s=e.fullPath,r=new _w(n,s);return t._makeStorageReference(r)}})}(s,e),s}function eE(e,t,n){const s=zw(t);if(null===s)return null;return Zw(e,s,n)}function tE(e,t){const n={},s=t.length;for(let r=0;r<s;r++){const s=t[r];s.writable&&(n[s.server]=e[s.local])}return JSON.stringify(n)}const nE="prefixes",sE="items";function rE(e,t,n){const s=zw(n);if(null===s)return null;return function(e,t,n){const s={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[nE])for(const r of n[nE]){const n=r.replace(/\/$/,""),i=e._makeStorageReference(new _w(t,n));s.prefixes.push(i)}if(n[sE])for(const r of n[sE]){const n=e._makeStorageReference(new _w(t,r.name));s.items.push(n)}return s}(e,t,s)}class iE{constructor(e,t,n,s){this.url=e,this.method=t,this.handler=n,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function aE(e){if(!e)throw fw()}function oE(e,t){return function(n,s){const r=eE(e,s,t);return aE(null!==r),r}}function BE(e,t){return function(n,s){const r=eE(e,s,t);return aE(null!==r),function(e,t,n,s){const r=zw(t);if(null===r)return null;if(!vw(r.downloadTokens))return null;const i=r.downloadTokens;if(0===i.length)return null;const a=encodeURIComponent;return i.split(",").map(t=>{const r=e.bucket,i=e.fullPath;return Ow("/b/"+a(r)+"/o/"+a(i),n,s)+Sw({alt:"media",token:t})})[0]}(r,s,e.host,e._protocol)}}function cE(e){return function(t,n){let s;var r,i;return 401===t.getStatus()?s=t.getErrorText().includes("Firebase App Check token is invalid")?new uw(hw.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new uw(hw.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(i=e.bucket,s=new uw(hw.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=e.path,s=new uw(hw.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):s=n,s.status=t.getStatus(),s.serverResponse=n.serverResponse,s}}function lE(e){const t=cE(e);return function(n,s){let r=t(n,s);var i;return 404===n.getStatus()&&(i=e.path,r=new uw(hw.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),r.serverResponse=s.serverResponse,r}}function uE(e,t,n,s,r){const i={};t.isRoot?i.prefix="":i.prefix=t.path+"/",n.length>0&&(i.delimiter=n),s&&(i.pageToken=s),r&&(i.maxResults=r);const a=Ow(t.bucketOnlyServerUrl(),e.host,e._protocol),o=e.maxOperationRetryTime,B=new iE(a,"GET",function(e,t){return function(n,s){const r=rE(e,t,s);return aE(null!==r),r}}(e,t.bucket),o);return B.urlParams=i,B.errorHandler=cE(t),B}function hE(e,t,n){const s=Object.assign({},n);return s.fullPath=e.path,s.size=t.size(),s.contentType||(s.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),s}class pE{constructor(e,t,n,s){this.current=e,this.total=t,this.finalized=!!n,this.metadata=s||null}}function dE(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){aE(!1)}return aE(!!n&&-1!==(t||["active"]).indexOf(n)),n}const fE=262144;function CE(e,t,n,s,r,i,a,o){const B=new pE(0,0);if(a?(B.current=a.current,B.total=a.total):(B.current=0,B.total=s.size()),s.size()!==B.total)throw new uw(hw.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=B.total-B.current;let l=c;r>0&&(l=Math.min(l,r));const u=B.current,h=u+l;let p="";p=0===l?"finalize":c===l?"upload, finalize":"upload";const d={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":`${B.current}`},f=s.slice(u,h);if(null===f)throw mw();const C=t.maxUploadRetryTime,g=new iE(n,"POST",function(e,n){const r=dE(e,["active","final"]),a=B.current+l,o=s.size();let c;return c="final"===r?oE(t,i)(e,n):null,new pE(a,o,"final"===r,c)},C);return g.headers=d,g.body=f.uploadData(),g.progressCallback=o||null,g.errorHandler=cE(e),g}const gE="running",mE="paused",wE="success",EE="canceled",yE="error";function DE(e){switch(e){case"running":case"pausing":case"canceling":return gE;case"paused":return mE;case"success":return wE;case"canceled":return EE;default:return yE}}class _E{constructor(e,t,n){const s=function(e){return"function"==typeof e}(e)||null!=t||null!=n;if(s)this.next=e,this.error=t??void 0,this.complete=n??void 0;else{const t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}}function bE(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}class vE{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=pw.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=pw.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=pw.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,n,s,r){if(this.sent_)throw Dw("cannot .send() more than once");if(es(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==r)for(const e in r)r.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,r[e].toString());return void 0!==s?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Dw("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Dw("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw Dw("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Dw("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class IE extends vE{initXhr(){this.xhr_.responseType="text"}}function TE(){return new IE}class AE{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=Xw(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(hw.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(Nw(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=Cw()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(hw.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,n])=>{switch(this._state){case"running":e(t,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{const n=function(e,t,n,s,r){const i=t.bucketOnlyServerUrl(),a=hE(t,s,r),o={name:a.fullPath},B=Ow(i,e.host,e._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=tE(a,n),u=e.maxUploadRetryTime,h=new iE(B,"POST",function(e){let t;dE(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){aE(!1)}return aE(vw(t)),t},u);return h.urlParams=o,h.headers=c,h.body=l,h.errorHandler=cE(t),h}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,TE,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,n)=>{const s=function(e,t,n,s){const r=e.maxUploadRetryTime,i=new iE(n,"POST",function(e){const t=dE(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){aE(!1)}n||aE(!1);const r=Number(n);return aE(!isNaN(r)),new pE(r,s.size(),"final"===t)},r);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=cE(t),i}(this._ref.storage,this._ref._location,e,this._blob),r=this._ref.storage._makeRequest(s,TE,t,n);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=fE*this._chunkMultiplier,t=new pE(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((s,r)=>{let i;try{i=CE(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(e){return this._error=e,void this._transition("error")}const a=this._ref.storage._makeRequest(i,TE,s,r,!1);this._request=a,a.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(fE*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const n=function(e,t,n){const s=Ow(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,i=new iE(s,"GET",oE(e,n),r);return i.errorHandler=lE(t),i}(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(n,TE,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const n=function(e,t,n,s,r){const i=t.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},o=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();a["Content-Type"]="multipart/related; boundary="+o;const B=hE(t,s,r),c="--"+o+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+tE(B,n)+"\r\n--"+o+"\r\nContent-Type: "+B.contentType+"\r\n\r\n",l="\r\n--"+o+"--",u=qw.getBlob(c,s,l);if(null===u)throw mw();const h={name:B.fullPath},p=Ow(i,e.host,e._protocol),d=e.maxUploadRetryTime,f=new iE(p,"POST",oE(e,n),d);return f.urlParams=h,f.headers=a,f.body=u.uploadData(),f.errorHandler=cE(t),f}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,TE,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=gw(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const e=DE(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,s){const r=new _E(t||void 0,n||void 0,s||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(DE(this._state)){case wE:bE(this._resolve.bind(null,this.snapshot))();break;case EE:case yE:bE(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(DE(this._state)){case gE:case mE:e.next&&bE(e.next.bind(e,this.snapshot))();break;case wE:e.complete&&bE(e.complete.bind(e))();break;default:e.error&&bE(e.error.bind(e,this._error))()}}resume(){const e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){const e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){const e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class OE{constructor(e,t){this._service=e,this._location=t instanceof _w?t:_w.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new OE(e,t)}get root(){const e=new _w(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Kw(this._location.path)}get storage(){return this._service}get parent(){const e=function(e){if(0===e.length)return null;const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;const t=new _w(this._location.bucket,e);return new OE(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new uw(hw.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(e)}}function SE(e){const t={prefixes:[],items:[]};return NE(e,t).then(()=>t)}async function NE(e,t,n){const s={pageToken:n},r=await function(e,t){null!=t&&"number"==typeof t.maxResults&&Aw("options.maxResults",1,1e3,t.maxResults);const n=t||{},s=uE(e.storage,e._location,"/",n.pageToken,n.maxResults);return e.storage.makeRequestWithTokens(s,TE)}(e,s);t.prefixes.push(...r.prefixes),t.items.push(...r.items),null!=r.nextPageToken&&await NE(e,t,r.nextPageToken)}function RE(e){e._throwIfRoot("getDownloadURL");const t=function(e,t,n){const s=Ow(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,i=new iE(s,"GET",BE(e,n),r);return i.errorHandler=lE(t),i}(e.storage,e._location,Xw());return e.storage.makeRequestWithTokens(t,TE).then(e=>{if(null===e)throw new uw(hw.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e})}function kE(e){e._throwIfRoot("deleteObject");const t=function(e,t){const n=Ow(t.fullServerUrl(),e.host,e._protocol),s=e.maxOperationRetryTime,r=new iE(n,"DELETE",function(e,t){},s);return r.successCodes=[200,204],r.errorHandler=lE(t),r}(e.storage,e._location);return e.storage.makeRequestWithTokens(t,TE)}function LE(e,t){if(e instanceof PE){const n=e;if(null==n._bucket)throw new uw(hw.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+lw+"' property when initializing the app?");const s=new OE(n,n._bucket);return null!=t?LE(s,t):s}return void 0!==t?function(e,t){const n=function(e,t){const n=t.split("/").filter(e=>e.length>0).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),s=new _w(e._location.bucket,n);return new OE(e.storage,s)}(e,t):e}function xE(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof PE)return new OE(e,t);throw ww("To use ref(service, url), the first argument must be a Storage instance.")}return LE(e,t)}function FE(e,t){const n=t?.[lw];return null==n?null:_w.makeFromBucketSpec(n,e)}class PE{constructor(e,t,n,s,r,i=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=s,this._firebaseVersion=r,this._isUsingEmulator=i,this._bucket=null,this._host=cw,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?_w.makeFromBucketSpec(s,this._host):FE(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=_w.makeFromBucketSpec(this._url,e):this._bucket=FE(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Aw("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Aw("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){if(pr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});if(e){return(await e.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new OE(this,e)}_makeRequest(e,t,n,s,r=!0){if(this._deleted)return new bw(Ew());{const i=function(e,t,n,s,r,i,a=!0,o=!1){const B=Sw(e.urlParams),c=e.url+B,l=Object.assign({},e.headers);return function(e,t){t&&(e["X-Firebase-GMPID"]=t)}(l,t),function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(l,n),function(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(t??"AppManager")}(l,i),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(l,s),new Rw(c,e.method,l,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,a,o)}(e,this._appId,n,s,t,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(e,t){const[n,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,s).getPromise()}}const ME="@firebase/storage",GE="0.14.5",UE="storage";function HE(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new AE(e,new qw(t),n)}(e=Zn(e),t,n)}function VE(e){return SE(e=Zn(e))}function jE(e){return kE(e=Zn(e))}function $E(e,t){return xE(e=Zn(e),t)}function JE(e=mr(),t){const n=hr(e=Zn(e),UE).getImmediate({identifier:t}),s=Rn("storage");return s&&function(e,t,n,s={}){!function(e,t,n,s={}){e.host=`${t}:${n}`;const r=es(t);r&&ts(`https://${e.host}/b`),e._isUsingEmulator=!0,e._protocol=r?"https":"http";const{mockUserToken:i}=s;i&&(e._overrideAuthToken="string"==typeof i?i:Fn(i,e.app.options.projectId))}(e,t,n,s)}(n,...s),n}function qE(e,{instanceIdentifier:t}){const n=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),r=e.getProvider("app-check-internal");return new PE(n,s,r,t,Cr)}ur(new ns(UE,qE,"PUBLIC").setMultipleInstances(!0)),wr(ME,GE,""),wr(ME,GE,"esm2020");let zE,KE,QE,WE,YE={},XE=null,ZE=!1;const ey=[];let ty;function ny(){return ty}function sy(){return ZE}function ry(e){ZE?e():ey.push(e)}function iy(){const e="undefined"==typeof process?void 0:process.env,t=e?.FIREBASE_CONFIG;if(!t)return null;const n=JSON.parse(t);return n&&n.apiKey?n:null}function ay(e){if(e&&Object.prototype.hasOwnProperty.call(e,"actionCodeSettings")&&(ty=e.actionCodeSettings),ZE){if(e?.app&&e.app!==zE)throw new Error("pwa-auth: Firebase app is already set");return zE}if(e?.app)zE=e.app,YE=zE.options;else{const t=e?.config??iy();if(!t)throw new Error("pwa-auth: pass initialize({ config }) or set window.process.env.FIREBASE_CONFIG");YE=t,zE=gr(YE)}return KE=function(e){const t="object"==typeof e?e:mr(),n="string"==typeof e?e:Xl,s=hr(t,"firestore").getImmediate({identifier:n});if(!s._initialized){const e=Rn("firestore");e&&Sd(s,...e)}return s}(zE),QE=JE(zE),WE=Qo(zE),XE=WE.currentUser,ZE=!0,ey.splice(0).forEach(e=>e()),zE}const oy=iy();oy&&ay({config:oy});const By={bubbles:!0,composed:!0};function cy(e){return e?{uid:e.uid,displayName:e.displayName,email:e.email,photoURL:e.photoURL,emailVerified:!0===e.emailVerified}:null}function ly(e,t){window.dispatchEvent(new CustomEvent(e,{...By,detail:t}))}function uy(e){if("object"==typeof e&&null!==e&&"code"in e){const t=String(e.code);return{code:t,message:e instanceof Error?e.message:t}}return{code:"pwa/unknown",message:e instanceof Error?e.message:"Authentication failed"}}const hy=new Set(["auth/popup-closed-by-user","auth/cancelled-popup-request","auth/user-cancelled"]);let py=null,dy=!1;function fy(){const e=py;return py=null,e}function Cy(){return new ga}async function gy(e){if(function(e){return/Android|iPhone|iPad|iPod/i.test(e)}("undefined"==typeof navigator?"":navigator.userAgent))return await go(WE,Cy()),"redirect";try{return await async function(e,t,n){if(pr(e.app))return Promise.reject(Pr(e,"operation-not-supported-in-this-environment"));const s=$i(e);Ur(e,t,da);const r=so(s,n);return new lo(s,"signInViaPopup",t,r).executeNotNull()}(WE,Cy()),"ok"}catch(e){const t=uy(e).code;if(hy.has(t))return"quiet";if("auth/popup-blocked"===t)return await go(WE,Cy()),"redirect";throw e}}function my(){dy||(dy=!0,ry(()=>{(async function(e,t){return await $i(e)._initializationPromise,mo(e,t,!1)})(WE).catch(e=>{!function(e){py=uy(e)}(e)})}))}const wy="pwa-auth-changed",Ey="pwa-login",yy="pwa-logout",Dy="pwa-signup",_y="pwa-account-deleted",by="pwa-profile-updated",vy="pwa-email-changed",Iy="pwa-password-changed",Ty="pwa-reset-sent",Ay="pwa-drawer-toggle",Oy="pwa-settings",Sy="pwa-auth-error",Ny="pwa-verification-sent",Ry="pwa-email-verified",ky={authChanged:wy,login:Ey,logout:yy,signup:Dy,accountDeleted:_y,profileUpdated:by,emailChanged:vy,passwordChanged:Iy,resetSent:Ty,drawerToggle:Ay,settings:Oy,authError:Sy,verificationSent:Ny,emailVerified:Ry},Ly=128,xy="At least 8 characters. A passphrase works well.",Fy="Use at least 8 characters.",Py="Use at most 128 characters.",My="Passwords don't match.";function Gy(e){return e.length<8?{code:"pwa/short-password",message:Fy}:e.length>Ly?{code:"pwa/long-password",message:Py}:null}const Uy={"auth/invalid-email":"Enter a valid email address.","auth/user-not-found":"No account uses that email.","auth/wrong-password":"That password is wrong.","auth/invalid-credential":"That email or password is wrong.","auth/invalid-login-credentials":"That email or password is wrong.","auth/user-token-expired":"This account is no longer available.","auth/invalid-user-token":"This account is no longer available.","auth/user-disabled":"This account is disabled.","auth/email-already-in-use":"An account already uses that email.","auth/account-exists-with-different-credential":"That email already has an account. Sign in with email and password.","auth/weak-password":Fy,"auth/too-many-requests":"Too many tries. Wait and try again.","auth/network-request-failed":"Network problem. Try again.","auth/requires-recent-login":"Sign in again, then retry.","pwa/missing-email":"Enter an email address.","pwa/invalid-email":"Enter a valid email address.","pwa/missing-password":"Enter a password.","pwa/short-password":Fy,"pwa/long-password":Py,"pwa/current-password":"Enter your current password.","pwa/password-mismatch":My,"pwa/weak-password":Fy,"pwa/signed-out":"Sign in first.","pwa/missing-file":"Choose a photo first.","pwa/not-ready":"Sign-in is not ready yet.","pwa/unknown":"Something went wrong. Try again."};function Hy(e){const t=uy(e);return Uy[t.code]??"Something went wrong. Try again."}const Vy=i`
194
+ `,Rn=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&s+1<t.length&&56320==(64512&t.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},Nn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let e=0;e<t.length;e+=3){const r=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,B=a?t[e+2]:0,c=r>>2,l=(3&r)<<4|o>>4;let u=(15&o)<<2|B>>6,h=63&B;a||(h=64,i||(u=64)),s.push(n[c],n[l],n[u],n[h])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Rn(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,s=0;for(;n<t.length;){const r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[s++]=String.fromCharCode(55296+(i>>10)),e[s++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==r||null==i||null==o||null==a)throw new xn;const B=r<<2|i>>4;if(s.push(B),64!==o){const t=i<<4&240|o>>2;if(s.push(t),64!==a){const t=o<<6&192|a;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class xn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const kn=function(t){return function(t){const e=Rn(t);return Nn.encodeByteArray(e,!0)}(t).replace(/\./g,"")},Ln=function(t){try{return Nn.decodeString(t,!0)}catch(t){}return null};const Fn=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Pn=()=>{try{return Fn()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&Ln(t[1]);return e&&JSON.parse(e)})()}catch(t){return}},Mn=t=>Pn()?.emulatorHosts?.[t],Gn=t=>{const e=Mn(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const s=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),s]:[e.substring(0,n),s]},Hn=()=>Pn()?.config,Un=t=>Pn()?.[`_${t}`];class Vn{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch(()=>{}),1===t.length?t(e):t(e,n))}}}function jn(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...t};return[kn(JSON.stringify({alg:"none",type:"JWT"})),kn(JSON.stringify(i)),""].join(".")}function $n(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Jn(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function qn(){return!function(){const t=Pn()?.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function zn(){try{return"object"==typeof indexedDB}catch(t){return!1}}function Kn(){return new Promise((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Qn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class Wn extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Wn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Yn.prototype.create)}}class Yn{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){try{let n=0,s="";for(;n<t.length;){const r=t.indexOf("{$",n);if(-1===r){s+=t.substring(n);break}const i=t.indexOf("}",r+2);if(-1===i){s+=t.substring(n);break}const o=t.substring(r+2,i),a=e[o];s+=t.substring(n,r)+(null!=a?String(a):`<${o}?>`),n=i+1}return s}catch(e){return t}}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new Wn(s,o,n)}}function Xn(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const r of n){if(!s.includes(r))return!1;const n=t[r],i=e[r];if(Zn(n)&&Zn(i)){if(!Xn(n,i))return!1}else if(n!==i)return!1}for(const t of s)if(!n.includes(t))return!1;return!0}function Zn(t){return null!==t&&"object"==typeof t}function ts(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach(t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function es(t){const e={};return t.replace(/^\?/,"").split("&").forEach(t=>{if(t){const[n,s]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(s)}}),e}function ns(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class ss{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(()=>{t(this)}).catch(t=>{this.error(t)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,e,n){let s;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");s=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===s.next&&(s.next=rs),void 0===s.error&&(s.error=rs),void 0===s.complete&&(s.complete=rs);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(t){}}),this.observers.push(s),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error}})}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function rs(){}function is(t,e=1e3,n=2){const s=e*Math.pow(n,t),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function os(t){return t&&t._delegate?t._delegate:t}function as(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Bs(t){return(await fetch(t,{credentials:"include"})).ok}class cs{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}const ls="[DEFAULT]";class us{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new Vn;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){const e=this.normalizeInstanceIdentifier(t?.identifier),n=t?.optional??!1;if(!this.isInitialized(e)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:e})}catch(t){if(n)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:ls})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=ls){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...t.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return null!=this.component}isInitialized(t=ls){return this.instances.has(t)}getOptions(t=ls){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(s)}return s}onInit(t,e){const n=this.normalizeInstanceIdentifier(e),s=this.onInitCallbacks.get(n)??new Set;s.add(t),this.onInitCallbacks.set(n,s);const r=this.instances.get(n);return r&&t(r,n),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const s of n)try{s(t,e)}catch{}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=t,s===ls?void 0:s),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}var s;return n||null}normalizeInstanceIdentifier(t=ls){return this.component?this.component.multipleInstances?t:ls:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class hs{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new us(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}var ds;!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"}(ds||(ds={}));const ps={debug:ds.DEBUG,verbose:ds.VERBOSE,info:ds.INFO,warn:ds.WARN,error:ds.ERROR,silent:ds.SILENT},fs=ds.INFO,Cs={[ds.DEBUG]:"log",[ds.VERBOSE]:"log",[ds.INFO]:"info",[ds.WARN]:"warn",[ds.ERROR]:"error"},gs=(t,e,...n)=>{if(e<t.logLevel)return;(new Date).toISOString();if(!Cs[e])throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class ms{constructor(t){this.name=t,this._logLevel=fs,this._logHandler=gs,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in ds))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ps[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,ds.DEBUG,...t),this._logHandler(this,ds.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,ds.VERBOSE,...t),this._logHandler(this,ds.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,ds.INFO,...t),this._logHandler(this,ds.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,ds.WARN,...t),this._logHandler(this,ds.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,ds.ERROR,...t),this._logHandler(this,ds.ERROR,...t)}}let ws,ys;const Es=new WeakMap,Ds=new WeakMap,_s=new WeakMap,bs=new WeakMap,vs=new WeakMap;let Is={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return Ds.get(t);if("objectStoreNames"===e)return t.objectStoreNames||_s.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return As(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function Ts(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ys||(ys=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Ss(this),e),As(Es.get(this))}:function(...e){return As(t.apply(Ss(this),e))}:function(e,...n){const s=t.call(Ss(this),e,...n);return _s.set(s,e.sort?e.sort():[e]),As(s)}}function Os(t){return"function"==typeof t?Ts(t):(t instanceof IDBTransaction&&function(t){if(Ds.has(t))return;const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)});Ds.set(t,e)}(t),e=t,(ws||(ws=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,Is):t);var e}function As(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(As(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&Es.set(e,t)}).catch(()=>{}),vs.set(e,t),e}(t);if(bs.has(t))return bs.get(t);const e=Os(t);return e!==t&&(bs.set(t,e),vs.set(e,t)),e}const Ss=t=>vs.get(t);function Rs(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e),a=As(o);return s&&o.addEventListener("upgradeneeded",t=>{s(As(o.result),t.oldVersion,t.newVersion,As(o.transaction),t)}),n&&o.addEventListener("blocked",t=>n(t.oldVersion,t.newVersion,t)),a.then(t=>{i&&t.addEventListener("close",()=>i()),r&&t.addEventListener("versionchange",t=>r(t.oldVersion,t.newVersion,t))}).catch(()=>{}),a}const Ns=["get","getKey","getAll","getAllKeys","count"],xs=["put","add","delete","clear"],ks=new Map;function Ls(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(ks.get(e))return ks.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=xs.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!Ns.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return ks.set(e,i),i}Is=(t=>({...t,get:(e,n,s)=>Ls(e,n)||t.get(e,n,s),has:(e,n)=>!!Ls(e,n)||t.has(e,n)}))(Is);class Fs{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(function(t){const e=t.getComponent();return"VERSION"===e?.type}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null}).filter(t=>t).join(" ")}}const Ps="@firebase/app",Ms="0.16.2",Gs=new ms("@firebase/app"),Hs="@firebase/app-compat",Us="@firebase/analytics-compat",Vs="@firebase/analytics",js="@firebase/app-check-compat",$s="@firebase/app-check",Js="@firebase/auth",qs="@firebase/auth-compat",zs="@firebase/database",Ks="@firebase/data-connect",Qs="@firebase/database-compat",Ws="@firebase/functions",Ys="@firebase/functions-compat",Xs="@firebase/installations",Zs="@firebase/installations-compat",tr="@firebase/messaging",er="@firebase/messaging-compat",nr="@firebase/performance",sr="@firebase/performance-compat",rr="@firebase/remote-config",ir="@firebase/remote-config-compat",or="@firebase/storage",ar="@firebase/storage-compat",Br="@firebase/firestore",cr="@firebase/ai",lr="@firebase/firestore-compat",ur="firebase",hr="[DEFAULT]",dr={[Ps]:"fire-core",[Hs]:"fire-core-compat",[Vs]:"fire-analytics",[Us]:"fire-analytics-compat",[$s]:"fire-app-check",[js]:"fire-app-check-compat",[Js]:"fire-auth",[qs]:"fire-auth-compat",[zs]:"fire-rtdb",[Ks]:"fire-data-connect",[Qs]:"fire-rtdb-compat",[Ws]:"fire-fn",[Ys]:"fire-fn-compat",[Xs]:"fire-iid",[Zs]:"fire-iid-compat",[tr]:"fire-fcm",[er]:"fire-fcm-compat",[nr]:"fire-perf",[sr]:"fire-perf-compat",[rr]:"fire-rc",[ir]:"fire-rc-compat",[or]:"fire-gcs",[ar]:"fire-gcs-compat",[Br]:"fire-fst",[lr]:"fire-fst-compat",[cr]:"fire-vertex","fire-js":"fire-js",[ur]:"fire-js-all"},pr=new Map,fr=new Map,Cr=new Map;function gr(t,e){try{t.container.addComponent(e)}catch(n){Gs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function mr(t){const e=t.name;if(Cr.has(e))return Gs.debug(`There were multiple attempts to register component ${e}.`),!1;Cr.set(e,t);for(const e of pr.values())gr(e,t);for(const e of fr.values())gr(e,t);return!0}function wr(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function yr(t){return null!=t&&void 0!==t.settings}const Er=new Yn("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class Dr{constructor(t,e,n){this._isDeleted=!1,this._options={...t},this._config={...e},this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new cs("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}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(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Er.create("app-deleted",{appName:this._name})}}const _r="12.19.0";function br(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const s={name:hr,automaticDataCollectionEnabled:!0,...e},r=s.name;if("string"!=typeof r||!r)throw Er.create("bad-app-name",{appName:String(r)});if(n||(n=Hn()),!n)throw Er.create("no-options");const i=pr.get(r);if(i){if(Xn(n,i.options)){if(Xn(s,i.config))return i;throw Er.create("duplicate-app",{appName:r,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(s)})}throw Er.create("duplicate-app",{appName:r,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(n)})}const o=new hs(r);for(const t of Cr.values())o.addComponent(t);const a=new Dr(n,s,o);return pr.set(r,a),a}function vr(t=hr){const e=pr.get(t);if(!e&&t===hr&&Hn())return br();if(!e)throw Er.create("no-app",{appName:t});return e}function Ir(t,e,n){let s=dr[t]??t;n&&(s+=`-${n}`);const r=s.match(/\s|\//),i=e.match(/\s|\//);if(r||i){const t=[`Unable to register library "${s}" with version "${e}":`];return r&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&i&&t.push("and"),i&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void Gs.warn(t.join(" "))}mr(new cs(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}const Tr="firebase-heartbeat-store";let Or=null;function Ar(){return Or||(Or=Rs("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(Tr)}catch(t){}}}).catch(t=>{throw Er.create("idb-open",{originalErrorMessage:t.message})})),Or}async function Sr(t,e){try{const n=(await Ar()).transaction(Tr,"readwrite"),s=n.objectStore(Tr);await s.put(e,Rr(t)),await n.done}catch(t){if(t instanceof Wn)Gs.warn(t.message);else{const e=Er.create("idb-set",{originalErrorMessage:t?.message});Gs.warn(e.message)}}}function Rr(t){return`${t.name}!${t.options.appId}`}class Nr{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new kr(e),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=xr();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===e||this._heartbeatsCache.heartbeats.some(t=>t.date===e))return;if(this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats.length>30){const t=function(t){if(0===t.length)return-1;let e=0,n=t[0].date;for(let s=1;s<t.length;s++)t[s].date<n&&(n=t[s].date,e=s);return e}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(t,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){Gs.warn(t)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const t=xr(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let s=t.slice();for(const r of t){const t=n.find(t=>t.agent===r.agent);if(t){if(t.dates.push(r.date),Lr(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Lr(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=kn(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return Gs.warn(t),""}}}function xr(){return(new Date).toISOString().substring(0,10)}class kr{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!zn()&&Kn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Ar()).transaction(Tr),n=await e.objectStore(Tr).get(Rr(t));return await e.done,n}catch(t){if(t instanceof Wn)Gs.warn(t.message);else{const e=Er.create("idb-get",{originalErrorMessage:t?.message});Gs.warn(e.message)}}}(this.app);return t?.heartbeats?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return Sr(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return Sr(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function Lr(t){return kn(JSON.stringify({version:2,heartbeats:t})).length}var Fr;function Pr(){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."}}Fr="",mr(new cs("platform-logger",t=>new Fs(t),"PRIVATE")),mr(new cs("heartbeat",t=>new Nr(t),"PRIVATE")),Ir(Ps,Ms,Fr),Ir(Ps,Ms,"esm2020"),Ir("fire-js","");const Mr=Pr,Gr=new Yn("auth","Firebase",{"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."}),Hr=new ms("@firebase/auth");function Ur(t,...e){Hr.logLevel<=ds.WARN&&Hr.warn(`Auth (${_r}): ${t}`,...e)}function Vr(t,...e){Hr.logLevel<=ds.ERROR&&Hr.error(`Auth (${_r}): ${t}`,...e)}function jr(t,...e){throw Kr(t,...e)}function $r(t,...e){return Kr(t,...e)}function Jr(t,e,n){const s={...Mr(),[e]:n};return new Yn("auth","Firebase",s).create(e,{appName:t.name})}function qr(t){return Jr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function zr(t,e,n){if(!(e instanceof n))throw n.name!==e.constructor.name&&jr(t,"argument-error"),Jr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Kr(t,...e){if("string"!=typeof t){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return Gr.create(t,...e)}function Qr(t,e,...n){if(!t)throw Kr(e,...n)}function Wr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Vr(e),new Error(e)}function Yr(t,e){t||Wr(e)}function Xr(){return"undefined"!=typeof self&&self.location?.href||""}function Zr(){return"undefined"!=typeof self&&self.location?.protocol||null}function ti(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Zr()&&"https:"!==Zr()&&!Jn()&&!("connection"in navigator)||navigator.onLine}class ei{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yr(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test($n())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return ti()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function ni(t,e){Yr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class si{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Wr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Wr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Wr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const ri={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"},ii=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],oi=new ei(3e4,6e4);function ai(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Bi(t,e,n,s,r={}){return ci(t,r,async()=>{let r={},i={};s&&("GET"===e?i=s:r={body:JSON.stringify(s)});const o=ts({...i,key:t.config.apiKey}).slice(1),a=await t._getAdditionalHeaders();a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode);const B={method:e,headers:a,...r};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(B.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&as(t.emulatorConfig.host)&&(B.credentials="include"),si.fetch()(await ui(t,t.config.apiHost,n,o),B)})}async function ci(t,e,n){t._canInitEmulator=!1;const s={...ri,...e};try{const e=new di(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw pi(t,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const e=r.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw pi(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw pi(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw pi(t,"user-disabled",i);const a=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Jr(t,a,o);jr(t,a)}}catch(e){if(e instanceof Wn)throw e;jr(t,"network-request-failed",{message:String(e)})}}async function li(t,e,n,s,r={}){const i=await Bi(t,e,n,s,r);return"mfaPendingCredential"in i&&jr(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function ui(t,e,n,s){const r=`${e}${n}?${s}`,i=t,o=i.config.emulator?ni(t.config,r):`${t.config.apiScheme}://${r}`;if(ii.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(o).toString()}return o}function hi(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class di{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((t,e)=>{this.timer=setTimeout(()=>e($r(this.auth,"network-request-failed")),oi.get())})}}function pi(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=$r(t,e,s);return r.customData._tokenResponse=n,r}function fi(t){return void 0!==t&&void 0!==t.enterprise}class Ci{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return hi(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function gi(t,e){return Bi(t,"POST","/v1/accounts:lookup",e)}function mi(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function wi(t){return 1e3*Number(t)}function yi(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return Vr("JWT malformed, contained fewer than 3 sections"),null;try{const t=Ln(n);return t?JSON.parse(t):(Vr("Failed to decode base64 JWT payload"),null)}catch(t){return Vr("Caught error parsing JWT payload as JSON",t?.toString()),null}}function Ei(t){const e=yi(t);return Qr(e,"internal-error"),Qr(void 0!==e.exp,"internal-error"),Qr(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function Di(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof Wn&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class _i{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===t?.code&&this.schedule(!0))}this.schedule()}}class bi{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=mi(this.lastLoginAt),this.creationTime=mi(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function vi(t){const e=t.auth,n=await t.getIdToken(),s=await Di(t,gi(e,{idToken:n}));Qr(s?.users.length,e,"internal-error");const r=s.users[0];t._notifyReloadListener(r);const i=r.providerUserInfo?.length?Ii(r.providerUserInfo):[],o=function(t,e){const n=t.filter(t=>!e.some(e=>e.providerId===t.providerId));return[...n,...e]}(t.providerData,i),a=t.isAnonymous,B=!(t.email&&r.passwordHash||o?.length),c=!!a&&B,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new bi(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(t,l)}function Ii(t){return t.map(({providerId:t,...e})=>({providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}))}class Ti{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Qr(t.idToken,"internal-error"),Qr(void 0!==t.idToken,"internal-error"),Qr(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):Ei(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Qr(0!==t.length,"internal-error");const e=Ei(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Qr(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:s,expiresIn:r}=await async function(t,e){const n=await ci(t,{},async()=>{const n=ts({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=await ui(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return t.emulatorConfig&&as(t.emulatorConfig.host)&&(a.credentials="include"),si.fetch()(i,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new Ti;return n&&(Qr("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(Qr("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(Qr("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Ti,this.toJSON())}_performRefresh(){return Wr("not implemented")}}function Oi(t,e){Qr("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Ai{constructor({uid:t,auth:e,stsTokenManager:n,...s}){this.providerId="firebase",this.proactiveRefresh=new _i(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=e,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new bi(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await Di(this,this.stsTokenManager.getToken(this.auth,t));return Qr(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=os(t),s=await n.getIdToken(e),r=yi(s);Qr(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=i?.sign_in_provider;return{claims:r,token:s,authTime:mi(wi(r.auth_time)),issuedAtTime:mi(wi(r.iat)),expirationTime:mi(wi(r.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}(this,t)}reload(){return async function(t){const e=os(t);await vi(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Qr(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(t=>({...t})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Ai({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return e.metadata._copy(this.metadata),e}_onReload(t){Qr(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await vi(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(yr(this.auth.app))return Promise.reject(qr(this.auth));const t=await this.getIdToken();return await Di(this,async function(t,e){return Bi(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),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(t=>({...t})),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(t,e){const n=e.displayName??void 0,s=e.email??void 0,r=e.phoneNumber??void 0,i=e.photoURL??void 0,o=e.tenantId??void 0,a=e._redirectEventId??void 0,B=e.createdAt??void 0,c=e.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:h,providerData:d,stsTokenManager:p}=e;Qr(l&&p,t,"internal-error");const f=Ti.fromJSON(this.name,p);Qr("string"==typeof l,t,"internal-error"),Oi(n,t.name),Oi(s,t.name),Qr("boolean"==typeof u,t,"internal-error"),Qr("boolean"==typeof h,t,"internal-error"),Oi(r,t.name),Oi(i,t.name),Oi(o,t.name),Oi(a,t.name),Oi(B,t.name),Oi(c,t.name);const C=new Ai({uid:l,auth:t,email:s,emailVerified:u,displayName:n,isAnonymous:h,photoURL:i,phoneNumber:r,tenantId:o,stsTokenManager:f,createdAt:B,lastLoginAt:c});return d&&Array.isArray(d)&&(C.providerData=d.map(t=>({...t}))),a&&(C._redirectEventId=a),C}static async _fromIdTokenResponse(t,e,n=!1){const s=new Ti;s.updateFromServerResponse(e);const r=new Ai({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await vi(r),r}static async _fromGetAccountInfoResponse(t,e,n){const s=e.users[0];Qr(void 0!==s.localId,"internal-error");const r=void 0!==s.providerUserInfo?Ii(s.providerUserInfo):[],i=!(s.email&&s.passwordHash||r?.length),o=new Ti;o.updateFromIdToken(n);const a=new Ai({uid:s.localId,auth:t,stsTokenManager:o,isAnonymous:i}),B={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:r,metadata:new bi(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash||r?.length)};return Object.assign(a,B),a}}const Si=new Map;function Ri(t){Yr(t instanceof Function,"Expected a class definition");let e=Si.get(t);return e?(Yr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Si.set(t,e),e)}class Ni{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Ni.type="NONE";const xi=Ni;function ki(t,e,n){return`firebase:${t}:${e}:${n}`}class Li{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=ki(this.userKey,s.apiKey,r),this.fullPersistenceKey=ki("persistence",s.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if("string"==typeof t){const e=await gi(this.auth,{idToken:t}).catch(()=>{});return e?Ai._fromGetAccountInfoResponse(this.auth,e,t):null}return Ai._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(t,e,n="authUser"){if(!e.length)return new Li(Ri(xi),t,n);const s=(await Promise.all(e.map(async t=>{try{if(await t._isAvailable())return t}catch{return}}))).filter(t=>t);let r=s[0]||Ri(xi);const i=ki(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){let s;if("string"==typeof e){const n=await gi(t,{idToken:e}).catch(()=>{});if(!n)break;s=await Ai._fromGetAccountInfoResponse(t,n,e)}else s=Ai._fromJSON(t,e);n!==r&&(o=s),r=n;break}}catch{}const a=s.filter(t=>t._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(i,o.toJSON()),await Promise.all(e.map(async t=>{if(t!==r)try{await t._remove(i)}catch{}})),new Li(r,t,n)):new Li(r,t,n)}}function Fi(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Hi(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Pi(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Vi(e))return"Blackberry";if(ji(e))return"Webos";if(Mi(e))return"Safari";if((e.includes("chrome/")||Gi(e))&&!e.includes("edge/"))return"Chrome";if(Ui(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===n?.length)return n[1]}return"Other"}function Pi(t=$n()){return/firefox\//i.test(t)}function Mi(t=$n()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Gi(t=$n()){return/crios\//i.test(t)}function Hi(t=$n()){return/iemobile/i.test(t)}function Ui(t=$n()){return/android/i.test(t)}function Vi(t=$n()){return/blackberry/i.test(t)}function ji(t=$n()){return/webos/i.test(t)}function $i(t=$n()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ji(){return function(){const t=$n();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function qi(t=$n()){return $i(t)||Ui(t)||ji(t)||Vi(t)||/windows phone/i.test(t)||Hi(t)}function zi(t,e=[]){let n;switch(t){case"Browser":n=Fi($n());break;case"Worker":n=`${Fi($n())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${_r}/${s}`}class Ki{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise((n,s)=>{try{n(t(e))}catch(t){s(t)}});n.onAbort=e,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}}class Qi{constructor(t){const e=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=e.minPasswordLength??6,e.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=e.maxPasswordLength),void 0!==e.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=e.containsLowercaseCharacter),void 0!==e.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=e.containsUppercaseCharacter),void 0!==e.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=e.containsNumericCharacter),void 0!==e.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=e.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=t.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const e={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,e),this.validatePasswordCharacterOptions(t,e),e.isValid&&(e.isValid=e.meetsMinPasswordLength??!0),e.isValid&&(e.isValid=e.meetsMaxPasswordLength??!0),e.isValid&&(e.isValid=e.containsLowercaseLetter??!0),e.isValid&&(e.isValid=e.containsUppercaseLetter??!0),e.isValid&&(e.isValid=e.containsNumericCharacter??!0),e.isValid&&(e.isValid=e.containsNonAlphanumericCharacter??!0),e}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),s&&(e.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let s=0;s<t.length;s++)n=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,s,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}class Wi{constructor(t,e,n,s){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Xi(this),this.idTokenSubscription=new Xi(this),this.beforeStateQueue=new Ki(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=Gr,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=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(t=>this._resolvePersistenceManagerAvailable=t)}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Ri(e)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){try{this.persistenceManager=await Li.create(this,t)}catch(t){Ur(`Failed to initialize persistence: ${t}`),this.persistenceManager=await Li.create(this,[])}finally{this._resolvePersistenceManagerAvailable?.()}if(!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}try{await this.initializeCurrentUser(e)}catch(t){Ur(`Failed to initialize current user: ${t}`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await gi(this,{idToken:t}),n=await Ai._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){if(yr(this.app)){const t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}const e=await this.assertedPersistence.getCurrentUser();let n=e,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const e=this.redirectUser?._redirectEventId,r=n?._redirectEventId,i=await this.tryRedirectSignIn(t);e&&e!==r||!i?.user||(n=i.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(t){n=e,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(t))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Qr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await vi(t)}catch(t){if("auth/network-request-failed"!==t?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(yr(this.app))return Promise.reject(qr(this));const e=t?os(t):null;return e&&Qr(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Qr(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return yr(this.app)?Promise.reject(qr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return yr(this.app)?Promise.reject(qr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ri(t))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Bi(t,"GET","/v2/passwordPolicy",ai(t,e))}(this),e=new Qi(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Yn("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged(()=>{n(),t()},e)}})}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Bi(t,"POST","/v2/accounts:revokeToken",ai(t,e))}(this,e)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Ri(t)||this._popupRedirectResolver;Qr(e,this,"argument-error"),this.redirectPersistenceManager=await Li.create(this,[Ri(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===t?this._currentUser:this.redirectUser?._redirectEventId===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===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);const t=this.currentUser?.uid??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,s){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Qr(o,this,"internal-error"),o.then(()=>{i||r(this.currentUser)}).catch(t=>{if(!i)if("function"!=typeof e&&e.error)e.error(t);else{if(!n)throw t;n(t)}}),"function"==typeof e){const r=t.addObserver(e,n,s);return()=>{i=!0,r()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,this.persistenceManager)try{t?await this.persistenceManager.setCurrentUser(t):await this.persistenceManager.removeCurrentUser()}catch(t){const e=Jr(this,"internal-error",`An internal AuthError has occurred: ${t?.message||String(t)}`);throw e.customData={originalError:t},e}}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Qr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=zi(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const e=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());e&&(t["X-Firebase-Client"]=e);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){if(yr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return t?.error&&Ur(`Error while retrieving App Check token: ${t.error}`),t?.token}}function Yi(t){return os(t)}class Xi{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new ss(t,e);return n.subscribe.bind(n)}(t=>this.observer=t)}get next(){return Qr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Zi={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function to(t){return Zi.loadJS(t)}class eo{constructor(){this.enterprise=new no}ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}class no{ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}const so="NO_RECAPTCHA",ro="onFirebaseAuthREInstanceReady";class io{constructor(t){this.type="recaptcha-enterprise",this.auth=Yi(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise(async(e,n)=>{(async function(t,e){return Bi(t,"GET","/v2/recaptchaConfig",ai(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(s=>{if(void 0!==s.recaptchaKey){const n=new Ci(s);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(t=>{n(t)})})}function s(e,n,s){const r=window.grecaptcha;fi(r)?r.enterprise.ready(()=>{r.enterprise.execute(e,{action:t}).then(t=>{n(t)}).catch(()=>{n(so)})}):s(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new eo).execute("siteKey",{action:"verify"})}return new Promise((t,r)=>{n(this.auth).then(async n=>{if(!e&&fi(window.grecaptcha)&&io.scriptInjectionDeferred)await io.scriptInjectionDeferred.promise,s(n,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let e=Zi.recaptchaEnterpriseScript;0!==e.length&&(e+=n+`&onload=${ro}`),io.scriptInjectionDeferred=new Vn,window[ro]=()=>{io.scriptInjectionDeferred?.resolve()},to(e).then(()=>io.scriptInjectionDeferred?.promise).then(()=>{s(n,t,r)}).catch(t=>{r(t)})}}).catch(t=>{r(t)})})}}async function oo(t,e,n,s=!1,r=!1){const i=new io(t);let o;if(r)o=so;else try{o=await i.verify(n)}catch(t){o=await i.verify(n,!0)}const a={...e};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const t=a.phoneEnrollmentInfo.phoneNumber,e=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const t=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return s?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function ao(t,e,n,s,r){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await oo(t,e,n,"getOobCode"===n);return s(t,r)}return s(t,e).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){const r=await oo(t,e,n,"getOobCode"===n);return s(t,r)}return Promise.reject(r)})}function Bo(t,e,n){const s=Yi(t);Qr(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const r=co(e),{host:i,port:o}=function(t){const e=co(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const t=r[1];return{host:t,port:lo(s.substr(t.length+1))}}{const[t,e]=s.split(":");return{host:t,port:lo(e)}}}(e),a=null===o?"":`:${o}`,B={url:`${r}//${i}${a}/`},c=Object.freeze({host:i,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!s._canInitEmulator)return Qr(s.config.emulator&&s.emulatorConfig,s,"emulator-config-failed"),void Qr(Xn(B,s.config.emulator)&&Xn(c,s.emulatorConfig),s,"emulator-config-failed");s.config.emulator=B,s.emulatorConfig=c,s.settings.appVerificationDisabledForTesting=!0,as(i)?Bs(`${r}//${i}${a}`):function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}()}function co(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function lo(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}io.scriptInjectionDeferred=null;class uo{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Wr("not implemented")}_getIdTokenResponse(t){return Wr("not implemented")}_linkToIdToken(t,e){return Wr("not implemented")}_getReauthenticationResolver(t){return Wr("not implemented")}}async function ho(t,e){return Bi(t,"POST","/v1/accounts:signUp",e)}async function po(t,e){return li(t,"POST","/v1/accounts:signInWithPassword",ai(t,e))}async function fo(t,e){return Bi(t,"POST","/v1/accounts:sendOobCode",ai(t,e))}async function Co(t,e){return fo(t,e)}class go extends uo{constructor(t,e,n,s=null){super("password",n),this._email=t,this._password=e,this._tenantId=s}static _fromEmailAndPassword(t,e){return new go(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new go(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if(e?.email&&e?.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return ao(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",po);case"emailLink":return async function(t,e){return li(t,"POST","/v1/accounts:signInWithEmailLink",ai(t,e))}(t,{email:this._email,oobCode:this._password});default:jr(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return ao(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ho);case"emailLink":return async function(t,e){return li(t,"POST","/v1/accounts:signInWithEmailLink",ai(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:jr(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}async function mo(t,e){return li(t,"POST","/v1/accounts:signInWithIdp",ai(t,e))}class wo extends uo{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new wo(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):jr("argument-error"),e}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(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:s,...r}=e;if(!n||!s)return null;const i=new wo(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(t){return mo(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,mo(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,mo(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=ts(e)}return t}}class yo{constructor(t){const e=es(ns(t)),n=e.apiKey??null,s=e.oobCode??null,r=function(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}}(e.mode??null);Qr(n&&s&&r,"argument-error"),this.apiKey=n,this.operation=r,this.code=s,this.continueUrl=e.continueUrl??null,this.languageCode=e.lang??null,this.tenantId=e.tenantId??null}static parseLink(t){const e=function(t){const e=es(ns(t)).link,n=e?es(ns(e)).deep_link_id:null,s=es(ns(t)).deep_link_id;return(s?es(ns(s)).link:null)||s||n||e||t}(t);try{return new yo(e)}catch{return null}}}class Eo{constructor(){this.providerId=Eo.PROVIDER_ID}static credential(t,e){return go._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=yo.parseLink(e);return Qr(n,"argument-error"),go._fromEmailAndCode(t,n.code,n.tenantId)}}Eo.PROVIDER_ID="password",Eo.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Eo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Do{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}class _o extends Do{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}class bo extends _o{constructor(){super("facebook.com")}static credential(t){return wo._fromParams({providerId:bo.PROVIDER_ID,signInMethod:bo.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return bo.credentialFromTaggedObject(t)}static credentialFromError(t){return bo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return bo.credential(t.oauthAccessToken)}catch{return null}}}bo.FACEBOOK_SIGN_IN_METHOD="facebook.com",bo.PROVIDER_ID="facebook.com";class vo extends _o{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return wo._fromParams({providerId:vo.PROVIDER_ID,signInMethod:vo.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return vo.credentialFromTaggedObject(t)}static credentialFromError(t){return vo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return vo.credential(e,n)}catch{return null}}}vo.GOOGLE_SIGN_IN_METHOD="google.com",vo.PROVIDER_ID="google.com";class Io extends _o{constructor(){super("github.com")}static credential(t){return wo._fromParams({providerId:Io.PROVIDER_ID,signInMethod:Io.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Io.credentialFromTaggedObject(t)}static credentialFromError(t){return Io.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Io.credential(t.oauthAccessToken)}catch{return null}}}Io.GITHUB_SIGN_IN_METHOD="github.com",Io.PROVIDER_ID="github.com";class To extends _o{constructor(){super("twitter.com")}static credential(t,e){return wo._fromParams({providerId:To.PROVIDER_ID,signInMethod:To.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return To.credentialFromTaggedObject(t)}static credentialFromError(t){return To.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return To.credential(e,n)}catch{return null}}}async function Oo(t,e){return li(t,"POST","/v1/accounts:signUp",ai(t,e))}To.TWITTER_SIGN_IN_METHOD="twitter.com",To.PROVIDER_ID="twitter.com";class Ao{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,s=!1){const r=await Ai._fromIdTokenResponse(t,n,s),i=So(n);return new Ao({user:r,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const s=So(n);return new Ao({user:t,providerId:s,_tokenResponse:n,operationType:e})}}function So(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Ro extends Wn{constructor(t,e,n,s){super(e.code,e.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Ro.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,s){return new Ro(t,e,n,s)}}function No(t,e,n,s){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw Ro._fromErrorAndOperation(t,n,e,s);throw n})}async function xo(t,e,n=!1){const{auth:s}=t;if(yr(s.app))return Promise.reject(qr(s));const r="reauthenticate";try{const i=await Di(t,No(s,r,e,t),n);Qr(i.idToken,s,"internal-error");const o=yi(i.idToken);Qr(o,s,"internal-error");const{sub:a}=o;return Qr(t.uid===a,s,"user-mismatch"),Ao._forOperation(t,r,i)}catch(t){throw"auth/user-not-found"===t?.code&&jr(s,"user-mismatch"),t}}async function ko(t,e,n=!1){if(yr(t.app))return Promise.reject(qr(t));const s="signIn",r=await No(t,s,e),i=await Ao._fromIdTokenResponse(t,s,r);return n||await t._updateCurrentUser(i.user),i}function Lo(t,e,n){Qr(n.url?.length>0,t,"invalid-continue-uri"),Qr(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),Qr(void 0===n.linkDomain||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Qr(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Qr(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Fo(t){const e=Yi(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Po(t,e,n){const s=Yi(t),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};await ao(s,r,"getOobCode",Co)}function Mo(t,e,n){return yr(t.app)?Promise.reject(qr(t)):async function(t,e){return ko(Yi(t),e)}(os(t),Eo.credential(e,n)).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Fo(t),e})}async function Go(t,e){const n=os(t),s={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&Lo(n.auth,s,e);const{email:r}=await async function(t,e){return fo(t,e)}(n.auth,s);r!==t.email&&await t.reload()}async function Ho(t,e,n){const s=os(t),r={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&Lo(s.auth,r,n);const{email:i}=await async function(t,e){return fo(t,e)}(s.auth,r);i!==t.email&&await t.reload()}async function Uo(t,e){const{displayName:n,photoURL:s}=e;if(void 0===n&&void 0===s)return;const r=os(t),i={idToken:await r.getIdToken(),displayName:n,photoUrl:s,returnSecureToken:!0},o=await Di(r,async function(t,e){return Bi(t,"POST","/v1/accounts:update",e)}(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:t})=>"password"===t);a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function Vo(t,e){return async function(t,e,n){const{auth:s}=t,r=await t.getIdToken(),i={idToken:r,returnSecureToken:!0};n&&(i.password=n);const o=await Di(t,async function(t,e){return Bi(t,"POST","/v1/accounts:update",e)}(s,i));await t._updateTokensIfNecessary(o,!0)}(os(t),0,e)}function jo(t,e,n,s){return os(t).onAuthStateChanged(e,n,s)}const $o="__sak";class Jo{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem($o,"1"),this.storage.removeItem($o),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}class qo extends Jo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=qi(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),s=this.localCache[e];n!==s&&t(e,s,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys((t,e,n)=>{this.notifyListeners(t,n)});const n=t.key;e?this.detachListener():this.stopPolling();const s=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);Ji()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,10):s()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}qo.type="LOCAL";const zo=qo;class Ko extends Jo{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Ko.type="SESSION";const Qo=Ko;class Wo{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;const n=new Wo(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:s,data:r}=e.data,i=this.handlersMap[s];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const o=Array.from(i).map(async t=>t(e.origin,r)),a=await function(t){return Promise.all(t.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}}))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Yo(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}Wo.receivers=[];class Xo{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise((o,a)=>{const B=Yo("",20);s.port1.start();const c=setTimeout(()=>{a(new Error("unsupported_event"))},n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===B)switch(e.data.status){case"ack":clearTimeout(c),r=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(c),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:B,data:e},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function Zo(){return window}function ta(){return void 0!==Zo().WorkerGlobalScope&&"function"==typeof Zo().importScripts}const ea="firebaseLocalStorageDb",na="firebaseLocalStorage",sa="fbase_key";class ra{constructor(t){this.request=t}toPromise(){return new Promise((t,e)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{e(this.request.error)})})}}function ia(t,e){return t.transaction([na],e?"readwrite":"readonly").objectStore(na)}function oa(){const t=indexedDB.open(ea,1);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const e=t.result;try{e.createObjectStore(na,{keyPath:sa})}catch(t){n(t)}}),t.addEventListener("success",async()=>{const n=t.result;n.objectStoreNames.contains(na)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(ea);return new ra(t).toPromise()}(),e(await oa()))})})}async function aa(t,e,n){const s=ia(t,!0).put({[sa]:e,value:n});return new ra(s).toPromise()}function Ba(t,e){const n=ia(t,!0).delete(e);return new ra(n).toPromise()}class ca{registerLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.removeEventListener&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(t=>t.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise||(this.dbPromise=oa(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;if(this.dbPromise){const t=this.dbPromise;this.dbPromise=null;try{(await t).close()}catch{}}}}async initializeServiceWorkerMessaging(){return ta()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Wo._getInstance(ta()?self:null),this.receiver._subscribe("keyChanged",async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)})),this.receiver._subscribe("ping",async(t,e)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new Xo(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&t[0]?.fulfilled&&t[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return!!indexedDB&&(await this._withRetries(async t=>{await aa(t,$o,"1"),await Ba(t,$o)}),!0)}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite(async()=>(await this._withRetries(n=>aa(n,t,e)),this.localCache[t]=e,this.notifyServiceWorker(t)))}async _get(t){const e=await this._withRetries(e=>async function(t,e){const n=ia(t,!1).get(e),s=await new ra(n).toPromise();return void 0===s?null:s.value}(e,t));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>Ba(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){if(this.isClosing)return[];try{const t=await this._withRetries(t=>{const e=ia(t,!1).getAll();return new ra(e).toPromise()});if(this.isClosing)return[];if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}catch(t){return this.isClosing||Ur(`Firebase Auth cross-tab polling failed with error: ${t}`),[]}}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.stopPolling(),this.unregisterLifecycleListeners())}}ca.type="LOCAL";const la=ca;function ua(t,e){return e?Ri(e):(Qr(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}new ei(3e4,6e4);class ha extends uo{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return mo(t,this._buildIdpRequest())}_linkToIdToken(t,e){return mo(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return mo(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={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 t&&(e.idToken=t),e}}function da(t){return ko(t.auth,new ha(t),t.bypassAuthState)}function pa(t){const{auth:e,user:n}=t;return Qr(n,e,"internal-error"),xo(n,new ha(t),t.bypassAuthState)}async function fa(t){const{auth:e,user:n}=t;return Qr(n,e,"internal-error"),async function(t,e,n=!1){const s=await Di(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ao._forOperation(t,"link",s)}(n,new ha(t),t.bypassAuthState)}class Ca{constructor(t,e,n,s,r=!1){this.auth=t,this.resolver=n,this.user=s,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise(async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:s,tenantId:r,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return da;case"linkViaPopup":case"linkViaRedirect":return fa;case"reauthViaPopup":case"reauthViaRedirect":return pa;default:jr(this.auth,"internal-error")}}resolve(t){Yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const ga=new ei(2e3,1e4);class ma extends Ca{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ma.currentPopupAction&&ma.currentPopupAction.cancel(),ma.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Qr(t,this.auth,"internal-error"),t}async onExecution(){Yr(1===this.filter.length,"Popup operations only handle one event");const t=Yo();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject($r(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject($r(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ma.currentPopupAction=null}pollUserCancellation(){const t=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject($r(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,ga.get())};t()}}ma.currentPopupAction=null;const wa=new Map;class ya extends Ca{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=wa.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=_a(e),s=Da(t);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}wa.set(this.auth._key(),t)}return this.bypassAuthState||wa.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Ea(t,e){wa.set(t._key(),e)}function Da(t){return Ri(t._redirectPersistence)}function _a(t){return ki("pendingRedirect",t.config.apiKey,t.name)}function ba(t,e,n){return async function(t,e,n){if(yr(t.app))return Promise.reject(qr(t));const s=Yi(t);zr(t,e,Do),await s._initializationPromise;const r=ua(s,n);return await async function(t,e){return Da(t)._set(_a(e),"true")}(r,s),r._openRedirect(s,e,"signInViaRedirect")}(t,e,n)}async function va(t,e,n=!1){if(yr(t.app))return Promise.reject(qr(t));const s=Yi(t),r=ua(s,e),i=new ya(s,r,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,e)),o}class Ia{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Oa(t);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){if(t.error&&!Oa(t)){const n=t.error.code?.split("auth/")[1]||"internal-error";e.onError($r(this.auth,n))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ta(t))}saveEventToCache(t){this.cachedEventUids.add(Ta(t)),this.lastProcessedEventTime=Date.now()}}function Ta(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(t=>t).join("-")}function Oa({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===e?.code}const Aa=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Sa=/^https?/;async function Ra(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Bi(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Na(t))return}catch{}jr(t,"unauthorized-domain")}function Na(t){const e=Xr(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===s?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!Sa.test(n))return!1;if(Aa.test(t))return s===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}const xa=new ei(3e4,6e4);function ka(){const t=Zo().___jsl;if(t?.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function La(t){return new Promise((e,n)=>{function s(){ka(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ka(),n($r(t,"network-request-failed"))},timeout:xa.get()})}if(Zo().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else{if(!Zo().gapi?.load){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Zo()[e]=()=>{gapi.load?s():n($r(t,"network-request-failed"))},to(`${Zi.gapiScript}?onload=${e}`).catch(t=>n(t))}s()}}).catch(t=>{throw Fa=null,t})}let Fa=null;const Pa=new ei(5e3,15e3),Ma={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ga=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ha(t){const e=t.config;Qr(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?ni(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,s={apiKey:e.apiKey,appName:t.name,v:_r},r=Ga.get(t.config.apiHost);r&&(s.eid=r);const i=t._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${ts(s).slice(1)}`}async function Ua(t){const e=await function(t){return Fa=Fa||La(t),Fa}(t),n=Zo().gapi;return Qr(n,t,"internal-error"),e.open({where:document.body,url:Ha(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ma,dontclear:!0},e=>new Promise(async(n,s)=>{await e.restyle({setHideOnLeave:!1});const r=$r(t,"network-request-failed"),i=Zo().setTimeout(()=>{s(r)},Pa.get());function o(){Zo().clearTimeout(i),n(e)}e.ping(o).then(o,()=>{s(r)})}))}const Va={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ja{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function $a(t,e,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-s)/2,0).toString();let a="";const B={...Va,width:s.toString(),height:r.toString(),top:i,left:o},c=$n().toLowerCase();n&&(a=Gi(c)?"_blank":n),Pi(c)&&(e=e||"http://localhost",B.scrollbars="yes");const l=Object.entries(B).reduce((t,[e,n])=>`${t}${e}=${n},`,"");if(function(t=$n()){return $i(t)&&!!window.navigator?.standalone}(c)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}(e||"",a),new ja(null);const u=window.open(e||"",a,l);Qr(u,t,"popup-blocked");try{u.focus()}catch(t){}return new ja(u)}const Ja="__/auth/handler",qa="emulator/auth/handler",za=encodeURIComponent("fac");async function Ka(t,e,n,s,r,i){Qr(t.config.authDomain,t,"auth-domain-config-required"),Qr(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:_r,eventId:r};if(e instanceof Do){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries({}))o[t]=e}if(e instanceof _o){const t=e.getScopes().filter(t=>""!==t);t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const B=await t._getAppCheckToken(),c=B?`#${za}=${encodeURIComponent(B)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Ja}`;return ni(t,qa)}(t)}?${ts(a).slice(1)}${c}`}const Qa="webStorageSupport";const Wa=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Qo,this._completeRedirectFn=va,this._overrideRedirectResult=Ea}async _openPopup(t,e,n,s){Yr(this.eventManagers[t._key()]?.manager,"_initialize() not called before _openPopup()");return $a(t,await Ka(t,e,n,Xr(),s),Yo())}async _openRedirect(t,e,n,s){await this._originValidation(t);return function(t){Zo().location.href=t}(await Ka(t,e,n,Xr(),s)),new Promise(()=>{})}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Yr(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch(()=>{delete this.eventManagers[e]}),n}async initAndGetManager(t){const e=await Ua(t),n=new Ia(t);return e.register("authEvent",e=>{Qr(e?.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Qa,{type:Qa},n=>{const s=n?.[0]?.[Qa];void 0!==s&&e(!!s),jr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Ra(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return qi()||Mi()||$i()}};var Ya="@firebase/auth",Xa="1.13.6";class Za{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged(e=>{t(e?.stsTokenManager.accessToken||null)});this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Qr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const tB=Un("authIdTokenMaxAge")||300;let eB=null;function nB(t=vr()){const e=wr(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=wr(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(Xn(n.getOptions(),e??{}))return t;jr(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Wa,persistence:[la,zo,Qo]}),s=Un("authTokenSyncURL");if(s&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(s,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>tB)return;const s=e?.token;eB!==s&&(eB=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){os(t).beforeAuthStateChanged(e,n)}(n,e,()=>e(n.currentUser)),function(t,e,n,s){os(t).onIdTokenChanged(e,n,s)}(n,t=>e(t))}}var r;const i=Mn("auth");return i&&Bo(n,`http://${i}`),n}var sB;!function(t){Zi=t}({loadJS:t=>new Promise((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=t=>{const e=$r("internal-error");e.customData=t,n(e)},s.type="text/javascript",s.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(s)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),sB="Browser",mr(new cs("auth",(t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Qr(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:sB,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:zi(sB)},B=new Wi(n,s,r,a);return function(t,e){const n=e?.persistence||[],s=(Array.isArray(n)?n:[n]).map(Ri);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,e?.popupRedirectResolver)}(B,e),B},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider("auth-internal").initialize()})),mr(new cs("auth-internal",t=>(t=>new Za(t))(Yi(t.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Ir(Ya,Xa,function(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}}(sB)),Ir(Ya,Xa,"esm2020");Ir("firebase","12.19.0","app");var rB,iB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t;function e(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(t,e,n){n||(n=0);const s=Array(16);if("string"==typeof e)for(var r=0;r<16;++r)s[r]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(r=0;r<16;++r)s[r]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],r=t.g[2];let i,o=t.g[3];i=e+(o^n&(r^o))+s[0]+3614090360&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[1]+3905402710&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[2]+606105819&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[3]+3250441966&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[4]+4118548399&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[5]+1200080426&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[6]+2821735955&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[7]+4249261313&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[8]+1770035416&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[9]+2336552879&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[10]+4294925233&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[11]+2304563134&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[12]+1804603682&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[13]+4254626195&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[14]+2792965006&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[15]+1236535329&4294967295,i=e+(r^o&((n=r+(i<<22&4294967295|i>>>10))^r))+s[1]+4129170786&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[6]+3225465664&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[11]+643717713&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[0]+3921069994&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[5]+3593408605&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[10]+38016083&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[15]+3634488961&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[4]+3889429448&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[9]+568446438&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[14]+3275163606&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[3]+4107603335&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[8]+1163531501&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[13]+2850285829&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[2]+4243563512&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[7]+1735328473&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[12]+2368359562&4294967295,i=e+((n=r+(i<<20&4294967295|i>>>12))^r^o)+s[5]+4294588738&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[8]+2272392833&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[11]+1839030562&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[14]+4259657740&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[1]+2763975236&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[4]+1272893353&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[7]+4139469664&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[10]+3200236656&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[13]+681279174&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[0]+3936430074&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[3]+3572445317&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[6]+76029189&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[9]+3654602809&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[12]+3873151461&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[15]+530742520&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[2]+3299628645&4294967295,i=e+(r^((n=r+(i<<23&4294967295|i>>>9))|~o))+s[0]+4096336452&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[7]+1126891415&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[14]+2878612391&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[5]+4237533241&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[12]+1700485571&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[3]+2399980690&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[10]+4293915773&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[1]+2240044497&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[8]+1873313359&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[15]+4264355552&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[6]+2734768916&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[13]+1309151649&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[4]+4149444226&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[11]+3174756917&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[2]+718787259&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(r+(i<<21&4294967295|i>>>11))&4294967295,t.g[2]=t.g[2]+r&4294967295,t.g[3]=t.g[3]+o&4294967295}function s(t,e){this.h=e;const n=[];let s=!0;for(let r=t.length-1;r>=0;r--){const i=0|t[r];s&&i==e||(n[r]=i,s=!1)}this.g=n}!function(t,e){function n(){}n.prototype=e.prototype,t.F=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.D=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}(e,function(){this.blockSize=-1}),e.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},e.prototype.v=function(t,e){void 0===e&&(e=t.length);const s=e-this.blockSize,r=this.C;let i=this.h,o=0;for(;o<e;){if(0==i)for(;o<=s;)n(this,t,o),o+=this.blockSize;if("string"==typeof t){for(;o<e;)if(r[i++]=t.charCodeAt(o++),i==this.blockSize){n(this,r),i=0;break}}else for(;o<e;)if(r[i++]=t[o++],i==this.blockSize){n(this,r),i=0;break}}this.h=i,this.o+=e},e.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;e=8*this.o;for(var n=t.length-8;n<t.length;++n)t[n]=255&e,e/=256;for(this.v(t),t=Array(16),e=0,n=0;n<4;++n)for(let s=0;s<32;s+=8)t[e++]=this.g[n]>>>s&255;return t};var r={};function i(t){return-128<=t&&t<128?function(t,e){var n=r;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(t){return new s([0|t],t<0?-1:0)}):new s([0|t],t<0?-1:0)}function o(t){if(isNaN(t)||!isFinite(t))return a;if(t<0)return h(o(-t));const e=[];let n=1;for(let s=0;t>=n;s++)e[s]=t/n|0,n*=4294967296;return new s(e,0)}var a=i(0),B=i(1),c=i(16777216);function l(t){if(0!=t.h)return!1;for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return!1;return!0}function u(t){return-1==t.h}function h(t){const e=t.g.length,n=[];for(let s=0;s<e;s++)n[s]=~t.g[s];return new s(n,~t.h).add(B)}function d(t,e){return t.add(h(e))}function p(t,e){for(;(65535&t[e])!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function f(t,e){this.g=t,this.h=e}function C(t,e){if(l(e))throw Error("division by zero");if(l(t))return new f(a,a);if(u(t))return e=C(h(t),e),new f(h(e.g),h(e.h));if(u(e))return e=C(t,h(e)),new f(h(e.g),e.h);if(t.g.length>30){if(u(t)||u(e))throw Error("slowDivide_ only works with positive integers.");for(var n=B,s=e;s.l(t)<=0;)n=g(n),s=g(s);var r=m(n,1),i=m(s,1);for(s=m(s,2),n=m(n,2);!l(s);){var c=i.add(s);c.l(t)<=0&&(r=r.add(n),i=c),s=m(s,1),n=m(n,1)}return e=d(t,r.j(e)),new f(r,e)}for(r=a;t.l(e)>=0;){for(n=Math.max(1,Math.floor(t.m()/e.m())),s=(s=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,s-48),c=(i=o(n)).j(e);u(c)||c.l(t)>0;)c=(i=o(n-=s)).j(e);l(i)&&(i=B),r=r.add(i),t=d(t,c)}return new f(r,t)}function g(t){const e=t.g.length+1,n=[];for(let s=0;s<e;s++)n[s]=t.i(s)<<1|t.i(s-1)>>>31;return new s(n,t.h)}function m(t,e){const n=e>>5;e%=32;const r=t.g.length-n,i=[];for(let s=0;s<r;s++)i[s]=e>0?t.i(s+n)>>>e|t.i(s+n+1)<<32-e:t.i(s+n);return new s(i,t.h)}(t=s.prototype).m=function(){if(u(this))return-h(this).m();let t=0,e=1;for(let n=0;n<this.g.length;n++){const s=this.i(n);t+=(s>=0?s:4294967296+s)*e,e*=4294967296}return t},t.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(l(this))return"0";if(u(this))return"-"+h(this).toString(t);const e=o(Math.pow(t,6));var n=this;let s="";for(;;){const r=C(n,e).g;let i=(((n=d(n,r.j(e))).g.length>0?n.g[0]:n.h)>>>0).toString(t);if(l(n=r))return i+s;for(;i.length<6;)i="0"+i;s=i+s}},t.i=function(t){return t<0?0:t<this.g.length?this.g[t]:this.h},t.l=function(t){return u(t=d(this,t))?-1:l(t)?0:1},t.abs=function(){return u(this)?h(this):this},t.add=function(t){const e=Math.max(this.g.length,t.g.length),n=[];let r=0;for(let s=0;s<=e;s++){let e=r+(65535&this.i(s))+(65535&t.i(s)),i=(e>>>16)+(this.i(s)>>>16)+(t.i(s)>>>16);r=i>>>16,e&=65535,i&=65535,n[s]=i<<16|e}return new s(n,-2147483648&n[n.length-1]?-1:0)},t.j=function(t){if(l(this)||l(t))return a;if(u(this))return u(t)?h(this).j(h(t)):h(h(this).j(t));if(u(t))return h(this.j(h(t)));if(this.l(c)<0&&t.l(c)<0)return o(this.m()*t.m());const e=this.g.length+t.g.length,n=[];for(var r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let e=0;e<t.g.length;e++){const s=this.i(r)>>>16,i=65535&this.i(r),o=t.i(e)>>>16,a=65535&t.i(e);n[2*r+2*e]+=i*a,p(n,2*r+2*e),n[2*r+2*e+1]+=s*a,p(n,2*r+2*e+1),n[2*r+2*e+1]+=i*o,p(n,2*r+2*e+1),n[2*r+2*e+2]+=s*o,p(n,2*r+2*e+2)}for(t=0;t<e;t++)n[t]=n[2*t+1]<<16|n[2*t];for(t=e;t<2*e;t++)n[t]=0;return new s(n,0)},t.B=function(t){return C(this,t).h},t.and=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)&t.i(s);return new s(n,this.h&t.h)},t.or=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)|t.i(s);return new s(n,this.h|t.h)},t.xor=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)^t.i(s);return new s(n,this.h^t.h)},e.prototype.digest=e.prototype.A,e.prototype.reset=e.prototype.u,e.prototype.update=e.prototype.v,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.B,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=o,s.fromString=function t(e,n){if(0==e.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return h(t(e.substring(1),n));if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character');const s=o(Math.pow(n,8));let r=a;for(let t=0;t<e.length;t+=8){var i=Math.min(8,e.length-t);const a=parseInt(e.substring(t,t+i),n);i<8?(i=o(Math.pow(n,i)),r=r.j(i).add(o(a))):(r=r.j(s),r=r.add(o(a)))}return r},rB=s}).apply(void 0!==iB?iB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var oB,aB,BB,cB,lB,uB,hB,dB,pB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t,e=Object.defineProperty;var n=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof pB&&pB];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(t,s){if(s)t:{var r=n;t=t.split(".");for(var i=0;i<t.length-1;i++){var o=t[i];if(!(o in r))break t;r=r[o]}(s=s(i=r[t=t[t.length-1]]))!=i&&null!=s&&e(r,t,{configurable:!0,writable:!0,value:s})}}s("Symbol.dispose",function(t){return t||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(t){return t||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(t){return t||function(t){var e,n=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push([e,t[e]]);return n}});var r=r||{},i=this||self;function o(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function a(t,e,n){return t.call.apply(t.bind,arguments)}function B(t,e,n){return(B=a).apply(null,arguments)}function c(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function l(t,e){function n(){}n.prototype=e.prototype,t.Z=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Ob=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?t=>t&&AsyncContext.Snapshot.wrap(t):t=>t;function h(t){const e=t.length;if(e>0){const n=Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}return[]}function d(t,e){for(let e=1;e<arguments.length;e++){const s=arguments[e];var n=typeof s;if("array"==(n="object"!=n?n:s?Array.isArray(s)?"array":n:"null")||"object"==n&&"number"==typeof s.length){n=t.length||0;const e=s.length||0;t.length=n+e;for(let r=0;r<e;r++)t[n+r]=s[r]}else t.push(s)}}function p(t){i.setTimeout(()=>{throw t},0)}function f(){var t=y;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var C=new class{constructor(t,e){this.i=t,this.j=e,this.h=0,this.g=null}get(){let t;return this.h>0?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t}}(()=>new g,t=>t.reset());class g{constructor(){this.next=this.g=this.h=null}set(t,e){this.h=t,this.g=e,this.next=null}reset(){this.next=this.g=this.h=null}}let m,w=!1,y=new class{constructor(){this.h=this.g=null}add(t,e){const n=C.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n}},E=()=>{const t=Promise.resolve(void 0);m=()=>{t.then(D)}};function D(){for(var t;t=f();){try{t.h.call(t.g)}catch(t){p(t)}var e=C;e.j(t),e.h<100&&(e.h++,t.next=e.g,e.g=t)}w=!1}function _(){this.u=this.u,this.C=this.C}function b(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}_.prototype.u=!1,_.prototype.dispose=function(){this.u||(this.u=!0,this.N())},_.prototype[Symbol.dispose]=function(){this.dispose()},_.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},b.prototype.h=function(){this.defaultPrevented=!0};var v=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const t=()=>{};i.addEventListener("test",t,e),i.removeEventListener("test",t,e)}catch(t){}return t}();function I(t){return/^[\s\xa0]*$/.test(t)}function T(t,e){b.call(this,t?t.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,t&&this.init(t,e)}l(T,b),T.prototype.init=function(t,e){const n=this.type=t.type,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;this.target=t.target||t.srcElement,this.g=e,(e=t.relatedTarget)||("mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement)),this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=t.pointerType,this.state=t.state,this.i=t,t.defaultPrevented&&T.Z.h.call(this)},T.prototype.h=function(){T.Z.h.call(this);const t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var O="closure_listenable_"+(1e6*Math.random()|0),A=0;function S(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++A,this.da=this.fa=!1}function R(t){t.da=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function N(t,e,n){for(const s in t)e.call(n,t[s],s,t)}function x(t){const e={};for(const n in t)e[n]=t[n];return e}const k="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(t,e){let n,s;for(let e=1;e<arguments.length;e++){for(n in s=arguments[e],s)t[n]=s[n];for(let e=0;e<k.length;e++)n=k[e],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function F(t){this.src=t,this.g={},this.h=0}function P(t,e){const n=e.type;if(n in t.g){var s,r=t.g[n],i=Array.prototype.indexOf.call(r,e,void 0);(s=i>=0)&&Array.prototype.splice.call(r,i,1),s&&(R(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function M(t,e,n,s){for(let r=0;r<t.length;++r){const i=t[r];if(!i.da&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}F.prototype.add=function(t,e,n,s,r){const i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);const o=M(t,e,s,r);return o>-1?(e=t[o],n||(e.fa=!1)):((e=new S(e,this.src,i,!!s,r)).fa=n,t.push(e)),e};var G="closure_lm_"+(1e6*Math.random()|0),H={};function U(t,e,n,s,r){if(Array.isArray(e)){for(let i=0;i<e.length;i++)U(t,e[i],n,s,r);return null}return n=K(n),t&&t[O]?t.J(e,n,!!o(s)&&!!s.capture,r):function(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");const a=o(r)?!!r.capture:!!r;let B=q(t);if(B||(t[G]=B=new F(t)),n=B.add(e,n,s,a,i),n.proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}const e=J;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)v||(r=a),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent($(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}(t,e,n,!1,s,r)}function V(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)V(t,e[i],n,s,r);else s=o(s)?!!s.capture:!!s,n=K(n),t&&t[O]?(t=t.i,(i=String(e).toString())in t.g&&((n=M(e=t.g[i],n,s,r))>-1&&(R(e[n]),Array.prototype.splice.call(e,n,1),0==e.length&&(delete t.g[i],t.h--)))):t&&(t=q(t))&&(e=t.g[e.toString()],t=-1,e&&(t=M(e,n,s,r)),(n=t>-1?e[t]:null)&&j(n))}function j(t){if("number"!=typeof t&&t&&!t.da){var e=t.src;if(e&&e[O])P(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent($(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=q(e))?(P(n,t),0==n.h&&(n.src=null,e[G]=null)):R(t)}}}function $(t){return t in H?H[t]:H[t]="on"+t}function J(t,e){if(t.da)t=!0;else{e=new T(e,this);const n=t.listener,s=t.ha||t.src;t.fa&&j(t),t=n.call(s,e)}return t}function q(t){return(t=t[G])instanceof F?t:null}var z="__closure_events_fn_"+(1e9*Math.random()>>>0);function K(t){return"function"==typeof t?t:(t[z]||(t[z]=function(e){return t.handleEvent(e)}),t[z])}function Q(){_.call(this),this.i=new F(this),this.M=this,this.G=null}function W(t,e){var n,s=t.G;if(s)for(n=[];s;s=s.G)n.push(s);if(t=t.M,s=e.type||e,"string"==typeof e)e=new b(e,t);else if(e instanceof b)e.target=e.target||t;else{var r=e;L(e=new b(s,t),r)}let i,o;if(r=!0,n)for(o=n.length-1;o>=0;o--)i=e.g=n[o],r=Y(i,s,!0,e)&&r;if(i=e.g=t,r=Y(i,s,!0,e)&&r,r=Y(i,s,!1,e)&&r,n)for(o=0;o<n.length;o++)i=e.g=n[o],r=Y(i,s,!1,e)&&r}function Y(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();let r=!0;for(let i=0;i<e.length;++i){const o=e[i];if(o&&!o.da&&o.capture==n){const e=o.listener,n=o.ha||o.src;o.fa&&P(t.i,o),r=!1!==e.call(n,s)&&r}}return r&&!s.defaultPrevented}function X(t){t.g=function(t,e){if("function"!=typeof t){if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=B(t.handleEvent,t)}return Number(e)>2147483647?-1:i.setTimeout(t,e||0)}(()=>{t.g=null,t.i&&(t.i=!1,X(t))},t.l);const e=t.h;t.h=null,t.m.apply(null,e)}l(Q,_),Q.prototype[O]=!0,Q.prototype.removeEventListener=function(t,e,n,s){V(this,t,e,n,s)},Q.prototype.N=function(){if(Q.Z.N.call(this),this.i){var t=this.i;for(const e in t.g){const n=t.g[e];for(let t=0;t<n.length;t++)R(n[t]);delete t.g[e],t.h--}}this.G=null},Q.prototype.J=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Q.prototype.K=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};class Z extends _{constructor(t,e){super(),this.m=t,this.l=e,this.h=null,this.i=!1,this.g=null}j(t){this.h=arguments,this.g?this.i=!0:X(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function tt(t){_.call(this),this.h=t,this.g={}}l(tt,_);var et=[];function nt(t){N(t.g,function(t,e){this.g.hasOwnProperty(e)&&j(t)},t),t.g={}}tt.prototype.N=function(){tt.Z.N.call(this),nt(this)},tt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var st=i.JSON.stringify,rt=i.JSON.parse,it=class{stringify(t){return i.JSON.stringify(t,void 0)}parse(t){return i.JSON.parse(t,void 0)}};function ot(){}function at(){}var Bt={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ct(){b.call(this,"d")}function lt(){b.call(this,"c")}l(ct,b),l(lt,b);var ut={},ht=null;function dt(){return ht=ht||new Q}function pt(t){b.call(this,ut.Ia,t)}function ft(t){const e=dt();W(e,new pt(e))}function Ct(t,e){b.call(this,ut.STAT_EVENT,t),this.stat=e}function gt(t){const e=dt();W(e,new Ct(e,t))}function mt(t,e){b.call(this,ut.Ja,t),this.size=e}function wt(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){t()},e)}function yt(){this.g=!0}function Et(t,e,n,s){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{const i=JSON.parse(e);if(i)for(t=0;t<i.length;t++)if(Array.isArray(i[t])){var n=i[t];if(!(n.length<2)){var s=n[1];if(Array.isArray(s)&&!(s.length<1)){var r=s[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(let t=1;t<s.length;t++)s[t]=""}}}return st(i)}catch(t){return e}}(t,n)+(s?" "+s:"")})}ut.Ia="serverreachability",l(pt,b),ut.STAT_EVENT="statevent",l(Ct,b),ut.Ja="timingevent",l(mt,b),yt.prototype.ua=function(){this.g=!1},yt.prototype.info=function(){};var Dt,_t={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},bt={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function vt(){}function It(t){return encodeURIComponent(String(t))}function Tt(t){var e=1;t=t.split(":");const n=[];for(;e>0&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function Ot(t,e,n,s){this.j=t,this.i=e,this.l=n,this.S=s||1,this.V=new tt(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new At}function At(){this.i=null,this.g="",this.h=!1}l(vt,ot),vt.prototype.g=function(){return new XMLHttpRequest},Dt=new vt;var St={},Rt={};function Nt(t,e,n){t.M=1,t.A=se(Xt(e)),t.u=n,t.R=!0,xt(t,null)}function xt(t,e){t.F=Date.now(),Ft(t),t.B=Xt(t.A);var n=t.B,s=t.S;Array.isArray(s)||(s=[String(s)]),ge(n.i,"t",s),t.C=0,n=t.j.L,t.h=new At,t.g=sn(t.j,n?e:null,!t.u),t.P>0&&(t.O=new Z(B(t.Y,t,t.g),t.P)),e=t.V,n=t.g,s=t.ba;var r="readystatechange";Array.isArray(r)||(r&&(et[0]=r.toString()),r=et);for(let t=0;t<r.length;t++){const i=U(n,r[t],s||e.handleEvent,!1,e.h||e);if(!i)break;e.g[i.key]=i}e=t.J?x(t.J):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.B,t.v,t.u,e)):(t.v="GET",t.g.ea(t.B,t.v,null,e)),ft(),function(t,e,n,s,r,i){t.info(function(){if(t.g)if(i){var o="",a=i.split("&");for(let t=0;t<a.length;t++){var B=a[t].split("=");if(B.length>1){const t=B[0];B=B[1];const e=t.split("_");o=e.length>=2&&"type"==e[1]?o+(t+"=")+B+"&":o+(t+"=redacted&")}}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o})}(t.i,t.v,t.B,t.l,t.S,t.u)}function kt(t){return!!t.g&&("GET"==t.v&&2!=t.M&&t.j.Aa)}function Lt(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Rt:(n=Number(e.substring(n,s)),isNaN(n)?St:(s+=1)+n>e.length?Rt:(e=e.slice(s,s+n),t.C=s+n,e))}function Ft(t){t.T=Date.now()+t.H,Pt(t,t.H)}function Pt(t,e){if(null!=t.D)throw Error("WatchDog timer not null");t.D=wt(B(t.aa,t),e)}function Mt(t){t.D&&(i.clearTimeout(t.D),t.D=null)}function Gt(t){0==t.j.I||t.K||Xe(t.j,t)}function Ht(t){Mt(t);var e=t.O;e&&"function"==typeof e.dispose&&e.dispose(),t.O=null,nt(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.dispose())}function Ut(t,e){try{var n=t.j;if(0!=n.I&&(n.g==t||qt(n.h,t)))if(!t.L&&qt(n.h,t)&&3==n.I){try{var s=n.Ba.g.parse(e)}catch(t){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.v){if(n.g){if(!(n.g.F+3e3<t.F))break t;Ye(n),Ue(n)}Ke(n),gt(18)}}else n.xa=r[1],0<n.xa-n.K&&r[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=wt(B(n.Va,n),6e3));Jt(n.h)<=1&&n.ta&&(n.ta=void 0)}else tn(n,11)}else if((t.L||n.g==t)&&Ye(n),!I(e))for(r=n.Ba.g.parse(e),e=0;e<r.length;e++){let B=r[e];const l=B[0];if(!(l<=n.K))if(n.K=l,B=B[1],2==n.I)if("c"==B[0]){n.M=B[1],n.ba=B[2];const e=B[3];null!=e&&(n.ka=e,n.j.info("VER="+n.ka));const r=B[4];null!=r&&(n.za=r,n.j.info("SVER="+n.za));const l=B[5];null!=l&&"number"==typeof l&&l>0&&(s=1.5*l,n.O=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;const u=t.g;if(u){const t=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(t){var i=s.h;i.g||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(zt(i,i.h),i.h=null))}if(s.G){const t=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;t&&(s.wa=t,ne(s.J,s.G,t))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-t.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=t;if((s=n).na=nn(s,s.L?s.ba:null,s.W),o.L){Kt(s.h,o);var a=o,c=s.O;c&&(a.H=c),a.D&&(Mt(a),Ft(a)),s.g=o}else ze(s);n.i.length>0&&je(n)}else"stop"!=B[0]&&"close"!=B[0]||tn(n,7);else 3==n.I&&("stop"==B[0]||"close"==B[0]?"stop"==B[0]?tn(n,7):He(n):"noop"!=B[0]&&n.l&&n.l.qa(B),n.A=0)}ft()}catch(t){}}Ot.prototype.ba=function(t){t=t.target;const e=this.O;e&&3==Fe(t)?e.j():this.Y(t)},Ot.prototype.Y=function(t){try{if(t==this.g)t:{const B=Fe(this.g),c=this.g.ya();this.g.ca();if(!(B<3)&&(3!=B||this.g&&(this.h.h||this.g.la()||Pe(this.g)))){this.K||4!=B||7==c||ft(),Mt(this);var e=this.g.ca();this.X=e;var n=function(t){if(!kt(t))return t.g.la();const e=Pe(t.g);if(""===e)return"";let n="";const s=e.length,r=4==Fe(t.g);if(!t.h.i){if("undefined"==typeof TextDecoder)return Ht(t),Gt(t),"";t.h.i=new i.TextDecoder}for(let i=0;i<s;i++)t.h.h=!0,n+=t.h.i.decode(e[i],{stream:!(r&&i==s-1)});return e.length=0,t.h.g+=n,t.C=0,t.h.g}(this);if(this.o=200==e,function(t,e,n,s,r,i,o){t.info(function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o})}(this.i,this.v,this.B,this.l,this.S,B,e),this.o){if(this.U&&!this.L){e:{if(this.g){var s,r=this.g;if((s=r.g?r.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(s)){var o=s;break e}}o=null}if(!(t=o)){this.o=!1,this.m=3,gt(12),Ht(this),Gt(this);break t}Et(this.i,this.l,t,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ut(this,t)}if(this.R){let e;for(t=!0;!this.K&&this.C<n.length;){if(e=Lt(this,n),e==Rt){4==B&&(this.m=4,gt(14),t=!1),Et(this.i,this.l,null,"[Incomplete Response]");break}if(e==St){this.m=4,gt(15),Et(this.i,this.l,n,"[Invalid Chunk]"),t=!1;break}Et(this.i,this.l,e,null),Ut(this,e)}if(kt(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=B||0!=n.length||this.h.h||(this.m=1,gt(16),t=!1),this.o=this.o&&t,t){if(n.length>0&&!this.W){this.W=!0;var a=this.j;a.g==this&&a.aa&&!a.P&&(a.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Qe(a),a.P=!0,gt(11))}}else Et(this.i,this.l,n,"[Invalid Chunked Response]"),Ht(this),Gt(this)}else Et(this.i,this.l,n,null),Ut(this,n);4==B&&Ht(this),this.o&&!this.K&&(4==B?Xe(this.j,this):(this.o=!1,Ft(this)))}else(function(t){const e={};t=(t.g&&Fe(t)>=2&&t.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<t.length;s++){if(I(t[s]))continue;var n=Tt(t[s]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=e[r]||[];e[r]=i,i.push(n)}!function(t,e){for(const n in t)e.call(void 0,t[n],n,t)}(e,function(t){return t.join(", ")})})(this.g),400==e&&n.indexOf("Unknown SID")>0?(this.m=3,gt(12)):(this.m=0,gt(13)),Ht(this),Gt(this)}}}catch(t){}},Ot.prototype.cancel=function(){this.K=!0,Ht(this)},Ot.prototype.aa=function(){this.D=null;const t=Date.now();t-this.T>=0?(function(t,e){t.info(function(){return"TIMEOUT: "+e})}(this.i,this.B),2!=this.M&&(ft(),gt(17)),Ht(this),this.m=2,Gt(this)):Pt(this,this.T-t)};var Vt=class{constructor(t,e){this.g=t,this.map=e}};function jt(t){this.l=t||10,i.PerformanceNavigationTiming?t=(t=i.performance.getEntriesByType("navigation")).length>0&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=t?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function $t(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Jt(t){return t.h?1:t.g?t.g.size:0}function qt(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function zt(t,e){t.g?t.g.add(e):t.h=e}function Kt(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Qt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null!=t.g&&0!==t.g.size){let e=t.i;for(const n of t.g.values())e=e.concat(n.G);return e}return h(t.i)}jt.prototype.cancel=function(){if(this.i=Qt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const t of this.g.values())t.cancel();this.g.clear()}};var Wt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Yt(t){let e;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,t instanceof Yt?(this.l=t.l,Zt(this,t.j),this.o=t.o,this.g=t.g,te(this,t.u),this.h=t.h,ee(this,me(t.i)),this.m=t.m):t&&(e=String(t).match(Wt))?(this.l=!1,Zt(this,e[1]||"",!0),this.o=re(e[2]||""),this.g=re(e[3]||"",!0),te(this,e[4]),this.h=re(e[5]||"",!0),ee(this,e[6]||"",!0),this.m=re(e[7]||"")):(this.l=!1,this.i=new he(null,this.l))}function Xt(t){return new Yt(t)}function Zt(t,e,n){t.j=n?re(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function te(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.u=e}else t.u=null}function ee(t,e,n){e instanceof he?(t.i=e,function(t,e){e&&!t.j&&(de(t),t.i=null,t.g.forEach(function(t,e){const n=e.toLowerCase();e!=n&&(pe(this,e),ge(this,n,t))},t)),t.j=e}(t.i,t.l)):(n||(e=ie(e,le)),t.i=new he(e,t.l))}function ne(t,e,n){t.i.set(e,n)}function se(t){return ne(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function re(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ie(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,oe),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function oe(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Yt.prototype.toString=function(){const t=[];var e=this.j;e&&t.push(ie(e,ae,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.o)&&t.push(ie(e,ae,!0),"@"),t.push(It(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&t.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(ie(n,"/"==n.charAt(0)?ce:Be,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.m)&&t.push("#",ie(n,ue)),t.join("")},Yt.prototype.resolve=function(t){const e=Xt(this);let n=!!t.j;n?Zt(e,t.j):n=!!t.o,n?e.o=t.o:n=!!t.g,n?e.g=t.g:n=null!=t.u;var s=t.h;if(n)te(e,t.u);else if(n=!!t.h){if("/"!=s.charAt(0))if(this.g&&!this.h)s="/"+s;else{var r=e.h.lastIndexOf("/");-1!=r&&(s=e.h.slice(0,r+1)+s)}if(".."==(r=s)||"."==r)s="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){s=0==r.lastIndexOf("/",0),r=r.split("/");const t=[];for(let e=0;e<r.length;){const n=r[e++];"."==n?s&&e==r.length&&t.push(""):".."==n?((t.length>1||1==t.length&&""!=t[0])&&t.pop(),s&&e==r.length&&t.push("")):(t.push(n),s=!0)}s=t.join("/")}else s=r}return n?e.h=s:n=""!==t.i.toString(),n?ee(e,me(t.i)):n=!!t.m,n&&(e.m=t.m),e};var ae=/[#\/\?@]/g,Be=/[#\?:]/g,ce=/[#\?]/g,le=/[#\?@]/g,ue=/#/g;function he(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function de(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(let n=0;n<t.length;n++){const s=t[n].indexOf("=");let r,i=null;s>=0?(r=t[n].substring(0,s),i=t[n].substring(s+1)):r=t[n],e(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function pe(t,e){de(t),e=we(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function fe(t,e){return de(t),e=we(t,e),t.g.has(e)}function Ce(t,e){de(t);let n=[];if("string"==typeof e)fe(t,e)&&(n=n.concat(t.g.get(we(t,e))));else for(t=Array.from(t.g.values()),e=0;e<t.length;e++)n=n.concat(t[e]);return n}function ge(t,e,n){pe(t,e),n.length>0&&(t.i=null,t.g.set(we(t,e),h(n)),t.h+=n.length)}function me(t){const e=new he;return e.i=t.i,t.g&&(e.g=new Map(t.g),e.h=t.h),e}function we(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function ye(t,e,n,s,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),s(n)}catch(t){}}function Ee(){this.g=new it}function De(t){this.i=t.Sb||null,this.h=t.ab||!1}function _e(t,e){Q.call(this),this.H=t,this.o=e,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function be(t){t.j.read().then(t.Ma.bind(t)).catch(t.ga.bind(t))}function ve(t){t.readyState=4,t.l=null,t.j=null,t.B=null,Ie(t)}function Ie(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Te(t){let e="";return N(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}function Oe(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Te(n),"string"==typeof t?null!=n&&It(n):ne(t,e,n))}function Ae(t){Q.call(this),this.headers=new Map,this.L=t||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(t=he.prototype).add=function(t,e){de(this),this.i=null,t=we(this,t);let n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},t.forEach=function(t,e){de(this),this.g.forEach(function(n,s){n.forEach(function(n){t.call(e,n,s,this)},this)},this)},t.set=function(t,e){return de(this),this.i=null,fe(this,t=we(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},t.get=function(t,e){return t&&(t=Ce(this,t)).length>0?String(t[0]):e},t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(let s=0;s<e.length;s++){var n=e[s];const r=It(n);n=Ce(this,n);for(let e=0;e<n.length;e++){let s=r;""!==n[e]&&(s+="="+It(n[e])),t.push(s)}}return this.i=t.join("&")},l(De,ot),De.prototype.g=function(){return new _e(this.i,this.h)},l(_e,Q),(t=_e.prototype).open=function(t,e){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=t,this.D=e,this.readyState=1,Ie(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const e={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};t&&(e.body=t),(this.H||i).fetch(new Request(this.D,e)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,ve(this)),this.readyState=0},t.Pa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ie(this)),this.g&&(this.readyState=3,Ie(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;be(this)}else t.text().then(this.Oa.bind(this),this.ga.bind(this))},t.Ma=function(t){if(this.g){if(this.o&&t.value)this.response.push(t.value);else if(!this.o){var e=t.value?t.value:new Uint8Array(0);(e=this.B.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ve(this):Ie(this),3==this.readyState&&be(this)}},t.Oa=function(t){this.g&&(this.response=this.responseText=t,ve(this))},t.Na=function(t){this.g&&(this.response=t,ve(this))},t.ga=function(){this.g&&ve(this)},t.setRequestHeader=function(t,e){this.A.append(t,e)},t.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(_e.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}}),l(Ae,Q);var Se=/^https?$/i,Re=["POST","PUT"];function Ne(t,e){t.h=!1,t.g&&(t.j=!0,t.g.abort(),t.j=!1),t.l=e,t.o=5,xe(t),Le(t)}function xe(t){t.A||(t.A=!0,W(t,"complete"),W(t,"error"))}function ke(t){if(t.h&&void 0!==r)if(t.v&&4==Fe(t))setTimeout(t.Ca.bind(t),0);else if(W(t,"readystatechange"),4==Fe(t)){t.h=!1;try{const r=t.ca();t:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}var n;if(!(n=e)){var s;if(s=0===r){let e=String(t.D).match(Wt)[1]||null;!e&&i.self&&i.self.location&&(e=i.self.location.protocol.slice(0,-1)),s=!Se.test(e?e.toLowerCase():"")}n=s}if(n)W(t,"complete"),W(t,"success");else{t.o=6;try{var o=Fe(t)>2?t.g.statusText:""}catch(t){o=""}t.l=o+" ["+t.ca()+"]",xe(t)}}finally{Le(t)}}}function Le(t,e){if(t.g){t.m&&(clearTimeout(t.m),t.m=null);const n=t.g;t.g=null,e||W(t,"ready");try{n.onreadystatechange=null}catch(t){}}}function Fe(t){return t.g?t.g.readyState:0}function Pe(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.F){case"":case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Me(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ge(t){this.za=0,this.i=[],this.j=new yt,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Me("failFast",!1,t),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Me("baseRetryDelayMs",5e3,t),this.Za=Me("retryDelaySeedMs",1e4,t),this.Ta=Me("forwardChannelMaxRetries",2,t),this.va=Me("forwardChannelRequestTimeoutMs",2e4,t),this.ma=t&&t.xmlHttpFactory||void 0,this.Ua=t&&t.Rb||void 0,this.Aa=t&&t.useFetchStreams||!1,this.O=void 0,this.L=t&&t.supportsCrossDomainXhr||!1,this.M="",this.h=new jt(t&&t.concurrentRequestLimit),this.Ba=new Ee,this.S=t&&t.fastHandshake||!1,this.R=t&&t.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=t&&t.Pb||!1,t&&t.ua&&this.j.ua(),t&&t.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&t&&t.detectBufferingProxy||!1,this.ia=void 0,t&&t.longPollingTimeout&&t.longPollingTimeout>0&&(this.ia=t.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function He(t){if(Ve(t),3==t.I){var e=t.V++,n=Xt(t.J);if(ne(n,"SID",t.M),ne(n,"RID",e),ne(n,"TYPE","terminate"),Je(t,n),(e=new Ot(t,t.j,e)).M=2,e.A=se(Xt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(e.A.toString(),"")}catch(t){}!n&&i.Image&&((new Image).src=e.A,n=!0),n||(e.g=sn(e.j,null),e.g.ea(e.A)),e.F=Date.now(),Ft(e)}en(t)}function Ue(t){t.g&&(Qe(t),t.g.cancel(),t.g=null)}function Ve(t){Ue(t),t.v&&(i.clearTimeout(t.v),t.v=null),Ye(t),t.h.cancel(),t.m&&("number"==typeof t.m&&i.clearTimeout(t.m),t.m=null)}function je(t){if(!$t(t.h)&&!t.m){t.m=!0;var e=t.Ea;m||E(),w||(m(),w=!0),y.add(e,t),t.D=0}}function $e(t,e){var n;n=e?e.l:t.V++;const s=Xt(t.J);ne(s,"SID",t.M),ne(s,"RID",n),ne(s,"AID",t.K),Je(t,s),t.u&&t.o&&Oe(s,t.u,t.o),n=new Ot(t,t.j,n,t.D+1),null===t.u&&(n.J=t.o),e&&(t.i=e.G.concat(t.i)),e=qe(t,n,1e3),n.H=Math.round(.5*t.va)+Math.round(.5*t.va*Math.random()),zt(t.h,n),Nt(n,s,e)}function Je(t,e){t.H&&N(t.H,function(t,n){ne(e,n,t)}),t.l&&N({},function(t,n){ne(e,n,t)})}function qe(t,e,n){n=Math.min(t.i.length,n);const s=t.l?B(t.l.Ka,t.l,t):null;t:{var r=t.i;let e=-1;for(;;){const t=["count="+n];-1==e?n>0?(e=r[0].g,t.push("ofs="+e)):e=0:t.push("ofs="+e);let B=!0;for(let c=0;c<n;c++){var i=r[c].g;const n=r[c].map;if((i-=e)<0)e=Math.max(0,r[c].g-100),B=!1;else try{i="req"+i+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[e,n]of a){let s=n;o(n)&&(s=st(n)),t.push(i+e+"="+encodeURIComponent(s))}}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}catch(t){s&&s(n)}}if(B){a=t.join("&");break t}}a=void 0}return t=t.i.splice(0,n),e.G=t,a}function ze(t){if(!t.g&&!t.v){t.Y=1;var e=t.Da;m||E(),w||(m(),w=!0),y.add(e,t),t.A=0}}function Ke(t){return!(t.g||t.v||t.A>=3)&&(t.Y++,t.v=wt(B(t.Da,t),Ze(t,t.A)),t.A++,!0)}function Qe(t){null!=t.B&&(i.clearTimeout(t.B),t.B=null)}function We(t){t.g=new Ot(t,t.j,"rpc",t.Y),null===t.u&&(t.g.J=t.o),t.g.P=0;var e=Xt(t.na);ne(e,"RID","rpc"),ne(e,"SID",t.M),ne(e,"AID",t.K),ne(e,"CI",t.F?"0":"1"),!t.F&&t.ia&&ne(e,"TO",t.ia),ne(e,"TYPE","xmlhttp"),Je(t,e),t.u&&t.o&&Oe(e,t.u,t.o),t.O&&(t.g.H=t.O);var n=t.g;t=t.ba,n.M=1,n.A=se(Xt(e)),n.u=null,n.R=!0,xt(n,t)}function Ye(t){null!=t.C&&(i.clearTimeout(t.C),t.C=null)}function Xe(t,e){var n=null;if(t.g==e){Ye(t),Qe(t),t.g=null;var s=2}else{if(!qt(t.h,e))return;n=e.G,Kt(t.h,e),s=1}if(0!=t.I)if(e.o)if(1==s){n=e.u?e.u.length:0,e=Date.now()-e.F;var r=t.D;W(s=dt(),new mt(s,n)),je(t)}else ze(t);else if(3==(r=e.m)||0==r&&e.X>0||!(1==s&&function(t,e){return!(Jt(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.G.concat(t.i),0):1==t.I||2==t.I||t.D>=(t.Sa?0:t.Ta)||(t.m=wt(B(t.Ea,t,e),Ze(t,t.D)),t.D++,0)))}(t,e)||2==s&&Ke(t)))switch(n&&n.length>0&&(e=t.h,e.i=e.i.concat(n)),r){case 1:tn(t,5);break;case 4:tn(t,10);break;case 3:tn(t,6);break;default:tn(t,2)}}function Ze(t,e){let n=t.Qa+Math.floor(Math.random()*t.Za);return t.isActive()||(n*=2),n*e}function tn(t,e){if(t.j.info("Error code "+e),2==e){var n=B(t.bb,t),s=t.Ua;const e=!s;s=new Yt(s||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||Zt(s,"https"),se(s),e?function(t,e){const n=new yt;if(i.Image){const s=new Image;s.onload=c(ye,n,"TestLoadImage: loaded",!0,e,s),s.onerror=c(ye,n,"TestLoadImage: error",!1,e,s),s.onabort=c(ye,n,"TestLoadImage: abort",!1,e,s),s.ontimeout=c(ye,n,"TestLoadImage: timeout",!1,e,s),i.setTimeout(function(){s.ontimeout&&s.ontimeout()},1e4),s.src=t}else e(!1)}(s.toString(),n):function(t,e){new yt;const n=new AbortController,s=setTimeout(()=>{n.abort(),ye(0,0,!1,e)},1e4);fetch(t,{signal:n.signal}).then(t=>{clearTimeout(s),t.ok?ye(0,0,!0,e):ye(0,0,!1,e)}).catch(()=>{clearTimeout(s),ye(0,0,!1,e)})}(s.toString(),n)}else gt(2);t.I=0,t.l&&t.l.pa(e),en(t),Ve(t)}function en(t){if(t.I=0,t.ja=[],t.l){const e=Qt(t.h);0==e.length&&0==t.i.length||(d(t.ja,e),d(t.ja,t.i),t.h.i.length=0,h(t.i),t.i.length=0),t.l.oa()}}function nn(t,e,n){var s=n instanceof Yt?Xt(n):new Yt(n);if(""!=s.g)e&&(s.g=e+"."+s.g),te(s,s.u);else{var r=i.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;const t=new Yt(null);s&&Zt(t,s),e&&(t.g=e),r&&te(t,r),n&&(t.h=n),s=t}return n=t.G,e=t.wa,n&&e&&ne(s,n,e),ne(s,"VER",t.ka),Je(t,s),s}function sn(t,e,n){if(e&&!t.L)throw Error("Can't create secondary domain capable XhrIo object.");return(e=t.Aa&&!t.ma?new Ae(new De({ab:n})):new Ae(t.ma)).Fa(t.L),e}function rn(){}function on(){}function an(t,e){Q.call(this),this.g=new Ge(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.o=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.sa&&(t?t["X-WebChannel-Client-Profile"]=e.sa:t={"X-WebChannel-Client-Profile":e.sa}),this.g.U=t,(t=e&&e.Qb)&&!I(t)&&(this.g.u=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!I(e)&&(this.g.G=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ln(this)}function Bn(t){ct.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){t:{for(const n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function cn(){lt.call(this),this.status=1}function ln(t){this.g=t}(t=Ae.prototype).Fa=function(t){this.H=t},t.ea=function(t,e,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Dt.g(),this.g.onreadystatechange=u(B(this.Ca,this));try{this.B=!0,this.g.open(e,String(t),!0),this.B=!1}catch(t){return void Ne(this,t)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var r in s)n.set(r,s[r]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const t of s.keys())n.set(t,s.get(t))}s=Array.from(n.keys()).find(t=>"content-type"==t.toLowerCase()),r=i.FormData&&t instanceof i.FormData,!(Array.prototype.indexOf.call(Re,e,void 0)>=0)||s||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[t,e]of n)this.g.setRequestHeader(t,e);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(t),this.v=!1}catch(t){Ne(this,t)}},t.abort=function(t){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=t||7,W(this,"complete"),W(this,"abort"),Le(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Le(this,!0)),Ae.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?ke(this):this.Xa())},t.Xa=function(){ke(this)},t.isActive=function(){return!!this.g},t.ca=function(){try{return Fe(this)>2?this.g.status:-1}catch(t){return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},t.La=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),rt(e)}},t.ya=function(){return this.o},t.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(t=Ge.prototype).ka=8,t.I=1,t.connect=function(t,e,n,s){gt(0),this.W=t,this.H=e||{},n&&void 0!==s&&(this.H.OSID=n,this.H.OAID=s),this.F=this.X,this.J=nn(this,null,this.W),je(this)},t.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;const r=new Ot(this,this.j,t);let i=this.o;if(this.U&&(i?(i=x(i),L(i,this.U)):i=this.U),null!==this.u||this.R||(r.J=i,i=null),this.S)t:{for(var e=0,n=0;n<this.i.length;n++){var s=this.i[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if((e+=s)>4096){e=n;break t}if(4096===e||n===this.i.length-1){e=n+1;break t}}e=1e3}else e=1e3;e=qe(this,r,e),ne(n=Xt(this.J),"RID",t),ne(n,"CVER",22),this.G&&ne(n,"X-HTTP-Session-Id",this.G),Je(this,n),i&&(this.R?e="headers="+It(Te(i))+"&"+e:this.u&&Oe(n,this.u,i)),zt(this.h,r),this.Ra&&ne(n,"TYPE","init"),this.S?(ne(n,"$req",e),ne(n,"SID","null"),r.U=!0,Nt(r,n,null)):Nt(r,n,e),this.I=2}}else 3==this.I&&(t?$e(this,t):0==this.i.length||$t(this.h)||$e(this))},t.Da=function(){if(this.v=null,We(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var t=4*this.T;this.j.info("BP detection timer enabled: "+t),this.B=wt(B(this.Wa,this),t)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,gt(10),Ue(this),We(this))},t.Va=function(){null!=this.C&&(this.C=null,Ue(this),Ke(this),gt(19))},t.bb=function(t){t?(this.j.info("Successfully pinged google.com"),gt(2)):(this.j.info("Failed to ping google.com"),gt(1))},t.isActive=function(){return!!this.l&&this.l.isActive(this)},(t=rn.prototype).ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){},on.prototype.g=function(t,e){return new an(t,e)},l(an,Q),an.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},an.prototype.close=function(){He(this.g)},an.prototype.o=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=st(t),t=n);e.i.push(new Vt(e.Ya++,t)),3==e.I&&je(e)},an.prototype.N=function(){this.g.l=null,delete this.j,He(this.g),delete this.g,an.Z.N.call(this)},l(Bn,ct),l(cn,lt),l(ln,rn),ln.prototype.ra=function(){W(this.g,"a")},ln.prototype.qa=function(t){W(this.g,new Bn(t))},ln.prototype.pa=function(t){W(this.g,new cn)},ln.prototype.oa=function(){W(this.g,"b")},on.prototype.createWebChannel=on.prototype.g,an.prototype.send=an.prototype.o,an.prototype.open=an.prototype.m,an.prototype.close=an.prototype.close,dB=function(){return new on},hB=function(){return dt()},uB=ut,lB={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},_t.NO_ERROR=0,_t.TIMEOUT=8,_t.HTTP_ERROR=6,cB=_t,bt.COMPLETE="complete",BB=bt,at.EventType=Bt,Bt.OPEN="a",Bt.CLOSE="b",Bt.ERROR="c",Bt.MESSAGE="d",Q.prototype.listen=Q.prototype.J,aB=at,Ae.prototype.listenOnce=Ae.prototype.K,Ae.prototype.getLastError=Ae.prototype.Ha,Ae.prototype.getLastErrorCode=Ae.prototype.ya,Ae.prototype.getStatus=Ae.prototype.ca,Ae.prototype.getResponseJson=Ae.prototype.La,Ae.prototype.getResponseText=Ae.prototype.la,Ae.prototype.send=Ae.prototype.ea,Ae.prototype.setWithCredentials=Ae.prototype.Fa,oB=Ae}).apply(void 0!==pB?pB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var fB=class t{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static LOOKBEHIND=512;static MATCH_NL=t.CLASS_NL|t.DOT_NL;static PERL=t.CLASS_NL|t.ONE_LINE|t.PERL_X|t.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2};const CB=1,gB=2,mB=4,wB=8,yB=16,EB=512,DB=128,_B=new Int32Array(DB),bB=new Int32Array(DB),vB=65535;for(let t=0;t<DB;t++)_B[t]=t>=97&&t<=122?t-32:t,bB[t]=t>=65&&t<=90?t+32:t;var IB=class{static CODES=Object.freeze({"":7,"\b":8,"\t":9,"\n":10,"\v":11,"\f":12,"\r":13," ":32,'"':34,$:36,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,"-":45,".":46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,"<":60,">":62,"?":63,A:65,B:66,C:67,F:70,P:80,Q:81,U:85,Z:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,a:97,b:98,f:102,i:105,m:109,n:110,r:114,s:115,t:116,v:118,x:120,z:122,"{":123,"|":124,"}":125});static toUpperCase(t){if(t<DB)return _B[t];const e=String.fromCodePoint(t).toUpperCase(),n=e.codePointAt(0)>vB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toLowerCase(),r=s.codePointAt(0)>vB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}static toLowerCase(t){if(t<DB)return bB[t];const e=String.fromCodePoint(t).toLowerCase(),n=e.codePointAt(0)>vB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toUpperCase(),r=s.codePointAt(0)>vB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}},TB=class{constructor(t,e=!1){this.data=t,this.isStride1=e,this.SIZE=e?2:3}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.isStride1?1:this.data[t*this.SIZE+2]}get length(){return this.data.length/this.SIZE}};const OB=new Uint8Array(256);for(let t=0;t<64;t++)OB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-".charCodeAt(t)]=t;const AB=t=>{const e=[];let n=0,s=0;for(let r=0;r<t.length;r++){const i=OB[t.charCodeAt(r)];n|=(31&i)<<s,32&i?s+=5:(e.push(n),n=0,s=0)}return e},SB=(t,e)=>{const n=AB(t),s=e?n.length/2:n.length/3,r=new Uint32Array(3*s);let i=0,o=0;for(let t=0;t<s;t++)i+=n[o++],r[3*t]=i,i+=n[o++],r[3*t+1]=i,r[3*t+2]=e?1:n[o++];return r};var RB=class{constructor(t){this.initializer=t,this.cache=new Map}has(t){return t in this.initializer}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.initializer[t],n=e?e():null;return this.cache.set(t,n),n}},NB=class{static _CASE_ORBIT=null;static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=(t=>{const e=AB(t),n=new Map;let s=0;for(let t=0;t<e.length;t+=2){s+=e[t];const r=e[t+1],i=r>>>1^-(1&r);n.set(s,s+i)}return n})("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0NDCBBB0NBCBBByNByNBCBBBCBBB2NBCBBDCBBCwDFCBCBDBCBCBDBCBCBDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB9EBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBCBDBCBBBhGBvDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBjICCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBH2iVBCBBBlKBwiVB+jVB+jVBCBBBlMBqEBuEBCBBBCBBBCBBBCBBBCBBB+hVB4hVB8hVBjNB7MC5MB5MCzMC1MB+0yCE5MB20yCC9MBu2yCBwyyCBo0yCChNBlNBo0yCBu-UBi0yCDlNC6-UBpNDrNIu+UDzNCm0yCBzNE0yyCBzNBpEBxNBxNBtEG1NLqxyCBkxyCnFoFrBCBBBCBBDCBBEkIBkIBkICoHHsCCqCBqCBqCCgEC+DB+DBmkOBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCC+BBgCBgCBgCBgCBgCBgCBgCBgCBrCBpCBpCBpCBmjOB-BB8BB-BB-BBgEB-BB-BByBBqgOBsDB-BBtwBB-BB-BB-BBsBBgDBCB-BB-BB-BBeB-BB-BB61OB-BB-BB-DB9DB9DBQB7DBmCE9CBrDBPBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBrFB-EBOBnHB3FB-FCCBBBNBCBBCjIBjIBjIBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB8kMB-BB6kMB-BB-BB-BB-BB-BB-BB-BB-BB-BBokMB-BB-BBkkMBkkMB-BB-BB-BB-BB-BB-BB-BB4jMB-BB-BB-BB-BB-BB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EBCBBBCBoiMBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBJCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBeBCBBBCBBBCBBBCBBBCBBBCBBBCBBBdBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDL-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-C64CgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOCgmOGgmODg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FDg8FBg8FBg8FhVg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBQBQBQBQBQBQDPBPBPBPBPBPjkC7mMB5mMBnmMBjmMBCBlmMB3lMBpiMBk8kCBCBBG-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FD-7FB-7FB-7F6FoglCEsuHRwjlCyDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCB0DBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBG1DD97OCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPEQCQCQCQCPCPCPCPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPB0EB0EBsFBsFBsFBsFBoGBoGBgIBgIBgHBgHB8HB8HDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQCSFPBPBzEBzEBRCxnOFSFrFBrFBrFBrFBREQBQClkOFPBPBnGBnGFQBQCljOCODPBPB-GB-GBNHSF-HB-HB7HB7HBRqJ53OE9tQBrmQH4Bc3BSgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfECBByZ0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzB34BgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CBCBBBt-UBruHBt+UB1iVBviVBCBBBCBBBCBBB3hVB5-UB9hVB7hVCCBBCCBBI9jVB9jVBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBICBBBCBBECBBN-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOC-lOG-lOzoeCBBBCBBBCBBBCBBBCBBBCBl8kCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBTCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBnECBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBKCBBBCBBBnglCBCBBBCBBBCBBBCBBBCBBECBBBvyyCDCBBBCBBBgDCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBn0yCB90yCB10yCBh0yCBn0yCCjxyCBzyyCBpxyCBg6BBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB-CBl0yCBvjlCBCBBBCBBBt2yCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBhkzCZCBB9a-5Bd-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCm6TCBB7gBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCH-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BmlBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvChDwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCFvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvC1DuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCCuCBuCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCCtCBtCk2BgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEO-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-D+CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCL-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-B74CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhrVgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BD1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BtxekCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjC")),this._CASE_ORBIT}static _Print=null;static get Print(){return this._Print||(this._Print=new TB(SB("hB9CBjBLBCpWBDFBFGBCCCBSBCsMBClBBDxBBDCBC2BBJaBFFBSVBC-FBCvBBD6BBDkDBP6BBDwBBDOBCbBDCCBJBGfBIqCBCgFBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYBDCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPBLCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGBCCBCHBDBBDVBCGBCBBCEBDIBDBBDCBICBFBBCEBDRBLBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBGMBCCBCWBCPBDIBCCBCDBIBBCCBCBBDDBDJBIVBCCBCWBCJBCEBDIBCCBCDBIBBGCBCDBDJBCCBNMBCCBCyBBCCBCFBFPBDZBCCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBN5BBFcBmBBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDBhBnCBCjBBFmBBCjBBCOBCMBmBlGBCGGD4LBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBH1CBDFBD-TBCbBE4CBIVBKXBKTBNMBCCBCBBN9CBDJBHJBHNBCKBH4CBIqBBGlCBLeBCLBFLBFEEBoBBDEBMrBBFZBHKBE9BBDgCBCcBDKBHJBHNBDtBBDLBVsCBClFBJ7BBEOBE9BBGqBBDKBJqBBG1QBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBSXBJuBBSBBDaBCMBEhBBPgBBQrEBF5UBXKBWz4BBD9LBGsBBCGGD3BBIBBPXBKGBCGBCGBCGBCGBCGBCGBCGBC9DBjBZBC4CBN1GBbPBC+BBC1CBDmDBGqBBC9CBC1CBKvBBCszcBE2BBK7KBV3FBJ8GBV7BBEJBH3BBJlCBJLBHzDBMdBEtCBCKBFgBBC2BBKNBDJBDmDBZbBLFBDFBDFBKGBCGBC7BBF9DBDJBHj9KBNWBFwBBloItLBDpDBnBGBNEBGZBCEBCCCBCCBCCBoUBhBpBBHyBBCSBCDBFEBCmEBF9FBEFBDFBDFBDCBEGBCGBOBBDLBCZBCSBCBBCOBDNBjB6DBGCBFsBBE3CBCMBEwBwBBsBBjEcBEwBBQbBFjBBKdBGqBBGdBCkBBFNBrB9EBDJBHjBBFjBBFnBBJzBBMLBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBCnCBJIBxBSBCBBGgBBEaBGaBnB3BBFTBDxBBCBBGHBCCBCcBDCBFJBIIBI-BBhBmBBFLBK1BBEcBDaBGZBIDBNGBxCoCB4ByBBOyBBItBBJJBHlBBEcBJBBxGeBCpBBCCBDBBRFBJIBiBtBBJpBBXZBnBbBVWBKtCBFjBBK9BBCEBOYBIJBH0BBCRBJmBBK-CBCTBMRBCuBB-BGBCCCBCBCOBCKBH6BBGJBHDBCHBDBBDVBCGBCBBCEBCJBDBBDCBDHHGGBDGBEEBMJBCDDClBBCJBCDDCDBCJBCBBJBBe7CBCEBfnCBJJBnF1BBDlBBjBkCBMJBHMBU5BBHJBHTBdaBDOBFWB6F7BBlDyCBNHBDDDBGBCBBCdBCBBDLBKJBnCHBDtBBDKBcnCBJyCBOoCBIJB3CHB5ChBBPJBHIBCsBBCNBLcBEfBDVBCNBqCGBCBBCrBBECCBCCBHBJJBHFBCBBCkBBCBBCFBIJBHrBBFJB3HYBIQBCoBBEcB2CQQBwBBO6cBnDuDBCEBMjGBtyCiDBOvhBBRVBL68DBGmSB61G5BBn2B4RBIeBCJBFwCBCJBHdBDFBLlCBLJBCGBCUBGSBxN5BBnG6CBGYBDYBtBqCBF4BBIQBhCEBMGBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBDDBh7D8HBEzNBHWBQQBQtBBDWBKzDB9B1HBLmBBDpCBJvDBWlCB7DTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBD9VBQEBCOBxiBeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBENBDJBFBBhKeBS5BBGxOxOBoBB3GqBBFhGhGBdBCVBJBBhHGBCDBCBBCOBCkGBDPBqBrCBFJBFBByYjCBtC8BBjGDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBBvIrBBFjDBNOBDOBCOBCkBBLtFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBmgB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIBnkzVvHB",!1))),this._Print}static CATEGORIES=new RB({C:()=>new TB(SB("AfBgDgBBOrWrWBHHBCBICCVuMuMnBBBzBBBE4B4BBGBcDBHQBXhGhGxBBB8BBBmDNB8BBByBBBQddBCCMEBhBGBsCiFiFJBBDBBXIICCBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBPMMBEB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKMMBDBbEByBPBDBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCB-FCBHBBHBBHBBECBIIIBLBDBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIB-BGGBLBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMBxhBPBXJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBF-6DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBrCHBxDUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIlkzVBxHvw-FB",!1)),Cc:()=>new TB(SB("AfgDgB",!0)),Cf:()=>new TB(SB("tFzqBzqBBEBXhGhGyBhMhMBxCxCs5D9-B9-BBDBbEByBEBCJBw03B6H6HBBBimEQQj7IPBhjiBDBwmFHBn0rYffB+CB",!1)),Cn:()=>new TB(SB("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBDBvzIBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-BB---BBB---BBB",!1)),Co:()=>new TB(SB("gg4B-nGh4hc9--BD9--B",!0)),Cs:()=>new TB(SB("gg2B--B",!0)),L:()=>new TB(SB("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICCiEEBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoCaBFDBuBqBBkBBBCiDBCQQBIIBLLBBBDRRCdBe4CBMZZBfBKBBFGGBUBFKKEYYBXBIKBGXBCGBRpBB7B1BBETTIJBQPBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNGB7BBBCCCBDBCXBCCCBIBCBBKDDBDBCWWBCBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNSSBkBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBkBFFkC4CBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBzC+C+CBtBBSHB3BdBOBBLrBBbjBBqBCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBhC1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBF1B1BB8zC8zCBjHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBxC2O2OBrBrBBDBGBBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBReBDlCByBIBDmDBDxCBVQBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBdRRBDBCJBLEBCoBBYCBCHBVWBEEEBwBBCEEBDDBDBDCCZCBDKBICBNFBDFBDFBKGBCGBCqBBCNBHyDBej9KBNWBFwBBloItLBDpDBnBGBNEBGCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBxB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOjBBnBbBKWB7HpBBHBBRFB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB1D-BBgBHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBqBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBGjCjCBLBhCBBCPPBNNB0mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBn7F0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFBmI9BBzEsBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCCBCBBCGBDEBKBBhHGBCDBCBBCOBCkGB8BjCBI1lB1lBBCBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),LC:()=>new TB(SB("hCZBHZB7BLLBVBCeBCiGBCDBFvGBDZBhGDBDBBECBCHHCCBCCCBSBCyCBCqEBJlFBClBBKoBB44ClBBCGGDqBBDCBhV1CBDFBjkCKBGqBBDCBhCrBBgCMBChBBmD1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGBmIFFDJBCEEBDBHGCBCBCFBFDDBCBGEBF1B1BB8zC8zCB6DBDmDBHDBEBBNlBBCGGzoetBBTbBnEtCBCWBEDBCsCBZBBE2Z2ZBpBBGIBIvCBh6TGBNEBqgBZBHZBmlBvCBhDjBBFjBB1DKBCOBCGBCBBCKBCOBCGBCBBk2ByBBOyBB+CVBLVB74C-BBhrV-BBhBYBDYBtpZ0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BJBCTBHFB2uCjCB",!1)),Ll:()=>new TB(SB("hDZB7BqBqBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDZBiGCCEEEBBBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBDCB5XFBjkCIBC2D2DBqBBgCMBChBBnD0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBBzIEEBEEcKFDBBJDBF2B2Bs1CvBBCEEBGCFCCBCCBEBGiDCBIICFFNlBBCGG0oesBCUaCoEMCBBBC+BCBGBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCbEE2ZqBBGIBIvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFB4vChBB",!1)),Lm:()=>new TB(SB("wVRBFLBPEBICCmEGG-OnHnHlFBBuIBBFgBgBKEEhFoFoF1mBgEgE2R72B72BsDkTkTxOFBvF+BBOjBjBBjBByVOORMBg-CBByHgGgG2OsBsBBDBGiDiDB+C+CBBB34bjnBjnBBEBvIzDzDdBB6DIBxCYYpDDBEBB2OXXqEtDtDWBBoDDBKngVngVuBBBh-BFBCpBBCIB0sBhBhB2K04D04DnrTDB9PCBpBBBnRMBhCBBCPPB9-P9-PBCBCGBCBByhM9BBqGGBud0Q0QsSAB",!1)),Lo:()=>new TB(SB("qFQQhIFFBCBxGBB7ZaBFDBuBfBCJBkBBBCiDBCZZBLLBBBDRRCdBe4CBMZZBfBWVBrBYBIKBGXBCGBRoBB8B1BBETTIJBROBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNFB8BBBCCCBDBCXBCCCBIBCBBKDDBDBYDBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNyDyDBnKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPByDrTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBpBkCkCBhBBC0BBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBxFuBBSHB3BdBOBBLrBBbjBBqBCBLdByDDBCFBCBBE7hB7hBBCB4-C3BBZWBKGBCGBCGBCGBCGBCGBCGBCGBoR2B2BF1CBJCCB4CBFGGBpBBC9CBSfBxBPBhQ-tGBhC0wUBC2jBBkCnBBJrIBFPBLBBjCyByBBkCBqFoDoDEGBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBuBEBDIBLEBCoBBYCBCHBVPBCFBEEEBwBBCEEBDDBDBDCCZBBEKBIPPBEBDFBDFBKGBCGByEiBBej9KBNWBFwBBloItLBDpDBkCCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBqDJBCsBBDeBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBhEtCBjDnBBJzBB9CzBBN2JBKVBLHB5EFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4FjBBnBDBCxJxJBoBBHBBRCBCBB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB0GHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBnBBCBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBB0BUBGSB0NnBB2MqCBGwFwFB0mHBqBfBiDyDBuwIiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBxzI2P2PBrBBiBiKiKBcBTrBBlPaBmHdBDwGwGBdBCCBCBBCGBDEBKiHiHBFBCDBCBBCOBCkGB8pBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Lt:()=>new TB(SB("lOGDnB2sH2sHBGBJHBJHBNQQwBAB",!1)),Lu:()=>new TB(SB("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBG+B+B9zCvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBB",!1)),M:()=>new TB(SB("gYvDB0IGBoIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCgBB3BCBCRBCGBLBBeCB5BCCBFBDBBDCBKLLBbbDCB5BCCBDBFBBDCBEffBEEMCB5BCCBGBCCBCCBVBBXFBCCB5BCCBFBDBBDCBICBLBBf8B8BBDBECBCDBKpBpBBDB4BCCBFBCCBCDBIBBMBBeCB5BCCBFBCCBCDBIBBMBBQNNBCB4BBBCGBCCBCDBKLLBeeBBBnCFFBEBCCCBGBTBB+BDDBFBNHBjDDDBHBMGBqCBBcECFBByBTBCBBGKBCjBBKlDlDBSBYDBFCBCCBDGBEDBOLBCLLBCBgWCBzdDBdCBeBBfBBhCfBKuBuBBBBC2D2DBjBjB3DLBFLB8GEB6BJBCcBDxBxBBsBBDLBVEBwBQBnBIBNCBfMB5BNBxBTB5ECBCUBFHHDCBnG-BBxWgBB--CCBuEhDhDBeBrRFBqDBB1udDBCJBhBBBxCBBxIEEFYYBDBF0C0CBzBzBBQBbRBOnBnBBGBaMBtBDBwBNBlBkCkCBMBNJJBuBuBBBBzBCCBBBDBBGBBCqBqBBDBGBBtHHBCBBx5TiXiXBOBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB7DCB2BOBqBDDBLLBCBuBKBI+B+BBBBlBNBRBBtBNNBBBxBNBJDBCBB9CLBHDD+ELBWDB4BBBCGBDBBDCBKLLBDDBFBEEBkCIBCDDCDBCEBCPPBzCzCBQBYyCyCBSBsHGBDIBcBBzCQBrDMBmDOBhIOB2HFBCBBDDBCCCBuEuEBFBDGBEddBIBpBGBCDBJKKBJBvBPBnGHBoGHBCHBzCVBCNB7DFBECCBCCBFBCjCjCBDBCBBCEB8KDBKBBCxBxBBFBEEBYmnFmnFHOBpmLRBhuCEB8BGB5gBCCB1BBIDByCMMBslTslTBizEizEBsBBDWB-QEBEFBJHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),Mc:()=>new TB(SB("joC4B4BDCBJDBCBBzBBB7BCBHBBDBBLsBsB7BCBjC7B7BBBBJCCB2B2BB7B7BCHHBDDBLLnDBBCBBECBCCBLqBqBBBB+BDB+BBB7BCCBDBDBBCBBKBBdPPB7B7BBBBGCBCCBLrBrBBsCsCBBBHHBTBBrKBBgCsFsFBFFHDDBaaBLLBBBDGBWBBDFBDLLBBB5zBffiEIIBGBCBB7KDBDCBFBBCFBhHBB7BCCKCCBJJBEByExBxBGCCBDBCBB+BffFBBD9B9BDCBCEEBxBxBBGBJBBsFWW35EBB0-dBBD5C5CBzBzBBOBvEBBwBxBxBBFFBDDBBBvDBBDBBZuBuBCuDuDDBBGuHuHBCCBCCBCC0gZCCgEuBuBBBBFBB0DZZB8B8BxBCBKBBO+C+CBBBEBBCrFrFBBBgBBB7BBBCDBDBBDCBKLLB1C1CBBBIDDCDBCBBCmDmDBBBJBBErDrDBBBHCCBCBDuHuHBBBHDBDyDyDBBBJBBCuDuDCBBHoDoDCBBFmImIBBBK4H4HBEBCBBFDDCvEvEBBBJDBF1C1CeBB-BqGqGECCoGPPrDIID2G2GBDBFBBC-K-KBNNxBBBJBBCpvQpvQBBBlxD2BBpDBB0rYBBHFB",!1)),Me:()=>new TB(SB("okBBB1xF-wB-wBBCBCCBsshBCB",!1)),Mn:()=>new TB(SB("gYvDB0IEBqIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCfB4BCCFHBFEEBFBLBBe7B7BFDBJVVBbbDBB6BFFBFFBDDBBBEffBEEMBB6BFFBDBCBBFVVBXXBEBC7B7BDCCBCBJIIBMMBff+BNNzBEE4BCCBBBGCBCDBIBBMBBe7B7BDHHGBBVBBdBB6BBBFDBJVVBeepCIIBBBC7C7CDGBNHBjDDDBHBMGBqCBBcEC4BNBCEBCBBGKBCjBBKnDnDBCBCFBCBBDBBaBBFCBRDBODDBHHQgWgWBBBzdCBeBBfBBfBBhCBBCGBJDDBJBKuBuBBBBC2D2DBjBjB3DCBFBBKHHBBB8GBBD7B7BCGBCCCDHBHJBDxBxBBMBCeBDLBVDBxBCCBDBCGGpBIBNBBhBDBDBBCCB5BCCBEECCB7BHBDBB5ECBCMBCGBFHHEBBnG-BBxWMBFEEBKB--CCBuEhDhDBeBrRDBsDBB1udFFBIBhBBBxCBBxIEEFaaBGG4EBBbRBOnBnBBGBaKBvBCBxBDDBCBDBBoBkCkCBEBDBBDBBNJJwB0B0BCCBDBBGBBCrBrBBJJvHDDFx5Tx5TiXPBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB8D3B3BBNBqBDDBLLBBByBDBDBBI+B+BBBBlBEBCHB-BNNB1B1BBHBLDBDgDgDBBBDCCBHHD+E+EEHBWBB6BBBEmBmBBFBEEBnCFBOECPBB2CHBDCBCYY1CFBCFFBCCBvHvHBCBHBBCBBcBB2CHBDCCBrDrDCDDBEBCmDmDCDDBCBCEBkIIBCBBhIBBCFFxEDBDBBFhBhBBIBpBFBDDBJKKBEBDCBvBMBCBBnGCCBBBCqGqGBFBCFBCzCzCBUBDGBCBBCBB7DFBECCBCCBFBCpCpCBEEC8K8KBMMB1B1BBDBGCCYmnFmnFHOBpmLLBECBhuCEB8BGB5gBgCgCBCByC5lT5lTBizEizEBsBBDWBhRCBSHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),N:()=>new TB(SB("wBJB5DBBGDDBBBitBJBnEJBnGJB9MJB3DJBFFBtDJB3DJB3DJBDFBvDMB0DJBJGBoDJBpDGBISBuDJBhDJB3DJBnCTBtIJBnCJBwWTBybCBwHJBHJBXJBtJJBhEKBmFJBHJB3FJB3CJBnEJBHJB3gBEEBEBHJBnGyBBDEB3W7BBvCVB3TdBqrBqYqYaIBPCB4KDBrEJBfHBCOBhBJBoBOBh7cJB9FJBhKFB7EJBnBJBnGJBXJB3CJB3MJB34UJBuPsBBN4BBSBB2KaBlBDBeJJnEEBrGJBvdHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBxBJBHJB3IeB-EJBrBDBxDGBnEdBhEJB9BJBxEJBITB8HJB3KJB3DJB3LJBnDJBHTBtCLBlNSB+CJB3UJB3CcBkHJBnCJB3BJBnLJBnDUBshBuDBimPJBnpCJB3CJBnEJBCGBvQJBnIWB+KCB6nXJBnuBTBNTBtDYB2iBxBBhqCJBnNJB3PJB4HJBtWIBhEJB4Y6BBCCBCDBtCsBBCOBjeMBk3CJB",!1)),Nd:()=>new TB(SB("wBJnxBJnEJnGJ9MJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJhDJ3DJnCJ3IJnCJn6BJnBJtJJhEJnFJHJ3FJ3CJnEJHJnuiBJnVJnBJnGJXJ3CJ3MJ34UJnsBJnkCJHJ9YJhEJ9BJxEJ3IJ3KJ3DJ3LJnDJHTtCJnNJnDJ3UJ3CJ3HJnCJ3BJnLJ3uQJnpCJ3CJnEJ3QJ37XJ12CxBhqCJnNJ3PJ4HJ2aJ30EJ",!0)),Nl:()=>new TB(SB("u3FCBwzCiBBDDB-zDaaBHBPCBs1dJBxyW0BBtOJJnEEBrhIuDBm8SCB",!1)),No:()=>new TB(SB("yFBBGDDBBB2pCFB5LFB5DCBmEGB6GGBSIByNJB2hBTB0jBJBhP20B20BEFBHJBnGPBqB3W3WB6BBvCVB3TdBqrB1kB1kBBCBrEJBfHBCOBhBJBoBOBxrdFBymWsBBiCDBSBB2KaBlBDB1pBHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBhLeB-EJBrBDBxDGBnETB8LTBmqBBBvNIBobSB0aUBn8SGB-YWBqhZTBNTBtDYBvqFIBid6BBCCBCDBtCsBBCOBjeMB",!1)),P:()=>new TB(SB("hBCBCFBCDBLBBEBBbCBCccCkBkBGEELBBEEE-VJJzOFBqBBB0BCCDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCmBmBBCBoCrCrCBDBFBBwDFBsFlTlTBHB4EuTuTtBBBvCCBoCBB+ECBCCBmBKB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBM9Z9ZBWBJTBCMBCLBfBBPBB6TDBeBB+hBNBwCBBgBJB0MVBgCDBhBBB8XDBCBBxDwEwEBtBBCfBDLBkNCBFJBDLBRNNjD7C7CjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HzqUzqUBxGxGBIBXiBBCNBCFFCBB2ECBCFBCDBLBBEBBbCBCccCCCBFB7MCB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDByO-J-JjBlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Pc:()=>new TB(SB("-Cg-Hg-HBUU-u3BBBZCBwHAB",!1)),Pd:()=>new TB(SB("tB9qB9qB0BiyDiyDmgBqgCqgCBEBiwDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Pe:()=>new TB(SB("pB0B0BgB+1D+1DC-6B-6BqtC4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECtBGCtNICEGCDBB-ozB6G6GeOCESSCCCrF0B0BgBGD",!1)),Pf:()=>new TB(SB("7F+6H+6HEddpuDCCFDDQEE",!1)),Pi:()=>new TB(SB("rFt7Ht7HDBBDaapuDCCFDDQEE",!1)),Po:()=>new TB(SB("hBCBCCBDECBLLBEEBcclCGGPBBI-V-VJzOzOBEBqB3B3BDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCxDxDrCEBFBBwDFBsFlTlTBHBmY9D9DBBBoCBB+ECBCCBmBFBCDB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBMjajaBJJBGBJIBDDBDCBEKBCCCBIB7kDDBCBBxDwEwEBFFBBBDDDBHBCBBCDDBLLBDBCJBDDBCCCBLBDCBtNCB6B+F+FjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HlxUlxUBFBDXXVBBDDBECBCDBICBHCCB2E2EBBBCCBDECBLLBEEBcclBDDB7M7MBBB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDB0ZlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Ps:()=>new TB(SB("oBzBzBgB-1D-1DC-6B-6B-rCEEnB4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECaTTCECtNICEGCDipzBipzB4GeeCMCESSCCCrFzBzBgBEEDAB",!1)),S:()=>new TB(SB("kBHHRCBgBCCcCCkBEBCBBDCCBCBDEEfgBgBrODBNNBGGBCCCBPB2DPPBxDxDsErIrIBBB3DCBDDDBvGvGLUUB4H4HIBBpEqLqLBHHB2H2H-DjEjEBGBlEwGwGqBmGmGiGCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WuLuLlL+E+EBgBBiLJBKIBhiBCCBBBMCBOCBOCBOBBmCOOoBCBOCBUhBB-BBBCDBCBBLCCBBBGFBCECFMMBFFBDBGDBC7B7BBFFB2LBFcBD+HBXKByCtCBXnTBtBwBBDeBLyMBX+BBFfBD1LBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBB8CBB0HBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BB6RWBKBBoDBB+EDBLDB+RCBiHPPB+9T+9TpEgBBuLPBhCBB3BHBtBDBjDCCBBBD7E7EHRRBBBgBCCcCCiEGBCGBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSmWmWBiKiKBGBnjC2kC2kCBbBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQQBgDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBrbaagBaagBaagBaagBaa9B-PB4BDBzBHBCNBCBBp2BwNwNttCEE+DiOiOBvIvIBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Sc:()=>new TB(SB("kB+D+DBCBqnB8D8DzPBBzPBBI2H2HoImSmS8sClmClmCBgBB37hBkuVkuVtD7E7E8GBBEBB3-HDB-4wBxtCxtC",!1)),Sk:()=>new TB(SB("+CCCoCHHFEEqQDBNNBGGBCCCBPB2DPPBjoBjoB15FCCBBBMCBOCBOCBOBB9kEBBkzdWBKBBoDBBxePPBniUniUBPB8bCCjF4g9B4g9BBDB",!1)),Sm:()=>new TB(SB("rBRRBBB+BCCuBFFmBgBgB-XwQwQBBB8xGOOoBCBOCBsEoBoBBDBHlClCBDBGBBFGDIgBgBBDDCgBgBBqIBhBBB7CffBXBpBFB2OKK3BHBwDxKxKBDBDeBLPBhIiEBX+BBFfBDhIBxBUBDFB9+zB5Z5ZCCBlFRRBBB+BCCkEHHBCBitDBBhrwBx+Bx+BagBgBagBgBagBgBagBgBat5Ft5FB-uC-uCBHB",!1)),So:()=>new TB(SB("mFDDFCCyerIrIBgEgEBvGvGLUUB4H4HkQ2L2LjEFBClElEwGqBqBoMCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WzWzW+EhBBiLJBKIBksBBBCDBCBBLCCBHHBEBCECFMMBPPCBBC7B7BBKKBDBDDBCBBCBBCGBCeBDBBCCCBdBtIHBFTBDGBDwCBCdBanBBHnCBXKByCtCBX2FBCIBC1BBJuDBC3HBtBrBBhC-HBhQvBBWBBHmBBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBBxKBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BBibDBLBBC+R+RBBBqqUPBuLPBhCBB3BHBuBCBlPEEFBBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSpgBpgBBGBnjC2kC2kCBGBFQBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQPBhDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBqlB-PB4BDBzBHBCNBCBBp2B96C96CiEyWyWBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E6HBG4WBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBB-B3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Z:()=>new TB(SB("gBgEgEgvFgsCgsCBJBeBBGwBwBh9DAB",!1)),Zl:()=>new TB(SB("ohIA",!0)),Zp:()=>new TB(SB("phIA",!0)),Zs:()=>new TB(SB("gBgEgEgvFgsCgsCBJBlBwBwBh9DAB",!1)),ASCII_Hex_Digit:()=>new TB(SB("wBJIFbF",!0)),Alphabetic:()=>new TB(SB("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICC3CeeBQBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoBNBCCCBCCBCCJaBFDBeKBG3BBCGBPlDBCHBFHBFCBLCBDRRBuBBOkDBZgBBKBBFGGBWBDSBUYBIKBGXBCGBIJJBoBBLLBEGBHrCBCPBCCBFOBOSBCHBDBBDVBCGBCEEBCBEHBDBBDBBCJJFBBCEBNBBLFFBBBCFBFBBDVBCGBCBBCBBCBBFEBFBBDBBFIIBCBCSSBEBMCBCIBCCBCVBCGBCBBCEBEIBCCBCBBEQQBCBWDBFCBCHBDBBDVBCGBCBBCEBEHBDBBDBBKBBFBBCEBORRBCCBEBECBCDBEBBCCCBEEBEEBBBELBFEBECBCCBEHHpBMBCCBCWBCPBEHBCCBCCBJBBCCBCBBDDBdDBCHBCCBCWBCJBCEBEHBCCBCCBJBBGCBCDBOCBNMBCCBCoBBDHBCCBCCBCGGBCBIEBXFBCCBCRBEXBCIBCDDBFBJFBCCCBGBTBBO5BBGGBH0B0BBECBDBCXBCCCBRBCCBDEBCHHPDBhBgCgCBGBCjBBFSBFPBCjBBkC2BBCDDBDBR-BBLDBDlBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBEKBITBMUBNTBNMBCCBCBBNzBBDSBPFFkC4CBIqBBGlCBLeBCLBFIBYdBDEBMrBBFZB3BbBF+BBDTBzBYYBMMBBByBzBBCOBCHB0BpBBDDBLrBBCKBP2BBXCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBUhBBM1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBFSSBnBBuZzBB34BkHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBCfBwB2O2OBBBaIBIEBDEBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBGHBEwDBoBIBDmDBDxCBVUBCgBBZzBBNjCBCtBtBBEBECCBBBLgBBGiBBOcBEyBBCLBQRRBOBLEBC2BBKNBTWBEkCBCCCZCBDPBDDBMFBDFBDFBKGBCGBCqBBCNBH6DBWj9KBNWBFwBBloItLBDpDBnBGBNEBGLBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmC0BBsIcBEwBBwBfBOdBGqBBGdBDjBBFHBCEBrB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCDBCBBGHBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOnBBjBbBEGGBVB7HpBBCBBEBBRFBzBCBEcBLJJBUBrBRBvBUBcWBKlCBsBEBL4BBKOOBXBYyBBSDBJiBBEKKB+BBCDBKBBLCCkBRBChBBDHHBCB-BGBCCCBCBCOBCJBI4BBYDBCHBDBBDVBCGBCBBCEBEHBDBBDBBEHHGGBdJBCDDClBBCJBCDDCDBCBBECCtBhCBCCBCDBVCBfhCBDBBC5F5FB0BBDGBaFBjB+BBCEE8B1BBDoCoCBZBDNBWGB6F4BBoD-BBgBHBDDDBGBCBBCdBCBBDBBDDB+CHBDtBBDFBCCCBccBxBBDJBSnCBGTTBnCBoDHB5CgBBgBIBCsBBCGBCyByBBcBDVBCNBqCGBCBBCrBBECCBCCBBBCDDBZZBEBCBBCkBBCBBCDBCYYBqBBlIWBKQBCoBBECBwDwCwCB4cBnDuDBSjGBtyCgDBQvhBBSFBa68DBGmSB61GuBBy2B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBF4BBIQBhCBBCNNBFBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBFi7Fi7FBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCVBJBBhHGBCDBCBBCOBCkGB8BjCBEEE1lBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1TZBHZBHZB3zD-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Dash:()=>new TB(SB("tB9qB9qB0BiyDiyDmgBqgCqgCBEB+BoBoBQnMnMlgDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Emoji:()=>new TB(SB("jBHHGJBwDFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDrGrGhFBBNBBPDDBIBsCZBCBBYVVDIBWBBvFhBBDvDBDBBCCBDyCBDCBCmIBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDDBEJBECCBEEDJBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Emoji_Component:()=>new TB(SB("jBHHGJB0+H2G2Gsp3B3+8B3+8BBYB8PEBxtBDBtzhY-CB",!1)),Emoji_Modifier:()=>new TB(SB("7-8DE",!0)),Emoji_Modifier_Base:()=>new TB(SB("9wJ8G8GRDB4jzD9B9BBBBDDDBBB2DBBDKBWSBEFFBBBCCBICCZqGqGBFFWFFBvFvFBBBEEB0CRRBBBKMMgSDDJHBHKKBIBDCB5B+B+BBCCBCCSCBCMBmHCBrBIB",!1)),Emoji_Presentation:()=>new TB(SB("64IBBuGDBEDDqQBBWBBzBLBsBUUOJJBSSBGGBJJGWWIBBCFFDIIFBBdkBkBCFFBBBC+B+BBBBZPP8aBB0BFFvlxDrGrG-FDDBIBsCZBCZZVDDBDBCCBWBBvFgBBNIBClCBCVBNqBBFEBNQBEEEBlCBCCCB5FBD+BBODBCXBTbbBOO3C0CBxBlCBHEEBBBDDBEDBMBBIIBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Extended_Pictographic:()=>new TB(SB("pFFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDoBoBBCBlDLBQBBQPPBmBmBBIBxDBBNBBPDDBIBU3BBcOBLVVDIBCDBKWBH7FBDvDBDBBCCBDyCBDCBCDBG9HBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDQBECCBEBDMB7GlBBNDB5BHBLFBpBHBfBBNDBDNBKmBBNuBBCJBC4FB5CHBPxEBhI9fB",!1)),Hex_Digit:()=>new TB(SB("wBJIFbFq1-BJIFbF",!0)),Lowercase:()=>new TB(SB("hDZBwBLLFlBlBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDiBBIBBfEBhDsBsBCEEDDBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBCDB5XFBjkCIBC2D2DB+FBiC0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBB6DOORMBuDEEBEEcKFDBBJDBFiBiBBOBFsasaBYBn6BvBBCEEBGCFCCBCCBGBEiDCBIICFFNlBBCGG0oesBCUaCBBBmEMCBBBC8BCBIBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCWDBCCCBBB2ZqBBCNBHvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBkODDBBBCpBBCIBmoByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFBmI9BB1lChBB",!1)),Math:()=>new TB(SB("rBRRBBBgBeeCuBuBFmBmBgB5W5WBBBDbbBDDBBBwQCBuwGccBBBMEEOPPBCBWEBMEBiCMBFEEBFFBDBTFFDJBCDDBEBHEEBDDBCCBBBCFBENBClClCBWBCFBCBBFBBFfBCHHBPPBqIBJDBVBB7CffBZBCZZMGB+NBBNJBFFBFBBDBBEEBPCCDFBMHBGBB6BCCeDBKCBxK-BBhI-PBxBUBDFB9+zB4Z4ZBEBCjFjFRCBeCCeCCkEHHBCBitDBBhrwBwoBwoBBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBBhwFDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB-uCIB",!1)),Quotation_Mark:()=>new TB(SB("iBFFkEQQ96HHBaBBowDqOqOBCBOCBixzBDB+FFF7CBB",!1)),Terminal_Punctuation:()=>new TB(SB("hBLLCMMBEE-ZJJiQ6B6BpCPPCCB1FsBsBBJBCsHsHB3B3BBEBCHBgBmImIB1nB1nBBtFtFFFB4JBB2YHBmY9D9DBBBoCBB+ECBEoBoBBCBDBB7JBBjLDBjFBBLBBCCBeCB8FEB-BBBldYYBKKBBBwlDCBzJOOFLLCBBEBBtNBB8ndBBuICBkHEB-LBB3CBBgD4E4EBBB0ECBgERRB6H6HnxUDDB6B6BBBBCDBqFLLCMMBEEiCDD7hBxBxBnkBoGoG3JBB5EFBlCFB6CDB5dEBtBDB+FGBxDDBgECBiEBBHRRB5C5CBDBtDrJrJB2D2DBBBNBBnLDBEOBqDBB6HCBmQCC8HBB4CBBFBB-MCBuBmUmUBrCrCBspBspBBDB6vRBBmEiCiCBBBLqRqRBoJoJBnwTnwTovHDB",!1)),Uppercase:()=>new TB(SB("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBGbbBOBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new TB(SB("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))});static SCRIPTS=new RB({Adlam:()=>new TB(SB("go6DrCFJFB",!0)),Ahom:()=>new TB(SB("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new TB(SB("ggxCmS",!0)),Arabic:()=>new TB(SB("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!1)),Armenian:()=>new TB(SB("xpBlBDxBDCks9BE",!0)),Avestan:()=>new TB(SB("g4iC1BEG",!0)),Balinese:()=>new TB(SB("g4GsCCxB",!0)),Bamum:()=>new TB(SB("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new TB(SB("w26CdDF",!0)),Batak:()=>new TB(SB("g+GzBJD",!0)),Bengali:()=>new TB(SB("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new TB(SB("g17CYDY",!0)),Bhaiksuki:()=>new TB(SB("ggnCICsBCNLc",!0)),Bopomofo:()=>new TB(SB("qXB6wLqBxDf",!0)),Brahmi:()=>new TB(SB("ggkCtCFjBKA",!0)),Braille:()=>new TB(SB("ggK-H",!0)),Buginese:()=>new TB(SB("gwGbDB",!0)),Buhid:()=>new TB(SB("g6FT",!0)),Canadian_Aboriginal:()=>new TB(SB("ggF-TxRlC7tgCP",!0)),Carian:()=>new TB(SB("g1gCwB",!0)),Caucasian_Albanian:()=>new TB(SB("wphCzBMA",!0)),Chakma:()=>new TB(SB("gokC0BCR",!0)),Cham:()=>new TB(SB("gwqB2BKNDJDD",!0)),Cherokee:()=>new TB(SB("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new TB(SB("w9jCb",!0)),Common:()=>new TB(SB("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new TB(SB("ifNxkKzDGG",!0)),Cuneiform:()=>new TB(SB("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new TB(SB("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new TB(SB("w8rCiD",!0)),Cyrillic:()=>new TB(SB("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new TB(SB("gghCvC",!0)),Devanagari:()=>new TB(SB("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new TB(SB("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new TB(SB("ggmC7B",!0)),Duployan:()=>new TB(SB("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new TB(SB("ggsC1iBL68D",!0)),Elbasan:()=>new TB(SB("gohCnB",!0)),Elymaic:()=>new TB(SB("g-jCW",!0)),Ethiopic:()=>new TB(SB("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCDBCBBCOB",!1)),Garay:()=>new TB(SB("gqjClBEcJB",!0)),Georgian:()=>new TB(SB("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new TB(SB("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new TB(SB("w5gCa",!0)),Grantha:()=>new TB(SB("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new TB(SB("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new TB(SB("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new TB(SB("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new TB(SB("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new TB(SB("go4C5B",!0)),Han:()=>new TB(SB("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new TB(SB("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new TB(SB("gojCnBJJ",!0)),Hanunoo:()=>new TB(SB("g5FU",!0)),Hatran:()=>new TB(SB("gniCSCBGE",!0)),Hebrew:()=>new TB(SB("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new TB(SB("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new TB(SB("giiCVCI",!0)),Inherited:()=>new TB(SB("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new TB(SB("g7iCSGH",!0)),Inscriptional_Parthian:()=>new TB(SB("g6iCVDH",!0)),Javanese:()=>new TB(SB("gsqBtCDJFB",!0)),Kaithi:()=>new TB(SB("gkkCiCLA",!0)),Kannada:()=>new TB(SB("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new TB(SB("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new TB(SB("g4nCQCoBEc",!0)),Kayah_Li:()=>new TB(SB("goqBtBCA",!0)),Kharoshthi:()=>new TB(SB("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new TB(SB("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new TB(SB("g8F9CDJHJnPf",!0)),Khojki:()=>new TB(SB("gwkCRCuB",!0)),Khudawadi:()=>new TB(SB("w1kC6BGJ",!0)),Kirat_Rai:()=>new TB(SB("gq7C5B",!0)),Lao:()=>new TB(SB("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new TB(SB("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new TB(SB("ggH3BEOEC",!0)),Limbu:()=>new TB(SB("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new TB(SB("gwhC2JKVLH",!0)),Linear_B:()=>new TB(SB("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new TB(SB("wmpBvBx1eA",!0)),Lycian:()=>new TB(SB("g0gCc",!0)),Lydian:()=>new TB(SB("gpiCZGA",!0)),Mahajani:()=>new TB(SB("wqkCmB",!0)),Makasar:()=>new TB(SB("g3nCY",!0)),Malayalam:()=>new TB(SB("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new TB(SB("giCbDA",!0)),Manichaean:()=>new TB(SB("g2iCmBFL",!0)),Marchen:()=>new TB(SB("wjnCfDVCN",!0)),Masaram_Gondi:()=>new TB(SB("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new TB(SB("gy7C6C",!0)),Meetei_Mayek:()=>new TB(SB("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new TB(SB("gg6DkGDP",!0)),Meroitic_Cursive:()=>new TB(SB("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new TB(SB("gsiCf",!0)),Miao:()=>new TB(SB("g47CqCF4BIQ",!0)),Modi:()=>new TB(SB("gwlCkCMJ",!0)),Mongolian:()=>new TB(SB("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new TB(SB("gy6CeCJFB",!0)),Multani:()=>new TB(SB("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>new TB(SB("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new TB(SB("gkiCeJI",!0)),Nag_Mundari:()=>new TB(SB("wm5DpB",!0)),Nandinagari:()=>new TB(SB("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new TB(SB("gsGrBFZHKEB",!0)),Newa:()=>new TB(SB("gglC7CCE",!0)),Nko:()=>new TB(SB("g+B6BDC",!0)),Nushu:()=>new TB(SB("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new TB(SB("go4DsBENDJFB",!0)),Ogham:()=>new TB(SB("g0Fc",!0)),Ol_Chiki:()=>new TB(SB("wiHvB",!0)),Ol_Onal:()=>new TB(SB("wu5DqBFA",!0)),Old_Hungarian:()=>new TB(SB("gkjCyBOyBIF",!0)),Old_Italic:()=>new TB(SB("g4gCjBKC",!0)),Old_North_Arabian:()=>new TB(SB("g0iCf",!0)),Old_Permic:()=>new TB(SB("w6gCqB",!0)),Old_Persian:()=>new TB(SB("g9gCjBFN",!0)),Old_Sogdian:()=>new TB(SB("g4jCnB",!0)),Old_South_Arabian:()=>new TB(SB("gziCf",!0)),Old_Turkic:()=>new TB(SB("ggjCoC",!0)),Old_Uyghur:()=>new TB(SB("w7jCZ",!0)),Oriya:()=>new TB(SB("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new TB(SB("wlhCjBFjB",!0)),Osmanya:()=>new TB(SB("gkhCdDJ",!0)),Pahawh_Hmong:()=>new TB(SB("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new TB(SB("gjiCf",!0)),Pau_Cin_Hau:()=>new TB(SB("g2mC4B",!0)),Phags_Pa:()=>new TB(SB("giqB3B",!0)),Phoenician:()=>new TB(SB("goiCbEA",!0)),Psalter_Pahlavi:()=>new TB(SB("g8iCRIDNG",!0)),Rejang:()=>new TB(SB("wpqBjBMA",!0)),Runic:()=>new TB(SB("g1FqCEK",!0)),Samaritan:()=>new TB(SB("ggCtBDO",!0)),Saurashtra:()=>new TB(SB("gkqBlCJL",!0)),Sharada:()=>new TB(SB("gskC-ChsCH",!0)),Shavian:()=>new TB(SB("wihCvB",!0)),Siddham:()=>new TB(SB("gslC1BDlB",!0)),Sidetic:()=>new TB(SB("gqiCZ",!0)),SignWriting:()=>new TB(SB("gg2DrUQECO",!0)),Sinhala:()=>new TB(SB("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new TB(SB("w5jCpB",!0)),Sora_Sompeng:()=>new TB(SB("wmkCYIJ",!0)),Soyombo:()=>new TB(SB("wymCyC",!0)),Sundanese:()=>new TB(SB("g8G-BhIH",!0)),Sunuwar:()=>new TB(SB("g+mChBPJ",!0)),Syloti_Nagri:()=>new TB(SB("ggqBsB",!0)),Syriac:()=>new TB(SB("g4BNC7BDCxIK",!0)),Tagalog:()=>new TB(SB("g4FVKA",!0)),Tagbanwa:()=>new TB(SB("g7FMCCCB",!0)),Tai_Le:()=>new TB(SB("wqGdDE",!0)),Tai_Tham:()=>new TB(SB("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new TB(SB("g0qBiCZE",!0)),Tai_Yo:()=>new TB(SB("g25DeCVJB",!0)),Takri:()=>new TB(SB("g0lC5BHJ",!0)),Tamil:()=>new TB(SB("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new TB(SB("wz6CuCCJ",!0)),Tangut:()=>new TB(SB("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new TB(SB("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new TB(SB("g8BxB",!0)),Thai:()=>new TB(SB("hwD5BGb",!0)),Tibetan:()=>new TB(SB("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new TB(SB("wpL3BIBPA",!0)),Tirhuta:()=>new TB(SB("gklCnCJJ",!0)),Todhri:()=>new TB(SB("guhCzB",!0)),Tolong_Siki:()=>new TB(SB("wtnCrBFJ",!0)),Toto:()=>new TB(SB("w04De",!0)),Tulu_Tigalari:()=>new TB(SB("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new TB(SB("g8gCdCA",!0)),Unknown:()=>new TB(SB("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new TB(SB("gopBrJ",!0)),Vithkuqi:()=>new TB(SB("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new TB(SB("g24D5BGA",!0)),Warang_Citi:()=>new TB(SB("glmCyCNA",!0)),Yezidi:()=>new TB(SB("g0jCpBCCDB",!0)),Yi:()=>new TB(SB("ggoBskBE2B",!0)),Zanabazar_Square:()=>new TB(SB("gwmCnC",!0))});static FOLD_CATEGORIES=new RB({L:()=>new TB(SB("laA",!0)),LC:()=>new TB(SB("laA",!0)),Ll:()=>new TB(SB("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Lt:()=>new TB(SB("kOCCBCCBCClBCCtsHHBJHBJHBMQQwBAB",!1)),Lu:()=>new TB(SB("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpL2B2Bs1CvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1)),M:()=>new TB(SB("5cgBgBlgHAB",!1)),Mn:()=>new TB(SB("5cgBgBlgHAB",!1)),Emoji:()=>new TB(SB("8mJA",!0)),Extended_Pictographic:()=>new TB(SB("8mJA",!0)),Lowercase:()=>new TB(SB("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHuBPBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Math:()=>new TB(SB("ycGDCHHFMMDDDCHHFAB",!1)),Uppercase:()=>new TB(SB("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpLiBiBBOBFsasaBYBn6BvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1))});static FOLD_SCRIPT=new RB({Common:()=>new TB(SB("8cgBgB",!1)),Greek:()=>new TB(SB("1FwUwU",!1)),Inherited:()=>new TB(SB("5cgBgBlgHAB",!1))})},xB=class t{static MAX_RUNE=1114111;static RUNE_ERROR=65533;static isUnsearchable(e){return e===t.RUNE_ERROR||e>=t.MIN_HIGH_SURROGATE&&e<=t.MAX_LOW_SURROGATE}static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static MIN_HIGH_SURROGATE=55296;static MAX_HIGH_SURROGATE=56319;static MIN_LOW_SURROGATE=56320;static MAX_LOW_SURROGATE=57343;static MIN_SUPPLEMENTARY_CODE_POINT=65536;static is32(t,e){let n=0,s=t.length;for(;n<s;){const r=n+Math.floor((s-n)/2),i=t.getLo(r),o=t.getHi(r);if(i<=e&&e<=o){return(e-i)%t.getStride(r)===0}e<i?s=r:n=r+1}return!1}static is(e,n){if(n<=t.MAX_LATIN1){for(let t=0;t<e.length;t++){if(n>e.getHi(t))continue;const s=e.getLo(t);if(n<s)return!1;return(n-s)%e.getStride(t)===0}return!1}return e.length>0&&n>=e.getLo(0)&&t.is32(e,n)}static isPrint(e){return e<=t.MAX_LATIN1?e>=32&&e<t.MAX_ASCII||e>=161&&173!==e:t.is(NB.Print,e)}static simpleFold(e){if(NB.CASE_ORBIT.has(e))return NB.CASE_ORBIT.get(e);if(e<=t.MAX_ASCII){const t=IB.toLowerCase(e);return t!==e?t:IB.toUpperCase(e)}return e}static equalsIgnoreCase(e,n){if(e===n)return!0;if(e<0||n<0)return!1;if(e<=t.MAX_ASCII&&n<=t.MAX_ASCII)return 65<=e&&e<=90&&(e|=32),65<=n&&n<=90&&(n|=32),e===n;for(let s=t.simpleFold(e);s!==e;s=t.simpleFold(s))if(s===n)return!0;return!1}};const kB=new Uint8Array(256);for(let t=0;t<256;t++)kB[t]=97<=t&&t<=122||65<=t&&t<=90||48<=t&&t<=57||95===t?1:0;let LB=null,FB=null;var PB=class t{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isByteArray(t){return Array.isArray(t)||"[object Uint8Array]"===Object.prototype.toString.call(t)}static isalnum(t){return IB.CODES[0]<=t&&t<=IB.CODES[9]||IB.CODES.a<=t&&t<=IB.CODES.z||IB.CODES.A<=t&&t<=IB.CODES.Z}static unhex(t){return IB.CODES[0]<=t&&t<=IB.CODES[9]?t-IB.CODES[0]:IB.CODES.a<=t&&t<=IB.CODES.f?t-IB.CODES.a+10:IB.CODES.A<=t&&t<=IB.CODES.F?t-IB.CODES.A+10:-1}static escapeRune(e){let n="";if(xB.isPrint(e))t.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(n+="\\"),n+=String.fromCodePoint(e);else switch(e){case IB.CODES['"']:n+='\\"';break;case IB.CODES["\\"]:n+="\\\\";break;case IB.CODES["\t"]:n+="\\t";break;case IB.CODES["\n"]:n+="\\n";break;case IB.CODES["\r"]:n+="\\r";break;case IB.CODES["\b"]:n+="\\b";break;case IB.CODES["\f"]:n+="\\f";break;default:{let t=e.toString(16);e<256?(n+="\\x",1===t.length&&(n+="0"),n+=t):n+=`\\x{${t}}`;break}}return n}static stringToRunes(t){const e=String(t),n=[];let s=0;for(;s<e.length;){const t=e.codePointAt(s);n.push(t),s+=t>xB.MAX_BMP?2:1}return new Int32Array(n)}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return t<256&&1===kB[t]}static emptyOpContext(e,n){let s=0;return e<0&&(s|=t.EMPTY_BEGIN_TEXT|t.EMPTY_BEGIN_LINE),10===e&&(s|=t.EMPTY_BEGIN_LINE),n<0&&(s|=t.EMPTY_END_TEXT|t.EMPTY_END_LINE),10===n&&(s|=t.EMPTY_END_LINE),t.isWordRune(e)!==t.isWordRune(n)?s|=t.EMPTY_WORD_BOUNDARY:s|=t.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(e){return e.split("").map(e=>t.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(t){return t>xB.MAX_BMP?2:1}static toArray(t){const e=t.length,n=new Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return LB||(LB=new TextEncoder),LB.encode(t);{let e=[],n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):(64512&r)===xB.MIN_HIGH_SURROGATE&&s+1<t.length&&(64512&t.charCodeAt(s+1))===xB.MIN_LOW_SURROGATE?(r=xB.MIN_SUPPLEMENTARY_CODE_POINT+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder){FB||(FB=new TextDecoder("utf-8"));const e=t instanceof Uint8Array?t:new Uint8Array(t);return FB.decode(e)}{let e=[],n=0,s=0;for(;n<t.length;){let r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){let i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){let i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-xB.MIN_SUPPLEMENTARY_CODE_POINT;e[s++]=String.fromCharCode(xB.MIN_HIGH_SURROGATE+(i>>10)),e[s++]=String.fromCharCode(xB.MIN_LOW_SURROGATE+(1023&i))}else{let i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}}};const MB=(t=[],e=0)=>{const n=Object.create(null);for(let s=0;s<t.length;s++){const r=t[s],i=e+s;n[r]=i,n[i]=r}return Object.freeze(n)};var GB=class t{static Encoding=MB(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===t.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===t.Encoding.UTF_16}},HB=class extends GB{constructor(t=null){super(),this.bytes=t}getEncoding(){return GB.Encoding.UTF_8}asCharSequence(){return PB.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},UB=class extends GB{constructor(t=null){super(),this.charSequence=t}getEncoding(){return GB.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return PB.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},VB=class{static utf16(t){return new UB(t)}static utf8(t){return PB.isByteArray(t)?new HB(t):new HB(PB.stringToUtf8ByteArray(t))}},jB=class{static EOF(){return-8}constructor(){this.start=0,this.end=0}canCheckPrefix(){return!0}endPos(){return this.end-this.start}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},$B=class t extends jB{static RUNE_ERROR_STEP=xB.RUNE_ERROR<<3|1;constructor(t,e=0,n=t.length){super(),this.bytes=t,this.start=e,this.end=n}hasString(t,e){const n=t.bytes;if(0===n.length)return!0;const s=this.indexOf(this.bytes,n,this.start+e);return-1!==s&&s<=this.end-n.length}hasAnyString(t,e){return t.automaton8().searchUTF8(this.bytes,this.start+e,this.end)}step(e){if((e+=this.start)>=this.end)return jB.EOF();const n=255&this.bytes[e];if(n<128)return n<<3|1;let s,r,i=128,o=191;if(n>=194&&n<=223)s=2,r=31&n;else if(n>=224&&n<=239)s=3,r=15&n,224===n?i=160:237===n&&(o=159);else{if(!(n>=240&&n<=244))return t.RUNE_ERROR_STEP;s=4,r=7&n,240===n?i=144:244===n&&(o=143)}if(e+s>this.end)return t.RUNE_ERROR_STEP;const a=255&this.bytes[e+1];if(a<i||a>o)return t.RUNE_ERROR_STEP;if(r=r<<6|63&a,s>2){const n=255&this.bytes[e+2];if(128!=(192&n))return t.RUNE_ERROR_STEP;if(r=r<<6|63&n,s>3){const n=255&this.bytes[e+3];if(128!=(192&n))return t.RUNE_ERROR_STEP;r=r<<6|63&n}}return r<<3|s}index(t,e){e+=this.start;const n=this.indexOf(this.bytes,t.prefixUTF8,e);return n<0?n:n-e}context(t){let e=-1;if((t+=this.start)>this.start&&t<=this.end){let n=t-1;if(e=this.bytes[n--],e>=128){let s=t-4;for(s<this.start&&(s=this.start);n>=s&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start);const r=this.step(n-this.start);e=n+(7&r)===t?r>>3:xB.RUNE_ERROR}}const n=t<this.end?this.step(t-this.start)>>3:-1;return PB.emptyOpContext(e,n)}indexOf(t,e,n=0){let s=e.length;if(0===s)return n<=this.end?n:-1;const r=e[0];let i=this.end-s;const o="function"==typeof t.indexOf;let a=n;for(;a<=i;){if(o){if(a=t.indexOf(r,a),-1===a||a>i)return-1}else{for(;a<=i&&t[a]!==r;)a++;if(a>i)return-1}let n=!0;for(let r=1;r<s;r++)if(t[a+r]!==e[r]){n=!1;break}if(n)return a;a++}return-1}prefixLength(t){return t.prefixUTF8.length}},JB=class extends jB{constructor(t,e=0,n=t.length){super(),this.charSequence=t,this.start=e,this.end=n}hasString(t,e){const n=this.charSequence.indexOf(t.str,this.start+e);return-1!==n&&n<=this.end-t.str.length}hasAnyString(t,e){return t.automaton16().searchUTF16(this.charSequence,this.start+e,this.end)}step(t){if((t+=this.start)>=this.end)return jB.EOF();const e=this.charSequence.charCodeAt(t);if(e<xB.MIN_HIGH_SURROGATE||e>xB.MAX_HIGH_SURROGATE||t+1>=this.end)return e<<3|1;const n=this.charSequence.charCodeAt(t+1);return n>=xB.MIN_LOW_SURROGATE&&n<=xB.MAX_LOW_SURROGATE?1024*(e-xB.MIN_HIGH_SURROGATE)+(n-xB.MIN_LOW_SURROGATE)+xB.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:e<<3|1}index(t,e){e+=this.start;const n=this.charSequence.indexOf(t.prefix,e);return n<0||n>this.end-t.prefix.length?-1:n-e}context(t){const e=(t+=this.start)>this.start&&t<=this.end?this.charSequence.charCodeAt(t-1):-1,n=t<this.end?this.charSequence.charCodeAt(t):-1;return PB.emptyOpContext(e,n)}prefixLength(t){return t.prefix.length}},qB=class{static fromUTF8(t,e=0,n=t.length){return new $B(t,e,n)}static fromUTF16(t,e=0,n=t.length){return new JB(t,e,n)}},zB=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},KB=class extends zB{constructor(t,e=null){let n=`error parsing regexp: ${t}`;e&&(n+=`: \`${e}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=t,this.input=e}getDescription(){return this.error}getPattern(){return this.input}},QB=class extends zB{constructor(t){super(t),this.name="RE2JSCompileException"}},WB=class extends zB{constructor(t){super(t),this.name="RE2JSGroupException"}},YB=class extends zB{constructor(t){super(t),this.name="RE2JSFlagsException"}},XB=class extends zB{constructor(t){super(t),this.name="RE2JSInternalException"}},ZB=class t{static MAX_REPLACER_ARGS=65535;static quoteReplacement(t,e=!1){return e?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(t=>{const e=t.codePointAt(0);return e===IB.CODES["\\"]||e===IB.CODES.$?`\\${t}`:t}).join(""):t.indexOf("$")<0?t:t.split("").map(t=>t.codePointAt(0)===IB.CODES.$?"$$":t).join("")}constructor(t,e){if(null===t)throw new Error("pattern is null");this.patternInput=t;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.hasNamedGroups=Object.keys(this.namedGroups).length>0,this.numberOfInstructions=n.numberOfInstructions(),this.lookbehindState=null,e instanceof GB?this.resetMatcherInput(e):PB.isByteArray(e)?this.resetMatcherInput(VB.utf8(e)):this.resetMatcherInput(VB.utf16(e))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(null===t)throw new Error("input is null");return t instanceof GB||(t=PB.isByteArray(t)?VB.utf8(t):VB.utf16(t)),this.matcherInput=t,null!==this.lookbehindState?this.lookbehindState.reset():this.lookbehindState=this.patternInput.re2().createLookbehindState(),this.reset(),this}start(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t]}end(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}const e=this.start(t),n=this.end(t);return e<0&&n<0?null:this.substring(e,n)}getNamedGroups(){if(!this.hasMatch)throw new WB("perhaps no match attempted");const t=Object.create(null);for(const e of Object.keys(this.namedGroups))t[e]=this.group(e);return t}groupCount(){return this.patternGroupCount}loadGroup(t){if(!Number.isInteger(t)||t<0||t>this.patternGroupCount)throw new WB(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new WB("perhaps no match attempted");if(0===t||this.hasGroups)return;const e=this.matcherInputLength,n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],e,this.anchorFlag,1+this.patternGroupCount,this.lookbehindState);if(!n[0])throw new WB("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,fB.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,fB.ANCHOR_START)}find(t=null){if(null!==t){if(!Number.isInteger(t)||t<0||t>this.matcherInputLength)throw new WB(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}if(t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1])){const e=(this.matcherInput.isUTF16Encoding()?qB.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):qB.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(t);e<0?t++:t+=7&e}return this.genMatch(t,fB.UNANCHORED)}genMatch(t,e){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,e,1,this.lookbehindState);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=0===this.patternGroupCount,this.anchorFlag=e,!0):(this.hasMatch=!1,!1)}substring(t,e){return this.matcherInput.isUTF8Encoding()?PB.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,e)):this.matcherInput.asCharSequence().substring(t,e).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,e=!1){let n="";const s=this.start(),r=this.end();return this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r,n+=e?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),n}appendReplacementInternalJava(t){let e="",n=0;const s=t.length;let r=0;for(;r<s;){const i=t.codePointAt(r);if(i!==IB.CODES["\\"]){if(i===IB.CODES.$){if(n<r&&(e+=t.substring(n,r)),r+1>=s)throw new WB("Illegal group reference: group index is missing");const i=t.codePointAt(r+1);if(IB.CODES[0]<=i&&i<=IB.CODES[9]){let o=i-IB.CODES[0],a=r+2;for(;a<s;a++){const e=t.codePointAt(a);if(e<IB.CODES[0]||e>IB.CODES[9]||10*o+e-IB.CODES[0]>this.patternGroupCount)break;o=10*o+e-IB.CODES[0]}if(o>this.patternGroupCount)throw new WB(`n > number of groups: ${o}`);const B=this.group(o);null!==B&&(e+=B),r=a,n=r}else{if(i!==IB.CODES["{"])throw new WB("Illegal group reference");{let i=r+2;for(;i<s&&t.codePointAt(i)!==IB.CODES["}"];)i++;if(i>=s)throw new WB("named capture group is missing trailing '}'");const o=t.substring(r+2,i),a=this.group(o);null!==a&&(e+=a),r=i+1,n=r}}continue}r++}else{if(n<r&&(e+=t.substring(n,r)),r++,r>=s)throw new WB("character to be escaped is missing");n=r,r++}}return n<s&&(e+=t.substring(n,s)),e}appendReplacementInternalJs(t){const e=t=>t>=48&&t<=57,n=this.patternGroupCount;let s="",r=0;for(;r<t.length;){const i=t.indexOf("$",r);if(i<0)break;s+=t.substring(r,i),r=i;const o=t.charCodeAt(r+1);if(o===IB.CODES.$)s+="$",r+=2;else if(o===IB.CODES["&"])s+=this.group(0),r+=2;else if(o===IB.CODES["`"])s+=this.substring(0,this.start(0)),r+=2;else if(o===IB.CODES["'"])s+=this.substring(this.end(0),this.matcherInputLength),r+=2;else if(e(o)){let i=1,a=o-48;const B=t.charCodeAt(r+2);if(e(B)&&10*a+B-48<=n&&(i=2,a=10*a+B-48),a>=1&&a<=n){const t=this.group(a);null!==t&&(s+=t)}else s+=t.substring(r,r+1+i);r+=1+i}else if(o===IB.CODES["<"]&&this.hasNamedGroups){const e=t.indexOf(">",r+2);if(e<0)s+="$<",r+=2;else{const n=t.substring(r+2,e);if(Object.prototype.hasOwnProperty.call(this.namedGroups,n)){const t=this.group(n);null!==t&&(s+=t)}r=e+1}}else s+="$",r+=1}return s+t.substring(r)}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,e=!1){return this.replace(t,!0,e)}replaceFirst(t,e=!1){return this.replace(t,!1,e)}replace(e,n=!0,s=!1){let r="";this.reset();const i="function"==typeof e;let o=null;if(i){if(this.groupCount()>=t.MAX_REPLACER_ARGS)throw new WB("Too many capture groups to safely invoke replacer function");o=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(r+=i?this.appendReplacementFunc(e,o):this.appendReplacement(e,s),n););return r+=this.appendTail(),r}appendReplacementFunc(t,e){let n="";const s=this.start(),r=this.end();this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r;const i=this.matchArray();return i.push(s,e),this.hasNamedGroups&&i.push(this.namedGroupsObject()),n+=String(t(...i)),n}matchArray(){const t=[this.group(0)];for(let e=1;e<=this.patternGroupCount;e++){const n=this.group(e);t.push(null===n?void 0:n)}return t}namedGroupsObject(){if(!this.hasNamedGroups)return;const t=this.getNamedGroups();for(const e in t)null===t[e]&&(t[e]=void 0);return t}},tc=class t{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static LB_WRITE=12;static LB_CHECK=13;static isRuneOp(e){return t.RUNE<=e&&e<=t.RUNE_ANY_NOT_NL}static escapeRunes(t){let e='"';for(let n of t)e+=PB.escapeRune(n);return e+='"',e}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=new Int32Array(0),this.next=null}matchRune(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&fB.FOLD_CASE)?xB.equalsIgnoreCase(e,t):t===e}const e=this.runes.length;if(0===e)return!1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return!1;if(t<=this.runes[n+1])return!0}return!1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]}matchRunePos(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&fB.FOLD_CASE)?xB.equalsIgnoreCase(e,t)?0:-1:t===e?0:-1}const e=this.runes.length;if(0===e)return-1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return-1;if(t<=this.runes[n+1])return Math.floor(n/2)}return-1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]?r:-1}toString(){switch(this.op){case t.ALT:return`alt -> ${this.out}, ${this.arg}`;case t.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case t.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case t.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case t.MATCH:return"match"+(0!==this.arg?` ${this.arg}`:"");case t.FAIL:return"fail";case t.NOP:return`nop -> ${this.out}`;case t.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case t.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case t.RUNE:return null===this.runes?"rune <null>":["rune ",t.escapeRunes(this.runes),0!==(this.arg&fB.FOLD_CASE)?"/i":""," -> ",this.out].join("");case t.RUNE1:return`rune1 ${t.escapeRunes(this.runes)} -> ${this.out}`;case t.RUNE_ANY:return`any -> ${this.out}`;case t.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},ec=class t{constructor(t){this.sparse=new Int32Array(t),this.densePcs=new Int32Array(t),this.denseCaps=null,this.size=0,this.ncap=0,this.mainThreads=0}static INITIAL_THREADS=32;init(e){this.ncap=e;const n=Math.min(this.densePcs.length,t.INITIAL_THREADS)*e;(!this.denseCaps||this.denseCaps.length<n)&&(this.denseCaps=new Int32Array(n))}growCaps(t){const e=this.densePcs.length*this.ncap,n=new Int32Array(Math.min(e,Math.max(t,2*this.denseCaps.length)));n.set(this.denseCaps),this.denseCaps=n}contains(t){const e=this.sparse[t];return e<this.size&&this.densePcs[e]===t}isEmpty(){return 0===this.size}add(t){const e=this.size++;return this.sparse[t]=e,this.densePcs[e]=t,e}clear(){this.size=0,this.mainThreads=0}toString(){let t="{";for(let e=0;e<this.size;e++)0!==e&&(t+=", "),t+=this.densePcs[e];return t+="}",t}},nc=class{constructor(t){this.pos=-1,this.pcs=new Int32Array(t.numInst()),this.size=0,this.lbTable=new Int32Array(t.numLb+1)}reset(){this.pos=-1,this.size=0}},sc=class t{static fromRE2(e){const n=new t;return n.prog=e.prog,n.re2=e,n.q0=new ec(n.prog.numInst()),n.q1=new ec(n.prog.numInst()),n.addStack=new Int32Array(2*(n.prog.numInst()+1)),n.matched=!1,n.matchcap=new Int32Array(n.prog.numCap<2?2:n.prog.numCap),n.ncap=0,n}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.addStack=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(t){this.ncap=t,t>this.matchcap.length?this.matchcap=new Int32Array(t).fill(-1):this.matchcap.fill(-1),this.q0.init(t),this.q1.init(t),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return 0===this.ncap?PB.emptyInts():PB.toArray(this.matchcap.subarray(0,this.ncap))}match(t,e,n,s=null){const r=this.re2.cond;if(r===PB.EMPTY_ALL)return!1;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return!1;this.matched=!1,this.matchcap.fill(-1);const i=this.prog.numLb>0,o=e;let a=e,B=!1;i&&(null!==s&&s.pos>=0&&s.pos<=e?(a=s.pos,B=!0):a=0);let c,l=i&&null!==s,u=this.q0,h=this.q1,d=t.step(a),p=d>>3,f=7&d,C=-1,g=0;for(d!==jB.EOF()&&(d=t.step(a+f),C=d>>3,g=7&d),c=0===a?PB.emptyOpContext(-1,p):t.context(a),i&&(B?this.restoreLookbehinds(s,u,c):this.spawnLookbehinds(u,a,c));;){if(0===u.mainThreads){if(0!==(r&PB.EMPTY_BEGIN_TEXT)&&0!==a)break;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==a)break;if(this.matched)break;if(0===this.prog.numLb&&u.isEmpty()&&0!==this.re2.prefix.length&&C!==this.re2.prefixRune&&t.canCheckPrefix()){const e=t.index(this.re2,a);if(e<0)break;a+=e,d=t.step(a),p=d>>3,f=7&d,d=t.step(a+f),C=d>>3,g=7&d,c=t.context(a)}}a>=o&&(l&&(this.saveLookbehinds(s,u,a),l=!1),this.matched||0!==a&&n!==fB.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=a),this.add(u,this.prog.start,a,this.matchcap,0,c)));const e=a+f;if(c=t.context(e),this.step(u,h,a,e,p,c,n,a===t.endPos()),0===f)break;if(0===this.ncap&&this.matched)break;a+=f,p=C,f=g,-1!==p&&(d=t.step(a+f),C=d>>3,g=7&d);const i=u;u=h,h=i}return u.clear(),h.clear(),this.matched}matchSet(t,e,n){const s=this.re2.cond;if(s===PB.EMPTY_ALL)return[];if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return[];let r=this.prog.numLb>0?0:e,i=e,o=this.q0,a=this.q1,B=t.step(r),c=B>>3,l=7&B,u=-1,h=0;B!==jB.EOF()&&(B=t.step(r+l),u=B>>3,h=7&B);let d=0===r?PB.emptyOpContext(-1,c):t.context(r);const p=new Set;for(this.prog.numLb>0&&this.spawnLookbehinds(o,r,d);;){if(0===o.mainThreads){if(0!==(s&PB.EMPTY_BEGIN_TEXT)&&0!==r)break;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==r)break}0!==r&&n!==fB.UNANCHORED||r>=i&&this.add(o,this.prog.start,r,this.matchcap,0,d);const e=r+l;d=t.context(e);for(let s=0;s<o.size;s++){const i=o.densePcs[s],B=this.prog.inst[i],l=s*this.ncap;let u=!1;switch(B.op){case tc.MATCH:if(n===fB.ANCHOR_BOTH&&r!==t.endPos())break;p.add(B.arg);break;case tc.RUNE:u=B.matchRune(c);break;case tc.RUNE1:u=c===B.runes[0];break;case tc.RUNE_ANY:u=!0;break;case tc.RUNE_ANY_NOT_NL:u=10!==c;break;default:continue}u&&this.add(a,B.out,e,o.denseCaps,l,d)}if(o.clear(),0===l)break;r+=l,c=u,l=h,-1!==c&&(B=t.step(r+l),u=B>>3,h=7&B);const f=o;o=a,a=f}return a.clear(),Array.from(p).sort((t,e)=>t-e)}step(t,e,n,s,r,i,o,a){const B=this.re2.longest;for(let c=0;c<t.size;c++){const l=t.densePcs[c],u=c*this.ncap;if(B&&this.matched&&this.ncap>0&&this.matchcap[0]<t.denseCaps[u])continue;const h=this.prog.inst[l];let d=!1;switch(h.op){case tc.MATCH:if(o===fB.ANCHOR_BOTH&&!a)break;if(this.ncap>0&&(!B||!this.matched||this.matchcap[1]<n)){t.denseCaps[u+1]=n;for(let e=0;e<this.ncap;e++)this.matchcap[e]=t.denseCaps[u+e]}B||(t.size=0),this.matched=!0;break;case tc.RUNE:d=h.matchRune(r);break;case tc.RUNE1:d=r===h.runes[0];break;case tc.RUNE_ANY:d=!0;break;case tc.RUNE_ANY_NOT_NL:d=10!==r;break;default:continue}d&&this.add(e,h.out,s,t.denseCaps,u,i)}t.clear()}spawnLookbehinds(t,e,n){for(let s=0;s<this.prog.lbStarts.length;s++)this.add(t,this.prog.lbStarts[s],e,this.matchcap,0,n)}restoreLookbehinds(t,e,n){this.lbTable.set(t.lbTable);for(let s=0;s<t.size;s++)this.add(e,t.pcs[s],t.pos,this.matchcap,0,n)}saveLookbehinds(t,e,n){let s=0;for(let n=0;n<e.size;n++){const r=e.densePcs[n];1===this.prog.lbInst[r]&&tc.isRuneOp(this.prog.inst[r].op)&&(t.pcs[s++]=r)}t.size=s,t.pos=n,t.lbTable.set(this.lbTable)}add(t,e,n,s,r,i){const o=this.addStack;let a=0;for(;;){for(;0!==e&&!t.contains(e);){const B=t.add(e),c=this.prog.inst[e];switch(c.op){case tc.FAIL:e=0;break;case tc.ALT:case tc.ALT_MATCH:o[a++]=c.arg,o[a++]=0,e=c.out;break;case tc.EMPTY_WIDTH:e=0===(c.arg&~i)?c.out:0;break;case tc.NOP:e=c.out;break;case tc.CAPTURE:c.arg<this.ncap&&(o[a++]=-c.arg-1,o[a++]=s[r+c.arg],s[r+c.arg]=n),e=c.out;break;case tc.LB_WRITE:this.lbTable[Math.abs(c.arg)]=n,e=c.out;break;case tc.LB_CHECK:e=c.arg>0?this.lbTable[c.arg]===n?c.out:0:this.lbTable[-c.arg]!==n?c.out:0;break;case tc.MATCH:case tc.RUNE:case tc.RUNE1:case tc.RUNE_ANY:case tc.RUNE_ANY_NOT_NL:if(0===this.prog.lbInst[e]&&t.mainThreads++,this.ncap>0){const e=B*this.ncap;e+this.ncap>t.denseCaps.length&&t.growCaps(e+this.ncap);for(let n=0;n<this.ncap;n++)t.denseCaps[e+n]=s[r+n]}e=0;break;default:throw new XB("unhandled")}}if(0===a)return;a-=2;const B=o[a];B<0?(s[r-B-1]=o[a+1],e=0):e=B}}};const rc=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},ic=(t,e,n,s)=>t.flag===n&&rc(t.nfaStates,e)&&rc(t.matchIDs,s),oc=[];var ac=class{constructor(t,e,n){this.nfaStates=t,this.flag=e,this.isMatch=0!==(e&Bc.FLAG_MATCH),this.matchIDs=n,this.next=null,this.nextAnchored=null}},Bc=class t{static FLAG_EMPTY_MASK=255;static FLAG_MATCH=256;static FLAG_LAST_WORD=512;static FLAG_NEED_SHIFT=16;static STATE_OVERHEAD=150;static ARRAY_OVERHEAD=40;static ELEMENT_SIZE=8;static TABLE_OVERHEAD=48;static PROGRESS_PER_STATE=10;constructor(t,e=8388608){this.prog=t,this.maxMem=e,this.stateCache=new Map,this.stateCount=0,this.startStates=new Map,this.failed=!1;for(let e=0;e<t.numInst();e++){const n=t.getInst(e).op;if(n===tc.LB_WRITE||n===tc.LB_CHECK){this.failed=!0;break}}this.computeRuneClasses(),this.stateBudget=e,this.memBudget=e}computeRuneClasses(){const t=new Set,e=(e,n)=>{t.add(e),t.add(n+1)};for(let t=0;t<this.prog.numInst();t++){const n=this.prog.getInst(t);switch(n.op){case tc.RUNE:case tc.RUNE1:if(1===n.runes.length){if(e(n.runes[0],n.runes[0]),0!==(n.arg&fB.FOLD_CASE))for(let t=xB.simpleFold(n.runes[0]);t!==n.runes[0];t=xB.simpleFold(t))e(t,t)}else for(let t=0;t<n.runes.length;t+=2)e(n.runes[t],n.runes[t+1]);break;case tc.RUNE_ANY_NOT_NL:e(10,10);break;case tc.EMPTY_WIDTH:0!==(n.arg&(PB.EMPTY_BEGIN_LINE|PB.EMPTY_END_LINE))&&e(10,10),0!==(n.arg&(PB.EMPTY_WORD_BOUNDARY|PB.EMPTY_NO_WORD_BOUNDARY))&&(e(48,57),e(65,90),e(95,95),e(97,122))}}t.delete(0),this.classBounds=Int32Array.from(t).sort(),this.numClasses=this.classBounds.length+1;const n=new Int32Array(xB.MAX_LATIN1+1);for(let t=0;t<=xB.MAX_LATIN1;t++)n[t]=this.searchClass(t);this.latin1Class=n}runeClass(t){return t<=xB.MAX_LATIN1?this.latin1Class[t]:this.searchClass(t)}searchClass(t){const e=this.classBounds;let n=0,s=e.length;for(;n<s;){const r=n+s>>1;e[r]<=t?n=r+1:s=r}return n}closure(t,e){const n=new Set,s=Array.from(t);let r=0;for(;s.length>0;){const t=s.pop();if(0===t||n.has(t))continue;n.add(t);const i=this.prog.getInst(t);switch(i.op){case tc.ALT:case tc.ALT_MATCH:s.push(i.out),s.push(i.arg);break;case tc.NOP:case tc.CAPTURE:s.push(i.out);break;case tc.EMPTY_WIDTH:r|=i.arg,0===(i.arg&~e)&&s.push(i.out)}}return{pcs:Array.from(n).sort((t,e)=>t-e),needflags:r}}getState(e,n,s){const r=((t,e,n)=>{let s=-2128831035;for(let e=0;e<t.length;e++)s^=t[e],s=Math.imul(s,16777619);s^=e,s=Math.imul(s,16777619);for(let t=0;t<n.length;t++)s^=n[t],s=Math.imul(s,16777619);return s})(e,n,s),i=this.stateCache.get(r);if(i instanceof ac){if(ic(i,e,n,s))return i}else if(void 0!==i)for(let t=0;t<i.length;t++)if(ic(i[t],e,n,s))return i[t];const o=t.stateCost(e,s);if(this.memBudget<o)return null;this.memBudget-=o;const a=new ac(e,n,s);return void 0===i?this.stateCache.set(r,a):i instanceof ac?this.stateCache.set(r,[i,a]):i.push(a),this.stateCount++,a}static stateCost(e,n){const s=0===n.length?0:t.ARRAY_OVERHEAD+t.ELEMENT_SIZE*n.length;return t.STATE_OVERHEAD+t.ELEMENT_SIZE*e.length+s}*cachedStates(){for(const t of this.stateCache.values())t instanceof ac?yield t:yield*t}makeState(e,n,s){const r=this.closure(e,n&t.FLAG_EMPTY_MASK);let i=n;return 0===r.needflags&&(i&=t.FLAG_MATCH),i|=r.needflags<<t.FLAG_NEED_SHIFT,this.getState(r.pcs,i,s)}allocTable(e,n){const s=this.numClasses+1,r=t.TABLE_OVERHEAD+t.ELEMENT_SIZE*s;if(this.memBudget<r)return null;this.memBudget-=r;const i=new Array(s).fill(null);return n===fB.UNANCHORED?e.next=i:e.nextAnchored=i,i}clearCache(){this.stateCache.clear(),this.stateCount=0,this.startStates.clear(),this.memBudget=this.stateBudget}resetCache(t){return this.clearCache(),this.getState(t.nfaStates,t.flag,t.matchIDs)}step(e,n,s,r){let i=r===fB.UNANCHORED?e.next:e.nextAnchored;if(null!==i){const t=i[n];if(null!==t)return t}else if(i=this.allocTable(e,r),null===i)return null;const o=e.flag>>>t.FLAG_NEED_SHIFT,a=e.flag&t.FLAG_EMPTY_MASK;let B=a,c=0;10===s&&(B|=PB.EMPTY_END_LINE,c|=PB.EMPTY_BEGIN_LINE),-1===s&&(B|=PB.EMPTY_END_LINE|PB.EMPTY_END_TEXT);const l=0!==(e.flag&t.FLAG_LAST_WORD),u=-1!==s&&PB.isWordRune(s);B|=u===l?PB.EMPTY_NO_WORD_BOUNDARY:PB.EMPTY_WORD_BOUNDARY;let h=e.nfaStates;0!==(B&~a&o)&&(h=this.closure(h,B).pcs);const d=[];let p=!1,f=oc;for(let t=0;t<h.length;t++){const e=this.prog.getInst(h[t]);e.op===tc.MATCH?(p||(p=!0,f=[]),f.push(e.arg)):-1!==s&&tc.isRuneOp(e.op)&&e.matchRune(s)&&d.push(e.out)}f.length>1&&f.sort((t,e)=>t-e),r===fB.UNANCHORED&&-1!==s&&d.push(this.prog.start);let C=c;p&&(C|=t.FLAG_MATCH),u&&(C|=t.FLAG_LAST_WORD);const g=this.makeState(d,C,f);return null===g?null:(i[n]=g,g)}start(e,n){const s=e.context(n);let r;if(0!==(s&PB.EMPTY_BEGIN_TEXT))r=PB.EMPTY_BEGIN_TEXT|PB.EMPTY_BEGIN_LINE;else if(0!==(s&PB.EMPTY_BEGIN_LINE))r=PB.EMPTY_BEGIN_LINE;else{const i=e.step(n),o=i>=0&&PB.isWordRune(i>>3);r=0!==(s&PB.EMPTY_WORD_BOUNDARY)!==o?t.FLAG_LAST_WORD:0}let i=this.startStates.get(r);if(void 0===i){if(i=this.makeState([this.prog.start],r,oc),null===i&&(this.clearCache(),i=this.makeState([this.prog.start],r,oc),null===i))return null;this.startStates.set(r,i)}return i}stepOrReset(e,n,s,r,i,o){let a=this.step(e,n,s,r);if(null!==a)return a;if(o.resetPos>=0&&i-o.resetPos<t.PROGRESS_PER_STATE*this.stateCount)return null;o.resetPos=i;const B=this.resetCache(e);return null===B?null:(a=this.step(B,n,s,r),a)}run(t,e,n,s,r){const i=t.endPos(),o=this.latin1Class,a=n===fB.UNANCHORED,B={resetPos:-1};let c=e;for(;c<i;){const e=t.step(c),i=e>>3,l=7&e;if(0===l)break;const u=i<=xB.MAX_LATIN1?o[i]:this.runeClass(i);let h=a&&null!==s.next?s.next[u]:null;if(null===h&&(h=this.stepOrReset(s,u,i,n,c,B),null===h))return null;if((s=h).isMatch&&r(s,!1))return!0;if(!a&&0===s.nfaStates.length)return!1;c+=l}return null===(s=this.stepOrReset(s,this.numClasses,-1,n,c,B))?null:s.isMatch&&r(s,!0)}match(t,e,n){if(this.failed)return null;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return!1;const s=this.start(t,e);return null===s?null:this.run(t,e,n,s,(t,e)=>n!==fB.ANCHOR_BOTH||e)}matchSet(t,e,n){if(this.failed)return null;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return[];const s=this.start(t,e);if(null===s)return null;const r=new Set;return null===this.run(t,e,n,s,(t,e)=>{if(n!==fB.ANCHOR_BOTH||e)for(let e=0;e<t.matchIDs.length;e++)r.add(t.matchIDs[e]);return!1})?null:Array.from(r).sort((t,e)=>t-e)}};var cc=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(256),this.jobArg=new Uint8Array(256),this.jobPos=new Int32Array(256),this.jobLen=0,this.visited=new Uint32Array(0)}reset(t,e,n){this.end=e,this.jobLen=0,this.ncap=n;const s=t.numInst()*(e+1)+32-1>>>5;this.visited.length<s?this.visited=new Uint32Array(s):this.visited.fill(0,0,s),this.cap.length<n?this.cap=new Int32Array(n).fill(-1):this.cap.fill(-1,0,n),this.matchcap.length<n?this.matchcap=new Int32Array(n).fill(-1):this.matchcap.fill(-1,0,n)}shouldVisit(t,e){const n=t*(this.end+1)+e,s=n>>>5,r=1<<(31&n);return 0===(this.visited[s]&r)&&(this.visited[s]|=r,!0)}push(t,e,n,s){if(t.prog.getInst(e).op!==tc.FAIL&&(s||this.shouldVisit(e,n))){if(this.jobLen>=this.jobPc.length){const t=2*this.jobPc.length,e=new Int32Array(t);e.set(this.jobPc),this.jobPc=e;const n=new Uint8Array(t);n.set(this.jobArg),this.jobArg=n;const s=new Int32Array(t);s.set(this.jobPos),this.jobPos=s}this.jobPc[this.jobLen]=e,this.jobArg[this.jobLen]=s?1:0,this.jobPos[this.jobLen]=n,this.jobLen++}}tryBacktrack(t,e,n,s,r){const i=t.longest;for(this.push(t,n,s,!1);this.jobLen>0;){this.jobLen--;let n=this.jobPc[this.jobLen],s=1===this.jobArg[this.jobLen],o=this.jobPos[this.jobLen],a=!0;for(;a||this.shouldVisit(n,o);){a=!1;const B=t.prog.getInst(n);switch(B.op){case tc.FAIL:break;case tc.ALT:if(s){s=!1,n=B.arg;continue}this.push(t,n,o,!0),n=B.out;continue;case tc.ALT_MATCH:{const e=t.prog.getInst(B.out);if(tc.isRuneOp(e.op)){this.push(t,B.arg,o,!1),n=B.arg,o=this.end;continue}this.push(t,B.out,this.end,!1),n=B.out;continue}case tc.RUNE:{const t=e.step(o);if(t===jB.EOF())break;if(!B.matchRune(t>>3))break;o+=7&t,n=B.out;continue}case tc.RUNE1:{const t=e.step(o);if(t===jB.EOF())break;if(t>>3!==B.runes[0])break;o+=7&t,n=B.out;continue}case tc.RUNE_ANY_NOT_NL:{const t=e.step(o);if(t===jB.EOF())break;if(t>>3==10)break;o+=7&t,n=B.out;continue}case tc.RUNE_ANY:{const t=e.step(o);if(t===jB.EOF())break;o+=7&t,n=B.out;continue}case tc.CAPTURE:if(s){this.cap[B.arg]=o;break}B.arg<this.ncap&&(this.push(t,n,this.cap[B.arg],!0),this.cap[B.arg]=o),n=B.out;continue;case tc.EMPTY_WIDTH:{const t=e.context(o);if(0!==(B.arg&~t))break;n=B.out;continue}case tc.NOP:n=B.out;continue;case tc.MATCH:{if(r===fB.ANCHOR_BOTH&&o!==this.end)break;if(0===this.ncap)return!0;this.ncap>1&&(this.cap[1]=o);const t=this.matchcap[1];if((-1===t||i&&o>0&&o>t)&&this.matchcap.set(this.cap),!i)return!0;if(o===this.end)return!0;break}case tc.LB_WRITE:case tc.LB_CHECK:throw new XB("Backtracker cannot evaluate Lookbehind instructions");default:throw new XB("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}};const lc=[];var uc=class t{static shouldBacktrack(t){return t.numInst()<=500}static maxBitStateLen(e){return t.shouldBacktrack(e)?Math.floor(262144/e.numInst()):0}static execute(t,e,n,s,r){const i=t.cond;if(i===PB.EMPTY_ALL)return null;if((s===fB.ANCHOR_START||s===fB.ANCHOR_BOTH)&&0!==n)return null;if(0!==(i&PB.EMPTY_BEGIN_TEXT)&&0!==n)return null;const o=lc.length>0?lc.pop():new cc,a=e.endPos();o.reset(t.prog,a,r);let B=!1;if(0!==(i&PB.EMPTY_BEGIN_TEXT)||s===fB.ANCHOR_START||s===fB.ANCHOR_BOTH)o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)&&(B=!0);else{let r=-1;for(;n<=a&&0!==r;n+=r){if(t.prefix.length>0){const s=e.index(t,n);if(s<0)break;n+=s}if(o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)){B=!0;break}const i=e.step(n);r=i===jB.EOF()?0:7&i}}if(!B)return lc.push(o),null;const c=0===r?[]:PB.toArray(o.matchcap.subarray(0,r));return lc.push(o),c}},hc=class{constructor(t){this.sparse=new Uint32Array(t),this.dense=new Uint32Array(t),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(t){return t<this.sparse.length&&this.sparse[t]<this.size&&this.dense[this.sparse[t]]===t}insert(t){this.contains(t)||this.insertNew(t)}insertNew(t){t>=this.sparse.length||(this.sparse[t]=this.size,this.dense[this.size]=t,this.size++)}};var dc=class{constructor(t){this.start=t.start,this.numCap=t.numCap,this.inst=new Array(t.inst.length);for(let e=0;e<t.inst.length;e++){const n=t.inst[e],s=new tc(n.op);s.out=n.out,s.arg=n.arg,s.runes=n.runes?new Int32Array(n.runes):new Int32Array(0),s.next=null,this.inst[e]=s}}};var pc=class t{static compile(t){if(0===t.start)return null;if(t.numLb>0)return null;const e=t.inst[t.start];if(e.op!==tc.EMPTY_WIDTH||0===(e.arg&PB.EMPTY_BEGIN_TEXT))return null;let n=!1;for(let e=0;e<t.inst.length;e++)if(t.inst[e].op===tc.ALT||t.inst[e].op===tc.ALT_MATCH){n=!0;break}for(let e=0;e<t.inst.length;e++){const s=t.inst[e],r=t.inst[s.out].op;switch(s.op){case tc.ALT:case tc.ALT_MATCH:if(r===tc.MATCH||t.inst[s.arg].op===tc.MATCH)return null;break;case tc.EMPTY_WIDTH:if(r===tc.MATCH){if((s.arg&PB.EMPTY_END_TEXT)===PB.EMPTY_END_TEXT)continue;return null}break;default:if(r===tc.MATCH&&n)return null}}let s=(t=>{const e=new dc(t);for(let t=0;t<e.inst.length;t++){const n=e.inst[t];if(n.op!==tc.ALT&&n.op!==tc.ALT_MATCH)continue;let s="out",r="arg",i=e.inst[n[r]];if(i.op!==tc.ALT&&i.op!==tc.ALT_MATCH&&(s="arg",r="out",i=e.inst[n[r]],i.op!==tc.ALT&&i.op!==tc.ALT_MATCH))continue;const o=e.inst[n[s]];if(o.op===tc.ALT||o.op===tc.ALT_MATCH)continue;let a="out",B="arg",c=!1;i.out===t?c=!0:i.arg===t&&(c=!0,a="arg",B="out"),c&&(i[a]=n[s]),n[s]===i[a]&&(n[r]=i[B])}return e})(t);return s=(t=>{if(t.inst.length>=1e3)return null;const e=new hc(t.inst.length),n=new hc(t.inst.length),s=new Array(t.inst.length),r=new Array(t.inst.length).fill(!1),i=o=>{let a=!0;const B=t.inst[o];if(n.contains(o))return!0;switch(n.insert(o),B.op){case tc.ALT:case tc.ALT_MATCH:{a=i(B.out)&&i(B.arg);let t=r[B.out],e=r[B.arg];if(t&&e)return!1;if(e){const n=B.out;B.out=B.arg,B.arg=n;const s=t;t=e,e=s}t&&(r[o]=!0,B.op=tc.ALT_MATCH);const n=((t,e,n,s)=>{const r=t.length,i=e.length;let o=0,a=0;const B=[],c=[];let l=!0,u=-1;const h=r=>{const i=r?t:e,l=r?o:a,h=r?n:s;return!(u>0&&i[l]<=B[u]||(B.push(i[l],i[l+1]),r?o+=2:a+=2,u+=2,c.push(h),0))};for(;o<r||a<i;)if(l=a>=i?h(!0):o>=r||e[a]<t[o]?h(!1):h(!0),!l)return null;return{merged:B,next:c}})(s[B.out]||[],s[B.arg]||[],B.out,B.arg);if(!n)return!1;s[o]=new Int32Array(n.merged),B.next=new Uint32Array(n.next);break}case tc.CAPTURE:case tc.EMPTY_WIDTH:case tc.NOP:a=i(B.out),r[o]=r[B.out],s[o]=s[B.out]?new Int32Array(s[B.out]):new Int32Array(0),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out);break;case tc.MATCH:case tc.FAIL:r[o]=B.op===tc.MATCH;break;case tc.RUNE:{if(r[o]=!1,B.next&&B.next.length>0)break;if(e.insert(B.out),!B.runes||0===B.runes.length){s[o]=new Int32Array(0),B.next=new Uint32Array([B.out]);break}let t=[];if(1===B.runes.length&&0!==(B.arg&fB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=xB.simpleFold(e);n!==e;n=xB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else for(let e=0;e<B.runes.length;e++)t.push(B.runes[e]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=tc.RUNE;break}case tc.RUNE1:{if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out);let t=[];if(0!==(B.arg&fB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=xB.simpleFold(e);n!==e;n=xB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else t.push(B.runes[0],B.runes[0]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=tc.RUNE;break}case tc.RUNE_ANY:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,xB.MAX_RUNE]),B.next=new Uint32Array([B.out]);break;case tc.RUNE_ANY_NOT_NL:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,9,11,xB.MAX_RUNE]),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out)}return a};for(e.clear(),e.insert(t.start);!e.empty();)if(n.clear(),!i(e.next()))return null;for(let e=0;e<t.inst.length;e++)s[e]&&(t.inst[e].runes=s[e]);return t})(s),null!==s&&((t,e)=>{for(let n=0;n<e.inst.length;n++){const s=e.inst[n];switch(s.op){case tc.ALT:case tc.ALT_MATCH:case tc.RUNE:break;case tc.CAPTURE:case tc.EMPTY_WIDTH:case tc.NOP:case tc.MATCH:case tc.FAIL:t.inst[n].next=null;break;case tc.RUNE1:case tc.RUNE_ANY:case tc.RUNE_ANY_NOT_NL:t.inst[n].next=null,t.inst[n].op=s.op,t.inst[n].runes=s.runes?new Int32Array(s.runes):new Int32Array(0)}}})(s,t),s}static next(t,e){const n=t.matchRunePos(e);return n>=0?t.next[n]:t.op===tc.ALT_MATCH?t.out:0}static execute(e,n,s,r,i){const o=e.onepass;if(!o)return null;const a=new Int32Array(i).fill(-1);let B=!1,c=n.step(s),l=c>>3,u=7&c,h=jB.EOF(),d=-1,p=0;c!==jB.EOF()&&(h=n.step(s+u),h!==jB.EOF()&&(d=h>>3,p=7&h));let f,C=0===s?PB.emptyOpContext(-1,l):n.context(s),g=o.start;for(;;){switch(f=o.inst[g],g=f.out,f.op){case tc.MATCH:return r===fB.ANCHOR_BOTH&&s!==n.endPos()?null:(B=!0,a.length>0&&(a[0]=0,a[1]=s),0===i?[]:PB.toArray(a));case tc.RUNE:if(!f.matchRune(l))return null;break;case tc.RUNE1:if(l!==f.runes[0])return null;break;case tc.RUNE_ANY:break;case tc.RUNE_ANY_NOT_NL:if(10===l)return null;break;case tc.ALT:case tc.ALT_MATCH:g=t.next(f,l);continue;case tc.FAIL:return null;case tc.NOP:continue;case tc.EMPTY_WIDTH:if(0!==(f.arg&~C))return null;continue;case tc.CAPTURE:f.arg<a.length&&(a[f.arg]=s);continue;default:throw new XB("bad inst")}if(0===u)break;C=PB.emptyOpContext(l,d),s+=u,l=d,u=p,-1!==l&&(h=n.step(s+u),h!==jB.EOF()?(d=h>>3,p=7&h):(d=-1,p=0))}return B?0===i?[]:PB.toArray(a):null}},fc=class t{static Op=MB(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(e){return e>=t.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===IB.CODES["-"]?"\\":""}static fromRegexp(e){const n=new t(e.op);return n.flags=e.flags,n.subs=e.subs,n.runes=e.runes,n.cap=e.cap,n.min=e.min,n.max=e.max,n.name=e.name,n.namedGroups=e.namedGroups,n.lb=e.lb,n}constructor(e){this.op=e,this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case t.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case t.Op.EMPTY_MATCH:e+="(?:)";break;case t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:case t.Op.REPEAT:{const n=this.subs[0];switch(n.op>t.Op.CAPTURE||n.op===t.Op.LITERAL&&n.runes.length>1?e+=`(?:${n.appendTo()})`:e+=n.appendTo(),this.op){case t.Op.STAR:e+="*";break;case t.Op.PLUS:e+="+";break;case t.Op.QUEST:e+="?";break;case t.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}"}0!==(this.flags&fB.NON_GREEDY)&&(e+="?");break}case t.Op.CONCAT:for(let n of this.subs)n.op===t.Op.ALTERNATE?e+=`(?:${n.appendTo()})`:e+=n.appendTo();break;case t.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case t.Op.LITERAL:0!==(this.flags&fB.FOLD_CASE)&&(e+="(?i:");for(let t of this.runes)e+=PB.escapeRune(t);0!==(this.flags&fB.FOLD_CASE)&&(e+=")");break;case t.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case t.Op.ANY_CHAR:e+="(?s:.)";break;case t.Op.PLB:e+=`(?<=${this.subs[0].appendTo()})`;break;case t.Op.NLB:e+=`(?<!${this.subs[0].appendTo()})`;break;case t.Op.CAPTURE:null===this.name||0===this.name.length?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==t.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case t.Op.BEGIN_TEXT:e+="\\A";break;case t.Op.END_TEXT:0!==(this.flags&fB.WAS_DOLLAR)?e+="(?-m:$)":e+="\\z";break;case t.Op.BEGIN_LINE:e+="^";break;case t.Op.END_LINE:e+="$";break;case t.Op.WORD_BOUNDARY:e+="\\b";break;case t.Op.NO_WORD_BOUNDARY:e+="\\B";break;case t.Op.CHAR_CLASS:if(this.runes.length%2!=0){e+="[invalid char class]";break}if(e+="[",0===this.runes.length)e+="^\\x00-\\x{10FFFF}";else if(0===this.runes[0]&&this.runes[this.runes.length-1]===xB.MAX_RUNE){e+="^";for(let n=1;n<this.runes.length-1;n+=2){const s=this.runes[n]+1,r=this.runes[n+1]-1;e+=t.quoteIfHyphen(s),e+=PB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=PB.escapeRune(r))}}else for(let n=0;n<this.runes.length;n+=2){const s=this.runes[n],r=this.runes[n+1];e+=t.quoteIfHyphen(s),e+=PB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=PB.escapeRune(r))}e+="]";break;default:e+=this.op}return e}maxCap(){let e=0;if(this.op===t.Op.CAPTURE&&(e=this.cap),null!==this.subs)for(let t of this.subs){const n=t.maxCap();e<n&&(e=n)}return e}equals(e){if(!(null!==e&&e instanceof t))return!1;if(this.op!==e.op)return!1;switch(this.op){case t.Op.END_TEXT:if((this.flags&fB.WAS_DOLLAR)!==(e.flags&fB.WAS_DOLLAR))return!1;break;case t.Op.LITERAL:case t.Op.CHAR_CLASS:if((this.flags&fB.FOLD_CASE)!==(e.flags&fB.FOLD_CASE))return!1;if(null===this.runes&&null===e.runes)break;if(null===this.runes||null===e.runes)return!1;if(this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break;case t.Op.ALTERNATE:case t.Op.CONCAT:if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break;case t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:if((this.flags&fB.NON_GREEDY)!==(e.flags&fB.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case t.Op.REPEAT:if((this.flags&fB.NON_GREEDY)!==(e.flags&fB.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case t.Op.CAPTURE:if(this.cap!==e.cap||(null===this.name?null!==e.name:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1;break;case t.Op.PLB:case t.Op.NLB:if(this.lb!==e.lb||!this.subs[0].equals(e.subs[0]))return!1}return!0}},Cc=class{static walk(t,e){const n=[];let s,r=t;for(;;){if(0===r.subs.length)s=e.leaf(r);else{const t=e.enter(r);if(void 0===t.result){n.push({re:r,state:t,i:0}),r=r.subs[0];continue}s=t.result}for(;;){if(0===n.length)return s;const t=n[n.length-1];if(e.child(t.re,t.state,s,t.i),t.i++,void 0===t.state.result&&t.i<t.re.subs.length){r=t.re.subs[t.i];break}n.pop(),s=void 0!==t.state.result?t.state.result:e.leave(t.re,t.state)}}}},gc=class{constructor(t,e){const n=new Map,s=[0],r=[0],i=[0],o=[0];for(const a of t){let t=0;for(let B=0;B<a.length;B++){const c=t*e+a[B];let l=n.get(c);void 0===l&&(l=s.length,n.set(c,l),s.push(t),r.push(a[B]),i.push(i[t]+1),o.push(0)),t=l}o[t]=1}const a=s.length,B=new Int32Array(a-1);for(let t=1;t<a;t++)B[t-1]=t;B.sort((t,e)=>s[t]-s[e]||r[t]-r[e]);const c=new Int32Array(a+1);for(let t=1;t<a;t++)c[s[t]+1]++;for(let t=0;t<a;t++)c[t+1]+=c[t];const l=new Int32Array(a-1);for(let t=0;t<B.length;t++)l[t]=r[B[t]];this.childStart=c,this.childUnit=l,this.childNode=B;const u=new Int32Array(a);for(let t=0;t<a;t++)u[t]=t;u.sort((t,e)=>i[t]-i[e]);const h=new Int32Array(a),d=Uint8Array.from(o);for(let t=1;t<a;t++){const e=u[t],n=s[e];if(0!==n){let t=h[n],s=this.next(t,r[e]);for(;s<0&&0!==t;)t=h[t],s=this.next(t,r[e]);h[e]=s>=0?s:0}d[e]|=d[h[e]]}this.fail=h,this.match=d}next(t,e){let n=this.childStart[t],s=this.childStart[t+1];const r=this.childUnit;for(;n<s;){const t=n+s>>1,i=r[t];if(i===e)return this.childNode[t];i<e?n=t+1:s=t}return-1}advance(t,e){for(;;){const n=this.next(t,e);if(n>=0)return n;if(0===t)return 0;t=this.fail[t]}}searchUTF16(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t.charCodeAt(r)),1===this.match[s])return!0;return!1}searchUTF8(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t[r]),1===this.match[s])return!0;return!1}},mc=class t{static Type={NONE:0,EXACT:1,AND:2,OR:3};static MAX_SCANS=32;static MAX_AC_UNITS=1<<18;constructor(e){this.type=e,this.subs=[],this.str="",this.bytes=null,this.cost=e===t.Type.EXACT?1:0,this.allExact=!1,this.ac16=null,this.ac8=null}automaton16(){if(null===this.ac16){const t=this.subs.map(t=>{const e=new Array(t.str.length);for(let n=0;n<t.str.length;n++)e[n]=t.str.charCodeAt(n);return e});this.ac16=new gc(t,65536)}return this.ac16}automaton8(){return null===this.ac8&&(this.ac8=new gc(this.subs.map(t=>t.bytes),256)),this.ac8}eval(e,n){switch(this.type){case t.Type.NONE:return!0;case t.Type.EXACT:return e.hasString(this,n);case t.Type.AND:for(let t=0;t<this.subs.length;t++)if(!this.subs[t].eval(e,n))return!1;return!0;case t.Type.OR:if(this.allExact)return e.hasAnyString(this,n);for(let t=0;t<this.subs.length;t++)if(this.subs[t].eval(e,n))return!0;return!1;default:return!0}}},wc=class t{static build(e){return e?Cc.walk(e,t.WALKER):new mc(mc.Type.NONE)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s)=>t.child(e,n,s),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op!==fc.Op.LITERAL)return new mc(mc.Type.NONE);if(0===t.runes.length||0!==(t.flags&fB.FOLD_CASE))return new mc(mc.Type.NONE);let e="";for(let n=0;n<t.runes.length;n++){if(xB.isUnsearchable(t.runes[n]))return new mc(mc.Type.NONE);e+=String.fromCodePoint(t.runes[n])}const n=new mc(mc.Type.EXACT);return n.str=e,n.bytes=PB.stringToUtf8ByteArray(n.str),n}static enter(t){switch(t.op){case fc.Op.CAPTURE:case fc.Op.PLUS:return{sub:null};case fc.Op.REPEAT:return t.min>=1?{sub:null}:{result:new mc(mc.Type.NONE)};case fc.Op.CONCAT:return{pf:new mc(mc.Type.AND),subs:[]};case fc.Op.ALTERNATE:return{pf:new mc(mc.Type.OR),subs:[]};default:return{result:new mc(mc.Type.NONE)}}}static child(t,e,n){if(void 0!==e.subs)if(e.pf.type!==mc.Type.AND)if(n.type!==mc.Type.NONE)if(n.type!==mc.Type.OR)e.subs.push(n);else for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);else e.result=new mc(mc.Type.NONE);else{if(n.type===mc.Type.NONE)return;if(n.type===mc.Type.AND){for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}e.subs.push(n)}else e.sub=n}static leave(t,e){if(void 0===e.subs)return e.sub;const n=e.pf,s=new Set,r=[];for(const t of e.subs){if(t.type===mc.Type.EXACT){if(s.has(t.str))continue;s.add(t.str)}r.push(t)}if(n.type===mc.Type.AND){const t=[];let e=0;for(const n of r)e+n.cost>mc.MAX_SCANS||(t.push(n),e+=n.cost);return 0===t.length?new mc(mc.Type.NONE):1===t.length?t[0]:(n.subs=t,n.cost=e,n)}if(0===r.length)return new mc(mc.Type.NONE);if(1===r.length)return r[0];n.subs=r;let i=!0,o=0,a=0;for(const t of r)t.type!==mc.Type.EXACT?i=!1:a+=t.bytes.length,o+=t.cost;return i?a>mc.MAX_AC_UNITS?new mc(mc.Type.NONE):(n.allExact=!0,n.cost=1,n):o>mc.MAX_SCANS?new mc(mc.Type.NONE):(n.cost=o,n)}},yc=class{constructor(t=0,e=0){this.head=t,this.tail=e}},Ec=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0,this.lbInst=null}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new tc(t))}markLookbehindInsts(){const t=new Uint8Array(this.inst.length),e=this.lbStarts.slice();for(;e.length>0;){const n=e.pop();if(0===n||1===t[n])continue;t[n]=1;const s=this.inst[n];switch(s.op){case tc.ALT:case tc.ALT_MATCH:e.push(s.out,s.arg);break;case tc.MATCH:case tc.FAIL:break;default:e.push(s.out)}}this.lbInst=t}skipNop(t){let e=this.inst[t];for(;e.op===tc.NOP||e.op===tc.CAPTURE;)e=this.inst[t],t=e.out;return e}prefix(){let t="",e=this.skipNop(this.start);if(!tc.isRuneOp(e.op)||1!==e.runes.length)return[e.op===tc.MATCH,t];for(;tc.isRuneOp(e.op)&&1===e.runes.length&&0===(e.arg&fB.FOLD_CASE)&&!xB.isUnsearchable(e.runes[0]);)t+=String.fromCodePoint(e.runes[0]),e=this.skipNop(e.out);return[e.op===tc.MATCH,t]}startCond(){let t=0,e=this.start;t:for(;;){const n=this.inst[e];switch(n.op){case tc.EMPTY_WIDTH:t|=n.arg;break;case tc.FAIL:return-1;case tc.CAPTURE:case tc.NOP:break;default:break t}e=n.out}return t}patch(t,e){let n=t.head;for(;0!==n;){const t=this.inst[n>>1];1&n?(n=t.arg,t.arg=e):(n=t.out,t.out=e)}}append(t,e){if(0===t.head)return e;if(0===e.head)return t;const n=this.inst[t.tail>>1];return 1&t.tail?n.arg=e.head:n.out=e.head,new yc(t.head,e.tail)}toString(){let t="";for(let e=0;e<this.inst.length;e++){const n=t.length;t+=e,e===this.start&&(t+="*"),t+=" ".substring(t.length-n),t+=this.inst[e],t+="\n"}return t}};const Dc=new Int32Array([0,IB.CODES["\n"]-1,IB.CODES["\n"]+1,xB.MAX_RUNE]),_c=new Int32Array([0,xB.MAX_RUNE]);var bc=class{constructor(t=0,e=new yc,n=!1){this.i=t,this.out=e,this.nullable=n}},vc=class t{static compileRegexp(e){const n=new t,s=n.compile(e);return n.prog.patch(s.out,n.newInst(tc.MATCH).i),n.prog.start=s.i,n.prog.markLookbehindInsts(),n.prog}static compileSet(e){const n=new t;if(0===e.length)return n.prog.start=n.newInst(tc.FAIL).i,n.prog.markLookbehindInsts(),n.prog;let s=[];for(let t=0;t<e.length;t++){n.lbOffset=n.prog.numLb;const r=n.compile(e[t]),i=n.newInst(tc.MATCH);n.prog.getInst(i.i).arg=t,n.prog.patch(r.out,i.i),s.push(r.i)}let r=s[0];for(let t=1;t<s.length;t++){const e=n.newInst(tc.ALT),i=n.prog.getInst(e.i);i.out=r,i.arg=s[t],r=e.i}return n.prog.start=r,n.prog.markLookbehindInsts(),n.prog}constructor(){this.prog=new Ec,this.newInst(tc.FAIL),this.lbOffset=0,this.runeCache=new Map,this.walker={leaf:t=>this.leaf(t),enter:t=>this.enter(t),child:(t,e,n)=>this.child(t,e,n),leave:(t,e)=>this.leave(t,e)}}newInst(t){return this.prog.addInst(t),new bc(this.prog.numInst()-1,new yc,!0)}nop(){const t=this.newInst(tc.NOP);return t.out=new yc(t.i<<1,t.i<<1),t}fail(){return new bc}cap(t){const e=this.newInst(tc.CAPTURE);return e.out=new yc(e.i<<1,e.i<<1),this.prog.getInst(e.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),e}cat(t,e){return 0===t.i||0===e.i?(this.prog.patch(t.out,0),this.prog.patch(e.out,0),this.fail()):(this.prog.patch(t.out,e.i),new bc(t.i,e.out,t.nullable&&e.nullable))}alt(t,e){if(0===t.i)return e;if(0===e.i)return t;const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return s.out=t.i,s.arg=e.i,n.out=this.prog.append(t.out,e.out),n.nullable=t.nullable||e.nullable,n}loop(t,e){const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new yc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new yc(n.i<<1|1,n.i<<1|1)),this.prog.patch(t.out,n.i),n}quest(t,e){if(0===t.i)return this.nop();const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new yc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new yc(n.i<<1|1,n.i<<1|1)),n.out=this.prog.append(n.out,t.out),n}star(t,e){return 0===t.i?this.nop():t.nullable?this.quest(this.plus(t,e),e):this.loop(t,e)}plus(t,e){return 0===t.i?this.fail():new bc(t.i,this.loop(t,e).out,t.nullable)}empty(t){const e=this.newInst(tc.EMPTY_WIDTH);return this.prog.getInst(e.i).arg=t,e.out=new yc(e.i<<1,e.i<<1),e}rune(t,e){const n=this.newInst(tc.RUNE);n.nullable=!1;const s=this.prog.getInst(n.i);return s.runes=t,e&=fB.FOLD_CASE,1===t.length&&xB.simpleFold(t[0])!==t[0]||(e&=-2),s.arg=e,n.out=new yc(n.i<<1,n.i<<1),0===(e&fB.FOLD_CASE)&&1===t.length||2===t.length&&t[0]===t[1]?s.op=tc.RUNE1:2===t.length&&0===t[0]&&t[1]===xB.MAX_RUNE?s.op=tc.RUNE_ANY:4===t.length&&0===t[0]&&t[1]===IB.CODES["\n"]-1&&t[2]===IB.CODES["\n"]+1&&t[3]===xB.MAX_RUNE&&(s.op=tc.RUNE_ANY_NOT_NL),n}lookBehind(t,e){const n=Math.sign(e)*(Math.abs(e)+this.lbOffset),s=this.newInst(tc.LB_WRITE);this.prog.getInst(s.i).arg=n;const r=this.rune(_c,0),i=this.star(r,!0),o=this.cat(i,t);this.prog.patch(o.out,s.i);const a=this.newInst(tc.LB_CHECK);return this.prog.getInst(a.i).arg=n,this.prog.lbStarts.push(o.i),Math.abs(n)>this.prog.numLb&&(this.prog.numLb=Math.abs(n)),a.out=new yc(a.i<<1,a.i<<1),a}compile(t){return Cc.walk(t,this.walker)}leaf(t){switch(t.op){case fc.Op.NO_MATCH:return this.fail();case fc.Op.EMPTY_MATCH:return this.nop();case fc.Op.LITERAL:{if(0===t.runes.length)return this.nop();let e=null;for(let n of t.runes){let s=this.runeCache.get(n);void 0===s&&(s=new Int32Array([n]),this.runeCache.set(n,s));const r=this.rune(s,t.flags);e=null===e?r:this.cat(e,r)}return e}case fc.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case fc.Op.ANY_CHAR_NOT_NL:return this.rune(Dc,0);case fc.Op.ANY_CHAR:return this.rune(_c,0);case fc.Op.BEGIN_LINE:return this.empty(PB.EMPTY_BEGIN_LINE);case fc.Op.END_LINE:return this.empty(PB.EMPTY_END_LINE);case fc.Op.BEGIN_TEXT:return this.empty(PB.EMPTY_BEGIN_TEXT);case fc.Op.END_TEXT:return this.empty(PB.EMPTY_END_TEXT);case fc.Op.WORD_BOUNDARY:return this.empty(PB.EMPTY_WORD_BOUNDARY);case fc.Op.NO_WORD_BOUNDARY:return this.empty(PB.EMPTY_NO_WORD_BOUNDARY);case fc.Op.CONCAT:case fc.Op.ALTERNATE:return this.nop();default:throw new QB("regexp: unhandled case in compile")}}enter(t){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return{sub:null};case fc.Op.CAPTURE:return{bra:this.cap(t.cap<<1),sub:null};case fc.Op.CONCAT:case fc.Op.ALTERNATE:return{f:null};default:throw new QB("regexp: unhandled case in compile")}}child(t,e,n){t.op===fc.Op.CONCAT?e.f=null===e.f?n:this.cat(e.f,n):t.op===fc.Op.ALTERNATE?e.f=null===e.f?n:this.alt(e.f,n):e.sub=n}leave(t,e){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:return this.lookBehind(e.sub,t.lb);case fc.Op.CAPTURE:{const n=this.cap(t.cap<<1|1);return this.cat(this.cat(e.bra,e.sub),n)}case fc.Op.STAR:return this.star(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.PLUS:return this.plus(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.QUEST:return this.quest(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.CONCAT:case fc.Op.ALTERNATE:return e.f;default:throw new QB("regexp: unhandled case in compile")}}},Ic=class t{static simplify(e){return null===e?null:Cc.walk(e,t.WALKER)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s,r)=>t.child(e,n,s,r),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op===fc.Op.CHAR_CLASS){if(null===t.runes)return t;if(0===t.runes.length)return new fc(fc.Op.NO_MATCH);if(2===t.runes.length&&0===t.runes[0]&&t.runes[1]===xB.MAX_RUNE)return new fc(fc.Op.ANY_CHAR);if(4===t.runes.length&&0===t.runes[0]&&t.runes[1]===IB.CODES["\n"]-1&&t.runes[2]===IB.CODES["\n"]+1&&t.runes[3]===xB.MAX_RUNE)return new fc(fc.Op.ANY_CHAR_NOT_NL)}return t}static enter(t){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return{sub:null};case fc.Op.CONCAT:case fc.Op.ALTERNATE:return{subs:[],changed:!1};case fc.Op.REPEAT:return 0===t.min&&0===t.max?{result:new fc(fc.Op.EMPTY_MATCH)}:{sub:null};default:return{result:t}}}static child(t,e,n,s){if(void 0!==e.subs){if(n!==t.subs[s]&&(e.changed=!0),t.op===fc.Op.CONCAT){if(n.op===fc.Op.NO_MATCH)return void(e.result=new fc(fc.Op.NO_MATCH));if(n.op===fc.Op.EMPTY_MATCH)return void(e.changed=!0);if(n.op===fc.Op.CONCAT){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}else{if(n.op===fc.Op.NO_MATCH)return void(e.changed=!0);if(n.op===fc.Op.ALTERNATE){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}e.subs.push(n)}else e.sub=n}static leave(e,n){switch(e.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:{const t=n.sub;if(t!==e.subs[0]){const n=fc.fromRegexp(e);return n.runes=new Int32Array(0),n.subs=[t],n}return e}case fc.Op.CONCAT:case fc.Op.ALTERNATE:if(n.changed){const t=n.subs;if(0===t.length)return new fc(e.op===fc.Op.CONCAT?fc.Op.EMPTY_MATCH:fc.Op.NO_MATCH);if(1===t.length)return t[0];const s=fc.fromRegexp(e);return s.runes=new Int32Array(0),s.subs=t,s}return e;case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return t.simplify1(e.op,e.flags,n.sub,e);case fc.Op.REPEAT:return t.simplifyRepeat(e,n.sub);default:return e}}static simplifyRepeat(e,n){if(-1===e.max){if(0===e.min)return t.simplify1(fc.Op.STAR,e.flags,n,null);if(1===e.min)return t.simplify1(fc.Op.PLUS,e.flags,n,null);const s=[];for(let t=0;t<e.min-1;t++)s.push(n);return s.push(t.simplify1(fc.Op.PLUS,e.flags,n,null)),t.concat(s)}if(1===e.min&&1===e.max)return n;let s=null;if(e.min>0){s=[];for(let t=0;t<e.min;t++)s.push(n)}if(e.max>e.min){let r=t.simplify1(fc.Op.QUEST,e.flags,n,null);for(let s=e.min+1;s<e.max;s++)r=t.simplify1(fc.Op.QUEST,e.flags,t.concat([n,r]),null);if(null===s)return r;s.push(r)}return null!==s?t.concat(s):new fc(fc.Op.NO_MATCH)}static concat(t){const e=[];for(let n=0;n<t.length;n++){const s=t[n];if(s.op===fc.Op.NO_MATCH)return new fc(fc.Op.NO_MATCH);if(s.op!==fc.Op.EMPTY_MATCH)if(s.op!==fc.Op.CONCAT)e.push(s);else for(let t=0;t<s.subs.length;t++)e.push(s.subs[t])}if(0===e.length)return new fc(fc.Op.EMPTY_MATCH);if(1===e.length)return e[0];const n=new fc(fc.Op.CONCAT);return n.subs=e,n}static simplify1(t,e,n,s){if(n.op===fc.Op.EMPTY_MATCH)return n;if(n.op===fc.Op.NO_MATCH)return t===fc.Op.PLUS?n:new fc(fc.Op.EMPTY_MATCH);if(t===n.op&&(e&fB.NON_GREEDY)===(n.flags&fB.NON_GREEDY))return n;if(null!==s&&s.op===t&&(s.flags&fB.NON_GREEDY)===(e&fB.NON_GREEDY)&&n===s.subs[0])return s;const r=new fc(t);return r.flags=e,r.subs=[n],r}},Tc=class{constructor(t,e){this.sign=t,this.cls=e}};const Oc=[48,57],Ac=[9,10,12,13,32,32],Sc=[48,57,65,90,95,95,97,122],Rc=new Map([["\\d",new Tc(1,Oc)],["\\D",new Tc(-1,Oc)],["\\s",new Tc(1,Ac)],["\\S",new Tc(-1,Ac)],["\\w",new Tc(1,Sc)],["\\W",new Tc(-1,Sc)]]),Nc=[48,57,65,90,97,122],xc=[65,90,97,122],kc=[0,127],Lc=[9,9,32,32],Fc=[0,31,127,127],Pc=[48,57],Mc=[33,126],Gc=[97,122],Hc=[32,126],Uc=[33,47,58,64,91,96,123,126],Vc=[9,13,32,32],jc=[65,90],$c=[48,57,65,90,95,95,97,122],Jc=[48,57,65,70,97,102],qc=new Map([["[:alnum:]",new Tc(1,Nc)],["[:^alnum:]",new Tc(-1,Nc)],["[:alpha:]",new Tc(1,xc)],["[:^alpha:]",new Tc(-1,xc)],["[:ascii:]",new Tc(1,kc)],["[:^ascii:]",new Tc(-1,kc)],["[:blank:]",new Tc(1,Lc)],["[:^blank:]",new Tc(-1,Lc)],["[:cntrl:]",new Tc(1,Fc)],["[:^cntrl:]",new Tc(-1,Fc)],["[:digit:]",new Tc(1,Pc)],["[:^digit:]",new Tc(-1,Pc)],["[:graph:]",new Tc(1,Mc)],["[:^graph:]",new Tc(-1,Mc)],["[:lower:]",new Tc(1,Gc)],["[:^lower:]",new Tc(-1,Gc)],["[:print:]",new Tc(1,Hc)],["[:^print:]",new Tc(-1,Hc)],["[:punct:]",new Tc(1,Uc)],["[:^punct:]",new Tc(-1,Uc)],["[:space:]",new Tc(1,Vc)],["[:^space:]",new Tc(-1,Vc)],["[:upper:]",new Tc(1,jc)],["[:^upper:]",new Tc(-1,jc)],["[:word:]",new Tc(1,$c)],["[:^word:]",new Tc(-1,$c)],["[:xdigit:]",new Tc(1,Jc)],["[:^xdigit:]",new Tc(-1,Jc)]]);var zc=class t{static charClassToString(t,e){let n="[";for(let s=0;s<e;s+=2){s>0&&(n+=" ");const e=t[s],r=t[s+1];n+=e===r?`0x${e.toString(16)}`:`0x${e.toString(16)}-0x${r.toString(16)}`}return n+="]",n}static sortRanges(t,e){const n=e>>1,s=new Array(n);for(let t=0;t<n;t++)s[t]=t;s.sort((e,n)=>t[2*e]-t[2*n]||t[2*n+1]-t[2*e+1]);const r=t.slice(0,e);for(let e=0;e<n;e++)t[2*e]=r[2*s[e]],t[2*e+1]=r[2*s[e]+1]}constructor(t=PB.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.r instanceof Int32Array?this.len===this.r.length?this.r:this.r.subarray(0,this.len):new Int32Array(this.len===this.r.length?this.r:this.r.slice(0,this.len))}toGrowableArray(){return Array.isArray(this.r)?(this.r.length=this.len,this.r):Array.from(this.r.subarray(0,this.len))}cleanClass(){if(this.len<4)return this;t.sortRanges(this.r,this.len);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],s=this.r[t+1];n<=this.r[e-1]+1?s>this.r[e-1]&&(this.r[e-1]=s):(this.r[e]=n,this.r[e+1]=s,e+=2)}return this.len=e,this}appendLiteral(t,e){return 0!==(e&fB.FOLD_CASE)?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,e){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const s=this.r[this.len-n],r=this.r[this.len-n+1];if(t<=r+1&&s<=e+1)return t<s&&(this.r[this.len-n]=t),e>r&&(this.r[this.len-n+1]=e),this}return this.r[this.len++]=t,this.r[this.len++]=e,this}appendFoldedRange(t,e){if(t<=xB.MIN_FOLD&&e>=xB.MAX_FOLD)return this.appendRange(t,e);if(e<xB.MIN_FOLD||t>xB.MAX_FOLD)return this.appendRange(t,e);t<xB.MIN_FOLD&&(this.appendRange(t,xB.MIN_FOLD-1),t=xB.MIN_FOLD),e>xB.MAX_FOLD&&(this.appendRange(xB.MAX_FOLD+1,e),e=xB.MAX_FOLD);for(let n=t;n<=e;n++){this.appendRange(n,n);for(let t=xB.simpleFold(n);t!==n;t=xB.simpleFold(t))this.appendRange(t,t)}return this}appendClass(t){for(let e=0;e<t.length;e+=2)this.appendRange(t[e],t[e+1]);return this}appendFoldedClass(t){for(let e=0;e<t.length;e+=2)this.appendFoldedRange(t[e],t[e+1]);return this}appendNegatedClass(t){let e=0;for(let n=0;n<t.length;n+=2){const s=t[n],r=t[n+1];e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=xB.MAX_RUNE&&this.appendRange(e,xB.MAX_RUNE),this}appendTable(t){for(let e=0;e<t.length;++e){const n=t.getLo(e),s=t.getHi(e),r=t.getStride(e);if(1!==r)for(let t=n;t<=s;t+=r)this.appendRange(t,t);else this.appendRange(n,s)}return this}appendNegatedTable(t){let e=0;for(let n=0;n<t.length;++n){const s=t.getLo(n),r=t.getHi(n),i=t.getStride(n);if(1!==i)for(let t=s;t<=r;t+=i)e<=t-1&&this.appendRange(e,t-1),e=t+1;else e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=xB.MAX_RUNE&&this.appendRange(e,xB.MAX_RUNE),this}appendTableWithSign(t,e){return e<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,e=0;for(let n=0;n<this.len;n+=2){const s=this.r[n],r=this.r[n+1];t<=s-1&&(this.r[e]=t,this.r[e+1]=s-1,e+=2),t=r+1}return this.len=e,t<=xB.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=xB.MAX_RUNE),this}appendClassWithSign(t,e){return e<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(e,n){let s=e.cls;return n&&(s=(new t).appendFoldedClass(s).cleanClass().toArray()),this.appendClassWithSign(s,e.sign)}toString(){return t.charClassToString(this.r,this.len)}},Kc=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){const t=this.str.codePointAt(this.position);return this.position+=PB.charCount(t),t}lookingAt(t){return this.str.startsWith(t,this.position)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},Qc=class t{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static ERR_INVALID_CAPTURE_IN_LOOKBEHIND="invalid capture in lookbehind";static MAX_HEIGHT=1e3;static MAX_SIZE=1398101;static MAX_RUNES=33554432;static ANY_TABLE=new TB(new Uint32Array([0,xB.MAX_RUNE,1]));static ASCII_TABLE=new TB(new Uint32Array([0,127,1]));static ASCII_FOLD_TABLE=new TB(new Uint32Array([0,127,1,383,383,1,8490,8490,1]));static unicodeTable(e){return"Any"===e?{tab:t.ANY_TABLE,fold:t.ANY_TABLE,sign:1}:"Ascii"===e?{tab:t.ASCII_TABLE,fold:t.ASCII_FOLD_TABLE,sign:1}:"Assigned"===e?{tab:NB.CATEGORIES.get("Cn"),fold:NB.CATEGORIES.get("Cn"),sign:-1}:"Lc"===e?{tab:NB.CATEGORIES.get("LC"),fold:NB.FOLD_CATEGORIES.get("LC"),sign:1}:NB.CATEGORIES.has(e)?{tab:NB.CATEGORIES.get(e),fold:NB.FOLD_CATEGORIES.get(e),sign:1}:NB.SCRIPTS.has(e)?{tab:NB.SCRIPTS.get(e),fold:NB.FOLD_SCRIPT.get(e),sign:1}:null}static minFoldRune(t){if(t<xB.MIN_FOLD||t>xB.MAX_FOLD)return t;let e=t;const n=t;for(t=xB.simpleFold(t);t!==n;t=xB.simpleFold(t))e>t&&(e=t);return e}static leadingRegexp(t){if(t.op===fc.Op.EMPTY_MATCH)return null;if(t.op===fc.Op.CONCAT&&t.subs.length>0){const e=t.subs[0];return e.op===fc.Op.EMPTY_MATCH?null:e}return t}static literalRegexp(t,e){const n=new fc(fc.Op.LITERAL);return n.flags=e,n.runes=PB.stringToRunes(t),n}static parse(e,n){return new t(e,n).parseInternal()}static parseRepeat(e){const n=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const s=t.parseInt(e);if(-1===s)return-1;if(!e.more())return-1;let r;if(e.lookingAt(",")){if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))r=-1;else if(-1===(r=t.parseInt(e)))return-1}else r=s;if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),s<0||s>1e3||-2===r||r>1e3||r>=0&&s>r)throw new KB(t.ERR_INVALID_REPEAT_SIZE,e.from(n));return s<<16|r&xB.MAX_BMP}static isValidCaptureName(t){if(0===t.length)return!1;for(let e=0;e<t.length;e++){const n=t.codePointAt(e);if(n!==IB.CODES._&&!PB.isalnum(n))return!1}return!0}static parseInt(t){const e=t.pos();for(;t.more()&&t.peek()>=IB.CODES[0]&&t.peek()<=IB.CODES[9];)t.skip(1);const n=t.from(e);return 0===n.length||n.length>1&&n.codePointAt(0)===IB.CODES[0]?-1:n.length>8?-2:parseInt(n,10)}static isCharClass(t){return t.op===fc.Op.LITERAL&&1===t.runes.length||t.op===fc.Op.CHAR_CLASS||t.op===fc.Op.ANY_CHAR_NOT_NL||t.op===fc.Op.ANY_CHAR}static matchRune(t,e){switch(t.op){case fc.Op.LITERAL:return 1===t.runes.length&&t.runes[0]===e;case fc.Op.CHAR_CLASS:for(let n=0;n<t.runes.length;n+=2)if(t.runes[n]<=e&&e<=t.runes[n+1])return!0;return!1;case fc.Op.ANY_CHAR_NOT_NL:return e!==IB.CODES["\n"];case fc.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,n){switch(e.op){case fc.Op.ANY_CHAR:break;case fc.Op.ANY_CHAR_NOT_NL:t.matchRune(n,IB.CODES["\n"])&&(e.op=fc.Op.ANY_CHAR);break;case fc.Op.CHAR_CLASS:{const t=new zc(Array.isArray(e.runes)?e.runes:Array.from(e.runes));n.op===fc.Op.LITERAL?t.appendLiteral(n.runes[0],n.flags):t.appendClass(n.runes),e.runes=t.toGrowableArray();break}case fc.Op.LITERAL:if(n.runes[0]===e.runes[0]&&n.flags===e.flags)break;e.op=fc.Op.CHAR_CLASS,e.runes=(new zc).appendLiteral(e.runes[0],e.flags).appendLiteral(n.runes[0],n.flags).toGrowableArray()}}static parseEscape(e){const n=e.pos();if(e.skip(1),!e.more())throw new KB(t.ERR_TRAILING_BACKSLASH);let s=e.pop();t:switch(s){case IB.CODES[1]:case IB.CODES[2]:case IB.CODES[3]:case IB.CODES[4]:case IB.CODES[5]:case IB.CODES[6]:case IB.CODES[7]:if(!e.more()||e.peek()<IB.CODES[0]||e.peek()>IB.CODES[7])break;case IB.CODES[0]:{let t=s-IB.CODES[0];for(let n=1;n<3&&!(!e.more()||e.peek()<IB.CODES[0]||e.peek()>IB.CODES[7]);n++)t=8*t+e.peek()-IB.CODES[0],e.skip(1);return t}case IB.CODES.x:{if(!e.more())break;if(s=e.pop(),s===IB.CODES["{"]){let t=0,n=0;for(;;){if(!e.more())break t;if(s=e.pop(),s===IB.CODES["}"])break;const r=PB.unhex(s);if(r<0)break t;if(n=16*n+r,n>xB.MAX_RUNE)break t;t++}if(0===t)break t;return n}const t=PB.unhex(s);if(!e.more())break;s=e.pop();const n=PB.unhex(s);if(t<0||n<0)break;return 16*t+n}case IB.CODES.a:return IB.CODES[""];case IB.CODES.f:return IB.CODES["\f"];case IB.CODES.n:return IB.CODES["\n"];case IB.CODES.r:return IB.CODES["\r"];case IB.CODES.t:return IB.CODES["\t"];case IB.CODES.v:return IB.CODES["\v"];default:if(s<=xB.MAX_ASCII&&!PB.isalnum(s))return s}throw new KB(t.ERR_INVALID_ESCAPE,e.from(n))}static parseClassChar(e,n){if(!e.more())throw new KB(t.ERR_MISSING_BRACKET,e.from(n));return e.lookingAt("\\")?t.parseEscape(e):e.pop()}static hasCapture(e){if(null===e)return!1;if(e.op===fc.Op.CAPTURE)return!0;if(e.subs)for(let n of e.subs)if(t.hasCapture(n))return!0;return!1}constructor(t,e=0){this.wholeRegexp=t,this.flags=e,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(t){let e=this.free;return null!==e&&null!==e.subs&&e.subs.length>0?(this.free=e.subs[0],e.reinit(),e.op=t):(e=new fc(t),this.numRegexp+=1),e}reuse(t){null!==this.height&&this.height.has(t)&&this.height.delete(t),null!==t.subs&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(e){if(this.numRunes>t.MAX_RUNES)throw new KB(t.ERR_LARGE);this.checkSize(e),this.checkHeight(e)}checkSize(e){if(null===this.size){if(0===this.repeats&&(this.repeats=1),e.op===fc.Op.REPEAT){let n=e.max;-1===n&&(n=e.min),n<=0&&(n=1),n>Math.floor(t.MAX_SIZE/this.repeats)?this.repeats=t.MAX_SIZE:this.repeats*=n}if(this.numRegexp<Math.floor(t.MAX_SIZE/this.repeats))return;this.size=new Map;for(let t of this.stack)this.checkSize(t)}if(this.calcSize(e,!0)>t.MAX_SIZE)throw new KB(t.ERR_LARGE)}calcSize(t,e=!1){if(!e&&null!==this.size&&this.size.has(t))return this.size.get(t);let n=0;switch(t.op){case fc.Op.LITERAL:n=t.runes.length;break;case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:case fc.Op.STAR:n=2+this.calcSize(t.subs[0]);break;case fc.Op.PLUS:case fc.Op.QUEST:n=1+this.calcSize(t.subs[0]);break;case fc.Op.CONCAT:for(let e of t.subs)n+=this.calcSize(e);break;case fc.Op.ALTERNATE:for(let e of t.subs)n+=this.calcSize(e);t.subs.length>1&&(n=n+t.subs.length-1);break;case fc.Op.REPEAT:{let e=this.calcSize(t.subs[0]);if(-1===t.max){n=0===t.min?2+e:1+t.min*e;break}n=t.max*e+(t.max-t.min);break}}return n=Math.max(1,n),null===this.size&&(this.size=new Map),this.size.set(t,n),n}checkHeight(e){if(!(this.numRegexp<t.MAX_HEIGHT)){if(null===this.height){this.height=new Map;for(let t of this.stack)this.checkHeight(t)}if(this.calcHeight(e,!0)>t.MAX_HEIGHT)throw new KB(t.ERR_NESTING_DEPTH)}}calcHeight(t,e=!1){if(!e&&null!==this.height&&this.height.has(t))return this.height.get(t);let n=1;for(let e of t.subs){const t=this.calcHeight(e);n<1+t&&(n=1+t)}return null===this.height&&(this.height=new Map),this.height.set(t,n),n}pop(){return this.stack.pop()}popToPseudo(){const t=this.stack.length;let e=t;for(;e>0&&!fc.isPseudoOp(this.stack[e-1].op);)e--;return this.stack.splice(e,t-e)}push(t){if(this.numRunes+=t.runes.length,t.op===fc.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],-2&this.flags))return null;t.op=fc.Op.LITERAL,t.runes=[t.runes[0]],t.flags=-2&this.flags}else if(t.op===fc.Op.CHAR_CLASS&&4===t.runes.length&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&xB.simpleFold(t.runes[0])===t.runes[2]&&xB.simpleFold(t.runes[2])===t.runes[0]||t.op===fc.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]+1===t.runes[1]&&xB.simpleFold(t.runes[0])===t.runes[1]&&xB.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|fB.FOLD_CASE))return null;t.op=fc.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|fB.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,e){const n=this.stack.length;if(n<2)return!1;const s=this.stack[n-1],r=this.stack[n-2];if(s.op!==fc.Op.LITERAL||r.op!==fc.Op.LITERAL||(s.flags&fB.FOLD_CASE)!==(r.flags&fB.FOLD_CASE))return!1;Array.isArray(r.runes)||(r.runes=Array.from(r.runes));for(let t=0;t<s.runes.length;t++)r.runes.push(s.runes[t]);return t>=0?(s.runes=[t],s.flags=e,!0):(this.pop(),this.reuse(s),!1)}newLiteral(e,n){const s=this.newRegexp(fc.Op.LITERAL);return s.flags=n,0!==(n&fB.FOLD_CASE)&&(e=t.minFoldRune(e)),s.runes=[e],s}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){const e=this.newRegexp(t);return e.flags=this.flags,this.push(e)}repeat(e,n,s,r,i,o){let a=this.flags;if(0!==(a&fB.PERL_X)&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=fB.NON_GREEDY),-1!==o))throw new KB(t.ERR_INVALID_REPEAT_OP,i.from(o));const B=this.stack.length;if(0===B)throw new KB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const c=this.stack[B-1];if(fc.isPseudoOp(c.op))throw new KB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const l=this.newRegexp(e);if(l.min=n,l.max=s,l.flags=a,l.subs=[c],this.stack[B-1]=l,this.checkLimits(l),e===fc.Op.REPEAT&&(n>=2||s>=2)&&!this.repeatIsValid(l,1e3))throw new KB(t.ERR_INVALID_REPEAT_SIZE,i.from(r))}repeatIsValid(t,e){if(t.op===fc.Op.REPEAT){let n=t.max;if(0===n)return!0;if(n<0&&(n=t.min),n>e)return!1;n>0&&(e=Math.trunc(e/n))}for(let n of t.subs)if(!this.repeatIsValid(n,e))return!1;return!0}concat(){this.maybeConcat(-1,0);const t=this.popToPseudo();return 0===t.length?this.push(this.newRegexp(fc.Op.EMPTY_MATCH)):this.push(this.collapse(t,fc.Op.CONCAT))}alternate(){const t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),0===t.length?this.push(this.newRegexp(fc.Op.NO_MATCH)):this.push(this.collapse(t,fc.Op.ALTERNATE))}cleanAlt(t){t.op===fc.Op.CHAR_CLASS&&(t.runes=new zc(Array.from(t.runes)).cleanClass().toArray(),2===t.runes.length&&0===t.runes[0]&&t.runes[1]===xB.MAX_RUNE?(t.runes=new Int32Array(0),t.op=fc.Op.ANY_CHAR):4===t.runes.length&&0===t.runes[0]&&t.runes[1]===IB.CODES["\n"]-1&&t.runes[2]===IB.CODES["\n"]+1&&t.runes[3]===xB.MAX_RUNE&&(t.runes=new Int32Array(0),t.op=fc.Op.ANY_CHAR_NOT_NL))}collapse(t,e){if(1===t.length)return t[0];let n=0;for(let s of t)n+=s.op===e?s.subs.length:1;let s=new Array(n).fill(null),r=0;for(let n of t)if(n.op===e){for(let t=0;t<n.subs.length;t++)s[r++]=n.subs[t];this.reuse(n)}else s[r++]=n;let i=this.newRegexp(e);if(i.subs=s,e===fc.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const t=i;i=i.subs[0],this.reuse(t)}return i}factor(e){if(e.length<2)return e;let n=0,s=e.length,r=0,i=null,o=0,a=0,B=0;for(let t=0;t<=s;t++){let c=null,l=0,u=0;if(t<s){let s=e[n+t];if(s.op===fc.Op.CONCAT&&s.subs.length>0&&(s=s.subs[0]),s.op===fc.Op.LITERAL&&(c=s.runes,l=s.runes.length,u=s.flags&fB.FOLD_CASE),u===a){let t=0;for(;t<o&&t<l&&i[t]===c[t];)t++;if(t>0){o=t;continue}}}if(t===B);else if(t===B+1)e[r++]=e[n+B];else{const s=this.newRegexp(fc.Op.LITERAL);s.flags=a,s.runes=i.slice(0,o);for(let s=B;s<t;s++)e[n+s]=this.removeLeadingString(e[n+s],o),this.checkLimits(e[n+s]);const c=this.collapse(e.slice(n+B,n+t),fc.Op.ALTERNATE),l=this.newRegexp(fc.Op.CONCAT);l.subs=[s,c],e[r++]=l}B=t,i=c,o=l,a=u}s=r,n=0,B=0,r=0;let c=null;for(let i=0;i<=s;i++){let o=null;if(!(i<s&&(o=t.leadingRegexp(e[n+i]),null!==c&&c.equals(o)&&(t.isCharClass(c)||c.op===fc.Op.REPEAT&&c.min===c.max&&t.isCharClass(c.subs[0]))))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{const t=c;for(let t=B;t<i;t++){const s=t!==B;e[n+t]=this.removeLeadingRegexp(e[n+t],s),this.checkLimits(e[n+t])}const s=this.collapse(e.slice(n+B,n+i),fc.Op.ALTERNATE),o=this.newRegexp(fc.Op.CONCAT);o.subs=[t,s],e[r++]=o}B=i,c=o}}s=r,n=0,B=0,r=0;for(let i=0;i<=s;i++)if(!(i<s&&t.isCharClass(e[n+i]))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{let s=B;for(let t=B+1;t<i;t++){const r=e[n+s],i=e[n+t];(r.op<i.op||r.op===i.op&&(null!==r.runes?r.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(s=t)}const o=e[n+B];e[n+B]=e[n+s],e[n+s]=o;for(let s=B+1;s<i;s++)t.mergeCharClass(e[n+B],e[n+s]),this.reuse(e[n+s]);this.cleanAlt(e[n+B]),e[r++]=e[n+B]}i<s&&(e[r++]=e[n+i]),B=i+1}s=r,n=0,B=0,r=0;for(let t=0;t<s;++t)t+1<s&&e[n+t].op===fc.Op.EMPTY_MATCH&&e[n+t+1].op===fc.Op.EMPTY_MATCH||(e[r++]=e[n+t]);return s=r,n=0,e.slice(n,s)}removeLeadingString(t,e){if(t.op===fc.Op.CONCAT&&t.subs.length>0){const n=this.removeLeadingString(t.subs[0],e);if(t.subs[0]=n,n.op===fc.Op.EMPTY_MATCH)switch(this.reuse(n),t.subs.length){case 0:case 1:t.op=fc.Op.EMPTY_MATCH,t.subs=fc.emptySubs();break;case 2:{const e=t;t=t.subs[1],this.reuse(e);break}default:t.subs=t.subs.slice(1,t.subs.length)}return t}return t.op===fc.Op.LITERAL&&(t.runes=t.runes.slice(e,t.runes.length),0===t.runes.length&&(t.op=fc.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,e){if(t.op===fc.Op.CONCAT&&t.subs.length>0){switch(e&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:t.op=fc.Op.EMPTY_MATCH,t.subs=fc.emptySubs();break;case 1:{const e=t;t=t.subs[0],this.reuse(e);break}}return t}return e&&this.reuse(t),this.newRegexp(fc.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&fB.LITERAL))return t.literalRegexp(this.wholeRegexp,this.flags);let e=-1,n=-1,s=-1;const r=new Kc(this.wholeRegexp);for(;r.more();){let i=-1;t:switch(r.peek()){case IB.CODES["("]:if(0!==(this.flags&fB.LOOKBEHIND)){if(r.lookingAt("(?<=")){this.parsePosLookBehind(),r.skip(4);break}if(r.lookingAt("(?<!")){this.parseNegLookBehind(),r.skip(4);break}}if(0!==(this.flags&fB.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(fc.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case IB.CODES["|"]:this.parseVerticalBar(),r.skip(1);break;case IB.CODES[")"]:this.parseRightParen(),r.skip(1);break;case IB.CODES["^"]:0!==(this.flags&fB.ONE_LINE)?this.op(fc.Op.BEGIN_TEXT):this.op(fc.Op.BEGIN_LINE),r.skip(1);break;case IB.CODES.$:0!==(this.flags&fB.ONE_LINE)?this.op(fc.Op.END_TEXT).flags|=fB.WAS_DOLLAR:this.op(fc.Op.END_LINE),r.skip(1);break;case IB.CODES["."]:0!==(this.flags&fB.DOT_NL)?this.op(fc.Op.ANY_CHAR):this.op(fc.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case IB.CODES["["]:this.parseClass(r);break;case IB.CODES["*"]:case IB.CODES["+"]:case IB.CODES["?"]:{i=r.pos();let t=null;switch(r.pop()){case IB.CODES["*"]:t=fc.Op.STAR;break;case IB.CODES["+"]:t=fc.Op.PLUS;break;case IB.CODES["?"]:t=fc.Op.QUEST}this.repeat(t,n,s,i,r,e);break}case IB.CODES["{"]:{const o=r.pos(),a=t.parseRepeat(r);if(a<0){r.rewindTo(o),this.literal(r.pop());break}i=o,n=a>>16,s=(a&xB.MAX_BMP)<<16>>16,this.repeat(fc.Op.REPEAT,n,s,i,r,e);break}case IB.CODES["\\"]:{const e=r.pos();if(r.skip(1),0!==(this.flags&fB.PERL_X)&&r.more())switch(r.pop()){case IB.CODES.A:this.op(fc.Op.BEGIN_TEXT);break t;case IB.CODES.b:this.op(fc.Op.WORD_BOUNDARY);break t;case IB.CODES.B:this.op(fc.Op.NO_WORD_BOUNDARY);break t;case IB.CODES.C:throw new KB(t.ERR_INVALID_ESCAPE,"\\C");case IB.CODES.Q:{let t=r.rest();const e=t.indexOf("\\E");e>=0?(t=t.substring(0,e),r.skipString(t),r.skipString("\\E")):r.skipString(t);let n=0;for(;n<t.length;){const e=t.codePointAt(n);this.literal(e),n+=PB.charCount(e)}break t}case IB.CODES.z:this.op(fc.Op.END_TEXT);break t;default:r.rewindTo(e)}else r.rewindTo(e);const n=this.newRegexp(fc.Op.CHAR_CLASS);if(n.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const t=new zc;if(this.parseUnicodeClass(r,t)){n.runes=t.toArray(),this.push(n);break t}}const s=new zc;if(this.parsePerlClassEscape(r,s)){n.runes=s.toArray(),this.push(n);break t}r.rewindTo(e),this.reuse(n),this.literal(t.parseEscape(r));break}default:this.literal(r.pop())}e=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),1!==this.stack.length)throw new KB(t.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const n=e.pos(),s=e.rest();if(s.startsWith("(?P<")||s.startsWith("(?<")){const n="P"===s.charAt(2)?4:3,r=s.indexOf(">");if(r<0)throw new KB(t.ERR_INVALID_NAMED_CAPTURE,s);const i=s.substring(n,r);if(e.skipString(i),e.skip(n+1),!t.isValidCaptureName(i))throw new KB(t.ERR_INVALID_NAMED_CAPTURE,s.substring(0,r+1));const o=this.op(fc.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[i])throw new KB(t.ERR_DUPLICATE_NAMED_CAPTURE,i);return this.namedGroups[i]=this.numCap,void(o.name=i)}e.skip(2);let r=this.flags,i=1,o=!1;t:for(;e.more();){const t=e.pop();switch(t){case IB.CODES.i:r|=fB.FOLD_CASE,o=!0;break;case IB.CODES.m:r&=-17,o=!0;break;case IB.CODES.s:r|=fB.DOT_NL,o=!0;break;case IB.CODES.U:r|=fB.NON_GREEDY,o=!0;break;case IB.CODES["-"]:if(i<0)break t;i=-1,r=~r,o=!1;break;case IB.CODES[":"]:case IB.CODES[")"]:if(i<0){if(!o)break t;r=~r}return t===IB.CODES[":"]&&this.op(fc.Op.LEFT_PAREN),void(this.flags=r);default:break t}}throw new KB(t.ERR_INVALID_PERL_OP,e.from(n))}parsePosLookBehind(){const t=this.newRegexp(fc.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=++this.nlb,this.push(t)}parseNegLookBehind(){const t=this.newRegexp(fc.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=-++this.nlb,this.push(t)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(fc.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===fc.Op.VERTICAL_BAR&&t.isCharClass(this.stack[e-1])&&t.isCharClass(this.stack[e-3])){let n=this.stack[e-1],s=this.stack[e-3];if(n.op>s.op){const t=s;s=n,n=t,this.stack[e-3]=s}return t.mergeCharClass(s,n),this.reuse(n),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===fc.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new KB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const e=this.pop(),n=this.pop();if(n.op!==fc.Op.LEFT_PAREN)throw new KB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=n.flags,0!==n.lb){if(t.hasCapture(e))throw new KB(t.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);return n.lb>0?n.op=fc.Op.PLB:n.op=fc.Op.NLB,n.subs=[e],void this.push(n)}0===n.cap?this.push(e):(n.op=fc.Op.CAPTURE,n.subs=[e],this.push(n))}parsePerlClassEscape(t,e){const n=t.pos();if(0===(this.flags&fB.PERL_X)||!t.more()||t.pop()!==IB.CODES["\\"]||!t.more())return!1;t.pop();const s=t.from(n),r=Rc.has(s)?Rc.get(s):null;return null!==r&&(e.appendGroup(r,0!==(this.flags&fB.FOLD_CASE)),!0)}parseNamedClass(e,n){const s=e.rest(),r=s.indexOf(":]");if(r<0)return!1;const i=s.substring(0,r+2);e.skipString(i);const o=qc.has(i)?qc.get(i):null;if(null===o)throw new KB(t.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,0!==(this.flags&fB.FOLD_CASE)),!0}parseUnicodeClass(e,n){const s=e.pos();if(0===(this.flags&fB.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let r,i=1,o=e.pop();if(o===IB.CODES.P&&(i=-1),!e.more())throw e.rewindTo(s),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest());if(o=e.pop(),o!==IB.CODES["{"])r=PB.runeToString(o);else{const n=e.rest(),i=n.indexOf("}");if(i<0)throw e.rewindTo(s),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest());r=n.substring(0,i),e.skipString(r),e.skip(1)}0!==r.length&&r.codePointAt(0)===IB.CODES["^"]&&(i=0-i,r=r.substring(1));const a=t.unicodeTable(r);if(null===a)throw new KB(t.ERR_INVALID_CHAR_RANGE,e.from(s));a.sign<0&&(i=0-i);const B=a.tab,c=a.fold;if(0===(this.flags&fB.FOLD_CASE)||null===c)n.appendTableWithSign(B,i);else{const t=(new zc).appendTable(B).appendTable(c).cleanClass().toArray();n.appendClassWithSign(Array.from(t),i)}return!0}parseClass(e){const n=e.pos();e.skip(1);const s=this.newRegexp(fc.Op.CHAR_CLASS);s.flags=this.flags;const r=new zc;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),0===(this.flags&fB.CLASS_NL)&&r.appendRange(IB.CODES["\n"],IB.CODES["\n"]));let o=!0;for(;!e.more()||e.peek()!==IB.CODES["]"]||o;){if(e.more()&&e.lookingAt("-")&&0===(this.flags&fB.PERL_X)&&!o){const s=e.rest();if("-"===s||!s.startsWith("-]"))throw e.rewindTo(n),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest())}o=!1;const s=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,r))continue;e.rewindTo(s)}if(this.parseUnicodeClass(e,r))continue;if(this.parsePerlClassEscape(e,r))continue;e.rewindTo(s);const i=t.parseClassChar(e,n);let a=i;if(e.more()&&e.lookingAt("-"))if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(a=t.parseClassChar(e,n),a<i)throw new KB(t.ERR_INVALID_CHAR_RANGE,e.from(s));0===(this.flags&fB.FOLD_CASE)?r.appendRange(i,a):r.appendFoldedRange(i,a)}e.skip(1),r.cleanClass(),i<0&&r.negateClass(),s.runes=r.toArray(),this.push(s)}},Wc=class t{static initTest(e){const n=t.compile(e),s=new t(n.expr,n.prog,n.numSubexp,n.longest);return s.cond=n.cond,s.prefix=n.prefix,s.prefixUTF8=n.prefixUTF8,s.prefixComplete=n.prefixComplete,s.prefixRune=n.prefixRune,s.prefilter=n.prefilter,s.namedGroups=n.namedGroups,s}static compile(e){return t.compileImpl(e,fB.PERL,!1)}static compilePOSIX(e){return t.compileImpl(e,fB.POSIX,!0)}static compileImpl(e,n,s){let r=Qc.parse(e,n);const i=r.maxCap(),o=r.namedGroups;r=Ic.simplify(r);const a=wc.build(r),B=vc.compileRegexp(r),c=new t(e,B,i,s);c.prefilter=a.type===mc.Type.NONE?null:a;const[l,u]=B.prefix();return c.prefixComplete=l,c.prefix=u,c.prefixUTF8=PB.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=o,c}static match(e,n){return t.compile(e).match(n)}constructor(t,e,n=0,s=0){this.expr=t,this.prog=e,this.numSubexp=n,this.longest=s,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.namedGroups=Object.create(null),this.machinePool=[],this.lazyDFA=null,this.onepass=pc.compile(this.prog),this.prefilter=null}get dfa(){return null===this.lazyDFA&&(this.lazyDFA=new Bc(this.prog)),this.lazyDFA}matchPrefixComplete(t,e,n,s){if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return null;let r=-1,i=-1;const o=t.prefixLength(this);if(n===fB.UNANCHORED){const n=t.index(this,e);if(n<0)return null;r=e+n,i=r+o}else if(n===fB.ANCHOR_BOTH){if(t.endPos()!==o)return null;if(0!==t.index(this,0))return null;r=0,i=o}else if(n===fB.ANCHOR_START){if(0!==t.index(this,0))return null;r=0,i=o}if(r<0)return null;if(s>0){const t=new Int32Array(s).fill(-1);return t[0]=r,t[1]=i,Array.from(t)}return[]}createLookbehindState(){return this.prog.numLb>0?new nc(this.prog):null}executeEngine(t,e,n,s,r=null){if(this.prefixComplete&&(0===s||0===this.numSubexp))return this.matchPrefixComplete(t,e,n,s);if(null!==this.prefilter&&n===fB.UNANCHORED&&!this.prefilter.eval(t,e))return null;if(null!==this.onepass)return pc.execute(this,t,e,n,s);if(s>0)return 0===this.prog.numLb&&t.endPos()<=uc.maxBitStateLen(this.prog)?uc.execute(this,t,e,n,s):this.doExecuteNFA(t,e,n,s,r);if(0===this.prog.numLb){const r=this.dfa.match(t,e,n);if(null!==r)return r?[]:null;if(t.endPos()<=uc.maxBitStateLen(this.prog))return uc.execute(this,t,e,n,s)}return this.doExecuteNFA(t,e,n,s,r)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(t){this.machinePool.push(t)}toString(){return this.expr}doExecuteNFA(t,e,n,s,r=null){let i=this.get();i||(i=sc.fromRE2(this)),i.init(s);const o=i.match(t,e,n,r)?i.submatches():null;return this.put(i),o}match(t){return null!==this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,0)}matchWithGroup(t,e,n,s,r,i=null){return t instanceof GB||(t=PB.isByteArray(t)?VB.utf8(t):VB.utf16(t)),this.matchMachineInput(t,e,n,s,r,i)}matchMachineInput(t,e,n,s,r,i=null){if(e>n)return[!1,null];const o=t.isUTF16Encoding()?qB.fromUTF16(t.asCharSequence(),0,n):qB.fromUTF8(t.asBytes(),0,n),a=this.executeEngine(o,e,s,2*r,i);return null===a?[!1,null]:[!0,a]}matchUTF8(t){return null!==this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,0)}replaceAll(t,e){return this.replaceAllFunc(t,()=>e,2*t.length+1)}replaceFirst(t,e){return this.replaceAllFunc(t,()=>e,1)}replaceAllFunc(t,e,n){let s=0,r=0,i="";const o=qB.fromUTF16(t),a=this.createLookbehindState();let B=0;for(;r<=t.length;){const c=this.executeEngine(o,r,fB.UNANCHORED,2,a);if(null===c||0===c.length)break;i+=t.substring(s,c[0]),(c[1]>s||0===c[0])&&(i+=e(t.substring(c[0],c[1])),B++),s=c[1];const l=7&o.step(r);if(r+l>c[1]?r+=l:r+1>c[1]?r++:r=c[1],B>=n)break}return i+=t.substring(s),i}pad(t){if(null===t)return null;let e=2*(1+this.numSubexp);if(t.length<e){let n=new Array(e).fill(-1);for(let e=0;e<t.length;e++)n[e]=t[e];t=n}return t}allMatches(t,e,n=t=>t){let s=[];const r=t.endPos();e<0&&(e=r+1);let i=0,o=0,a=-1;const B=this.createLookbehindState();for(;o<e&&i<=r;){const e=this.executeEngine(t,i,fB.UNANCHORED,this.prog.numCap,B);if(null===e||0===e.length)break;let c=!0;if(e[1]===i){e[0]===a&&(c=!1);const n=t.step(i);n<0?i=r+1:i+=7&n}else i=e[1];a=e[1],c&&(s.push(n(this.pad(e))),o++)}return s}findUTF8(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,2);return null===e?null:t.slice(e[0],e[1])}findUTF8Index(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,2);return null===e?null:e.slice(0,2)}find(t){const e=this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,2);return null===e?"":t.substring(e[0],e[1])}findIndex(t){return this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,2)}findUTF8Submatch(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,this.prog.numCap))}findSubmatch(t){const e=this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n}findSubmatchIndex(t){return this.pad(this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,this.prog.numCap))}findAllUTF8(t,e){const n=this.allMatches(qB.fromUTF8(t),e,e=>t.slice(e[0],e[1]));return 0===n.length?null:n}findAllUTF8Index(t,e){const n=this.allMatches(qB.fromUTF8(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAll(t,e){const n=this.allMatches(qB.fromUTF16(t),e,e=>t.substring(e[0],e[1]));return 0===n.length?null:n}findAllIndex(t,e){const n=this.allMatches(qB.fromUTF16(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(t,e){const n=this.allMatches(qB.fromUTF8(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(t,e){const n=this.allMatches(qB.fromUTF8(t),e);return 0===n.length?null:n}findAllSubmatch(t,e){const n=this.allMatches(qB.fromUTF16(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(t,e){const n=this.allMatches(qB.fromUTF16(t),e);return 0===n.length?null:n}},Yc=class t{static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static translate(e){let n="";if(e instanceof RegExp&&(e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),e.dotAll&&(n+="s"),e=e.source),"string"!=typeof e)return e;let s="",r=!1,i=e.length;0===i&&(s="(?:)",r=!0);let o=!1,a=0;for(;a<i;){let n=e[a];if("\\"===n){if(a+1<i)switch(n=e[a+1],n){case"\\":s+="\\\\",a+=2;continue;case"c":if(a+2<i){let t=e[a+2].charCodeAt(0);if(t>=65&&t<=90||t>=97&&t<=122){let e=t%32;s+="\\x",s+=(e>>4).toString(16).toUpperCase(),s+=(15&e).toString(16).toUpperCase(),a+=3,r=!0;continue}}s+="c",a+=2,r=!0;continue;case"u":if(a+2<i)if("{"===e[a+2]){let n=a+3,o=!1,B=!1;for(;n<i;){const s=e[n];if("}"===s){B=!0;break}if(!t.isHexadecimal(s))break;o=!0,n++}if(B&&o){s+="\\x",a+=2,r=!0;continue}}else if(a+5<i){let n=!0;for(let s=0;s<4;s++)if(!t.isHexadecimal(e[a+2+s])){n=!1;break}if(n){s+="\\x{"+e.substring(a+2,a+6)+"}",a+=6,r=!0;continue}}s+="u",a+=2,r=!0;continue;case"x":{let n=!1;if(a+2<i&&"{"===e[a+2]){let s=a+3,r=!1,o=!1;for(;s<i;){const n=e[s];if("}"===n){o=!0;break}if(!t.isHexadecimal(n))break;r=!0,s++}o&&r&&(n=!0)}else a+3<i&&t.isHexadecimal(e[a+2])&&t.isHexadecimal(e[a+3])&&(n=!0);n?(s+="\\x",a+=2):(s+="x",a+=2,r=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":s+="\\"+n,a+=2;continue;default:{let t=e.codePointAt(a+1);if(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){let n=PB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1,r=!0}else{s+="\\";let n=PB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1}continue}}}else{if("/"===n){s+="\\/",a+=1,r=!0;continue}if("["===n){if(!o&&"]"===e[a+1]){s+="[^\\x00-\\x{10FFFF}]",a+=2,r=!0;continue}if(!o&&"^"===e[a+1]&&"]"===e[a+2]){s+="[\\x00-\\x{10FFFF}]",a+=3,r=!0;continue}o=!0}else if("]"===n)o=!1;else if(!o&&"("===n&&a+2<i&&"?"===e[a+1]&&"<"===e[a+2]&&a+3<i&&!"=!>)".includes(e[a+3])){s+="(?P<",a+=3,r=!0;continue}}let B=e.codePointAt(a),c=PB.charCount(B);s+=e.substring(a,a+c),a+=c}const B=r?s:e;return n.length>0?`(?${n})${B}`:B}};const Xc=(t,e)=>{const n=t.matchArray();return n.index=t.start(0),n.input=e,n.groups=t.namedGroupsObject(),n};var Zc=class t{static CASE_INSENSITIVE=CB;static DOTALL=gB;static MULTILINE=mB;static DISABLE_UNICODE_GROUPS=wB;static LONGEST_MATCH=yB;static LOOKBEHINDS=EB;static quote(t){return PB.quoteMeta(t)}static quoteReplacement(t,e=!1){return ZB.quoteReplacement(t,e)}static translateRegExp(t){return Yc.translate(t)}static compile(e,n=0){let s=e;if(0!==(n&t.CASE_INSENSITIVE)&&(s=`(?i)${s}`),0!==(n&t.DOTALL)&&(s=`(?s)${s}`),0!==(n&t.MULTILINE)&&(s=`(?m)${s}`),-544&n)throw new YB("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let r=fB.PERL;0!==(n&t.DISABLE_UNICODE_GROUPS)&&(r&=-129),0!==(n&t.LOOKBEHINDS)&&(r|=fB.LOOKBEHIND);const i=new t(e,n);return i.re2Input=Wc.compileImpl(s,r,0!==(n&t.LONGEST_MATCH)),i}static matches(e,n){return t.compile(e).testExact(n)}static initTest(e,n,s){if(null==e)throw new Error("pattern is null");if(null==s)throw new Error("re2 is null");const r=new t(e,n);return r.re2Input=s,r}constructor(t,e){this.patternInput=t,this.flagsInput=e,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return PB.isByteArray(t)&&(t=VB.utf8(t)),new ZB(this,t)}test(t){return PB.isByteArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){const e=PB.isByteArray(t)?qB.fromUTF8(t):qB.fromUTF16(t);return null!==this.re2Input.executeEngine(e,0,fB.ANCHOR_BOTH,0)}exec(t){const e=this.matcher(t);return e.find()?Xc(e,t):null}split(t,e=0){const n=this.matcher(t),s=[];let r=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(e>0&&s.length===e-1)break;if(i===n.start()){if(0===e){r+=1,i=n.end();continue}}else for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===e&&i!==n.inputLength()){for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.inputLength()))}return 0===e&&(0!==s.length||i===n.inputLength()&&i>0)||s.push(n.substring(i,n.inputLength())),s}*matchAll(t){const e=this.matcher(t);for(;e.find();)yield Xc(e,t)}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t||null!==t&&this.constructor===t.constructor&&(this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput)}};let tl="12.19.0";const el=new ms("@firebase/firestore");function nl(){return el.logLevel}function sl(t,...e){if(el.logLevel<=ds.DEBUG){const n=e.map(ol);el.debug(`Firestore (${tl}): ${t}`,...n)}}function rl(t,...e){if(el.logLevel<=ds.ERROR){const n=e.map(ol);el.error(`Firestore (${tl}): ${t}`,...n)}}function il(t,...e){if(el.logLevel<=ds.WARN){const n=e.map(ol);el.warn(`Firestore (${tl}): ${t}`,...n)}}function ol(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function al(t,e,n){let s="Unexpected state";"string"==typeof e?s=e:n=e,Bl(t,s,n)}function Bl(t,e,n){let s=`FIRESTORE (${tl}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(void 0!==n)try{s+=" CONTEXT: "+JSON.stringify(n)}catch(t){s+=" CONTEXT: "+n}throw rl(s),new Error(s)}function cl(t,e,n,s){let r="Unexpected state";"string"==typeof n?r=n:s=n,t||Bl(e,r,s)}function ll(t,e){return t}function ul(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}class hl{static newId(){const t=62*Math.floor(256/62);let e="";for(;e.length<20;){const n=ul(40);for(let s=0;s<n.length;++s)e.length<20&&n[s]<t&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[s]%62))}return e}}function dl(t,e){return t<e?-1:t>e?1:0}function pl(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=t.charAt(s),r=e.charAt(s);if(n!==r)return gl(n)===gl(r)?dl(n,r):gl(n)?1:-1}return dl(t.length,e.length)}const fl=55296,Cl=57343;function gl(t){const e=t.charCodeAt(0);return e>=fl&&e<=Cl}function ml(t,e,n){return t.length===e.length&&t.every((t,s)=>n(t,e[s]))}class wl{constructor(t,e){this.comparator=t,this.root=e||El.EMPTY}insert(t,e){return new wl(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,El.BLACK,null,null))}remove(t){return new wl(this.comparator,this.root.remove(t,this.comparator).copy(null,null,El.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(t,n.key);if(0===s)return e+n.left.size;s<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((e,n)=>(t(e,n),!1))}toString(){const t=[];return this.inorderTraversal((e,n)=>(t.push(`${e}:${n}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new yl(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new yl(this.root,t,this.comparator,!1)}getReverseIterator(){return new yl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new yl(this.root,t,this.comparator,!0)}}class yl{constructor(t,e,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&s&&(r*=-1),r<0)t=this.isReverse?t.left:t.right;else{if(0===r){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class El{constructor(t,e,n,s,r){this.key=t,this.value=e,this.color=null!=n?n:El.RED,this.left=null!=s?s:El.EMPTY,this.right=null!=r?r:El.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,s,r){return new El(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}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(t,e,n){let s=this;const r=n(t,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(t,e,n),null):0===r?s.copy(null,e,null,null,null):s.copy(null,null,null,null,s.right.insert(t,e,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return El.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,s=this;if(e(t,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(t,e),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===e(t,s.key)){if(s.right.isEmpty())return El.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(t,e))}return s.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,El.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,El.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw al(43730,{key:this.key,value:this.value});if(this.right.isRed())throw al(14113,{key:this.key,value:this.value});const t=this.left.check();if(t!==this.right.check())throw al(27949);return t+(this.isRed()?0:1)}}El.EMPTY=null,El.RED=!0,El.BLACK=!1,El.EMPTY=new class{constructor(){this.size=0}get key(){throw al(57766)}get value(){throw al(16141)}get color(){throw al(16727)}get left(){throw al(29726)}get right(){throw al(36894)}copy(t,e,n,s,r){return this}insert(t,e,n){return new El(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class Dl{constructor(t){this.comparator=t,this.data=new wl(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((e,n)=>(t(e),!1))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,t[1])>=0)return;e(s.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new _l(this.data.getIterator())}getIteratorFrom(t){return new _l(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach(t=>{e=e.add(t)}),e}isEqual(t){if(!(t instanceof Dl))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,s=n.getNext().key;if(0!==this.comparator(t,s))return!1}return!0}toArray(){const t=[];return this.forEach(e=>{t.push(e)}),t}toString(){const t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(t){const e=new Dl(this.comparator);return e.data=t,e}}class _l{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}const bl={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class vl extends Wn{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}const Il="__name__";class Tl{constructor(t,e,n){void 0===e?e=0:e>t.length&&al(637,{offset:e,range:t.length}),void 0===n?n=t.length-e:n>t.length-e&&al(1746,{length:n,range:t.length-e}),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Tl.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Tl?t.forEach(t=>{e.push(t)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}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(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=Tl.compareSegments(t.get(s),e.get(s));if(0!==n)return n}return dl(t.length,e.length)}static compareSegments(t,e){const n=Tl.isNumericId(t),s=Tl.isNumericId(e);return n&&!s?-1:!n&&s?1:n&&s?Tl.extractNumericId(t).compare(Tl.extractNumericId(e)):pl(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return rB.fromString(t.substring(4,t.length-2))}}class Ol extends Tl{construct(t,e,n){return new Ol(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new vl(bl.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter(t=>t.length>0))}return new Ol(e)}static emptyPath(){return new Ol([])}}const Al=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let Sl=class t extends Tl{construct(e,n,s){return new t(e,n,s)}static isValidIdentifier(t){return Al.test(t)}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 1===this.length&&this.get(0)===Il}static keyField(){return new t([Il])}static fromServerFormat(e){const n=[];let s="",r=0;const i=()=>{if(0===s.length)throw new vl(bl.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(s),s=""};let o=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new vl(bl.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new vl(bl.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);s+=t,r+=2}else"`"===t?(o=!o,r++):"."!==t||o?(s+=t,r++):(i(),r++)}if(i(),o)throw new vl(bl.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(n)}static emptyPath(){return new t([])}};class Rl{constructor(t){this.fields=t,t.sort(Sl.comparator)}static empty(){return new Rl([])}unionWith(t){let e=new Dl(Sl.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new Rl(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ml(this.fields,t.fields,(t,e)=>t.isEqual(e))}}function Nl(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function xl(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function kl(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}class Ll{constructor(t){this.path=t}static fromPath(t){return new Ll(Ol.fromString(t))}static fromName(t){return new Ll(Ol.fromString(t).popFirst(5))}static empty(){return new Ll(Ol.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Ol.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Ol.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Ll(new Ol(t.slice()))}}function Fl(t){if(!Ll.isDocumentKey(t))throw new vl(bl.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Pl(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function Ml(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":al(12329,{type:typeof t})}function Gl(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new vl(bl.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ml(t);throw new vl(bl.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Hl(t,e){const n={typeString:t};return e&&(n.value=e),n}function Ul(t,e){if(!Pl(t))throw new vl(bl.INVALID_ARGUMENT,"JSON must be an object");let n;for(const s in e)if(e[s]){const r=e[s].typeString,i="value"in e[s]?{value:e[s].value}:void 0;if(!(s in t)){n=`JSON missing required field: '${s}'`;break}const o=t[s];if(r&&typeof o!==r){n=`JSON field '${s}' must be a ${r}.`;break}if(void 0!==i&&o!==i.value){n=`Expected '${s}' field to equal '${i.value}'`;break}}if(n)throw new vl(bl.INVALID_ARGUMENT,n);return!0}const Vl=-62135596800,jl=1e6;class $l{static now(){return $l.fromMillis(Date.now())}static fromDate(t){return $l.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor((t-1e3*e)*jl);return new $l(e,n)}static fromInstant(t){if(!t||"bigint"!=typeof t.t)throw new vl(bl.INVALID_ARGUMENT,"Invalid Temporal.Instant object provided.");return $l._fromEpochNanoseconds(t.t)}static _fromEpochNanoseconds(t){let e,n;if(t>=0n)e=Number(t/1000000000n),n=Number(t%1000000000n);else{const s=t%1000000000n;0n===s?(e=Number(t/1000000000n),n=0):(e=Number(t/1000000000n-1n),n=Number(s+1000000000n))}return new $l(e,n)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new vl(bl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new vl(bl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<Vl)throw new vl(bl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new vl(bl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/jl}toInstant(){if("undefined"==typeof Temporal||!Temporal.Instant)throw new vl(bl.FAILED_PRECONDITION,"The Temporal object is not available in the current environment.");const t=1000000000n*BigInt(this.seconds)+BigInt(this.nanoseconds);return Temporal.Instant.__PRIVATE_fromEpochNanoseconds(t)}_compareTo(t){return this.seconds===t.seconds?dl(this.nanoseconds,t.nanoseconds):dl(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:$l._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(Ul(t,$l._jsonSchema))return new $l(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-Vl;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}$l._jsonSchemaVersion="firestore/timestamp/1.0",$l._jsonSchema={type:Hl("string",$l._jsonSchemaVersion),seconds:Hl("number"),nanoseconds:Hl("number")};class Jl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ql{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new Jl("Invalid base64 string: "+t):t}}(t);return new ql(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new ql(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return dl(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}ql.EMPTY_BYTE_STRING=new ql("");const zl=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Kl(t){if(cl(!!t,39018),"string"==typeof t){let e=0;const n=zl.exec(t);if(cl(!!n,46558,{timestamp:t}),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:Ql(t.seconds),nanos:Ql(t.nanos)}}function Ql(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Wl(t){return"string"==typeof t?ql.fromBase64String(t):ql.fromUint8Array(t)}const Yl="server_timestamp",Xl="__type__",Zl="__previous_value__",tu="__local_write_time__";function eu(t){const e=(t?.mapValue?.fields||{})[Xl]?.stringValue;return e===Yl}function nu(t){const e=t.mapValue.fields[Zl];return eu(e)?nu(e):e}function su(t){const e=Kl(t.mapValue.fields[tu].timestampValue);return new $l(e.seconds,e.nanos)}class ru{constructor(t,e,n,s,r,i,o,a,B,c,l,u,h){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=B,this.isUsingEmulator=c,this.apiKey=l,this._customHeaders=u,this.grpcFlowControlWindow=h}}const iu="(default)";class ou{constructor(t,e){this.projectId=t,this.database=e||iu}static empty(){return new ou("","")}get isDefaultDatabase(){return this.database===iu}isEqual(t){return t instanceof ou&&t.projectId===this.projectId&&t.database===this.database}}function au(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new vl(bl.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ou(t.options.projectId,e)}function Bu(t){return null==t}function cu(t){return 0===t&&1/t==-1/0}const lu="__type__",uu="__max__",hu={},du="__vector__",pu="value",fu={nullValue:"NULL_VALUE"},Cu={booleanValue:!0},gu={booleanValue:!1};function mu(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?eu(t)?4:function(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===uu}(t)?9007199254740991:ku(t)?10:11:al(28295,{value:t})}function wu(t,e,n){if(t===e)return!0;const s=mu(t);if(s!==mu(e))return!1;switch(s){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return su(t).isEqual(su(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=Kl(t.timestampValue),s=Kl(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Wl(t.bytesValue).isEqual(Wl(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ql(t.geoPointValue.latitude)===Ql(e.geoPointValue.latitude)&&Ql(t.geoPointValue.longitude)===Ql(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e,n){if("integerValue"in t&&"integerValue"in e)return Ql(t.integerValue)===Ql(e.integerValue);let s,r;if("doubleValue"in t&&"doubleValue"in e)s=Ql(t.doubleValue),r=Ql(e.doubleValue);else{if(!n?.i)return!1;s=Ql(t.integerValue??t.doubleValue),r=Ql(e.integerValue??e.doubleValue)}return s===r?!!n?.o||cu(s)===cu(r):!(void 0!==n&&!n.u)&&isNaN(s)&&isNaN(r)}(t,e,n);case 9:return ml(t.arrayValue.values||[],e.arrayValue.values||[],(t,e)=>wu(t,e,n));case 10:case 11:return function(t,e,n){const s=t.mapValue.fields||{},r=e.mapValue.fields||{};if(Nl(s)!==Nl(r))return!1;for(const t in s)if(s.hasOwnProperty(t)&&(void 0===r[t]||!wu(s[t],r[t],n)))return!1;return!0}(t,e,n);default:return al(52216,{left:t})}}function yu(t,e){return void 0!==(t.values||[]).find(t=>wu(t,e))}function Eu(t,e){if(t===e)return 0;const n=mu(t),s=mu(e);if(n!==s)return dl(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return dl(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ql(t.integerValue||t.doubleValue),s=Ql(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return Du(t.timestampValue,e.timestampValue);case 4:return Du(su(t),su(e));case 5:return pl(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Wl(t),s=Wl(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=dl(n[t],s[t]);if(0!==e)return e}return dl(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=dl(Ql(t.latitude),Ql(e.latitude));return 0!==n?n:dl(Ql(t.longitude),Ql(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return _u(t.arrayValue,e.arrayValue);case 10:return function(t,e){const n=t.fields||{},s=e.fields||{},r=n[pu]?.arrayValue,i=s[pu]?.arrayValue,o=dl(r?.values?.length||0,i?.values?.length||0);return 0!==o?o:_u(r,i)}(t.mapValue,e.mapValue);case 11:return function(t,e){if(t===hu&&e===hu)return 0;if(t===hu)return 1;if(e===hu)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=pl(s[t],i[t]);if(0!==e)return e;const o=Eu(n[s[t]],r[i[t]]);if(0!==o)return o}return dl(s.length,i.length)}(t.mapValue,e.mapValue);default:throw al(23264,{l:n})}}function Du(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return dl(t,e);const n=Kl(t),s=Kl(e),r=dl(n.seconds,s.seconds);return 0!==r?r:dl(n.nanos,s.nanos)}function _u(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Eu(n[t],s[t]);if(void 0!==e&&0!==e)return e}return dl(n.length,s.length)}function bu(t){return vu(t)}function vu(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(t){const e=Kl(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(t){return Wl(t).toBase64()}(t.bytesValue):"referenceValue"in t?function(t){return Ll.fromName(t).toString()}(t.referenceValue):"geoPointValue"in t?function(t){return`geo(${t.latitude},${t.longitude})`}(t.geoPointValue):"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=vu(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${vu(t.fields[r])}`;return n+"}"}(t.mapValue):al(61005,{value:t})}function Iu(t){switch(mu(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=nu(t);return e?16+Iu(e):16;case 5:return 2*t.stringValue.length;case 6:return Wl(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return function(t){return(t.values||[]).reduce((t,e)=>t+Iu(e),0)}(t.arrayValue);case 10:case 11:return function(t){let e=0;return xl(t.fields,(t,n)=>{e+=t.length+Iu(n)}),e}(t.mapValue);default:throw al(13486,{value:t})}}function Tu(t){return!!t&&"integerValue"in t}function Ou(t){return!!t&&"doubleValue"in t}function Au(t){return Tu(t)||Ou(t)}function Su(t){return!!t&&"arrayValue"in t}function Ru(t){return!!t&&"nullValue"in t}function Nu(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function xu(t){return!!t&&"mapValue"in t}function ku(t){const e=(t?.mapValue?.fields||{})[lu]?.stringValue;return e===du}function Lu(t){return(t?.mapValue?.fields||{})[pu]?.arrayValue}function Fu(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return xl(t.mapValue.fields,(t,n)=>e.mapValue.fields[t]=Fu(n)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Fu(t.arrayValue.values[n]);return e}return{...t}}class Pu{constructor(t){this.value=t}static empty(){return new Pu({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!xu(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Fu(e)}setAll(t){let e=Sl.emptyPath(),n={},s=[];t.forEach((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=Fu(t):s.push(r.lastSegment())});const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());xu(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return wu(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let s=e.mapValue.fields[t.get(n)];xu(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){xl(e,(e,n)=>t[e]=n);for(const e of n)delete t[e]}clone(){return new Pu(Fu(this.value))}}function Mu(t){const e=[];return xl(t.fields,(t,n)=>{const s=new Sl([t]);if(xu(n)){const t=Mu(n.mapValue).fields;if(0===t.length)e.push(s);else for(const n of t)e.push(s.child(n))}else e.push(s)}),new Rl(e)}function Gu(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:cu(e)?"-0":e}}function Hu(t){return{integerValue:""+t}}function Uu(t,e,n){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!cu(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Hu(e):Gu(t,e)}class Vu{constructor(){this._=void 0}}function ju(t,e,n){return t instanceof qu?function(t,e){const n={fields:{[Xl]:{stringValue:Yl},[tu]:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&eu(e)&&(e=nu(e)),e&&(n.fields[Zl]=e),{mapValue:n}}(n,e):t instanceof zu?Ku(t,e):t instanceof Qu?Wu(t,e):t instanceof Xu?function(t,e){const n=Ju(t,e),s=nh(n)+nh(t.h);return Tu(n)&&Tu(t.h)?Hu(s):Gu(t.serializer,s)}(t,e):t instanceof Zu?function(t,e){return eh(t,e,Math.min)}(t,e):t instanceof th?function(t,e){return eh(t,e,Math.max)}(t,e):void 0}function $u(t,e,n){return t instanceof zu?Ku(t,e):t instanceof Qu?Wu(t,e):n}function Ju(t,e){return t instanceof Xu?Au(e)?e:{integerValue:0}:null}class qu extends Vu{}class zu extends Vu{constructor(t){super(),this.elements=t}}function Ku(t,e){const n=sh(e);for(const e of t.elements)n.some(t=>wu(t,e))||n.push(e);return{arrayValue:{values:n}}}class Qu extends Vu{constructor(t){super(),this.elements=t}}function Wu(t,e){let n=sh(e);for(const e of t.elements)n=n.filter(t=>!wu(t,e));return{arrayValue:{values:n}}}class Yu extends Vu{constructor(t,e){super(),this.serializer=t,this.h=e}}class Xu extends Yu{}class Zu extends Yu{}class th extends Yu{}function eh(t,e,n){if(!Au(e))return t.h;const s=n(nh(e),nh(t.h));return Tu(e)&&Tu(t.h)?Hu(s):Gu(t.serializer,s)}function nh(t){return Ql(t.integerValue||t.doubleValue)}function sh(t){return Su(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class rh{constructor(t,e){this.version=t,this.transformResults=e}}class ih{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ih}static exists(t){return new ih(void 0,t)}static updateTime(t){return new ih(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function oh(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ah{}function Bh(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new mh(t.key,ih.none()):new dh(t.key,t.data,ih.none());{const n=t.data,s=Pu.empty();let r=new Dl(Sl.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new ph(t.key,s,new Rl(r.toArray()),ih.none())}}function ch(t,e,n){t instanceof dh?function(t,e,n){const s=t.value.clone(),r=Ch(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof ph?function(t,e,n){if(!oh(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=Ch(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(fh(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function lh(t,e,n,s){return t instanceof dh?function(t,e,n,s){if(!oh(t.precondition,e))return n;const r=t.value.clone(),i=gh(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof ph?function(t,e,n,s){if(!oh(t.precondition,e))return n;const r=gh(t.fieldTransforms,s,e),i=e.data;return i.setAll(fh(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map(t=>t.field))}(t,e,n,s):function(t,e,n){return oh(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function uh(t,e){let n=null;for(const s of t.fieldTransforms){const t=e.data.field(s.field),r=Ju(s.transform,t||null);null!=r&&(null===n&&(n=Pu.empty()),n.set(s.field,r))}return n||null}function hh(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&ml(t,e,(t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof zu&&e instanceof zu||t instanceof Qu&&e instanceof Qu?ml(t.elements,e.elements,wu):t instanceof Xu&&e instanceof Xu||t instanceof Zu&&e instanceof Zu||t instanceof th&&e instanceof th?wu(t.h,e.h):t instanceof qu&&e instanceof qu}(t.transform,e.transform)}(t,e))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class dh extends ah{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class ph extends ah{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function fh(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}}),e}function Ch(t,e,n){const s=new Map;cl(t.length===n.length,32656,{T:n.length,P:t.length});for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$u(o,a,n[r]))}return s}function gh(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,ju(t,i,e))}return s}class mh extends ah{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class wh extends ah{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class yh{constructor(t,e){this.position=t,this.inclusive=e}}function Eh(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?Ll.comparator(Ll.fromName(o.referenceValue),n.key):Eu(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function Dh(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!wu(t.position[n],e.position[n]))return!1;return!0}class _h{}class bh extends _h{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Rh(t,e,n):"array-contains"===e?new Lh(t,n):"in"===e?new Fh(t,n):"not-in"===e?new Ph(t,n):"array-contains-any"===e?new Mh(t,n):new bh(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Nh(t,n):new xh(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&void 0===e.nullValue&&this.matchesComparison(Eu(e,this.value)):null!==e&&mu(this.value)===mu(e)&&this.matchesComparison(Eu(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return al(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class vh extends _h{constructor(t,e){super(),this.filters=t,this.op=e,this.I=null}static create(t,e){return new vh(t,e)}matches(t){return Ih(this)?void 0===this.filters.find(e=>!e.matches(t)):void 0!==this.filters.find(e=>e.matches(t))}getFlattenedFilters(){return null!==this.I||(this.I=this.filters.reduce((t,e)=>t.concat(e.getFlattenedFilters()),[])),this.I}getFilters(){return Object.assign([],this.filters)}}function Ih(t){return"and"===t.op}function Th(t){return function(t){for(const e of t.filters)if(e instanceof vh)return!1;return!0}(t)&&Ih(t)}function Oh(t){if(t instanceof bh)return t.field.canonicalString()+t.op.toString()+bu(t.value);if(Th(t))return t.filters.map(t=>Oh(t)).join(",");{const e=t.filters.map(t=>Oh(t)).join(",");return`${t.op}(${e})`}}function Ah(t,e){return t instanceof bh?function(t,e){return e instanceof bh&&t.op===e.op&&t.field.isEqual(e.field)&&wu(t.value,e.value)}(t,e):t instanceof vh?function(t,e){return e instanceof vh&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce((t,n,s)=>t&&Ah(n,e.filters[s]),!0)}(t,e):void al(19439)}function Sh(t){return t instanceof bh?function(t){return`${t.field.canonicalString()} ${t.op} ${bu(t.value)}`}(t):t instanceof vh?function(t){return t.op.toString()+" {"+t.getFilters().map(Sh).join(" ,")+"}"}(t):"Filter"}class Rh extends bh{constructor(t,e,n){super(t,e,n),this.key=Ll.fromName(n.referenceValue)}matches(t){const e=Ll.comparator(t.key,this.key);return this.matchesComparison(e)}}class Nh extends bh{constructor(t,e){super(t,"in",e),this.keys=kh("in",e)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}}class xh extends bh{constructor(t,e){super(t,"not-in",e),this.keys=kh("not-in",e)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}}function kh(t,e){return(e.arrayValue?.values||[]).map(t=>Ll.fromName(t.referenceValue))}class Lh extends bh{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Su(e)&&yu(e.arrayValue,this.value)}}class Fh extends bh{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&yu(this.value.arrayValue,e)}}class Ph extends bh{constructor(t,e){super(t,"not-in",e)}matches(t){if(yu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&void 0===e.nullValue&&!yu(this.value.arrayValue,e)}}class Mh extends bh{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Su(e)||!e.arrayValue.values)&&e.arrayValue.values.some(t=>yu(this.value.arrayValue,t))}}class Gh{constructor(t,e="asc"){this.field=t,this.dir=e}}function Hh(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}class Uh{static fromTimestamp(t){return new Uh(t)}static min(){return new Uh(new $l(0,0))}static max(){return new Uh(new $l(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class Vh{constructor(t,e,n,s,r,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=o}static newInvalidDocument(t){return new Vh(t,0,Uh.min(),Uh.min(),Uh.min(),Pu.empty(),0)}static newFoundDocument(t,e,n,s){return new Vh(t,1,e,Uh.min(),n,s,0)}static newNoDocument(t,e){return new Vh(t,2,e,Uh.min(),Uh.min(),Pu.empty(),0)}static newUnknownDocument(t,e){return new Vh(t,3,e,Uh.min(),Uh.min(),Pu.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Uh.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=Pu.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=Pu.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Uh.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof Vh&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new Vh(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}})`}}function jh(t){return new $h(t.readTime,t.key,-1)}class $h{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new $h(Uh.min(),Ll.empty(),-1)}static max(){return new $h(Uh.max(),Ll.empty(),-1)}}function Jh(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Ll.comparator(t.documentKey,e.documentKey),0!==n?n:dl(t.largestBatchId,e.largestBatchId))}class qh{constructor(t,e=null,n=[],s=[],r=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=o,this.R=null}}function zh(t,e=null,n=[],s=[],r=null,i=null,o=null){return new qh(t,e,n,s,r,i,o)}function Kh(t){const e=ll(t);if(null===e.R){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(t=>Oh(t)).join(","),t+="|ob:",t+=e.orderBy.map(t=>function(t){return t.field.canonicalString()+t.dir}(t)).join(","),Bu(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(t=>bu(t)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(t=>bu(t)).join(",")),e.R=t}return e.R}function Qh(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!Hh(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Ah(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Dh(t.startAt,e.startAt)&&Dh(t.endAt,e.endAt)}class Wh{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.A=null,this.V=null,this.m=null,this.startAt,this.endAt}}function Yh(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Xh(t){const e=ll(t);if(null===e.A){e.A=[];const t=new Set;for(const n of e.explicitOrderBy)e.A.push(n),t.add(n.field.canonicalString());const n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",s=function(t){let e=new Dl(Sl.comparator);return t.filters.forEach(t=>{t.getFlattenedFilters().forEach(t=>{t.isInequality()&&(e=e.add(t.field))})}),e}(e);s.forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.A.push(new Gh(s,n))}),t.has(Sl.keyField().canonicalString())||e.A.push(new Gh(Sl.keyField(),n))}return e.A}function Zh(t){const e=ll(t);return e.V||(e.V=function(t,e){if("F"===t.limitType)return zh(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(t=>{const e="desc"===t.dir?"asc":"desc";return new Gh(t.field,e)});const n=t.endAt?new yh(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new yh(t.startAt.position,t.startAt.inclusive):null;return zh(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}}(e,Xh(t))),e.V}function td(t,e,n){return new Wh(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function ed(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map(t=>Sh(t)).join(", ")}]`),Bu(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map(t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t)).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(t=>bu(t)).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(t=>bu(t)).join(",")),`Target(${e})`}(Zh(t))}; limitType=${t.limitType})`}function nd(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Ll.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Xh(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const s=Eh(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Xh(t),e))&&!(t.endAt&&!function(t,e,n){const s=Eh(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Xh(t),e))}(t,e)}function sd(t){return(e,n)=>{let s=!1;for(const r of Xh(t)){const t=rd(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function rd(t,e,n){const s=t.field.isKeyField()?Ll.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Eu(s,r):al(42886)}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return al(19790,{direction:t.dir})}}var id,od;function ad(t){if(void 0===t)return rl("GRPC error has no .code"),bl.UNKNOWN;switch(t){case id.OK:return bl.OK;case id.CANCELLED:return bl.CANCELLED;case id.UNKNOWN:return bl.UNKNOWN;case id.DEADLINE_EXCEEDED:return bl.DEADLINE_EXCEEDED;case id.RESOURCE_EXHAUSTED:return bl.RESOURCE_EXHAUSTED;case id.INTERNAL:return bl.INTERNAL;case id.UNAVAILABLE:return bl.UNAVAILABLE;case id.UNAUTHENTICATED:return bl.UNAUTHENTICATED;case id.INVALID_ARGUMENT:return bl.INVALID_ARGUMENT;case id.NOT_FOUND:return bl.NOT_FOUND;case id.ALREADY_EXISTS:return bl.ALREADY_EXISTS;case id.PERMISSION_DENIED:return bl.PERMISSION_DENIED;case id.FAILED_PRECONDITION:return bl.FAILED_PRECONDITION;case id.ABORTED:return bl.ABORTED;case id.OUT_OF_RANGE:return bl.OUT_OF_RANGE;case id.UNIMPLEMENTED:return bl.UNIMPLEMENTED;case id.DATA_LOSS:return bl.DATA_LOSS;default:return al(39323,{code:t})}}(od=id||(id={}))[od.OK=0]="OK",od[od.CANCELLED=1]="CANCELLED",od[od.UNKNOWN=2]="UNKNOWN",od[od.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",od[od.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",od[od.NOT_FOUND=5]="NOT_FOUND",od[od.ALREADY_EXISTS=6]="ALREADY_EXISTS",od[od.PERMISSION_DENIED=7]="PERMISSION_DENIED",od[od.UNAUTHENTICATED=16]="UNAUTHENTICATED",od[od.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",od[od.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",od[od.ABORTED=10]="ABORTED",od[od.OUT_OF_RANGE=11]="OUT_OF_RANGE",od[od.UNIMPLEMENTED=12]="UNIMPLEMENTED",od[od.INTERNAL=13]="INTERNAL",od[od.UNAVAILABLE=14]="UNAVAILABLE",od[od.DATA_LOSS=15]="DATA_LOSS";class Bd{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,s]of n)if(this.equalsFn(e,t))return s}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0===s)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],t))return 1===n.length?delete this.inner[e]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(t){xl(this.inner,(e,n)=>{for(const[e,s]of n)t(e,s)})}isEmpty(){return kl(this.inner)}size(){return this.innerSize}}const cd=new wl(Ll.comparator);function ld(){return cd}const ud=new wl(Ll.comparator);function hd(...t){let e=ud;for(const n of t)e=e.insert(n.key,n);return e}function dd(t){let e=ud;return t.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function pd(){return Cd()}function fd(){return Cd()}function Cd(){return new Bd(t=>t.toString(),(t,e)=>t.isEqual(e))}const gd=new wl(Ll.comparator),md=new Dl(Ll.comparator);function wd(...t){let e=md;for(const n of t)e=e.add(n);return e}const yd=new Dl(dl);new rB([4294967295,4294967295],0);class Ed{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function Dd(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 _d(t){const e=Kl(t);return new $l(e.seconds,e.nanos)}function bd(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function vd(t,e){return Dd(t,e.toTimestamp())}function Id(t){return cl(!!t,49232),Uh.fromTimestamp(_d(t))}function Td(t,e){return Od(t,e).canonicalString()}function Od(t,e){const n=function(t){return new Ol(["projects",t.projectId,"databases",t.database])}(t).child("documents");return void 0===e?n:n.child(e)}function Ad(t,e){return Td(t.databaseId,e.path)}function Sd(t){const e=function(t){const e=Ol.fromString(t);return cl(function(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}(e),10190,{key:e.toString()}),e}(t);return 4===e.length?Ol.emptyPath():function(t){return cl(t.length>4&&"documents"===t.get(4),29091,{key:t.toString()}),t.popFirst(5)}(e)}function Rd(t,e,n){return{name:Ad(t,e),fields:n.value.mapValue.fields}}function Nd(t){let e=Sd(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){cl(1===s,65062);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=xd(t);return e instanceof vh&&Th(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=function(t){return t.map(t=>function(t){return new Gh(kd(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))}(n.orderBy));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Bu(e)?null:e}(n.limit));let B=null;n.startAt&&(B=function(t){const e=!!t.before,n=t.values||[];return new yh(n,e)}(n.startAt));let c=null;return n.endAt&&(c=function(t){const e=!t.before,n=t.values||[];return new yh(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Wh(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",B,c)}function xd(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=kd(t.unaryFilter.field);return bh.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=kd(t.unaryFilter.field);return bh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=kd(t.unaryFilter.field);return bh.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=kd(t.unaryFilter.field);return bh.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return al(61313);default:return al(60726)}}(t):void 0!==t.fieldFilter?function(t){return bh.create(kd(t.fieldFilter.field),function(t){switch(t){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 al(58110);default:return al(50506)}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return vh.create(t.compositeFilter.filters.map(t=>xd(t)),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return al(1026)}}(t.compositeFilter.op))}(t):al(30097,{filter:t})}function kd(t){return Sl.fromServerFormat(t.fieldPath)}function Ld(t){const e=[];return t.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Fd(t){return!!t&&"function"==typeof t._toProto&&"ProtoValue"===t._protoValueType}function Pd(t,e){const n={fields:{}};return e.forEach((e,s)=>{if("string"!=typeof s)throw new Error(`Cannot encode map with non-string key: ${s}`);n.fields[s]=e._toProto(t)}),{mapValue:n}}function Md(t){return{stringValue:t}}function Gd(t){return new Ed(t,!0)}class Hd{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Hd(ql.fromBase64String(t))}catch(t){throw new vl(bl.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Hd(ql.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}toJSON(){return{type:Hd._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(Ul(t,Hd._jsonSchema))return Hd.fromBase64String(t.bytes)}}Hd._jsonSchemaVersion="firestore/bytes/1.0",Hd._jsonSchema={type:Hl("string",Hd._jsonSchemaVersion),bytes:Hl("string")};class Ud{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new vl(bl.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Sl(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}class Vd{constructor(t){this._methodName=t}}class jd{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new vl(bl.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new vl(bl.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return dl(this._lat,t._lat)||dl(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:jd._jsonSchemaVersion}}static fromJSON(t){if(Ul(t,jd._jsonSchema))return new jd(t.latitude,t.longitude)}}jd._jsonSchemaVersion="firestore/geoPoint/1.0",jd._jsonSchema={type:Hl("string",jd._jsonSchemaVersion),latitude:Hl("number"),longitude:Hl("number")};class $d{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}$d.UNAUTHENTICATED=new $d(null),$d.GOOGLE_CREDENTIALS=new $d("google-credentials-uid"),$d.FIRST_PARTY=new $d("first-party-uid"),$d.MOCK_USER=new $d("mock-user");class Jd{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}class qd{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zd{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e($d.UNAUTHENTICATED))}shutdown(){}}class Kd{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}}class Qd{constructor(t){this.De=t,this.currentUser=$d.UNAUTHENTICATED,this.xe=0,this.forceRefresh=!1,this.auth=null}start(t,e){cl(void 0===this.Ce,42304);let n=this.xe;const s=t=>this.xe!==n?(n=this.xe,e(t)):Promise.resolve();let r=new Jd;this.Ce=()=>{this.xe++,this.currentUser=this.Fe(),r.resolve(),r=new Jd,t.enqueueRetryable(()=>s(this.currentUser))};const i=()=>{const e=r;t.enqueueRetryable(async()=>{await e.promise,await s(this.currentUser)})},o=t=>{sl("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.Ce&&(this.auth.addAuthTokenListener(this.Ce),i())};this.De.onInit(t=>o(t)),setTimeout(()=>{if(!this.auth){const t=this.De.getImmediate({optional:!0});t?o(t):(sl("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Jd)}},0),i()}getToken(){const t=this.xe,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.xe!==t?(sl("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(cl("string"==typeof e.accessToken,31837,{Oe:e}),new qd(e.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.Ce&&this.auth.removeAuthTokenListener(this.Ce),this.Ce=void 0}Fe(){const t=this.auth&&this.auth.getUid();return cl(null===t||"string"==typeof t,2055,{Me:t}),new $d(t)}}class Wd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n,this.type="FirstParty",this.user=$d.FIRST_PARTY,this.Ue=new Map}ke(){return this.Be?this.Be():null}get headers(){this.Ue.set("X-Goog-AuthUser",this.Ne);const t=this.ke();return t&&this.Ue.set("Authorization",t),this.Le&&this.Ue.set("X-Goog-Iam-Authorization-Token",this.Le),this.Ue}}class Yd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n}getToken(){return Promise.resolve(new Wd(this.Ne,this.Le,this.Be))}start(t,e){t.enqueueRetryable(()=>e($d.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Xd{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Zd{constructor(t,e){this.qe=e,this.forceRefresh=!1,this.appCheck=null,this.$e=null,this.Ke=null,yr(t)&&t.settings.appCheckToken&&(this.Ke=t.settings.appCheckToken)}start(t,e){cl(void 0===this.Ce,3512);const n=t=>{null!=t.error&&sl("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.$e;return this.$e=t.token,sl("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.Ce=e=>{t.enqueueRetryable(()=>n(e))};const s=t=>{sl("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.Ce&&this.appCheck.addTokenListener(this.Ce)};this.qe.onInit(t=>s(t)),setTimeout(()=>{if(!this.appCheck){const t=this.qe.getImmediate({optional:!0});t?s(t):sl("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.Ke)return Promise.resolve(new Xd(this.Ke));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(t=>t?(cl("string"==typeof t.token,44558,{tokenResult:t}),this.$e=t.token,new Xd(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.Ce&&this.appCheck.removeTokenListener(this.Ce),this.Ce=void 0}}function tp(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}class ep{Qe(t){}shutdown(){}}const np="ConnectivityMonitor";class sp{constructor(){this.We=()=>this.Ge(),this.ze=()=>this.je(),this.He=[],this.Je()}Qe(t){this.He.push(t)}shutdown(){window.removeEventListener("online",this.We),window.removeEventListener("offline",this.ze)}Je(){window.addEventListener("online",this.We),window.addEventListener("offline",this.ze)}Ge(){sl(np,"Network connectivity changed: AVAILABLE");for(const t of this.He)t(0)}je(){sl(np,"Network connectivity changed: UNAVAILABLE");for(const t of this.He)t(1)}static Ye(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let rp=null;function ip(){return null===rp?rp=268435456+Math.round(2147483648*Math.random()):rp++,"0x"+rp.toString(16)}const op="RestConnection",ap={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class Bp{get Ze(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Xe=e+"://"+t.host,this.et=`projects/${n}/databases/${s}`,this.tt=this.databaseId.database===iu?`project_id=${n}`:`project_id=${n}&database_id=${s}`}nt(t,e,n,s,r){const i=ip(),o=this.rt(t,e.toUriEncodedString());sl(op,`Sending RPC '${t}' ${i}:`,o,n);const a={"google-cloud-resource-prefix":this.et,"x-goog-request-params":this.tt};this.it(a,s,r);const{host:B}=new URL(o),c=as(B);return this.st(t,o,a,n,c).then(e=>(sl(op,`Received RPC '${t}' ${i}: `,e),e),e=>{throw il(op,`RPC '${t}' ${i} failed with error: `,e,"url: ",o,"request:",n),e})}_t(t,e,n,s,r,i){return this.nt(t,e,n,s,r)}it(t,e,n){if(t["X-Goog-Api-Client"]="gl-js/ fire/"+tl,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach((e,n)=>t[n]=e),n&&n.headers.forEach((e,n)=>t[n]=e),this.databaseInfo._customHeaders)for(const e of Object.keys(this.databaseInfo._customHeaders))t[e]=this.databaseInfo._customHeaders[e]}rt(t,e){const n=ap[t];let s=`${this.Xe}/v1/${e}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}class cp{constructor(t){this.ot=t.ot,this.ut=t.ut}ct(t){this.lt=t}Et(t){this.ht=t}Tt(t){this.Pt=t}onMessage(t){this.It=t}close(){this.ut()}send(t){this.ot(t)}Rt(){this.lt()}At(){this.ht()}Vt(t){this.Pt(t)}dt(t){this.It(t)}}const lp="WebChannelConnection",up=(t,e,n)=>{t.listen(e,t=>{try{n(t)}catch(t){setTimeout(()=>{throw t},0)}})};class hp extends Bp{constructor(t){super(t),this.ft=[],this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}static gt(){if(!hp.yt){const t=hB();up(t,uB.STAT_EVENT,t=>{t.stat===lB.PROXY?sl(lp,"STAT_EVENT: detected buffering proxy"):t.stat===lB.NOPROXY&&sl(lp,"STAT_EVENT: detected no buffering proxy")}),hp.yt=!0}}st(t,e,n,s,r){const i=ip();return new Promise((r,o)=>{const a=new oB;a.setWithCredentials(!0),a.listenOnce(BB.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case cB.NO_ERROR:const e=a.getResponseJson();sl(lp,`XHR for RPC '${t}' ${i} received:`,JSON.stringify(e)),r(e);break;case cB.TIMEOUT:sl(lp,`RPC '${t}' ${i} timed out`),o(new vl(bl.DEADLINE_EXCEEDED,"Request time out"));break;case cB.HTTP_ERROR:const n=a.getStatus();if(sl(lp,`RPC '${t}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let t=a.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=t?.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(bl).indexOf(e)>=0?e:bl.UNKNOWN}(e.status);o(new vl(t,e.message))}else o(new vl(bl.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new vl(bl.UNAVAILABLE,"Connection failed."));break;default:al(9055,{wt:t,streamId:i,bt:a.getLastErrorCode(),St:a.getLastError()})}}finally{sl(lp,`RPC '${t}' ${i} completed.`)}});const B=JSON.stringify(s);sl(lp,`RPC '${t}' ${i} sending request:`,s),a.send(e,"POST",B,n,15)})}vt(t,e,n){const s=ip(),r=[this.Xe,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=this.createWebChannelTransport(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},a=this.longPollingOptions.timeoutSeconds;void 0!==a&&(o.longPollingTimeout=Math.round(1e3*a)),this.useFetchStreams&&(o.useFetchStreams=!0),this.it(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const B=r.join("");sl(lp,`Creating RPC '${t}' stream ${s}: ${B}`,o);const c=i.createWebChannel(B,o);this.Dt(c);let l=!1,u=!1;const h=new cp({ot:e=>{u?sl(lp,`Not sending because RPC '${t}' stream ${s} is closed:`,e):(l||(sl(lp,`Opening RPC '${t}' stream ${s} transport.`),c.open(),l=!0),sl(lp,`RPC '${t}' stream ${s} sending:`,e),c.send(e))},ut:()=>c.close()});return up(c,aB.EventType.OPEN,()=>{u||(sl(lp,`RPC '${t}' stream ${s} transport opened.`),h.Rt())}),up(c,aB.EventType.CLOSE,()=>{u||(u=!0,sl(lp,`RPC '${t}' stream ${s} transport closed`),h.Vt(),this.xt(c))}),up(c,aB.EventType.ERROR,e=>{u||(u=!0,il(lp,`RPC '${t}' stream ${s} transport errored. Name:`,e.name,"Message:",e.message),h.Vt(new vl(bl.UNAVAILABLE,"The operation could not be completed")))}),up(c,aB.EventType.MESSAGE,e=>{if(!u){const n=e.data[0];cl(!!n,16349);const r=n,i=r?.error||r[0]?.error;if(i){sl(lp,`RPC '${t}' stream ${s} received error:`,i);const e=i.status;let n=function(t){const e=id[t];if(void 0!==e)return ad(e)}(e),r=i.message;"NOT_FOUND"===e&&r.includes("database")&&r.includes("does not exist")&&r.includes(this.databaseId.database)&&il(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=bl.INTERNAL,r="Unknown error status: "+e+" with message "+i.message),u=!0,h.Vt(new vl(n,r)),c.close()}else sl(lp,`RPC '${t}' stream ${s} received:`,n),h.dt(n)}}),hp.gt(),setTimeout(()=>{h.At()},0),h}terminate(){this.ft.forEach(t=>t.close()),this.ft=[]}Dt(t){this.ft.push(t)}xt(t){this.ft=this.ft.filter(e=>e===t)}it(t,e,n){super.it(t,e,n),this.databaseInfo.apiKey&&(t["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return dB()}}hp.yt=!1;class dp{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Ct=t,this.timerId=e,this.Ft=n,this.Ot=s,this.Mt=r,this.Nt=0,this.Lt=null,this.Bt=Date.now(),this.reset()}reset(){this.Nt=0}Ut(){this.Nt=this.Mt}kt(t){this.cancel();const e=Math.floor(this.Nt+this.qt()),n=Math.max(0,Date.now()-this.Bt),s=Math.max(0,e-n);s>0&&sl("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Nt} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.Lt=this.Ct.enqueueAfterDelay(this.timerId,s,()=>(this.Bt=Date.now(),t())),this.Nt*=this.Ot,this.Nt<this.Ft&&(this.Nt=this.Ft),this.Nt>this.Mt&&(this.Nt=this.Mt)}$t(){null!==this.Lt&&(this.Lt.skipDelay(),this.Lt=null)}cancel(){null!==this.Lt&&(this.Lt.cancel(),this.Lt=null)}qt(){return(Math.random()-.5)*this.Nt}}const pp="PersistentStream";class fp{constructor(t,e,n,s,r,i,o,a){this.Ct=t,this.Kt=n,this.Qt=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Wt=0,this.Gt=null,this.zt=null,this.stream=null,this.jt=0,this.Ht=new dp(t,e)}Jt(){return 1===this.state||5===this.state||this.Yt()}Yt(){return 2===this.state||3===this.state}start(){this.jt=0,4!==this.state?this.auth():this.Zt()}async stop(){this.Jt()&&await this.close(0)}Xt(){this.state=0,this.Ht.reset()}en(){this.Yt()&&null===this.Gt&&(this.Gt=this.Ct.enqueueAfterDelay(this.Kt,6e4,()=>this.tn()))}nn(t){this.rn(),this.stream.send(t)}async tn(){if(this.Yt())return this.close(0)}rn(){this.Gt&&(this.Gt.cancel(),this.Gt=null)}sn(){this.zt&&(this.zt.cancel(),this.zt=null)}async close(t,e){this.rn(),this.sn(),this.Ht.cancel(),this.Wt++,4!==t?this.Ht.reset():e&&e.code===bl.RESOURCE_EXHAUSTED?(rl(e.toString()),rl("Using maximum backoff delay to prevent overloading the backend."),this.Ht.Ut()):e&&e.code===bl.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this._n(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Tt(e)}_n(){}auth(){this.state=1;const t=this.an(this.Wt),e=this.Wt;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([t,n])=>{this.Wt===e&&this.un(t,n)},e=>{t(()=>{const t=new vl(bl.UNKNOWN,"Fetching auth token failed: "+e.message);return this.cn(t)})})}un(t,e){const n=this.an(this.Wt);this.stream=this.En(t,e),this.stream.ct(()=>{n(()=>this.listener.ct())}),this.stream.Et(()=>{n(()=>(this.state=2,this.zt=this.Ct.enqueueAfterDelay(this.Qt,1e4,()=>(this.Yt()&&(this.state=3),Promise.resolve())),this.listener.Et()))}),this.stream.Tt(t=>{n(()=>this.cn(t))}),this.stream.onMessage(t=>{n(()=>1==++this.jt?this.hn(t):this.onNext(t))})}Zt(){this.state=5,this.Ht.kt(async()=>{this.state=0,this.start()})}cn(t){return sl(pp,`close with error: ${t}`),this.stream=null,this.close(4,t)}an(t){return e=>{this.Ct.enqueueAndForget(()=>this.Wt===t?e():(sl(pp,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Cp extends fp{constructor(t,e,n,s,r,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,s,i),this.serializer=r}get Rn(){return this.jt>0}start(){this.lastStreamToken=void 0,super.start()}_n(){this.Rn&&this.An([])}En(t,e){return this.connection.vt("Write",t,e)}hn(t){return cl(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,cl(!t.writeResults||0===t.writeResults.length,55816),this.listener.Vn()}onNext(t){cl(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.Ht.reset();const e=function(t,e){return t&&t.length>0?(cl(void 0!==e,14353),t.map(t=>function(t,e){let n=t.updateTime?Id(t.updateTime):Id(e);return n.isEqual(Uh.min())&&(n=Id(e)),new rh(n,t.transformResults||[])}(t,e))):[]}(t.writeResults,t.commitTime),n=Id(t.commitTime);return this.listener.dn(n,e)}fn(){const t={};t.database=function(t){return new Ol(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}(this.serializer),this.nn(t)}An(t){const e={streamToken:this.lastStreamToken,writes:t.map(t=>function(t,e){let n;if(e instanceof dh)n={update:Rd(t,e.key,e.value)};else if(e instanceof mh)n={delete:Ad(t,e.key)};else if(e instanceof ph)n={update:Rd(t,e.key,e.data),updateMask:Ld(e.fieldMask)};else{if(!(e instanceof wh))return al(16599,{be:e.type});n={verify:Ad(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(t=>function(t,e){const n=e.transform;if(n instanceof qu)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof zu)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qu)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Xu)return{fieldPath:e.field.canonicalString(),increment:n.h};if(n instanceof Zu)return{fieldPath:e.field.canonicalString(),minimum:n.h};if(n instanceof th)return{fieldPath:e.field.canonicalString(),maximum:n.h};throw al(20930,{transform:e.transform})}(0,t))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:vd(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:al(27497)}(t,e.precondition)),n}(this.serializer,t))};this.nn(e)}}class gp{}class mp extends gp{constructor(t,e,n,s){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=s,this.mn=!1}pn(){if(this.mn)throw new vl(bl.FAILED_PRECONDITION,"The client has already been terminated.")}nt(t,e,n,s){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,i])=>this.connection.nt(t,Od(e,n),s,r,i)).catch(t=>{throw"FirebaseError"===t.name?(t.code===bl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new vl(bl.UNKNOWN,t.toString())})}_t(t,e,n,s,r){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection._t(t,Od(e,n),s,i,o,r)).catch(t=>{throw"FirebaseError"===t.name?(t.code===bl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new vl(bl.UNKNOWN,t.toString())})}terminate(){this.mn=!0,this.connection.terminate()}}const wp=new Map;const yp={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Ep=41943040;class Dp{static withCacheSize(t){return new Dp(t,Dp.DEFAULT_COLLECTION_PERCENTILE,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}}Dp.DEFAULT_COLLECTION_PERCENTILE=10,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Dp.DEFAULT=new Dp(Ep,Dp.DEFAULT_COLLECTION_PERCENTILE,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Dp.DISABLED=new Dp(-1,0,0);class _p{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.gn(t),this.yn=t=>e.writeSequenceNumber(t))}gn(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.yn&&this.yn(t),t}}_p.wn=-1;class bp{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}}async function vp(t){if(t.code!==bl.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;sl("LocalStore","Unexpectedly lost primary lease")}class Ip{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&al(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new Ip((n,s)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,s)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,s)}})}toPromise(){return new Promise((t,e)=>{this.next(t,e)})}wrapUserFunction(t){try{const e=t();return e instanceof Ip?e:Ip.resolve(e)}catch(t){return Ip.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction(()=>t(e)):Ip.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction(()=>t(e)):Ip.reject(e)}static resolve(t){return new Ip((e,n)=>{e(t)})}static reject(t){return new Ip((e,n)=>{n(t)})}static waitFor(t){return new Ip((e,n)=>{let s=0,r=0,i=!1;t.forEach(t=>{++s,t.next(()=>{++r,i&&r===s&&e()},t=>n(t))}),i=!0,r===s&&e()})}static or(t){let e=Ip.resolve(!1);for(const n of t)e=e.next(t=>t?Ip.resolve(t):n());return e}static forEach(t,e){const n=[];return t.forEach((t,s)=>{n.push(e.call(this,t,s))}),this.waitFor(n)}static mapArray(t,e){return new Ip((n,s)=>{const r=t.length,i=new Array(r);let o=0;for(let a=0;a<r;a++){const B=a;e(t[B]).next(t=>{i[B]=t,++o,o===r&&n(i)},t=>s(t))}})}static doWhile(t,e){return new Ip((n,s)=>{const r=()=>{!0===t()?e().next(()=>{r()},s):n()};r()})}}function Tp(t){return"IndexedDbTransactionError"===t.name}const Op="LruGarbageCollector";function Ap([t,e],[n,s]){const r=dl(t,n);return 0===r?dl(e,s):r}class Sp{constructor(t){this.Yn=t,this.buffer=new Dl(Ap),this.Zn=0}Xn(){return++this.Zn}er(t){const e=[t,this.Xn()];if(this.buffer.size<this.Yn)this.buffer=this.buffer.add(e);else{const t=this.buffer.last();Ap(e,t)<0&&(this.buffer=this.buffer.delete(t).add(e))}}get maxValue(){return this.buffer.last()[0]}}class Rp{constructor(t,e,n){this.garbageCollector=t,this.asyncQueue=e,this.localStore=n,this.tr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.nr(6e4)}stop(){this.tr&&(this.tr.cancel(),this.tr=null)}get started(){return null!==this.tr}nr(t){sl(Op,`Garbage collection scheduled in ${t}ms`),this.tr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,async()=>{this.tr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Tp(t)?sl(Op,"Ignoring IndexedDB error during garbage collection: ",t):await vp(t)}await this.nr(3e5)})}}class Np{constructor(t,e){this.rr=t,this.params=e}calculateTargetCount(t,e){return this.rr.ir(t).next(t=>Math.floor(e/100*t))}nthSequenceNumber(t,e){if(0===e)return Ip.resolve(_p.wn);const n=new Sp(e);return this.rr.forEachTarget(t,t=>n.er(t.sequenceNumber)).next(()=>this.rr.sr(t,t=>n.er(t))).next(()=>n.maxValue)}removeTargets(t,e,n){return this.rr.removeTargets(t,e,n)}removeOrphanedDocuments(t,e){return this.rr.removeOrphanedDocuments(t,e)}collect(t,e){return-1===this.params.cacheSizeCollectionThreshold?(sl("LruGarbageCollector","Garbage collection skipped; disabled"),Ip.resolve(yp)):this.getCacheSize(t).next(n=>n<this.params.cacheSizeCollectionThreshold?(sl("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),yp):this._r(t,e))}getCacheSize(t){return this.rr.getCacheSize(t)}_r(t,e){let n,s,r,i,o,a,B;const c=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(e=>(e>this.params.maximumSequenceNumbersToCollect?(sl("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),s=this.params.maximumSequenceNumbersToCollect):s=e,i=Date.now(),this.nthSequenceNumber(t,s))).next(s=>(n=s,o=Date.now(),this.removeTargets(t,n,e))).next(e=>(r=e,a=Date.now(),this.removeOrphanedDocuments(t,n))).next(t=>(B=Date.now(),nl()<=ds.DEBUG&&sl("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-c}ms\n\tDetermined least recently used ${s} in `+(o-i)+"ms\n"+`\tRemoved ${r} targets in `+(a-o)+"ms\n"+`\tRemoved ${t} documents in `+(B-a)+"ms\n"+`Total Duration: ${B-c}ms`),Ip.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:r,documentsRemoved:t})))}}const xp="firestore.googleapis.com",kp=!0;class Lp{constructor(t){if(void 0===t.host){if(void 0!==t.ssl)throw new vl(bl.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=xp,this.ssl=kp}else this.host=t.host,this.ssl=t.ssl??kp;if(this.isUsingEmulator=void 0!==t.emulatorOptions,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t._customHeaders&&(this._customHeaders={...t._customHeaders}),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Ep;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new vl(bl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}if(function(t,e,n,s){if(!0===e&&!0===s)throw new vl(bl.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=tp(t.experimentalLongPollingOptions??{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams,void 0!==t.grpcFlowControlWindow){if("number"!=typeof t.grpcFlowControlWindow||t.grpcFlowControlWindow<=0||t.grpcFlowControlWindow>2147483647||!Number.isInteger(t.grpcFlowControlWindow))throw new vl(bl.INVALID_ARGUMENT,"grpcFlowControlWindow must be a positive integer and cannot exceed 2147483647");this.grpcFlowControlWindow=t.grpcFlowControlWindow}}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams&&this.grpcFlowControlWindow===t.grpcFlowControlWindow&&function(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n)if(t[s]!==e[s])return!1;return!0}(this._customHeaders,t._customHeaders)}}let Fp=class{constructor(t,e,n,s){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Lp({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new vl(bl.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new vl(bl.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 Lp(t),this._emulatorOptions=t.emulatorOptions||{},void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zd;switch(t.type){case"firstParty":return new Yd(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new vl(bl.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=wp.get(t);e&&(sl("ComponentProvider","Removing Datastore"),wp.delete(t),e.terminate())}(this),Promise.resolve()}};function Pp(t,e,n,s={}){t=Gl(t,Fp);const r=as(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;r&&Bs(`https://${a}`),i.host!==xp&&i.host!==a&&il("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const B={...i,host:a,ssl:r,emulatorOptions:s};if(!Xn(B,o)&&(t._setSettings(B),s.mockUserToken)){let e,n;if("string"==typeof s.mockUserToken)e=s.mockUserToken,n=$d.MOCK_USER;else{e=jn(s.mockUserToken,t._app?.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new vl(bl.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new $d(r)}t._authCredentials=new Kd(new qd(e,n))}}class Mp{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Mp(this.firestore,t,this._query)}}class Gp{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Hp(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Gp(this.firestore,t,this._key)}toJSON(){return{type:Gp._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,n){if(Ul(e,Gp._jsonSchema))return new Gp(t,n||null,new Ll(Ol.fromString(e.referencePath)))}}Gp._jsonSchemaVersion="firestore/documentReference/1.0",Gp._jsonSchema={type:Hl("string",Gp._jsonSchemaVersion),referencePath:Hl("string")};class Hp extends Mp{constructor(t,e,n){super(t,e,function(t){return new Wh(t)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Gp(this.firestore,null,new Ll(t))}withConverter(t){return new Hp(this.firestore,t,this._path)}}function Up(t,e,...n){if(t=os(t),1===arguments.length&&(e=hl.newId()),function(t,e,n){if(!n)throw new vl(bl.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}("doc","path",e),t instanceof Fp){const s=Ol.fromString(e,...n);return Fl(s),new Gp(t,null,new Ll(s))}{if(!(t instanceof Gp||t instanceof Hp))throw new vl(bl.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(Ol.fromString(e,...n));return Fl(s),new Gp(t.firestore,t instanceof Hp?t.converter:null,new Ll(s))}}class Vp{constructor(t){this._values=(t||[]).map(t=>t)}toArray(){return this._values.map(t=>t)}isEqual(t){return function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(this._values,t._values)}toJSON(){return{type:Vp._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(Ul(t,Vp._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every(t=>"number"==typeof t))return new Vp(t.vectorValues);throw new vl(bl.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}function jp(t,e,n){if(Jp(t=os(t)))return function(t,e,n){if(!Jp(n)||!Pl(n)){const s=Ml(n);throw"an object"===s?e.createError(t+" a custom object"):e.createError(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return kl(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):xl(t,(t,s)=>{const r=jp(s,e.childContextForField(t));null!=r&&(n[t]=r)}),{mapValue:{fields:n}}}(t,e);if(t instanceof Vd)return function(t,e){if(!function(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw al(40011,{dataSource:t})}}(e.dataSource))throw e.createError(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.createError(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&4!==e.dataSource)throw e.createError("Nested arrays are not supported");return function(t,e){const n=[];let s=0;for(const r of t){let t=jp(r,e.childContextForArray(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=os(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Uu(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=$l.fromDate(t);return{timestampValue:Dd(e.serializer,n)}}if(t instanceof $l){const n=new $l(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Dd(e.serializer,n)}}if($p(t)){const n=$l.fromInstant(t),s=new $l(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:Dd(e.serializer,s)}}if(t instanceof jd)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Hd)return{bytesValue:bd(e.serializer,t._byteString)};if(t instanceof Gp){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.createError(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Td(t.firestore._databaseId||e.databaseId,t._key.path)}}if(t instanceof Vp)return function(t,e){const n=t instanceof Vp?t.toArray():t,s={fields:{[lu]:{stringValue:du},[pu]:{arrayValue:{values:n.map(t=>{if("number"!=typeof t)throw e.createError("VectorValues must only contain numeric values.");return Gu(e.serializer,t)})}}}};return{mapValue:s}}(t,e);if(Fd(t))return t._toProto(e.serializer);throw e.createError(`Unsupported field value: ${Ml(t)}`)}(t,e)}function $p(t){if("object"!=typeof t||null===t)return!1;if("undefined"!=typeof Temporal&&"function"==typeof Temporal.Instant&&t instanceof Temporal.Instant)return!0;const e=t;return"Temporal.Instant"===e[Symbol.toStringTag]&&"bigint"==typeof e.t}function Jp(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof $l||t instanceof jd||t instanceof Hd||t instanceof Gp||t instanceof Vd||t instanceof Vp||$p(t)||Fd(t))}function qp(t,e,n){if((e=os(e))instanceof Ud)return e._internalPath;if("string"==typeof e)return function(t,e){if(e.search(zp)>=0)throw Kp(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t);try{return new Ud(...e.split("."))._internalPath}catch(n){throw Kp(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t)}}(t,e);throw Kp("Field path arguments must be of type string or ",t)}Vp._jsonSchemaVersion="firestore/vectorValue/1.0",Vp._jsonSchema={type:Hl("string",Vp._jsonSchemaVersion),vectorValues:Hl("object")};const zp=new RegExp("[~\\*/\\[\\]]");function Kp(t,e,n,s,r){let i=`Function ${e}() called with invalid data`;i+=". ";return new vl(bl.INVALID_ARGUMENT,i+t+"")}class Qp{constructor(t){this.optionDefinitions=t}_getKnownOptions(t,e){const n=Pu.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const r=this.optionDefinitions[s];if(s in t){const i=t[s];let o;r.nestedOptions&&Pl(i)?o={mapValue:{fields:new Qp(r.nestedOptions).getOptionsProto(e,i)}}:i&&(o=jp(i,e)??void 0),o&&n.set(Sl.fromServerFormat(r.serverName),o)}}return n}getOptionsProto(t,e,n){const s=this._getKnownOptions(e,t);if(n){const e=new Map(function(t,e){const n=[];for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n.push(e(t[s],s,t));return n}(n,(e,n)=>[Sl.fromServerFormat(n),void 0!==e?jp(e,t):null]));s.setAll(e)}return s.value.mapValue.fields??{}}}function Wp(t){let e;return t instanceof Zp?t:(e=Pl(t)?function(t){const e=[];for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n];e.push(af(n)),e.push(Wp(s))}return new cf("map",e,"map")}(t):t instanceof Array?function(t){return function(t,e){return new cf("array",t.map(t=>Wp(t)),e)}(t,"array")}(t):Bf(t,void 0),e)}function Yp(t){if(t instanceof Zp)return t;if(t instanceof Vp)return af(t);if(Array.isArray(t))return af(function(t){return new Vp(t)}(t));throw new Error("Unsupported value: "+typeof t)}function Xp(t){return function(t){return"string"==typeof t}(t)?function(t){return function(t,e){return new rf("string"==typeof t?Il===t?new Ud(Il)._internalPath:qp("field",t):t._internalPath,e)}(t,"field")}(t):Wp(t)}class Zp{constructor(){this._protoValueType="ProtoValue"}add(t){return new cf("add",[this,Wp(t)],"add")}asBoolean(){if(this instanceof lf)return this;if(this instanceof of)return new hf(this);if(this instanceof rf)return new df(this);if(this instanceof cf)return new uf(this);throw new vl("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(t){return new cf("subtract",[this,Wp(t)],"subtract")}multiply(t){return new cf("multiply",[this,Wp(t)],"multiply")}divide(t){return new cf("divide",[this,Wp(t)],"divide")}mod(t){return new cf("mod",[this,Wp(t)],"mod")}equal(t){return new cf("equal",[this,Wp(t)],"equal").asBoolean()}notEqual(t){return new cf("not_equal",[this,Wp(t)],"notEqual").asBoolean()}lessThan(t){return new cf("less_than",[this,Wp(t)],"lessThan").asBoolean()}lessThanOrEqual(t){return new cf("less_than_or_equal",[this,Wp(t)],"lessThanOrEqual").asBoolean()}greaterThan(t){return new cf("greater_than",[this,Wp(t)],"greaterThan").asBoolean()}greaterThanOrEqual(t){return new cf("greater_than_or_equal",[this,Wp(t)],"greaterThanOrEqual").asBoolean()}arrayConcat(t,...e){const n=[t,...e].map(t=>Wp(t));return new cf("array_concat",[this,...n],"arrayConcat")}arrayContains(t){return new cf("array_contains",[this,Wp(t)],"arrayContains").asBoolean()}arrayContainsAll(t){const e=Array.isArray(t)?new sf(t.map(Wp),"arrayContainsAll"):t;return new cf("array_contains_all",[this,e],"arrayContainsAll").asBoolean()}arrayContainsAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"arrayContainsAny"):t;return new cf("array_contains_any",[this,e],"arrayContainsAny").asBoolean()}arrayReverse(){return new cf("array_reverse",[this])}arrayLength(){return new cf("array_length",[this],"arrayLength")}equalAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"equalAny"):t;return new cf("equal_any",[this,e],"equalAny").asBoolean()}notEqualAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"notEqualAny"):t;return new cf("not_equal_any",[this,e],"notEqualAny").asBoolean()}exists(){return new cf("exists",[this],"exists").asBoolean()}charLength(){return new cf("char_length",[this],"charLength")}like(t){return new cf("like",[this,Wp(t)],"like").asBoolean()}regexContains(t){return new cf("regex_contains",[this,Wp(t)],"regexContains").asBoolean()}regexFind(t){return new cf("regex_find",[this,Wp(t)],"regexFind")}regexFindAll(t){return new cf("regex_find_all",[this,Wp(t)],"regexFindAll")}regexMatch(t){return new cf("regex_match",[this,Wp(t)],"regexMatch").asBoolean()}stringContains(t){return new cf("string_contains",[this,Wp(t)],"stringContains").asBoolean()}startsWith(t){return new cf("starts_with",[this,Wp(t)],"startsWith").asBoolean()}endsWith(t){return new cf("ends_with",[this,Wp(t)],"endsWith").asBoolean()}toLower(){return new cf("to_lower",[this],"toLower")}toUpper(){return new cf("to_upper",[this],"toUpper")}trim(t){const e=[this];return t&&e.push(Wp(t)),new cf("trim",e,"trim")}ltrim(t){const e=[this];return t&&e.push(Wp(t)),new cf("ltrim",e,"ltrim")}rtrim(t){const e=[this];return t&&e.push(Wp(t)),new cf("rtrim",e,"rtrim")}type(){return new cf("type",[this])}isType(t){return new cf("is_type",[this,af(t)],"isType").asBoolean()}stringConcat(t,...e){const n=[t,...e].map(Wp);return new cf("string_concat",[this,...n],"stringConcat")}stringIndexOf(t){return new cf("string_index_of",[this,Wp(t)],"stringIndexOf")}stringRepeat(t){return new cf("string_repeat",[this,Wp(t)],"stringRepeat")}stringReplaceAll(t,e){return new cf("string_replace_all",[this,Wp(t),Wp(e)],"stringReplaceAll")}stringReplaceOne(t,e){return new cf("string_replace_one",[this,Wp(t),Wp(e)],"stringReplaceOne")}concat(t,...e){const n=[t,...e].map(Wp);return new cf("concat",[this,...n],"concat")}reverse(){return new cf("reverse",[this],"reverse")}arrayFilter(t,e){return new cf("array_filter",[this,Wp(t),e],"arrayFilter")}arrayTransform(t,e){return new cf("array_transform",[this,Wp(t),e],"arrayTransform")}arrayTransformWithIndex(t,e,n){return new cf("array_transform",[this,Wp(t),Wp(e),n],"arrayTransformWithIndex")}arraySlice(t,e){const n=[this,Wp(t)];return void 0!==e&&n.push(Wp(e)),new cf("array_slice",n,"arraySlice")}arrayFirst(){return new cf("array_first",[this],"arrayFirst")}arrayFirstN(t){return new cf("array_first_n",[this,Wp(t)],"arrayFirstN")}arrayLast(){return new cf("array_last",[this],"arrayLast")}arrayLastN(t){return new cf("array_last_n",[this,Wp(t)],"arrayLastN")}arrayMaximum(){return new cf("maximum",[this],"arrayMaximum")}arrayMaximumN(t){return new cf("maximum_n",[this,Wp(t)],"arrayMaximumN")}arrayMinimum(){return new cf("minimum",[this],"arrayMinimum")}arrayMinimumN(t){return new cf("minimum_n",[this,Wp(t)],"arrayMinimumN")}arrayIndexOf(t){return new cf("array_index_of",[this,Wp(t),Wp("first")],"arrayIndexOf")}arrayLastIndexOf(t){return new cf("array_index_of",[this,Wp(t),Wp("last")],"arrayLastIndexOf")}arrayIndexOfAll(t){return new cf("array_index_of_all",[this,Wp(t)],"arrayIndexOfAll")}byteLength(){return new cf("byte_length",[this],"byteLength")}ceil(){return new cf("ceil",[this])}floor(){return new cf("floor",[this])}abs(){return new cf("abs",[this])}exp(){return new cf("exp",[this])}mapGet(t){return new cf("map_get",[this,af(t)],"mapGet")}mapSet(t,e,...n){const s=[this,Wp(t),Wp(e),...n.map(Wp)];return new cf("map_set",s,"mapSet")}mapKeys(){return new cf("map_keys",[this],"mapKeys")}mapValues(){return new cf("map_values",[this],"mapValues")}mapEntries(){return new cf("map_entries",[this],"mapEntries")}getField(t){return new cf("get_field",[this,Wp(t)],"get_field")}count(){return tf._create("count",[this],"count")}sum(){return tf._create("sum",[this],"sum")}average(){return tf._create("average",[this],"average")}minimum(){return tf._create("minimum",[this],"minimum")}maximum(){return tf._create("maximum",[this],"maximum")}first(){return tf._create("first",[this],"first")}last(){return tf._create("last",[this],"last")}arrayAgg(){return tf._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return tf._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return tf._create("count_distinct",[this],"countDistinct")}logicalMaximum(t,...e){const n=[t,...e];return new cf("maximum",[this,...n.map(Wp)],"logicalMaximum")}logicalMinimum(t,...e){const n=[t,...e];return new cf("minimum",[this,...n.map(Wp)],"minimum")}vectorLength(){return new cf("vector_length",[this],"vectorLength")}cosineDistance(t){return new cf("cosine_distance",[this,Yp(t)],"cosineDistance")}dotProduct(t){return new cf("dot_product",[this,Yp(t)],"dotProduct")}euclideanDistance(t){return new cf("euclidean_distance",[this,Yp(t)],"euclideanDistance")}unixMicrosToTimestamp(){return new cf("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new cf("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new cf("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new cf("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new cf("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new cf("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(t,e){return new cf("timestamp_add",[this,Wp(t),Wp(e)],"timestampAdd")}timestampSubtract(t,e){return new cf("timestamp_subtract",[this,Wp(t),Wp(e)],"timestampSubtract")}timestampDiff(t,e){return new cf("timestamp_diff",[this,Xp(t),Wp(e)],"timestampDiff")}timestampExtract(t,e){const n=[this,Wp(t)];return e&&n.push(Wp(e)),new cf("timestamp_extract",n,"timestampExtract")}documentId(){return new cf("document_id",[this],"documentId")}parent(){return new cf("parent",[this],"parent")}substring(t,e){const n=Wp(t);return new cf("substring",void 0===e?[this,n]:[this,n,Wp(e)],"substring")}arrayGet(t){return new cf("array_get",[this,Wp(t)],"arrayGet")}isError(){return new cf("is_error",[this],"isError").asBoolean()}ifError(t){const e=new cf("if_error",[this,Wp(t)],"ifError");return t instanceof lf?e.asBoolean():e}isAbsent(){return new cf("is_absent",[this],"isAbsent").asBoolean()}mapRemove(t){return new cf("map_remove",[this,Wp(t)],"mapRemove")}mapMerge(t,...e){const n=Wp(t),s=e.map(Wp);return new cf("map_merge",[this,n,...s],"mapMerge")}pow(t){return new cf("pow",[this,Wp(t)])}trunc(t){return void 0===t?new cf("trunc",[this]):new cf("trunc",[this,Wp(t)],"trunc")}round(t){return void 0===t?new cf("round",[this]):new cf("round",[this,Wp(t)],"round")}collectionId(){return new cf("collection_id",[this])}length(){return new cf("length",[this])}ln(){return new cf("ln",[this])}sqrt(){return new cf("sqrt",[this])}stringReverse(){return new cf("string_reverse",[this])}ifAbsent(t){return new cf("if_absent",[this,Wp(t)],"ifAbsent")}ifNull(t){return new cf("if_null",[this,Wp(t)],"ifNull")}coalesce(t,...e){return new cf("coalesce",[this,Wp(t),...e.map(Wp)],"coalesce")}join(t){return new cf("join",[this,Wp(t)],"join")}log10(){return new cf("log10",[this])}arraySum(){return new cf("sum",[this])}split(t){return new cf("split",[this,Wp(t)])}timestampTruncate(t,e){const n=[this,Wp(t)];return e&&n.push(Wp(e)),new cf("timestamp_trunc",n)}ascending(){return function(t){return new pf(Xp(t),"ascending","ascending")}(this)}descending(){return function(t){return new pf(Xp(t),"descending","descending")}(this)}as(t){return new nf(this,t,"as")}}class tf{constructor(t,e){this.name=t,this.params=e,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(t,e,n){const s=new tf(t,e);return s._methodName=n,s}as(t){return new ef(this,t,"as")}_toProto(t){return{functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}}}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t))}}class ef{constructor(t,e,n){this.aggregate=t,this.alias=e,this._methodName=n}_readUserData(t){this.aggregate._readUserData(t)}}class nf{constructor(t,e,n){this.expr=t,this.alias=e,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(t){this.expr._readUserData(t)}}class sf extends Zp{constructor(t,e){super(),this.cr=t,this._methodName=e,this.expressionType="ListOfExpressions"}_toProto(t){return{arrayValue:{values:this.cr.map(e=>e._toProto(t))}}}_readUserData(t){this.cr.forEach(e=>e._readUserData(t))}}class rf extends Zp{constructor(t,e){super(),this.fieldPath=t,this._methodName=e,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(t){return new cf("geo_distance",[this,Wp(t)],"geoDistance")}_toProto(t){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(t){}}class of extends Zp{constructor(t,e){super(),this.value=t,this._methodName=e,this.expressionType="Constant"}static _fromProto(t){const e=new of(t,void 0);return e._protoValue=t,e}_toProto(t){return cl(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,function(t){return"object"==typeof t&&null!==t&&!!("nullValue"in t&&(null===t.nullValue||"NULL_VALUE"===t.nullValue)||"booleanValue"in t&&(null===t.booleanValue||"boolean"==typeof t.booleanValue)||"integerValue"in t&&(null===t.integerValue||"number"==typeof t.integerValue||"string"==typeof t.integerValue)||"doubleValue"in t&&(null===t.doubleValue||"number"==typeof t.doubleValue)||"timestampValue"in t&&(null===t.timestampValue||function(t){return"object"==typeof t&&null!==t&&"seconds"in t&&(null===t.seconds||"number"==typeof t.seconds||"string"==typeof t.seconds)&&"nanos"in t&&(null===t.nanos||"number"==typeof t.nanos)}(t.timestampValue))||"stringValue"in t&&(null===t.stringValue||"string"==typeof t.stringValue)||"bytesValue"in t&&(null===t.bytesValue||t.bytesValue instanceof Uint8Array)||"referenceValue"in t&&(null===t.referenceValue||"string"==typeof t.referenceValue)||"geoPointValue"in t&&(null===t.geoPointValue||function(t){return"object"==typeof t&&null!==t&&"latitude"in t&&(null===t.latitude||"number"==typeof t.latitude)&&"longitude"in t&&(null===t.longitude||"number"==typeof t.longitude)}(t.geoPointValue))||"arrayValue"in t&&(null===t.arrayValue||function(t){return"object"==typeof t&&null!==t&&!(!("values"in t)||null!==t.values&&!Array.isArray(t.values))}(t.arrayValue))||"mapValue"in t&&(null===t.mapValue||function(t){return"object"==typeof t&&null!==t&&!(!("fields"in t)||null!==t.fields&&!Pl(t.fields))}(t.mapValue))||"fieldReferenceValue"in t&&(null===t.fieldReferenceValue||"string"==typeof t.fieldReferenceValue)||"functionValue"in t&&(null===t.functionValue||function(t){return"object"==typeof t&&null!==t&&!(!("name"in t)||null!==t.name&&"string"!=typeof t.name||!("args"in t)||null!==t.args&&!Array.isArray(t.args))}(t.functionValue))||"pipelineValue"in t&&(null===t.pipelineValue||function(t){return"object"==typeof t&&null!==t&&!(!("stages"in t)||null!==t.stages&&!Array.isArray(t.stages))}(t.pipelineValue)))}(this._protoValue)||(this._protoValue=jp(this.value,t))}}function af(t,e){return Bf(t,"constant")}function Bf(t,e){const n=new of(t,e);return"boolean"==typeof t?new hf(n):n}class cf extends Zp{constructor(t,e,n,s){super(),this.name=t,this.params=e,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==s&&(this._options=s)}get _optionsUtil(){return new Qp({})}_toProto(t){const e={functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}};return this._optionsProto&&(e.functionValue.options=this._optionsProto),e}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(t,this._options))}}class lf extends Zp{get _methodName(){return this._expr._methodName}countIf(){return tf._create("count_if",[this],"countIf")}not(){return new cf("not",[this],"not").asBoolean()}conditional(t,e){return new cf("conditional",[this,t,e],"conditional")}ifError(t){const e=Wp(t),n=new cf("if_error",[this,e],"ifError");return e instanceof lf?n.asBoolean():n}_toProto(t){return this._expr._toProto(t)}_readUserData(t){this._expr._readUserData(t)}}class uf extends lf{constructor(t){super(),this._expr=t,this.expressionType="Function"}}class hf extends lf{constructor(t){super(),this._expr=t,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class df extends lf{constructor(t){super(),this._expr=t,this.expressionType="Field"}}class pf{constructor(t,e,n){this.expr=t,this.direction=e,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(t){return{mapValue:{fields:{direction:Md(this.direction),expression:this.expr._toProto(t)}}}}_readUserData(t){this.expr._readUserData(t)}}class ff{constructor(t){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=t)}_readUserData(t){this.optionsProto=this._optionsUtil.getOptionsProto(t,this.knownOptions,this.rawOptions)}_toProto(t){return{name:this._name,options:this.optionsProto}}}class Cf extends ff{get _name(){return"add_fields"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.fields=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.fields)]}}_readUserData(t){super._readUserData(t),Af(this.fields,t)}}class gf extends ff{get _name(){return"aggregate"}get _optionsUtil(){return new Qp({})}constructor(t,e,n){super(n),this.groups=t,this.accumulators=e}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.accumulators),Pd(t,this.groups)]}}_readUserData(t){super._readUserData(t),Af(this.groups,t),Af(this.accumulators,t)}}class mf extends ff{get _name(){return"distinct"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.groups=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.groups)]}}_readUserData(t){super._readUserData(t),Af(this.groups,t)}}class wf extends ff{get _name(){return"collection"}get _optionsUtil(){return new Qp({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.hr=t.startsWith("/")?t:"/"+t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:this.hr}]}}_readUserData(t){super._readUserData(t)}}class yf extends ff{get _name(){return"collection_group"}get _optionsUtil(){return new Qp({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.collectionId=t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(t){super._readUserData(t)}}class Ef extends ff{get _name(){return"database"}get _optionsUtil(){return new Qp({})}_toProto(t){return{...super._toProto(t)}}_readUserData(t){super._readUserData(t)}}class Df extends ff{get _name(){return"documents"}get _optionsUtil(){return new Qp({})}constructor(t,e){if(super(e),!t||0===t.length)throw new vl(bl.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=t.map(t=>t.startsWith("/")?t:"/"+t),s=new Set(n);if(s.size!==n.length)throw new vl(bl.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.Tr=n,this.Pr=s}_toProto(t){return{...super._toProto(t),args:this.Tr.map(t=>({referenceValue:t}))}}_readUserData(t){super._readUserData(t)}}class _f extends ff{get _name(){return"where"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.condition=t}_toProto(t){return{...super._toProto(t),args:[this.condition._toProto(t)]}}_readUserData(t){super._readUserData(t),Af(this.condition,t)}}class bf extends ff{get _name(){return"limit"}get _optionsUtil(){return new Qp({})}constructor(t,e){cl(!isNaN(t)&&t!==1/0&&t!==-1/0,34860),super(e),this.limit=t}_toProto(t){return{...super._toProto(t),args:[Uu(t,this.limit)]}}}class vf extends ff{get _name(){return"offset"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.offset=t}_toProto(t){return{...super._toProto(t),args:[Uu(t,this.offset)]}}}class If extends ff{get _name(){return"select"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.selections=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.selections)]}}_readUserData(t){super._readUserData(t),Af(this.selections,t)}}class Tf extends ff{get _name(){return"sort"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.orderings=t}_toProto(t){return{...super._toProto(t),args:this.orderings.map(e=>e._toProto(t))}}_readUserData(t){super._readUserData(t),Af(this.orderings,t)}}class Of extends ff{get _name(){return"replace_with"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.map=t}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),Md(Of.Ir)]}}_readUserData(t){super._readUserData(t),Af(this.map,t)}}function Af(t,e){return function(t){return"function"==typeof t._readUserData}(t)?t._readUserData(e):Array.isArray(t)||t instanceof Map?t.forEach(t=>t._readUserData(e)):Object.values(t).forEach(t=>t._readUserData(e)),t}Of.Ir="full_replace";class Sf{constructor(t,e,n){this.serializer=t,this.stages=e,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Nf(this)}getPipelineCollectionGroup(){return xf(this)}getPipelineCollectionId(){return function(t){switch(Rf(t)){case"collection":return Ol.fromString(Nf(t)).lastSegment();case"collection_group":return xf(t);default:return}}(this)}getPipelineDocuments(){return kf(this)}getPipelineFlavor(){return function(t){let e="exact";return t.stages.forEach((n,s)=>{n._name!==mf.name&&n._name!==gf.name||(e="keyless"),n._name===If.name&&"exact"===e&&(e="augmented"),n._name===Cf.name&&s<t.stages.length-1&&"exact"===e&&(e="augmented")}),e}(this)}getPipelineSourceType(){return Rf(this)}}function Rf(t){const e=t.stages[0];return e instanceof wf||e instanceof yf||e instanceof Ef||e instanceof Df?e._name:"unknown"}function Nf(t){if("collection"===Rf(t))return t.stages[0].hr}function xf(t){if("collection_group"===Rf(t))return t.stages[0].collectionId}function kf(t){if("documents"===Rf(t))return t.stages[0].Tr}class Lf{constructor(t,e){this.type=t,this.value=e}static mr(){return new Lf("ERROR",void 0)}static pr(){return new Lf("UNSET",void 0)}static gr(){return new Lf("NULL",fu)}static newValue(t){return Ru(t)?new Lf("NULL",fu):function(t){return!!t&&"booleanValue"in t}(t)?new Lf("BOOLEAN",t):Tu(t)?new Lf("INT",t):Ou(t)?new Lf("DOUBLE",t):function(t){return!!t&&"timestampValue"in t&&!!t.timestampValue}(t)?new Lf("TIMESTAMP",t):function(t){return!!t&&"stringValue"in t}(t)?new Lf("STRING",t):function(t){return!!t&&"bytesValue"in t}(t)?new Lf("BYTES",t):t.referenceValue?new Lf("REFERENCE",t):t.geoPointValue?new Lf("GEO_POINT",t):Su(t)?new Lf("ARRAY",t):ku(t)?new Lf("VECTOR",t):xu(t)?new Lf("MAP",t):new Lf("ERROR",void 0)}yr(){return"ERROR"===this.type||"UNSET"===this.type}wr(){return"NULL"===this.type}}function Ff(t){if(!t.yr())return t.value}function Pf(t){return t instanceof lf?t._expr:t}function Mf(t){if((t=Pf(t))instanceof rf)return new Gf(t);if(t instanceof of)return new Hf(t);if(t instanceof sf)return new Uf(t);if(t instanceof cf){if("add"===t.name)return new Kf(t);if("subtract"===t.name)return new Qf(t);if("multiply"===t.name)return new Wf(t);if("divide"===t.name)return new Yf(t);if("mod"===t.name)return new Xf(t);if("and"===t.name)return new Zf(t);if("equal"===t.name)return new fC(t);if("not_equal"===t.name)return new CC(t);if("less_than"===t.name)return new gC(t);if("less_than_or_equal"===t.name)return new mC(t);if("greater_than"===t.name)return new wC(t);if("greater_than_or_equal"===t.name)return new yC(t);if("array_concat"===t.name)return new EC(t);if("array_reverse"===t.name)return new DC(t);if("array_contains"===t.name)return new _C(t);if("array_contains_all"===t.name)return new bC(t);if("array_contains_any"===t.name)return new vC(t);if("array_length"===t.name)return new IC(t);if("array_element"===t.name)return new TC(t);if("equal_any"===t.name)return new sC(t);if("not_equal_any"===t.name)return new rC(t);if("is_nan"===t.name)return new iC(t);if("is_not_nan"===t.name)return new oC(t);if("is_null"===t.name)return new aC(t);if("is_not_null"===t.name)return new BC(t);if("is_error"===t.name)return new cC(t);if("exists"===t.name)return new lC(t);if("not"===t.name)return new tC(t);if("or"===t.name)return new eC(t);if("xor"===t.name)return new nC(t);if("conditional"===t.name)return new uC(t);if("maximum"===t.name)return new hC(t);if("minimum"===t.name)return new dC(t);if("reverse"===t.name)return new OC(t);if("replace_first"===t.name)return new AC(t);if("replace_all"===t.name)return new SC(t);if("char_length"===t.name)return new RC(t);if("byte_length"===t.name)return new NC(t);if("like"===t.name)return new kC(t);if("regex_contains"===t.name)return new LC(t);if("regex_match"===t.name)return new FC(t);if("string_contains"===t.name)return new PC(t);if("starts_with"===t.name)return new MC(t);if("ends_with"===t.name)return new GC(t);if("to_lower"===t.name)return new HC(t);if("to_upper"===t.name)return new UC(t);if("trim"===t.name)return new VC(t);if("string_concat"===t.name)return new jC(t);if("map_get"===t.name)return new $C(t);if("cosine_distance"===t.name)return new qC(t);if("dot_product"===t.name)return new zC(t);if("euclidean_distance"===t.name)return new KC(t);if("vector_length"===t.name)return new QC(t);if("unix_micros_to_timestamp"===t.name)return new lg(t);if("timestamp_to_unix_micros"===t.name)return new pg(t);if("unix_millis_to_timestamp"===t.name)return new ug(t);if("timestamp_to_unix_millis"===t.name)return new fg(t);if("unix_seconds_to_timestamp"===t.name)return new hg(t);if("timestamp_to_unix_seconds"===t.name)return new Cg(t);if("timestamp_add"===t.name)return new mg(t);if("timestamp_subtract"===t.name)return new wg(t)}throw new Error(`Unknown Expr : ${t}`)}class Gf{constructor(t){this.expr=t}evaluate(t,e){if(this.expr.fieldName===Il)return Lf.newValue({referenceValue:Ad(t.serializer,e.key)});if("__update_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:vd(t.serializer,e.version)});if("__create_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:vd(t.serializer,e.createTime)});const n=e.data.field(this.expr._fieldPath);return n?eu(n)?Lf.newValue(function(t,e){if("estimate"===t.serverTimestampBehavior)return{timestampValue:vd(t.serializer,Uh.fromTimestamp(su(e)))};if("previous"===t.serverTimestampBehavior){const t=nu(e);if(t)return t}return{nullValue:"NULL_VALUE"}}(t,n)):Lf.newValue(n):Lf.pr()}}class Hf{constructor(t){this.expr=t}evaluate(t,e){return Lf.newValue(this.expr._getValue())}}class Uf{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.cr.map(n=>Mf(n).evaluate(t,e));return n.some(t=>t.yr())?Lf.mr():Lf.newValue({arrayValue:{values:n.map(t=>t.value)}})}}function Vf(t){return Ou(t)?Number(t.doubleValue):Number(t.integerValue)}function jf(t){return BigInt(t.integerValue)}const $f=BigInt("0x7fffffffffffffff"),Jf=-BigInt("0x8000000000000000");class qf{constructor(t){this.expr=t}evaluate(t,e){cl(this.expr.params.length>=2,24778);const n=Mf(this.expr.params[0]).evaluate(t,e),s=Mf(this.expr.params[1]).evaluate(t,e);let r=this.br(n,s);for(const n of this.expr.params.slice(2)){const s=Mf(n).evaluate(t,e);r=this.br(r,s)}return r}br(t,e){if(t.yr()||e.yr())return Lf.mr();if(t.wr()||e.wr())return Lf.gr();const n=t.value,s=e.value;if(!Ou(n)&&!Tu(n)||!Ou(s)&&!Tu(s))return Lf.mr();if(Ou(n)||Ou(s)){const t=this.Sr(n,s);return t?Lf.newValue(t):Lf.mr()}if(Tu(n)&&Tu(s)){const t=this.vr(n,s);return void 0===t?Lf.mr():"number"==typeof t?Lf.newValue({doubleValue:t}):t<Jf||t>$f?Lf.mr():Lf.newValue({integerValue:`${t}`})}return Lf.mr()}}function zf(t,e){return mu(t)!==mu(e)?"TYPE_MISMATCH":Nu(t)||Nu(e)?"NOT_EQ":Ru(t)&&Ru(e)?"EQ":Ru(t)||Ru(e)?"NULL":Su(t)&&Su(e)?function(t,e){if(t.values?.length!==e.values?.length)return"NOT_EQ";let n=!1;for(let s=0;s<(t.values?.length??0);s++){const r=t.values[s],i=e.values[s];switch(zf(r,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:al(44609,{Dr:r,Cr:i})}}return n?"NULL":"EQ"}(t.arrayValue,e.arrayValue):ku(t)&&ku(e)||xu(t)&&xu(e)?function(t,e){const n=t.fields||{},s=e.fields||{};if(Nl(n)!==Nl(s))return"NOT_EQ";let r=!1;for(const t in n)if(n.hasOwnProperty(t)){if(void 0===s[t])return"NOT_EQ";switch(zf(n[t],s[t])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":r=!0}}return r?"NULL":"EQ"}(t.mapValue,e.mapValue):function(t,e){return wu(t,e,{u:!1,i:!0,o:!0})}(t,e)?"EQ":"NOT_EQ"}class Kf extends qf{vr(t,e){return jf(t)+jf(e)}Sr(t,e){return{doubleValue:Vf(t)+Vf(e)}}}class Qf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){return jf(t)-jf(e)}Sr(t,e){return{doubleValue:Vf(t)-Vf(e)}}}class Wf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){return jf(t)*jf(e)}Sr(t,e){return{doubleValue:Vf(t)*Vf(e)}}}class Yf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){const n=jf(e);if(n!==BigInt(0))return jf(t)/n}Sr(t,e){const n=Vf(e);return 0===n?{doubleValue:cu(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:Vf(t)/n}}}class Xf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){const n=jf(e);if(n!==BigInt(0))return jf(t)%n}Sr(t,e){const n=Vf(e);if(0!==n)return{doubleValue:Vf(t)%n}}}class Zf{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return Lf.newValue(gu);break;case"NULL":s=!0;break;default:n=!0}}return n?Lf.mr():s?Lf.gr():Lf.newValue(Cu)}}class tC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,9634);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return Lf.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return Lf.gr();default:return Lf.mr()}}}class eC{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return Lf.newValue(Cu);break;case"NULL":s=!0;break;default:n=!0}}return n?Lf.mr():s?Lf.gr():Lf.newValue(gu)}}class nC{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":n=nC.xor(n,!!i.value?.booleanValue);break;case"NULL":s=!0;break;default:return Lf.mr()}}return s?Lf.gr():Lf.newValue({booleanValue:n})}static xor(t,e){return(t||e)&&!(t&&e)}}class sC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,55094);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();for(const t of r.value?.arrayValue?.values??[])switch(Ru(s.value)&&Ru(t)?"EQ":zf(s.value,t)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(44608,{value:s.value,candidate:t})}return n?Lf.gr():Lf.newValue(gu)}}class rC{constructor(t){this.expr=t}evaluate(t,e){return new tC(new cf("not",[new cf("equal_any",this.expr.params)])).evaluate(t,e)}}class iC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,23322);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return Lf.newValue(gu);case"DOUBLE":return Lf.newValue({booleanValue:isNaN(Vf(n.value))});case"NULL":return Lf.gr();default:return Lf.mr()}}}class oC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,50406),new tC(new cf("not",[new cf("is_nan",this.expr.params)])).evaluate(t,e)}}class aC{constructor(t){this.expr=t}evaluate(t,e){switch(cl(1===this.expr.params.length,23123),Mf(this.expr.params[0]).evaluate(t,e).type){case"NULL":return Lf.newValue(Cu);case"UNSET":case"ERROR":return Lf.mr();default:return Lf.newValue(gu)}}}class BC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,23167),new tC(new cf("not",[new cf("is_null",this.expr.params)])).evaluate(t,e)}}class cC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,5228),"ERROR"===Mf(this.expr.params[0]).evaluate(t,e).type?Lf.newValue(Cu):Lf.newValue(gu)}}class lC{constructor(t){this.expr=t}evaluate(t,e){switch(cl(1===this.expr.params.length,6877),Mf(this.expr.params[0]).evaluate(t,e).type){case"ERROR":return Lf.mr();case"UNSET":return Lf.newValue(gu);default:return Lf.newValue(Cu)}}}class uC{constructor(t){this.expr=t}evaluate(t,e){cl(3===this.expr.params.length,11706);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?Mf(this.expr.params[1]).evaluate(t,e):Mf(this.expr.params[2]).evaluate(t,e);case"NULL":return Mf(this.expr.params[2]).evaluate(t,e);default:return Lf.mr()}}}class hC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||Eu(t.value,s.value)>0?t:s}return void 0===s?Lf.gr():s}}class dC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||Eu(t.value,s.value)<0?t:s}return void 0===s?Lf.gr():s}}class pC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"ERROR":case"UNSET":return Lf.mr()}const s=Mf(this.expr.params[1]).evaluate(t,e);switch(s.type){case"ERROR":case"UNSET":return Lf.mr()}return this.Fr(n,s)}}class fC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){if(t.wr()&&e.wr())return Lf.newValue(Cu);if(t.wr()||e.wr())return Lf.newValue(gu);if(Nu(t.value)||Nu(e.value))return Lf.newValue(gu);if(mu(t.value)!==mu(e.value))return Lf.newValue(gu);switch(zf(t.value,e.value)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":return Lf.newValue(gu);case"NULL":return Lf.gr();default:al(44615,{left:t,right:e})}}}class CC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){switch(zf(t.value,e.value)){case"EQ":return Lf.newValue(gu);case"NOT_EQ":case"TYPE_MISMATCH":return Lf.newValue(Cu);case"NULL":return Lf.gr();default:al(44614,{left:t,right:e})}}}class gC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):Lf.newValue({booleanValue:Eu(t.value,e.value)<0})}}class mC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):"EQ"===zf(t.value,e.value)?Lf.newValue(Cu):Lf.newValue({booleanValue:Eu(t.value,e.value)<0})}}class wC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):Lf.newValue({booleanValue:Eu(t.value,e.value)>0})}}class yC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):"EQ"===zf(t.value,e.value)?Lf.newValue(Cu):Lf.newValue({booleanValue:Eu(t.value,e.value)>0})}}class EC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class DC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,216);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"ARRAY":{const t=n.value.arrayValue?.values??[];return Lf.newValue({arrayValue:{values:[...t].reverse()}})}default:return Lf.mr()}}}class _C{constructor(t){this.expr=t}evaluate(t,e){return cl(2===this.expr.params.length,52884),new sC(new cf("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(t,e)}}class bC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,1392);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of i){let e=!1;n=!1;for(const s of o){switch(Ru(t)&&Ru(s)?"EQ":zf(t,s)){case"EQ":e=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(44613,{value:s,search:t})}if(e)break}if(!e)return Lf.newValue(gu)}return Lf.newValue(Cu)}}class vC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,2680);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of o)for(const e of i)switch(Ru(t)&&Ru(e)?"EQ":zf(t,e)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(60403,{value:t,search:e})}return n?Lf.gr():Lf.newValue(gu)}}class IC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,38605);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"ARRAY":return Lf.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Lf.mr()}}}class TC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class OC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,1508);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"BYTES":{const t=n.value?.bytesValue;if("string"==typeof t){const e=ql.fromBase64String(t).toUint8Array();return e.reverse(),Lf.newValue({bytesValue:ql.fromUint8Array(e).toBase64()})}return Lf.newValue({bytesValue:new Uint8Array(t).reverse()})}case"STRING":{const t=n.value?.stringValue,e=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(t),s=Array.from(e,t=>t.segment).reverse();return Lf.newValue({stringValue:s.join("")})}default:return Lf.mr()}}}class AC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class SC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class RC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,19400);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s<=65535)if(s>=55296&&s<=57343)if(s<=56319){const s=t.codePointAt(n+1);void 0!==s&&s>=56320&&s<=57343?(e+=1,n++):e+=1}else e+=1;else e+=1;else{if(!(s<=1114111))return;e+=1,n++}}return e}(n.value.stringValue);return void 0===t?Lf.mr():Lf.newValue({integerValue:t})}default:return Lf.mr()}}}class NC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,8486);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BYTES":{const t=n.value?.bytesValue;return"string"==typeof t?Lf.newValue({integerValue:ql.fromBase64String(t).toUint8Array().length}):Lf.newValue({integerValue:new Uint8Array(t).length})}case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s>=55296&&s<=57343){if(!(s<=56319))return;{const s=t.codePointAt(n+1);if(void 0===s||!(s>=56320&&s<=57343))return;e+=4,n++}}else if(s<=127)e+=1;else if(s<=2047)e+=2;else if(s<=65535)e+=3;else{if(!(s<=1114111))return;e+=4,n++}}return e}(n.value?.stringValue);return void 0===t?Lf.mr():Lf.newValue({integerValue:t})}case"NULL":return Lf.gr();default:return Lf.mr()}}}class xC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.mr()}return n?Lf.gr():this.Or(s.value?.stringValue,r.value?.stringValue)}}class kC extends xC{Or(t,e){try{const n=function(t){let e="";for(let n=0;n<t.length;n++){const s=t.charAt(n);switch(s){case"_":e+=".";break;case"%":e+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":e+="\\"+s;break;default:e+=s}}return"^"+e+"$"}(e),s=Zc.compile(n);return Lf.newValue({booleanValue:s.matches(t)})}catch(t){return il(`Invalid LIKE pattern converted to regex: ${e}, returning error. Error: ${t}`),Lf.mr()}}}class LC extends xC{Or(t,e){try{const n=Zc.compile(e);return Lf.newValue({booleanValue:n.test(t)})}catch(t){return il(`Invalid regex pattern found in regex_contains: ${e}, returning error`),Lf.mr()}}}class FC extends xC{Or(t,e){try{return Lf.newValue({booleanValue:Zc.compile(e).matches(t)})}catch(t){return il(`Invalid regex pattern found in regex_match: ${e}, returning error`),Lf.mr()}}}class PC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.includes(e)})}}class MC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.startsWith(e)})}}class GC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.endsWith(e)})}}class HC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,29079);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class UC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,60487);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class VC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,28544);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class jC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s="",r=!1;for(const t of n)switch(t.type){case"STRING":s+=t.value.stringValue;break;case"NULL":r=!0;break;default:return Lf.mr()}return r?Lf.gr():Lf.newValue({stringValue:s})}}class $C{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,4483);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"UNSET":return Lf.pr();case"MAP":break;default:return Lf.mr()}const s=Mf(this.expr.params[1]).evaluate(t,e);if("STRING"!==s.type)return Lf.mr();const r=n.value?.mapValue?.fields?.[s.value?.stringValue];return void 0===r?Lf.pr():Lf.newValue(r)}}class JC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=Lu(s.value),o=Lu(r.value);if(void 0===i||void 0===o||i.values?.length!==o.values?.length)return Lf.mr();const a=this.Mr(i,o);return void 0===a||isNaN(a)?Lf.mr():Lf.newValue({doubleValue:a})}}class qC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return;let r=0,i=0,o=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;const e=Vf(n[t]),a=Vf(s[t]);r+=e*a,i+=e*e,o+=a*a}const a=Math.sqrt(i)*Math.sqrt(o);return 0!==a?1-Math.max(-1,Math.min(1,r/a)):void 0}}class zC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;r+=Vf(n[t])*Vf(s[t])}return r}}class KC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;const e=Vf(n[t]),i=Vf(s[t]);r+=Math.pow(e-i,2)}return Math.sqrt(r)}}class QC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,39044);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"VECTOR":{const t=Lu(n.value);return Lf.newValue({integerValue:t?.values?.length??0})}case"NULL":return Lf.gr();default:return Lf.mr()}}}const WC=BigInt(-62135596800),YC=BigInt(253402300799),XC=BigInt(1e3),ZC=BigInt(1e6),tg=WC*XC,eg=YC*XC+BigInt(999),ng=WC*ZC,sg=YC*ZC+BigInt(999999);function rg(t){return t>=ng&&t<=sg}function ig(t){return t>=WC&&t<=YC}function og(t,e){const n=BigInt(t);return!(n<WC||n>YC||e<0||e>=1e9||n===WC&&0!==e||n===YC&&e>999999999)}function ag(t,e){return e<0?{seconds:t-1,nanos:e+1e9}:{seconds:t,nanos:e}}function Bg(t){return BigInt(t.seconds)*ZC+BigInt(Math.trunc(t.nanoseconds/1e3))}class cg{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return Lf.gr();default:return Lf.mr()}}}class lg extends cg{toTimestamp(t){if(!rg(t))return Lf.mr();let e=Number(t/ZC),n=Number(t%ZC*BigInt(1e3));const s=ag(e,n);return e=s.seconds,n=s.nanos,og(e,n)?Lf.newValue({timestampValue:{seconds:e,nanos:n}}):Lf.mr()}}class ug extends cg{toTimestamp(t){if(!function(t){return t>=tg&&t<=eg}(t))return Lf.mr();let e=Number(t/XC),n=Number(t%XC*BigInt(1e6));const s=ag(e,n);return e=s.seconds,n=s.nanos,og(e,n)?Lf.newValue({timestampValue:{seconds:e,nanos:n}}):Lf.mr()}}class hg extends cg{toTimestamp(t){if(!ig(t))return Lf.mr();const e=Number(t);return Lf.newValue({timestampValue:{seconds:e,nanos:0}})}}class dg{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"TIMESTAMP":break;case"NULL":return Lf.gr();default:return Lf.mr()}const s=_d(n.value.timestampValue);return og(s.seconds,s.nanoseconds)?this.Nr(s):Lf.mr()}}class pg extends dg{Nr(t){const e=Bg(t);return rg(e)?Lf.newValue({integerValue:`${e.toString()}`}):Lf.mr()}}class fg extends dg{Nr(t){const e=Bg(t),n=e/BigInt(1e3),s=e%BigInt(1e3);return n>BigInt(0)||s===BigInt(0)?Lf.newValue({integerValue:n.toString()}):Lf.newValue({integerValue:(n-BigInt(1)).toString()})}}class Cg extends dg{Nr(t){const e=BigInt(t.seconds);return ig(e)?Lf.newValue({integerValue:e.toString()}):Lf.mr()}}class gg{constructor(t){this.expr=t}evaluate(t,e){cl(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);let i;switch(r.type){case"STRING":if(i=function(t){switch(t){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}}(r.value.stringValue),void 0===i)return Lf.mr();break;case"NULL":n=!0;break;default:return Lf.mr()}const o=Mf(this.expr.params[2]).evaluate(t,e);switch(o.type){case"INT":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const a=BigInt(o.value.integerValue);let B;try{switch(i){case"microsecond":B=a;break;case"millisecond":B=a*BigInt(1e3);break;case"second":B=a*BigInt(1e6);break;case"minute":B=a*BigInt(6e7);break;case"hour":B=a*BigInt(36e8);break;case"day":B=a*BigInt(864e8);break;default:return Lf.mr()}if("microsecond"!==i&&a!==BigInt(0)&&B/a!==BigInt(this.Lr(i)))return Lf.mr()}catch(t){return il(`Error during timestamp arithmetic: ${t}`),Lf.mr()}const c=_d(s.value.timestampValue);if(!og(c.seconds,c.nanoseconds))return Lf.mr();const l=Bg(c),u=this.Br(l,B);if(!rg(u))return Lf.mr();const h=Number(u/ZC),d=u%ZC,p=Number((d<0?d+ZC:d)*BigInt(1e3)),f=d<0?h-1:h;return og(f,p)?Lf.newValue({timestampValue:{seconds:f,nanos:p}}):Lf.mr()}Lr(t){switch(t){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class mg extends gg{Br(t,e){return t+e}}class wg extends gg{Br(t,e){return t-e}}function yg(t){if((t=Pf(t))instanceof rf)return`fld(${t.fieldName})`;if(t instanceof of)return`cst(${function(t){return null===t?"null":"number"==typeof t?t.toString():"string"==typeof t?`"${t}"`:t instanceof Gp?`ref(${t.path})`:t instanceof Vp?`vec(${JSON.stringify(t)})`:JSON.stringify(t)}(t.value)})`;if(t instanceof cf)return`fn(${t.name},[${t.params.map(yg).join(",")}])`;if("ListOfExpressions"===t.expressionType)return`list([${t.cr.map(yg).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(t,null,2)}`)}function Eg(t){return`${Array.from(t.entries()).sort().map(([t,e])=>`${t}=${yg(e)}`).join(",")}`}function Dg(t){return t.stages.map(t=>function(t){if(t instanceof Cf)return`${t._name}(${Eg(t.fields)})`;if(t instanceof gf){let e=`${t._name}(${Eg(t.accumulators)})`;return t.groups.size>0&&(e+=`grouping(${Eg(t.groups)})`),e}if(t instanceof mf)return`${t._name}(${Eg(t.groups)})`;if(t instanceof wf)return`${t._name}(${t.hr})`;if(t instanceof yf)return`${t._name}(${t.collectionId})`;if(t instanceof Ef)return`${t._name}()`;if(t instanceof Df)return`${t._name}(${t.Tr.sort()})`;if(t instanceof _f)return`${t._name}(${yg(t.condition)})`;if(t instanceof bf)return`${t._name}(${t.limit})`;if(t instanceof Tf)return`${t._name}(${function(t){return t.map(t=>`${yg(t.expr)}${t.direction}`).join(",")}(t.orderings)})`;throw new Error(`Unrecognized stage ${t._name}`)}(t)).join("|")}function _g(t,e){return Dg(t)===Dg(e)}function bg(t){return t instanceof Sf}function vg(t){return bg(t)?Dg(t):ed(t)}function Ig(t){return bg(t)?Dg(t):function(t){return`${Kh(Zh(t))}|lt:${t.limitType}`}(t)}function Tg(t,e){return t instanceof Sf&&e instanceof Sf?_g(t,e):!(t instanceof Sf&&!(e instanceof Sf)||!(t instanceof Sf)&&e instanceof Sf)&&function(t,e){return Qh(Zh(t),Zh(e))&&t.limitType===e.limitType}(t,e)}function Og(t){return function(t){return!!t.isCorePipeline}(t)?Dg(t):Kh(t)}function Ag(t,e){return t instanceof Sf&&e instanceof Sf?_g(t,e):!(t instanceof Sf&&!(e instanceof Sf)||!(t instanceof Sf)&&e instanceof Sf)&&Qh(t,e)}class Sg{constructor(t,e,n,s){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const s=this.mutations[e];s.key.isEqual(t.key)&&ch(s,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=lh(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=lh(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=fd();return this.mutations.forEach(s=>{const r=t.get(s.key),i=r.overlayedDocument;let o=this.applyToLocalView(i,r.mutatedFields);o=e.has(s.key)?null:o;const a=Bh(i,o);null!==a&&n.set(s.key,a),i.isValidDocument()||i.convertToNoDocument(Uh.min())}),n}keys(){return this.mutations.reduce((t,e)=>t.add(e.key),wd())}isEqual(t){return this.batchId===t.batchId&&ml(this.mutations,t.mutations,(t,e)=>hh(t,e))&&ml(this.baseMutations,t.baseMutations,(t,e)=>hh(t,e))}}class Rg{constructor(t,e,n,s){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=s}static from(t,e,n){cl(t.mutations.length===n.length,58842,{Ur:t.mutations.length,kr:n.length});let s=gd;const r=t.mutations;for(let t=0;t<r.length;t++)s=s.insert(r[t].key,n[t].version);return new Rg(t,e,n,s)}}function Ng(t,e){let n=e;const s=t.length;for(let e=0;e<s;e++){const s=t.charAt(e);switch(s){case"\0":n+="";break;case"":n+="";break;default:n+=s}}return n}function xg(t){return t+""}class kg{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class Lg{constructor(t){this.$r=t}}function Fg(t){const e=Nd({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?td(e,e.limit,"L"):e}class Pg{constructor(){this.Zi=new Mg}addToCollectionParentIndex(t,e){return this.Zi.add(e),Ip.resolve()}getCollectionParents(t,e){return Ip.resolve(this.Zi.getEntries(e))}addFieldIndex(t,e){return Ip.resolve()}deleteFieldIndex(t,e){return Ip.resolve()}deleteAllFieldIndexes(t){return Ip.resolve()}createTargetIndexes(t,e){return Ip.resolve()}getDocumentsMatchingTarget(t,e){return Ip.resolve(null)}getIndexType(t,e){return Ip.resolve(0)}getFieldIndexes(t,e){return Ip.resolve([])}getNextCollectionGroupToUpdate(t){return Ip.resolve(null)}getMinOffset(t,e){return Ip.resolve($h.min())}getMinOffsetFromCollectionGroup(t,e){return Ip.resolve($h.min())}updateCollectionGroup(t,e,n){return Ip.resolve()}updateIndexEntries(t,e){return Ip.resolve()}}class Mg{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e]||new Dl(Ol.comparator),r=!s.has(n);return this.index[e]=s.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e];return s&&s.has(n)}getEntries(t){return(this.index[t]||new Dl(Ol.comparator)).toArray()}}class Gg{constructor(t){this.ys=t}next(){return this.ys+=2,this.ys}static ws(){return new Gg(0)}static bs(){return new Gg(-1)}}function Hg(t,e){return function(t,e){let n=e;for(const e of t.stages)n=Ug({serializer:t.serializer,serverTimestampBehavior:t.listenOptions?.serverTimestampBehavior},e,n);return n}(t,[e]).length>0}function Ug(t,e,n){if(e instanceof wf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&`/${t.key.getCollectionPath().canonicalString()}`===e.hr)}(0,e,n);if(e instanceof _f)return function(t,e,n){return n.filter(n=>{const s=Ff(Mf(e.condition).evaluate(t,n));return void 0!==s&&wu(s,Cu)})}(t,e,n);if(e instanceof yf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&t.key.getCollectionPath().lastSegment()===e.collectionId)}(0,e,n);if(e instanceof Ef)return function(t,e,n){return n.filter(t=>t.isFoundDocument())}(0,0,n);if(e instanceof Df)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&e.Pr.has(t.key.path.toStringWithLeadingSlash()))}(0,e,n);if(e instanceof bf)return function(t,e,n){return n.slice(0,e.limit)}(0,e,n);if(e instanceof Tf)return function(t,e,n){const s=e.orderings.map(t=>({Ms:Mf(t.expr),direction:t.direction}));return[...n].sort((e,n)=>{for(const{Ms:r,direction:i}of s){const s=Ff(r.evaluate(t,e)),o=Ff(r.evaluate(t,n)),a=Eu(s??fu,o??fu);if(0!==a)return"ascending"===i?a:-a}return 0})}(t,e,n);throw new Error(`Unknown stage: ${e._name}`)}class Vg{constructor(){this.changes=new Bd(t=>t.toString(),(t,e)=>t.isEqual(e)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,Vh.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?Ip.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}class jg{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}class $g{constructor(t,e,n,s){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=s}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next(s=>(n=s,this.remoteDocumentCache.getEntry(t,e))).next(t=>(null!==n&&lh(n.mutation,t,Rl.empty(),$l.now()),t))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.getLocalViewOfDocuments(t,e,wd()).next(()=>e))}getLocalViewOfDocuments(t,e,n=wd()){const s=pd();return this.populateOverlays(t,s,e).next(()=>this.computeViews(t,e,s,n).next(t=>{let e=hd();return t.forEach((t,n)=>{e=e.insert(t,n.overlayedDocument)}),e}))}getOverlayedDocuments(t,e){const n=pd();return this.populateOverlays(t,n,e).next(()=>this.computeViews(t,e,n,wd()))}populateOverlays(t,e,n){const s=[];return n.forEach(t=>{e.has(t)||s.push(t)}),this.documentOverlayCache.getOverlays(t,s).next(t=>{t.forEach((t,n)=>{e.set(t,n)})})}computeViews(t,e,n,s){let r=ld();const i=Cd(),o=Cd();return e.forEach((t,e)=>{const o=n.get(e.key);s.has(e.key)&&(void 0===o||o.mutation instanceof ph)?r=r.insert(e.key,e):void 0!==o?(i.set(e.key,o.mutation.getFieldMask()),lh(o.mutation,e,o.mutation.getFieldMask(),$l.now())):i.set(e.key,Rl.empty())}),this.recalculateAndSaveOverlays(t,r).next(t=>(t.forEach((t,e)=>i.set(t,e)),e.forEach((t,e)=>o.set(t,new jg(e,i.get(t)??null))),o))}recalculateAndSaveOverlays(t,e){const n=Cd();let s=new wl((t,e)=>t-e),r=wd();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next(t=>{for(const r of t)r.keys().forEach(t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||Rl.empty();o=r.applyToLocalView(i,o),n.set(t,o);const a=(s.get(r.batchId)||wd()).add(t);s=s.insert(r.batchId,a)})}).next(()=>{const i=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,B=s.value,c=fd();B.forEach(t=>{if(!r.has(t)){const s=Bh(e.get(t),n.get(t));null!==s&&c.set(t,s),r=r.add(t)}}),i.push(this.documentOverlayCache.saveOverlays(t,a,c))}return Ip.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.recalculateAndSaveOverlays(t,e))}getDocumentsMatchingQuery(t,e,n,s){return bg(e)?this.getDocumentsMatchingPipeline(t,e,n,s):function(t){return Ll.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):function(t){return null!==t.collectionGroup}(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n,s):this.getDocumentsMatchingCollectionQuery(t,e,n,s)}getNextDocuments(t,e,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,s).next(r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,s-r.size):Ip.resolve(pd());let o=-1,a=r;return i.next(e=>Ip.forEach(e,(e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?Ip.resolve():this.remoteDocumentCache.getEntry(t,e).next(t=>{a=a.insert(e,t)}))).next(()=>this.populateOverlays(t,e,r)).next(()=>this.computeViews(t,a,e,wd())).next(t=>({batchId:o,changes:dd(t)})))})}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Ll(e)).next(t=>{let e=hd();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e})}getDocumentsMatchingCollectionGroupQuery(t,e,n,s){const r=e.collectionGroup;let i=hd();return this.indexManager.getCollectionParents(t,r).next(o=>Ip.forEach(o,o=>{const a=function(t,e){return new Wh(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,o.child(r));return this.getDocumentsMatchingCollectionQuery(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(t,e,n,s){let r;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId).next(i=>(r=i,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s))).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>nd(e,t)))}getDocumentsMatchingPipeline(t,e,n,s){if("collection_group"===Rf(e)){const r=xf(e);let i=hd();return this.indexManager.getCollectionParents(t,r).next(o=>Ip.forEach(o,o=>{const a=function(t,e){const n=t.stages.map(t=>t instanceof yf?new wf(e.canonicalString(),{}):t);return new Sf(t.serializer,n)}(e,o.child(r));return this.getDocumentsMatchingPipeline(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}{let r;return this.getOverlaysForPipeline(t,e,n.largestBatchId).next(i=>{switch(r=i,Rf(e)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s);case"documents":let i=wd();for(const t of kf(e))i=i.add(Ll.fromPath(t));return this.remoteDocumentCache.getEntries(t,i);case"database":return this.remoteDocumentCache.getAllEntries(t);default:throw new vl("invalid-argument",`Invalid pipeline source to execute offline: ${Dg(e)}`)}}).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>Hg(e,t)))}}retrieveMatchingLocalDocuments(t,e,n){t.forEach((t,n)=>{const s=n.getKey();null===e.get(s)&&(e=e.insert(s,Vh.newInvalidDocument(s)))});let s=hd();return e.forEach((e,r)=>{const i=t.get(e);void 0!==i&&lh(i.mutation,r,Rl.empty(),$l.now()),n(r)&&(s=s.insert(e,r))}),s}getOverlaysForPipeline(t,e,n){switch(Rf(e)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(t,Ol.fromString(Nf(e)),n);case"collection_group":throw new vl("invalid-argument",`Unexpected collection group pipeline: ${Dg(e)}`);case"documents":return this.documentOverlayCache.getOverlays(t,kf(e).map(t=>Ll.fromPath(t)));case"database":return this.documentOverlayCache.getAllOverlays(t,n);default:throw new vl("invalid-argument",`Failed to get overlays for pipeline: ${Dg(e)}`)}}}class Jg{constructor(t){this.serializer=t,this.Qs=new Map,this.Ws=new Map}getBundleMetadata(t,e){return Ip.resolve(this.Qs.get(e))}saveBundleMetadata(t,e){return this.Qs.set(e.id,function(t){return{id:t.id,version:t.version,createTime:Id(t.createTime)}}(e)),Ip.resolve()}getNamedQuery(t,e){return Ip.resolve(this.Ws.get(e))}saveNamedQuery(t,e){return this.Ws.set(e.name,function(t){return{name:t.name,query:Fg(t.bundledQuery),readTime:Id(t.readTime)}}(e)),Ip.resolve()}}class qg{constructor(){this.overlays=new wl(Ll.comparator),this.Gs=new Map}getOverlay(t,e){return Ip.resolve(this.overlays.get(e))}getOverlays(t,e){const n=pd();return Ip.forEach(e,e=>this.getOverlay(t,e).next(t=>{null!==t&&n.set(e,t)})).next(()=>n)}getAllOverlays(t,e){const n=pd();return this.overlays.forEach((t,s)=>{s.largestBatchId>e&&n.set(t,s)}),Ip.resolve(n)}saveOverlays(t,e,n){return n.forEach((n,s)=>{this.Zr(t,e,s)}),Ip.resolve()}removeOverlaysForBatchId(t,e,n){const s=this.Gs.get(n);return void 0!==s&&(s.forEach(t=>this.overlays=this.overlays.remove(t)),this.Gs.delete(n)),Ip.resolve()}getOverlaysForCollection(t,e,n){const s=pd(),r=e.length+1,i=new Ll(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===r&&t.largestBatchId>n&&s.set(t.getKey(),t)}return Ip.resolve(s)}getOverlaysForCollectionGroup(t,e,n,s){let r=new wl((t,e)=>t-e);const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=r.get(t.largestBatchId);null===e&&(e=pd(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=pd(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((t,e)=>o.set(t,e)),!(o.size()>=s)););return Ip.resolve(o)}Zr(t,e,n){const s=this.overlays.get(n.key);if(null!==s){const t=this.Gs.get(s.largestBatchId).delete(n.key);this.Gs.set(s.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new kg(e,n));let r=this.Gs.get(e);void 0===r&&(r=wd(),this.Gs.set(e,r)),this.Gs.set(e,r.add(n.key))}}class zg{constructor(){this.sessionToken=ql.EMPTY_BYTE_STRING}getSessionToken(t){return Ip.resolve(this.sessionToken)}setSessionToken(t,e){return this.sessionToken=e,Ip.resolve()}}class Kg{constructor(){this.zs=new Dl(Qg.js),this.Hs=new Dl(Qg.Js)}isEmpty(){return this.zs.isEmpty()}addReference(t,e){const n=new Qg(t,e);this.zs=this.zs.add(n),this.Hs=this.Hs.add(n)}Ys(t,e){t.forEach(t=>this.addReference(t,e))}removeReference(t,e){this.Zs(new Qg(t,e))}Xs(t,e){t.forEach(t=>this.removeReference(t,e))}e_(t){const e=new Ll(new Ol([])),n=new Qg(e,t),s=new Qg(e,t+1),r=[];return this.Hs.forEachInRange([n,s],t=>{this.Zs(t),r.push(t.key)}),r}t_(){this.zs.forEach(t=>this.Zs(t))}Zs(t){this.zs=this.zs.delete(t),this.Hs=this.Hs.delete(t)}n_(t){const e=new Ll(new Ol([])),n=new Qg(e,t),s=new Qg(e,t+1);let r=wd();return this.Hs.forEachInRange([n,s],t=>{r=r.add(t.key)}),r}containsKey(t){const e=new Qg(t,0),n=this.zs.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Qg{constructor(t,e){this.key=t,this.r_=e}static js(t,e){return Ll.comparator(t.key,e.key)||dl(t.r_,e.r_)}static Js(t,e){return dl(t.r_,e.r_)||Ll.comparator(t.key,e.key)}}class Wg{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.Gr=1,this.i_=new Dl(Qg.js)}checkEmpty(t){return Ip.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,s){const r=this.Gr;this.Gr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new Sg(r,e,n,s);this.mutationQueue.push(i);for(const e of s)this.i_=this.i_.add(new Qg(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return Ip.resolve(i)}lookupMutationBatch(t,e){return Ip.resolve(this.s_(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,s=this.__(n),r=s<0?0:s;return Ip.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return Ip.resolve(0===this.mutationQueue.length?-1:this.Gr-1)}getAllMutationBatches(t){return Ip.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Qg(e,0),s=new Qg(e,Number.POSITIVE_INFINITY),r=[];return this.i_.forEachInRange([n,s],t=>{const e=this.s_(t.r_);r.push(e)}),Ip.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new Dl(dl);return e.forEach(t=>{const e=new Qg(t,0),s=new Qg(t,Number.POSITIVE_INFINITY);this.i_.forEachInRange([e,s],t=>{n=n.add(t.r_)})}),Ip.resolve(this.o_(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,s=n.length+1;let r=n;Ll.isDocumentKey(r)||(r=r.child(""));const i=new Qg(new Ll(r),0);let o=new Dl(dl);return this.i_.forEachWhile(t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===s&&(o=o.add(t.r_)),!0)},i),Ip.resolve(this.o_(o))}o_(t){const e=[];return t.forEach(t=>{const n=this.s_(t);null!==n&&e.push(n)}),e}removeMutationBatch(t,e){cl(0===this.a_(e.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.i_;return Ip.forEach(e.mutations,s=>{const r=new Qg(s.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,s.key)}).next(()=>{this.i_=n})}Hr(t){}containsKey(t,e){const n=new Qg(e,0),s=this.i_.firstAfterOrEqual(n);return Ip.resolve(e.isEqual(s&&s.key))}performConsistencyCheck(t){return this.mutationQueue.length,Ip.resolve()}a_(t,e){return this.__(t)}__(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}s_(t){const e=this.__(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}class Yg{constructor(t){this.u_=t,this.docs=new wl(Ll.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,s=this.docs.get(n),r=s?s.size:0,i=this.u_(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-r,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return Ip.resolve(n?n.document.mutableCopy():Vh.newInvalidDocument(e))}getEntries(t,e){let n=ld();return e.forEach(t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():Vh.newInvalidDocument(t))}),Ip.resolve(n)}getAllEntries(t){let e=ld();return this.docs.forEach((t,n)=>{e=e.insert(t,n.document)}),Ip.resolve(e)}getDocumentsMatchingQuery(t,e,n,s){let r,i;bg(e)?(r=Ol.fromString(Nf(e)),i=t=>Hg(e,t)):(r=e.path,i=t=>nd(e,t));let o=ld();const a=new Ll(r.child("__id-9223372036854775808__")),B=this.docs.getIteratorFrom(a);for(;B.hasNext();){const{key:t,value:{document:e}}=B.getNext();if(!r.isPrefixOf(t.path))break;t.path.length>r.length+1||Jh(jh(e),n)<=0||(s.has(e.key)||i(e))&&(o=o.insert(e.key,e.mutableCopy()))}return Ip.resolve(o)}getAllFromCollectionGroup(t,e,n,s){al(9500)}c_(t,e){return Ip.forEach(this.docs,t=>e(t))}newChangeBuffer(t){return new Xg(this)}getSize(t){return Ip.resolve(this.size)}}class Xg extends Vg{constructor(t){super(),this.$s=t}applyChanges(t){const e=[];return this.changes.forEach((n,s)=>{s.isValidDocument()?e.push(this.$s.addEntry(t,s)):this.$s.removeEntry(n)}),Ip.waitFor(e)}getFromCache(t,e){return this.$s.getEntry(t,e)}getAllFromCache(t,e){return this.$s.getEntries(t,e)}}class Zg{constructor(t){this.persistence=t,this.l_=new Bd(t=>Og(t),Ag),this.lastRemoteSnapshotVersion=Uh.min(),this.highestTargetId=0,this.E_=0,this.h_=new Kg,this.targetCount=0,this.T_=Gg.ws()}forEachTarget(t,e){return this.l_.forEach((t,n)=>e(n)),Ip.resolve()}getLastRemoteSnapshotVersion(t){return Ip.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return Ip.resolve(this.E_)}allocateTargetId(t){return this.highestTargetId=this.T_.next(),Ip.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.E_&&(this.E_=e),Ip.resolve()}Ds(t){this.l_.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.T_=new Gg(e),this.highestTargetId=e),t.sequenceNumber>this.E_&&(this.E_=t.sequenceNumber)}addTargetData(t,e){return this.Ds(e),this.targetCount+=1,Ip.resolve()}updateTargetData(t,e){return this.Ds(e),Ip.resolve()}removeTargetData(t,e){return this.l_.delete(e.target),this.h_.e_(e.targetId),this.targetCount-=1,Ip.resolve()}removeTargets(t,e,n){let s=0;const r=[];return this.l_.forEach((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.l_.delete(i),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),s++)}),Ip.waitFor(r).next(()=>s)}getTargetCount(t){return Ip.resolve(this.targetCount)}getTargetData(t,e){const n=this.l_.get(e)||null;return Ip.resolve(n)}addMatchingKeys(t,e,n){return this.h_.Ys(e,n),Ip.resolve()}removeMatchingKeys(t,e,n){this.h_.Xs(e,n);const s=this.persistence.referenceDelegate,r=[];return s&&e.forEach(e=>{r.push(s.markPotentiallyOrphaned(t,e))}),Ip.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.h_.e_(e),Ip.resolve()}getMatchingKeysForTargetId(t,e){const n=this.h_.n_(e);return Ip.resolve(n)}containsKey(t,e){return Ip.resolve(this.h_.containsKey(e))}}class tm{constructor(t,e){this.P_={},this.overlays={},this.I_=new _p(0),this.R_=!1,this.R_=!0,this.A_=new zg,this.referenceDelegate=t(this),this.V_=new Zg(this),this.indexManager=new Pg,this.remoteDocumentCache=function(t){return new Yg(t)}(t=>this.referenceDelegate.d_(t)),this.serializer=new Lg(e),this.f_=new Jg(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.R_=!1,Promise.resolve()}get started(){return this.R_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new qg,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.P_[t.toKey()];return n||(n=new Wg(e,this.referenceDelegate),this.P_[t.toKey()]=n),n}getGlobalsCache(){return this.A_}getTargetCache(){return this.V_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.f_}runTransaction(t,e,n){sl("MemoryPersistence","Starting transaction:",t);const s=new em(this.I_.next());return this.referenceDelegate.m_(),n(s).next(t=>this.referenceDelegate.p_(s).next(()=>t)).toPromise().then(t=>(s.raiseOnCommittedEvent(),t))}g_(t,e){return Ip.or(Object.values(this.P_).map(n=>()=>n.containsKey(t,e)))}}class em extends bp{constructor(t){super(),this.currentSequenceNumber=t}}class nm{constructor(t){this.persistence=t,this.y_=new Kg,this.w_=null}static b_(t){return new nm(t)}get S_(){if(this.w_)return this.w_;throw al(60996)}addReference(t,e,n){return this.y_.addReference(n,e),this.S_.delete(n.toString()),Ip.resolve()}removeReference(t,e,n){return this.y_.removeReference(n,e),this.S_.add(n.toString()),Ip.resolve()}markPotentiallyOrphaned(t,e){return this.S_.add(e.toString()),Ip.resolve()}removeTarget(t,e){this.y_.e_(e.targetId).forEach(t=>this.S_.add(t.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next(t=>{t.forEach(t=>this.S_.add(t.toString()))}).next(()=>n.removeTargetData(t,e))}m_(){this.w_=new Set}p_(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Ip.forEach(this.S_,n=>{const s=Ll.fromPath(n);return this.v_(t,s).next(t=>{t||e.removeEntry(s,Uh.min())})}).next(()=>(this.w_=null,e.apply(t)))}updateLimboDocument(t,e){return this.v_(t,e).next(t=>{t?this.S_.delete(e.toString()):this.S_.add(e.toString())})}d_(t){return 0}v_(t,e){return Ip.or([()=>Ip.resolve(this.y_.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.g_(t,e)])}}class sm{constructor(t,e){this.persistence=t,this.D_=new Bd(t=>function(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=xg(e)),e=Ng(t.get(n),e);return xg(e)}(t.path),(t,e)=>t.isEqual(e)),this.garbageCollector=function(t,e){return new Np(t,e)}(this,e)}static b_(t,e){return new sm(t,e)}m_(){}p_(t){return Ip.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}ir(t){const e=this.Cs(t);return this.persistence.getTargetCache().getTargetCount(t).next(t=>e.next(e=>t+e))}Cs(t){let e=0;return this.sr(t,t=>{e++}).next(()=>e)}sr(t,e){return Ip.forEach(this.D_,(n,s)=>this.Os(t,n,s).next(t=>t?Ip.resolve():e(s)))}removeTargets(t,e,n){return this.persistence.getTargetCache().removeTargets(t,e,n)}removeOrphanedDocuments(t,e){let n=0;const s=this.persistence.getRemoteDocumentCache(),r=s.newChangeBuffer();return s.c_(t,s=>this.Os(t,s,e).next(t=>{t||(n++,r.removeEntry(s,Uh.min()))})).next(()=>r.apply(t)).next(()=>n)}markPotentiallyOrphaned(t,e){return this.D_.set(e,t.currentSequenceNumber),Ip.resolve()}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),Ip.resolve()}removeReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),Ip.resolve()}updateLimboDocument(t,e){return this.D_.set(e,t.currentSequenceNumber),Ip.resolve()}d_(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=Iu(t.data.value)),e}Os(t,e,n){return Ip.or([()=>this.persistence.g_(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{const t=this.D_.get(e);return Ip.resolve(void 0!==t&&t>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}class rm{constructor(t,e,n,s){this.targetId=t,this.fromCache=e,this.Vo=n,this.fo=s}static mo(t,e){let n=wd(),s=wd();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:s=s.add(t.doc.key)}return new rm(t,e.fromCache,n,s)}}function im(t,e){return Ll.comparator(t.key,e.key)}class om{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}class am{constructor(){this.po=!1,this.yo=!1,this.wo=100,this.bo=qn()?8:function(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}($n())>0?6:4}initialize(t,e){this.So=t,this.indexManager=e,this.po=!0}getDocumentsMatchingQuery(t,e,n,s){const r={result:null};return this.vo(t,e).next(t=>{r.result=t}).next(()=>{if(!r.result)return this.Do(t,e,s,n).next(t=>{r.result=t})}).next(()=>{if(r.result)return;const n=new om;return this.xo(t,e,n).next(s=>{if(r.result=s,this.yo)return this.Co(t,e,n,s.size)})}).next(()=>r.result)}Co(t,e,n,s){return bg(e)?Ip.resolve():n.documentReadCount<this.wo?(nl()<=ds.DEBUG&&sl("QueryEngine","SDK will not create cache indexes for query:",ed(e),"since it only creates cache indexes for collection contains","more than or equal to",this.wo,"documents"),Ip.resolve()):(nl()<=ds.DEBUG&&sl("QueryEngine","Query:",ed(e),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.bo*s?(nl()<=ds.DEBUG&&sl("QueryEngine","The SDK decides to create cache indexes for query:",ed(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Zh(e))):Ip.resolve())}vo(t,e){if(bg(e))return Ip.resolve(null);let n=e;if(Yh(n))return Ip.resolve(null);let s=Zh(n);return this.indexManager.getIndexType(t,s).next(e=>0===e?null:(null!==n.limit&&1===e&&(n=td(n,null,"F"),s=Zh(n)),this.indexManager.getDocumentsMatchingTarget(t,s).next(e=>{const r=wd(...e);return this.So.getDocuments(t,r).next(e=>this.indexManager.getMinOffset(t,s).next(s=>{const i=this.Fo(n,e);return this.Oo(n,i,r,s.readTime)?this.vo(t,td(n,null,"F")):this.Mo(t,i,n,s)}))})))}Do(t,e,n,s){return(bg(e)?function(t){for(const e of t.stages){if(e instanceof bf||e instanceof vf)return!1;if(e instanceof _f){if(e.condition instanceof uf&&"exists"===e.condition._expr.name&&e.condition._expr.params[0]instanceof rf&&e.condition._expr.params[0].fieldName===Il)continue;return!1}}return!0}(e):Yh(e))||s.isEqual(Uh.min())?Ip.resolve(null):this.So.getDocuments(t,n).next(r=>{const i=this.Fo(e,r);return this.Oo(e,i,n,s)?Ip.resolve(null):(nl()<=ds.DEBUG&&sl("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),vg(e)),this.Mo(t,i,e,function(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,r=Uh.fromTimestamp(1e9===s?new $l(n+1,0):new $l(n,s));return new $h(r,Ll.empty(),e)}(s,-1)).next(t=>t))})}Fo(t,e){let n,s;return bg(t)?(n=new Dl(im),s=e=>Hg(t,e)):(n=new Dl(sd(t)),s=e=>nd(t,e)),e.forEach((t,e)=>{s(e)&&(n=n.add(e))}),n}Oo(t,e,n,s){if(bg(t))return function(t){return t.stages.some(t=>t instanceof bf||t instanceof vf)}(t);if(null===t.limit)return!1;if(n.size!==e.size)return!0;const r="F"===t.limitType?e.last():e.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}xo(t,e,n){return nl()<=ds.DEBUG&&sl("QueryEngine","Using full collection scan to execute query:",vg(e)),this.So.getDocumentsMatchingQuery(t,e,$h.min(),n)}Mo(t,e,n,s){return this.So.getDocumentsMatchingQuery(t,n,s).next(t=>(e.forEach(e=>{t=t.insert(e.key,e)}),t))}}class Bm{constructor(t,e,n,s){this.persistence=t,this.No=e,this.serializer=s,this.Lo=new wl(dl),this.Bo=new Bd(t=>Og(t),Ag),this.Uo=new Map,this.ko=t.getRemoteDocumentCache(),this.V_=t.getTargetCache(),this.f_=t.getBundleCache(),this.qo(n)}qo(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new $g(this.ko,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ko.setIndexManager(this.indexManager),this.No.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",e=>t.collect(e,this.Lo))}}async function cm(t,e){const n=ll(t);return await n.persistence.runTransaction("Handle user change","readonly",t=>{let s;return n.mutationQueue.getAllMutationBatches(t).next(r=>(s=r,n.qo(e),n.mutationQueue.getAllMutationBatches(t))).next(e=>{const r=[],i=[];let o=wd();for(const t of s){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next(t=>({$o:t,removedBatchIds:r,addedBatchIds:i}))})})}function lm(t,e){const n=ll(t);return n.persistence.runTransaction("Get next mutation batch","readonly",t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e)))}class um{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.Yo=0,this.Zo=null,this.Xo=!0}ea(){0===this.Yo&&(this.ta("Unknown"),this.Zo=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.Zo=null,this.na("Backend didn't respond within 10 seconds."),this.ta("Offline"),Promise.resolve())))}ra(t){"Online"===this.state?this.ta("Unknown"):(this.Yo++,this.Yo>=1&&(this.ia(),this.na(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.ta("Offline")))}set(t){this.ia(),this.Yo=0,"Online"===t&&(this.Xo=!1),this.ta(t)}ta(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}na(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis 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.Xo?(rl(e),this.Xo=!1):sl("OnlineStateTracker",e)}ia(){null!==this.Zo&&(this.Zo.cancel(),this.Zo=null)}}const hm="RemoteStore";class dm{constructor(t,e,n,s,r){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.sa=[],this._a=new Map,this.oa=new Map,this.aa=new Map,this.ua=new Gg(1e3),this.ca=new Gg(1001),this.la=new Set,this.Ea=[],this.ha=r,this.ha.Qe(t=>{n.enqueueAndForget(async()=>{Cm(this)&&(sl(hm,"Restarting streams for network reachability change."),await async function(t){const e=ll(t);e.la.add(4),await fm(e),e.Ta.set("Unknown"),e.la.delete(4),await pm(e)}(this))})}),this.Ta=new um(n,s)}}async function pm(t){if(Cm(t))for(const e of t.Ea)await e(!0)}async function fm(t){for(const e of t.Ea)await e(!1)}function Cm(t){return 0===ll(t).la.size}async function gm(t,e,n){if(!Tp(e))throw e;t.la.add(1),await fm(t),t.Ta.set("Offline"),n||(n=()=>function(t){const e=ll(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.V_.getLastRemoteSnapshotVersion(t))}(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{sl(hm,"Retrying IndexedDB access"),await n(),t.la.delete(1),await pm(t)})}function mm(t,e){return e().catch(n=>gm(t,n,e))}async function wm(t){const e=ll(t),n=Am(e);let s=e.sa.length>0?e.sa[e.sa.length-1].batchId:-1;for(;ym(e);)try{const t=await lm(e.localStore,s);if(null===t){0===e.sa.length&&n.en();break}s=t.batchId,Em(e,t)}catch(t){await gm(e,t)}Dm(e)&&_m(e)}function ym(t){return Cm(t)&&t.sa.length<10}function Em(t,e){t.sa.push(e);const n=Am(t);n.Yt()&&n.Rn&&n.An(e.mutations)}function Dm(t){return Cm(t)&&!Am(t).Jt()&&t.sa.length>0}function _m(t){Am(t).start()}async function bm(t){Am(t).fn()}async function vm(t){const e=Am(t);for(const n of t.sa)e.An(n.mutations)}async function Im(t,e,n){const s=t.sa.shift(),r=Rg.from(s,e,n);await mm(t,()=>t.remoteSyncer.applySuccessfulWrite(r)),await wm(t)}async function Tm(t,e){e&&Am(t).Rn&&await async function(t,e){if(function(t){return function(t){switch(t){case bl.OK:return al(64938);case bl.CANCELLED:case bl.UNKNOWN:case bl.DEADLINE_EXCEEDED:case bl.RESOURCE_EXHAUSTED:case bl.INTERNAL:case bl.UNAVAILABLE:case bl.UNAUTHENTICATED:return!1;case bl.INVALID_ARGUMENT:case bl.NOT_FOUND:case bl.ALREADY_EXISTS:case bl.PERMISSION_DENIED:case bl.FAILED_PRECONDITION:case bl.ABORTED:case bl.OUT_OF_RANGE:case bl.UNIMPLEMENTED:case bl.DATA_LOSS:return!0;default:return al(15467,{code:t})}}(t)&&t!==bl.ABORTED}(e.code)){const n=t.sa.shift();Am(t).Xt(),await mm(t,()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e)),await wm(t)}}(t,e),Dm(t)&&_m(t)}async function Om(t,e){const n=ll(t);n.asyncQueue.verifyOperationInProgress(),sl(hm,"RemoteStore received new credentials");const s=Cm(n);n.la.add(3),await fm(n),s&&n.Ta.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.la.delete(3),await pm(n)}function Am(t){return t.Ra||(t.Ra=function(t,e,n){const s=ll(t);return s.pn(),new Cp(e,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(t.datastore,t.asyncQueue,{ct:()=>Promise.resolve(),Et:bm.bind(null,t),Tt:Tm.bind(null,t),Vn:vm.bind(null,t),dn:Im.bind(null,t)}),t.Ea.push(async e=>{e?(t.Ra.Xt(),await wm(t)):(await t.Ra.stop(),t.sa.length>0&&(sl(hm,`Stopping write stream with ${t.sa.length} pending writes`),t.sa=[]))})),t.Ra}class Sm{constructor(t,e,n,s,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new Jd,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(t=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,e,n,s,r){const i=Date.now()+n,o=new Sm(t,e,i,s,r);return o.start(n),o}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new vl(bl.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Rm(t,e){if(rl("AsyncQueue",`${e}: ${t}`),Tp(t))return new vl(bl.UNAVAILABLE,`${e}: ${t}`);throw t}class Nm{constructor(){this.activeTargetIds=yd}Ba(t){this.activeTargetIds=this.activeTargetIds.add(t)}Ua(t){this.activeTargetIds=this.activeTargetIds.delete(t)}La(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class xm{constructor(){this.fu=new Nm,this.mu={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t,e=!0){return e&&this.fu.Ba(t),this.mu[t]||"not-current"}updateQueryState(t,e,n){this.mu[t]=e}removeLocalQueryTarget(t){this.fu.Ua(t)}isLocalQueryTarget(t){return this.fu.activeTargetIds.has(t)}clearQueryState(t){delete this.mu[t]}getAllActiveQueryTargets(){return this.fu.activeTargetIds}isActiveQueryTarget(t){return this.fu.activeTargetIds.has(t)}start(){return this.fu=new Nm,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}function km(){return"undefined"!=typeof document?document:null}class Lm{constructor(){this.queries=Fm(),this.onlineState="Unknown",this.Du=new Set}terminate(){!function(t,e){const n=ll(t),s=n.queries;n.queries=Fm(),s.forEach((t,n)=>{for(const t of n.bu)t.onError(e)})}(this,new vl(bl.ABORTED,"Firestore shutting down"))}}function Fm(){return new Bd(t=>Ig(t),Tg)}var Pm;!function(t){t.Default="default",t.Cache="cache"}(Pm||(Pm={}));class Mm{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.hc={},this.Tc=new Bd(t=>Ig(t),Tg),this.Pc=new Map,this.Ic=new Set,this.Rc=new wl(Ll.comparator),this.Ac=new Map,this.Vc=new Kg,this.dc={},this.fc=new Map,this.mc=Gg.bs(),this.onlineState="Unknown",this.gc=void 0}get isPrimaryClient(){return!0===this.gc}}async function Gm(t,e,n){const s=function(t){const e=ll(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Um.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Vm.bind(null,e),e}(t);try{const t=await function(t,e){const n=ll(t),s=$l.now(),r=e.reduce((t,e)=>t.add(e.key),wd());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",t=>{let a=ld(),B=wd();return n.ko.getEntries(t,r).next(t=>{a=t,a.forEach((t,e)=>{e.isValidDocument()||(B=B.add(t))})}).next(()=>n.localDocuments.getOverlayedDocuments(t,a)).next(r=>{i=r;const o=[];for(const t of e){const e=uh(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new ph(t.key,e,Mu(e.value.mapValue),ih.exists(!0)))}return n.mutationQueue.addMutationBatch(t,s,o,e)}).next(e=>{o=e;const s=e.applyToLocalDocumentSet(i,B);return n.documentOverlayCache.saveOverlays(t,e.batchId,s)})}).then(()=>({batchId:o.batchId,changes:dd(i)}))}(s.localStore,e);s.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let s=t.dc[t.currentUser.toKey()];s||(s=new wl(dl)),s=s.insert(e,n),t.dc[t.currentUser.toKey()]=s}(s,t.batchId,n),await Jm(s,t.changes),await wm(s.remoteStore)}catch(t){const e=Rm(t,"Failed to persist write");n.reject(e)}}function Hm(t,e,n){const s=ll(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.Tc.forEach((n,s)=>{const r=s.view.xu(e);r.snapshot&&t.push(r.snapshot)}),function(t,e){const n=ll(t);n.onlineState=e;let s=!1;n.queries.forEach((t,n)=>{for(const t of n.bu)t.xu(e)&&(s=!0)}),s&&function(t){t.Du.forEach(t=>{t.next()})}(n)}(s.eventManager,e),t.length&&s.hc.Tn(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function Um(t,e){const n=ll(t),s=e.batch.batchId;try{const t=await function(t,e){const n=ll(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",t=>{const s=e.batch.keys(),r=n.ko.newChangeBuffer({trackRemovals:!0});return function(t,e,n,s){const r=n.batch,i=r.keys();let o=Ip.resolve();return i.forEach(t=>{o=o.next(()=>s.getEntry(e,t)).next(e=>{const i=n.docVersions.get(t);cl(null!==i,48541),e.version.compareTo(i)<0&&(r.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),s.addEntry(e)))})}),o.next(()=>t.mutationQueue.removeMutationBatch(e,r))}(n,t,e,r).next(()=>r.apply(t)).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=wd();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e))).next(()=>n.localDocuments.getDocuments(t,s))})}(n.localStore,e);$m(n,s,null),jm(n,s),n.sharedClientState.updateMutationState(s,"acknowledged"),await Jm(n,t)}catch(t){await vp(t)}}async function Vm(t,e,n){const s=ll(t);try{const t=await function(t,e){const n=ll(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",t=>{let s;return n.mutationQueue.lookupMutationBatch(t,e).next(e=>(cl(null!==e,37113),s=e.keys(),n.mutationQueue.removeMutationBatch(t,e))).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,s)).next(()=>n.localDocuments.getDocuments(t,s))})}(s.localStore,e);$m(s,e,n),jm(s,e),s.sharedClientState.updateMutationState(e,"rejected",n),await Jm(s,t)}catch(n){await vp(n)}}function jm(t,e){(t.fc.get(e)||[]).forEach(t=>{t.resolve()}),t.fc.delete(e)}function $m(t,e,n){const s=ll(t);let r=s.dc[s.currentUser.toKey()];if(r){const t=r.get(e);t&&(n?t.reject(n):t.resolve(),r=r.remove(e)),s.dc[s.currentUser.toKey()]=r}}async function Jm(t,e,n){const s=ll(t),r=[],i=[],o=[];s.Tc.isEmpty()||(s.Tc.forEach((t,a)=>{o.push(s.yc(a,e,n).then(t=>{if((t||n)&&s.isPrimaryClient){const e=t?!t.fromCache:n?.targetChanges.get(a.targetId)?.current;s.sharedClientState.updateQueryState(a.targetId,e?"current":"not-current")}if(t){r.push(t);const e=rm.mo(a.targetId,t);i.push(e)}}))}),await Promise.all(o),s.hc.Tn(r),await async function(t,e){const n=ll(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",t=>Ip.forEach(e,e=>Ip.forEach(e.Vo,s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s)).next(()=>Ip.forEach(e.fo,s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))}catch(t){if(!Tp(t))throw t;sl("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.Lo.get(e),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.Lo=n.Lo.insert(e,r)}}}(s.localStore,i))}async function qm(t,e){const n=ll(t);if(!n.currentUser.isEqual(e)){sl("SyncEngine","User change. New user:",e.toKey());const t=await cm(n.localStore,e);n.currentUser=e,function(t,e){t.fc.forEach(t=>{t.forEach(t=>{t.reject(new vl(bl.CANCELLED,e))})}),t.fc.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Jm(n,t.$o)}}class zm{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=Gd(t.databaseInfo.databaseId),this.sharedClientState=this.vc(t),this.persistence=this.Dc(t),await this.persistence.start(),this.localStore=this.xc(t),this.gcScheduler=this.Cc(t,this.localStore),this.indexBackfillerScheduler=this.Fc(t,this.localStore)}Cc(t,e){return null}Fc(t,e){return null}xc(t){return function(t,e,n,s){return new Bm(t,e,n,s)}(this.persistence,new am,t.initialUser,this.serializer)}Dc(t){return new tm(nm.b_,this.serializer)}vc(t){return new xm}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}zm.provider={build:()=>new zm};class Km extends zm{constructor(t){super(),this.cacheSizeBytes=t}Cc(t,e){cl(this.persistence.referenceDelegate instanceof sm,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Rp(n,t.asyncQueue,e)}Dc(t){const e=void 0!==this.cacheSizeBytes?Dp.withCacheSize(this.cacheSizeBytes):Dp.DEFAULT;return new tm(t=>sm.b_(t,e),this.serializer)}}class Qm{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Hm(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=qm.bind(null,this.syncEngine),await async function(t,e){const n=ll(t);e?(n.la.delete(2),await pm(n)):e||(n.la.add(2),await fm(n),n.Ta.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Lm}createDatastore(t){const e=Gd(t.databaseInfo.databaseId),n=function(t){return new hp(t)}(t.databaseInfo);return function(t,e,n,s){return new mp(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return function(t,e,n,s,r){return new dm(t,e,n,s,r)}(this.localStore,this.datastore,t.asyncQueue,t=>Hm(this.syncEngine,t,0),sp.Ye()?new sp:new ep)}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Mm(t,e,n,s,r,i);return o&&(a.gc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){await async function(t){const e=ll(t);sl(hm,"RemoteStore shutting down."),e.la.add(5),await fm(e),e.ha.shutdown(),e.Ta.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Qm.provider={build:()=>new Qm};const Wm="FirestoreClient";class Ym{constructor(t,e,n,s,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this._databaseInfo=s,this.user=$d.UNAUTHENTICATED,this.clientId=hl.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async t=>{sl(Wm,"Received user=",t.uid),await this.authCredentialListener(t),this.user=t}),this.appCheckCredentials.start(n,t=>(sl(Wm,"Received new app check token=",t),this.appCheckCredentialListener(t,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(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Jd;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Rm(e,"Failed to shutdown persistence");t.reject(n)}}),t.promise}}async function Xm(t,e){t.asyncQueue.verifyOperationInProgress(),sl(Wm,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener(async t=>{s.isEqual(t)||(await cm(e.localStore,t),s=t)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function Zm(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){sl(Wm,"Using user provided OfflineComponentProvider");try{await Xm(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(t){return"FirebaseError"===t.name?t.code===bl.FAILED_PRECONDITION||t.code===bl.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}(n))throw n;il("Error using user provided cache. Falling back to memory cache: "+n),await Xm(t,new zm)}}else sl(Wm,"Using default OfflineComponentProvider"),await Xm(t,new Km(void 0));return t._offlineComponents}(t);sl(Wm,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(t=>Om(e.remoteStore,t)),t.setAppCheckTokenChangeListener((t,n)=>Om(e.remoteStore,n)),t._onlineComponents=e}function tw(t){return async function(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(sl(Wm,"Using user provided OnlineComponentProvider"),await Zm(t,t._uninitializedComponentsProvider._online)):(sl(Wm,"Using default OnlineComponentProvider"),await Zm(t,new Qm))),t._onlineComponents}(t).then(t=>t.syncEngine)}let ew=class{constructor(t,e,n,s,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Gp(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new nw(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(t){if(this._document){const e=this._document.data.field(qp("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}},nw=class extends ew{data(){return super.data()}};const sw="AsyncQueue";class rw{constructor(t=Promise.resolve()){this.$c=[],this.Kc=!1,this.Qc=[],this.Wc=null,this.Gc=!1,this.zc=!1,this.jc=[],this.Ht=new dp(this,"async_queue_retry"),this.Hc=()=>{const t=km();t&&sl(sw,"Visibility state changed to "+t.visibilityState),this.Ht.$t()},this.Jc=t;const e=km();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Hc)}get isShuttingDown(){return this.Kc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.Yc(),this.Zc(t)}enterRestrictedMode(t){if(!this.Kc){this.Kc=!0,this.zc=t||!1;const e=km();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Hc)}}enqueue(t){if(this.Yc(),this.Kc)return new Promise(()=>{});const e=new Jd;return this.Zc(()=>this.Kc&&this.zc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise)).then(()=>e.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.$c.push(t),this.Xc()))}async Xc(){if(0!==this.$c.length){try{await this.$c[0](),this.$c.shift(),this.Ht.reset()}catch(t){if(!Tp(t))throw t;sl(sw,"Operation failed with retryable error: "+t)}this.$c.length>0&&this.Ht.kt(()=>this.Xc())}}Zc(t){const e=this.Jc.then(()=>(this.Gc=!0,t().catch(t=>{throw this.Wc=t,this.Gc=!1,rl("INTERNAL UNHANDLED ERROR: ",iw(t)),t}).then(t=>(this.Gc=!1,t))));return this.Jc=e,e}enqueueAfterDelay(t,e,n){this.Yc(),this.jc.indexOf(t)>-1&&(e=0);const s=Sm.createAndSchedule(this,t,e,n,t=>this.el(t));return this.Qc.push(s),s}Yc(){this.Wc&&al(47125,{tl:iw(this.Wc)})}verifyOperationInProgress(){}async nl(){let t;do{t=this.Jc,await t}while(t!==this.Jc)}rl(t){for(const e of this.Qc)if(e.timerId===t)return!0;return!1}il(t){return this.nl().then(()=>{this.Qc.sort((t,e)=>t.targetTimeMs-e.targetTimeMs);for(const e of this.Qc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.nl()})}sl(t){this.jc.push(t)}el(t){const e=this.Qc.indexOf(t);this.Qc.splice(e,1)}}function iw(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}class ow extends Fp{constructor(t,e,n,s){super(t,e,n,s),this.type="firestore",this._queue=new rw,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new rw(t),this._firestoreClient=void 0,await t}}}function aw(t){if(t._terminated)throw new vl(bl.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||function(t){const e=t._freezeSettings(),n=function(t,e,n,s,r){return new ru(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,tp(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator,s,r._customHeaders,r.grpcFlowControlWindow)}(t._databaseId,t._app?.options.appId||"",t._persistenceKey,t._app?.options.apiKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new Ym(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(t){const e=t?._online.build();return{_offline:t?._offline.build(e),_online:e}}(t._componentsProvider))}(t),t._firestoreClient}class Bw{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class cw extends ew{constructor(t,e,n,s,r,i){super(t,e,n,s,i),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new lw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(qp("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new vl(bl.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,e={};return e.type=cw._jsonSchemaVersion,e.bundle="",e.bundleSource="DocumentSnapshot",e.bundleName=this._key.toString(),t&&t.isValidDocument()&&t.isFoundDocument()?(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),e.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),e):e}}cw._jsonSchemaVersion="firestore/documentSnapshot/1.0",cw._jsonSchema={type:Hl("string",cw._jsonSchemaVersion),bundleSource:Hl("string","DocumentSnapshot"),bundleName:Hl("string"),bundle:Hl("string")};class lw extends cw{data(t={}){return super.data(t)}}class uw{constructor(t,e,n,s){this._firestore=t,this._userDataWriter=e,this._snapshot=s,this.metadata=new Bw(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const t=[];return this.forEach(e=>t.push(e)),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach(n=>{t.call(e,new lw(this._firestore,this._userDataWriter,n.key,n,new Bw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new vl(bl.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map(n=>{bg(t._snapshot.query)?function(t){const e=function(t){for(let e=t.stages.length-1;e>=0;e--){const n=t.stages[e];if(n instanceof Tf)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(t)}(t._snapshot.query):sd(t.query._query);const s=new lw(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Bw(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:e++}})}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter(t=>e||3!==t.type).map(e=>{const s=new lw(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Bw(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,i=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:hw(e.type),doc:s,oldIndex:r,newIndex:i}})}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new vl(bl.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=uw._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=hl.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const e=[],n=[],s=[];return this.docs.forEach(t=>{null!==t._document&&(e.push(t._document),n.push(this._userDataWriter.convertObjectMap(t._document.data.value.mapValue.fields,"previous")),s.push(t.ref.path))}),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}}function hw(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return al(61501,{type:t})}}function dw(t){return function(t,e){const n=aw(t);return function(t,e){const n=new Jd;return t.asyncQueue.enqueueAndForget(async()=>Gm(await tw(t),e,n)),n.promise}(n,e)}(Gl(t.firestore,ow),[new mh(t._key,ih.none())])}uw._jsonSchemaVersion="firestore/querySnapshot/1.0",uw._jsonSchema={type:Hl("string",uw._jsonSchemaVersion),bundleSource:Hl("string","QuerySnapshot"),bundleName:Hl("string"),bundle:Hl("string")};const pw="@firebase/firestore",fw="4.17.2";!function(t,e=!0){(function(t){tl=t})(_r),mr(new cs("firestore",(t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new ow(new Qd(t.getProvider("auth-internal")),new Zd(r,t.getProvider("app-check-internal")),au(r,n),r);return s={useFetchStreams:e,...s},i._setSettings(s),i},"PUBLIC").setMultipleInstances(!0)),Ir(pw,fw,t),Ir(pw,fw,"esm2020")}();const Cw="firebasestorage.googleapis.com",gw="storageBucket";class mw extends Wn{constructor(t,e,n=0){super(Ew(t),`Firebase Storage: ${e} (${Ew(t)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,mw.prototype)}get status(){return this.status_}set status(t){this.status_=t}_codeEquals(t){return Ew(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var ww,yw;function Ew(t){return"storage/"+t}function Dw(){return new mw(ww.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function _w(){return new mw(ww.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function bw(){return new mw(ww.CANCELED,"User canceled the upload/download.")}function vw(){return new mw(ww.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Iw(t){return new mw(ww.INVALID_ARGUMENT,t)}function Tw(){return new mw(ww.APP_DELETED,"The Firebase app was deleted.")}function Ow(t,e){return new mw(ww.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Aw(t){throw new mw(ww.INTERNAL_ERROR,"Internal error: "+t)}!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"}(ww||(ww={}));class Sw{constructor(t,e){this.bucket=t,this.path_=e}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let n;try{n=Sw.makeFromUrl(t,e)}catch(e){return new Sw(t,"")}if(""===n.path)return n;throw s=t,new mw(ww.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+s+"'.");var s}static makeFromUrl(t,e){let n=null;const s="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}const o=e.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${e===Cw?"(?:storage.googleapis.com|storage.cloud.google.com)":e}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let e=0;e<a.length;e++){const s=a[e],r=s.regex.exec(t);if(r){const t=r[s.indices.bucket];let e=r[s.indices.path];e||(e=""),n=new Sw(t,e),s.postModify(n);break}}if(null==n)throw function(t){return new mw(ww.INVALID_URL,"Invalid URL '"+t+"'.")}(t);return n}}class Rw{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}}function Nw(t){return"string"==typeof t||t instanceof String}function xw(t){return kw()&&t instanceof Blob}function kw(){return"undefined"!=typeof Blob}function Lw(t,e,n,s){if(s<e)throw Iw(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw Iw(`Invalid value for '${t}'. Expected ${n} or less.`)}function Fw(t,e,n){let s=e;return null==n&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function Pw(t){const e=encodeURIComponent;let n="?";for(const s in t)if(t.hasOwnProperty(s)){n=n+(e(s)+"="+e(t[s]))+"&"}return n=n.slice(0,-1),n}function Mw(t,e){const n=t>=500&&t<600,s=-1!==[408,429].indexOf(t),r=-1!==e.indexOf(t);return n||s||r}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(yw||(yw={}));class Gw{constructor(t,e,n,s,r,i,o,a,B,c,l,u=!0,h=!1){this.url_=t,this.method_=e,this.headers_=n,this.body_=s,this.successCodes_=r,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=a,this.timeout_=B,this.progressCallback_=c,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((t,e)=>{this.resolve_=t,this.reject_=e,this.start_()})}start_(){const t=(t,e)=>{if(e)return void t(!1,new Hw(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const s=t=>{const e=t.loaded,n=t.lengthComputable?t.total:-1;null!==this.progressCallback_&&this.progressCallback_(e,n)};null!==this.progressCallback_&&n.addUploadProgressListener(s),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(s),this.pendingConnection_=null;const e=n.getErrorCode()===yw.NO_ERROR,r=n.getStatus();if(!e||Mw(r,this.additionalRetryCodes_)&&this.retry){const e=n.getErrorCode()===yw.ABORT;return void t(!1,new Hw(!1,null,e))}const i=-1!==this.successCodes_.indexOf(r);t(!0,new Hw(i,n))})},e=(t,e)=>{const n=this.resolve_,s=this.reject_,r=e.connection;if(e.wasSuccessCode)try{const t=this.callback_(r,r.getResponse());!function(t){return void 0!==t}(t)?n():n(t)}catch(t){s(t)}else if(null!==r){const t=Dw();t.serverResponse=r.getErrorText(),this.errorCallback_?s(this.errorCallback_(r,t)):s(t)}else if(e.canceled){s(this.appDelete_?Tw():bw())}else{s(_w())}};this.canceled_?e(0,new Hw(!1,null,!0)):this.backoffId_=function(t,e,n){let s=1,r=null,i=null,o=!1,a=0;function B(){return 2===a}let c=!1;function l(...t){c||(c=!0,e.apply(null,t))}function u(e){r=setTimeout(()=>{r=null,t(d,B())},e)}function h(){i&&clearTimeout(i)}function d(t,...e){if(c)return void h();if(t)return h(),void l.call(null,t,...e);if(B()||o)return h(),void l.call(null,t,...e);let n;s<64&&(s*=2),1===a?(a=2,n=0):n=1e3*(s+Math.random()),u(n)}let p=!1;function f(t){p||(p=!0,h(),c||(null!==r?(t||(a=2),clearTimeout(r),u(0)):t||(a=1)))}return u(0),i=setTimeout(()=>{o=!0,f(!0)},n),f}(t,e,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class Hw{constructor(t,e,n){this.wasSuccessCode=t,this.connection=e,this.canceled=!!n}}function Uw(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function Vw(...t){const e=Uw();if(void 0!==e){const n=new e;for(let e=0;e<t.length;e++)n.append(t[e]);return n.getBlob()}if(kw())return new Blob(t);throw new mw(ww.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function jw(t){if("undefined"==typeof atob)throw e="base-64",new mw(ww.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var e;return atob(t)}const $w="raw",Jw="base64",qw="base64url",zw="data_url";class Kw{constructor(t,e){this.data=t,this.contentType=e||null}}function Qw(t,e){switch(t){case $w:return new Kw(Ww(e));case Jw:case qw:return new Kw(Yw(t,e));case zw:return new Kw(function(t){const e=new Xw(t);return e.base64?Yw(Jw,e.rest):function(t){let e;try{e=decodeURIComponent(t)}catch(t){throw Ow(zw,"Malformed data URL.")}return Ww(e)}(e.rest)}(e),new Xw(e).contentType)}throw Dw()}function Ww(t){const e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|63&s);else if(55296==(64512&s)){if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1))){s=65536|(1023&s)<<10|1023&t.charCodeAt(++n),e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s)}else e.push(239,191,189)}else 56320==(64512&s)?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|63&s)}return new Uint8Array(e)}function Yw(t,e){switch(t){case Jw:{const n=-1!==e.indexOf("-"),s=-1!==e.indexOf("_");if(n||s){throw Ow(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case qw:{const n=-1!==e.indexOf("+"),s=-1!==e.indexOf("/");if(n||s){throw Ow(t,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=jw(e)}catch(e){if(e.message.includes("polyfill"))throw e;throw Ow(t,"Invalid character found")}const s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return s}class Xw{constructor(t){this.base64=!1,this.contentType=null;const e=t.match(/^data:([^,]+)?,/);if(null===e)throw Ow(zw,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=e[1]||null;null!=n&&(this.base64=function(t,e){const n=t.length>=e.length;if(!n)return!1;return t.substring(t.length-e.length)===e}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=t.substring(t.indexOf(",")+1)}}class Zw{constructor(t,e){let n=0,s="";xw(t)?(this.data_=t,n=t.size,s=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=s}size(){return this.size_}type(){return this.type_}slice(t,e){if(xw(this.data_)){const n=function(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}(this.data_,t,e);return null===n?null:new Zw(n)}{const n=new Uint8Array(this.data_.buffer,t,e-t);return new Zw(n,!0)}}static getBlob(...t){if(kw()){const e=t.map(t=>t instanceof Zw?t.data_:t);return new Zw(Vw.apply(null,e))}{const e=t.map(t=>Nw(t)?Qw($w,t).data:t.data_);let n=0;e.forEach(t=>{n+=t.byteLength});const s=new Uint8Array(n);let r=0;return e.forEach(t=>{for(let e=0;e<t.length;e++)s[r++]=t[e]}),new Zw(s,!0)}}uploadData(){return this.data_}}function ty(t){let e;try{e=JSON.parse(t)}catch(t){return null}return function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?e:null}function ey(t){const e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function ny(t,e){return e}class sy{constructor(t,e,n,s){this.server=t,this.local=e||t,this.writable=!!n,this.xform=s||ny}}let ry=null;function iy(){if(ry)return ry;const t=[];t.push(new sy("bucket")),t.push(new sy("generation")),t.push(new sy("metageneration")),t.push(new sy("name","fullPath",!0));const e=new sy("name");e.xform=function(t,e){return function(t){return!Nw(t)||t.length<2?t:ey(t)}(e)},t.push(e);const n=new sy("size");return n.xform=function(t,e){return void 0!==e?Number(e):e},t.push(n),t.push(new sy("timeCreated")),t.push(new sy("updated")),t.push(new sy("md5Hash",null,!0)),t.push(new sy("cacheControl",null,!0)),t.push(new sy("contentDisposition",null,!0)),t.push(new sy("contentEncoding",null,!0)),t.push(new sy("contentLanguage",null,!0)),t.push(new sy("contentType",null,!0)),t.push(new sy("metadata","customMetadata",!0)),ry=t,ry}function oy(t,e,n){const s={type:"file"},r=n.length;for(let t=0;t<r;t++){const r=n[t];s[r.local]=r.xform(s,e[r.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){const n=t.bucket,s=t.fullPath,r=new Sw(n,s);return e._makeStorageReference(r)}})}(s,t),s}function ay(t,e,n){const s=ty(e);if(null===s)return null;return oy(t,s,n)}function By(t,e){const n={},s=e.length;for(let r=0;r<s;r++){const s=e[r];s.writable&&(n[s.server]=t[s.local])}return JSON.stringify(n)}const cy="prefixes",ly="items";function uy(t,e,n){const s=ty(n);if(null===s)return null;return function(t,e,n){const s={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[cy])for(const r of n[cy]){const n=r.replace(/\/$/,""),i=t._makeStorageReference(new Sw(e,n));s.prefixes.push(i)}if(n[ly])for(const r of n[ly]){const n=t._makeStorageReference(new Sw(e,r.name));s.items.push(n)}return s}(t,e,s)}class hy{constructor(t,e,n,s){this.url=t,this.method=e,this.handler=n,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function dy(t){if(!t)throw Dw()}function py(t,e){return function(n,s){const r=ay(t,s,e);return dy(null!==r),r}}function fy(t,e){return function(n,s){const r=ay(t,s,e);return dy(null!==r),function(t,e,n,s){const r=ty(e);if(null===r)return null;if(!Nw(r.downloadTokens))return null;const i=r.downloadTokens;if(0===i.length)return null;const o=encodeURIComponent;return i.split(",").map(e=>{const r=t.bucket,i=t.fullPath;return Fw("/b/"+o(r)+"/o/"+o(i),n,s)+Pw({alt:"media",token:e})})[0]}(r,s,t.host,t._protocol)}}function Cy(t){return function(e,n){let s;var r,i;return 401===e.getStatus()?s=e.getErrorText().includes("Firebase App Check token is invalid")?new mw(ww.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new mw(ww.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(i=t.bucket,s=new mw(ww.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(r=t.path,s=new mw(ww.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):s=n,s.status=e.getStatus(),s.serverResponse=n.serverResponse,s}}function gy(t){const e=Cy(t);return function(n,s){let r=e(n,s);var i;return 404===n.getStatus()&&(i=t.path,r=new mw(ww.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),r.serverResponse=s.serverResponse,r}}function my(t,e,n,s,r){const i={};e.isRoot?i.prefix="":i.prefix=e.path+"/",n.length>0&&(i.delimiter=n),s&&(i.pageToken=s),r&&(i.maxResults=r);const o=Fw(e.bucketOnlyServerUrl(),t.host,t._protocol),a=t.maxOperationRetryTime,B=new hy(o,"GET",function(t,e){return function(n,s){const r=uy(t,e,s);return dy(null!==r),r}}(t,e.bucket),a);return B.urlParams=i,B.errorHandler=Cy(e),B}function wy(t,e,n){const s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),s}class yy{constructor(t,e,n,s){this.current=t,this.total=e,this.finalized=!!n,this.metadata=s||null}}function Ey(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){dy(!1)}return dy(!!n&&-1!==(e||["active"]).indexOf(n)),n}const Dy=262144;function _y(t,e,n,s,r,i,o,a){const B=new yy(0,0);if(o?(B.current=o.current,B.total=o.total):(B.current=0,B.total=s.size()),s.size()!==B.total)throw new mw(ww.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=B.total-B.current;let l=c;r>0&&(l=Math.min(l,r));const u=B.current,h=u+l;let d="";d=0===l?"finalize":c===l?"upload, finalize":"upload";const p={"X-Goog-Upload-Command":d,"X-Goog-Upload-Offset":`${B.current}`},f=s.slice(u,h);if(null===f)throw vw();const C=e.maxUploadRetryTime,g=new hy(n,"POST",function(t,n){const r=Ey(t,["active","final"]),o=B.current+l,a=s.size();let c;return c="final"===r?py(e,i)(t,n):null,new yy(o,a,"final"===r,c)},C);return g.headers=p,g.body=f.uploadData(),g.progressCallback=a||null,g.errorHandler=Cy(t),g}const by="running",vy="paused",Iy="success",Ty="canceled",Oy="error";function Ay(t){switch(t){case"running":case"pausing":case"canceling":return by;case"paused":return vy;case"success":return Iy;case"canceled":return Ty;default:return Oy}}class Sy{constructor(t,e,n){const s=function(t){return"function"==typeof t}(t)||null!=e||null!=n;if(s)this.next=t,this.error=e??void 0,this.complete=n??void 0;else{const e=t;this.next=e.next,this.error=e.error,this.complete=e.complete}}}function Ry(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class Ny{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=yw.NO_ERROR,this.sendPromise_=new Promise(t=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=yw.ABORT,t()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=yw.NETWORK_ERROR,t()}),this.xhr_.addEventListener("load",()=>{t()})})}send(t,e,n,s,r){if(this.sent_)throw Aw("cannot .send() more than once");if(as(t)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(const t in r)r.hasOwnProperty(t)&&this.xhr_.setRequestHeader(t,r[t].toString());return void 0!==s?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Aw("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Aw("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}}getResponse(){if(!this.sent_)throw Aw("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Aw("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)}removeUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)}}class xy extends Ny{initXhr(){this.xhr_.responseType="text"}}function ky(){return new xy}class Ly{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(t,e,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=iy(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=t=>{if(this._request=void 0,this._chunkMultiplier=1,t._codeEquals(ww.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const e=this.isExponentialBackoffExpired();if(Mw(t.status,[])){if(!e)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();t=_w()}this._error=t,this._transition("error")}},this._metadataErrorHandler=t=>{this._request=void 0,t._codeEquals(ww.CANCELED)?this.completeTransitions_():(this._error=t,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((t,e)=>{this._resolve=t,this._reject=e,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(t){return t.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(t){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,n])=>{switch(this._state){case"running":t(e,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o=wy(e,s,r),a={name:o.fullPath},B=Fw(i,t.host,t._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=By(o,n),u=t.maxUploadRetryTime,h=new hy(B,"POST",function(t){let e;Ey(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){dy(!1)}return dy(Nw(e)),e},u);return h.urlParams=a,h.headers=c,h.body=l,h.errorHandler=Cy(e),h}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._uploadUrl=t,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const t=this._uploadUrl;this._resolveToken((e,n)=>{const s=function(t,e,n,s){const r=t.maxUploadRetryTime,i=new hy(n,"POST",function(t){const e=Ey(t,["active","final"]);let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){dy(!1)}n||dy(!1);const r=Number(n);return dy(!isNaN(r)),new yy(r,s.size(),"final"===e)},r);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=Cy(e),i}(this._ref.storage,this._ref._location,t,this._blob),r=this._ref.storage._makeRequest(s,ky,e,n);this._request=r,r.getPromise().then(t=>{this._request=void 0,this._updateProgress(t.current),this._needToFetchStatus=!1,t.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const t=Dy*this._chunkMultiplier,e=new yy(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((s,r)=>{let i;try{i=_y(this._ref._location,this._ref.storage,n,this._blob,t,this._mappings,e,this._makeProgressCallback())}catch(t){return this._error=t,void this._transition("error")}const o=this._ref.storage._makeRequest(i,ky,s,r,!1);this._request=o,o.getPromise().then(t=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(t.current),t.finalized?(this._metadata=t.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(Dy*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,e)=>{const n=function(t,e,n){const s=Fw(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new hy(s,"GET",py(t,n),r);return i.errorHandler=gy(e),i}(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let t="";for(let e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();o["Content-Type"]="multipart/related; boundary="+a;const B=wy(e,s,r),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+By(B,n)+"\r\n--"+a+"\r\nContent-Type: "+B.contentType+"\r\n\r\n",l="\r\n--"+a+"--",u=Zw.getBlob(c,s,l);if(null===u)throw vw();const h={name:B.fullPath},d=Fw(i,t.host,t._protocol),p=t.maxUploadRetryTime,f=new hy(d,"POST",py(t,n),p);return f.urlParams=h,f.headers=o,f.body=u.uploadData(),f.errorHandler=Cy(e),f}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(t){const e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()}_transition(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=t,this._notifyObservers();break;case"canceled":this._error=bw(),this._state=t,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const t=Ay(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}}on(t,e,n,s){const r=new Sy(e||void 0,n||void 0,s||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(t,e){return this._promise.then(t,e)}catch(t){return this.then(null,t)}_addObserver(t){this._observers.push(t),this._notifyObserver(t)}_removeObserver(t){const e=this._observers.indexOf(t);-1!==e&&this._observers.splice(e,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(void 0!==this._resolve){let t=!0;switch(Ay(this._state)){case Iy:Ry(this._resolve.bind(null,this.snapshot))();break;case Ty:case Oy:Ry(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(Ay(this._state)){case by:case vy:t.next&&Ry(t.next.bind(t,this.snapshot))();break;case Iy:t.complete&&Ry(t.complete.bind(t))();break;default:t.error&&Ry(t.error.bind(t,this._error))()}}resume(){const t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t}pause(){const t="running"===this._state;return t&&this._transition("pausing"),t}cancel(){const t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t}}class Fy{constructor(t,e){this._service=t,this._location=e instanceof Sw?e:Sw.makeFromUrl(e,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,e){return new Fy(t,e)}get root(){const t=new Sw(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return ey(this._location.path)}get storage(){return this._service}get parent(){const t=function(t){if(0===t.length)return null;const e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this._location.path);if(null===t)return null;const e=new Sw(this._location.bucket,t);return new Fy(this._service,e)}_throwIfRoot(t){if(""===this._location.path)throw function(t){return new mw(ww.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').")}(t)}}function Py(t){const e={prefixes:[],items:[]};return My(t,e).then(()=>e)}async function My(t,e,n){const s={pageToken:n},r=await function(t,e){null!=e&&"number"==typeof e.maxResults&&Lw("options.maxResults",1,1e3,e.maxResults);const n=e||{},s=my(t.storage,t._location,"/",n.pageToken,n.maxResults);return t.storage.makeRequestWithTokens(s,ky)}(t,s);e.prefixes.push(...r.prefixes),e.items.push(...r.items),null!=r.nextPageToken&&await My(t,e,r.nextPageToken)}function Gy(t){t._throwIfRoot("getDownloadURL");const e=function(t,e,n){const s=Fw(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new hy(s,"GET",fy(t,n),r);return i.errorHandler=gy(e),i}(t.storage,t._location,iy());return t.storage.makeRequestWithTokens(e,ky).then(t=>{if(null===t)throw new mw(ww.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})}function Hy(t){t._throwIfRoot("deleteObject");const e=function(t,e){const n=Fw(e.fullServerUrl(),t.host,t._protocol),s=t.maxOperationRetryTime,r=new hy(n,"DELETE",function(t,e){},s);return r.successCodes=[200,204],r.errorHandler=gy(e),r}(t.storage,t._location);return t.storage.makeRequestWithTokens(e,ky)}function Uy(t,e){if(t instanceof $y){const n=t;if(null==n._bucket)throw new mw(ww.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+gw+"' property when initializing the app?");const s=new Fy(n,n._bucket);return null!=e?Uy(s,e):s}return void 0!==e?function(t,e){const n=function(t,e){const n=e.split("/").filter(t=>t.length>0).join("/");return 0===t.length?n:t+"/"+n}(t._location.path,e),s=new Sw(t._location.bucket,n);return new Fy(t.storage,s)}(t,e):t}function Vy(t,e){if(e&&/^[A-Za-z]+:\/\//.test(e)){if(t instanceof $y)return new Fy(t,e);throw Iw("To use ref(service, url), the first argument must be a Storage instance.")}return Uy(t,e)}function jy(t,e){const n=e?.[gw];return null==n?null:Sw.makeFromBucketSpec(n,t)}class $y{constructor(t,e,n,s,r,i=!1){this.app=t,this._authProvider=e,this._appCheckProvider=n,this._url=s,this._firebaseVersion=r,this._isUsingEmulator=i,this._bucket=null,this._host=Cw,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?Sw.makeFromBucketSpec(s,this._host):jy(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,null!=this._url?this._bucket=Sw.makeFromBucketSpec(this._url,t):this._bucket=jy(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){Lw("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){Lw("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const t=this._authProvider.getImmediate({optional:!0});if(t){const e=await t.getToken();if(null!==e)return e.accessToken}return null}async _getAppCheckToken(){if(yr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=this._appCheckProvider.getImmediate({optional:!0});if(t){return(await t.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new Fy(this,t)}_makeRequest(t,e,n,s,r=!0){if(this._deleted)return new Rw(Tw());{const i=function(t,e,n,s,r,i,o=!0,a=!1){const B=Pw(t.urlParams),c=t.url+B,l=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(l,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(l,n),function(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}(l,i),function(t,e){null!==e&&(t["X-Firebase-AppCheck"]=e)}(l,s),new Gw(c,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r,o,a)}(t,this._appId,n,s,e,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(t,e){const[n,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,e,n,s).getPromise()}}const Jy="@firebase/storage",qy="0.14.5",zy="storage";function Ky(t,e,n){return function(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new Ly(t,new Zw(e),n)}(t=os(t),e,n)}function Qy(t){return Py(t=os(t))}function Wy(t){return Hy(t=os(t))}function Yy(t,e){return Vy(t=os(t),e)}function Xy(t=vr(),e){const n=wr(t=os(t),zy).getImmediate({identifier:e}),s=Gn("storage");return s&&function(t,e,n,s={}){!function(t,e,n,s={}){t.host=`${e}:${n}`;const r=as(e);r&&Bs(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=r?"https":"http";const{mockUserToken:i}=s;i&&(t._overrideAuthToken="string"==typeof i?i:jn(i,t.app.options.projectId))}(t,e,n,s)}(n,...s),n}function Zy(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("auth-internal"),r=t.getProvider("app-check-internal");return new $y(n,s,r,e,_r)}mr(new cs(zy,Zy,"PUBLIC").setMultipleInstances(!0)),Ir(Jy,qy,""),Ir(Jy,qy,"esm2020");let tE,eE,nE,sE,rE={},iE=null,oE=!1;const aE=[];let BE;function cE(){return BE}function lE(){return oE}function uE(t){oE?t():aE.push(t)}function hE(){const t="undefined"==typeof process?void 0:process.env,e=t?.FIREBASE_CONFIG;if(!e)return null;const n=JSON.parse(e);return n&&n.apiKey?n:null}function dE(t){if(t&&Object.prototype.hasOwnProperty.call(t,"actionCodeSettings")&&(BE=t.actionCodeSettings),oE){if(t?.app&&t.app!==tE)throw new Error("pwa-auth: Firebase app is already set");return tE}if(t?.app)tE=t.app,rE=tE.options;else{const e=t?.config??hE();if(!e)throw new Error("pwa-auth: pass initialize({ config }) or set window.process.env.FIREBASE_CONFIG");rE=e,tE=br(rE)}return eE=function(t){const e="object"==typeof t?t:vr(),n="string"==typeof t?t:iu,s=wr(e,"firestore").getImmediate({identifier:n});if(!s._initialized){const t=Gn("firestore");t&&Pp(s,...t)}return s}(tE),nE=Xy(tE),sE=nB(tE),iE=sE.currentUser,oE=!0,aE.splice(0).forEach(t=>t()),tE}const pE=hE();pE&&dE({config:pE});const fE={bubbles:!0,composed:!0};function CE(t){return t?{uid:t.uid,displayName:t.displayName,email:t.email,photoURL:t.photoURL,emailVerified:!0===t.emailVerified}:null}function gE(t,e){window.dispatchEvent(new CustomEvent(t,{...fE,detail:e}))}function mE(t){if("object"==typeof t&&null!==t&&"code"in t){const e=String(t.code);return{code:e,message:t instanceof Error?t.message:e}}return{code:"pwa/unknown",message:t instanceof Error?t.message:"Authentication failed"}}const wE=new Set(["auth/popup-closed-by-user","auth/cancelled-popup-request","auth/user-cancelled"]);let yE=null,EE=!1;function DE(){const t=yE;return yE=null,t}function _E(){return new vo}async function bE(t){if(function(t){return/Android|iPhone|iPad|iPod/i.test(t)}("undefined"==typeof navigator?"":navigator.userAgent))return await ba(sE,_E()),"redirect";try{return await async function(t,e,n){if(yr(t.app))return Promise.reject($r(t,"operation-not-supported-in-this-environment"));const s=Yi(t);zr(t,e,Do);const r=ua(s,n);return new ma(s,"signInViaPopup",e,r).executeNotNull()}(sE,_E()),"ok"}catch(t){const e=mE(t).code;if(wE.has(e))return"quiet";if("auth/popup-blocked"===e)return await ba(sE,_E()),"redirect";throw t}}function vE(){EE||(EE=!0,uE(()=>{(async function(t,e){return await Yi(t)._initializationPromise,va(t,e,!1)})(sE).catch(t=>{!function(t){yE=mE(t)}(t)})}))}const IE="pwa-auth-changed",TE="pwa-login",OE="pwa-logout",AE="pwa-signup",SE="pwa-account-deleted",RE="pwa-profile-updated",NE="pwa-email-changed",xE="pwa-password-changed",kE="pwa-reset-sent",LE="pwa-drawer-toggle",FE="pwa-settings",PE="pwa-auth-error",ME="pwa-verification-sent",GE="pwa-email-verified",HE={authChanged:IE,login:TE,logout:OE,signup:AE,accountDeleted:SE,profileUpdated:RE,emailChanged:NE,passwordChanged:xE,resetSent:kE,drawerToggle:LE,settings:FE,authError:PE,verificationSent:ME,emailVerified:GE},UE=128,VE="At least 8 characters. A passphrase works well.",jE="Use at least 8 characters.",$E="Use at most 128 characters.",JE="Passwords don't match.";function qE(t){return t.length<8?{code:"pwa/short-password",message:jE}:t.length>UE?{code:"pwa/long-password",message:$E}:null}const zE={"auth/invalid-email":"Enter a valid email address.","auth/user-not-found":"No account uses that email.","auth/wrong-password":"That password is wrong.","auth/invalid-credential":"That email or password is wrong.","auth/invalid-login-credentials":"That email or password is wrong.","auth/user-token-expired":"This account is no longer available.","auth/invalid-user-token":"This account is no longer available.","auth/user-disabled":"This account is disabled.","auth/email-already-in-use":"An account already uses that email.","auth/account-exists-with-different-credential":"That email already has an account. Sign in with email and password.","auth/weak-password":jE,"auth/too-many-requests":"Too many tries. Wait and try again.","auth/network-request-failed":"Network problem. Try again.","auth/requires-recent-login":"Sign in again, then retry.","pwa/missing-email":"Enter an email address.","pwa/invalid-email":"Enter a valid email address.","pwa/missing-password":"Enter a password.","pwa/short-password":jE,"pwa/long-password":$E,"pwa/current-password":"Enter your current password.","pwa/password-mismatch":JE,"pwa/weak-password":jE,"pwa/signed-out":"Sign in first.","pwa/missing-file":"Choose a photo first.","pwa/not-ready":"Sign-in is not ready yet.","pwa/unknown":"Something went wrong. Try again."};function KE(t){const e=mE(t);return zE[e.code]??"Something went wrong. Try again."}const QE=i`
217
195
 
218
196
  .action-button:focus { outline: 0; }
219
197
 
@@ -223,10 +201,14 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
223
201
  }
224
202
 
225
203
  .action-button {
226
- display: inline-block;
204
+ display: block;
227
205
  box-sizing: border-box;
228
- white-space: nowrap;
229
- margin: 8px 16px 20px auto;
206
+ white-space: normal;
207
+ /* Required - flush to the host. The page sets --pwa_inset when it wants a gap. */
208
+ width: 100%;
209
+ max-width: 100%;
210
+ min-width: 0;
211
+ margin: 8px 0 20px;
230
212
  font-weight: 600;
231
213
  text-align: center;
232
214
  vertical-align: middle;
@@ -236,7 +218,6 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
236
218
  font-size: 16px;
237
219
  min-height: var(--pwa_tap, 44px); /* Required - minimum tap target */
238
220
  height: auto;
239
- max-width: calc(100% - 32px); /* Required - fit 320px */
240
221
  line-height: 1.2;
241
222
  padding: 10px 18px;
242
223
  border-radius: 10px;
@@ -245,17 +226,8 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
245
226
  color: var(--pwa_action_text_color, #fff);
246
227
  background-color: var(--pwa_action_background_color, #2a6b45);
247
228
  border-color: var(--pwa_action_border_color, #214f34);
248
- align-self: start; /* Required - stay under the field when a tab changes height */
249
- justify-self: end;
250
- }
251
-
252
- /* Required - fit 320px */
253
- @media (max-width: 320px) {
254
- .action-button {
255
- white-space: normal;
256
- margin-left: 16px;
257
- margin-right: 16px;
258
- }
229
+ align-self: stretch;
230
+ justify-self: stretch;
259
231
  }
260
232
 
261
233
  .saving{
@@ -269,12 +241,15 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
269
241
  }
270
242
 
271
243
  .google {
272
- display: inline-flex;
244
+ display: flex;
273
245
  align-items: center;
274
246
  justify-content: center;
275
247
  gap: 10px;
276
248
  box-sizing: border-box;
249
+ /* Required - full width of the host. The G mark does not set the width. */
277
250
  width: 100%;
251
+ max-width: 100%;
252
+ min-width: 0;
278
253
  min-height: var(--pwa_tap, 44px);
279
254
  margin: 0 0 8px;
280
255
  padding: 10px 18px;
@@ -312,6 +287,8 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
312
287
  .submit {
313
288
  box-sizing: border-box;
314
289
  width: 100%;
290
+ max-width: 100%;
291
+ min-width: 0;
315
292
  background-color: var(--pwa_action_background_color, #2a6b45);
316
293
  color: white;
317
294
  padding: 14px 20px;
@@ -321,7 +298,25 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
321
298
  cursor: pointer;
322
299
  }
323
300
 
324
- `,jy=i`
301
+ `,WE=i`
302
+
303
+ :host {
304
+ box-sizing: border-box;
305
+ width: 100%;
306
+ min-width: 0;
307
+ max-width: 100%;
308
+ }
309
+
310
+ /* Required - the column fills a narrow host and stops at --pwa_max_width on a wide one. Centered. */
311
+ form {
312
+ box-sizing: border-box;
313
+ width: 100%;
314
+ max-width: min(100%, var(--pwa_max_width, 400px));
315
+ min-width: 0;
316
+ margin-inline: auto;
317
+ margin-block: 0;
318
+ padding-inline: var(--pwa_inset, 0px);
319
+ }
325
320
 
326
321
  label {
327
322
  display: grid;
@@ -332,7 +327,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
332
327
  margin: 0;
333
328
  font-weight: 600;
334
329
  line-height: 1.3;
335
- padding: 0 16px 14px; /* Required - field inset */
330
+ padding: 0 0 14px;
336
331
  }
337
332
 
338
333
  .hint {
@@ -343,7 +338,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
343
338
  line-height: 1.4;
344
339
  }
345
340
 
346
- `,$y=i`
341
+ `,YE=i`
347
342
 
348
343
  input[type=text],
349
344
  input[type=email],
@@ -357,7 +352,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
357
352
  text-align: left;
358
353
  padding: 8px 14px;
359
354
  color: var(--pwa_drawer_text_color, #1c2430);
360
- background-color: var(--pwa_input_background_color, #f3efe6);
355
+ background-color: var(--pwa_input_background_color, var(--pwa_background, #fff));
361
356
  border: 1px solid var(--pwa_line_color, #e3daca);
362
357
  border-radius: 10px;
363
358
  font-size: 1rem;
@@ -365,9 +360,25 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
365
360
 
366
361
  input.invalid { background-color: #ffdddd; }
367
362
 
368
- `,Jy=i`
363
+ /* Required - Chrome paints a yellow autofill. Keep the field on the component background. */
364
+ input:-webkit-autofill,
365
+ input:-webkit-autofill:hover,
366
+ input:-webkit-autofill:focus {
367
+ -webkit-text-fill-color: var(--pwa_drawer_text_color, #1c2430);
368
+ caret-color: var(--pwa_drawer_text_color, #1c2430);
369
+ box-shadow: 0 0 0 1000px var(--pwa_input_background_color, var(--pwa_background, #fff)) inset;
370
+ }
371
+
372
+ `,XE=i`
369
373
 
370
374
  .new {
375
+ display: block;
376
+ box-sizing: border-box;
377
+ width: 100%;
378
+ max-width: 100%;
379
+ min-width: 0;
380
+ margin-left: 0;
381
+ margin-right: 0;
371
382
  border: 0;
372
383
  border-top: 1px solid var(--pwa_line_color, #e3daca);
373
384
  padding: 14px 16px;
@@ -408,10 +419,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
408
419
  opacity: 0.72;
409
420
  }
410
421
 
411
- `,qy=i`
422
+ `,ZE=i`
412
423
 
413
424
  .status {
414
- margin: 0 16px 8px;
425
+ margin: 0 0 8px;
415
426
  color: var(--pwa_label_text_color, #1c2430);
416
427
  font-size: 0.95rem;
417
428
  line-height: 1.4;
@@ -432,55 +443,68 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
432
443
  .status.error { color: var(--pwa_close_color, #9a3b32); }
433
444
 
434
445
  .pair {
435
- display: grid;
436
- grid-template-columns: minmax(0, 1fr) auto;
437
- gap: 8px;
438
- align-items: center;
446
+ display: block;
447
+ position: relative;
448
+ min-width: 0;
449
+ }
450
+
451
+ /* Required - Show sits in the field so the input border matches the column. */
452
+ .pair > input {
453
+ padding-right: 4.75rem;
439
454
  }
440
455
 
441
- `;function zy(e,t,n){return H`
456
+ .pair > .reveal {
457
+ position: absolute;
458
+ top: 0;
459
+ right: 6px;
460
+ height: 48px;
461
+ min-height: 0;
462
+ margin: 0;
463
+ }
464
+
465
+ `;function tD(t,e,n){return U`
442
466
  <p
443
- id="${e}"
467
+ id="${t}"
444
468
  part="status"
445
- class="status ${t?"on":""} ${n}"
469
+ class="status ${e?"on":""} ${n}"
446
470
  role="status"
447
471
  aria-live="polite"
448
- aria-atomic="true">${t}</p>
449
- `}const Ky=i`
472
+ aria-atomic="true">${e}</p>
473
+ `}const eD=i`
450
474
 
451
475
  :host {
452
476
  --pwa_tap: 44px;
453
477
  }
454
478
 
455
- `;function Qy(e,t){return H`
479
+ `;function nD(t,e){return U`
456
480
  <button
457
481
  type="button"
458
482
  class="reveal"
459
483
  part="reveal"
460
- aria-pressed="${e?"true":"false"}"
461
- aria-label="${e?"Hide password":"Show password"}"
462
- @click="${t}">${e?"Hide":"Show"}</button>
463
- `}const Wy=H`
484
+ aria-pressed="${t?"true":"false"}"
485
+ aria-label="${t?"Hide password":"Show password"}"
486
+ @click="${e}">${t?"Hide":"Show"}</button>
487
+ `}const sD=U`
464
488
  <svg class="g" viewBox="0 0 48 48" aria-hidden="true">
465
489
  <path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"></path>
466
490
  <path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"></path>
467
491
  <path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"></path>
468
492
  <path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"></path>
469
493
  </svg>
470
- `;function Yy(e,t){return H`
494
+ `;function rD(t,e){return U`
471
495
  <button
472
496
  type="button"
473
497
  part="google"
474
498
  class="google"
475
- ?disabled="${e}"
476
- @click="${t}">
477
- ${Wy}
499
+ ?disabled="${t}"
500
+ @click="${e}">
501
+ ${sD}
478
502
  Continue with Google
479
503
  </button>
480
- `}let Xy="";const Zy=new Set;function eD(e){const t=e.trim();t!==Xy&&(Xy=t,t&&Zy.forEach(e=>e()))}function tD(){return Xy}var nD=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sD=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let rD=class extends ie{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.resetBusy=!1,this.showPassword=!1,this.signIn=async(e,t)=>{this.busy=!0,this.tone="",this.status="";try{const n=cy((await Sa(WE,e,t)).user);n&&ly(Ey,{user:n})}catch(e){this.show(uy(e))}finally{this.busy=!1}},this.forgot=async()=>{if(this.busy||this.resetBusy)return;this.readFields();const e=this.email.trim();if(e.length<4)this.show({code:"pwa/missing-email",message:"Enter an email address."});else if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){this.resetBusy=!0,this.tone="",this.status="";try{await Oa(WE,e),this.sent(e)}catch(t){"auth/user-not-found"===uy(t).code?this.sent(e):this.show(uy(t))}finally{this.resetBusy=!1}}else this.show({code:"pwa/invalid-email",message:"Enter a valid email address."})}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const e=fy();e&&this.show(e)}static get styles(){return[_n,jy,$y,Vy,Jy,qy,Ky,i`
504
+ `}let iD="";const oD=new Set;function aD(t){const e=t.trim();e!==iD&&(iD=e,e&&oD.forEach(t=>t()))}function BD(){return iD}var cD=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uD=class extends it{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.resetBusy=!1,this.showPassword=!1,this.signIn=async(t,e)=>{this.busy=!0,this.tone="",this.status="";try{const n=CE((await Mo(sE,t,e)).user);n&&gE(TE,{user:n})}catch(t){this.show(mE(t))}finally{this.busy=!1}},this.forgot=async()=>{if(this.busy||this.resetBusy)return;this.readFields();const t=this.email.trim();if(t.length<4)this.show({code:"pwa/missing-email",message:"Enter an email address."});else if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){this.resetBusy=!0,this.tone="",this.status="";try{await Po(sE,t),this.sent(t)}catch(e){"auth/user-not-found"===mE(e).code?this.sent(t):this.show(mE(e))}finally{this.resetBusy=!1}}else this.show({code:"pwa/invalid-email",message:"Enter a valid email address."})}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const t=DE();t&&this.show(t)}static get styles(){return[Sn,WE,YE,QE,XE,ZE,eD,i`
481
505
 
482
506
  :host {
483
- background-color: var(--section_background_color, #fffdf8);
507
+ background-color: var(--pwa_background, var(--section_background_color, #fff));
484
508
  }
485
509
 
486
510
  .double {
@@ -490,7 +514,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
490
514
 
491
515
  form { display: grid; }
492
516
 
493
- `]}render(){const e=`${this.source}-login-email`,t=`${this.source}-login-pass`,n=`${this.source||"page"}-login-status`;return H`
517
+ `]}render(){const t=`${this.source}-login-email`,e=`${this.source}-login-pass`,n=`${this.source||"page"}-login-status`;return U`
494
518
 
495
519
  <!-- Log-in State -->
496
520
  <form
@@ -503,10 +527,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
503
527
 
504
528
  <li>
505
529
 
506
- <label for="${e}">Email
530
+ <label for="${t}">Email
507
531
 
508
532
  <input
509
- id= "${e}"
533
+ id= "${t}"
510
534
  name= "email"
511
535
  part= "email"
512
536
  type= "email"
@@ -525,12 +549,12 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
525
549
 
526
550
  <li>
527
551
 
528
- <label for="${t}">Password
552
+ <label for="${e}">Password
529
553
 
530
554
  <span class="pair">
531
555
 
532
556
  <input
533
- id= "${t}"
557
+ id= "${e}"
534
558
  name= "password"
535
559
  part= "password"
536
560
  type= "${this.showPassword?"text":"password"}"
@@ -540,7 +564,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
540
564
  @input= "${this.handlePassword}"
541
565
  @change= "${this.handlePassword}">
542
566
 
543
- ${Qy(this.showPassword,()=>{this.showPassword=!this.showPassword})}
567
+ ${nD(this.showPassword,()=>{this.showPassword=!this.showPassword})}
544
568
 
545
569
  </span>
546
570
 
@@ -550,9 +574,9 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
550
574
 
551
575
  <li>
552
576
 
553
- ${zy(n,this.status,this.tone)}
577
+ ${tD(n,this.status,this.tone)}
554
578
 
555
- ${this.hideGoogle?"":Yy(this.busy||this.resetBusy,()=>{this.google()})}
579
+ ${this.hideGoogle?"":rD(this.busy||this.resetBusy,()=>{this.google()})}
556
580
 
557
581
  <button
558
582
  type= "submit"
@@ -580,13 +604,13 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
580
604
 
581
605
  </form>
582
606
 
583
- `}change(){gn.dispatch(Yt(this.source))}async google(){if(!this.busy&&!this.resetBusy){this.busy=!0,this.tone="",this.status="";try{await gy()}catch(e){this.show(uy(e))}finally{this.busy=!1}}}show(e,t=!0){this.tone=t?"error":"",this.status=Hy(e),t&&ly(Sy,e)}handleEmail(e){const t=e.target;this.email=t.value,eD(this.email)}handlePassword(e){const t=e.target;this.password=t.value}readFields(){const e=this.renderRoot.querySelector('input[type="email"]'),t=this.renderRoot.querySelector('input[name="password"]');this.email=e?.value??"",this.password=t?.value??"",eD(this.email)}_handleSubmit(e){e.preventDefault(),this.login()}async login(){this.busy||(this.readFields(),this.email.length<4?this.show({code:"pwa/missing-email",message:"Enter an email address."}):this.password?await this.signIn(this.email,this.password):this.show({code:"pwa/missing-password",message:"Enter a password."}))}sent(e){this.tone="",this.status="If an account uses that email, a reset link is on its way.",ly(Ty,{email:e})}};nD([le({type:String}),sD("design:type",Object)],rD.prototype,"source",void 0),nD([le({type:Boolean,attribute:"hide-google",reflect:!0}),sD("design:type",Object)],rD.prototype,"hideGoogle",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"email",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"password",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"status",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"tone",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"busy",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"resetBusy",void 0),nD([ue(),sD("design:type",Object)],rD.prototype,"showPassword",void 0),rD=nD([oe("form-login"),sD("design:paramtypes",[])],rD);const iD="@firebase/installations",aD="0.6.24",oD=1e4,BD=`w:${aD}`,cD="FIS_v2",lD=36e5,uD=new $n("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function hD(e){return e instanceof jn&&e.code.includes("request-failed")}function pD({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function dD(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function fD(e,t){const n=(await t.json()).error;return uD.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function CD({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function gD(e,{refreshToken:t}){const n=CD(e);return n.append("Authorization",function(e){return`${cD} ${e}`}(t)),n}async function mD(e){const t=await e();return t.status>=500&&t.status<600?e():t}function wD(e){return new Promise(t=>{setTimeout(t,e)})}const ED=/^[cdef][\w-]{21}$/;function yD(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return ED.test(t)?t:""}catch{return""}}function DD(e){return`${e.appName}!${e.appId}`}const _D=new Map;function bD(e,t){const n=DD(e);vD(n,t),function(e,t){const n=function(){!ID&&"BroadcastChannel"in self&&(ID=new BroadcastChannel("[Firebase] FID Change"),ID.onmessage=e=>{vD(e.data.key,e.data.fid)});return ID}();n&&n.postMessage({key:e,fid:t});0===_D.size&&ID&&(ID.close(),ID=null)}(n,t)}function vD(e,t){const n=_D.get(e);if(n)for(const e of n)e(t)}let ID=null;const TD="firebase-installations-store";let AD=null;function OD(){return AD||(AD=bs("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(TD)}})),AD}async function SD(e,t){const n=DD(e),s=(await OD()).transaction(TD,"readwrite"),r=s.objectStore(TD),i=await r.get(n);return await r.put(t,n),await s.done,i&&i.fid===t.fid||bD(e,t.fid),t}async function ND(e){const t=DD(e),n=(await OD()).transaction(TD,"readwrite");await n.objectStore(TD).delete(t),await n.done}async function RD(e,t){const n=DD(e),s=(await OD()).transaction(TD,"readwrite"),r=s.objectStore(TD),i=await r.get(n),a=t(i);return void 0===a?await r.delete(n):await r.put(a,n),await s.done,!a||i&&i.fid===a.fid||bD(e,a.fid),a}async function kD(e){let t;const n=await RD(e.appConfig,n=>{const s=function(e){const t=e||{fid:yD(),registrationStatus:0};return FD(t)}(n),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(uD.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const s=pD(e),r=CD(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={fid:n,authVersion:cD,appId:e.appId,sdkVersion:BD},o={method:"POST",headers:r,body:JSON.stringify(a)},B=await mD(()=>fetch(s,o));if(B.ok){const e=await B.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:dD(e.authToken)}}throw await fD("Create Installation",B)}(e,t);return SD(e.appConfig,n)}catch(n){throw hD(n)&&409===n.customData.serverCode?await ND(e.appConfig):await SD(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:s}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:LD(e)}:{installationEntry:t}}(e,s);return t=r.registrationPromise,r.installationEntry});return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function LD(e){let t=await xD(e.appConfig);for(;1===t.registrationStatus;)await wD(100),t=await xD(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await kD(e);return n||t}return t}function xD(e){return RD(e,e=>{if(!e)throw uD.create("installation-not-found");return FD(e)})}function FD(e){return 1===(t=e).registrationStatus&&t.registrationTime+oD<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function PD({appConfig:e,heartbeatServiceProvider:t},n){const s=function(e,{fid:t}){return`${pD(e)}/${t}/authTokens:generate`}(e,n),r=gD(e,n),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={installation:{sdkVersion:BD,appId:e.appId}},o={method:"POST",headers:r,body:JSON.stringify(a)},B=await mD(()=>fetch(s,o));if(B.ok){return dD(await B.json())}throw await fD("Generate Auth Token",B)}async function MD(e,t=!1){let n;const s=await RD(e.appConfig,s=>{if(!UD(s))throw uD.create("not-registered");const r=s.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+lD}(e)}(r))return s;if(1===r.requestStatus)return n=async function(e,t){let n=await GD(e.appConfig);for(;1===n.authToken.requestStatus;)await wD(100),n=await GD(e.appConfig);const s=n.authToken;return 0===s.requestStatus?MD(e,t):s}(e,t),s;{if(!navigator.onLine)throw uD.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return{...e,authToken:t}}(s);return n=async function(e,t){try{const n=await PD(e,t),s={...t,authToken:n};return await SD(e.appConfig,s),n}catch(n){if(!hD(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...t,authToken:{requestStatus:0}};await SD(e.appConfig,n)}else await ND(e.appConfig);throw n}}(e,t),t}});return n?await n:s.authToken}function GD(e){return RD(e,e=>{if(!UD(e))throw uD.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+oD<Date.now()?{...e,authToken:{requestStatus:0}}:e;var n})}function UD(e){return void 0!==e&&2===e.registrationStatus}async function HD(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await kD(e);t&&await t}(n);return(await MD(n,t)).token}function VD(e){return uD.create("missing-app-config-values",{valueName:e})}const jD="installations",$D=e=>{const t=hr(e.getProvider("app").getImmediate(),jD).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:s}=await kD(t);return s?s.catch(console.error):MD(t).catch(console.error),n.fid}(t),getToken:e=>HD(t,e)}};ur(new ns(jD,e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw VD("App Configuration");if(!e.name)throw VD("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw VD(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:hr(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),ur(new ns("installations-internal",$D,"PRIVATE")),wr(iD,aD),wr(iD,aD,"esm2020");const JD="analytics",qD="https://www.googletagmanager.com/gtag/js",zD=new us("@firebase/analytics"),KD=new $n("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function QD(e){if(!e.startsWith(qD)){const t=KD.create("invalid-gtag-resource",{gtagURL:e});return zD.warn(t.message),""}return e}function WD(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function YD(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:QD}),s=document.createElement("script"),r=`${qD}?l=${e}&id=${t}`;s.src=n?n?.createScriptURL(r):r,s.async=!0,document.head.appendChild(s)}function XD(e,t,n,s){return async function(r,...i){try{if("event"===r){const[s,r]=i;await async function(e,t,n,s,r){try{let i=[];if(r&&r.send_to){let e=r.send_to;Array.isArray(e)||(e=[e]);const s=await WD(n);for(const n of e){const e=s.find(e=>e.measurementId===n),r=e&&t[e.appId];if(!r){i=[];break}i.push(r)}}0===i.length&&(i=Object.values(t)),await Promise.all(i),e("event",s,r||{})}catch(e){zD.error(e)}}(e,t,n,s,r)}else if("config"===r){const[r,a]=i;await async function(e,t,n,s,r,i){const a=s[r];try{if(a)await t[a];else{const e=(await WD(n)).find(e=>e.measurementId===r);e&&await t[e.appId]}}catch(e){zD.error(e)}e("config",r,i)}(e,t,n,s,r,a)}else if("consent"===r){const[t,n]=i;e("consent",t,n)}else if("get"===r){const[t,n,s]=i;e("get",t,n,s)}else if("set"===r){const[t]=i;e("set",t)}else e(r,...i)}catch(e){zD.error(e)}}}const ZD=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function e_(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function t_(e,t=ZD,n){const{appId:s,apiKey:r,measurementId:i}=e.options;if(!s)throw KD.create("no-app-id");if(!r){if(i)return{measurementId:i,appId:s};throw KD.create("no-api-key")}const a=t.getThrottleMetadata(s)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new s_;return setTimeout(async()=>{o.abort()},6e4),n_({appId:s,apiKey:r,measurementId:i},a,o,t)}async function n_(e,{throttleEndTimeMillis:t,backoffCount:n},s,r=ZD){const{appId:i,measurementId:a}=e;try{await function(e,t){return new Promise((n,s)=>{const r=Math.max(t-Date.now(),0),i=setTimeout(n,r);e.addEventListener(()=>{clearTimeout(i),s(KD.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}(s,t)}catch(e){if(a)return zD.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${a} provided in the "measurementId" field in the local Firebase config. [${e?.message}]`),{appId:i,measurementId:a};throw e}try{const t=await async function(e){const{appId:t,apiKey:n}=e,s={method:"GET",headers:e_(n)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",t),i=await fetch(r,s);if(200!==i.status&&304!==i.status){let e="";try{const t=await i.json();t.error?.message&&(e=t.error.message)}catch(e){}throw KD.create("config-fetch-failed",{httpStatus:i.status,responseMessage:e})}return i.json()}(e);return r.deleteThrottleMetadata(i),t}catch(t){const o=t;if(!function(e){if(!(e instanceof jn&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(o)){if(r.deleteThrottleMetadata(i),a)return zD.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${a} provided in the "measurementId" field in the local Firebase config. [${o?.message}]`),{appId:i,measurementId:a};throw t}const B=503===Number(o?.customData?.httpStatus)?Xn(n,r.intervalMillis,30):Xn(n,r.intervalMillis),c={throttleEndTimeMillis:Date.now()+B,backoffCount:n+1};return r.setThrottleMetadata(i,c),zD.debug(`Calling attemptFetch again in ${B} millis`),n_(e,c,s,r)}}class s_{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function r_(e,t,n,s,r,i,a){const o=t_(e);o.then(t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&zD.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(e=>zD.error(e)),t.push(o);const B=async function(){if(!Un())return zD.warn(KD.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Hn()}catch(e){return zD.warn(KD.create("indexeddb-unavailable",{errorInfo:e?.toString()}).message),!1}return!0}().then(e=>e?s.getId():void 0),[c,l]=await Promise.all([o,B]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(qD)&&n.src.includes(e))return n;return null})(i)||YD(i,c.measurementId),r("js",new Date);const u=a?.config??{};return u.origin="firebase",u.update=!0,null!=l&&(u.firebase_id=l),r("config",c.measurementId,u),c.measurementId}class i_{constructor(e){this.app=e}_delete(){return delete a_[this.app.options.appId],Promise.resolve()}}let a_={},o_=[];const B_={};let c_,l_,u_="dataLayer",h_=!1;function p_(e,t,n){!function(){const e=[];if(Mn()&&e.push("This is a browser extension environment."),Vn()||e.push("Cookies are not available."),e.length>0){const t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),n=KD.create("invalid-analytics-context",{errorInfo:t});zD.warn(n.message)}}();const s=e.options.appId;if(!s)throw KD.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw KD.create("no-api-key");zD.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=a_[s])throw KD.create("already-exists",{id:s});if(!h_){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(u_);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,s,r){let i=function(...e){window[s].push(arguments)};return window[r]&&"function"==typeof window[r]&&(i=window[r]),window[r]=XD(i,e,t,n),{gtagCore:i,wrappedGtag:window[r]}}(a_,o_,B_,u_,"gtag");l_=e,c_=t,h_=!0}a_[s]=r_(e,o_,B_,t,c_,u_,n);return new i_(e)}function d_(e=mr()){const t=hr(e=Zn(e),JD);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=hr(e,JD);if(n.isInitialized()){const e=n.getImmediate();if(Jn(t,n.getOptions()))return e;throw KD.create("already-initialized")}const s=n.initialize({options:t});return s}(e)}function f_(e,t,n){e=Zn(e),async function(e,t,n,s){if(s&&s.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(l_,a_[e.app.options.appId],t,n).catch(e=>zD.error(e))}function C_(e,t,n,s){e=Zn(e),async function(e,t,n,s,r){if(r&&r.global)e("event",n,s);else{const r=await t;e("event",n,{...s,send_to:r})}}(l_,a_[e.app.options.appId],t,n,s).catch(e=>zD.error(e))}const g_="@firebase/analytics",m_="0.10.25";ur(new ns(JD,(e,{options:t})=>p_(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t),"PUBLIC")),ur(new ns("analytics-internal",function(e){try{const t=e.getProvider(JD).getImmediate();return{logEvent:(e,n,s)=>C_(t,e,n,s),setUserProperties:(e,n)=>f_(t,e,n)}}catch(e){throw KD.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),wr(g_,m_),wr(g_,m_,"esm2020");let w_,E_=null;function y_(){const e=E_;return E_=null,e}function D_(e){E_=e,ly(Sy,e)}let __=Promise.resolve();const b_=()=>{gn.dispatch(rn())};ry(()=>{my(),Qo(zE).useDeviceLanguage(),__=(async()=>{await async function(){if(Mn())return!1;if(!Vn())return!1;if(!Un())return!1;try{return await Hn()}catch(e){return!1}}()&&(w_=d_(zE))})(),xa(WE,e=>{ly(wy,{user:cy(e)}),e?(gn.dispatch(tn(!0)),gn.dispatch(rn()),gn.dispatch(ln(e.uid)),gn.dispatch(un(e.displayName??"")),gn.dispatch(pn(e.email||"")),gn.dispatch(dn(e.photoURL||"")),gn.dispatch(cn(!0===e.emailVerified)),gn.dispatch(en(e.displayName??"")),gn.dispatch(Zt(e.photoURL||""))):(gn.dispatch(tn(!1)),gn.dispatch(ln("")),gn.dispatch(un("")),gn.dispatch(pn("")),gn.dispatch(dn("")),gn.dispatch(cn(!1)),gn.dispatch(en("")),gn.dispatch(Zt("")))})});const v_=async e=>{const t=WE.currentUser;if(!t||!t.email)return D_({code:"pwa/signed-out",message:"Sign in first."}),!1;try{const n=pa.credential(t.email,e);return await async function(e,t){return va(Zn(e),t)}(t,n),!0}catch(e){return D_(uy(e)),!1}},I_=async()=>{if(!sy()){const e={code:"pwa/not-ready",message:"Sign-in is not ready yet."};throw ly(Sy,e),new Error(e.message)}try{await function(e){return Zn(e).signOut()}(WE),ly(yy,{user:null})}catch(e){throw ly(Sy,uy(e)),e}},T_=async()=>{await __,w_&&C_(w_,"create_account")},A_=async()=>{await __,w_&&C_(w_,"delete_account")},O_=async(e,t)=>{await aw(Ld(KE,e,t))};let S_="",N_=!1,R_=!1;function k_(e){if(!e)return S_="",N_=!1,!1;const t=!0===e.emailVerified;return e.uid!==S_?(S_=e.uid,N_=t,!1):!N_&&t?(N_=!0,!0):(N_=t,!1)}function L_(e){gn.dispatch(cn(!0));const t=cy({...e,emailVerified:!0});t&&ly(Ry,{user:t})}async function x_(e){if(!sy())return!1;const t=WE.currentUser;if(!t)return k_(null),!1;try{await t.reload()}catch(n){return e&&ly(Sy,uy(n)),!0===t.emailVerified}return gn.dispatch(cn(!0===t.emailVerified)),k_(t)&&L_(t),!0===t.emailVerified}function F_(){x_(!1)}function P_(){"visible"===document.visibilityState&&x_(!1)}function M_(e,t){const n={code:e,message:t};throw ly(Sy,n),Object.assign(new Error(t),n)}async function G_(){sy()||M_("pwa/not-ready","Sign-in is not ready yet.");const e=WE.currentUser;if(e||M_("pwa/signed-out","Sign in first."),e.email||M_("pwa/missing-email","Enter an email address."),e.emailVerified)return!1;const t=ny();try{t?await Na(e,t):await Na(e)}catch(e){throw ly(Sy,uy(e)),e}return ly(Ny,{email:e.email}),!0}async function U_(){return x_(!0)}R_||(R_=!0,ry(()=>{xa(WE,e=>{e&&k_(e)&&L_(e),e||k_(null)}),"undefined"!=typeof window&&(window.addEventListener("focus",F_),document.addEventListener("visibilitychange",P_))}));const H_=i`
607
+ `}change(){bn.dispatch(rn(this.source))}async google(){if(!this.busy&&!this.resetBusy){this.busy=!0,this.tone="",this.status="";try{await bE()}catch(t){this.show(mE(t))}finally{this.busy=!1}}}show(t,e=!0){this.tone=e?"error":"",this.status=KE(t),e&&gE(PE,t)}handleEmail(t){const e=t.target;this.email=e.value,aD(this.email)}handlePassword(t){const e=t.target;this.password=e.value}readFields(){const t=this.renderRoot.querySelector('input[type="email"]'),e=this.renderRoot.querySelector('input[name="password"]');this.email=t?.value??"",this.password=e?.value??"",aD(this.email)}_handleSubmit(t){t.preventDefault(),this.login()}async login(){this.busy||(this.readFields(),this.email.length<4?this.show({code:"pwa/missing-email",message:"Enter an email address."}):this.password?await this.signIn(this.email,this.password):this.show({code:"pwa/missing-password",message:"Enter a password."}))}sent(t){this.tone="",this.status="If an account uses that email, a reset link is on its way.",gE(kE,{email:t})}};cD([lt({type:String}),lD("design:type",Object)],uD.prototype,"source",void 0),cD([lt({type:Boolean,attribute:"hide-google",reflect:!0}),lD("design:type",Object)],uD.prototype,"hideGoogle",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"email",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"password",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"status",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"tone",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"busy",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"resetBusy",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"showPassword",void 0),uD=cD([at("form-login"),lD("design:paramtypes",[])],uD);const hD="@firebase/installations",dD="0.6.24",pD=1e4,fD=`w:${dD}`,CD="FIS_v2",gD=36e5,mD=new Yn("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function wD(t){return t instanceof Wn&&t.code.includes("request-failed")}function yD({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function ED(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function DD(t,e){const n=(await e.json()).error;return mD.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function _D({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function bD(t,{refreshToken:e}){const n=_D(t);return n.append("Authorization",function(t){return`${CD} ${t}`}(e)),n}async function vD(t){const e=await t();return e.status>=500&&e.status<600?t():e}function ID(t){return new Promise(e=>{setTimeout(e,t)})}const TD=/^[cdef][\w-]{21}$/;function OD(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){const e=(n=t,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return e.substr(0,22)}(t);return TD.test(e)?e:""}catch{return""}}function AD(t){return`${t.appName}!${t.appId}`}const SD=new Map;function RD(t,e){const n=AD(t);ND(n,e),function(t,e){const n=function(){!xD&&"BroadcastChannel"in self&&(xD=new BroadcastChannel("[Firebase] FID Change"),xD.onmessage=t=>{ND(t.data.key,t.data.fid)});return xD}();n&&n.postMessage({key:t,fid:e});0===SD.size&&xD&&(xD.close(),xD=null)}(n,e)}function ND(t,e){const n=SD.get(t);if(n)for(const t of n)t(e)}let xD=null;const kD="firebase-installations-store";let LD=null;function FD(){return LD||(LD=Rs("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(kD)}})),LD}async function PD(t,e){const n=AD(t),s=(await FD()).transaction(kD,"readwrite"),r=s.objectStore(kD),i=await r.get(n);return await r.put(e,n),await s.done,i&&i.fid===e.fid||RD(t,e.fid),e}async function MD(t){const e=AD(t),n=(await FD()).transaction(kD,"readwrite");await n.objectStore(kD).delete(e),await n.done}async function GD(t,e){const n=AD(t),s=(await FD()).transaction(kD,"readwrite"),r=s.objectStore(kD),i=await r.get(n),o=e(i);return void 0===o?await r.delete(n):await r.put(o,n),await s.done,!o||i&&i.fid===o.fid||RD(t,o.fid),o}async function HD(t){let e;const n=await GD(t.appConfig,n=>{const s=function(t){const e=t||{fid:OD(),registrationStatus:0};return jD(e)}(n),r=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(mD.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=yD(t),r=_D(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={fid:n,authVersion:CD,appId:t.appId,sdkVersion:fD},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await vD(()=>fetch(s,a));if(B.ok){const t=await B.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:ED(t.authToken)}}throw await DD("Create Installation",B)}(t,e);return PD(t.appConfig,n)}catch(n){throw wD(n)&&409===n.customData.serverCode?await MD(t.appConfig):await PD(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:s}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:UD(t)}:{installationEntry:e}}(t,s);return e=r.registrationPromise,r.installationEntry});return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function UD(t){let e=await VD(t.appConfig);for(;1===e.registrationStatus;)await ID(100),e=await VD(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await HD(t);return n||e}return e}function VD(t){return GD(t,t=>{if(!t)throw mD.create("installation-not-found");return jD(t)})}function jD(t){return 1===(e=t).registrationStatus&&e.registrationTime+pD<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function $D({appConfig:t,heartbeatServiceProvider:e},n){const s=function(t,{fid:e}){return`${yD(t)}/${e}/authTokens:generate`}(t,n),r=bD(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={installation:{sdkVersion:fD,appId:t.appId}},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await vD(()=>fetch(s,a));if(B.ok){return ED(await B.json())}throw await DD("Generate Auth Token",B)}async function JD(t,e=!1){let n;const s=await GD(t.appConfig,s=>{if(!zD(s))throw mD.create("not-registered");const r=s.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+gD}(t)}(r))return s;if(1===r.requestStatus)return n=async function(t,e){let n=await qD(t.appConfig);for(;1===n.authToken.requestStatus;)await ID(100),n=await qD(t.appConfig);const s=n.authToken;return 0===s.requestStatus?JD(t,e):s}(t,e),s;{if(!navigator.onLine)throw mD.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return{...t,authToken:e}}(s);return n=async function(t,e){try{const n=await $D(t,e),s={...e,authToken:n};return await PD(t.appConfig,s),n}catch(n){if(!wD(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...e,authToken:{requestStatus:0}};await PD(t.appConfig,n)}else await MD(t.appConfig);throw n}}(t,e),e}});return n?await n:s.authToken}function qD(t){return GD(t,t=>{if(!zD(t))throw mD.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+pD<Date.now()?{...t,authToken:{requestStatus:0}}:t;var n})}function zD(t){return void 0!==t&&2===t.registrationStatus}async function KD(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await HD(t);e&&await e}(n);return(await JD(n,e)).token}function QD(t){return mD.create("missing-app-config-values",{valueName:t})}const WD="installations",YD=t=>{const e=wr(t.getProvider("app").getImmediate(),WD).getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:s}=await HD(e);return s?s.catch(console.error):JD(e).catch(console.error),n.fid}(e),getToken:t=>KD(e,t)}};mr(new cs(WD,t=>{const e=t.getProvider("app").getImmediate(),n=function(t){if(!t||!t.options)throw QD("App Configuration");if(!t.name)throw QD("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw QD(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:n,heartbeatServiceProvider:wr(e,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),mr(new cs("installations-internal",YD,"PRIVATE")),Ir(hD,dD),Ir(hD,dD,"esm2020");const XD="analytics",ZD="https://www.googletagmanager.com/gtag/js",t_=new ms("@firebase/analytics"),e_=new Yn("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function n_(t){if(!t.startsWith(ZD)){const e=e_.create("invalid-gtag-resource",{gtagURL:t});return t_.warn(e.message),""}return t}function s_(t){return Promise.all(t.map(t=>t.catch(t=>t)))}function r_(t,e){const n=function(t,e){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(t,e)),n}("firebase-js-sdk-policy",{createScriptURL:n_}),s=document.createElement("script"),r=`${ZD}?l=${t}&id=${e}`;s.src=n?n?.createScriptURL(r):r,s.async=!0,document.head.appendChild(s)}function i_(t,e,n,s){return async function(r,...i){try{if("event"===r){const[s,r]=i;await async function(t,e,n,s,r){try{let i=[];if(r&&r.send_to){let t=r.send_to;Array.isArray(t)||(t=[t]);const s=await s_(n);for(const n of t){const t=s.find(t=>t.measurementId===n),r=t&&e[t.appId];if(!r){i=[];break}i.push(r)}}0===i.length&&(i=Object.values(e)),await Promise.all(i),t("event",s,r||{})}catch(t){t_.error(t)}}(t,e,n,s,r)}else if("config"===r){const[r,o]=i;await async function(t,e,n,s,r,i){const o=s[r];try{if(o)await e[o];else{const t=(await s_(n)).find(t=>t.measurementId===r);t&&await e[t.appId]}}catch(t){t_.error(t)}t("config",r,i)}(t,e,n,s,r,o)}else if("consent"===r){const[e,n]=i;t("consent",e,n)}else if("get"===r){const[e,n,s]=i;t("get",e,n,s)}else if("set"===r){const[e]=i;t("set",e)}else t(r,...i)}catch(t){t_.error(t)}}}const o_=new class{constructor(t={},e=1e3){this.throttleMetadata=t,this.intervalMillis=e}getThrottleMetadata(t){return this.throttleMetadata[t]}setThrottleMetadata(t,e){this.throttleMetadata[t]=e}deleteThrottleMetadata(t){delete this.throttleMetadata[t]}};function a_(t){return new Headers({Accept:"application/json","x-goog-api-key":t})}async function B_(t,e=o_,n){const{appId:s,apiKey:r,measurementId:i}=t.options;if(!s)throw e_.create("no-app-id");if(!r){if(i)return{measurementId:i,appId:s};throw e_.create("no-api-key")}const o=e.getThrottleMetadata(s)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new l_;return setTimeout(async()=>{a.abort()},6e4),c_({appId:s,apiKey:r,measurementId:i},o,a,e)}async function c_(t,{throttleEndTimeMillis:e,backoffCount:n},s,r=o_){const{appId:i,measurementId:o}=t;try{await function(t,e){return new Promise((n,s)=>{const r=Math.max(e-Date.now(),0),i=setTimeout(n,r);t.addEventListener(()=>{clearTimeout(i),s(e_.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}(s,e)}catch(t){if(o)return t_.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${t?.message}]`),{appId:i,measurementId:o};throw t}try{const e=await async function(t){const{appId:e,apiKey:n}=t,s={method:"GET",headers:a_(n)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",e),i=await fetch(r,s);if(200!==i.status&&304!==i.status){let t="";try{const e=await i.json();e.error?.message&&(t=e.error.message)}catch(t){}throw e_.create("config-fetch-failed",{httpStatus:i.status,responseMessage:t})}return i.json()}(t);return r.deleteThrottleMetadata(i),e}catch(e){const a=e;if(!function(t){if(!(t instanceof Wn&&t.customData))return!1;const e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(a)){if(r.deleteThrottleMetadata(i),o)return t_.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${a?.message}]`),{appId:i,measurementId:o};throw e}const B=503===Number(a?.customData?.httpStatus)?is(n,r.intervalMillis,30):is(n,r.intervalMillis),c={throttleEndTimeMillis:Date.now()+B,backoffCount:n+1};return r.setThrottleMetadata(i,c),t_.debug(`Calling attemptFetch again in ${B} millis`),c_(t,c,s,r)}}class l_{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach(t=>t())}}async function u_(t,e,n,s,r,i,o){const a=B_(t);a.then(e=>{n[e.measurementId]=e.appId,t.options.measurementId&&e.measurementId!==t.options.measurementId&&t_.warn(`The measurement ID in the local Firebase config (${t.options.measurementId}) does not match the measurement ID fetched from the server (${e.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(t=>t_.error(t)),e.push(a);const B=async function(){if(!zn())return t_.warn(e_.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Kn()}catch(t){return t_.warn(e_.create("indexeddb-unavailable",{errorInfo:t?.toString()}).message),!1}return!0}().then(t=>t?s.getId():void 0),[c,l]=await Promise.all([a,B]);(function(t){const e=window.document.getElementsByTagName("script");for(const n of Object.values(e))if(n.src&&n.src.includes(ZD)&&n.src.includes(t))return n;return null})(i)||r_(i,c.measurementId),r("js",new Date);const u=o?.config??{};return u.origin="firebase",u.update=!0,null!=l&&(u.firebase_id=l),r("config",c.measurementId,u),c.measurementId}class h_{constructor(t){this.app=t}_delete(){return delete d_[this.app.options.appId],Promise.resolve()}}let d_={},p_=[];const f_={};let C_,g_,m_="dataLayer",w_=!1;function y_(t,e,n){!function(){const t=[];if(Jn()&&t.push("This is a browser extension environment."),Qn()||t.push("Cookies are not available."),t.length>0){const e=t.map((t,e)=>`(${e+1}) ${t}`).join(" "),n=e_.create("invalid-analytics-context",{errorInfo:e});t_.warn(n.message)}}();const s=t.options.appId;if(!s)throw e_.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw e_.create("no-api-key");t_.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${t.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=d_[s])throw e_.create("already-exists",{id:s});if(!w_){!function(t){let e=[];Array.isArray(window[t])?e=window[t]:window[t]=e}(m_);const{wrappedGtag:t,gtagCore:e}=function(t,e,n,s,r){let i=function(...t){window[s].push(arguments)};return window[r]&&"function"==typeof window[r]&&(i=window[r]),window[r]=i_(i,t,e,n),{gtagCore:i,wrappedGtag:window[r]}}(d_,p_,f_,m_,"gtag");g_=t,C_=e,w_=!0}d_[s]=u_(t,p_,f_,e,C_,m_,n);return new h_(t)}function E_(t=vr()){const e=wr(t=os(t),XD);return e.isInitialized()?e.getImmediate():function(t,e={}){const n=wr(t,XD);if(n.isInitialized()){const t=n.getImmediate();if(Xn(e,n.getOptions()))return t;throw e_.create("already-initialized")}const s=n.initialize({options:e});return s}(t)}function D_(t,e,n){t=os(t),async function(t,e,n,s){if(s&&s.global){const e={};for(const t of Object.keys(n))e[`user_properties.${t}`]=n[t];return t("set",e),Promise.resolve()}t("config",await e,{update:!0,user_properties:n})}(g_,d_[t.app.options.appId],e,n).catch(t=>t_.error(t))}function __(t,e,n,s){t=os(t),async function(t,e,n,s,r){if(r&&r.global)t("event",n,s);else{const r=await e;t("event",n,{...s,send_to:r})}}(g_,d_[t.app.options.appId],e,n,s).catch(t=>t_.error(t))}const b_="@firebase/analytics",v_="0.10.25";mr(new cs(XD,(t,{options:e})=>y_(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),e),"PUBLIC")),mr(new cs("analytics-internal",function(t){try{const e=t.getProvider(XD).getImmediate();return{logEvent:(t,n,s)=>__(e,t,n,s),setUserProperties:(t,n)=>D_(e,t,n)}}catch(t){throw e_.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),Ir(b_,v_),Ir(b_,v_,"esm2020");let I_,T_=null;function O_(){const t=T_;return T_=null,t}function A_(t){T_=t,gE(PE,t)}let S_=Promise.resolve();const R_=()=>{bn.dispatch(hn())};uE(()=>{vE(),nB(tE).useDeviceLanguage(),S_=(async()=>{await async function(){if(Jn())return!1;if(!Qn())return!1;if(!zn())return!1;try{return await Kn()}catch(t){return!1}}()&&(I_=E_(tE))})(),jo(sE,t=>{gE(IE,{user:CE(t)}),t?(bn.dispatch(cn(!0)),bn.dispatch(hn()),bn.dispatch(gn(t.uid)),bn.dispatch(mn(t.displayName??"")),bn.dispatch(yn(t.email||"")),bn.dispatch(En(t.photoURL||"")),bn.dispatch(Cn(!0===t.emailVerified)),bn.dispatch(Bn(t.displayName??"")),bn.dispatch(an(t.photoURL||""))):(bn.dispatch(cn(!1)),bn.dispatch(gn("")),bn.dispatch(mn("")),bn.dispatch(yn("")),bn.dispatch(En("")),bn.dispatch(Cn(!1)),bn.dispatch(Bn("")),bn.dispatch(an("")))})});const N_=async t=>{const e=sE.currentUser;if(!e||!e.email)return A_({code:"pwa/signed-out",message:"Sign in first."}),!1;try{const n=Eo.credential(e.email,t);return await async function(t,e){return xo(os(t),e)}(e,n),!0}catch(t){return A_(mE(t)),!1}},x_=async()=>{if(!lE()){const t={code:"pwa/not-ready",message:"Sign-in is not ready yet."};throw gE(PE,t),new Error(t.message)}try{await function(t){return os(t).signOut()}(sE),gE(OE,{user:null})}catch(t){throw gE(PE,mE(t)),t}},k_=async()=>{await S_,I_&&__(I_,"create_account")},L_=async()=>{await S_,I_&&__(I_,"delete_account")},F_=async(t,e)=>{await dw(Up(eE,t,e))};let P_="",M_=!1,G_=!1;function H_(t){if(!t)return P_="",M_=!1,!1;const e=!0===t.emailVerified;return t.uid!==P_?(P_=t.uid,M_=e,!1):!M_&&e?(M_=!0,!0):(M_=e,!1)}function U_(t){bn.dispatch(Cn(!0));const e=CE({...t,emailVerified:!0});e&&gE(GE,{user:e})}async function V_(t){if(!lE())return!1;const e=sE.currentUser;if(!e)return H_(null),!1;try{await e.reload()}catch(n){return t&&gE(PE,mE(n)),!0===e.emailVerified}return bn.dispatch(Cn(!0===e.emailVerified)),H_(e)&&U_(e),!0===e.emailVerified}function j_(){V_(!1)}function $_(){"visible"===document.visibilityState&&V_(!1)}function J_(t,e){const n={code:t,message:e};throw gE(PE,n),Object.assign(new Error(e),n)}async function q_(){lE()||J_("pwa/not-ready","Sign-in is not ready yet.");const t=sE.currentUser;if(t||J_("pwa/signed-out","Sign in first."),t.email||J_("pwa/missing-email","Enter an email address."),t.emailVerified)return!1;const e=cE();try{e?await Go(t,e):await Go(t)}catch(t){throw gE(PE,mE(t)),t}return gE(ME,{email:t.email}),!0}async function z_(){return V_(!0)}G_||(G_=!0,uE(()=>{jo(sE,t=>{t&&H_(t)&&U_(t),t||H_(null)}),"undefined"!=typeof window&&(window.addEventListener("focus",j_),document.addEventListener("visibilitychange",$_))}));const K_=i`
584
608
 
585
609
  .notice {
586
- margin: 4px 16px 8px;
587
- padding: 14px 16px 16px;
610
+ margin: 4px 0 8px;
611
+ padding: 14px 0 16px;
588
612
  color: var(--pwa_label_text_color, #1c2430);
589
- background: var(--pwa_nav_on_background, #f3efe6);
613
+ background: var(--pwa_nav_on_background, #f2f2f2);
590
614
  border: 1px solid var(--pwa_line_color, #e3daca);
591
615
  border-radius: 10px;
592
616
  }
@@ -597,10 +621,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
597
621
  line-height: 1.45;
598
622
  }
599
623
 
600
- `;let V_="";const j_=new Set;function $_(){return V_}function J_(e){return j_.add(e),()=>{j_.delete(e)}}var q_=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},z_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let K_=class extends ie{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.showPassword=!1,this.notice="",this.newAccount=async(e,t)=>{this.busy=!0,this.tone="",this.status="";try{const n=await async function(e,t,n){if(pr(e.app))return Promise.reject(Gr(e));const s=$i(e),r=ea(s,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Ea),i=await r.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&Aa(e),t}),a=await ya._fromIdTokenResponse(s,"signIn",i);return await s._updateCurrentUser(a.user),a}(WE,e,t);await T_();const s=cy(n.user);s&&ly(Dy,{user:s});try{await G_(),this.notice="Check your inbox for the verification email. You can still sign in.",function(e){V_=e,j_.forEach(e=>e())}(e)}catch(e){this.tone="error",this.status=Hy(e)}}catch(e){this.show(uy(e))}finally{this.busy=!1}}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const e=fy();e&&this.show(e)}static get styles(){return[_n,jy,$y,Vy,Jy,qy,H_,Ky,i`
624
+ `;let Q_="";const W_=new Set;function Y_(){return Q_}function X_(t){return W_.add(t),()=>{W_.delete(t)}}var Z_=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},tb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eb=class extends it{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.showPassword=!1,this.notice="",this.newAccount=async(t,e)=>{this.busy=!0,this.tone="",this.status="";try{const n=await async function(t,e,n){if(yr(t.app))return Promise.reject(qr(t));const s=Yi(t),r=ao(s,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Oo),i=await r.catch(e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Fo(t),e}),o=await Ao._fromIdTokenResponse(s,"signIn",i);return await s._updateCurrentUser(o.user),o}(sE,t,e);await k_();const s=CE(n.user);s&&gE(AE,{user:s});try{await q_(),this.notice="Check your inbox for the verification email. You can still sign in.",function(t){Q_=t,W_.forEach(t=>t())}(t)}catch(t){this.tone="error",this.status=KE(t)}}catch(t){this.show(mE(t))}finally{this.busy=!1}}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const t=DE();t&&this.show(t)}static get styles(){return[Sn,WE,YE,QE,XE,ZE,K_,eD,i`
601
625
 
602
626
  :host {
603
- background-color: var(--section_background_color, #fffdf8);
627
+ background-color: var(--pwa_background, var(--section_background_color, #fff));
604
628
  }
605
629
 
606
630
  .double {
@@ -610,7 +634,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
610
634
 
611
635
  form { display: grid; }
612
636
 
613
- `]}render(){const e=`${this.source}-signup-email`,t=`${this.source}-signup-pass`,n=`${this.source||"page"}-signup-password-hint`,s=`${this.source||"page"}-signup-status`;return H`
637
+ `]}render(){const t=`${this.source}-signup-email`,e=`${this.source}-signup-pass`,n=`${this.source||"page"}-signup-password-hint`,s=`${this.source||"page"}-signup-status`;return U`
614
638
 
615
639
  <!-- Sign Up State-->
616
640
  <form
@@ -623,10 +647,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
623
647
 
624
648
  <li>
625
649
 
626
- <label for="${e}">Email
650
+ <label for="${t}">Email
627
651
 
628
652
  <input
629
- id= "${e}"
653
+ id= "${t}"
630
654
  name= "email"
631
655
  part= "email"
632
656
  type= "email"
@@ -645,28 +669,28 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
645
669
 
646
670
  <li>
647
671
 
648
- <label for="${t}">Password
672
+ <label for="${e}">Password
649
673
 
650
674
  <span class="pair">
651
675
 
652
676
  <input
653
- id= "${t}"
677
+ id= "${e}"
654
678
  name= "new-password"
655
679
  part= "password"
656
680
  type= "${this.showPassword?"text":"password"}"
657
681
  autocomplete= "new-password"
658
682
  minlength= "${8}"
659
- maxlength= "${Ly}"
683
+ maxlength= "${UE}"
660
684
  aria-invalid= "${"error"===this.tone?"true":"false"}"
661
685
  aria-describedby="${n} ${s}"
662
686
  @input= "${this.handlePassword}"
663
687
  @change= "${this.handlePassword}">
664
688
 
665
- ${Qy(this.showPassword,()=>{this.showPassword=!this.showPassword})}
689
+ ${nD(this.showPassword,()=>{this.showPassword=!this.showPassword})}
666
690
 
667
691
  </span>
668
692
 
669
- <p id="${n}" class="hint" part="hint">${xy}</p>
693
+ <p id="${n}" class="hint" part="hint">${VE}</p>
670
694
 
671
695
  </label>
672
696
 
@@ -674,9 +698,9 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
674
698
 
675
699
  <li>
676
700
 
677
- ${zy(s,this.status,this.tone)}
701
+ ${tD(s,this.status,this.tone)}
678
702
 
679
- ${this.hideGoogle?"":Yy(this.busy,()=>{this.google()})}
703
+ ${this.hideGoogle?"":rD(this.busy,()=>{this.google()})}
680
704
 
681
705
  <button
682
706
  type= "submit"
@@ -689,7 +713,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
689
713
 
690
714
  </ul>
691
715
 
692
- ${this.notice?H`
716
+ ${this.notice?U`
693
717
  <p class="notice" part="notice" role="status" aria-live="polite">${this.notice}</p>
694
718
  `:""}
695
719
 
@@ -701,12 +725,28 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
701
725
 
702
726
  </form>
703
727
 
704
- `}change(){gn.dispatch(Yt(this.source))}async google(){if(!this.busy){this.busy=!0,this.tone="",this.status="";try{await gy()}catch(e){this.show(uy(e))}finally{this.busy=!1}}}show(e){this.tone="error",this.status=Hy(e),ly(Sy,e)}readFields(){const e=this.renderRoot.querySelector('input[type="email"]'),t=this.renderRoot.querySelector('input[name="new-password"]');this.email=e?.value??"",this.password=t?.value??""}_handleSubmit(e){e.preventDefault(),this.signUp()}handleEmail(e){const t=e.target;this.email=t.value}handlePassword(e){const t=e.target;this.password=t.value}async signUp(){if(this.busy)return;if(this.readFields(),this.email.length<4)return void this.show({code:"pwa/missing-email",message:"Enter an email address."});const e=Gy(this.password);e?this.show(e):await this.newAccount(this.email,this.password)}};function Q_(e){if(sy())return;const t=e.getAttribute("firebase-config");if(t)try{ay({config:JSON.parse(t)})}catch(e){ly(Sy,uy(e))}}function W_(e,t){const n=e.trim();if(n){return n.split(/\s+/).slice(0,2).map(e=>e.charAt(0)).join("").toUpperCase()}const s=t.trim();return s?s.charAt(0).toUpperCase():""}function Y_(e,t){const n=e.trim();if(n)return n;const s=t.trim();return s||"Account"}q_([le({type:String}),z_("design:type",Object)],K_.prototype,"source",void 0),q_([le({type:Boolean,attribute:"hide-google",reflect:!0}),z_("design:type",Object)],K_.prototype,"hideGoogle",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"email",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"password",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"status",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"tone",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"busy",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"showPassword",void 0),q_([ue(),z_("design:type",Object)],K_.prototype,"notice",void 0),K_=q_([oe("form-signup"),z_("design:paramtypes",[])],K_);var X_=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Z_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let eb=class extends(he(gn)(ie)){constructor(){super(),this.subscribe=!1,this.hideGoogle=!1,this._name="",this._email="",this._verified=!1,this._notice="",this._log=!1,this._sign=!1,this.stopNotice=null}connectedCallback(){Q_(this),super.connectedCallback(),this._notice=$_(),this.stopNotice=J_(()=>{this._notice=$_()})}disconnectedCallback(){this.stopNotice?.(),this.stopNotice=null,super.disconnectedCallback()}stateChanged(e){this._name=e.backend.name,this._email=e.backend.email,this._verified=Boolean(e.backend?.verified),this._log=e.frontend.login,this._sign=e.frontend.registerTwo}static get styles(){return[En,yn,Dn,_n,mn,Ky,H_]}render(){return H`
728
+ `}change(){bn.dispatch(rn(this.source))}async google(){if(!this.busy){this.busy=!0,this.tone="",this.status="";try{await bE()}catch(t){this.show(mE(t))}finally{this.busy=!1}}}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}readFields(){const t=this.renderRoot.querySelector('input[type="email"]'),e=this.renderRoot.querySelector('input[name="new-password"]');this.email=t?.value??"",this.password=e?.value??""}_handleSubmit(t){t.preventDefault(),this.signUp()}handleEmail(t){const e=t.target;this.email=e.value}handlePassword(t){const e=t.target;this.password=e.value}async signUp(){if(this.busy)return;if(this.readFields(),this.email.length<4)return void this.show({code:"pwa/missing-email",message:"Enter an email address."});const t=qE(this.password);t?this.show(t):await this.newAccount(this.email,this.password)}};function nb(t){if(lE())return;const e=t.getAttribute("firebase-config");if(e)try{dE({config:JSON.parse(e)})}catch(t){gE(PE,mE(t))}}function sb(t,e){const n=t.trim();if(n){return n.split(/\s+/).slice(0,2).map(t=>t.charAt(0)).join("").toUpperCase()}const s=e.trim();return s?s.charAt(0).toUpperCase():""}function rb(t,e){const n=t.trim();if(n)return n;const s=e.trim();return s||"Account"}Z_([lt({type:String}),tb("design:type",Object)],eb.prototype,"source",void 0),Z_([lt({type:Boolean,attribute:"hide-google",reflect:!0}),tb("design:type",Object)],eb.prototype,"hideGoogle",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"email",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"password",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"status",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"tone",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"busy",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"showPassword",void 0),Z_([ut(),tb("design:type",Object)],eb.prototype,"notice",void 0),eb=Z_([at("form-signup"),tb("design:paramtypes",[])],eb);var ib=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ab=class extends(wt(bn)(it)){constructor(){super(),this.subscribe=!1,this.hideGoogle=!1,this._name="",this._email="",this._verified=!1,this._notice="",this._log=!1,this._sign=!1,this.motion=!1,this.clipHeight="auto",this.sheetShift="none",this.rollMotion=!1,this.booted=!1,this.stopNotice=null,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onClipEnd=t=>{t instanceof TransitionEvent&&t.target===t.currentTarget&&"max-height"===t.propertyName&&this.rest()}}connectedCallback(){nb(this),super.connectedCallback(),this._notice=Y_(),this.stopNotice=X_(()=>{this._notice=Y_()})}disconnectedCallback(){this.stopNotice?.(),this.stopNotice=null,this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}stateChanged(t){this._name=t.backend.name,this._email=t.backend.email,this._verified=Boolean(t.backend?.verified),this._log=t.frontend.login,this._sign=t.frontend.registerTwo}willUpdate(t){if(!this.booted)return;if(!t.has("_sign")&&!t.has("_log"))return;t.has("_sign")&&(this.motion=!0);const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,e)return this.watchColumn(),void requestAnimationFrame(()=>{this.motion=!0});if(!t.has("_sign")&&!t.has("_log"))return;const n=this.clip(),s=this.sheet();if(!n||!s||null==this.heldHeight)return;const r=this.heldHeight;this.heldHeight=null;const i=Math.ceil(s.getBoundingClientRect().height);Math.abs(i-r)>1?this.rollBetween(n,s,r,i,i):this.rest()}watchColumn(){"undefined"!=typeof ResizeObserver&&(this.columnObserver=new ResizeObserver(()=>{const t=Math.round(this.getBoundingClientRect().width);if(!t||t===this.columnWidth)return;if(this.columnWidth=t,!this.rollMotion)return;const e=this.clip(),n=this.sheet();if(!e||!n)return;const s=Math.ceil(e.getBoundingClientRect().height),r=Math.ceil(n.getBoundingClientRect().height);this.rollBetween(e,n,s,r,r)}),this.columnObserver.observe(this))}clip(){return this.shadowRoot?.querySelector(".login-clip")??null}sheet(){return this.shadowRoot?.querySelector(".service")??null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}rest(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void this.rest();t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}static get styles(){return[Tn,On,An,Sn,vn,eD,K_,i`
729
+ /* Required - this card's roll only. Block, so the sheet is not stretched to the clip. */
730
+ .login-clip {
731
+ display: block;
732
+ overflow: hidden;
733
+ min-height: 0;
734
+ }
705
735
 
706
- <section class="service" part="panel">
736
+ .login-clip > .service {
737
+ height: auto;
738
+ align-self: start;
739
+ }
740
+ `]}render(){return U`
741
+
742
+ <div
743
+ class="login-clip"
744
+ style=${mt(this.clipStyle())}
745
+ @transitionend=${this.onClipEnd}>
746
+ <section class="service" part="panel" style=${mt(this.sheetStyle())}>
707
747
 
708
748
  <header part="header">
709
- <h3 part="title">${this._log?Y_(this._name,this._email):this._sign===this.subscribe?"Login":"Subscribe"}</h3>
749
+ <h3 part="title">${this._log?rb(this._name,this._email):this._sign===this.subscribe?"Login":"Subscribe"}</h3>
710
750
  </header>
711
751
 
712
752
  <!-- Logged-out State -->
@@ -715,7 +755,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
715
755
  ?on= "${!1===this._log}">
716
756
 
717
757
  <div class= "wrapper">
718
- <div class= "inner">
758
+ <div class=${ft({inner:!0,motion:this.motion})}>
719
759
 
720
760
  <!-- Required - subscribe chooses the open form -->
721
761
  <form-login
@@ -723,7 +763,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
723
763
  ?hide-google= "${this.hideGoogle}"
724
764
  exportparts= "email: login-email, password: login-password, submit: login-submit, switch: login-switch, forgot: login-forgot, status: login-status, reveal: login-reveal, google: login-google"
725
765
  ?inert= "${this._sign!==this.subscribe}"
726
- class= "content ${this._sign===this.subscribe?"opened":"closed"} "></form-login>
766
+ class= ${ft({content:!0,opened:this._sign===this.subscribe,closed:this._sign!==this.subscribe})}></form-login>
727
767
 
728
768
  <!-- Sign-up State -->
729
769
  <form-signup
@@ -731,7 +771,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
731
771
  ?hide-google= "${this.hideGoogle}"
732
772
  exportparts= "email: signup-email, password: signup-password, submit: signup-submit, switch: signup-switch, status: signup-status, reveal: signup-reveal, notice: signup-notice, google: signup-google"
733
773
  ?inert= "${this._sign===this.subscribe}"
734
- class= "content ${!this._sign===this.subscribe?"opened":"closed"}"></form-signup>
774
+ class= ${ft({content:!0,opened:!this._sign===this.subscribe,closed:!this._sign!==this.subscribe})}></form-signup>
735
775
 
736
776
  </div>
737
777
  </div>
@@ -743,7 +783,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
743
783
  class= "spec setLog"
744
784
  ?on= "${!0===this._log}">
745
785
 
746
- ${this._notice&&!this._verified?H`
786
+ ${this._notice&&!this._verified?U`
747
787
  <p class="notice" part="notice" role="status" aria-live="polite">Check your inbox for the verification email. You can still sign in.</p>
748
788
  `:""}
749
789
 
@@ -752,13 +792,14 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
752
792
  </div>
753
793
 
754
794
  </section>
795
+ </div>
755
796
 
756
- `}};X_([le({type:Boolean,attribute:!0,reflect:!0}),Z_("design:type",Object)],eb.prototype,"subscribe",void 0),X_([le({type:Boolean,attribute:"hide-google",reflect:!0}),Z_("design:type",Object)],eb.prototype,"hideGoogle",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_name",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_email",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_verified",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_notice",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_log",void 0),X_([ue(),Z_("design:type",Object)],eb.prototype,"_sign",void 0),eb=X_([oe("user-login"),Z_("design:paramtypes",[])],eb);const tb=H`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`,nb=i`
797
+ `}};ib([lt({type:Boolean,attribute:!0,reflect:!0}),ob("design:type",Object)],ab.prototype,"subscribe",void 0),ib([lt({type:Boolean,attribute:"hide-google",reflect:!0}),ob("design:type",Object)],ab.prototype,"hideGoogle",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_name",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_email",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_verified",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_notice",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_log",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"_sign",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"motion",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"clipHeight",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"sheetShift",void 0),ib([ut(),ob("design:type",Object)],ab.prototype,"rollMotion",void 0),ab=ib([at("user-login"),ob("design:paramtypes",[])],ab);const Bb=U`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`,cb=i`
757
798
 
758
799
  .spec[on] { display: grid; }
759
800
  .spec { display: none; }
760
801
 
761
- `,sb=i`
802
+ `,lb=i`
762
803
 
763
804
  :host {
764
805
  position: var(--pwa_drawer_position, absolute);
@@ -768,23 +809,26 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
768
809
  width: 100%;
769
810
  box-sizing: border-box;
770
811
  -webkit-box-sizing: border-box;
771
- display: grid;
772
- padding-top: env(safe-area-inset-top);
812
+ display: block; /* Required - the child must start at the top of the clip */
813
+ /* padding-top lives on .userDrawer so the clip height matches the translating sheet */
773
814
  max-width: 100%; /* Required - fit 320px */
774
815
  min-width: 0;
816
+ background-color: var(--pwa_background, var(--pwa_drawer_background_color, #fff));
775
817
  }
776
818
 
777
- :host([drawer]) {
778
- /* Required - opaque sheet at 320px so the page does not show through */
819
+ :host([drawer]),
820
+ :host([sliding]) {
821
+ /* Required - the growing box. Top stays put; radius and shadow follow the bottom edge. */
779
822
  left: 0;
780
823
  right: 0;
781
824
  z-index: 5;
782
- background-color: var(--pwa_drawer_background_color, #fffdf8);
825
+ background-color: var(--pwa_background, var(--pwa_drawer_background_color, #fff));
826
+ border-radius: var(--pwa_drawer_border-radius, 0 0 18px 18px);
783
827
  box-shadow: 0 18px 40px rgba(28, 36, 48, 0.16);
784
828
  }
785
829
 
786
830
  .userDrawer > .spec > .wrapper {
787
- margin: 20px 8px 12px; /* Required - space under the drawer header */
831
+ margin: 20px 0 12px; /* Required - space under the header. Side gap is --pwa_inset on the form. */
788
832
  }
789
833
 
790
834
  .userDrawer,
@@ -806,19 +850,20 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
806
850
  height: auto;
807
851
  border-bottom: var(--pwa_drawer_border, 0);
808
852
  z-index: var(--pwa_drawer_z-index, 3);
809
- background-color: var(--pwa_drawer_background_color, #fffdf8);
853
+ background-color: var(--pwa_background, var(--pwa_drawer_background_color, #fff));
810
854
  color: var(--pwa_drawer_text_color, #1c2430);
811
855
  border-radius: var(--pwa_drawer_border-radius, 0 0 18px 18px);
856
+ padding-top: env(safe-area-inset-top);
812
857
  }
813
858
 
814
- `,rb=i`
859
+ `,ub=i`
815
860
 
816
861
  .exit {
817
862
  display: grid;
818
863
  grid-template-columns: minmax(var(--pwa_tap, 44px), 80px) minmax(0, 1fr) minmax(var(--pwa_tap, 44px), 80px); /* Required - fit 320px */
819
864
  padding: 12px 8px;
820
865
  z-index: 2;
821
- background-color: var(--pwa_drawer_background_color, #fffdf8);
866
+ background-color: var(--pwa_background, var(--pwa_drawer_background_color, #fff));
822
867
  border-bottom: 1px solid var(--pwa_line_color, #e3daca);
823
868
  }
824
869
 
@@ -869,7 +914,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
869
914
 
870
915
 
871
916
 
872
- `,ib=i`
917
+ `,hb=i`
873
918
 
874
919
  a {
875
920
  font-size: 0.95rem;
@@ -878,16 +923,19 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
878
923
  text-decoration: none;
879
924
  }
880
925
 
881
- `,ab=i`
926
+ `,db=i`
882
927
 
883
928
  .setLog > a,
884
929
  .setLog > button.settings {
885
930
  min-height: var(--pwa_tap, 44px); /* Required - minimum tap target */
886
931
  display: block;
887
932
  box-sizing: border-box;
888
- width: auto;
933
+ /* Required - same centered column as the form controls. */
934
+ width: max(0px, calc(min(100%, var(--pwa_max_width, 400px)) - 2 * var(--pwa_inset, 0px)));
935
+ max-width: 100%;
936
+ min-width: 0;
889
937
  padding: 12px 16px;
890
- margin: 12px 16px;
938
+ margin: 12px auto;
891
939
  border: 1px solid var(--pwa_line_color, #e3daca);
892
940
  border-radius: 10px;
893
941
  color: var(--pwa_drawer_text_color, #1c2430);
@@ -905,8 +953,12 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
905
953
  display: block;
906
954
  box-sizing: border-box;
907
955
  cursor: pointer;
956
+ /* Required - same centered column as the form controls. */
957
+ width: max(0px, calc(min(100%, var(--pwa_max_width, 400px)) - 2 * var(--pwa_inset, 0px)));
958
+ max-width: 100%;
959
+ min-width: 0;
908
960
  padding: 12px 16px;
909
- margin: 8px 16px 16px;
961
+ margin: 8px auto 16px;
910
962
  border: 1px solid var(--pwa_line_color, #e3daca);
911
963
  border-radius: 10px;
912
964
  background: transparent;
@@ -915,13 +967,13 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
915
967
  }
916
968
 
917
969
 
918
- `;function ob(e){const t=[],n=e=>{e.querySelectorAll("button, a[href], input, select, textarea").forEach(e=>{e.hasAttribute("disabled")||e.tabIndex<0||function(e){let t=e;for(;t;){if(t instanceof HTMLElement){if(t.classList.contains("closed"))return!0;if(t.classList.contains("spec")&&!t.hasAttribute("on"))return!0}if(t instanceof Element&&t.assignedSlot&&t.assignedSlot!==t){t=t.assignedSlot;continue}if(t.parentElement){t=t.parentElement;continue}const e=t.getRootNode();if(!(e instanceof ShadowRoot))break;t=e.host}return!1}(e)||t.push(e)}),e.querySelectorAll("*").forEach(e=>{e.shadowRoot&&n(e.shadowRoot)})};return e.shadowRoot&&n(e.shadowRoot),n(e),t.filter((e,n)=>t.indexOf(e)===n)}function Bb(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement instanceof HTMLElement;)e=e.shadowRoot.activeElement;return e}const cb=H`
970
+ `;function pb(t){const e=[],n=t=>{t.querySelectorAll("button, a[href], input, select, textarea").forEach(t=>{t.hasAttribute("disabled")||t.tabIndex<0||function(t){let e=t;for(;e;){if(e instanceof HTMLElement){if(e.classList.contains("closed"))return!0;if(e.classList.contains("spec")&&!e.hasAttribute("on"))return!0}if(e instanceof Element&&e.assignedSlot&&e.assignedSlot!==e){e=e.assignedSlot;continue}if(e.parentElement){e=e.parentElement;continue}const t=e.getRootNode();if(!(t instanceof ShadowRoot))break;e=t.host}return!1}(t)||e.push(t)}),t.querySelectorAll("*").forEach(t=>{t.shadowRoot&&n(t.shadowRoot)})};return t.shadowRoot&&n(t.shadowRoot),n(t),e.filter((t,n)=>e.indexOf(t)===n)}function fb(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement instanceof HTMLElement;)t=t.shadowRoot.activeElement;return t}const Cb=U`
919
971
  <span class="verified" part="verified" role="img" aria-label="Email verified">
920
972
  <svg viewBox="0 0 24 24" aria-hidden="true">
921
973
  <path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path>
922
974
  </svg>
923
975
  </span>
924
- `,lb=i`
976
+ `,gb=i`
925
977
 
926
978
  .verified {
927
979
  display: inline-grid;
@@ -956,19 +1008,33 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
956
1008
  min-width: 0;
957
1009
  }
958
1010
 
959
- `;var ub=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},hb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class pb extends(he(gn)(ie)){constructor(){super(),this.login=!1,this.verified=!1,this.email="",this.status="",this.tone="",this.busy=!1,this.cooldown=0,this.timer=0,this.resend=async e=>{if(e.preventDefault(),!(this.busy||this.cooldown>0||this.verified)){this.busy=!0,this.tone="",this.status="";try{await G_()&&this.showSent()}catch(e){this.showFirebase(e)}finally{this.busy=!1}}}}disconnectedCallback(){this.clearWait(),super.disconnectedCallback()}stateChanged(e){this.login=Boolean(e.frontend?.login),this.verified=Boolean(e.backend?.verified),this.email=e.backend?.email??"",this.hidden=!this.login,this.verified&&this.clearWait()}static get styles(){return[Vy,Ky,lb,i`
1011
+ `;var mb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class yb extends(wt(bn)(it)){constructor(){super(),this.login=!1,this.verified=!1,this.email="",this.status="",this.tone="",this.busy=!1,this.cooldown=0,this.timer=0,this.resend=async t=>{if(t.preventDefault(),!(this.busy||this.cooldown>0||this.verified)){this.busy=!0,this.tone="",this.status="";try{await q_()&&this.showSent()}catch(t){this.showFirebase(t)}finally{this.busy=!1}}}}disconnectedCallback(){this.clearWait(),super.disconnectedCallback()}stateChanged(t){this.login=Boolean(t.frontend?.login),this.verified=Boolean(t.backend?.verified),this.email=t.backend?.email??"",this.hidden=!this.login,this.verified&&this.clearWait()}static get styles(){return[QE,eD,gb,i`
960
1012
 
961
- :host { display: block; }
1013
+ :host {
1014
+ display: block;
1015
+ box-sizing: border-box;
1016
+ width: 100%;
1017
+ min-width: 0;
1018
+ max-width: min(100%, var(--pwa_max_width, 400px));
1019
+ margin-inline: auto;
1020
+ padding-inline: var(--pwa_inset, 0px);
1021
+ }
962
1022
 
963
1023
  .notice {
964
- margin: 4px 16px 8px;
965
- padding: 14px 16px 16px;
1024
+ margin: 4px 0 8px;
1025
+ padding: 14px 0 16px;
966
1026
  color: var(--pwa_label_text_color, #1c2430);
967
- background: var(--pwa_nav_on_background, #f3efe6);
1027
+ background: var(--pwa_nav_on_background, #f2f2f2);
968
1028
  border: 1px solid var(--pwa_line_color, #e3daca);
969
1029
  border-radius: 10px;
970
1030
  }
971
1031
 
1032
+ .lead,
1033
+ .row {
1034
+ padding: 0;
1035
+ box-sizing: border-box;
1036
+ }
1037
+
972
1038
  .lead {
973
1039
  margin: 0;
974
1040
  font-size: 0.95rem;
@@ -1023,9 +1089,12 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1023
1089
  }
1024
1090
 
1025
1091
  button.action-button {
1026
- display: inline-block;
1027
- margin: 12px 0 0;
1028
- max-width: 100%;
1092
+ display: block;
1093
+ /* Required - pull across the notice border so the button matches the field column. */
1094
+ width: calc(100% + 2px);
1095
+ max-width: none;
1096
+ min-width: 0;
1097
+ margin: 12px -1px 0;
1029
1098
  }
1030
1099
 
1031
1100
  button.action-button:disabled {
@@ -1033,14 +1102,14 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1033
1102
  opacity: 0.72;
1034
1103
  }
1035
1104
 
1036
- `]}lead(){return this.email?`${this.email} is not verified yet. You can still sign in.`:"This email is not verified yet. You can still sign in."}buttonLabel(){return this.busy?"Sending…":this.cooldown>0?`Send again in ${this.cooldown}s`:"Resend verification email"}render(){if(!this.login)return H``;if(this.verified)return H`
1105
+ `]}lead(){return this.email?`${this.email} is not verified yet. You can still sign in.`:"This email is not verified yet. You can still sign in."}buttonLabel(){return this.busy?"Sending…":this.cooldown>0?`Send again in ${this.cooldown}s`:"Resend verification email"}render(){if(!this.login)return U``;if(this.verified)return U`
1037
1106
  <div class="notice ok" part="notice">
1038
1107
  <p class="row">
1039
1108
  <span class="mail">${this.email}</span>
1040
- ${cb}
1109
+ ${Cb}
1041
1110
  </p>
1042
1111
  </div>
1043
- `;return H`
1112
+ `;return U`
1044
1113
  <div class="notice" part="notice">
1045
1114
 
1046
1115
  <p class="row">
@@ -1072,7 +1141,19 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1072
1141
  </form>
1073
1142
 
1074
1143
  </div>
1075
- `}showSent(){this.tone="",this.status="Check your inbox for the verification email.",this.cooldown=45,this.armCooldown(),this.updateComplete.then(()=>{this.focusStatus()})}showFirebase(e){this.tone="error",this.status=Hy(e),this.updateComplete.then(()=>{this.focusStatus()})}focusStatus(){const e=this.renderRoot.querySelector("#pwa-verify-status");e?.focus()}clearWait(){window.clearInterval(this.timer),this.timer=0,this.cooldown=0}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}}ub([ue(),hb("design:type",Object)],pb.prototype,"login",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"verified",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"email",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"status",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"tone",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"busy",void 0),ub([ue(),hb("design:type",Object)],pb.prototype,"cooldown",void 0),customElements.define("email-verify",pb);var db=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},fb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Cb=class extends(he(gn)(ie)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.hideGoogle=!1,this.name="",this.email="",this.verified=!1,this.notice="",this.user=!1,this.signup=!1,this.wasOpen=!1,this.sawOpen=!1,this.returnFocus=null,this.stopNotice=null,this.onKey=e=>{if(!this.drawer)return;if("Escape"===e.key)return e.preventDefault(),void gn.dispatch(rn());if("Tab"!==e.key)return;const t=ob(this);if(!t.length)return;const n=t[0],s=t[t.length-1],r=Bb(),i=!!r&&t.includes(r);e.shiftKey?i&&r!==n||(e.preventDefault(),s.focus()):i&&r!==s||(e.preventDefault(),n.focus())},this.onLightClick=e=>{if(e.defaultPrevented)return;const t=e.target;if(!(t instanceof Element))return;const n=t.closest("a, button");n instanceof HTMLElement&&this.contains(n)&&(this.shadowRoot?.contains(n)||gn.dispatch(rn()))},this.onSettings=e=>{const t=this.destination();if(!this.dispatchEvent(new CustomEvent(Oy,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:t}})))return void e.preventDefault();if(gn.dispatch(rn()),t)return;e.preventDefault();const n=document.querySelector("user-settings");n instanceof HTMLElement&&n.scrollIntoView({block:"nearest"})}}connectedCallback(){Q_(this),super.connectedCallback(),this.addEventListener("keydown",this.onKey),this.addEventListener("click",this.onLightClick),this.notice=$_(),this.stopNotice=J_(()=>{this.notice=$_()})}disconnectedCallback(){this.removeEventListener("keydown",this.onKey),this.removeEventListener("click",this.onLightClick),this.stopNotice?.(),this.stopNotice=null,super.disconnectedCallback()}stateChanged(e){const t=e.frontend.drawer;this.name=e.backend.name,this.email=e.backend.email,this.verified=Boolean(e.backend?.verified),this.drawer=t,this.user=e.frontend.login,this.signup=e.frontend.registerOne;(this.sawOpen?t!==this.wasOpen:t)&&function(e,t,n){e.dispatchEvent(new CustomEvent(t,{...By,detail:n}))}(this,Ay,{open:t}),this.wasOpen=t,this.sawOpen=!0}updated(e){if(e.has("drawer")){if(this.drawer){const e=Bb();return this.returnFocus=e&&!this.contains(e)?e:this.returnFocus,this.shadowRoot?.querySelector(".close")?.focus(),void x_(!1)}this.returnFocus?.focus(),this.returnFocus=null}}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{gn.dispatch(rn())}),this.shadowRoot.querySelector(".leave").addEventListener("click",async()=>{if(this.user)try{await I_()}catch{return}gn.dispatch(rn())});this.shadowRoot.querySelectorAll("a").forEach(e=>{e.addEventListener("click",()=>{gn.dispatch(rn())})})}static get styles(){return[nb,mn,wn,sb,rb,ib,ab,_n,Ky,H_,lb,i`
1144
+ `}showSent(){this.tone="",this.status="Check your inbox for the verification email.",this.cooldown=45,this.armCooldown(),this.updateComplete.then(()=>{this.focusStatus()})}showFirebase(t){this.tone="error",this.status=KE(t),this.updateComplete.then(()=>{this.focusStatus()})}focusStatus(){const t=this.renderRoot.querySelector("#pwa-verify-status");t?.focus()}clearWait(){window.clearInterval(this.timer),this.timer=0,this.cooldown=0}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}}mb([ut(),wb("design:type",Object)],yb.prototype,"login",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"verified",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"email",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"status",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"tone",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"busy",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"cooldown",void 0),customElements.define("email-verify",yb);var Eb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _b=class extends(wt(bn)(it)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.hideGoogle=!1,this.name="",this.email="",this.verified=!1,this.notice="",this.user=!1,this.signup=!1,this.sliding=!1,this.motion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)",this.rollMotion=!1,this.booted=!1,this.wasOpen=!1,this.sawOpen=!1,this.returnFocus=null,this.stopNotice=null,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onClipEnd=t=>{if(!(t instanceof TransitionEvent))return;if(t.target!==t.currentTarget)return;if("max-height"!==t.propertyName)return;const e=t.currentTarget;e instanceof HTMLElement&&(this.drawer?this.restOpen():e.getBoundingClientRect().height>1||(this.sliding=!1,this.restShut()))},this.onKey=t=>{if(!this.drawer)return;if("Escape"===t.key)return t.preventDefault(),void bn.dispatch(hn());if("Tab"!==t.key)return;const e=pb(this);if(!e.length)return;const n=e[0],s=e[e.length-1],r=fb(),i=!!r&&e.includes(r);t.shiftKey?i&&r!==n||(t.preventDefault(),s.focus({preventScroll:!0})):i&&r!==s||(t.preventDefault(),n.focus({preventScroll:!0}))},this.onLightClick=t=>{if(t.defaultPrevented)return;const e=t.target;if(!(e instanceof Element))return;const n=e.closest("a, button");n instanceof HTMLElement&&this.contains(n)&&(this.shadowRoot?.contains(n)||bn.dispatch(hn()))},this.onSettings=t=>{const e=this.destination();if(!this.dispatchEvent(new CustomEvent(FE,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:e}})))return void t.preventDefault();if(bn.dispatch(hn()),e)return;t.preventDefault();const n=document.querySelector("user-settings");n instanceof HTMLElement&&n.scrollIntoView({block:"nearest"})}}connectedCallback(){nb(this),super.connectedCallback(),this.addEventListener("keydown",this.onKey),this.addEventListener("click",this.onLightClick),this.notice=Y_(),this.stopNotice=X_(()=>{this.notice=Y_()})}disconnectedCallback(){this.removeEventListener("keydown",this.onKey),this.removeEventListener("click",this.onLightClick),this.stopNotice?.(),this.stopNotice=null,this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}stateChanged(t){const e=t.frontend.drawer;this.name=t.backend.name,this.email=t.backend.email,this.verified=Boolean(t.backend?.verified),e?this.sliding=!0:this.reduced()&&(this.sliding=!1),this.drawer=e,this.user=t.frontend.login,this.signup=t.frontend.registerOne;(this.sawOpen?e!==this.wasOpen:e)&&function(t,e,n){t.dispatchEvent(new CustomEvent(e,{...fE,detail:n}))}(this,LE,{open:e}),this.wasOpen=e,this.sawOpen=!0}willUpdate(t){if(!this.booted)return void(this.drawer&&this.restOpen());if(t.has("signup")&&(this.motion=!0),t.has("drawer")||!t.has("signup")||!this.drawer)return;const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,!e&&t.has("drawer"))this.heldHeight=null,this.drawer?this.unroll():this.rollUp();else if(!e&&null!=this.heldHeight&&this.drawer){const t=this.heldHeight;this.heldHeight=null;const e=this.clip(),n=this.sheet();if(e&&n){const s=Math.ceil(n.getBoundingClientRect().height);Math.abs(s-t)>1?this.rollBetween(e,n,t,s,s):this.restOpen()}}if(e&&requestAnimationFrame(()=>{this.motion=!0}),t.has("drawer")){if(this.drawer){const t=fb();return this.returnFocus=t&&!this.contains(t)?t:this.returnFocus,this.shadowRoot?.querySelector(".close")?.focus({preventScroll:!0}),void V_(!1)}this.returnFocus?.focus(),this.returnFocus=null}}clip(){return this.shadowRoot?.querySelector(".drawer-clip")??null}sheet(){return this.shadowRoot?.querySelector(".userDrawer")??null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}restShut(){this.rollMotion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)"}restOpen(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}unroll(){const t=this.clip(),e=this.sheet();if(!t||!e)return;this.scrollTop=0;const n=this.sheetPx(t,e),s=Math.ceil(t.getBoundingClientRect().height);this.rollBetween(t,e,s,n,n)}rollUp(){const t=this.clip(),e=this.sheet();if(!t||!e)return;const n=Math.ceil(e.getBoundingClientRect().height),s=Math.ceil(t.getBoundingClientRect().height);this.rollBetween(t,e,s,0,n),this.reduced()&&(this.sliding=!1)}sheetPx(t,e){const n=t.style.transition,s=t.style.maxHeight,r=t.style.height;t.style.transition="none",t.style.maxHeight="none",t.style.height="auto";const i=Math.ceil(e.getBoundingClientRect().height);return t.style.height=r,t.style.maxHeight=s,t.style.transition=n,i}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void(0===s?this.restShut():this.restOpen());t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{bn.dispatch(hn())}),this.shadowRoot.querySelector(".leave").addEventListener("click",async()=>{if(this.user)try{await x_()}catch{return}bn.dispatch(hn())});this.shadowRoot.querySelectorAll("a").forEach(t=>{t.addEventListener("click",()=>{bn.dispatch(hn())})}),this.watchColumn()}watchColumn(){"undefined"!=typeof ResizeObserver&&(this.columnObserver=new ResizeObserver(()=>{const t=Math.round(this.getBoundingClientRect().width);t&&t!==this.columnWidth&&(this.columnWidth=t,this.onColumnResize())}),this.columnObserver.observe(this))}onColumnResize(){if(!this.rollMotion)return;const t=this.clip(),e=this.sheet();if(!t||!e)return;const n=Math.ceil(t.getBoundingClientRect().height),s=this.sheetPx(t,e);this.rollBetween(t,e,n,this.drawer?s:0,s)}static get styles(){return[cb,vn,In,lb,ub,hb,db,Sn,eD,K_,gb,i`
1145
+ /* Required - this drawer's roll only. display:block so the sheet is not stretched. */
1146
+ .drawer-clip {
1147
+ display: block;
1148
+ overflow: hidden;
1149
+ min-height: 0;
1150
+ }
1151
+
1152
+ .drawer-clip > .userDrawer {
1153
+ height: auto;
1154
+ align-self: start;
1155
+ }
1156
+
1076
1157
  .exit > h3 {
1077
1158
  display: flex;
1078
1159
  align-items: center;
@@ -1104,51 +1185,61 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1104
1185
  text-decoration: none;
1105
1186
  appearance: none;
1106
1187
  padding: 12px 16px;
1107
- margin: 12px 16px;
1188
+ /* Required - same centered column as the form controls. */
1189
+ margin: 12px auto;
1108
1190
  border: 1px solid var(--pwa_line_color, #e3daca);
1109
1191
  border-radius: 10px;
1110
1192
  box-sizing: border-box;
1111
1193
  text-align: center;
1112
1194
  cursor: pointer;
1113
1195
  display: block;
1114
- width: auto;
1196
+ width: max(0px, calc(min(100%, var(--pwa_max_width, 400px)) - 2 * var(--pwa_inset, 0px)));
1197
+ max-width: 100%;
1198
+ min-width: 0;
1115
1199
  min-height: var(--pwa_tap, 44px); /* Required - minimum tap target */
1116
1200
  }
1117
1201
 
1118
1202
  ::slotted(a[aria-current]),
1119
1203
  ::slotted(button[aria-current]) {
1120
1204
  color: var(--pwa_nav_highlight_color, #1c2430);
1121
- background: var(--pwa_nav_on_background, #f3efe6);
1205
+ background: var(--pwa_nav_on_background, #f2f2f2);
1122
1206
  }
1123
- `]}render(){return H`
1207
+ `]}render(){return U`
1124
1208
 
1125
- <!-- Drawer Wrapper -->
1209
+ <!-- Clip. The first render binds shut, with no transition. -->
1210
+ <div
1211
+ class="drawer-clip"
1212
+ style=${mt(this.clipStyle())}
1213
+ @transitionend=${this.onClipEnd}>
1214
+
1215
+ <!-- Drawer Wrapper. Its translate is bound here, not by a shared class. -->
1126
1216
  <section
1127
1217
  part="panel"
1128
1218
  role="dialog"
1129
1219
  aria-modal="true"
1130
1220
  aria-labelledby="pwa-drawer-title"
1131
- aria-hidden="${this.drawer?"false":"true"}"
1132
- ?inert="${!this.drawer}"
1133
- class="userDrawer ${this.drawer?"out":"in"}">
1221
+ aria-hidden="${this.sliding?"false":"true"}"
1222
+ ?inert="${!this.sliding}"
1223
+ class="userDrawer"
1224
+ style=${mt(this.sheetStyle())}>
1134
1225
 
1135
1226
  <!-- Exit Button -->
1136
1227
  <header class="exit" part="header">
1137
1228
  <div></div>
1138
1229
  <h3 id="pwa-drawer-title" part="title">
1139
- <span class="who">${!1===this.user?this.signup===this.subscribe?"Login":"Subscribe":Y_(this.name,this.email)}</span>
1140
- ${this.user?this.verified?cb:H`<span class="unverified" part="unverified">Not verified</span>`:""}
1230
+ <span class="who">${!1===this.user?this.signup===this.subscribe?"Login":"Subscribe":rb(this.name,this.email)}</span>
1231
+ ${this.user?this.verified?Cb:U`<span class="unverified" part="unverified">Not verified</span>`:""}
1141
1232
  </h3>
1142
- <button class="close" part="close" type="button" aria-label="Close">${tb}</button>
1233
+ <button class="close" part="close" type="button" aria-label="Close">${Bb}</button>
1143
1234
  </header>
1144
1235
 
1145
1236
  <!-- Logged-out State -->
1146
1237
  <div
1147
- class="spec ${this.drawer?"spec-out":"spec-in"}"
1238
+ class="spec"
1148
1239
  ?on="${!1===this.user}">
1149
1240
 
1150
1241
  <div class= "wrapper">
1151
- <div class= "inner">
1242
+ <div class=${ft({inner:!0,motion:this.motion})}>
1152
1243
 
1153
1244
  <!-- Log-in State -->
1154
1245
  <form-login
@@ -1156,7 +1247,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1156
1247
  ?hide-google="${this.hideGoogle}"
1157
1248
  exportparts="email: login-email, password: login-password, submit: login-submit, switch: login-switch, forgot: login-forgot, status: login-status, reveal: login-reveal, google: login-google"
1158
1249
  ?inert="${this.signup!==this.subscribe}"
1159
- class="content ${this.signup===this.subscribe?"opened":"closed"} ">
1250
+ class=${ft({content:!0,opened:this.signup===this.subscribe,closed:this.signup!==this.subscribe})}>
1160
1251
  </form-login>
1161
1252
 
1162
1253
  <!-- Sign-up State -->
@@ -1165,7 +1256,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1165
1256
  ?hide-google="${this.hideGoogle}"
1166
1257
  exportparts="email: signup-email, password: signup-password, submit: signup-submit, switch: signup-switch, status: signup-status, reveal: signup-reveal, notice: signup-notice, google: signup-google"
1167
1258
  ?inert="${this.signup===this.subscribe}"
1168
- class="content ${!this.signup===this.subscribe?"opened":"closed"} ">
1259
+ class=${ft({content:!0,opened:!this.signup===this.subscribe,closed:!this.signup!==this.subscribe})}>
1169
1260
  </form-signup>
1170
1261
 
1171
1262
  </div>
@@ -1185,19 +1276,20 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1185
1276
 
1186
1277
  <slot><a href="/settings">slotted - default</a></slot>
1187
1278
 
1188
- ${this.user&&this.notice&&!this.verified?H`
1279
+ ${this.user&&this.notice&&!this.verified?U`
1189
1280
  <p class="notice" part="notice" role="status" aria-live="polite">Check your inbox for the verification email. You can still sign in.</p>
1190
1281
  `:""}
1191
1282
 
1192
- ${this.user?H`<email-verify exportparts="notice: verify-notice, status: verify-status, submit: verify-submit, verified: email-verified, unverified"></email-verify>`:""}
1283
+ ${this.user?U`<email-verify exportparts="notice: verify-notice, status: verify-status, submit: verify-submit, verified: email-verified, unverified"></email-verify>`:""}
1193
1284
 
1194
1285
  <button class="leave" part="logout" type="button" aria-label="Log out">Log out</button>
1195
1286
 
1196
1287
  </div>
1197
1288
 
1198
1289
  </section>
1290
+ </div>
1199
1291
 
1200
- `}destination(){return(this.url||"").trim()}settingsControl(){const e=this.destination();return e?H`<a href="${e}" part="settings" @click="${this.onSettings}">Settings</a>`:H`<button type="button" class="settings" part="settings" @click="${this.onSettings}">Settings</button>`}};db([le({type:String,reflect:!0}),fb("design:type",Object)],Cb.prototype,"url",void 0),db([le({type:Boolean,attribute:!0,reflect:!0}),fb("design:type",Object)],Cb.prototype,"drawer",void 0),db([le({type:Boolean,attribute:!0,reflect:!0}),fb("design:type",Object)],Cb.prototype,"subscribe",void 0),db([le({type:Boolean,attribute:"hide-google",reflect:!0}),fb("design:type",Object)],Cb.prototype,"hideGoogle",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"name",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"email",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"verified",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"notice",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"user",void 0),db([ue(),fb("design:type",Object)],Cb.prototype,"signup",void 0),Cb=db([oe("user-drawer"),fb("design:paramtypes",[])],Cb);const gb=i`
1292
+ `}destination(){return(this.url||"").trim()}settingsControl(){const t=this.destination();return t?U`<a href="${t}" part="settings" @click="${this.onSettings}">Settings</a>`:U`<button type="button" class="settings" part="settings" @click="${this.onSettings}">Settings</button>`}};Eb([lt({type:String,reflect:!0}),Db("design:type",Object)],_b.prototype,"url",void 0),Eb([lt({type:Boolean,attribute:!0,reflect:!0}),Db("design:type",Object)],_b.prototype,"drawer",void 0),Eb([lt({type:Boolean,attribute:!0,reflect:!0}),Db("design:type",Object)],_b.prototype,"subscribe",void 0),Eb([lt({type:Boolean,attribute:"hide-google",reflect:!0}),Db("design:type",Object)],_b.prototype,"hideGoogle",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"name",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"email",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"verified",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"notice",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"user",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"signup",void 0),Eb([lt({type:Boolean,reflect:!0}),Db("design:type",Object)],_b.prototype,"sliding",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"motion",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"clipHeight",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"sheetShift",void 0),Eb([ut(),Db("design:type",Object)],_b.prototype,"rollMotion",void 0),_b=Eb([at("user-drawer"),Db("design:paramtypes",[])],_b);const bb=i`
1201
1293
 
1202
1294
  nav {
1203
1295
  overflow: hidden;
@@ -1235,7 +1327,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1235
1327
  nav > ul > li > button[on] {
1236
1328
 
1237
1329
  color: var(--pwa_nav_highlight_color, #1c2430);
1238
- background-color: var(--pwa_nav_on_background, #f3efe6);
1330
+ background-color: var(--pwa_nav_on_background, #f2f2f2);
1239
1331
 
1240
1332
  }
1241
1333
 
@@ -1262,7 +1354,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1262
1354
 
1263
1355
  section {
1264
1356
  align-content: start; /* Required - tabs keep each button under its fields */
1265
- background-color: var(--section_background_color, #fffdf8);
1357
+ background-color: var(--pwa_background, var(--section_background_color, #fff));
1266
1358
  }
1267
1359
 
1268
1360
 
@@ -1272,10 +1364,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1272
1364
  font-weight: 600;
1273
1365
  font-size: 1.35rem;
1274
1366
  margin: 0;
1275
- padding: 20px 16px 4px;
1367
+ padding: 20px var(--pwa_inset, 0px) 4px;
1276
1368
  }
1277
1369
 
1278
- `;var mb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},wb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class Eb extends(he(gn)(ie)){constructor(){super(),this.photo="",this.emptyArtwork="",this.login=!1,this.person="",this.mail="",this.progress=0,this.error="",this.status="",this.tone="",this.busy=!1,this.saveImage=e=>{const t=e.target,n=t?.files?.[0],s=WE.currentUser;if(this.error="",this.tone="",!s)return void this.fail({code:"pwa/signed-out",message:"Sign in first."});if(!n)return void this.fail({code:"pwa/missing-file",message:"Choose a photo first."});this.busy=!0,this.progress=0,this.status="Uploading…";const r=HE($E(QE,"pwa-auth/"+s.uid+"/"+n.name),n,{cacheControl:"public,max-age=300",contentType:n.type||"application/octet-stream"});r.on("state_changed",e=>{const t=e.totalBytes>0?e.bytesTransferred/e.totalBytes*100:0;this.progress=isFinite(t)?t:0,"paused"===e.state?this.status="Upload is paused":this.status=`Uploading… ${Math.round(this.progress)}%`},e=>{this.busy=!1,this.progress=0,this.fail(e)},async()=>{try{const e=await function(e){return RE(e=Zn(e))}(r.snapshot.ref),t=WE.currentUser;if(!t)return void this.fail({code:"pwa/signed-out",message:"Sign in first."});await ka(t,{photoURL:e}),gn.dispatch(dn(e)),gn.dispatch(Zt(e)),this.photo=e,this.progress=100,this.tone="",this.error="",this.status="Photo saved.",ly(by,{uid:t.uid,displayName:t.displayName,photoURL:e})}catch(e){this.fail(e)}finally{this.busy=!1}})}}stateChanged(e){this.login=e.frontend.login,this.photo=e.backend.photoURL,this.person=e.backend.name,this.mail=e.backend.email}static get styles(){return[jy,qy,i`
1370
+ `;var vb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Tb extends(wt(bn)(it)){constructor(){super(),this.photo="",this.emptyArtwork="",this.login=!1,this.person="",this.mail="",this.progress=0,this.error="",this.status="",this.tone="",this.busy=!1,this.saveImage=t=>{const e=t.target,n=e?.files?.[0],s=sE.currentUser;if(this.error="",this.tone="",!s)return void this.fail({code:"pwa/signed-out",message:"Sign in first."});if(!n)return void this.fail({code:"pwa/missing-file",message:"Choose a photo first."});this.busy=!0,this.progress=0,this.status="Uploading…";const r=Ky(Yy(nE,"pwa-auth/"+s.uid+"/"+n.name),n,{cacheControl:"public,max-age=300",contentType:n.type||"application/octet-stream"});r.on("state_changed",t=>{const e=t.totalBytes>0?t.bytesTransferred/t.totalBytes*100:0;this.progress=isFinite(e)?e:0,"paused"===t.state?this.status="Upload is paused":this.status=`Uploading… ${Math.round(this.progress)}%`},t=>{this.busy=!1,this.progress=0,this.fail(t)},async()=>{try{const t=await function(t){return Gy(t=os(t))}(r.snapshot.ref),e=sE.currentUser;if(!e)return void this.fail({code:"pwa/signed-out",message:"Sign in first."});await Uo(e,{photoURL:t}),bn.dispatch(En(t)),bn.dispatch(an(t)),this.photo=t,this.progress=100,this.tone="",this.error="",this.status="Photo saved.",gE(RE,{uid:e.uid,displayName:e.displayName,photoURL:t})}catch(t){this.fail(t)}finally{this.busy=!1}})}}stateChanged(t){this.login=t.frontend.login,this.photo=t.backend.photoURL,this.person=t.backend.name,this.mail=t.backend.email}static get styles(){return[WE,ZE,i`
1279
1371
 
1280
1372
  :host {
1281
1373
  box-sizing: border-box;
@@ -1285,6 +1377,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1285
1377
  grid-template-rows: auto auto auto;
1286
1378
  grid-template-columns: 1fr;
1287
1379
  width: 100%;
1380
+ max-width: min(100%, var(--pwa_max_width, 400px));
1381
+ min-width: 0;
1382
+ margin-inline: auto;
1383
+ padding-inline: var(--pwa_inset, 0px);
1288
1384
  align-content: start;
1289
1385
  }
1290
1386
 
@@ -1316,16 +1412,16 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1316
1412
  font-weight: 600;
1317
1413
  letter-spacing: 0.04em;
1318
1414
  color: var(--pwa_action_background_color, #2a6b45);
1319
- background: var(--pwa_nav_on_background, #f3efe6);
1415
+ background: var(--pwa_nav_on_background, #f2f2f2);
1320
1416
  }
1321
1417
 
1322
- `]}letters(){return W_(this.person,this.mail)}render(){const e=this.letters(),t="string"==typeof this.photo?this.photo:"";return H`
1418
+ `]}letters(){return sb(this.person,this.mail)}render(){const t=this.letters(),e="string"==typeof this.photo?this.photo:"";return U`
1323
1419
  <label
1324
1420
  style="
1325
1421
  display: grid;
1326
1422
  grid-template-columns: auto 1fr;
1327
1423
  grid-gap: 16px;
1328
- padding: 0 16px;
1424
+ padding: 0;
1329
1425
  ">Upload
1330
1426
  <progress
1331
1427
  id="pwa-uploader"
@@ -1358,30 +1454,30 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1358
1454
  border: 1px dashed var(--pwa_line_color, #e3daca);
1359
1455
  border-radius: 12px;
1360
1456
  overflow: hidden;
1361
- margin: 0 16px;
1362
- padding: 0 16px 16px 16px;
1457
+ margin: 0;
1458
+ padding: 0 0 16px;
1363
1459
  "
1364
1460
  for ="photoURL"
1365
1461
  part="preview">Photo:
1366
1462
 
1367
- ${t?H`
1368
- <img class="preview" alt="" src="${t}">
1369
- `:e?H`
1370
- <span class="mark" part="initials" aria-hidden="true">${e}</span>
1371
- `:this.emptyArtwork?H`
1463
+ ${e?U`
1464
+ <img class="preview" alt="" src="${e}">
1465
+ `:t?U`
1466
+ <span class="mark" part="initials" aria-hidden="true">${t}</span>
1467
+ `:this.emptyArtwork?U`
1372
1468
  <img class="preview" alt="" src="${this.emptyArtwork}">
1373
- `:H`
1469
+ `:U`
1374
1470
  <span class="mark" part="initials" aria-hidden="true">?</span>
1375
1471
  `}
1376
1472
 
1377
1473
  </label>
1378
1474
 
1379
- ${zy("pwa-photo-status",this.error||this.status,this.tone)}
1380
- `}fail(e){const t="object"==typeof e&&null!==e&&"code"in e&&"message"in e&&!(e instanceof Error)?e:uy(e);this.tone="error",this.error=Hy(t),this.status="",ly(Sy,t)}}mb([le(),wb("design:type",Object)],Eb.prototype,"photo",void 0),mb([le({type:String,reflect:!0}),wb("design:type",Object)],Eb.prototype,"emptyArtwork",void 0),mb([ue(),wb("design:type",Boolean)],Eb.prototype,"login",void 0),mb([ue(),wb("design:type",Object)],Eb.prototype,"person",void 0),mb([ue(),wb("design:type",Object)],Eb.prototype,"mail",void 0),mb([ue(),wb("design:type",Number)],Eb.prototype,"progress",void 0),mb([ue(),wb("design:type",String)],Eb.prototype,"error",void 0),mb([ue(),wb("design:type",String)],Eb.prototype,"status",void 0),mb([ue(),wb("design:type",String)],Eb.prototype,"tone",void 0),mb([ue(),wb("design:type",Object)],Eb.prototype,"busy",void 0),customElements.define("contact-photo",Eb);var yb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Db=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class _b extends(he(gn)(ie)){constructor(){super(),this.login=!1,this.draft="",this.busy=!1,this.status="",this.tone="",this.dirty=!1,this.default=e=>{e.preventDefault(),this.alertProfile()},this.alertProfile=async()=>{if(this.busy)return;const e=this.renderRoot.querySelector("#pwa-name"),t=(e?.value??this.draft).trim(),n=WE.currentUser;if(n){this.busy=!0,this.tone="",this.status="";try{await ka(n,{displayName:t}),this.dirty=!1,this.draft=t,gn.dispatch(un(t)),gn.dispatch(en(t)),this.status="Name saved.",ly(by,{uid:n.uid,displayName:t,photoURL:n.photoURL})}catch(e){this.show(uy(e))}finally{this.busy=!1}}else this.show({code:"pwa/signed-out",message:"Sign in first."})}}stateChanged(e){const t=Boolean(e.frontend?.login);t!==this.login&&(this.dirty=!1),this.login=t,this.dirty||(this.draft=e.backend?.name??"")}static get styles(){return[jy,$y,Vy,qy,i`
1475
+ ${tD("pwa-photo-status",this.error||this.status,this.tone)}
1476
+ `}fail(t){const e="object"==typeof t&&null!==t&&"code"in t&&"message"in t&&!(t instanceof Error)?t:mE(t);this.tone="error",this.error=KE(e),this.status="",gE(PE,e)}}vb([lt(),Ib("design:type",Object)],Tb.prototype,"photo",void 0),vb([lt({type:String,reflect:!0}),Ib("design:type",Object)],Tb.prototype,"emptyArtwork",void 0),vb([ut(),Ib("design:type",Boolean)],Tb.prototype,"login",void 0),vb([ut(),Ib("design:type",Object)],Tb.prototype,"person",void 0),vb([ut(),Ib("design:type",Object)],Tb.prototype,"mail",void 0),vb([ut(),Ib("design:type",Number)],Tb.prototype,"progress",void 0),vb([ut(),Ib("design:type",String)],Tb.prototype,"error",void 0),vb([ut(),Ib("design:type",String)],Tb.prototype,"status",void 0),vb([ut(),Ib("design:type",String)],Tb.prototype,"tone",void 0),vb([ut(),Ib("design:type",Object)],Tb.prototype,"busy",void 0),customElements.define("contact-photo",Tb);var Ob=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Ab=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Sb extends(wt(bn)(it)){constructor(){super(),this.login=!1,this.draft="",this.busy=!1,this.status="",this.tone="",this.dirty=!1,this.default=t=>{t.preventDefault(),this.alertProfile()},this.alertProfile=async()=>{if(this.busy)return;const t=this.renderRoot.querySelector("#pwa-name"),e=(t?.value??this.draft).trim(),n=sE.currentUser;if(n){this.busy=!0,this.tone="",this.status="";try{await Uo(n,{displayName:e}),this.dirty=!1,this.draft=e,bn.dispatch(mn(e)),bn.dispatch(Bn(e)),this.status="Name saved.",gE(RE,{uid:n.uid,displayName:e,photoURL:n.photoURL})}catch(t){this.show(mE(t))}finally{this.busy=!1}}else this.show({code:"pwa/signed-out",message:"Sign in first."})}}stateChanged(t){const e=Boolean(t.frontend?.login);e!==this.login&&(this.dirty=!1),this.login=e,this.dirty||(this.draft=t.backend?.name??"")}static get styles(){return[WE,YE,QE,ZE,i`
1381
1477
 
1382
1478
  :host, form { display: grid; align-content: start; }
1383
1479
 
1384
- `]}render(){return H`
1480
+ `]}render(){return U`
1385
1481
 
1386
1482
  <form
1387
1483
  autocomplete="on"
@@ -1403,7 +1499,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1403
1499
 
1404
1500
  </label>
1405
1501
 
1406
- ${zy("pwa-name-status",this.status,this.tone)}
1502
+ ${tD("pwa-name-status",this.status,this.tone)}
1407
1503
 
1408
1504
  <button
1409
1505
  class="action-button save"
@@ -1414,11 +1510,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1414
1510
 
1415
1511
  </form>
1416
1512
 
1417
- `}handleInput(e){const t=e.target;this.dirty=!0,this.draft=t.value}show(e){this.tone="error",this.status=Hy(e),ly(Sy,e)}}yb([ue(),Db("design:type",Object)],_b.prototype,"login",void 0),yb([ue(),Db("design:type",Object)],_b.prototype,"draft",void 0),yb([ue(),Db("design:type",Object)],_b.prototype,"busy",void 0),yb([ue(),Db("design:type",Object)],_b.prototype,"status",void 0),yb([ue(),Db("design:type",Object)],_b.prototype,"tone",void 0),customElements.define("input-name",_b);const bb="userEmailChanged";var vb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ib=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class Tb extends(he(gn)(ie)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.saveEmail=async e=>{if(e.preventDefault(),this.busy)return;const t=WE.currentUser;if(!t)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const n=this.shadowRoot?.querySelector("#pwa-current-email-password")?.value??"",s=this.shadowRoot?.querySelector("#pwa-email");if(!s)return;if(n.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});this.busy=!0,this.tone="",this.status="";if(!await v_(n)){const e=y_();return this.tone="error",this.status=Hy(e??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{const e=ny();e?await Ra(t,s.value,e):await Ra(t,s.value);const n={email:s.value};if(ly(vy,n),function(e){window.dispatchEvent(new CustomEvent(bb,{detail:e,bubbles:!0,composed:!0}))}(n),this.tone="",this.status="Check your inbox to confirm the new address.",!t.emailVerified)try{await G_()}catch{}}catch(e){const t=uy(e);this.tone="error",this.status=Hy(e),ly(Sy,t)}finally{this.busy=!1}}}stateChanged(e){this.login=e.frontend.login,this.mail=e.backend.email}handleEmail(e){const t=e.target;this.mail=t.value}static get styles(){return[jy,$y,Vy,Jy,qy,i`
1513
+ `}handleInput(t){const e=t.target;this.dirty=!0,this.draft=e.value}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}Ob([ut(),Ab("design:type",Object)],Sb.prototype,"login",void 0),Ob([ut(),Ab("design:type",Object)],Sb.prototype,"draft",void 0),Ob([ut(),Ab("design:type",Object)],Sb.prototype,"busy",void 0),Ob([ut(),Ab("design:type",Object)],Sb.prototype,"status",void 0),Ob([ut(),Ab("design:type",Object)],Sb.prototype,"tone",void 0),customElements.define("input-name",Sb);const Rb="userEmailChanged";var Nb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class kb extends(wt(bn)(it)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.saveEmail=async t=>{if(t.preventDefault(),this.busy)return;const e=sE.currentUser;if(!e)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const n=this.shadowRoot?.querySelector("#pwa-current-email-password")?.value??"",s=this.shadowRoot?.querySelector("#pwa-email");if(!s)return;if(n.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});this.busy=!0,this.tone="",this.status="";if(!await N_(n)){const t=O_();return this.tone="error",this.status=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{const t=cE();t?await Ho(e,s.value,t):await Ho(e,s.value);const n={email:s.value};if(gE(NE,n),function(t){window.dispatchEvent(new CustomEvent(Rb,{detail:t,bubbles:!0,composed:!0}))}(n),this.tone="",this.status="Check your inbox to confirm the new address.",!e.emailVerified)try{await q_()}catch{}}catch(t){const e=mE(t);this.tone="error",this.status=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login,this.mail=t.backend.email}handleEmail(t){const e=t.target;this.mail=e.value}static get styles(){return[WE,YE,QE,XE,ZE,i`
1418
1514
 
1419
1515
  :host, form { display: grid; align-content: start; }
1420
1516
 
1421
- `]}render(){return H`
1517
+ `]}render(){return U`
1422
1518
 
1423
1519
  <form
1424
1520
  autocomplete="on"
@@ -1436,7 +1532,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1436
1532
  autocomplete = "current-password"
1437
1533
  aria-describedby = "pwa-email-status"/>
1438
1534
 
1439
- ${Qy(this.showPassword,()=>{this.showPassword=!this.showPassword})}
1535
+ ${nD(this.showPassword,()=>{this.showPassword=!this.showPassword})}
1440
1536
 
1441
1537
  </span>
1442
1538
 
@@ -1460,7 +1556,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1460
1556
 
1461
1557
  </label>
1462
1558
 
1463
- ${zy("pwa-email-status",this.status,this.tone)}
1559
+ ${tD("pwa-email-status",this.status,this.tone)}
1464
1560
 
1465
1561
  <button
1466
1562
  type = "submit"
@@ -1471,7 +1567,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1471
1567
 
1472
1568
  </form>
1473
1569
 
1474
- `}show(e){this.tone="error",this.status=Hy(e),ly(Sy,e)}}vb([le({type:String,reflect:!0}),Ib("design:type",Object)],Tb.prototype,"email",void 0),vb([ue(),Ib("design:type",Boolean)],Tb.prototype,"login",void 0),vb([ue(),Ib("design:type",String)],Tb.prototype,"mail",void 0),vb([ue(),Ib("design:type",Object)],Tb.prototype,"busy",void 0),vb([ue(),Ib("design:type",Object)],Tb.prototype,"status",void 0),vb([ue(),Ib("design:type",Object)],Tb.prototype,"tone",void 0),vb([ue(),Ib("design:type",Object)],Tb.prototype,"showPassword",void 0),customElements.define("contact-email",Tb);var Ab=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ob=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class Sb extends(he(gn)(ie)){constructor(){super(),this.message="",this.tone="",this.password="",this.login=!1,this.busy=!1,this.showCurrent=!1,this.showNext=!1,this.showVerify=!1,this.default=e=>{e.preventDefault(),this.alertPassword()},this.updatePass=async(e,t)=>{const n=WE.currentUser;if(!n)return void this.show({code:"pwa/signed-out",message:"Sign in first."});this.busy=!0,this.tone="",this.message="";if(!await v_(e)){const e=y_();return this.tone="error",this.message=Hy(e??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{await La(n,t),this.tone="",this.message="Password saved.",ly(Iy,{uid:n.uid})}catch(e){const t=uy(e);this.tone="error",this.message=Hy(e),ly(Sy,t)}finally{this.busy=!1}}}stateChanged(e){this.login=e.frontend.login}handleInputChange(e){const t=e.target;this.password=t.value}static get styles(){return[jy,$y,Vy,Jy,qy,i`
1570
+ `}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}Nb([lt({type:String,reflect:!0}),xb("design:type",Object)],kb.prototype,"email",void 0),Nb([ut(),xb("design:type",Boolean)],kb.prototype,"login",void 0),Nb([ut(),xb("design:type",String)],kb.prototype,"mail",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"busy",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"status",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"tone",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"showPassword",void 0),customElements.define("contact-email",kb);var Lb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Pb extends(wt(bn)(it)){constructor(){super(),this.message="",this.tone="",this.password="",this.login=!1,this.busy=!1,this.showCurrent=!1,this.showNext=!1,this.showVerify=!1,this.default=t=>{t.preventDefault(),this.alertPassword()},this.updatePass=async(t,e)=>{const n=sE.currentUser;if(!n)return void this.show({code:"pwa/signed-out",message:"Sign in first."});this.busy=!0,this.tone="",this.message="";if(!await N_(t)){const t=O_();return this.tone="error",this.message=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{await Vo(n,e),this.tone="",this.message="Password saved.",gE(xE,{uid:n.uid})}catch(t){const e=mE(t);this.tone="error",this.message=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login}handleInputChange(t){const e=t.target;this.password=e.value}static get styles(){return[WE,YE,QE,XE,ZE,i`
1475
1571
 
1476
1572
  :host{
1477
1573
  display: grid;
@@ -1480,7 +1576,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1480
1576
 
1481
1577
  form { display: grid; align-content: start; }
1482
1578
 
1483
- `]}render(){return H`
1579
+ `]}render(){return U`
1484
1580
 
1485
1581
  <form
1486
1582
  autocomplete="on"
@@ -1500,7 +1596,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1500
1596
  autocomplete = "current-password"
1501
1597
  aria-describedby = "pwa-password-status">
1502
1598
 
1503
- ${Qy(this.showCurrent,()=>{this.showCurrent=!this.showCurrent})}
1599
+ ${nD(this.showCurrent,()=>{this.showCurrent=!this.showCurrent})}
1504
1600
 
1505
1601
  </span>
1506
1602
 
@@ -1521,16 +1617,16 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1521
1617
  type = "${this.showNext?"text":"password"}"
1522
1618
  autocomplete = "new-password"
1523
1619
  minlength = "${8}"
1524
- maxlength = "${Ly}"
1620
+ maxlength = "${UE}"
1525
1621
  .value = "${this.password}"
1526
1622
  @input = "${this.handleInputChange}"
1527
1623
  aria-describedby = "pwa-new-password-hint pwa-password-status">
1528
1624
 
1529
- ${Qy(this.showNext,()=>{this.showNext=!this.showNext})}
1625
+ ${nD(this.showNext,()=>{this.showNext=!this.showNext})}
1530
1626
 
1531
1627
  </span>
1532
1628
 
1533
- <p id="pwa-new-password-hint" class="hint" part="hint">${xy}</p>
1629
+ <p id="pwa-new-password-hint" class="hint" part="hint">${VE}</p>
1534
1630
 
1535
1631
  </label>
1536
1632
 
@@ -1549,10 +1645,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1549
1645
  type = "${this.showVerify?"text":"password"}"
1550
1646
  autocomplete = "new-password"
1551
1647
  minlength = "${8}"
1552
- maxlength = "${Ly}"
1648
+ maxlength = "${UE}"
1553
1649
  aria-describedby = "pwa-password-status">
1554
1650
 
1555
- ${Qy(this.showVerify,()=>{this.showVerify=!this.showVerify})}
1651
+ ${nD(this.showVerify,()=>{this.showVerify=!this.showVerify})}
1556
1652
 
1557
1653
  </span>
1558
1654
 
@@ -1560,7 +1656,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1560
1656
 
1561
1657
  </div>
1562
1658
 
1563
- ${zy("pwa-password-status",this.message,this.tone)}
1659
+ ${tD("pwa-password-status",this.message,this.tone)}
1564
1660
 
1565
1661
  <button
1566
1662
  type="submit"
@@ -1571,22 +1667,28 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1571
1667
 
1572
1668
  </form>
1573
1669
 
1574
- `}show(e){this.tone="error",this.message=Hy(e),ly(Sy,e)}async alertPassword(){if(this.busy)return;const e=this.shadowRoot.querySelector("#pwa-current-password").value,t=this.shadowRoot.querySelector("#pwa-new-password").value,n=this.shadowRoot.querySelector("#pwa-verify-password").value;if(this.password=t,e.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});const s=Gy(this.password);s?this.show(s):this.password===n?WE.currentUser?await this.updatePass(e,this.password):this.show({code:"pwa/signed-out",message:"Sign in first."}):this.show({code:"pwa/password-mismatch",message:My})}}Ab([ue(),Ob("design:type",String)],Sb.prototype,"message",void 0),Ab([ue(),Ob("design:type",String)],Sb.prototype,"tone",void 0),Ab([ue(),Ob("design:type",String)],Sb.prototype,"password",void 0),Ab([ue(),Ob("design:type",Boolean)],Sb.prototype,"login",void 0),Ab([ue(),Ob("design:type",Boolean)],Sb.prototype,"busy",void 0),Ab([ue(),Ob("design:type",Object)],Sb.prototype,"showCurrent",void 0),Ab([ue(),Ob("design:type",Object)],Sb.prototype,"showNext",void 0),Ab([ue(),Ob("design:type",Object)],Sb.prototype,"showVerify",void 0),customElements.define("input-password",Sb);var Nb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Rb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class kb extends(he(gn)(ie)){constructor(){super(),this.login=!1,this.email="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.alertDelete=()=>{if(this.busy)return;if(!WE.currentUser)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const e=this.shadowRoot.querySelector("#pwa-delete-password").value;if(e.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});1==confirm("Delete Account?")&&this.officialDelete(e)},this.officialDelete=async e=>{this.busy=!0,this.tone="",this.status="";if(!await v_(e)){const e=y_();return this.tone="error",this.status=Hy(e??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}const t=WE.currentUser;if(!t)return this.show({code:"pwa/signed-out",message:"Sign in first."}),void(this.busy=!1);try{const e=t.uid;await(async e=>{const t=$E(QE,"pwa-auth/"+e),n=await VE(t);await Promise.all(n.items.map(e=>jE(e)));for(const e of n.prefixes){const t=await VE(e);await Promise.all(t.items.map(e=>jE(e)))}})(e),await A_(),await t.delete(),ly(_y,{uid:e})}catch(e){const t=uy(e);this.tone="error",this.status=Hy(e),ly(Sy,t)}finally{this.busy=!1}}}stateChanged(e){this.login=e.frontend.login,this.email=e.backend.email}static get styles(){return[Vy,jy,$y,Jy,qy,i`
1670
+ `}show(t){this.tone="error",this.message=KE(t),gE(PE,t)}async alertPassword(){if(this.busy)return;const t=this.shadowRoot.querySelector("#pwa-current-password").value,e=this.shadowRoot.querySelector("#pwa-new-password").value,n=this.shadowRoot.querySelector("#pwa-verify-password").value;if(this.password=e,t.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});const s=qE(this.password);s?this.show(s):this.password===n?sE.currentUser?await this.updatePass(t,this.password):this.show({code:"pwa/signed-out",message:"Sign in first."}):this.show({code:"pwa/password-mismatch",message:JE})}}Lb([ut(),Fb("design:type",String)],Pb.prototype,"message",void 0),Lb([ut(),Fb("design:type",String)],Pb.prototype,"tone",void 0),Lb([ut(),Fb("design:type",String)],Pb.prototype,"password",void 0),Lb([ut(),Fb("design:type",Boolean)],Pb.prototype,"login",void 0),Lb([ut(),Fb("design:type",Boolean)],Pb.prototype,"busy",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"showCurrent",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"showNext",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"showVerify",void 0),customElements.define("input-password",Pb);var Mb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Hb extends(wt(bn)(it)){constructor(){super(),this.login=!1,this.email="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.alertDelete=()=>{if(this.busy)return;if(!sE.currentUser)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const t=this.shadowRoot.querySelector("#pwa-delete-password").value;if(t.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});1==confirm("Delete Account?")&&this.officialDelete(t)},this.officialDelete=async t=>{this.busy=!0,this.tone="",this.status="";if(!await N_(t)){const t=O_();return this.tone="error",this.status=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}const e=sE.currentUser;if(!e)return this.show({code:"pwa/signed-out",message:"Sign in first."}),void(this.busy=!1);try{const t=e.uid;await(async t=>{const e=Yy(nE,"pwa-auth/"+t),n=await Qy(e);await Promise.all(n.items.map(t=>Wy(t)));for(const t of n.prefixes){const e=await Qy(t);await Promise.all(e.items.map(t=>Wy(t)))}})(t),await L_(),await e.delete(),gE(SE,{uid:t})}catch(t){const e=mE(t);this.tone="error",this.status=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login,this.email=t.backend.email}static get styles(){return[QE,WE,YE,XE,ZE,i`
1575
1671
 
1576
1672
  :host {
1577
1673
  display: grid;
1578
1674
  grid-template-rows: auto auto auto auto;
1579
1675
  align-content: start;
1676
+ box-sizing: border-box;
1677
+ width: 100%;
1678
+ max-width: min(100%, var(--pwa_max_width, 400px));
1679
+ min-width: 0;
1680
+ margin-inline: auto;
1681
+ padding-inline: var(--pwa_inset, 0px);
1580
1682
  }
1581
1683
 
1582
1684
  p.lead {
1583
1685
  margin: 0;
1584
- padding: 4px 20px 0;
1686
+ padding: 4px 0 0;
1585
1687
  line-height: 1.5;
1586
1688
  color: var(--pwa_label_text_color, #1c2430);
1587
1689
  }
1588
1690
 
1589
- `]}render(){return H`
1691
+ `]}render(){return U`
1590
1692
 
1591
1693
  <p class="lead">Permanently delete the user account and data related to: ${this.email}</p>
1592
1694
 
@@ -1601,13 +1703,13 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1601
1703
  autocomplete="current-password"
1602
1704
  aria-describedby="pwa-delete-status"/>
1603
1705
 
1604
- ${Qy(this.showPassword,()=>{this.showPassword=!this.showPassword})}
1706
+ ${nD(this.showPassword,()=>{this.showPassword=!this.showPassword})}
1605
1707
 
1606
1708
  </span>
1607
1709
 
1608
1710
  </label>
1609
1711
 
1610
- ${zy("pwa-delete-status",this.status,this.tone)}
1712
+ ${tD("pwa-delete-status",this.status,this.tone)}
1611
1713
 
1612
1714
  <button
1613
1715
  type="button"
@@ -1617,11 +1719,36 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1617
1719
  ?disabled="${!1===this.login||this.busy}"
1618
1720
  @click="${this.alertDelete}">${this.busy?"Deleting…":"Delete"}</button>
1619
1721
 
1620
- `}show(e){this.tone="error",this.status=Hy(e),ly(Sy,e)}}Nb([ue(),Rb("design:type",Boolean)],kb.prototype,"login",void 0),Nb([ue(),Rb("design:type",String)],kb.prototype,"email",void 0),Nb([ue(),Rb("design:type",Object)],kb.prototype,"busy",void 0),Nb([ue(),Rb("design:type",Object)],kb.prototype,"status",void 0),Nb([ue(),Rb("design:type",Object)],kb.prototype,"tone",void 0),Nb([ue(),Rb("design:type",Object)],kb.prototype,"showPassword",void 0),customElements.define("delete-user",kb);var Lb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Fb=class extends(he(gn)(ie)){constructor(){super(),this.empty="",this.profileTopic="",this.name="",this.email="",this.login=!1,this.onSubmit=e=>{e.preventDefault()}}connectedCallback(){Q_(this),super.connectedCallback(),this.addEventListener("submit",this.onSubmit)}disconnectedCallback(){this.removeEventListener("submit",this.onSubmit),super.disconnectedCallback()}onTabKey(e){if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;const t=["profile","verification","password","delete"],n=t.indexOf(this.profileTopic),s=t[(n+("ArrowRight"===e.key?1:-1)+t.length)%t.length];gn.dispatch(Xt(s)),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`button[value="${s}"]`)?.focus()})}stateChanged(e){this.profileTopic=e.frontend.settings,this.login=Boolean(e.frontend?.login),this.name=e.backend.name,this.email=e.backend.email}static get styles(){return[gb,_n,mn,Ky,i`
1722
+ `}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}Mb([ut(),Gb("design:type",Boolean)],Hb.prototype,"login",void 0),Mb([ut(),Gb("design:type",String)],Hb.prototype,"email",void 0),Mb([ut(),Gb("design:type",Object)],Hb.prototype,"busy",void 0),Mb([ut(),Gb("design:type",Object)],Hb.prototype,"status",void 0),Mb([ut(),Gb("design:type",Object)],Hb.prototype,"tone",void 0),Mb([ut(),Gb("design:type",Object)],Hb.prototype,"showPassword",void 0),customElements.define("delete-user",Hb);var Ub=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jb=class extends(wt(bn)(it)){constructor(){super(),this.empty="",this.profileTopic="",this.name="",this.email="",this.login=!1,this.clipHeight="auto",this.sheetShift="none",this.rollMotion=!1,this.booted=!1,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onSubmit=t=>{t.preventDefault()},this.onClipEnd=t=>{t instanceof TransitionEvent&&t.target===t.currentTarget&&"max-height"===t.propertyName&&this.rest()}}connectedCallback(){nb(this),super.connectedCallback(),this.addEventListener("submit",this.onSubmit)}disconnectedCallback(){this.removeEventListener("submit",this.onSubmit),this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}onTabKey(t){if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;const e=["profile","verification","password","delete"],n=e.indexOf(this.profileTopic),s=e[(n+("ArrowRight"===t.key?1:-1)+e.length)%e.length];bn.dispatch(on(s)),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`button[value="${s}"]`)?.focus()})}stateChanged(t){this.profileTopic=t.frontend.settings,this.login=Boolean(t.frontend?.login),this.name=t.backend.name,this.email=t.backend.email}static get styles(){return[bb,Sn,eD,i`
1621
1723
 
1622
1724
  :host {
1623
- display: grid;
1624
- background-color: var(--pwa_settings_background_color, #fffdf8);
1725
+ display: block;
1726
+ box-sizing: border-box;
1727
+ width: 100%;
1728
+ min-width: 0; /* Required - shrink inside a flex or grid track */
1729
+ max-width: 100%;
1730
+ /* Required - this component's clock. It is not the drawer or the page login. */
1731
+ --pwa_slide: 2s;
1732
+ background-color: var(--pwa_background, var(--pwa_settings_background_color, #fff));
1733
+ }
1734
+
1735
+ @media (prefers-reduced-motion: reduce) {
1736
+ :host { --pwa_slide: 0s; }
1737
+ }
1738
+
1739
+ /* Required - this settings roll only. Block, so the sheet is not stretched. */
1740
+ .settings-clip {
1741
+ display: block;
1742
+ overflow: hidden;
1743
+ min-height: 0;
1744
+ }
1745
+
1746
+ .settings-sheet {
1747
+ display: block;
1748
+ height: auto;
1749
+ width: 100%;
1750
+ box-sizing: border-box;
1751
+ background-color: var(--pwa_background, var(--pwa_settings_background_color, #fff));
1625
1752
  }
1626
1753
 
1627
1754
  form {
@@ -1634,7 +1761,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1634
1761
 
1635
1762
  .signed-out {
1636
1763
  margin: 0;
1637
- padding: 20px 16px;
1764
+ padding: 20px var(--pwa_inset, 0px);
1638
1765
  text-align: center;
1639
1766
  color: var(--pwa_label_text_color, #1c2430);
1640
1767
  font-size: 0.95rem;
@@ -1648,9 +1775,9 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1648
1775
  }
1649
1776
  }
1650
1777
 
1651
- `]}openTab(e){gn.dispatch(Xt(e))}render(){if(!this.login)return H`
1778
+ `]}openTab(t){bn.dispatch(on(t))}willUpdate(t){if(!this.booted||!this.login||t.has("login"))return;if(!t.has("profileTopic"))return;const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,e&&this.watchColumn(),e||!t.has("profileTopic")||!this.login||t.has("login"))return;const n=this.clip(),s=this.sheet();if(!n||!s||null==this.heldHeight)return;const r=this.heldHeight;this.heldHeight=null;const i=Math.ceil(s.getBoundingClientRect().height);Math.abs(i-r)>1?this.rollBetween(n,s,r,i,i):this.rest()}watchColumn(){"undefined"!=typeof ResizeObserver&&(this.columnObserver=new ResizeObserver(()=>{const t=Math.round(this.getBoundingClientRect().width);if(!t||t===this.columnWidth)return;if(this.columnWidth=t,!this.rollMotion)return;const e=this.clip(),n=this.sheet();if(!e||!n)return;const s=Math.ceil(e.getBoundingClientRect().height),r=Math.ceil(n.getBoundingClientRect().height);this.rollBetween(e,n,s,r,r)}),this.columnObserver.observe(this))}clip(){return this.shadowRoot?.querySelector(".settings-clip")??null}sheet(){return this.shadowRoot?.querySelector(".settings-sheet")??null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}rest(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void this.rest();t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}render(){if(!this.login)return U`
1652
1779
  <p class="signed-out" part="signed-out" role="status">Sign in to change the photo, name, email, or password.</p>
1653
- `;const e=Y_(this.name,this.email);return H`
1780
+ `;const t=rb(this.name,this.email);return U`
1654
1781
 
1655
1782
  <!-- Page Menu -->
1656
1783
  <nav aria-label="Account" @keydown="${this.onTabKey}">
@@ -1710,8 +1837,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1710
1837
  </nav>
1711
1838
 
1712
1839
 
1713
- <div class= "wrapper">
1714
- <div class= "inner">
1840
+ <div
1841
+ class="settings-clip"
1842
+ style=${mt(this.clipStyle())}
1843
+ @transitionend=${this.onClipEnd}>
1844
+ <div class="settings-sheet" style=${mt(this.sheetStyle())}>
1715
1845
 
1716
1846
 
1717
1847
  <!-- Page 1: Profile -->
@@ -1720,10 +1850,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1720
1850
  role="tabpanel"
1721
1851
  aria-hidden="${"profile"===this.profileTopic?"false":"true"}"
1722
1852
  ?inert="${"profile"!==this.profileTopic}"
1723
- class="content ${"profile"===this.profileTopic?"opened":"closed"}">
1853
+ ?hidden="${"profile"!==this.profileTopic}">
1724
1854
 
1725
1855
  <!-- Display Username -->
1726
- <h2>${e}</h2>
1856
+ <h2>${t}</h2>
1727
1857
 
1728
1858
  <!-- Custom Image Element - Display / Upload -->
1729
1859
  <contact-photo emptyArtwork="${this.empty}" exportparts="progress, file, preview"></contact-photo>
@@ -1736,7 +1866,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1736
1866
  role="tabpanel"
1737
1867
  aria-hidden="${"verification"===this.profileTopic?"false":"true"}"
1738
1868
  ?inert="${"verification"!==this.profileTopic}"
1739
- class="content ${"verification"===this.profileTopic?"opened":"closed"}">
1869
+ ?hidden="${"verification"!==this.profileTopic}">
1740
1870
 
1741
1871
  <!-- Page Title -->
1742
1872
  <h2>Contact Information</h2>
@@ -1758,7 +1888,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1758
1888
  role="tabpanel"
1759
1889
  aria-hidden="${"password"===this.profileTopic?"false":"true"}"
1760
1890
  ?inert="${"password"!==this.profileTopic}"
1761
- class="content ${"password"===this.profileTopic?"opened":"closed"}">
1891
+ ?hidden="${"password"!==this.profileTopic}">
1762
1892
 
1763
1893
  <!-- Page Title -->
1764
1894
  <h2>Password</h2>
@@ -1774,7 +1904,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1774
1904
  role="tabpanel"
1775
1905
  aria-hidden="${"delete"===this.profileTopic?"false":"true"}"
1776
1906
  ?inert="${"delete"!==this.profileTopic}"
1777
- class="content ${"delete"===this.profileTopic?"opened":"closed"}">
1907
+ ?hidden="${"delete"!==this.profileTopic}">
1778
1908
 
1779
1909
  <!-- Page Title -->
1780
1910
  <h2>Delete Account</h2>
@@ -1784,10 +1914,19 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1784
1914
 
1785
1915
  </section>
1786
1916
 
1787
- </div>
1917
+ </div>
1788
1918
  </div>
1789
1919
 
1790
- `}};Lb([le({type:String,reflect:!0}),xb("design:type",Object)],Fb.prototype,"empty",void 0),Lb([ue(),xb("design:type",Object)],Fb.prototype,"profileTopic",void 0),Lb([ue(),xb("design:type",Object)],Fb.prototype,"name",void 0),Lb([ue(),xb("design:type",Object)],Fb.prototype,"email",void 0),Lb([ue(),xb("design:type",Object)],Fb.prototype,"login",void 0),Fb=Lb([oe("user-settings"),xb("design:paramtypes",[])],Fb);const Pb=i`
1920
+ `}};Ub([lt({type:String,reflect:!0}),Vb("design:type",Object)],jb.prototype,"empty",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"profileTopic",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"name",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"email",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"login",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"clipHeight",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"sheetShift",void 0),Ub([ut(),Vb("design:type",Object)],jb.prototype,"rollMotion",void 0),jb=Ub([at("user-settings"),Vb("design:paramtypes",[])],jb);const $b=i`
1921
+
1922
+ :host {
1923
+ display: block;
1924
+ box-sizing: border-box;
1925
+ width: fit-content; /* Required - the button sizes to its label, not the page */
1926
+ max-width: 100%;
1927
+ min-width: 0;
1928
+ background-color: var(--pwa_background, #fff);
1929
+ }
1791
1930
 
1792
1931
  .icon, .login {
1793
1932
  cursor: pointer;
@@ -1850,7 +1989,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1850
1989
  letter-spacing: 0.04em;
1851
1990
  }
1852
1991
 
1853
- `;var Mb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Gb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Ub=class extends(he(gn)(ie)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._photoURL="",this._name="",this._email=""}connectedCallback(){Q_(this),super.connectedCallback()}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{gn.dispatch(nn())})}stateChanged(e){this._user=e.frontend.login,this._photoURL=e.backend.photoURL,this._name=e.backend.name,this._email=e.backend.email}static get styles(){return[Pb,i`:host { border-radius: 10px; }`]}render(){return H`
1992
+ `;var Jb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zb=class extends(wt(bn)(it)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._photoURL="",this._name="",this._email=""}connectedCallback(){nb(this),super.connectedCallback()}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{bn.dispatch(ln())})}stateChanged(t){this._user=t.frontend.login,this._photoURL=t.backend.photoURL,this._name=t.backend.name,this._email=t.backend.email}static get styles(){return[$b,i`:host { border-radius: 10px; }`]}render(){return U`
1854
1993
 
1855
1994
  <!-- two classes: icon / login -->
1856
1995
  <button
@@ -1863,12 +2002,15 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1863
2002
 
1864
2003
  </button>
1865
2004
 
1866
- `}face(){if(this._photoURL)return H`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const e=W_(this._name,this._email);return e?H`<span class="initials" part="initials" aria-hidden="true">${e}</span>`:this.empty?H`<img class="userImage" part="photo" alt="" src="${this.empty}">`:H`<span class="initials" part="initials" aria-hidden="true">?</span>`}};Mb([le({type:Boolean,reflect:!0}),Gb("design:type",Object)],Ub.prototype,"subscribe",void 0),Mb([le({type:String,reflect:!0}),Gb("design:type",Object)],Ub.prototype,"empty",void 0),Mb([ue(),Gb("design:type",Object)],Ub.prototype,"_user",void 0),Mb([ue(),Gb("design:type",Object)],Ub.prototype,"_photoURL",void 0),Mb([ue(),Gb("design:type",Object)],Ub.prototype,"_name",void 0),Mb([ue(),Gb("design:type",Object)],Ub.prototype,"_email",void 0),Ub=Mb([oe("user-icon"),Gb("design:paramtypes",[])],Ub);var Hb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Vb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class jb extends ie{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}function $b(){gn.dispatch(sn())}function Jb(){gn.dispatch(rn())}function qb(){gn.dispatch(nn())}Hb([le({type:Boolean}),Vb("design:type",Boolean)],jb.prototype,"active",void 0);var zb=function(e,t,n,s){var r,i=arguments.length,a=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Kb=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Qb=class extends jb{constructor(){super(),this.userEmail="",this.status="",this.tone="",this.invalid=!1,this.busy=!1,this.cooldown=0,this.touched=!1,this.timer=0,this.stopDraft=null,this.resetPassword=async e=>{if(e.preventDefault(),this.busy||this.cooldown>0)return;const t=this.renderRoot.querySelector(".email");this.userEmail=(t?t.value:this.userEmail).trim(),t&&t.value!==this.userEmail&&(t.value=this.userEmail);const n=(s=this.userEmail).length<4?{code:"pwa/missing-email",message:"Enter an email address."}:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)?null:{code:"pwa/invalid-email",message:"Enter a valid email address."};var s;if(n)this.showError(n,"email");else{this.busy=!0,this.tone="",this.status="";try{await Oa(WE,this.userEmail),this.showSent()}catch(e){!function(e){return"auth/user-not-found"===uy(e).code}(e)?this.showFirebase(e):this.showSent()}finally{this.busy=!1}}},this.backToSignIn=()=>{const e=document.querySelector("user-drawer");if(e){const t=e.hasAttribute("subscribe");return Boolean(gn.getState().frontend?.registerOne)!==t&&gn.dispatch(Yt("drawer")),void $b()}const t=document.querySelector("user-login");if(!t)return;const n=t.hasAttribute("subscribe");Boolean(gn.getState().frontend?.registerTwo)!==n&&gn.dispatch(Yt("page")),t.scrollIntoView({block:"nearest"})}}static{this.styles=[jy,$y,Vy,Jy,i`
1867
- :host { display: block; }
2005
+ `}face(){if(this._photoURL)return U`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const t=sb(this._name,this._email);return t?U`<span class="initials" part="initials" aria-hidden="true">${t}</span>`:this.empty?U`<img class="userImage" part="photo" alt="" src="${this.empty}">`:U`<span class="initials" part="initials" aria-hidden="true">?</span>`}};Jb([lt({type:Boolean,reflect:!0}),qb("design:type",Object)],zb.prototype,"subscribe",void 0),Jb([lt({type:String,reflect:!0}),qb("design:type",Object)],zb.prototype,"empty",void 0),Jb([ut(),qb("design:type",Object)],zb.prototype,"_user",void 0),Jb([ut(),qb("design:type",Object)],zb.prototype,"_photoURL",void 0),Jb([ut(),qb("design:type",Object)],zb.prototype,"_name",void 0),Jb([ut(),qb("design:type",Object)],zb.prototype,"_email",void 0),zb=Jb([at("user-icon"),qb("design:paramtypes",[])],zb);var Kb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Wb extends it{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}function Yb(){bn.dispatch(un())}function Xb(){bn.dispatch(hn())}function Zb(){bn.dispatch(ln())}Kb([lt({type:Boolean}),Qb("design:type",Boolean)],Wb.prototype,"active",void 0);var tv=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nv=class extends Wb{constructor(){super(),this.userEmail="",this.status="",this.tone="",this.invalid=!1,this.busy=!1,this.cooldown=0,this.touched=!1,this.timer=0,this.stopDraft=null,this.resetPassword=async t=>{if(t.preventDefault(),this.busy||this.cooldown>0)return;const e=this.renderRoot.querySelector(".email");this.userEmail=(e?e.value:this.userEmail).trim(),e&&e.value!==this.userEmail&&(e.value=this.userEmail);const n=(s=this.userEmail).length<4?{code:"pwa/missing-email",message:"Enter an email address."}:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)?null:{code:"pwa/invalid-email",message:"Enter a valid email address."};var s;if(n)this.showError(n,"email");else{this.busy=!0,this.tone="",this.status="";try{await Po(sE,this.userEmail),this.showSent()}catch(t){!function(t){return"auth/user-not-found"===mE(t).code}(t)?this.showFirebase(t):this.showSent()}finally{this.busy=!1}}},this.backToSignIn=()=>{const t=document.querySelector("user-drawer");if(t){const e=t.hasAttribute("subscribe");return Boolean(bn.getState().frontend?.registerOne)!==e&&bn.dispatch(rn("drawer")),void Yb()}const e=document.querySelector("user-login");if(!e)return;const n=e.hasAttribute("subscribe");Boolean(bn.getState().frontend?.registerTwo)!==n&&bn.dispatch(rn("page")),e.scrollIntoView({block:"nearest"})}}static{this.styles=[WE,YE,QE,XE,i`
2006
+ :host {
2007
+ display: block;
2008
+ background-color: var(--pwa_background, #fff);
2009
+ }
1868
2010
 
1869
2011
  /* Required - live region stays in the tree. Idle layout stays put. */
1870
2012
  .status {
1871
- margin: 0 16px 8px;
2013
+ margin: 0 0 8px;
1872
2014
  color: var(--pwa_label_text_color, #1c2430);
1873
2015
  font-size: 0.95rem;
1874
2016
  line-height: 1.4;
@@ -1902,10 +2044,8 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1902
2044
 
1903
2045
  button.new {
1904
2046
  display: block;
1905
- width: 100%;
1906
- box-sizing: border-box;
1907
2047
  }
1908
- `]}connectedCallback(){var e;super.connectedCallback(),this.stopDraft=(e=()=>{this.prefill()},Zy.add(e),()=>{Zy.delete(e)}),this.prefill()}disconnectedCallback(){window.clearInterval(this.timer),this.timer=0,this.stopDraft?.(),this.stopDraft=null,super.disconnectedCallback()}updated(){this.paintEmail()}prefill(){if(this.touched)return;const e=tD();e&&e!==this.userEmail&&(this.userEmail=e,this.paintEmail())}paintEmail(){if(this.touched)return;const e=this.renderRoot.querySelector(".email");e&&!e.value&&this.userEmail&&(e.value=this.userEmail)}handleEmail(e){const t=e.target;this.touched=!0,this.userEmail=t.value,this.invalid&&(this.invalid=!1)}buttonLabel(){return this.busy?"Sending…":this.cooldown>0?`Send again in ${this.cooldown}s`:"Send reset email"}render(){const e="pwa-reset-status";return H`
2048
+ `]}connectedCallback(){var t;super.connectedCallback(),this.stopDraft=(t=()=>{this.prefill()},oD.add(t),()=>{oD.delete(t)}),this.prefill()}disconnectedCallback(){window.clearInterval(this.timer),this.timer=0,this.stopDraft?.(),this.stopDraft=null,super.disconnectedCallback()}updated(){this.paintEmail()}prefill(){if(this.touched)return;const t=BD();t&&t!==this.userEmail&&(this.userEmail=t,this.paintEmail())}paintEmail(){if(this.touched)return;const t=this.renderRoot.querySelector(".email");t&&!t.value&&this.userEmail&&(t.value=this.userEmail)}handleEmail(t){const e=t.target;this.touched=!0,this.userEmail=e.value,this.invalid&&(this.invalid=!1)}buttonLabel(){return this.busy?"Sending…":this.cooldown>0?`Send again in ${this.cooldown}s`:"Send reset email"}render(){const t="pwa-reset-status";return U`
1909
2049
 
1910
2050
  <form
1911
2051
  class="resetPass"
@@ -1924,7 +2064,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1924
2064
  autocomplete = "email"
1925
2065
  required
1926
2066
  aria-invalid = "${this.invalid?"true":"false"}"
1927
- aria-describedby = "${e}"
2067
+ aria-describedby = "${t}"
1928
2068
  @input = "${this.handleEmail}"
1929
2069
  @change = "${this.handleEmail}">
1930
2070
 
@@ -1943,7 +2083,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1943
2083
  type = "submit"
1944
2084
  part = "submit"
1945
2085
  class = "reset action-button"
1946
- aria-describedby = "${e}"
2086
+ aria-describedby = "${t}"
1947
2087
  aria-busy = "${this.busy?"true":"false"}"
1948
2088
  ?disabled = "${this.busy||this.cooldown>0}">${this.buttonLabel()}</button>
1949
2089
 
@@ -1955,4 +2095,4 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1955
2095
 
1956
2096
  </form>
1957
2097
 
1958
- `}showSent(){this.tone="",this.status="If an account uses that email, a reset link is on its way.",this.invalid=!1,this.cooldown=45,this.armCooldown(),ly(Ty,{email:this.userEmail}),this.updateComplete.then(()=>{this.focusStatus()})}showError(e,t){this.tone="error",this.status=Hy(e),this.invalid="email"===t,ly(Sy,e),this.updateComplete.then(()=>{this.focusAfter(t)})}showFirebase(e){const t=uy(e);this.tone="error",this.status=Hy(e),this.invalid="auth/invalid-email"===t.code,ly(Sy,t),this.updateComplete.then(()=>{this.focusAfter(this.invalid?"email":"status")})}focusAfter(e){"email"===e?this.focusEmail():this.focusStatus()}focusEmail(){const e=this.renderRoot.querySelector(".email");e?.focus()}focusStatus(){const e=this.renderRoot.querySelector("#pwa-reset-status");e?.focus()}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}};function Wb(){return sy()?cy(WE.currentUser):null}function Yb(e){let t,n=!1;return ry(()=>{n||(t=xa(WE,t=>{e(cy(t))}))}),()=>{n=!0,t&&t()}}zb([ue(),Kb("design:type",String)],Qb.prototype,"userEmail",void 0),zb([ue(),Kb("design:type",String)],Qb.prototype,"status",void 0),zb([ue(),Kb("design:type",String)],Qb.prototype,"tone",void 0),zb([ue(),Kb("design:type",Boolean)],Qb.prototype,"invalid",void 0),zb([ue(),Kb("design:type",Boolean)],Qb.prototype,"busy",void 0),zb([ue(),Kb("design:type",Number)],Qb.prototype,"cooldown",void 0),Qb=zb([oe("email-reset"),Kb("design:paramtypes",[])],Qb);export{Qb as EmailReset,Cb as UserDrawer,Ub as UserIcon,eb as UserLogin,Fb as UserSettings,zE as application,WE as auth,Jb as closeDrawer,KE as db,O_ as deleteDocument,ky as eventName,YE as firebaseConfig,Wb as getCurrentUser,ay as initialize,U_ as isEmailVerified,T_ as logAccount,A_ as logAccountDelete,I_ as logOut,Yb as onUserChanged,$b as openDrawer,_y as pwaAccountDeleted,wy as pwaAuthChanged,Sy as pwaAuthError,b_ as pwaDrawerToggle,Ay as pwaDrawerToggleName,vy as pwaEmailChanged,Ry as pwaEmailVerified,Ey as pwaLogin,yy as pwaLogout,Iy as pwaPasswordChanged,by as pwaProfileUpdated,Ty as pwaResetSent,Oy as pwaSettings,Dy as pwaSignup,Ny as pwaVerificationSent,v_ as reauthenticate,G_ as sendVerification,QE as storage,qb as toggleDrawer,XE as user,bb as userEmailChanged};
2098
+ `}showSent(){this.tone="",this.status="If an account uses that email, a reset link is on its way.",this.invalid=!1,this.cooldown=45,this.armCooldown(),gE(kE,{email:this.userEmail}),this.updateComplete.then(()=>{this.focusStatus()})}showError(t,e){this.tone="error",this.status=KE(t),this.invalid="email"===e,gE(PE,t),this.updateComplete.then(()=>{this.focusAfter(e)})}showFirebase(t){const e=mE(t);this.tone="error",this.status=KE(t),this.invalid="auth/invalid-email"===e.code,gE(PE,e),this.updateComplete.then(()=>{this.focusAfter(this.invalid?"email":"status")})}focusAfter(t){"email"===t?this.focusEmail():this.focusStatus()}focusEmail(){const t=this.renderRoot.querySelector(".email");t?.focus()}focusStatus(){const t=this.renderRoot.querySelector("#pwa-reset-status");t?.focus()}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}};function sv(){return lE()?CE(sE.currentUser):null}function rv(t){let e,n=!1;return uE(()=>{n||(e=jo(sE,e=>{t(CE(e))}))}),()=>{n=!0,e&&e()}}tv([ut(),ev("design:type",String)],nv.prototype,"userEmail",void 0),tv([ut(),ev("design:type",String)],nv.prototype,"status",void 0),tv([ut(),ev("design:type",String)],nv.prototype,"tone",void 0),tv([ut(),ev("design:type",Boolean)],nv.prototype,"invalid",void 0),tv([ut(),ev("design:type",Boolean)],nv.prototype,"busy",void 0),tv([ut(),ev("design:type",Number)],nv.prototype,"cooldown",void 0),nv=tv([at("email-reset"),ev("design:paramtypes",[])],nv);export{nv as EmailReset,_b as UserDrawer,zb as UserIcon,ab as UserLogin,jb as UserSettings,tE as application,sE as auth,Xb as closeDrawer,eE as db,F_ as deleteDocument,HE as eventName,rE as firebaseConfig,sv as getCurrentUser,dE as initialize,z_ as isEmailVerified,k_ as logAccount,L_ as logAccountDelete,x_ as logOut,rv as onUserChanged,Yb as openDrawer,SE as pwaAccountDeleted,IE as pwaAuthChanged,PE as pwaAuthError,R_ as pwaDrawerToggle,LE as pwaDrawerToggleName,NE as pwaEmailChanged,GE as pwaEmailVerified,TE as pwaLogin,OE as pwaLogout,xE as pwaPasswordChanged,RE as pwaProfileUpdated,kE as pwaResetSent,FE as pwaSettings,AE as pwaSignup,ME as pwaVerificationSent,N_ as reauthenticate,q_ as sendVerification,nE as storage,Zb as toggleDrawer,iE as user,Rb as userEmailChanged};