@veltdev/sdk-dev 5.0.4 → 6.0.0-beta.1

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 (69) hide show
  1. package/app/client/snippyly.model.d.ts +0 -18
  2. package/app/{models/data/arrow-annotation.data.model.d.ts → features/arrow/models/arrow-annotation.model.d.ts} +6 -6
  3. package/app/features/user-request/models/user-request.data.model.d.ts +37 -0
  4. package/app/models/data/comment-annotation.data.model.d.ts +0 -7
  5. package/app/models/data/comment-resolver.data.model.d.ts +3 -15
  6. package/app/models/data/resolver.data.model.d.ts +1 -26
  7. package/app/models/data/user-contact-us.data.model.d.ts +1 -1
  8. package/app/models/data/user-feedback.data.model.d.ts +1 -1
  9. package/app/models/data/user-report-bug.data.model.d.ts +1 -1
  10. package/app/models/element/comment-element.model.d.ts +0 -4
  11. package/app/models/element/notification-element.model.d.ts +1 -15
  12. package/app/utils/constants.d.ts +10 -1
  13. package/app/utils/enums.d.ts +7 -27
  14. package/chunk-2BDYFELB.js +6 -0
  15. package/chunk-2MCCXRU6.js +93 -0
  16. package/chunk-3KN3NYZR.js +2 -0
  17. package/chunk-3RQKSLIV.js +1 -0
  18. package/chunk-4HGZF7YE.js +1 -0
  19. package/chunk-5ZWGZNCN.js +2 -0
  20. package/chunk-6NYVF3UW.js +1 -0
  21. package/chunk-BRIJGI4O.js +7 -0
  22. package/chunk-C63JXSXB.js +1 -0
  23. package/chunk-FKZM4T63.js +1 -0
  24. package/chunk-G46CTA6V.js +1 -0
  25. package/chunk-GD4JQQR2.js +167 -0
  26. package/chunk-HPCLPNY3.js +2 -0
  27. package/chunk-IYJWYBXI.js +13 -0
  28. package/chunk-JNJEOJET.js +1 -0
  29. package/chunk-KFXLOTXX.js +1 -0
  30. package/chunk-LXSCD43J.js +2 -0
  31. package/chunk-MEV4PQAP.js +193 -0
  32. package/chunk-NVFQYVI5.js +1 -0
  33. package/chunk-OQBVT36K.js +1 -0
  34. package/chunk-P2263MG2.js +2 -0
  35. package/chunk-P7SXN2XF.js +10 -0
  36. package/chunk-PROSLKM3.js +1 -0
  37. package/chunk-PTTRYFYB.js +1 -0
  38. package/chunk-RFW75IKO.js +1 -0
  39. package/chunk-S4AU5GVL.js +1 -0
  40. package/chunk-UZJTB2H6.js +1 -0
  41. package/chunk-V2COGSFG.js +1 -0
  42. package/chunk-WYMNU2Q5.js +1 -0
  43. package/chunk-X3GYH6JJ.js +1 -0
  44. package/chunk-X453UEMY.js +1 -0
  45. package/chunk-YD4VUEL4.js +1 -0
  46. package/chunk-ZI5OOBWM.js +1 -0
  47. package/models.d.ts +1 -1
  48. package/package.json +1 -1
  49. package/types.d.ts +0 -1
  50. package/velt-activity-log.js +1 -0
  51. package/velt-area.js +1 -0
  52. package/velt-arrow.js +2 -0
  53. package/velt-comment.js +14 -0
  54. package/velt-crdt.js +1 -0
  55. package/velt-cursor.js +2 -0
  56. package/velt-huddle.js +3 -0
  57. package/velt-live-state-sync.js +2 -0
  58. package/velt-notification.js +1 -0
  59. package/velt-presence.js +1 -0
  60. package/velt-reaction.js +1 -0
  61. package/velt-recorder.js +1 -0
  62. package/velt-rewriter.js +8 -0
  63. package/velt-selection.js +1 -0
  64. package/velt-tag.js +1 -0
  65. package/velt-user-invite.js +2 -0
  66. package/velt-user-request.js +1 -0
  67. package/velt-video-player.js +1 -0
  68. package/velt-views.js +3 -0
  69. package/velt.js +34 -549
@@ -0,0 +1,167 @@
1
+ var gz=Object.create;var $p=Object.defineProperty,mz=Object.defineProperties,pz=Object.getOwnPropertyDescriptor,Ez=Object.getOwnPropertyDescriptors,_z=Object.getOwnPropertyNames,Gp=Object.getOwnPropertySymbols,hP=Object.getPrototypeOf,lS=Object.prototype.hasOwnProperty,fP=Object.prototype.propertyIsEnumerable,Tz=Reflect.get;var dP=(n,e,r)=>e in n?$p(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,P=(n,e)=>{for(var r in e||={})lS.call(e,r)&&dP(n,r,e[r]);if(Gp)for(var r of Gp(e))fP.call(e,r)&&dP(n,r,e[r]);return n},le=(n,e)=>mz(n,Ez(e));var uS=(n,e)=>{var r={};for(var t in n)lS.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&Gp)for(var t of Gp(n))e.indexOf(t)<0&&fP.call(n,t)&&(r[t]=n[t]);return r};var mse=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),pse=(n,e)=>{for(var r in e)$p(n,r,{get:e[r],enumerable:!0})},Iz=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _z(e))!lS.call(n,i)&&i!==r&&$p(n,i,{get:()=>e[i],enumerable:!(t=pz(e,i))||t.enumerable});return n};var Ese=(n,e,r)=>(r=n!=null?gz(hP(n)):{},Iz(e||!n||!n.__esModule?$p(r,"default",{value:n,enumerable:!0}):r,n));var mc=(n,e,r)=>Tz(hP(n),r,e);var I=(n,e,r)=>new Promise((t,i)=>{var o=c=>{try{a(r.next(c))}catch(l){i(l)}},s=c=>{try{a(r.throw(c))}catch(l){i(l)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(o,s);a((r=r.apply(n,e)).next())});function ye(n){return typeof n=="function"}function dS(n){return ye(n?.lift)}function ve(n){return e=>{if(dS(e))return e.lift(function(r){try{return n(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function $s(n){let r=n(t=>{Error.call(t),t.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var jp=$s(n=>function(r){n(this),this.message=r?`${r.length} errors occurred during unsubscription:
2
+ ${r.map((t,i)=>`${i+1}) ${t.toString()}`).join(`
3
+ `)}`:"",this.name="UnsubscriptionError",this.errors=r});function pc(n,e){if(n){let r=n.indexOf(e);0<=r&&n.splice(r,1)}}var gt=class n{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:t}=this;if(ye(t))try{t()}catch(o){e=o instanceof jp?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{gP(o)}catch(s){e=e??[],s instanceof jp?e=[...e,...s.errors]:e.push(s)}}if(e)throw new jp(e)}}add(e){var r;if(e&&e!==this)if(this.closed)gP(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&pc(r,e)}remove(e){let{_finalizers:r}=this;r&&pc(r,e),e instanceof n&&e._removeParent(this)}};gt.EMPTY=(()=>{let n=new gt;return n.closed=!0,n})();var hS=gt.EMPTY;function Hp(n){return n instanceof gt||n&&"closed"in n&&ye(n.remove)&&ye(n.add)&&ye(n.unsubscribe)}function gP(n){ye(n)?n():n.unsubscribe()}var yi={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Eu={setTimeout(n,e,...r){let{delegate:t}=Eu;return t?.setTimeout?t.setTimeout(n,e,...r):setTimeout(n,e,...r)},clearTimeout(n){let{delegate:e}=Eu;return(e?.clearTimeout||clearTimeout)(n)},delegate:void 0};function Wp(n){Eu.setTimeout(()=>{let{onUnhandledError:e}=yi;if(e)e(n);else throw n})}function Si(){}var mP=fS("C",void 0,void 0);function pP(n){return fS("E",void 0,n)}function EP(n){return fS("N",n,void 0)}function fS(n,e,r){return{kind:n,value:e,error:r}}var Ec=null;function _u(n){if(yi.useDeprecatedSynchronousErrorHandling){let e=!Ec;if(e&&(Ec={errorThrown:!1,error:null}),n(),e){let{errorThrown:r,error:t}=Ec;if(Ec=null,r)throw t}}else n()}function _P(n){yi.useDeprecatedSynchronousErrorHandling&&Ec&&(Ec.errorThrown=!0,Ec.error=n)}var _c=class extends gt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Hp(e)&&e.add(this)):this.destination=Sz}static create(e,r,t){return new Ai(e,r,t)}next(e){this.isStopped?mS(EP(e),this):this._next(e)}error(e){this.isStopped?mS(pP(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?mS(mP,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},vz=Function.prototype.bind;function gS(n,e){return vz.call(n,e)}var pS=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(t){zp(t)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(t){zp(t)}else zp(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){zp(r)}}},Ai=class extends _c{constructor(e,r,t){super();let i;if(ye(e)||!e)i={next:e??void 0,error:r??void 0,complete:t??void 0};else{let o;this&&yi.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&gS(e.next,o),error:e.error&&gS(e.error,o),complete:e.complete&&gS(e.complete,o)}):i=e}this.destination=new pS(i)}};function zp(n){yi.useDeprecatedSynchronousErrorHandling?_P(n):Wp(n)}function yz(n){throw n}function mS(n,e){let{onStoppedNotification:r}=yi;r&&Eu.setTimeout(()=>r(n,e))}var Sz={closed:!0,next:Si,error:yz,complete:Si};function Ee(n,e,r,t,i){return new ES(n,e,r,t,i)}var ES=class extends _c{constructor(e,r,t,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=t?function(){try{t()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function Ct(n,e){return ve((r,t)=>{let i=0;r.subscribe(Ee(t,o=>n.call(e,o,i++)&&t.next(o)))})}var Tu=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Di(n){return n}function TP(n){return n.length===0?Di:n.length===1?n[0]:function(r){return n.reduce((t,i)=>i(t),r)}}var ge=(()=>{class n{constructor(r){r&&(this._subscribe=r)}lift(r){let t=new n;return t.source=this,t.operator=r,t}subscribe(r,t,i){let o=Dz(r)?r:new Ai(r,t,i);return _u(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(t){r.error(t)}}forEach(r,t){return t=IP(t),new t((i,o)=>{let s=new Ai({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)}[Tu](){return this}pipe(...r){return TP(r)(this)}toPromise(r){return r=IP(r),new r((t,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>t(o))})}}return n.create=e=>new n(e),n})();function IP(n){var e;return(e=n??yi.Promise)!==null&&e!==void 0?e:Promise}function Az(n){return n&&ye(n.next)&&ye(n.error)&&ye(n.complete)}function Dz(n){return n&&n instanceof _c||Az(n)&&Hp(n)}var Tc=new ge(n=>n.complete());function Nt(n){return n<=0?()=>Tc:ve((e,r)=>{let t=0;e.subscribe(Ee(r,i=>{++t<=n&&(r.next(i),n<=t&&r.complete())}))})}function _S(n,e){var r={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(n);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(n,t[i])&&(r[t[i]]=n[t[i]]);return r}function yP(n,e,r,t){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(t.next(u))}catch(d){s(d)}}function c(u){try{l(t.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((t=t.apply(n,e||[])).next())})}function vP(n){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&n[e],t=0;if(r)return r.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&t>=n.length&&(n=void 0),{value:n&&n[t++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ic(n){return this instanceof Ic?(this.v=n,this):new Ic(n)}function SP(n,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r.apply(n,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(p){return Promise.resolve(p).then(g,d)}}function a(g,p){t[g]&&(i[g]=function(_){return new Promise(function(T,S){o.push([g,_,T,S])>1||c(g,_)})},p&&(i[g]=p(i[g])))}function c(g,p){try{l(t[g](p))}catch(_){f(o[0][3],_)}}function l(g){g.value instanceof Ic?Promise.resolve(g.value.v).then(u,d):f(o[0][2],g)}function u(g){c("next",g)}function d(g){c("throw",g)}function f(g,p){g(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function AP(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],r;return e?e.call(n):(n=typeof vP=="function"?vP(n):n[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r);function t(o){r[o]=n[o]&&function(s){return new Promise(function(a,c){s=n[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Iu=n=>n&&typeof n.length=="number"&&typeof n!="function";function qp(n){return ye(n?.then)}function Kp(n){return ye(n[Tu])}function Yp(n){return Symbol.asyncIterator&&ye(n?.[Symbol.asyncIterator])}function Qp(n){return new TypeError(`You provided ${n!==null&&typeof n=="object"?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Rz(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xp=Rz();function Jp(n){return ye(n?.[Xp])}function Zp(n){return SP(this,arguments,function*(){let r=n.getReader();try{for(;;){let{value:t,done:i}=yield Ic(r.read());if(i)return yield Ic(void 0);yield yield Ic(t)}}finally{r.releaseLock()}})}function eE(n){return ye(n?.getReader)}function Le(n){if(n instanceof ge)return n;if(n!=null){if(Kp(n))return Cz(n);if(Iu(n))return Nz(n);if(qp(n))return Oz(n);if(Yp(n))return DP(n);if(Jp(n))return wz(n);if(eE(n))return bz(n)}throw Qp(n)}function Cz(n){return new ge(e=>{let r=n[Tu]();if(ye(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Nz(n){return new ge(e=>{for(let r=0;r<n.length&&!e.closed;r++)e.next(n[r]);e.complete()})}function Oz(n){return new ge(e=>{n.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Wp)})}function wz(n){return new ge(e=>{for(let r of n)if(e.next(r),e.closed)return;e.complete()})}function DP(n){return new ge(e=>{Lz(n,e).catch(r=>e.error(r))})}function bz(n){return DP(Zp(n))}function Lz(n,e){var r,t,i,o;return yP(this,void 0,void 0,function*(){try{for(r=AP(n);t=yield r.next(),!t.done;){let s=t.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{t&&!t.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function RP(n){return ve((e,r)=>{let t=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let l=i;i=null,r.next(l)}s&&r.complete()},c=()=>{o=null,s&&r.complete()};e.subscribe(Ee(r,l=>{t=!0,i=l,o||Le(n(l)).subscribe(o=Ee(r,a,c))},()=>{s=!0,(!t||!o||o.closed)&&r.complete()}))})}var tE=class extends gt{constructor(e,r){super()}schedule(e,r=0){return this}};var _f={setInterval(n,e,...r){let{delegate:t}=_f;return t?.setInterval?t.setInterval(n,e,...r):setInterval(n,e,...r)},clearInterval(n){let{delegate:e}=_f;return(e?.clearInterval||clearInterval)(n)},delegate:void 0};var oo=class extends tE{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var t;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(t=this.id)!==null&&t!==void 0?t:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,t=0){return _f.setInterval(e.flush.bind(e,this),t)}recycleAsyncId(e,r,t=0){if(t!=null&&this.delay===t&&this.pending===!1)return r;r!=null&&_f.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let t=this._execute(e,r);if(t)return t;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let t=!1,i;try{this.work(e)}catch(o){t=!0,i=o||new Error("Scheduled action threw falsy error")}if(t)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:t}=r;this.work=this.state=this.scheduler=null,this.pending=!1,pc(t,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var vc={now(){return(vc.delegate||Date).now()},delegate:void 0};var vu=class n{constructor(e,r=n.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,t){return new this.schedulerActionCtor(this,e).schedule(t,r)}};vu.now=vc.now;var so=class extends vu{constructor(e,r=vu.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let t;this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}}};var Hn=new so(oo),TS=Hn;function nE(n){return n&&ye(n.schedule)}function rE(n){return n instanceof Date&&!isNaN(n)}function Ri(n=0,e,r=TS){let t=-1;return e!=null&&(nE(e)?r=e:t=e),new ge(i=>{let o=rE(n)?+n-r.now():n;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=t?this.schedule(void 0,t):i.complete())},o)})}function Mz(n,e=Hn){return RP(()=>Ri(n,e))}function IS(n){return n[n.length-1]}function iE(n){return ye(IS(n))?n.pop():void 0}function ao(n){return nE(IS(n))?n.pop():void 0}function CP(n,e){return typeof IS(n)=="number"?n.pop():e}function Wn(n,e,r,t=0,i=!1){let o=e.schedule(function(){r(),i?n.add(this.schedule(null,t)):this.unsubscribe()},t);if(n.add(o),!i)return o}function es(n){return ve((e,r)=>{let t=null,i=!1,o;t=e.subscribe(Ee(r,void 0,void 0,s=>{o=Le(n(s,es(n)(e))),t?(t.unsubscribe(),t=null,o.subscribe(r)):i=!0})),i&&(t.unsubscribe(),t=null,o.subscribe(r))})}var{isArray:Pz}=Array,{getPrototypeOf:xz,prototype:Fz,keys:kz}=Object;function oE(n){if(n.length===1){let e=n[0];if(Pz(e))return{args:e,keys:null};if(Uz(e)){let r=kz(e);return{args:r.map(t=>e[t]),keys:r}}}return{args:n,keys:null}}function Uz(n){return n&&typeof n=="object"&&xz(n)===Fz}function js(n,e=0){return ve((r,t)=>{r.subscribe(Ee(t,i=>Wn(t,n,()=>t.next(i),e),()=>Wn(t,n,()=>t.complete(),e),i=>Wn(t,n,()=>t.error(i),e)))})}function Hs(n,e=0){return ve((r,t)=>{t.add(n.schedule(()=>r.subscribe(t),e))})}function NP(n,e){return Le(n).pipe(Hs(e),js(e))}function OP(n,e){return Le(n).pipe(Hs(e),js(e))}function wP(n,e){return new ge(r=>{let t=0;return e.schedule(function(){t===n.length?r.complete():(r.next(n[t++]),r.closed||this.schedule())})})}function bP(n,e){return new ge(r=>{let t;return Wn(r,e,()=>{t=n[Xp](),Wn(r,e,()=>{let i,o;try{({value:i,done:o}=t.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>ye(t?.return)&&t.return()})}function sE(n,e){if(!n)throw new Error("Iterable cannot be null");return new ge(r=>{Wn(r,e,()=>{let t=n[Symbol.asyncIterator]();Wn(r,e,()=>{t.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function LP(n,e){return sE(Zp(n),e)}function MP(n,e){if(n!=null){if(Kp(n))return NP(n,e);if(Iu(n))return wP(n,e);if(qp(n))return OP(n,e);if(Yp(n))return sE(n,e);if(Jp(n))return bP(n,e);if(eE(n))return LP(n,e)}throw Qp(n)}function Pr(n,e){return e?MP(n,e):Le(n)}function fe(n,e){return ve((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{t.next(n.call(e,o,i++))}))})}var{isArray:Vz}=Array;function Bz(n,e){return Vz(e)?n(...e):n(e)}function yu(n){return fe(e=>Bz(n,e))}function aE(n,e){return n.reduce((r,t,i)=>(r[t]=e[i],r),{})}function Jr(...n){let e=ao(n),r=iE(n),{args:t,keys:i}=oE(n);if(t.length===0)return Pr([],e);let o=new ge(Gz(t,e,i?s=>aE(i,s):Di));return r?o.pipe(yu(r)):o}function Gz(n,e,r=Di){return t=>{PP(e,()=>{let{length:i}=n,o=new Array(i),s=i,a=i;for(let c=0;c<i;c++)PP(e,()=>{let l=Pr(n[c],e),u=!1;l.subscribe(Ee(t,d=>{o[c]=d,u||(u=!0,a--),a||t.next(r(o.slice()))},()=>{--s||t.complete()}))},t)},t)}}function PP(n,e,r){n?Wn(r,n,e):e()}function xP(n,e,r,t,i,o,s,a){let c=[],l=0,u=0,d=!1,f=()=>{d&&!c.length&&!l&&e.complete()},g=_=>l<t?p(_):c.push(_),p=_=>{o&&e.next(_),l++;let T=!1;Le(r(_,u++)).subscribe(Ee(e,S=>{i?.(S),o?g(S):e.next(S)},()=>{T=!0},void 0,()=>{if(T)try{for(l--;c.length&&l<t;){let S=c.shift();s?Wn(e,s,()=>p(S)):p(S)}f()}catch(S){e.error(S)}}))};return n.subscribe(Ee(e,g,()=>{d=!0,f()})),()=>{a?.()}}function co(n,e,r=1/0){return ye(e)?co((t,i)=>fe((o,s)=>e(t,o,i,s))(Le(n(t,i))),r):(typeof e=="number"&&(r=e),ve((t,i)=>xP(t,i,n,r)))}function FP(n,e,r,t,i){return(o,s)=>{let a=r,c=e,l=0;o.subscribe(Ee(s,u=>{let d=l++;c=a?n(c,u,d):(a=!0,u),t&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}function cE(n=1/0){return co(Di,n)}function kP(){return cE(1)}function vS(n,e){return ye(e)?co(n,e,1):co(n,1)}var UP=$s(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ot=(()=>{class n extends ge{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let t=new lE(this,this);return t.operator=r,t}_throwIfClosed(){if(this.closed)throw new UP}next(r){_u(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let t of this.currentObservers)t.next(r)}})}error(r){_u(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:t}=this;for(;t.length;)t.shift().error(r)}})}complete(){_u(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:t,isStopped:i,observers:o}=this;return t||i?hS:(this.currentObservers=null,o.push(r),new gt(()=>{this.currentObservers=null,pc(o,r)}))}_checkFinalizedStatuses(r){let{hasError:t,thrownError:i,isStopped:o}=this;t?r.error(i):o&&r.complete()}asObservable(){let r=new ge;return r.source=this,r}}return n.create=(e,r)=>new lE(e,r),n})(),lE=class extends Ot{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.next)===null||t===void 0||t.call(r,e)}error(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.error)===null||t===void 0||t.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,t;return(t=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&t!==void 0?t:hS}};function yS(n){return ve((e,r)=>{let t=!1,i=null,o=null,s=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let a=i;i=null,r.next(a)}};e.subscribe(Ee(r,a=>{o?.unsubscribe(),t=!0,i=a,o=Ee(r,s,Si),Le(n(a)).subscribe(o)},()=>{s(),r.complete()},void 0,()=>{i=o=null}))})}function Su(n,e=Hn){return ve((r,t)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let l=o;o=null,t.next(l)}};function c(){let l=s+n,u=e.now();if(u<l){i=this.schedule(void 0,l-u),t.add(i);return}a()}r.subscribe(Ee(t,l=>{o=l,s=e.now(),i||(i=e.schedule(c,n),t.add(i))},()=>{a(),t.complete()},void 0,()=>{o=i=null}))})}function Ws(...n){return kP()(Pr(n,ao(n)))}function VP(){return ve((n,e)=>{n.subscribe(Ee(e,Si))})}function BP(n){return fe(()=>n)}function SS(n,e){return e?r=>Ws(e.pipe(Nt(1),VP()),r.pipe(SS(n))):co((r,t)=>Le(n(r,t)).pipe(Nt(1),BP(r)))}function AS(n,e=Hn){let r=Ri(n,e);return SS(()=>r)}function ue(...n){let e=ao(n);return Pr(n,e)}function it(n,e=Di){return n=n??$z,ve((r,t)=>{let i,o=!0;r.subscribe(Ee(t,s=>{let a=e(s);(o||!n(i,a))&&(o=!1,i=a,t.next(s))}))})}function $z(n,e){return n===e}var GP=$s(n=>function(){n(this),this.name="EmptyError",this.message="no elements in sequence"});function yc(n){return ve((e,r)=>{try{e.subscribe(r)}finally{r.add(n)}})}function $P(){return ve((n,e)=>{let r=null;n._refCount++;let t=Ee(e,void 0,void 0,void 0,()=>{if(!n||n._refCount<=0||0<--n._refCount){r=null;return}let i=n._connection,o=r;r=null,i&&(!o||i===o)&&i.unsubscribe(),e.unsubscribe()});n.subscribe(t),t.closed||(r=n.connect())})}var DS=class extends ge{constructor(e,r){super(),this.source=e,this.subjectFactory=r,this._subject=null,this._refCount=0,this._connection=null,dS(e)&&(this.lift=e.lift)}_subscribe(e){return this.getSubject().subscribe(e)}getSubject(){let e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:e}=this;this._subject=this._connection=null,e?.unsubscribe()}connect(){let e=this._connection;if(!e){e=this._connection=new gt;let r=this.getSubject();e.add(this.source.subscribe(Ee(r,void 0,()=>{this._teardown(),r.complete()},t=>{this._teardown(),r.error(t)},()=>this._teardown()))),e.closed&&(this._connection=null,e=gt.EMPTY)}return e}refCount(){return $P()(this)}};function Au(){return ve((n,e)=>{let r,t=!1;n.subscribe(Ee(e,i=>{let o=r;r=i,t&&e.next([o,i]),t=!0}))})}var Y=class extends Ot{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:t}=this;if(e)throw r;return this._throwIfClosed(),t}next(e){super.next(this._value=e)}};var Sc=class extends Ot{constructor(e=1/0,r=1/0,t=vc){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=t,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:t,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(t.push(e),!i&&t.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:t,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=t?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:t,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<t.length&&t.splice(0,t.length-o),!i){let s=r.now(),a=0;for(let c=1;c<t.length&&t[c]<=s;c+=2)a=c;a&&t.splice(0,a+1)}}};function jz(n=0,e=Hn){return n<0&&(n=0),Ri(n,n,e)}function uE(n,e){return ve(FP(n,e,arguments.length>=2,!0))}function CS(n={}){let{connector:e=()=>new Ot,resetOnError:r=!0,resetOnComplete:t=!0,resetOnRefCountZero:i=!0}=n;return o=>{let s,a,c,l=0,u=!1,d=!1,f=()=>{a?.unsubscribe(),a=void 0},g=()=>{f(),s=c=void 0,u=d=!1},p=()=>{let _=s;g(),_?.unsubscribe()};return ve((_,T)=>{l++,!d&&!u&&f();let S=c=c??e();T.add(()=>{l--,l===0&&!d&&!u&&(a=RS(p,i))}),S.subscribe(T),!s&&l>0&&(s=new Ai({next:b=>S.next(b),error:b=>{d=!0,f(),a=RS(g,r,b),S.error(b)},complete:()=>{u=!0,f(),a=RS(g,t),S.complete()}}),Le(_).subscribe(s))})(o)}}function RS(n,e,...r){if(e===!0){n();return}if(e===!1)return;let t=new Ai({next:()=>{t.unsubscribe(),n()}});return Le(e(...r)).subscribe(t)}function Hz(n,e,r){let t,i=!1;return n&&typeof n=="object"?{bufferSize:t=1/0,windowTime:e=1/0,refCount:i=!1,scheduler:r}=n:t=n??1/0,CS({connector:()=>new Sc(t,e,r),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function NS(n){return Ct((e,r)=>n<=r)}function Wz(n){return ve((e,r)=>{let t=!1,i=Ee(r,()=>{i?.unsubscribe(),t=!0},Si);Le(n).subscribe(i),e.subscribe(Ee(r,o=>t&&r.next(o)))})}function Du(...n){let e=ao(n);return ve((r,t)=>{(e?Ws(n,r,e):Ws(n,r)).subscribe(t)})}function mt(n,e){return ve((r,t)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&t.complete();r.subscribe(Ee(t,c=>{i?.unsubscribe();let l=0,u=o++;Le(n(c,u)).subscribe(i=Ee(t,d=>t.next(e?e(c,d,u,l++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function zs(n){return ve((e,r)=>{Le(n).subscribe(Ee(r,()=>r.complete(),Si)),!r.closed&&e.subscribe(r)})}function zz(n,e=!1){return ve((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{let s=n(o,i++);(s||e)&&t.next(o),!s&&t.complete()}))})}function qs(n,e,r){let t=ye(n)||e||r?{next:n,error:e,complete:r}:n;return t?ve((i,o)=>{var s;(s=t.subscribe)===null||s===void 0||s.call(t);let a=!0;i.subscribe(Ee(o,c=>{var l;(l=t.next)===null||l===void 0||l.call(t,c),o.next(c)},()=>{var c;a=!1,(c=t.complete)===null||c===void 0||c.call(t),o.complete()},c=>{var l;a=!1,(l=t.error)===null||l===void 0||l.call(t,c),o.error(c)},()=>{var c,l;a&&((c=t.unsubscribe)===null||c===void 0||c.call(t)),(l=t.finalize)===null||l===void 0||l.call(t)}))}):Di}function jP(n,e){return ve((r,t)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,l=!1,u=()=>{c?.unsubscribe(),c=null,o&&(g(),l&&t.complete())},d=()=>{c=null,l&&t.complete()},f=p=>c=Le(n(p)).subscribe(Ee(t,u,d)),g=()=>{if(s){s=!1;let p=a;a=null,t.next(p),!l&&f(p)}};r.subscribe(Ee(t,p=>{s=!0,a=p,!(c&&!c.closed)&&(i?g():f(p))},()=>{l=!0,!(o&&s&&c&&!c.closed)&&t.complete()}))})}function qz(n,e=Hn,r){let t=Ri(n,e);return jP(()=>t,r)}var Kz=$s(n=>function(r=null){n(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r});function Yz(n,e){let{first:r,each:t,with:i=Qz,scheduler:o=e??Hn,meta:s=null}=rE(n)?{first:n}:typeof n=="number"?{each:n}:n;if(r==null&&t==null)throw new TypeError("No timeout provided.");return ve((a,c)=>{let l,u,d=null,f=0,g=p=>{u=Wn(c,o,()=>{try{l.unsubscribe(),Le(i({meta:s,lastValue:d,seen:f})).subscribe(c)}catch(_){c.error(_)}},p)};l=a.subscribe(Ee(c,p=>{u?.unsubscribe(),f++,c.next(d=p),t>0&&g(t)},void 0,void 0,()=>{u?.closed||u?.unsubscribe(),d=null})),!f&&g(r!=null?typeof r=="number"?r:+r-o.now():t)})}function Qz(n){throw new Kz(n)}function Xz(n=vc){return fe(e=>({value:e,timestamp:n.now()}))}var OS;function dE(){return OS}function lo(n){let e=OS;return OS=n,e}var HP=Symbol("NotFound");function Ru(n){return n===HP||n?.name==="\u0275NotFound"}var zn=null,hE=!1,wS=1,Jz=null,An=Symbol("SIGNAL");function Se(n){let e=zn;return zn=n,e}function pE(){return zn}var Ac={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Cu(n){if(hE)throw new Error("");if(zn===null)return;zn.consumerOnSignalRead(n);let e=zn.producersTail;if(e!==void 0&&e.producer===n)return;let r,t=zn.recomputing;if(t&&(r=e!==void 0?e.nextProducer:zn.producers,r!==void 0&&r.producer===n)){zn.producersTail=r,r.lastReadVersion=n.version;return}let i=n.consumersTail;if(i!==void 0&&i.consumer===zn&&(!t||e6(i,zn)))return;let o=wu(zn),s={producer:n,consumer:zn,nextProducer:r,prevConsumer:i,lastReadVersion:n.version,nextConsumer:void 0};zn.producersTail=s,e!==void 0?e.nextProducer=s:zn.producers=s,o&&KP(n,s)}function WP(){wS++}function EE(n){if(!(wu(n)&&!n.dirty)&&!(!n.dirty&&n.lastCleanEpoch===wS)){if(!n.producerMustRecompute(n)&&!Ou(n)){mE(n);return}n.producerRecomputeValue(n),mE(n)}}function bS(n){if(n.consumers===void 0)return;let e=hE;hE=!0;try{for(let r=n.consumers;r!==void 0;r=r.nextConsumer){let t=r.consumer;t.dirty||Zz(t)}}finally{hE=e}}function LS(){return zn?.consumerAllowSignalWrites!==!1}function Zz(n){n.dirty=!0,bS(n),n.consumerMarkedDirty?.(n)}function mE(n){n.dirty=!1,n.lastCleanEpoch=wS}function Dc(n){return n&&zP(n),Se(n)}function zP(n){n.producersTail=void 0,n.recomputing=!0}function Nu(n,e){Se(e),n&&qP(n)}function qP(n){n.recomputing=!1;let e=n.producersTail,r=e!==void 0?e.nextProducer:n.producers;if(r!==void 0){if(wu(n))do r=MS(r);while(r!==void 0);e!==void 0?e.nextProducer=void 0:n.producers=void 0}}function Ou(n){for(let e=n.producers;e!==void 0;e=e.nextProducer){let r=e.producer,t=e.lastReadVersion;if(t!==r.version||(EE(r),t!==r.version))return!0}return!1}function Rc(n){if(wu(n)){let e=n.producers;for(;e!==void 0;)e=MS(e)}n.producers=void 0,n.producersTail=void 0,n.consumers=void 0,n.consumersTail=void 0}function KP(n,e){let r=n.consumersTail,t=wu(n);if(r!==void 0?(e.nextConsumer=r.nextConsumer,r.nextConsumer=e):(e.nextConsumer=void 0,n.consumers=e),e.prevConsumer=r,n.consumersTail=e,!t)for(let i=n.producers;i!==void 0;i=i.nextProducer)KP(i.producer,i)}function MS(n){let e=n.producer,r=n.nextProducer,t=n.nextConsumer,i=n.prevConsumer;if(n.nextConsumer=void 0,n.prevConsumer=void 0,t!==void 0?t.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=t;else if(e.consumers=t,!wu(e)){let o=e.producers;for(;o!==void 0;)o=MS(o)}return r}function wu(n){return n.consumerIsAlwaysLive||n.consumers!==void 0}function _E(n){Jz?.(n)}function e6(n,e){let r=e.producersTail;if(r!==void 0){let t=e.producers;do{if(t===n)return!0;if(t===r)break;t=t.nextProducer}while(t!==void 0)}return!1}function TE(n,e){return Object.is(n,e)}function If(n,e){let r=Object.create(t6);r.computation=n,e!==void 0&&(r.equal=e);let t=()=>{if(EE(r),Cu(r),r.value===Tf)throw r.error;return r.value};return t[An]=r,_E(r),t}var fE=Symbol("UNSET"),gE=Symbol("COMPUTING"),Tf=Symbol("ERRORED"),t6=le(P({},Ac),{value:fE,dirty:!0,error:null,equal:TE,kind:"computed",producerMustRecompute(n){return n.value===fE||n.value===gE},producerRecomputeValue(n){if(n.value===gE)throw new Error("");let e=n.value;n.value=gE;let r=Dc(n),t,i=!1;try{t=n.computation(),Se(null),i=e!==fE&&e!==Tf&&t!==Tf&&n.equal(e,t)}catch(o){t=Tf,n.error=o}finally{Nu(n,r)}if(i){n.value=e;return}n.value=t,n.version++}});function n6(){throw new Error}var YP=n6;function QP(n){YP(n)}function PS(n){YP=n}var r6=null;function xS(n,e){let r=Object.create(IE);r.value=n,e!==void 0&&(r.equal=e);let t=()=>XP(r);return t[An]=r,_E(r),[t,s=>bu(r,s),s=>FS(r,s)]}function XP(n){return Cu(n),n.value}function bu(n,e){LS()||QP(n),n.equal(n.value,e)||(n.value=e,i6(n))}function FS(n,e){LS()||QP(n),bu(n,e(n.value))}var IE=le(P({},Ac),{equal:TE,value:void 0,kind:"signal"});function i6(n){n.version++,WP(),bS(n),r6?.(n)}var Lu={schedule(n){let e=requestAnimationFrame,r=cancelAnimationFrame,{delegate:t}=Lu;t&&(e=t.requestAnimationFrame,r=t.cancelAnimationFrame);let i=e(o=>{r=void 0,n(o)});return new gt(()=>r?.(i))},requestAnimationFrame(...n){let{delegate:e}=Lu;return(e?.requestAnimationFrame||requestAnimationFrame)(...n)},cancelAnimationFrame(...n){let{delegate:e}=Lu;return(e?.cancelAnimationFrame||cancelAnimationFrame)(...n)},delegate:void 0};var o6=1,kS,US={};function JP(n){return n in US?(delete US[n],!0):!1}var ZP={setImmediate(n){let e=o6++;return US[e]=!0,kS||(kS=Promise.resolve()),kS.then(()=>JP(e)&&n()),e},clearImmediate(n){JP(n)}};var{setImmediate:s6,clearImmediate:a6}=ZP,vf={setImmediate(...n){let{delegate:e}=vf;return(e?.setImmediate||s6)(...n)},clearImmediate(n){let{delegate:e}=vf;return(e?.clearImmediate||a6)(n)},delegate:void 0};var vE=class extends oo{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=vf.setImmediate(e.flush.bind(e,void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(vf.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))}};var yE=class extends so{flush(e){this._active=!0;let r=this._scheduled;this._scheduled=void 0;let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var c6=new yE(vE);var SE=class extends oo{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}schedule(e,r=0){return r>0?super.schedule(e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)}execute(e,r){return r>0||this.closed?super.execute(e,r):this._execute(e,r)}requestAsyncId(e,r,t=0){return t!=null&&t>0||t==null&&this.delay>0?super.requestAsyncId(e,r,t):(e.flush(this),0)}};var AE=class extends so{};var VS=new AE(SE);var DE=class extends oo{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=Lu.requestAnimationFrame(()=>e.flush(void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&r===e._scheduled&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(Lu.cancelAnimationFrame(r),e._scheduled=void 0)}};var RE=class extends so{flush(e){this._active=!0;let r;e?r=e.id:(r=this._scheduled,this._scheduled=void 0);let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var l6=new RE(DE);function u6(n){return!!n&&(n instanceof ge||ye(n.lift)&&ye(n.subscribe))}function d6(n,e){let r=typeof e=="object";return new Promise((t,i)=>{let o=new Ai({next:s=>{t(s),o.unsubscribe()},error:i,complete:()=>{r?t(e.defaultValue):i(new GP)}});n.subscribe(o)})}function BS(n){return new ge(e=>{Le(n()).subscribe(e)})}function h6(...n){let e=iE(n),{args:r,keys:t}=oE(n),i=new ge(o=>{let{length:s}=r;if(!s){o.complete();return}let a=new Array(s),c=s,l=s;for(let u=0;u<s;u++){let d=!1;Le(r[u]).subscribe(Ee(o,f=>{d||(d=!0,l--),a[u]=f},()=>c--,void 0,()=>{(!c||!d)&&(l||o.next(t?aE(t,a):a),o.complete())}))}});return e?i.pipe(yu(e)):i}var f6=["addListener","removeListener"],g6=["addEventListener","removeEventListener"],m6=["on","off"];function uo(n,e,r,t){if(ye(r)&&(t=r,r=void 0),t)return uo(n,e,r).pipe(yu(t));let[i,o]=_6(n)?g6.map(s=>a=>n[s](e,a,r)):p6(n)?f6.map(e0(n,e)):E6(n)?m6.map(e0(n,e)):[];if(!i&&Iu(n))return co(s=>uo(s,e,r))(Le(n));if(!i)throw new TypeError("Invalid event target");return new ge(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function e0(n,e){return r=>t=>n[r](e,t)}function p6(n){return ye(n.addListener)&&ye(n.removeListener)}function E6(n){return ye(n.on)&&ye(n.off)}function _6(n){return ye(n.addEventListener)&&ye(n.removeEventListener)}function T6(n,e,r){return BS(()=>n()?e:r)}function Mu(...n){let e=ao(n),r=CP(n,1/0),t=n;return t.length?t.length===1?Le(t[0]):cE(r)(Pr(t,e)):Tc}function t0(n){let e=Se(null);try{return n()}finally{Se(e)}}var n0=le(P({},Ac),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function r0(n){if(n.dirty=!1,n.version>0&&!Ou(n))return;n.version++;let e=Dc(n);try{n.cleanup(),n.fn()}finally{Nu(n,e)}}var Nc=class{full;major;minor;patch;constructor(e){this.full=e;let r=e.split(".");this.major=r[0],this.minor=r[1],this.patch=r.slice(2).join(".")}},JS=new Nc("20.3.18");var wE="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",oe=class extends Error{code;constructor(e,r){super(Qs(e,r)),this.code=e}};function I6(n){return`NG0${Math.abs(n)}`}function Qs(n,e){return`${I6(n)}${e?": "+e:""}`}var tn=globalThis;function Je(n){for(let e in n)if(n[e]===Je)return e;throw Error("")}function s0(n,e){for(let r in e)e.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(n[r]=e[r])}function ns(n){if(typeof n=="string")return n;if(Array.isArray(n))return`[${n.map(ns).join(", ")}]`;if(n==null)return""+n;let e=n.overriddenName||n.name;if(e)return`${e}`;let r=n.toString();if(r==null)return""+r;let t=r.indexOf(`
4
+ `);return t>=0?r.slice(0,t):r}function bE(n,e){return n?e?`${n} ${e}`:n:e||""}var v6=Je({__forward_ref__:Je});function LE(n){return n.__forward_ref__=LE,n.toString=function(){return ns(this())},n}function hn(n){return ZS(n)?n():n}function ZS(n){return typeof n=="function"&&n.hasOwnProperty(v6)&&n.__forward_ref__===LE}function K(n){return{token:n.token,providedIn:n.providedIn||null,factory:n.factory,value:void 0}}function rs(n){return{providers:n.providers||[],imports:n.imports||[]}}function ME(n){return y6(n,PE)}function y6(n,e){return n.hasOwnProperty(e)&&n[e]||null}function S6(n){let e=n?.[PE]??null;return e||null}function $S(n){return n&&n.hasOwnProperty(NE)?n[NE]:null}var PE=Je({\u0275prov:Je}),NE=Je({\u0275inj:Je}),Z=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,r){this._desc=e,this.\u0275prov=void 0,typeof r=="number"?this.__NG_ELEMENT_ID__=r:r!==void 0&&(this.\u0275prov=K({token:this,providedIn:r.providedIn||"root",factory:r.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function eA(n){return n&&!!n.\u0275providers}var tA=Je({\u0275cmp:Je}),nA=Je({\u0275dir:Je}),rA=Je({\u0275pipe:Je}),iA=Je({\u0275mod:Je}),Sf=Je({\u0275fac:Je}),Lc=Je({__NG_ELEMENT_ID__:Je}),i0=Je({__NG_ENV_ID__:Je});function Fr(n){return typeof n=="string"?n:n==null?"":String(n)}function a0(n){return typeof n=="function"?n.name||n.toString():typeof n=="object"&&n!=null&&typeof n.type=="function"?n.type.name||n.type.toString():Fr(n)}var c0=Je({ngErrorCode:Je}),A6=Je({ngErrorMessage:Je}),D6=Je({ngTokenPath:Je});function oA(n,e){return l0("",-200,e)}function xE(n,e){throw new oe(-201,!1)}function l0(n,e,r){let t=new oe(e,n);return t[c0]=e,t[A6]=n,r&&(t[D6]=r),t}function R6(n){return n[c0]}var jS;function u0(){return jS}function ir(n){let e=jS;return jS=n,e}function sA(n,e,r){let t=ME(n);if(t&&t.providedIn=="root")return t.value===void 0?t.value=t.factory():t.value;if(r&8)return null;if(e!==void 0)return e;xE(n,"Injector")}var C6={},Cc=C6,HS="__NG_DI_FLAG__",WS=class{injector;constructor(e){this.injector=e}retrieve(e,r){let t=Oc(r)||0;try{return this.injector.get(e,t&8?null:Cc,t)}catch(i){if(Ru(i))return i;throw i}}};function N6(n,e=0){let r=dE();if(r===void 0)throw new oe(-203,!1);if(r===null)return sA(n,void 0,e);{let t=O6(e),i=r.retrieve(n,t);if(Ru(i)){if(t.optional)return null;throw i}return i}}function w(n,e=0){return(u0()||N6)(hn(n),e)}function ne(n,e){return w(n,Oc(e))}function Oc(n){return typeof n>"u"||typeof n=="number"?n:0|(n.optional&&8)|(n.host&&1)|(n.self&&2)|(n.skipSelf&&4)}function O6(n){return{optional:!!(n&8),host:!!(n&1),self:!!(n&2),skipSelf:!!(n&4)}}function zS(n){let e=[];for(let r=0;r<n.length;r++){let t=hn(n[r]);if(Array.isArray(t)){if(t.length===0)throw new oe(900,!1);let i,o=0;for(let s=0;s<t.length;s++){let a=t[s],c=w6(a);typeof c=="number"?c===-1?i=a.token:o|=c:i=a}e.push(w(i,o))}else e.push(w(t))}return e}function aA(n,e){return n[HS]=e,n.prototype[HS]=e,n}function w6(n){return n[HS]}function Ks(n,e){let r=n.hasOwnProperty(Sf);return r?n[Sf]:null}function d0(n,e,r){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],o=e[t];if(r&&(i=r(i),o=r(o)),o!==i)return!1}return!0}function h0(n){return n.flat(Number.POSITIVE_INFINITY)}function FE(n,e){n.forEach(r=>Array.isArray(r)?FE(r,e):e(r))}function cA(n,e,r){e>=n.length?n.push(r):n.splice(e,0,r)}function Rf(n,e){return e>=n.length-1?n.pop():n.splice(e,1)[0]}function f0(n,e){let r=[];for(let t=0;t<n;t++)r.push(e);return r}function g0(n,e,r,t){let i=n.length;if(i==e)n.push(r,t);else if(i===1)n.push(t,n[0]),n[0]=r;else{for(i--,n.push(n[i-1],n[i]);i>e;){let o=i-2;n[i]=n[o],i--}n[e]=r,n[e+1]=t}}function Cf(n,e,r){let t=xu(n,e);return t>=0?n[t|1]=r:(t=~t,g0(n,t,e,r)),t}function kE(n,e){let r=xu(n,e);if(r>=0)return n[r|1]}function xu(n,e){return b6(n,e,1)}function b6(n,e,r){let t=0,i=n.length>>r;for(;i!==t;){let o=t+(i-t>>1),s=n[o<<r];if(e===s)return o<<r;s>e?i=o:t=o+1}return~(i<<r)}var Ci={},qn=[],Xs=new Z(""),lA=new Z("",-1),uA=new Z(""),Af=class{get(e,r=Cc){if(r===Cc){let i=l0("",-201);throw i.name="\u0275NotFound",i}return r}};function m0(n){return n[iA]||null}function Js(n){return n[tA]||null}function UE(n){return n[nA]||null}function dA(n){return n[rA]||null}function mr(n){return{\u0275providers:n}}function p0(...n){return{\u0275providers:hA(!0,n),\u0275fromNgModule:!0}}function hA(n,...e){let r=[],t=new Set,i,o=s=>{r.push(s)};return FE(e,s=>{let a=s;OE(a,o,[],t)&&(i||=[],i.push(a))}),i!==void 0&&E0(i,o),r}function E0(n,e){for(let r=0;r<n.length;r++){let{ngModule:t,providers:i}=n[r];fA(i,o=>{e(o,t)})}}function OE(n,e,r,t){if(n=hn(n),!n)return!1;let i=null,o=$S(n),s=!o&&Js(n);if(!o&&!s){let c=n.ngModule;if(o=$S(c),o)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=n}let a=t.has(i);if(s){if(a)return!1;if(t.add(i),s.dependencies){let c=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let l of c)OE(l,e,r,t)}}else if(o){if(o.imports!=null&&!a){t.add(i);let l;FE(o.imports,u=>{OE(u,e,r,t)&&(l||=[],l.push(u))}),l!==void 0&&E0(l,e)}if(!a){let l=Ks(i)||(()=>new i);e({provide:i,useFactory:l,deps:qn},i),e({provide:uA,useValue:i,multi:!0},i),e({provide:Xs,useValue:()=>w(i),multi:!0},i)}let c=o.providers;if(c!=null&&!a){let l=n;fA(c,u=>{e(u,l)})}}else return!1;return i!==n&&n.providers!==void 0}function fA(n,e){for(let r of n)eA(r)&&(r=r.\u0275providers),Array.isArray(r)?fA(r,e):e(r)}var L6=Je({provide:String,useValue:Je});function _0(n){return n!==null&&typeof n=="object"&&L6 in n}function M6(n){return!!(n&&n.useExisting)}function P6(n){return!!(n&&n.useFactory)}function wc(n){return typeof n=="function"}function T0(n){return!!n.useClass}var Nf=new Z(""),CE={},o0={},GS;function Fu(){return GS===void 0&&(GS=new Af),GS}var Kn=class{},bc=class extends Kn{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,r,t,i){super(),this.parent=r,this.source=t,this.scopes=i,KS(e,s=>this.processProvider(s)),this.records.set(lA,Pu(void 0,this)),i.has("environment")&&this.records.set(Kn,Pu(void 0,this));let o=this.records.get(Nf);o!=null&&typeof o.value=="string"&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(uA,qn,{self:!0}))}retrieve(e,r){let t=Oc(r)||0;try{return this.get(e,Cc,t)}catch(i){if(Ru(i))return i;throw i}}destroy(){yf(this),this._destroyed=!0;let e=Se(null);try{for(let t of this._ngOnDestroyHooks)t.ngOnDestroy();let r=this._onDestroyHooks;this._onDestroyHooks=[];for(let t of r)t()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Se(e)}}onDestroy(e){return yf(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){yf(this);let r=lo(this),t=ir(void 0),i;try{return e()}finally{lo(r),ir(t)}}get(e,r=Cc,t){if(yf(this),e.hasOwnProperty(i0))return e[i0](this);let i=Oc(t),o,s=lo(this),a=ir(void 0);try{if(!(i&4)){let l=this.records.get(e);if(l===void 0){let u=V6(e)&&ME(e);u&&this.injectableDefInScope(u)?l=Pu(qS(e),CE):l=null,this.records.set(e,l)}if(l!=null)return this.hydrate(e,l,i)}let c=i&2?Fu():this.parent;return r=i&8&&r===Cc?null:r,c.get(e,r)}catch(c){let l=R6(c);throw l===-200||l===-201?new oe(l,null):c}finally{ir(a),lo(s)}}resolveInjectorInitializers(){let e=Se(null),r=lo(this),t=ir(void 0),i;try{let o=this.get(Xs,qn,{self:!0});for(let s of o)s()}finally{lo(r),ir(t),Se(e)}}toString(){let e=[],r=this.records;for(let t of r.keys())e.push(ns(t));return`R3Injector[${e.join(", ")}]`}processProvider(e){e=hn(e);let r=wc(e)?e:hn(e&&e.provide),t=F6(e);if(!wc(e)&&e.multi===!0){let i=this.records.get(r);i||(i=Pu(void 0,CE,!0),i.factory=()=>zS(i.multi),this.records.set(r,i)),r=e,i.multi.push(e)}this.records.set(r,t)}hydrate(e,r,t){let i=Se(null);try{if(r.value===o0)throw oA(ns(e));return r.value===CE&&(r.value=o0,r.value=r.factory(void 0,t)),typeof r.value=="object"&&r.value&&U6(r.value)&&this._ngOnDestroyHooks.add(r.value),r.value}finally{Se(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let r=hn(e.providedIn);return typeof r=="string"?r==="any"||this.scopes.has(r):this.injectorDefTypes.has(r)}removeOnDestroy(e){let r=this._onDestroyHooks.indexOf(e);r!==-1&&this._onDestroyHooks.splice(r,1)}};function qS(n){let e=ME(n),r=e!==null?e.factory:Ks(n);if(r!==null)return r;if(n instanceof Z)throw new oe(204,!1);if(n instanceof Function)return x6(n);throw new oe(204,!1)}function x6(n){if(n.length>0)throw new oe(204,!1);let r=S6(n);return r!==null?()=>r.factory(n):()=>new n}function F6(n){if(_0(n))return Pu(void 0,n.useValue);{let e=gA(n);return Pu(e,CE)}}function gA(n,e,r){let t;if(wc(n)){let i=hn(n);return Ks(i)||qS(i)}else if(_0(n))t=()=>hn(n.useValue);else if(P6(n))t=()=>n.useFactory(...zS(n.deps||[]));else if(M6(n))t=(i,o)=>w(hn(n.useExisting),o!==void 0&&o&8?8:void 0);else{let i=hn(n&&(n.useClass||n.provide));if(k6(n))t=()=>new i(...zS(n.deps));else return Ks(i)||qS(i)}return t}function yf(n){if(n.destroyed)throw new oe(205,!1)}function Pu(n,e,r=!1){return{factory:n,value:e,multi:r?[]:void 0}}function k6(n){return!!n.deps}function U6(n){return n!==null&&typeof n=="object"&&typeof n.ngOnDestroy=="function"}function V6(n){return typeof n=="function"||typeof n=="object"&&n.ngMetadataName==="InjectionToken"}function KS(n,e){for(let r of n)Array.isArray(r)?KS(r,e):r&&eA(r)?KS(r.\u0275providers,e):e(r)}function ho(n,e){let r;n instanceof bc?(yf(n),r=n):r=new WS(n);let t,i=lo(r),o=ir(void 0);try{return e()}finally{lo(i),ir(o)}}function mA(){return u0()!==void 0||dE()!=null}var Ni=0,Te=1,Ae=2,fn=3,ei=4,or=5,Mc=6,ku=7,$t=8,is=9,fo=10,Ze=11,Uu=12,pA=13,Pc=14,Yn=15,Zs=16,xc=17,go=18,Of=19,EA=20,ts=21,VE=22,os=23,kr=24,Fc=25,kc=26,et=27,I0=1,_A=6,ea=7,wf=8,Uc=9,jt=10;function mo(n){return Array.isArray(n)&&typeof n[I0]=="object"}function Oi(n){return Array.isArray(n)&&n[I0]===!0}function TA(n){return(n.flags&4)!==0}function ss(n){return n.componentOffset>-1}function Vu(n){return(n.flags&1)===1}function wi(n){return!!n.template}function Bu(n){return(n[Ae]&512)!==0}function Vc(n){return(n[Ae]&256)===256}var IA="svg",v0="math";function ti(n){for(;Array.isArray(n);)n=n[Ni];return n}function vA(n,e){return ti(e[n])}function ni(n,e){return ti(e[n.index])}function bf(n,e){return n.data[e]}function Bc(n,e){return n[e]}function Lf(n,e,r,t){r>=n.data.length&&(n.data[r]=null,n.blueprint[r]=null),e[r]=t}function ri(n,e){let r=e[n];return mo(r)?r:r[Ni]}function y0(n){return(n[Ae]&4)===4}function BE(n){return(n[Ae]&128)===128}function S0(n){return Oi(n[fn])}function Ur(n,e){return e==null?null:n[e]}function yA(n){n[xc]=0}function GE(n){n[Ae]&1024||(n[Ae]|=1024,BE(n)&&ta(n))}function A0(n,e){for(;n>0;)e=e[Pc],n--;return e}function Gu(n){return!!(n[Ae]&9216||n[kr]?.dirty)}function $E(n){n[fo].changeDetectionScheduler?.notify(8),n[Ae]&64&&(n[Ae]|=1024),Gu(n)&&ta(n)}function ta(n){n[fo].changeDetectionScheduler?.notify(0);let e=Ys(n);for(;e!==null&&!(e[Ae]&8192||(e[Ae]|=8192,!BE(e)));)e=Ys(e)}function SA(n,e){if(Vc(n))throw new oe(911,!1);n[ts]===null&&(n[ts]=[]),n[ts].push(e)}function D0(n,e){if(n[ts]===null)return;let r=n[ts].indexOf(e);r!==-1&&n[ts].splice(r,1)}function Ys(n){let e=n[fn];return Oi(e)?e[fn]:e}function AA(n){return n[ku]??=[]}function DA(n){return n.cleanup??=[]}function R0(n,e,r,t){let i=AA(e);i.push(r),n.firstCreatePass&&DA(n).push(t,i.length-1)}var Oe={lFrame:U0(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var YS=!1;function C0(){return Oe.lFrame.elementDepthCount}function N0(){Oe.lFrame.elementDepthCount++}function RA(){Oe.lFrame.elementDepthCount--}function jE(){return Oe.bindingsEnabled}function CA(){return Oe.skipHydrationRootTNode!==null}function NA(n){return Oe.skipHydrationRootTNode===n}function OA(){Oe.skipHydrationRootTNode=null}function ce(){return Oe.lFrame.lView}function tt(){return Oe.lFrame.tView}function O0(n){return Oe.lFrame.contextLView=n,n[$t]}function w0(n){return Oe.lFrame.contextLView=null,n}function gn(){let n=wA();for(;n!==null&&n.type===64;)n=n.parent;return n}function wA(){return Oe.lFrame.currentTNode}function b0(){let n=Oe.lFrame,e=n.currentTNode;return n.isParent?e:e.parent}function Gc(n,e){let r=Oe.lFrame;r.currentTNode=n,r.isParent=e}function bA(){return Oe.lFrame.isParent}function LA(){Oe.lFrame.isParent=!1}function MA(){return Oe.lFrame.contextLView}function PA(){return YS}function $u(n){let e=YS;return YS=n,e}function sr(){let n=Oe.lFrame,e=n.bindingRootIndex;return e===-1&&(e=n.bindingRootIndex=n.tView.bindingStartIndex),e}function xA(){return Oe.lFrame.bindingIndex}function L0(n){return Oe.lFrame.bindingIndex=n}function po(){return Oe.lFrame.bindingIndex++}function Mf(n){let e=Oe.lFrame,r=e.bindingIndex;return e.bindingIndex=e.bindingIndex+n,r}function M0(){return Oe.lFrame.inI18n}function P0(n,e){let r=Oe.lFrame;r.bindingIndex=r.bindingRootIndex=n,HE(e)}function x0(){return Oe.lFrame.currentDirectiveIndex}function HE(n){Oe.lFrame.currentDirectiveIndex=n}function F0(n){let e=Oe.lFrame.currentDirectiveIndex;return e===-1?null:n[e]}function WE(){return Oe.lFrame.currentQueryIndex}function Pf(n){Oe.lFrame.currentQueryIndex=n}function B6(n){let e=n[Te];return e.type===2?e.declTNode:e.type===1?n[or]:null}function FA(n,e,r){if(r&4){let i=e,o=n;for(;i=i.parent,i===null&&!(r&1);)if(i=B6(o),i===null||(o=o[Pc],i.type&10))break;if(i===null)return!1;e=i,n=o}let t=Oe.lFrame=k0();return t.currentTNode=e,t.lView=n,!0}function zE(n){let e=k0(),r=n[Te];Oe.lFrame=e,e.currentTNode=r.firstChild,e.lView=n,e.tView=r,e.contextLView=n,e.bindingIndex=r.bindingStartIndex,e.inI18n=!1}function k0(){let n=Oe.lFrame,e=n===null?null:n.child;return e===null?U0(n):e}function U0(n){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:n,child:null,inI18n:!1};return n!==null&&(n.child=e),e}function V0(){let n=Oe.lFrame;return Oe.lFrame=n.parent,n.currentTNode=null,n.lView=null,n}var kA=V0;function qE(){let n=V0();n.isParent=!0,n.tView=null,n.selectedIndex=-1,n.contextLView=null,n.elementDepthCount=0,n.currentDirectiveIndex=-1,n.currentNamespace=null,n.bindingRootIndex=-1,n.bindingIndex=-1,n.currentQueryIndex=0}function B0(n){return(Oe.lFrame.contextLView=A0(n,Oe.lFrame.contextLView))[$t]}function ii(){return Oe.lFrame.selectedIndex}function na(n){Oe.lFrame.selectedIndex=n}function ju(){let n=Oe.lFrame;return bf(n.tView,n.selectedIndex)}function G0(){Oe.lFrame.currentNamespace=IA}function $0(){G6()}function G6(){Oe.lFrame.currentNamespace=null}function j0(){return Oe.lFrame.currentNamespace}var H0=!0;function KE(){return H0}function xf(n){H0=n}function QS(n,e=null,r=null,t){let i=UA(n,e,r,t);return i.resolveInjectorInitializers(),i}function UA(n,e=null,r=null,t,i=new Set){let o=[r||qn,p0(n)];return t=t||(typeof n=="object"?void 0:ns(n)),new bc(o,e||Fu(),t||null,i)}var St=class n{static THROW_IF_NOT_FOUND=Cc;static NULL=new Af;static create(e,r){if(Array.isArray(e))return QS({name:""},r,e,"");{let t=e.name??"";return QS({name:t},e.parent,e.providers,t)}}static \u0275prov=K({token:n,providedIn:"any",factory:()=>w(lA)});static __NG_ELEMENT_ID__=-1},Dn=new Z(""),ar=(()=>{class n{static __NG_ELEMENT_ID__=$6;static __NG_ENV_ID__=r=>r}return n})(),Df=class extends ar{_lView;constructor(e){super(),this._lView=e}get destroyed(){return Vc(this._lView)}onDestroy(e){let r=this._lView;return SA(r,e),()=>D0(r,e)}};function $6(){return new Df(ce())}var xr=class{_console=console;handleError(e){this._console.error("ERROR",e)}},Eo=new Z("",{providedIn:"root",factory:()=>{let n=ne(Kn),e;return r=>{n.destroyed&&!e?setTimeout(()=>{throw r}):(e??=n.get(xr),e.handleError(r))}}}),W0={provide:Xs,useValue:()=>{ne(xr)},multi:!0};function _o(n){return typeof n=="function"&&n[An]!==void 0}function $c(n,e){let[r,t,i]=xS(n,e?.equal),o=r,s=o[An];return o.set=t,o.update=i,o.asReadonly=VA.bind(o),o}function VA(){let n=this[An];if(n.readonlyFn===void 0){let e=()=>this();e[An]=n,n.readonlyFn=e}return n.readonlyFn}function BA(n){return _o(n)&&typeof n.set=="function"}var Hu=(()=>{class n{view;node;constructor(r,t){this.view=r,this.node=t}static __NG_ELEMENT_ID__=j6}return n})();function j6(){return new Hu(ce(),gn())}var Zr=class{},Wu=new Z("",{providedIn:"root",factory:()=>!1});var GA=new Z(""),YE=new Z(""),ra=(()=>{class n{taskId=0;pendingTasks=new Set;destroyed=!1;pendingTask=new Y(!1);get hasPendingTasks(){return this.destroyed?!1:this.pendingTask.value}get hasPendingTasksObservable(){return this.destroyed?new ge(r=>{r.next(!1),r.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let r=this.taskId++;return this.pendingTasks.add(r),r}has(r){return this.pendingTasks.has(r)}remove(r){this.pendingTasks.delete(r),this.pendingTasks.size===0&&this.hasPendingTasks&&this.pendingTask.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this.hasPendingTasks&&this.pendingTask.next(!1),this.destroyed=!0,this.pendingTask.unsubscribe()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),To=(()=>{class n{internalPendingTasks=ne(ra);scheduler=ne(Zr);errorHandler=ne(Eo);add(){let r=this.internalPendingTasks.add();return()=>{this.internalPendingTasks.has(r)&&(this.scheduler.notify(11),this.internalPendingTasks.remove(r))}}run(r){let t=this.add();r().catch(this.errorHandler).finally(t)}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})();function jc(...n){}var Ff=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:()=>new XS})}return n})(),XS=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let r=e.zone,t=this.queues.get(r);t.has(e)&&(t.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let r=e.zone;this.queues.has(r)||this.queues.set(r,new Set);let t=this.queues.get(r);t.has(e)||t.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[r,t]of this.queues)r===null?e||=this.flushQueue(t):e||=r.run(()=>this.flushQueue(t));e||(this.dirtyEffectCount=0)}}flushQueue(e){let r=!1;for(let t of e)t.dirty&&(this.dirtyEffectCount--,r=!0,t.run());return r}};function od(n){return{toString:n}.toString()}var QE="__parameters__";function Q6(n){return function(...r){if(n){let t=n(...r);for(let i in t)this[i]=t[i]}}}function Nx(n,e,r){return od(()=>{let t=Q6(e);function i(...o){if(this instanceof i)return t.apply(this,o),this;let s=new i(...o);return a.annotation=s,a;function a(c,l,u){let d=c.hasOwnProperty(QE)?c[QE]:Object.defineProperty(c,QE,{value:[]})[QE];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),c}}return i.prototype.ngMetadataName=n,i.annotationCls=i,i})}var X6=aA(Nx("Inject",n=>({token:n})),-1),pn=aA(Nx("Optional"),8);function Ox(n){let e=tn.ng;if(e&&e.\u0275compilerFacade)return e.\u0275compilerFacade;throw new Error("JIT compiler unavailable")}function J6(n){return typeof n=="function"}var c_=class{previousValue;currentValue;firstChange;constructor(e,r,t){this.previousValue=e,this.currentValue=r,this.firstChange=t}isFirstChange(){return this.firstChange}};function wx(n,e,r,t){e!==null?e.applyValueToInputSignal(e,t):n[r]=t}var UD=(()=>{let n=()=>bx;return n.ngInherit=!0,n})();function bx(n){return n.type.prototype.ngOnChanges&&(n.setInput=e4),Z6}function Z6(){let n=Mx(this),e=n?.current;if(e){let r=n.previous;if(r===Ci)n.previous=e;else for(let t in e)r[t]=e[t];n.current=null,this.ngOnChanges(e)}}function e4(n,e,r,t,i){let o=this.declaredInputs[t],s=Mx(n)||t4(n,{previous:Ci,current:null}),a=s.current||(s.current={}),c=s.previous,l=c[o];a[o]=new c_(l&&l.currentValue,r,c===Ci),wx(n,e,i,r)}var Lx="__ngSimpleChanges__";function Mx(n){return n[Lx]||null}function t4(n,e){return n[Lx]=e}var z0=[];var lt=function(n,e=null,r){for(let t=0;t<z0.length;t++){let i=z0[t];i(n,e,r)}};function n4(n,e,r){let{ngOnChanges:t,ngOnInit:i,ngDoCheck:o}=e.type.prototype;if(t){let s=bx(e);(r.preOrderHooks??=[]).push(n,s),(r.preOrderCheckHooks??=[]).push(n,s)}i&&(r.preOrderHooks??=[]).push(0-n,i),o&&((r.preOrderHooks??=[]).push(n,o),(r.preOrderCheckHooks??=[]).push(n,o))}function Px(n,e){for(let r=e.directiveStart,t=e.directiveEnd;r<t;r++){let o=n.data[r].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:l,ngOnDestroy:u}=o;s&&(n.contentHooks??=[]).push(-r,s),a&&((n.contentHooks??=[]).push(r,a),(n.contentCheckHooks??=[]).push(r,a)),c&&(n.viewHooks??=[]).push(-r,c),l&&((n.viewHooks??=[]).push(r,l),(n.viewCheckHooks??=[]).push(r,l)),u!=null&&(n.destroyHooks??=[]).push(r,u)}}function r_(n,e,r){xx(n,e,3,r)}function i_(n,e,r,t){(n[Ae]&3)===r&&xx(n,e,r,t)}function $A(n,e){let r=n[Ae];(r&3)===e&&(r&=16383,r+=1,n[Ae]=r)}function xx(n,e,r,t){let i=t!==void 0?n[xc]&65535:0,o=t??-1,s=e.length-1,a=0;for(let c=i;c<s;c++)if(typeof e[c+1]=="number"){if(a=e[c],t!=null&&a>=t)break}else e[c]<0&&(n[xc]+=65536),(a<o||o==-1)&&(r4(n,r,e,c),n[xc]=(n[xc]&4294901760)+c+2),c++}function q0(n,e){lt(4,n,e);let r=Se(null);try{e.call(n)}finally{Se(r),lt(5,n,e)}}function r4(n,e,r,t){let i=r[t]<0,o=r[t+1],s=i?-r[t]:r[t],a=n[s];i?n[Ae]>>14<n[xc]>>16&&(n[Ae]&3)===e&&(n[Ae]+=16384,q0(a,o)):q0(a,o)}var qu=-1,Wc=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,r,t,i){this.factory=e,this.name=i,this.canSeeViewProviders=r,this.injectImpl=t}};function i4(n){return(n.flags&8)!==0}function o4(n){return(n.flags&16)!==0}function s4(n,e,r){let t=0;for(;t<r.length;){let i=r[t];if(typeof i=="number"){if(i!==0)break;t++;let o=r[t++],s=r[t++],a=r[t++];n.setAttribute(e,s,a,o)}else{let o=i,s=r[++t];c4(o)?n.setProperty(e,o,s):n.setAttribute(e,o,s),t++}}return t}function a4(n){return n===3||n===4||n===6}function c4(n){return n.charCodeAt(0)===64}function Ku(n,e){if(!(e===null||e.length===0))if(n===null||n.length===0)n=e.slice();else{let r=-1;for(let t=0;t<e.length;t++){let i=e[t];typeof i=="number"?r=i:r===0||(r===-1||r===2?K0(n,r,i,null,e[++t]):K0(n,r,i,null,null))}}return n}function K0(n,e,r,t,i){let o=0,s=n.length;if(e===-1)s=-1;else for(;o<n.length;){let a=n[o++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=o-1;break}}}for(;o<n.length;){let a=n[o];if(typeof a=="number")break;if(a===r){i!==null&&(n[o+1]=i);return}o++,i!==null&&o++}s!==-1&&(n.splice(s,0,e),o=s+1),n.splice(o++,0,r),i!==null&&n.splice(o++,0,i)}function Fx(n){return n!==qu}function l_(n){return n&32767}function l4(n){return n>>16}function u_(n,e){let r=l4(n),t=e;for(;r>0;)t=t[Pc],r--;return t}var ZA=!0;function d_(n){let e=ZA;return ZA=n,e}var u4=256,kx=u4-1,Ux=5,d4=0,Io={};function h4(n,e,r){let t;typeof r=="string"?t=r.charCodeAt(0)||0:r.hasOwnProperty(Lc)&&(t=r[Lc]),t==null&&(t=r[Lc]=d4++);let i=t&kx,o=1<<i;e.data[n+(i>>Ux)]|=o}function h_(n,e){let r=Vx(n,e);if(r!==-1)return r;let t=e[Te];t.firstCreatePass&&(n.injectorIndex=e.length,jA(t.data,n),jA(e,null),jA(t.blueprint,null));let i=VD(n,e),o=n.injectorIndex;if(Fx(i)){let s=l_(i),a=u_(i,e),c=a[Te].data;for(let l=0;l<8;l++)e[o+l]=a[s+l]|c[s+l]}return e[o+8]=i,o}function jA(n,e){n.push(0,0,0,0,0,0,0,0,e)}function Vx(n,e){return n.injectorIndex===-1||n.parent&&n.parent.injectorIndex===n.injectorIndex||e[n.injectorIndex+8]===null?-1:n.injectorIndex}function VD(n,e){if(n.parent&&n.parent.injectorIndex!==-1)return n.parent.injectorIndex;let r=0,t=null,i=e;for(;i!==null;){if(t=Hx(i),t===null)return qu;if(r++,i=i[Pc],t.injectorIndex!==-1)return t.injectorIndex|r<<16}return qu}function eD(n,e,r){h4(n,e,r)}function Bx(n,e,r){if(r&8||n!==void 0)return n;xE(e,"NodeInjector")}function Gx(n,e,r,t){if(r&8&&t===void 0&&(t=null),(r&3)===0){let i=n[is],o=ir(void 0);try{return i?i.get(e,t,r&8):sA(e,t,r&8)}finally{ir(o)}}return Bx(t,e,r)}function $x(n,e,r,t=0,i){if(n!==null){if(e[Ae]&2048&&!(t&2)){let s=E4(n,e,r,t,Io);if(s!==Io)return s}let o=jx(n,e,r,t,Io);if(o!==Io)return o}return Gx(e,r,t,i)}function jx(n,e,r,t,i){let o=g4(r);if(typeof o=="function"){if(!FA(e,n,t))return t&1?Bx(i,r,t):Gx(e,r,t,i);try{let s;if(s=o(t),s==null&&!(t&8))xE(r);else return s}finally{kA()}}else if(typeof o=="number"){let s=null,a=Vx(n,e),c=qu,l=t&1?e[Yn][or]:null;for((a===-1||t&4)&&(c=a===-1?VD(n,e):e[a+8],c===qu||!Q0(t,!1)?a=-1:(s=e[Te],a=l_(c),e=u_(c,e)));a!==-1;){let u=e[Te];if(Y0(o,a,u.data)){let d=f4(a,e,r,s,t,l);if(d!==Io)return d}c=e[a+8],c!==qu&&Q0(t,e[Te].data[a+8]===l)&&Y0(o,a,e)?(s=u,a=l_(c),e=u_(c,e)):a=-1}}return i}function f4(n,e,r,t,i,o){let s=e[Te],a=s.data[n+8],c=t==null?ss(a)&&ZA:t!=s&&(a.type&3)!==0,l=i&1&&o===a,u=o_(a,s,r,c,l);return u!==null?Vf(e,s,u,a,i):Io}function o_(n,e,r,t,i){let o=n.providerIndexes,s=e.data,a=o&1048575,c=n.directiveStart,l=n.directiveEnd,u=o>>20,d=t?a:a+u,f=i?a+u:l;for(let g=d;g<f;g++){let p=s[g];if(g<c&&r===p||g>=c&&p.type===r)return g}if(i){let g=s[c];if(g&&wi(g)&&g.type===r)return c}return null}function Vf(n,e,r,t,i){let o=n[r],s=e.data;if(o instanceof Wc){let a=o;if(a.resolving){let g=a0(s[r]);throw oA(g)}let c=d_(a.canSeeViewProviders);a.resolving=!0;let l=s[r].type||s[r],u,d=a.injectImpl?ir(a.injectImpl):null,f=FA(n,t,0);try{o=n[r]=a.factory(void 0,i,s,n,t),e.firstCreatePass&&r>=t.directiveStart&&n4(r,s[r],e)}finally{d!==null&&ir(d),d_(c),a.resolving=!1,kA()}}return o}function g4(n){if(typeof n=="string")return n.charCodeAt(0)||0;let e=n.hasOwnProperty(Lc)?n[Lc]:void 0;return typeof e=="number"?e>=0?e&kx:m4:e}function Y0(n,e,r){let t=1<<n;return!!(r[e+(n>>Ux)]&t)}function Q0(n,e){return!(n&2)&&!(n&1&&e)}var Hc=class{_tNode;_lView;constructor(e,r){this._tNode=e,this._lView=r}get(e,r,t){return $x(this._tNode,this._lView,e,Oc(t),r)}};function m4(){return new Hc(gn(),ce())}function p4(n){return od(()=>{let e=n.prototype.constructor,r=e[Sf]||tD(e),t=Object.prototype,i=Object.getPrototypeOf(n.prototype).constructor;for(;i&&i!==t;){let o=i[Sf]||tD(i);if(o&&o!==r)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function tD(n){return ZS(n)?()=>{let e=tD(hn(n));return e&&e()}:Ks(n)}function E4(n,e,r,t,i){let o=n,s=e;for(;o!==null&&s!==null&&s[Ae]&2048&&!Bu(s);){let a=jx(o,s,r,t|2,Io);if(a!==Io)return a;let c=o.parent;if(!c){let l=s[EA];if(l){let u=l.get(r,Io,t);if(u!==Io)return u}c=Hx(s),s=s[Pc]}o=c}return i}function Hx(n){let e=n[Te],r=e.type;return r===2?e.declTNode:r===1?n[or]:null}function _4(){return sd(gn(),ce())}function sd(n,e){return new oa(ni(n,e))}var oa=(()=>{class n{nativeElement;constructor(r){this.nativeElement=r}static __NG_ELEMENT_ID__=_4}return n})();function Wx(n){return n instanceof oa?n.nativeElement:n}function T4(){return this._results[Symbol.iterator]()}var f_=class{_emitDistinctChangesOnly;dirty=!0;_onDirty=void 0;_results=[];_changesDetected=!1;_changes=void 0;length=0;first=void 0;last=void 0;get changes(){return this._changes??=new Ot}constructor(e=!1){this._emitDistinctChangesOnly=e}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,r){return this._results.reduce(e,r)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,r){this.dirty=!1;let t=h0(e);(this._changesDetected=!d0(this._results,t,r))&&(this._results=t,this.length=t.length,this.last=t[this.length-1],this.first=t[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){this.dirty=!0,this._onDirty?.()}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}[Symbol.iterator]=T4};function zx(n){return(n.flags&128)===128}var BD=(function(n){return n[n.OnPush=0]="OnPush",n[n.Default=1]="Default",n})(BD||{}),qx=new Map,I4=0;function v4(){return I4++}function y4(n){qx.set(n[Of],n)}function nD(n){qx.delete(n[Of])}var X0="__ngContext__";function Yu(n,e){mo(e)?(n[X0]=e[Of],y4(e)):n[X0]=e}function Kx(n){return Qx(n[Uu])}function Yx(n){return Qx(n[ei])}function Qx(n){for(;n!==null&&!Oi(n);)n=n[ei];return n}var rD;function GD(n){rD=n}function $D(){if(rD!==void 0)return rD;if(typeof document<"u")return document;throw new oe(210,!1)}var O_=new Z("",{providedIn:"root",factory:()=>S4}),S4="ng",w_=new Z(""),ds=new Z("",{providedIn:"platform",factory:()=>"unknown"});var A4=new Z(""),ad=new Z("",{providedIn:"root",factory:()=>$D().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var D4="h",R4="b";var Xx="r";var Jx="di";var Zx=!1,eF=new Z("",{providedIn:"root",factory:()=>Zx});var C4=(n,e,r,t)=>{};function N4(n,e,r,t){C4(n,e,r,t)}function b_(n){return(n.flags&32)===32}var O4=()=>null;function tF(n,e,r=!1){return O4(n,e,r)}function nF(n,e){let r=n.contentQueries;if(r!==null){let t=Se(null);try{for(let i=0;i<r.length;i+=2){let o=r[i],s=r[i+1];if(s!==-1){let a=n.data[s];Pf(o),a.contentQueries(2,e[s],s)}}}finally{Se(t)}}}function iD(n,e,r){Pf(0);let t=Se(null);try{e(n,r)}finally{Se(t)}}function jD(n,e,r){if(TA(e)){let t=Se(null);try{let i=e.directiveStart,o=e.directiveEnd;for(let s=i;s<o;s++){let a=n.data[s];if(a.contentQueries){let c=r[s];a.contentQueries(1,c,s)}}}finally{Se(t)}}}var cs=(function(n){return n[n.Emulated=0]="Emulated",n[n.None=2]="None",n[n.ShadowDom=3]="ShadowDom",n})(cs||{});var XE;function w4(){if(XE===void 0&&(XE=null,tn.trustedTypes))try{XE=tn.trustedTypes.createPolicy("angular",{createHTML:n=>n,createScript:n=>n,createScriptURL:n=>n})}catch{}return XE}function L_(n){return w4()?.createHTML(n)||n}var JE;function b4(){if(JE===void 0&&(JE=null,tn.trustedTypes))try{JE=tn.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:n=>n,createScript:n=>n,createScriptURL:n=>n})}catch{}return JE}function J0(n){return b4()?.createHTML(n)||n}var ls=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${wE})`}},oD=class extends ls{getTypeName(){return"HTML"}},sD=class extends ls{getTypeName(){return"Style"}},aD=class extends ls{getTypeName(){return"Script"}},cD=class extends ls{getTypeName(){return"URL"}},lD=class extends ls{getTypeName(){return"ResourceURL"}};function Vr(n){return n instanceof ls?n.changingThisBreaksApplicationSecurity:n}function yo(n,e){let r=rF(n);if(r!=null&&r!==e){if(r==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${r} (see ${wE})`)}return r===e}function rF(n){return n instanceof ls&&n.getTypeName()||null}function HD(n){return new oD(n)}function WD(n){return new sD(n)}function zD(n){return new aD(n)}function qD(n){return new cD(n)}function KD(n){return new lD(n)}function L4(n){let e=new dD(n);return M4()?new uD(e):e}var uD=class{inertDocumentHelper;constructor(e){this.inertDocumentHelper=e}getInertBodyElement(e){e="<body><remove></remove>"+e;try{let r=new window.DOMParser().parseFromString(L_(e),"text/html").body;return r===null?this.inertDocumentHelper.getInertBodyElement(e):(r.firstChild?.remove(),r)}catch{return null}}},dD=class{defaultDoc;inertDocument;constructor(e){this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let r=this.inertDocument.createElement("template");return r.innerHTML=L_(e),r}};function M4(){try{return!!new window.DOMParser().parseFromString(L_(""),"text/html")}catch{return!1}}var P4=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function jf(n){return n=String(n),n.match(P4)?n:"unsafe:"+n}function hs(n){let e={};for(let r of n.split(","))e[r]=!0;return e}function Hf(...n){let e={};for(let r of n)for(let t in r)r.hasOwnProperty(t)&&(e[t]=!0);return e}var iF=hs("area,br,col,hr,img,wbr"),oF=hs("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),sF=hs("rp,rt"),x4=Hf(sF,oF),F4=Hf(oF,hs("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")),k4=Hf(sF,hs("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")),Z0=Hf(iF,F4,k4,x4),aF=hs("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),U4=hs("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"),V4=hs("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"),B4=Hf(aF,U4,V4),G4=hs("script,style,template");var hD=class{sanitizedSomething=!1;buf=[];sanitizeChildren(e){let r=e.firstChild,t=!0,i=[];for(;r;){if(r.nodeType===Node.ELEMENT_NODE?t=this.startElement(r):r.nodeType===Node.TEXT_NODE?this.chars(r.nodeValue):this.sanitizedSomething=!0,t&&r.firstChild){i.push(r),r=H4(r);continue}for(;r;){r.nodeType===Node.ELEMENT_NODE&&this.endElement(r);let o=j4(r);if(o){r=o;break}r=i.pop()}}return this.buf.join("")}startElement(e){let r=ex(e).toLowerCase();if(!Z0.hasOwnProperty(r))return this.sanitizedSomething=!0,!G4.hasOwnProperty(r);this.buf.push("<"),this.buf.push(r);let t=e.attributes;for(let i=0;i<t.length;i++){let o=t.item(i),s=o.name,a=s.toLowerCase();if(!B4.hasOwnProperty(a)){this.sanitizedSomething=!0;continue}let c=o.value;aF[a]&&(c=jf(c)),this.buf.push(" ",s,'="',tx(c),'"')}return this.buf.push(">"),!0}endElement(e){let r=ex(e).toLowerCase();Z0.hasOwnProperty(r)&&!iF.hasOwnProperty(r)&&(this.buf.push("</"),this.buf.push(r),this.buf.push(">"))}chars(e){this.buf.push(tx(e))}};function $4(n,e){return(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function j4(n){let e=n.nextSibling;if(e&&n!==e.previousSibling)throw cF(e);return e}function H4(n){let e=n.firstChild;if(e&&$4(n,e))throw cF(e);return e}function ex(n){let e=n.nodeName;return typeof e=="string"?e:"FORM"}function cF(n){return new Error(`Failed to sanitize html because the element is clobbered: ${n.outerHTML}`)}var W4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,z4=/([^\#-~ |!])/g;function tx(n){return n.replace(/&/g,"&amp;").replace(W4,function(e){let r=e.charCodeAt(0),t=e.charCodeAt(1);return"&#"+((r-55296)*1024+(t-56320)+65536)+";"}).replace(z4,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ZE;function M_(n,e){let r=null;try{ZE=ZE||L4(n);let t=e?String(e):"";r=ZE.getInertBodyElement(t);let i=5,o=t;do{if(i===0)throw new Error("Failed to sanitize html because the input is unstable");i--,t=o,o=r.innerHTML,r=ZE.getInertBodyElement(t)}while(t!==o);let a=new hD().sanitizeChildren(nx(r)||r);return L_(a)}finally{if(r){let t=nx(r)||r;for(;t.firstChild;)t.firstChild.remove()}}}function nx(n){return"content"in n&&q4(n)?n.content:null}function q4(n){return n.nodeType===Node.ELEMENT_NODE&&n.nodeName==="TEMPLATE"}var K4=/^>|^->|<!--|-->|--!>|<!-$/g,Y4=/(<|>)/g,Q4="\u200B$1\u200B";function X4(n){return n.replace(K4,e=>e.replace(Y4,Q4))}function J4(n,e){return n.createText(e)}function Z4(n,e,r){n.setValue(e,r)}function eq(n,e){return n.createComment(X4(e))}function lF(n,e,r){return n.createElement(e,r)}function g_(n,e,r,t,i){n.insertBefore(e,r,t,i)}function uF(n,e,r){n.appendChild(e,r)}function rx(n,e,r,t,i){t!==null?g_(n,e,r,t,i):uF(n,e,r)}function dF(n,e,r,t){n.removeChild(null,e,r,t)}function tq(n,e,r){n.setAttribute(e,"style",r)}function nq(n,e,r){r===""?n.removeAttribute(e,"class"):n.setAttribute(e,"class",r)}function hF(n,e,r){let{mergedAttrs:t,classes:i,styles:o}=r;t!==null&&s4(n,e,t),i!==null&&nq(n,e,i),o!==null&&tq(n,e,o)}var oi=(function(n){return n[n.NONE=0]="NONE",n[n.HTML=1]="HTML",n[n.STYLE=2]="STYLE",n[n.SCRIPT=3]="SCRIPT",n[n.URL=4]="URL",n[n.RESOURCE_URL=5]="RESOURCE_URL",n})(oi||{});function rq(n){let e=YD();return e?J0(e.sanitize(oi.HTML,n)||""):yo(n,"HTML")?J0(Vr(n)):M_($D(),Fr(n))}function iq(n){let e=YD();return e?e.sanitize(oi.STYLE,n)||"":yo(n,"Style")?Vr(n):Fr(n)}function oq(n){let e=YD();return e?e.sanitize(oi.URL,n)||"":yo(n,"URL")?Vr(n):jf(Fr(n))}function YD(){let n=ce();return n&&n[fo].sanitizer}function sq(n){return n.ownerDocument.defaultView}function aq(n){return n.ownerDocument}function cq(n){return n instanceof Function?n():n}function lq(n,e,r){let t=n.length;for(;;){let i=n.indexOf(e,r);if(i===-1)return i;if(i===0||n.charCodeAt(i-1)<=32){let o=e.length;if(i+o===t||n.charCodeAt(i+o)<=32)return i}r=i+1}}var fF="ng-template";function uq(n,e,r,t){let i=0;if(t){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&lq(e[i+1].toLowerCase(),r,0)!==-1)return!0}else if(QD(n))return!1;if(i=e.indexOf(1,i),i>-1){let o;for(;++i<e.length&&typeof(o=e[i])=="string";)if(o.toLowerCase()===r)return!0}return!1}function QD(n){return n.type===4&&n.value!==fF}function dq(n,e,r){let t=n.type===4&&!r?fF:n.value;return e===t}function hq(n,e,r){let t=4,i=n.attrs,o=i!==null?mq(i):0,s=!1;for(let a=0;a<e.length;a++){let c=e[a];if(typeof c=="number"){if(!s&&!bi(t)&&!bi(c))return!1;if(s&&bi(c))continue;s=!1,t=c|t&1;continue}if(!s)if(t&4){if(t=2|t&1,c!==""&&!dq(n,c,r)||c===""&&e.length===1){if(bi(t))return!1;s=!0}}else if(t&8){if(i===null||!uq(n,i,c,r)){if(bi(t))return!1;s=!0}}else{let l=e[++a],u=fq(c,i,QD(n),r);if(u===-1){if(bi(t))return!1;s=!0;continue}if(l!==""){let d;if(u>o?d="":d=i[u+1].toLowerCase(),t&2&&l!==d){if(bi(t))return!1;s=!0}}}}return bi(t)||s}function bi(n){return(n&1)===0}function fq(n,e,r,t){if(e===null)return-1;let i=0;if(t||!r){let o=!1;for(;i<e.length;){let s=e[i];if(s===n)return i;if(s===3||s===6)o=!0;else if(s===1||s===2){let a=e[++i];for(;typeof a=="string";)a=e[++i];continue}else{if(s===4)break;if(s===0){i+=4;continue}}i+=o?1:2}return-1}else return pq(e,n)}function gF(n,e,r=!1){for(let t=0;t<e.length;t++)if(hq(n,e[t],r))return!0;return!1}function gq(n){let e=n.attrs;if(e!=null){let r=e.indexOf(5);if((r&1)===0)return e[r+1]}return null}function mq(n){for(let e=0;e<n.length;e++){let r=n[e];if(a4(r))return e}return n.length}function pq(n,e){let r=n.indexOf(4);if(r>-1)for(r++;r<n.length;){let t=n[r];if(typeof t=="number")return-1;if(t===e)return r;r++}return-1}function Eq(n,e){e:for(let r=0;r<e.length;r++){let t=e[r];if(n.length===t.length){for(let i=0;i<n.length;i++)if(n[i]!==t[i])continue e;return!0}}return!1}function ix(n,e){return n?":not("+e.trim()+")":e}function _q(n){let e=n[0],r=1,t=2,i="",o=!1;for(;r<n.length;){let s=n[r];if(typeof s=="string")if(t&2){let a=n[++r];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else t&8?i+="."+s:t&4&&(i+=" "+s);else i!==""&&!bi(s)&&(e+=ix(o,i),i=""),t=s,o=o||!bi(t);r++}return i!==""&&(e+=ix(o,i)),e}function Tq(n){return n.map(_q).join(",")}function Iq(n){let e=[],r=[],t=1,i=2;for(;t<n.length;){let o=n[t];if(typeof o=="string")i===2?o!==""&&e.push(o,n[++t]):i===8&&r.push(o);else{if(!bi(i))break;i=o}t++}return r.length&&e.push(1,...r),e}var Rn={};function XD(n,e,r,t,i,o,s,a,c,l,u){let d=et+t,f=d+i,g=vq(d,f),p=typeof l=="function"?l():l;return g[Te]={type:n,blueprint:g,template:r,queries:null,viewQuery:a,declTNode:e,data:g.slice().fill(null,d),bindingStartIndex:d,expandoStartIndex:f,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:typeof o=="function"?o():o,pipeRegistry:typeof s=="function"?s():s,firstChild:null,schemas:c,consts:p,incompleteFirstPass:!1,ssrId:u}}function vq(n,e){let r=[];for(let t=0;t<e;t++)r.push(t<n?null:Rn);return r}function yq(n){let e=n.tView;return e===null||e.incompleteFirstPass?n.tView=XD(1,null,n.template,n.decls,n.vars,n.directiveDefs,n.pipeDefs,n.viewQuery,n.schemas,n.consts,n.id):e}function JD(n,e,r,t,i,o,s,a,c,l,u){let d=e.blueprint.slice();return d[Ni]=i,d[Ae]=t|4|128|8|64|1024,(l!==null||n&&n[Ae]&2048)&&(d[Ae]|=2048),yA(d),d[fn]=d[Pc]=n,d[$t]=r,d[fo]=s||n&&n[fo],d[Ze]=a||n&&n[Ze],d[is]=c||n&&n[is]||null,d[or]=o,d[Of]=v4(),d[Mc]=u,d[EA]=l,d[Yn]=e.type==2?n[Yn]:d,d}function Sq(n,e,r){let t=ni(e,n),i=yq(r),o=n[fo].rendererFactory,s=ZD(n,JD(n,i,null,mF(r),t,e,null,o.createRenderer(t,r),null,null,null));return n[e.index]=s}function mF(n){let e=16;return n.signals?e=4096:n.onPush&&(e=64),e}function pF(n,e,r,t){if(r===0)return-1;let i=e.length;for(let o=0;o<r;o++)e.push(t),n.blueprint.push(t),n.data.push(null);return i}function ZD(n,e){return n[Uu]?n[pA][ei]=e:n[Uu]=e,n[pA]=e,e}function Aq(n=1){EF(tt(),ce(),ii()+n,!1)}function EF(n,e,r,t){if(!t)if((e[Ae]&3)===3){let o=n.preOrderCheckHooks;o!==null&&r_(e,o,r)}else{let o=n.preOrderHooks;o!==null&&i_(e,o,0,r)}na(r)}var P_=(function(n){return n[n.None=0]="None",n[n.SignalBased=1]="SignalBased",n[n.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",n})(P_||{});function fD(n,e,r,t){let i=Se(null);try{let[o,s,a]=n.inputs[r],c=null;(s&P_.SignalBased)!==0&&(c=e[o][An]),c!==null&&c.transformFn!==void 0?t=c.transformFn(t):a!==null&&(t=a.call(e,t)),n.setInput!==null?n.setInput(e,c,t,r,o):wx(e,c,o,t)}finally{Se(i)}}var Li=(function(n){return n[n.Important=1]="Important",n[n.DashCase=2]="DashCase",n})(Li||{}),Dq;function eR(n,e){return Dq(n,e)}var zc=new Set,x_=(function(n){return n[n.CHANGE_DETECTION=0]="CHANGE_DETECTION",n[n.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",n})(x_||{}),Yc=new Z(""),ox=new Set;function fs(n){ox.has(n)||(ox.add(n),performance?.mark?.("mark_feature_usage",{detail:{feature:n}}))}var _F=!1,gD=class extends Ot{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,mA()&&(this.destroyRef=ne(ar,{optional:!0})??void 0,this.pendingTasks=ne(ra,{optional:!0})??void 0)}emit(e){let r=Se(null);try{super.next(e)}finally{Se(r)}}subscribe(e,r,t){let i=e,o=r||(()=>null),s=t;if(e&&typeof e=="object"){let c=e;i=c.next?.bind(c),o=c.error?.bind(c),s=c.complete?.bind(c)}this.__isAsync&&(o=this.wrapInTimeout(o),i&&(i=this.wrapInTimeout(i)),s&&(s=this.wrapInTimeout(s)));let a=super.subscribe({next:i,error:o,complete:s});return e instanceof gt&&e.add(a),a}wrapInTimeout(e){return r=>{let t=this.pendingTasks?.add();setTimeout(()=>{try{e(r)}finally{t!==void 0&&this.pendingTasks?.remove(t)}})}}},as=gD;function TF(n){let e,r;function t(){n=jc;try{r!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(r),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{n(),t()}),typeof requestAnimationFrame=="function"&&(r=requestAnimationFrame(()=>{n(),t()})),()=>t()}function sx(n){return queueMicrotask(()=>n()),()=>{n=jc}}var tR="isAngularZone",m_=tR+"_ID",Rq=0,be=class n{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new as(!1);onMicrotaskEmpty=new as(!1);onStable=new as(!1);onError=new as(!1);constructor(e){let{enableLongStackTrace:r=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:o=_F}=e;if(typeof Zone>"u")throw new oe(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),r&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&t,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=o,Oq(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(tR)===!0}static assertInAngularZone(){if(!n.isInAngularZone())throw new oe(909,!1)}static assertNotInAngularZone(){if(n.isInAngularZone())throw new oe(909,!1)}run(e,r,t){return this._inner.run(e,r,t)}runTask(e,r,t,i){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,e,Cq,jc,jc);try{return o.runTask(s,r,t)}finally{o.cancelTask(s)}}runGuarded(e,r,t){return this._inner.runGuarded(e,r,t)}runOutsideAngular(e){return this._outer.run(e)}},Cq={};function nR(n){if(n._nesting==0&&!n.hasPendingMicrotasks&&!n.isStable)try{n._nesting++,n.onMicrotaskEmpty.emit(null)}finally{if(n._nesting--,!n.hasPendingMicrotasks)try{n.runOutsideAngular(()=>n.onStable.emit(null))}finally{n.isStable=!0}}}function Nq(n){if(n.isCheckStableRunning||n.callbackScheduled)return;n.callbackScheduled=!0;function e(){TF(()=>{n.callbackScheduled=!1,mD(n),n.isCheckStableRunning=!0,nR(n),n.isCheckStableRunning=!1})}n.scheduleInRootZone?Zone.root.run(()=>{e()}):n._outer.run(()=>{e()}),mD(n)}function Oq(n){let e=()=>{Nq(n)},r=Rq++;n._inner=n._inner.fork({name:"angular",properties:{[tR]:!0,[m_]:r,[m_+r]:!0},onInvokeTask:(t,i,o,s,a,c)=>{if(wq(c))return t.invokeTask(o,s,a,c);try{return ax(n),t.invokeTask(o,s,a,c)}finally{(n.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||n.shouldCoalesceRunChangeDetection)&&e(),cx(n)}},onInvoke:(t,i,o,s,a,c,l)=>{try{return ax(n),t.invoke(o,s,a,c,l)}finally{n.shouldCoalesceRunChangeDetection&&!n.callbackScheduled&&!bq(c)&&e(),cx(n)}},onHasTask:(t,i,o,s)=>{t.hasTask(o,s),i===o&&(s.change=="microTask"?(n._hasPendingMicrotasks=s.microTask,mD(n),nR(n)):s.change=="macroTask"&&(n.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,i,o,s)=>(t.handleError(o,s),n.runOutsideAngular(()=>n.onError.emit(s)),!1)})}function mD(n){n._hasPendingMicrotasks||(n.shouldCoalesceEventChangeDetection||n.shouldCoalesceRunChangeDetection)&&n.callbackScheduled===!0?n.hasPendingMicrotasks=!0:n.hasPendingMicrotasks=!1}function ax(n){n._nesting++,n.isStable&&(n.isStable=!1,n.onUnstable.emit(null))}function cx(n){n._nesting--,nR(n)}var Qu=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new as;onMicrotaskEmpty=new as;onStable=new as;onError=new as;run(e,r,t){return e.apply(r,t)}runGuarded(e,r,t){return e.apply(r,t)}runOutsideAngular(e){return e()}runTask(e,r,t,i){return e.apply(r,t)}};function wq(n){return IF(n,"__ignore_ng_zone__")}function bq(n){return IF(n,"__scheduler_tick__")}function IF(n,e){return!Array.isArray(n)||n.length!==1?!1:n[0]?.data?.[e]===!0}function vF(n="zone.js",e){return n==="noop"?new Qu:n==="zone.js"?new be(e):n}var rR=(()=>{class n{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),yF=[0,1,2,3],SF=(()=>{class n{ngZone=ne(be);scheduler=ne(Zr);errorHandler=ne(xr,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){ne(Yc,{optional:!0})}execute(){let r=this.sequences.size>0;r&&lt(16),this.executing=!0;for(let t of yF)for(let i of this.sequences)if(!(i.erroredOrDestroyed||!i.hooks[t]))try{i.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>{let o=i.hooks[t];return o(i.pipelinedValue)},i.snapshot))}catch(o){i.erroredOrDestroyed=!0,this.errorHandler?.handleError(o)}this.executing=!1;for(let t of this.sequences)t.afterRun(),t.once&&(this.sequences.delete(t),t.destroy());for(let t of this.deferredRegistrations)this.sequences.add(t);this.deferredRegistrations.size>0&&this.scheduler.notify(7),this.deferredRegistrations.clear(),r&&lt(17)}register(r){let{view:t}=r;t!==void 0?((t[Fc]??=[]).push(r),ta(t),t[Ae]|=8192):this.executing?this.deferredRegistrations.add(r):this.addSequence(r)}addSequence(r){this.sequences.add(r),this.scheduler.notify(7)}unregister(r){this.executing&&this.sequences.has(r)?(r.erroredOrDestroyed=!0,r.pipelinedValue=void 0,r.once=!0):(this.sequences.delete(r),this.deferredRegistrations.delete(r))}maybeTrace(r,t){return t?t.run(x_.AFTER_NEXT_RENDER,r):r()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),p_=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,r,t,i,o,s=null){this.impl=e,this.hooks=r,this.view=t,this.once=i,this.snapshot=s,this.unregisterOnDestroy=o?.onDestroy(()=>this.destroy())}afterRun(){this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,this.snapshot?.dispose(),this.snapshot=null}destroy(){this.impl.unregister(this),this.unregisterOnDestroy?.();let e=this.view?.[Fc];e&&(this.view[Fc]=e.filter(r=>r!==this))}};function Lq(n,e){let r=e?.injector??ne(St);return fs("NgAfterNextRender"),Pq(n,r,e,!0)}function Mq(n){return n instanceof Function?[void 0,void 0,n,void 0]:[n.earlyRead,n.write,n.mixedReadWrite,n.read]}function Pq(n,e,r,t){let i=e.get(rR);i.impl??=e.get(SF);let o=e.get(Yc,null,{optional:!0}),s=r?.manualCleanup!==!0?e.get(ar):null,a=e.get(Hu,null,{optional:!0}),c=new p_(i.impl,Mq(n),a?.view,t,s,o?.snapshot(null));return i.impl.register(c),c}var AF=new Z("",{providedIn:"root",factory:()=>({queue:new Set,isScheduled:!1,scheduler:null})});function DF(n,e,r){let t=n.get(AF);if(Array.isArray(e))for(let i of e)t.queue.add(i),r?.detachedLeaveAnimationFns?.push(i);else t.queue.add(e),r?.detachedLeaveAnimationFns?.push(e);t.scheduler&&t.scheduler(n)}function xq(n,e){let r=n.get(AF);if(e.detachedLeaveAnimationFns){for(let t of e.detachedLeaveAnimationFns)r.queue.delete(t);e.detachedLeaveAnimationFns=void 0}}function Fq(n,e){for(let[r,t]of e)DF(n,t.animateFns)}function lx(n,e,r,t){let i=n?.[kc]?.enter;e!==null&&i&&i.has(r.index)&&Fq(t,i)}function zu(n,e,r,t,i,o,s,a){if(i!=null){let c,l=!1;Oi(i)?c=i:mo(i)&&(l=!0,i=i[Ni]);let u=ti(i);n===0&&t!==null?(lx(a,t,o,r),s==null?uF(e,t,u):g_(e,t,u,s||null,!0)):n===1&&t!==null?(lx(a,t,o,r),g_(e,t,u,s||null,!0)):n===2?ux(a,o,r,d=>{dF(e,u,l,d)}):n===3&&ux(a,o,r,()=>{e.destroyNode(u)}),c!=null&&qq(e,n,r,c,o,t,s)}}function kq(n,e){RF(n,e),e[Ni]=null,e[or]=null}function Uq(n,e,r,t,i,o){t[Ni]=i,t[or]=e,k_(n,t,r,1,i,o)}function RF(n,e){e[fo].changeDetectionScheduler?.notify(9),k_(n,e,e[Ze],2,null,null)}function Vq(n){let e=n[Uu];if(!e)return HA(n[Te],n);for(;e;){let r=null;if(mo(e))r=e[Uu];else{let t=e[jt];t&&(r=t)}if(!r){for(;e&&!e[ei]&&e!==n;)mo(e)&&HA(e[Te],e),e=e[fn];e===null&&(e=n),mo(e)&&HA(e[Te],e),r=e&&e[ei]}e=r}}function iR(n,e){let r=n[Uc],t=r.indexOf(e);r.splice(t,1)}function F_(n,e){if(Vc(e))return;let r=e[Ze];r.destroyNode&&k_(n,e,r,3,null,null),Vq(e)}function HA(n,e){if(Vc(e))return;let r=Se(null);try{e[Ae]&=-129,e[Ae]|=256,e[kr]&&Rc(e[kr]),$q(n,e),Gq(n,e),e[Te].type===1&&e[Ze].destroy();let t=e[Zs];if(t!==null&&Oi(e[fn])){t!==e[fn]&&iR(t,e);let i=e[go];i!==null&&i.detachView(n)}nD(e)}finally{Se(r)}}function ux(n,e,r,t){let i=n?.[kc];if(i==null||i.leave==null||!i.leave.has(e.index))return t(!1);n&&zc.add(n),DF(r,()=>{if(i.leave&&i.leave.has(e.index)){let s=i.leave.get(e.index),a=[];if(s){for(let c=0;c<s.animateFns.length;c++){let l=s.animateFns[c],{promise:u}=l();a.push(u)}i.detachedLeaveAnimationFns=void 0}i.running=Promise.allSettled(a),Bq(n,t)}else n&&zc.delete(n),t(!1)},i)}function Bq(n,e){let r=n[kc]?.running;if(r){r.then(()=>{n[kc].running=void 0,zc.delete(n),e(!0)});return}e(!1)}function Gq(n,e){let r=n.cleanup,t=e[ku];if(r!==null)for(let s=0;s<r.length-1;s+=2)if(typeof r[s]=="string"){let a=r[s+3];a>=0?t[a]():t[-a].unsubscribe(),s+=2}else{let a=t[r[s+1]];r[s].call(a)}t!==null&&(e[ku]=null);let i=e[ts];if(i!==null){e[ts]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let o=e[os];if(o!==null){e[os]=null;for(let s of o)s.destroy()}}function $q(n,e){let r;if(n!=null&&(r=n.destroyHooks)!=null)for(let t=0;t<r.length;t+=2){let i=e[r[t]];if(!(i instanceof Wc)){let o=r[t+1];if(Array.isArray(o))for(let s=0;s<o.length;s+=2){let a=i[o[s]],c=o[s+1];lt(4,a,c);try{c.call(a)}finally{lt(5,a,c)}}else{lt(4,i,o);try{o.call(i)}finally{lt(5,i,o)}}}}}function CF(n,e,r){return jq(n,e.parent,r)}function jq(n,e,r){let t=e;for(;t!==null&&t.type&168;)e=t,t=e.parent;if(t===null)return r[Ni];if(ss(t)){let{encapsulation:i}=n.data[t.directiveStart+t.componentOffset];if(i===cs.None||i===cs.Emulated)return null}return ni(t,r)}function NF(n,e,r){return Wq(n,e,r)}function Hq(n,e,r){return n.type&40?ni(n,r):null}var Wq=Hq,dx;function oR(n,e,r,t){let i=CF(n,t,e),o=e[Ze],s=t.parent||e[or],a=NF(s,t,e);if(i!=null)if(Array.isArray(r))for(let c=0;c<r.length;c++)rx(o,i,r[c],a,!1);else rx(o,i,r,a,!1);dx!==void 0&&dx(o,t,e,r,i)}function kf(n,e){if(e!==null){let r=e.type;if(r&3)return ni(e,n);if(r&4)return pD(-1,n[e.index]);if(r&8){let t=e.child;if(t!==null)return kf(n,t);{let i=n[e.index];return Oi(i)?pD(-1,i):ti(i)}}else{if(r&128)return kf(n,e.next);if(r&32)return eR(e,n)()||ti(n[e.index]);{let t=OF(n,e);if(t!==null){if(Array.isArray(t))return t[0];let i=Ys(n[Yn]);return kf(i,t)}else return kf(n,e.next)}}}return null}function OF(n,e){if(e!==null){let t=n[Yn][or],i=e.projection;return t.projection[i]}return null}function pD(n,e){let r=jt+n+1;if(r<e.length){let t=e[r],i=t[Te].firstChild;if(i!==null)return kf(t,i)}return e[ea]}function sR(n,e,r,t,i,o,s){for(;r!=null;){let a=t[is];if(r.type===128){r=r.next;continue}let c=t[r.index],l=r.type;if(s&&e===0&&(c&&Yu(ti(c),t),r.flags|=2),!b_(r))if(l&8)sR(n,e,r.child,t,i,o,!1),zu(e,n,a,i,c,r,o,t);else if(l&32){let u=eR(r,t),d;for(;d=u();)zu(e,n,a,i,d,r,o,t);zu(e,n,a,i,c,r,o,t)}else l&16?wF(n,e,t,r,i,o):zu(e,n,a,i,c,r,o,t);r=s?r.projectionNext:r.next}}function k_(n,e,r,t,i,o){sR(r,t,n.firstChild,e,i,o,!1)}function zq(n,e,r){let t=e[Ze],i=CF(n,r,e),o=r.parent||e[or],s=NF(o,r,e);wF(t,0,e,r,i,s)}function wF(n,e,r,t,i,o){let s=r[Yn],c=s[or].projection[t.projection];if(Array.isArray(c))for(let l=0;l<c.length;l++){let u=c[l];zu(e,n,r[is],i,u,t,o,r)}else{let l=c,u=s[fn];zx(t)&&(l.flags|=128),sR(n,e,l,u,i,o,!0)}}function qq(n,e,r,t,i,o,s){let a=t[ea],c=ti(t);a!==c&&zu(e,n,r,o,a,i,s);for(let l=jt;l<t.length;l++){let u=t[l];k_(u[Te],u,n,e,o,a)}}function Kq(n,e,r,t,i){if(e)i?n.addClass(r,t):n.removeClass(r,t);else{let o=t.indexOf("-")===-1?void 0:Li.DashCase;i==null?n.removeStyle(r,t,o):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=Li.Important),n.setStyle(r,t,i,o))}}function bF(n,e,r,t,i){let o=ii(),s=t&2;try{na(-1),s&&e.length>et&&EF(n,e,et,!1),lt(s?2:0,i,r),r(t,i)}finally{na(o),lt(s?3:1,i,r)}}function U_(n,e,r){Zq(n,e,r),(r.flags&64)===64&&e8(n,e,r)}function Wf(n,e,r=ni){let t=e.localNames;if(t!==null){let i=e.index+1;for(let o=0;o<t.length;o+=2){let s=t[o+1],a=s===-1?r(e,n):n[s];n[i++]=a}}}function Yq(n,e,r,t){let o=t.get(eF,Zx)||r===cs.ShadowDom,s=n.selectRootElement(e,o);return Qq(s),s}function Qq(n){Xq(n)}var Xq=()=>null;function Jq(n){return n==="class"?"className":n==="for"?"htmlFor":n==="formaction"?"formAction":n==="innerHtml"?"innerHTML":n==="readonly"?"readOnly":n==="tabindex"?"tabIndex":n}function LF(n,e,r,t,i,o){let s=e[Te];if(V_(n,s,e,r,t)){ss(n)&&PF(e,n.index);return}n.type&3&&(r=Jq(r)),MF(n,e,r,t,i,o)}function MF(n,e,r,t,i,o){if(n.type&3){let s=ni(n,e);t=o!=null?o(t,n.value||"",r):t,i.setProperty(s,r,t)}else n.type&12}function PF(n,e){let r=ri(e,n);r[Ae]&16||(r[Ae]|=64)}function Zq(n,e,r){let t=r.directiveStart,i=r.directiveEnd;ss(r)&&Sq(e,r,n.data[t+r.componentOffset]),n.firstCreatePass||h_(r,e);let o=r.initialInputs;for(let s=t;s<i;s++){let a=n.data[s],c=Vf(e,n,s,r);if(Yu(c,e),o!==null&&r8(e,s-t,c,a,r,o),wi(a)){let l=ri(r.index,e);l[$t]=Vf(e,n,s,r)}}}function e8(n,e,r){let t=r.directiveStart,i=r.directiveEnd,o=r.index,s=x0();try{na(o);for(let a=t;a<i;a++){let c=n.data[a],l=e[a];HE(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&t8(c,l)}}finally{na(-1),HE(s)}}function t8(n,e){n.hostBindings!==null&&n.hostBindings(1,e)}function aR(n,e){let r=n.directiveRegistry,t=null;if(r)for(let i=0;i<r.length;i++){let o=r[i];gF(e,o.selectors,!1)&&(t??=[],wi(o)?t.unshift(o):t.push(o))}return t}function n8(n,e,r,t,i,o){let s=ni(n,e);xF(e[Ze],s,o,n.value,r,t,i)}function xF(n,e,r,t,i,o,s){if(o==null)n.removeAttribute(e,i,r);else{let a=s==null?Fr(o):s(o,t||"",i);n.setAttribute(e,i,a,r)}}function r8(n,e,r,t,i,o){let s=o[e];if(s!==null)for(let a=0;a<s.length;a+=2){let c=s[a],l=s[a+1];fD(t,r,c,l)}}function cR(n,e,r,t,i){let o=et+r,s=e[Te],a=i(s,e,n,t,r);e[o]=a,Gc(n,!0);let c=n.type===2;return c?(hF(e[Ze],a,n),(C0()===0||Vu(n))&&Yu(a,e),N0()):Yu(a,e),KE()&&(!c||!b_(n))&&oR(s,e,a,n),n}function lR(n){let e=n;return bA()?LA():(e=e.parent,Gc(e,!1)),e}function i8(n,e){let r=n[is];if(!r)return;let t;try{t=r.get(Eo,null)}catch{t=null}t?.(e)}function V_(n,e,r,t,i){let o=n.inputs?.[t],s=n.hostDirectiveInputs?.[t],a=!1;if(s)for(let c=0;c<s.length;c+=2){let l=s[c],u=s[c+1],d=e.data[l];fD(d,r[l],u,i),a=!0}if(o)for(let c of o){let l=r[c],u=e.data[c];fD(u,l,t,i),a=!0}return a}function o8(n,e){let r=ri(e,n),t=r[Te];s8(t,r);let i=r[Ni];i!==null&&r[Mc]===null&&(r[Mc]=tF(i,r[is])),lt(18),uR(t,r,r[$t]),lt(19,r[$t])}function s8(n,e){for(let r=e.length;r<n.blueprint.length;r++)e.push(n.blueprint[r])}function uR(n,e,r){zE(e);try{let t=n.viewQuery;t!==null&&iD(1,t,r);let i=n.template;i!==null&&bF(n,e,i,1,r),n.firstCreatePass&&(n.firstCreatePass=!1),e[go]?.finishViewCreation(n),n.staticContentQueries&&nF(n,e),n.staticViewQueries&&iD(2,n.viewQuery,r);let o=n.components;o!==null&&a8(e,o)}catch(t){throw n.firstCreatePass&&(n.incompleteFirstPass=!0,n.firstCreatePass=!1),t}finally{e[Ae]&=-5,qE()}}function a8(n,e){for(let r=0;r<e.length;r++)o8(n,e[r])}function zf(n,e,r,t){let i=Se(null);try{let o=e.tView,a=n[Ae]&4096?4096:16,c=JD(n,o,r,a,null,e,null,null,t?.injector??null,t?.embeddedViewInjector??null,t?.dehydratedView??null),l=n[e.index];c[Zs]=l;let u=n[go];return u!==null&&(c[go]=u.createEmbeddedView(o)),uR(o,c,r),c}finally{Se(i)}}function Xu(n,e){return!e||e.firstChild===null||zx(n)}function Bf(n,e,r,t,i=!1){for(;r!==null;){if(r.type===128){r=i?r.projectionNext:r.next;continue}let o=e[r.index];o!==null&&t.push(ti(o)),Oi(o)&&FF(o,t);let s=r.type;if(s&8)Bf(n,e,r.child,t);else if(s&32){let a=eR(r,e),c;for(;c=a();)t.push(c)}else if(s&16){let a=OF(e,r);if(Array.isArray(a))t.push(...a);else{let c=Ys(e[Yn]);Bf(c[Te],c,a,t,!0)}}r=i?r.projectionNext:r.next}return t}function FF(n,e){for(let r=jt;r<n.length;r++){let t=n[r],i=t[Te].firstChild;i!==null&&Bf(t[Te],t,i,e)}n[ea]!==n[Ni]&&e.push(n[ea])}function kF(n){if(n[Fc]!==null){for(let e of n[Fc])e.impl.addSequence(e);n[Fc].length=0}}var UF=[];function c8(n){return n[kr]??l8(n)}function l8(n){let e=UF.pop()??Object.create(d8);return e.lView=n,e}function u8(n){n.lView[kr]!==n&&(n.lView=null,UF.push(n))}var d8=le(P({},Ac),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:n=>{ta(n.lView)},consumerOnSignalRead(){this.lView[kr]=this}});function h8(n){let e=n[kr]??Object.create(f8);return e.lView=n,e}var f8=le(P({},Ac),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:n=>{let e=Ys(n.lView);for(;e&&!VF(e[Te]);)e=Ys(e);e&&GE(e)},consumerOnSignalRead(){this.lView[kr]=this}});function VF(n){return n.type!==2}function BF(n){if(n[os]===null)return;let e=!0;for(;e;){let r=!1;for(let t of n[os])t.dirty&&(r=!0,t.zone===null||Zone.current===t.zone?t.run():t.zone.run(()=>t.run()));e=r&&!!(n[Ae]&8192)}}var g8=100;function GF(n,e=0){let t=n[fo].rendererFactory,i=!1;i||t.begin?.();try{m8(n,e)}finally{i||t.end?.()}}function m8(n,e){let r=PA();try{$u(!0),ED(n,e);let t=0;for(;Gu(n);){if(t===g8)throw new oe(103,!1);t++,ED(n,1)}}finally{$u(r)}}function p8(n,e,r,t){if(Vc(e))return;let i=e[Ae],o=!1,s=!1;zE(e);let a=!0,c=null,l=null;o||(VF(n)?(l=c8(e),c=Dc(l)):pE()===null?(a=!1,l=h8(e),c=Dc(l)):e[kr]&&(Rc(e[kr]),e[kr]=null));try{yA(e),L0(n.bindingStartIndex),r!==null&&bF(n,e,r,2,t);let u=(i&3)===3;if(!o)if(u){let g=n.preOrderCheckHooks;g!==null&&r_(e,g,null)}else{let g=n.preOrderHooks;g!==null&&i_(e,g,0,null),$A(e,0)}if(s||E8(e),BF(e),$F(e,0),n.contentQueries!==null&&nF(n,e),!o)if(u){let g=n.contentCheckHooks;g!==null&&r_(e,g)}else{let g=n.contentHooks;g!==null&&i_(e,g,1),$A(e,1)}T8(n,e);let d=n.components;d!==null&&HF(e,d,0);let f=n.viewQuery;if(f!==null&&iD(2,f,t),!o)if(u){let g=n.viewCheckHooks;g!==null&&r_(e,g)}else{let g=n.viewHooks;g!==null&&i_(e,g,2),$A(e,2)}if(n.firstUpdatePass===!0&&(n.firstUpdatePass=!1),e[VE]){for(let g of e[VE])g();e[VE]=null}o||(kF(e),e[Ae]&=-73)}catch(u){throw o||ta(e),u}finally{l!==null&&(Nu(l,c),a&&u8(l)),qE()}}function $F(n,e){for(let r=Kx(n);r!==null;r=Yx(r))for(let t=jt;t<r.length;t++){let i=r[t];jF(i,e)}}function E8(n){for(let e=Kx(n);e!==null;e=Yx(e)){if(!(e[Ae]&2))continue;let r=e[Uc];for(let t=0;t<r.length;t++){let i=r[t];GE(i)}}}function _8(n,e,r){lt(18);let t=ri(e,n);jF(t,r),lt(19,t[$t])}function jF(n,e){BE(n)&&ED(n,e)}function ED(n,e){let t=n[Te],i=n[Ae],o=n[kr],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(o?.dirty&&Ou(o)),s||=!1,o&&(o.dirty=!1),n[Ae]&=-9217,s)p8(t,n,t.template,n[$t]);else if(i&8192){let a=Se(null);try{BF(n),$F(n,1);let c=t.components;c!==null&&HF(n,c,1),kF(n)}finally{Se(a)}}}function HF(n,e,r){for(let t=0;t<e.length;t++)_8(n,e[t],r)}function T8(n,e){let r=n.hostBindingOpCodes;if(r!==null)try{for(let t=0;t<r.length;t++){let i=r[t];if(i<0)na(~i);else{let o=i,s=r[++t],a=r[++t];P0(s,o);let c=e[o];lt(24,c),a(2,c),lt(25,c)}}}finally{na(-1)}}function dR(n,e){let r=PA()?64:1088;for(n[fo].changeDetectionScheduler?.notify(e);n;){n[Ae]|=r;let t=Ys(n);if(Bu(n)&&!t)return n;n=t}return null}function WF(n,e,r,t){return[n,!0,0,e,null,t,null,r,null,null]}function zF(n,e){let r=jt+e;if(r<n.length)return n[r]}function qf(n,e,r,t=!0){let i=e[Te];if(I8(i,e,n,r),t){let s=pD(r,n),a=e[Ze],c=a.parentNode(n[ea]);c!==null&&Uq(i,n[or],a,e,c,s)}let o=e[Mc];o!==null&&o.firstChild!==null&&(o.firstChild=null)}function qF(n,e){let r=Gf(n,e);return r!==void 0&&F_(r[Te],r),r}function Gf(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r];if(t){let i=t[Zs];i!==null&&i!==n&&iR(i,t),e>0&&(n[r-1][ei]=t[ei]);let o=Rf(n,jt+e);kq(t[Te],t);let s=o[go];s!==null&&s.detachView(o[Te]),t[fn]=null,t[ei]=null,t[Ae]&=-129}return t}function I8(n,e,r,t){let i=jt+t,o=r.length;t>0&&(r[i-1][ei]=e),t<o-jt?(e[ei]=r[i],cA(r,jt+t,e)):(r.push(e),e[ei]=null),e[fn]=r;let s=e[Zs];s!==null&&r!==s&&KF(s,e);let a=e[go];a!==null&&a.insertView(n),$E(e),e[Ae]|=128}function KF(n,e){let r=n[Uc],t=e[fn];if(mo(t))n[Ae]|=2;else{let i=t[fn][Yn];e[Yn]!==i&&(n[Ae]|=2)}r===null?n[Uc]=[e]:r.push(e)}var ia=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,r=e[Te];return Bf(r,e,r.firstChild,[])}constructor(e,r){this._lView=e,this._cdRefInjectingView=r}get context(){return this._lView[$t]}set context(e){this._lView[$t]=e}get destroyed(){return Vc(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[fn];if(Oi(e)){let r=e[wf],t=r?r.indexOf(this):-1;t>-1&&(Gf(e,t),Rf(r,t))}this._attachedToViewContainer=!1}F_(this._lView[Te],this._lView)}onDestroy(e){SA(this._lView,e)}markForCheck(){dR(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[Ae]&=-129}reattach(){$E(this._lView),this._lView[Ae]|=128}detectChanges(){this._lView[Ae]|=1024,GF(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new oe(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=Bu(this._lView),r=this._lView[Zs];r!==null&&!e&&iR(r,this._lView),RF(this._lView[Te],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new oe(902,!1);this._appRef=e;let r=Bu(this._lView),t=this._lView[Zs];t!==null&&!r&&KF(t,this._lView),$E(this._lView)}};function v8(n){return Gu(n._lView)||!!(n._lView[Ae]&64)}function y8(n){GE(n._lView)}var vo=(()=>{class n{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=S8;constructor(r,t,i){this._declarationLView=r,this._declarationTContainer=t,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(r,t){return this.createEmbeddedViewImpl(r,t)}createEmbeddedViewImpl(r,t,i){let o=zf(this._declarationLView,this._declarationTContainer,r,{embeddedViewInjector:t,dehydratedView:i});return new ia(o)}}return n})();function S8(){return B_(gn(),ce())}function B_(n,e){return n.type&4?new vo(e,n,sd(n,e)):null}function Qc(n,e,r,t,i){let o=n.data[e];if(o===null)o=A8(n,e,r,t,i),M0()&&(o.flags|=32);else if(o.type&64){o.type=r,o.value=t,o.attrs=i;let s=b0();o.injectorIndex=s===null?-1:s.injectorIndex}return Gc(o,!0),o}function A8(n,e,r,t,i){let o=wA(),s=bA(),a=s?o:o&&o.parent,c=n.data[e]=R8(n,a,r,e,t,i);return D8(n,c,o,s),c}function D8(n,e,r,t){n.firstChild===null&&(n.firstChild=e),r!==null&&(t?r.child==null&&e.parent!==null&&(r.child=e):r.next===null&&(r.next=e,e.prev=r))}function R8(n,e,r,t,i,o){let s=e?e.injectorIndex:-1,a=0;return CA()&&(a|=128),{type:r,index:t,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,attrs:o,mergedAttrs:null,localNames:null,initialInputs:null,inputs:null,hostDirectiveInputs:null,outputs:null,hostDirectiveOutputs:null,directiveToIndex:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}var Dpe=new RegExp(`^(\\d+)*(${R4}|${D4})*(.*)`);function C8(n){let e=n[_A]??[],t=n[fn][Ze],i=[];for(let o of e)o.data[Jx]!==void 0?i.push(o):N8(o,t);n[_A]=i}function N8(n,e){let r=0,t=n.firstChild;if(t){let i=n.data[Xx];for(;r<i;){let o=t.nextSibling;dF(e,t,!1),t=o,r++}}}var O8=()=>null,w8=()=>null;function E_(n,e){return O8(n,e)}function YF(n,e,r){return w8(n,e,r)}var QF=class{},G_=class{},_D=class{resolveComponentFactory(e){throw new oe(917,!1)}},Kf=class{static NULL=new _D},us=class{},$_=(()=>{class n{destroyNode=null;static __NG_ELEMENT_ID__=()=>b8()}return n})();function b8(){let n=ce(),e=gn(),r=ri(e.index,n);return(mo(r)?r:n)[Ze]}var XF=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:()=>null})}return n})();var s_={},TD=class{injector;parentInjector;constructor(e,r){this.injector=e,this.parentInjector=r}get(e,r,t){let i=this.injector.get(e,s_,t);return i!==s_||r===s_?i:this.parentInjector.get(e,r,t)}};function __(n,e,r){let t=r?n.styles:null,i=r?n.classes:null,o=0;if(e!==null)for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")o=a;else if(o==1)i=bE(i,a);else if(o==2){let c=a,l=e[++s];t=bE(t,c+": "+l+";")}}r?n.styles=t:n.stylesWithoutHost=t,r?n.classes=i:n.classesWithoutHost=i}function ut(n,e=0){let r=ce();if(r===null)return w(n,e);let t=gn();return $x(t,r,hn(n),e)}function L8(){let n="invalid";throw new Error(n)}function JF(n,e,r,t,i){let o=t===null?null:{"":-1},s=i(n,r);if(s!==null){let a=s,c=null,l=null;for(let u of s)if(u.resolveHostDirectives!==null){[a,c,l]=u.resolveHostDirectives(s);break}x8(n,e,r,a,o,c,l)}o!==null&&t!==null&&M8(r,t,o)}function M8(n,e,r){let t=n.localNames=[];for(let i=0;i<e.length;i+=2){let o=r[e[i+1]];if(o==null)throw new oe(-301,!1);t.push(e[i],o)}}function P8(n,e,r){e.componentOffset=r,(n.components??=[]).push(e.index)}function x8(n,e,r,t,i,o,s){let a=t.length,c=!1;for(let f=0;f<a;f++){let g=t[f];!c&&wi(g)&&(c=!0,P8(n,r,f)),eD(h_(r,e),n,g.type)}G8(r,n.data.length,a);for(let f=0;f<a;f++){let g=t[f];g.providersResolver&&g.providersResolver(g)}let l=!1,u=!1,d=pF(n,e,a,null);a>0&&(r.directiveToIndex=new Map);for(let f=0;f<a;f++){let g=t[f];if(r.mergedAttrs=Ku(r.mergedAttrs,g.hostAttrs),k8(n,r,e,d,g),B8(d,g,i),s!==null&&s.has(g)){let[_,T]=s.get(g);r.directiveToIndex.set(g.type,[d,_+r.directiveStart,T+r.directiveStart])}else(o===null||!o.has(g))&&r.directiveToIndex.set(g.type,d);g.contentQueries!==null&&(r.flags|=4),(g.hostBindings!==null||g.hostAttrs!==null||g.hostVars!==0)&&(r.flags|=64);let p=g.type.prototype;!l&&(p.ngOnChanges||p.ngOnInit||p.ngDoCheck)&&((n.preOrderHooks??=[]).push(r.index),l=!0),!u&&(p.ngOnChanges||p.ngDoCheck)&&((n.preOrderCheckHooks??=[]).push(r.index),u=!0),d++}F8(n,r,o)}function F8(n,e,r){for(let t=e.directiveStart;t<e.directiveEnd;t++){let i=n.data[t];if(r===null||!r.has(i))hx(0,e,i,t),hx(1,e,i,t),gx(e,t,!1);else{let o=r.get(i);fx(0,e,o,t),fx(1,e,o,t),gx(e,t,!0)}}}function hx(n,e,r,t){let i=n===0?r.inputs:r.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s;n===0?s=e.inputs??={}:s=e.outputs??={},s[o]??=[],s[o].push(t),ZF(e,o)}}function fx(n,e,r,t){let i=n===0?r.inputs:r.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o],a;n===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(t,o),ZF(e,s)}}function ZF(n,e){e==="class"?n.flags|=8:e==="style"&&(n.flags|=16)}function gx(n,e,r){let{attrs:t,inputs:i,hostDirectiveInputs:o}=n;if(t===null||!r&&i===null||r&&o===null||QD(n)){n.initialInputs??=[],n.initialInputs.push(null);return}let s=null,a=0;for(;a<t.length;){let c=t[a];if(c===0){a+=4;continue}else if(c===5){a+=2;continue}else if(typeof c=="number")break;if(!r&&i.hasOwnProperty(c)){let l=i[c];for(let u of l)if(u===e){s??=[],s.push(c,t[a+1]);break}}else if(r&&o.hasOwnProperty(c)){let l=o[c];for(let u=0;u<l.length;u+=2)if(l[u]===e){s??=[],s.push(l[u+1],t[a+1]);break}}a+=2}n.initialInputs??=[],n.initialInputs.push(s)}function k8(n,e,r,t,i){n.data[t]=i;let o=i.factory||(i.factory=Ks(i.type,!0)),s=new Wc(o,wi(i),ut,null);n.blueprint[t]=s,r[t]=s,U8(n,e,t,pF(n,r,i.hostVars,Rn),i)}function U8(n,e,r,t,i){let o=i.hostBindings;if(o){let s=n.hostBindingOpCodes;s===null&&(s=n.hostBindingOpCodes=[]);let a=~e.index;V8(s)!=a&&s.push(a),s.push(r,t,o)}}function V8(n){let e=n.length;for(;e>0;){let r=n[--e];if(typeof r=="number"&&r<0)return r}return 0}function B8(n,e,r){if(r){if(e.exportAs)for(let t=0;t<e.exportAs.length;t++)r[e.exportAs[t]]=n;wi(e)&&(r[""]=n)}}function G8(n,e,r){n.flags|=1,n.directiveStart=e,n.directiveEnd=e+r,n.providerIndexes=e}function hR(n,e,r,t,i,o,s,a){let c=e[Te],l=c.consts,u=Ur(l,s),d=Qc(c,n,r,t,u);return o&&JF(c,e,d,Ur(l,a),i),d.mergedAttrs=Ku(d.mergedAttrs,d.attrs),d.attrs!==null&&__(d,d.attrs,!1),d.mergedAttrs!==null&&__(d,d.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,d),d}function fR(n,e){Px(n,e),TA(e)&&n.queries.elementEnd(e)}function $8(n,e,r,t,i,o){let s=e.consts,a=Ur(s,i),c=Qc(e,n,r,t,a);if(c.mergedAttrs=Ku(c.mergedAttrs,c.attrs),o!=null){let l=Ur(s,o);c.localNames=[];for(let u=0;u<l.length;u+=2)c.localNames.push(l[u],-1)}return c.attrs!==null&&__(c,c.attrs,!1),c.mergedAttrs!==null&&__(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}function gR(n){return j_(n)?Array.isArray(n)||!(n instanceof Map)&&Symbol.iterator in n:!1}function ek(n,e){if(Array.isArray(n))for(let r=0;r<n.length;r++)e(n[r]);else{let r=n[Symbol.iterator](),t;for(;!(t=r.next()).done;)e(t.value)}}function j_(n){return n!==null&&(typeof n=="function"||typeof n=="object")}function So(n,e,r){return n[e]=r}function Yf(n,e){return n[e]}function Pn(n,e,r){if(r===Rn)return!1;let t=n[e];return Object.is(t,r)?!1:(n[e]=r,!0)}function Ju(n,e,r,t){let i=Pn(n,e,r);return Pn(n,e+1,t)||i}function mR(n,e,r,t,i){let o=Ju(n,e,r,t);return Pn(n,e+2,i)||o}function Zu(n,e,r,t,i,o){let s=Ju(n,e,r,t);return Ju(n,e+2,i,o)||s}function a_(n,e,r){return function t(i){let o=ss(n)?ri(n.index,e):e;dR(o,5);let s=e[$t],a=mx(e,s,r,i),c=t.__ngNextListenerFn__;for(;c;)a=mx(e,s,c,i)&&a,c=c.__ngNextListenerFn__;return a}}function mx(n,e,r,t){let i=Se(null);try{return lt(6,e,r),r(t)!==!1}catch(o){return i8(n,o),!1}finally{lt(7,e,r),Se(i)}}function tk(n,e,r,t,i,o,s,a){let c=Vu(n),l=!1,u=null;if(!t&&c&&(u=H8(e,r,o,n.index)),u!==null){let d=u.__ngLastListenerFn__||u;d.__ngNextListenerFn__=s,u.__ngLastListenerFn__=s,l=!0}else{let d=ni(n,r),f=t?t(d):d;N4(r,f,o,a);let g=i.listen(f,o,a);if(!j8(o)){let p=t?_=>t(ti(_[n.index])):n.index;nk(p,e,r,o,a,g,!1)}}return l}function j8(n){return n.startsWith("animation")||n.startsWith("transition")}function H8(n,e,r,t){let i=n.cleanup;if(i!=null)for(let o=0;o<i.length-1;o+=2){let s=i[o];if(s===r&&i[o+1]===t){let a=e[ku],c=i[o+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(o+=2)}return null}function nk(n,e,r,t,i,o,s){let a=e.firstCreatePass?DA(e):null,c=AA(r),l=c.length;c.push(i,o),a&&a.push(t,n,l,(l+1)*(s?-1:1))}function px(n,e,r,t,i,o){let s=e[r],a=e[Te],l=a.data[r].outputs[t],d=s[l].subscribe(o);nk(n.index,a,e,i,o,d,!0)}var ID=Symbol("BINDING");var T_=class extends Kf{ngModule;constructor(e){super(),this.ngModule=e}resolveComponentFactory(e){let r=Js(e);return new ed(r,this.ngModule)}};function W8(n){return Object.keys(n).map(e=>{let[r,t,i]=n[e],o={propName:r,templateName:e,isSignal:(t&P_.SignalBased)!==0};return i&&(o.transform=i),o})}function z8(n){return Object.keys(n).map(e=>({propName:n[e],templateName:e}))}function q8(n,e,r){let t=e instanceof Kn?e:e?.injector;return t&&n.getStandaloneInjector!==null&&(t=n.getStandaloneInjector(t)||t),t?new TD(r,t):r}function K8(n){let e=n.get(us,null);if(e===null)throw new oe(407,!1);let r=n.get(XF,null),t=n.get(Zr,null);return{rendererFactory:e,sanitizer:r,changeDetectionScheduler:t,ngReflect:!1}}function Y8(n,e){let r=rk(n);return lF(e,r,r==="svg"?IA:r==="math"?v0:null)}function rk(n){return(n.selectors[0][0]||"div").toLowerCase()}var ed=class extends G_{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=W8(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=z8(this.componentDef.outputs),this.cachedOutputs}constructor(e,r){super(),this.componentDef=e,this.ngModule=r,this.componentType=e.type,this.selector=Tq(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!r}create(e,r,t,i,o,s){lt(22);let a=Se(null);try{let c=this.componentDef,l=Q8(t,c,s,o),u=q8(c,i||this.ngModule,e),d=K8(u),f=d.rendererFactory.createRenderer(null,c),g=t?Yq(f,t,c.encapsulation,u):Y8(c,f),p=s?.some(Ex)||o?.some(S=>typeof S!="function"&&S.bindings.some(Ex)),_=JD(null,l,null,512|mF(c),null,null,d,f,u,null,tF(g,u,!0));_[et]=g,zE(_);let T=null;try{let S=hR(et,_,2,"#host",()=>l.directiveRegistry,!0,0);hF(f,g,S),Yu(g,_),U_(l,_,S),jD(l,S,_),fR(l,S),r!==void 0&&J8(S,this.ngContentSelectors,r),T=ri(S.index,_),_[$t]=T[$t],uR(l,_,null)}catch(S){throw T!==null&&nD(T),nD(_),S}finally{lt(23),qE()}return new I_(this.componentType,_,!!p)}finally{Se(a)}}};function Q8(n,e,r,t){let i=n?["ng-version","20.3.18"]:Iq(e.selectors[0]),o=null,s=null,a=0;if(r)for(let u of r)a+=u[ID].requiredVars,u.create&&(u.targetIdx=0,(o??=[]).push(u)),u.update&&(u.targetIdx=0,(s??=[]).push(u));if(t)for(let u=0;u<t.length;u++){let d=t[u];if(typeof d!="function")for(let f of d.bindings){a+=f[ID].requiredVars;let g=u+1;f.create&&(f.targetIdx=g,(o??=[]).push(f)),f.update&&(f.targetIdx=g,(s??=[]).push(f))}}let c=[e];if(t)for(let u of t){let d=typeof u=="function"?u:u.type,f=UE(d);c.push(f)}return XD(0,null,X8(o,s),1,a,c,null,null,null,[i],null)}function X8(n,e){return!n&&!e?null:r=>{if(r&1&&n)for(let t of n)t.create();if(r&2&&e)for(let t of e)t.update()}}function Ex(n){let e=n[ID].kind;return e==="input"||e==="twoWay"}var I_=class extends QF{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,r,t){super(),this._rootLView=r,this._hasInputBindings=t,this._tNode=bf(r[Te],et),this.location=sd(this._tNode,r),this.instance=ri(this._tNode.index,r)[$t],this.hostView=this.changeDetectorRef=new ia(r,void 0),this.componentType=e}setInput(e,r){this._hasInputBindings;let t=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),r))return;let i=this._rootLView,o=V_(t,i[Te],i,e,r);this.previousInputValues.set(e,r);let s=ri(t.index,i);dR(s,1)}get injector(){return new Hc(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function J8(n,e,r){let t=n.projection=[];for(let i=0;i<e.length;i++){let o=r[i];t.push(o!=null&&o.length?Array.from(o):null)}}var Ao=(()=>{class n{static __NG_ELEMENT_ID__=Z8}return n})();function Z8(){let n=gn();return ok(n,ce())}var e5=Ao,ik=class extends e5{_lContainer;_hostTNode;_hostLView;constructor(e,r,t){super(),this._lContainer=e,this._hostTNode=r,this._hostLView=t}get element(){return sd(this._hostTNode,this._hostLView)}get injector(){return new Hc(this._hostTNode,this._hostLView)}get parentInjector(){let e=VD(this._hostTNode,this._hostLView);if(Fx(e)){let r=u_(e,this._hostLView),t=l_(e),i=r[Te].data[t+8];return new Hc(i,r)}else return new Hc(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let r=_x(this._lContainer);return r!==null&&r[e]||null}get length(){return this._lContainer.length-jt}createEmbeddedView(e,r,t){let i,o;typeof t=="number"?i=t:t!=null&&(i=t.index,o=t.injector);let s=E_(this._lContainer,e.ssrId),a=e.createEmbeddedViewImpl(r||{},o,s);return this.insertImpl(a,i,Xu(this._hostTNode,s)),a}createComponent(e,r,t,i,o,s,a){let c=e&&!J6(e),l;if(c)l=r;else{let T=r||{};l=T.index,t=T.injector,i=T.projectableNodes,o=T.environmentInjector||T.ngModuleRef,s=T.directives,a=T.bindings}let u=c?e:new ed(Js(e)),d=t||this.parentInjector;if(!o&&u.ngModule==null){let S=(c?d:this.parentInjector).get(Kn,null);S&&(o=S)}let f=Js(u.componentType??{}),g=E_(this._lContainer,f?.id??null),p=g?.firstChild??null,_=u.create(d,i,p,o,s,a);return this.insertImpl(_.hostView,l,Xu(this._hostTNode,g)),_}insert(e,r){return this.insertImpl(e,r,!0)}insertImpl(e,r,t){let i=e._lView;if(S0(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[fn],l=new ik(c,c[or],c[fn]);l.detach(l.indexOf(e))}}let o=this._adjustIndex(r),s=this._lContainer;return qf(s,i,o,t),e.attachToViewContainerRef(),cA(WA(s),o,e),e}move(e,r){return this.insert(e,r)}indexOf(e){let r=_x(this._lContainer);return r!==null?r.indexOf(e):-1}remove(e){let r=this._adjustIndex(e,-1),t=Gf(this._lContainer,r);t&&(Rf(WA(this._lContainer),r),F_(t[Te],t))}detach(e){let r=this._adjustIndex(e,-1),t=Gf(this._lContainer,r);return t&&Rf(WA(this._lContainer),r)!=null?new ia(t):null}_adjustIndex(e,r=0){return e??this.length+r}};function _x(n){return n[wf]}function WA(n){return n[wf]||(n[wf]=[])}function ok(n,e){let r,t=e[n.index];return Oi(t)?r=t:(r=WF(t,e,null,n),e[n.index]=r,ZD(e,r)),n5(r,e,n,t),new ik(r,n,e)}function t5(n,e){let r=n[Ze],t=r.createComment(""),i=ni(e,n),o=r.parentNode(i);return g_(r,o,t,r.nextSibling(i),!1),t}var n5=o5,r5=()=>!1;function i5(n,e,r){return r5(n,e,r)}function o5(n,e,r,t){if(n[ea])return;let i;r.type&8?i=ti(t):i=t5(e,r),n[ea]=i}var vD=class n{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new n(this.queryList)}setDirty(){this.queryList.setDirty()}},yD=class n{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let r=e.queries;if(r!==null){let t=e.contentQueries!==null?e.contentQueries[0]:r.length,i=[];for(let o=0;o<t;o++){let s=r.getByIndex(o),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new n(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let r=0;r<this.queries.length;r++)ER(e,r).matches!==null&&this.queries[r].setDirty()}},v_=class{flags;read;predicate;constructor(e,r,t=null){this.flags=r,this.read=t,typeof e=="string"?this.predicate=d5(e):this.predicate=e}},SD=class n{queries;constructor(e=[]){this.queries=e}elementStart(e,r){for(let t=0;t<this.queries.length;t++)this.queries[t].elementStart(e,r)}elementEnd(e){for(let r=0;r<this.queries.length;r++)this.queries[r].elementEnd(e)}embeddedTView(e){let r=null;for(let t=0;t<this.length;t++){let i=r!==null?r.length:0,o=this.getByIndex(t).embeddedTView(e,i);o&&(o.indexInDeclarationView=t,r!==null?r.push(o):r=[o])}return r!==null?new n(r):null}template(e,r){for(let t=0;t<this.queries.length;t++)this.queries[t].template(e,r)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},AD=class n{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,r=-1){this.metadata=e,this._declarationNodeIndex=r}elementStart(e,r){this.isApplyingToNode(r)&&this.matchTNode(e,r)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,r){this.elementStart(e,r)}embeddedTView(e,r){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,r),new n(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let r=this._declarationNodeIndex,t=e.parent;for(;t!==null&&t.type&8&&t.index!==r;)t=t.parent;return r===(t!==null?t.index:-1)}return this._appliesToNextNode}matchTNode(e,r){let t=this.metadata.predicate;if(Array.isArray(t))for(let i=0;i<t.length;i++){let o=t[i];this.matchTNodeWithReadOption(e,r,s5(r,o)),this.matchTNodeWithReadOption(e,r,o_(r,e,o,!1,!1))}else t===vo?r.type&4&&this.matchTNodeWithReadOption(e,r,-1):this.matchTNodeWithReadOption(e,r,o_(r,e,t,!1,!1))}matchTNodeWithReadOption(e,r,t){if(t!==null){let i=this.metadata.read;if(i!==null)if(i===oa||i===Ao||i===vo&&r.type&4)this.addMatch(r.index,-2);else{let o=o_(r,e,i,!1,!1);o!==null&&this.addMatch(r.index,o)}else this.addMatch(r.index,t)}}addMatch(e,r){this.matches===null?this.matches=[e,r]:this.matches.push(e,r)}};function s5(n,e){let r=n.localNames;if(r!==null){for(let t=0;t<r.length;t+=2)if(r[t]===e)return r[t+1]}return null}function a5(n,e){return n.type&11?sd(n,e):n.type&4?B_(n,e):null}function c5(n,e,r,t){return r===-1?a5(e,n):r===-2?l5(n,e,t):Vf(n,n[Te],r,e)}function l5(n,e,r){if(r===oa)return sd(e,n);if(r===vo)return B_(e,n);if(r===Ao)return ok(e,n)}function sk(n,e,r,t){let i=e[go].queries[t];if(i.matches===null){let o=n.data,s=r.matches,a=[];for(let c=0;s!==null&&c<s.length;c+=2){let l=s[c];if(l<0)a.push(null);else{let u=o[l];a.push(c5(e,u,s[c+1],r.metadata.read))}}i.matches=a}return i.matches}function DD(n,e,r,t){let i=n.queries.getByIndex(r),o=i.matches;if(o!==null){let s=sk(n,e,i,r);for(let a=0;a<o.length;a+=2){let c=o[a];if(c>0)t.push(s[a/2]);else{let l=o[a+1],u=e[-c];for(let d=jt;d<u.length;d++){let f=u[d];f[Zs]===f[fn]&&DD(f[Te],f,l,t)}if(u[Uc]!==null){let d=u[Uc];for(let f=0;f<d.length;f++){let g=d[f];DD(g[Te],g,l,t)}}}}}return t}function pR(n,e){return n[go].queries[e].queryList}function ak(n,e,r){let t=new f_((r&4)===4);return R0(n,e,t,t.destroy),(e[go]??=new yD).queries.push(new vD(t))-1}function ck(n,e,r){let t=tt();return t.firstCreatePass&&(lk(t,new v_(n,e,r),-1),(e&2)===2&&(t.staticViewQueries=!0)),ak(t,ce(),e)}function u5(n,e,r,t){let i=tt();if(i.firstCreatePass){let o=gn();lk(i,new v_(e,r,t),o.index),h5(i,n),(r&2)===2&&(i.staticContentQueries=!0)}return ak(i,ce(),r)}function d5(n){return n.split(",").map(e=>e.trim())}function lk(n,e,r){n.queries===null&&(n.queries=new SD),n.queries.track(new AD(e,r))}function h5(n,e){let r=n.contentQueries||(n.contentQueries=[]),t=r.length?r[r.length-1]:-1;e!==t&&r.push(n.queries.length-1,e)}function ER(n,e){return n.queries.getByIndex(e)}function uk(n,e){let r=n[Te],t=ER(r,e);return t.crossesNgTemplate?DD(r,n,e,[]):sk(r,n,t,e)}function dk(n,e,r){let t,i=If(()=>{t._dirtyCounter();let o=g5(t,n);if(e&&o===void 0)throw new oe(-951,!1);return o});return t=i[An],t._dirtyCounter=$c(0),t._flatValue=void 0,i}function hk(n){return dk(!0,!1,n)}function fk(n){return dk(!0,!0,n)}function f5(n,e){let r=n[An];r._lView=ce(),r._queryIndex=e,r._queryList=pR(r._lView,e),r._queryList.onDirty(()=>r._dirtyCounter.update(t=>t+1))}function g5(n,e){let r=n._lView,t=n._queryIndex;if(r===void 0||t===void 0||r[Ae]&4)return e?void 0:qn;let i=pR(r,t),o=uk(r,t);return i.reset(o,Wx),e?i.first:i._changesDetected||n._flatValue===void 0?n._flatValue=i.toArray():n._flatValue}function gk(n){let e=[],r=new Map;function t(i){let o=r.get(i);if(!o){let s=n(i);r.set(i,o=s.then(a=>p5(i,a)))}return o}return y_.forEach((i,o)=>{let s=[];i.templateUrl&&s.push(t(i.templateUrl).then(l=>{i.template=l}));let a=typeof i.styles=="string"?[i.styles]:i.styles||[];if(i.styles=a,i.styleUrl&&i.styleUrls?.length)throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple");if(i.styleUrls?.length){let l=i.styles.length,u=i.styleUrls;i.styleUrls.forEach((d,f)=>{a.push(""),s.push(t(d).then(g=>{a[l+f]=g,u.splice(u.indexOf(d),1),u.length==0&&(i.styleUrls=void 0)}))})}else i.styleUrl&&s.push(t(i.styleUrl).then(l=>{a.push(l),i.styleUrl=void 0}));let c=Promise.all(s).then(()=>E5(o));e.push(c)}),mk(),Promise.all(e).then(()=>{})}var y_=new Map,m5=new Set;function mk(){let n=y_;return y_=new Map,n}function pk(){return y_.size===0}function p5(n,e){return typeof e=="string"?e:e.status!==void 0&&e.status!==200?Promise.reject(new oe(918,!1)):e.text()}function E5(n){m5.delete(n)}var qc=class{},Ek=class{};function _k(n,e){return new td(n,e??null,[])}var td=class extends qc{ngModuleType;_parent;_bootstrapComponents=[];_r3Injector;instance;destroyCbs=[];componentFactoryResolver=new T_(this);constructor(e,r,t,i=!0){super(),this.ngModuleType=e,this._parent=r;let o=m0(e);this._bootstrapComponents=cq(o.bootstrap),this._r3Injector=UA(e,r,[{provide:qc,useValue:this},{provide:Kf,useValue:this.componentFactoryResolver},...t],ns(e),new Set(["environment"])),i&&this.resolveInjectorInitializers()}resolveInjectorInitializers(){this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(this.ngModuleType)}get injector(){return this._r3Injector}destroy(){let e=this._r3Injector;!e.destroyed&&e.destroy(),this.destroyCbs.forEach(r=>r()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}},S_=class extends Ek{moduleType;constructor(e){super(),this.moduleType=e}create(e){return new td(this.moduleType,e,[])}};function Tk(n,e,r){return new td(n,e,r,!1)}var A_=class extends qc{injector;componentFactoryResolver=new T_(this);instance=null;constructor(e){super();let r=new bc([...e.providers,{provide:qc,useValue:this},{provide:Kf,useValue:this.componentFactoryResolver}],e.parent||Fu(),e.debugName,new Set(["environment"]));this.injector=r,e.runEnvironmentInitializers&&r.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function Ik(n,e,r=null){return new A_({providers:n,parent:e,debugName:r,runEnvironmentInitializers:!0}).injector}var _5=(()=>{class n{_injector;cachedInjectors=new Map;constructor(r){this._injector=r}getOrCreateStandaloneInjector(r){if(!r.standalone)return null;if(!this.cachedInjectors.has(r)){let t=hA(!1,r.type),i=t.length>0?Ik([t],this._injector,`Standalone[${r.type.name}]`):null;this.cachedInjectors.set(r,i)}return this.cachedInjectors.get(r)}ngOnDestroy(){try{for(let r of this.cachedInjectors.values())r!==null&&r.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:n,providedIn:"environment",factory:()=>new n(w(Kn))})}return n})();function T5(n){return od(()=>{let e=yk(n),r=le(P({},e),{decls:n.decls,vars:n.vars,template:n.template,consts:n.consts||null,ngContentSelectors:n.ngContentSelectors,onPush:n.changeDetection===BD.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&n.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(_5).getOrCreateStandaloneInjector(r):null,getExternalStyles:null,signals:n.signals??!1,data:n.data||{},encapsulation:n.encapsulation||cs.Emulated,styles:n.styles||qn,_:null,schemas:n.schemas||null,tView:null,id:""});e.standalone&&fs("NgStandalone"),Sk(r);let t=n.dependencies;return r.directiveDefs=D_(t,vk),r.pipeDefs=D_(t,dA),r.id=y5(r),r})}function vk(n){return Js(n)||UE(n)}function sa(n){return od(()=>({type:n.type,bootstrap:n.bootstrap||qn,declarations:n.declarations||qn,imports:n.imports||qn,exports:n.exports||qn,transitiveCompileScopes:null,schemas:n.schemas||null,id:n.id||null}))}function I5(n,e){if(n==null)return Ci;let r={};for(let t in n)if(n.hasOwnProperty(t)){let i=n[t],o,s,a,c;Array.isArray(i)?(a=i[0],o=i[1],s=i[2]??o,c=i[3]||null):(o=i,s=i,a=P_.None,c=null),r[o]=[t,a,c],e[o]=s}return r}function v5(n){if(n==null)return Ci;let e={};for(let r in n)n.hasOwnProperty(r)&&(e[n[r]]=r);return e}function Do(n){return od(()=>{let e=yk(n);return Sk(e),e})}function Qf(n){return{type:n.type,name:n.name,factory:null,pure:n.pure!==!1,standalone:n.standalone??!0,onDestroy:n.type.prototype.ngOnDestroy||null}}function yk(n){let e={};return{type:n.type,providersResolver:null,factory:null,hostBindings:n.hostBindings||null,hostVars:n.hostVars||0,hostAttrs:n.hostAttrs||null,contentQueries:n.contentQueries||null,declaredInputs:e,inputConfig:n.inputs||Ci,exportAs:n.exportAs||null,standalone:n.standalone??!0,signals:n.signals===!0,selectors:n.selectors||qn,viewQuery:n.viewQuery||null,features:n.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,inputs:I5(n.inputs,e),outputs:v5(n.outputs),debugInfo:null}}function Sk(n){n.features?.forEach(e=>e(n))}function D_(n,e){return n?()=>{let r=typeof n=="function"?n():n,t=[];for(let i of r){let o=e(i);o!==null&&t.push(o)}return t}:null}function y5(n){let e=0,r=typeof n.consts=="function"?"":n.consts,t=[n.selectors,n.ngContentSelectors,n.hostVars,n.hostAttrs,r,n.vars,n.decls,n.encapsulation,n.standalone,n.signals,n.exportAs,JSON.stringify(n.inputs),JSON.stringify(n.outputs),Object.getOwnPropertyNames(n.type.prototype),!!n.contentQueries,!!n.viewQuery];for(let o of t.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function S5(n){return Object.getPrototypeOf(n.prototype).constructor}function Ak(n){let e=S5(n.type),r=!0,t=[n];for(;e;){let i;if(wi(n))i=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new oe(903,!1);i=e.\u0275dir}if(i){if(r){t.push(i);let s=n;s.inputs=zA(n.inputs),s.declaredInputs=zA(n.declaredInputs),s.outputs=zA(n.outputs);let a=i.hostBindings;a&&N5(n,a);let c=i.viewQuery,l=i.contentQueries;if(c&&R5(n,c),l&&C5(n,l),A5(n,i),s0(n.outputs,i.outputs),wi(i)&&i.data.animation){let u=n.data;u.animation=(u.animation||[]).concat(i.data.animation)}}let o=i.features;if(o)for(let s=0;s<o.length;s++){let a=o[s];a&&a.ngInherit&&a(n),a===Ak&&(r=!1)}}e=Object.getPrototypeOf(e)}D5(t)}function A5(n,e){for(let r in e.inputs){if(!e.inputs.hasOwnProperty(r)||n.inputs.hasOwnProperty(r))continue;let t=e.inputs[r];t!==void 0&&(n.inputs[r]=t,n.declaredInputs[r]=e.declaredInputs[r])}}function D5(n){let e=0,r=null;for(let t=n.length-1;t>=0;t--){let i=n[t];i.hostVars=e+=i.hostVars,i.hostAttrs=Ku(i.hostAttrs,r=Ku(r,i.hostAttrs))}}function zA(n){return n===Ci?{}:n===qn?[]:n}function R5(n,e){let r=n.viewQuery;r?n.viewQuery=(t,i)=>{e(t,i),r(t,i)}:n.viewQuery=e}function C5(n,e){let r=n.contentQueries;r?n.contentQueries=(t,i,o)=>{e(t,i,o),r(t,i,o)}:n.contentQueries=e}function N5(n,e){let r=n.hostBindings;r?n.hostBindings=(t,i)=>{e(t,i),r(t,i)}:n.hostBindings=e}function O5(n){let e=r=>{let t=Array.isArray(n);r.hostDirectives===null?(r.resolveHostDirectives=w5,r.hostDirectives=t?n.map(RD):[n]):t?r.hostDirectives.unshift(...n.map(RD)):r.hostDirectives.unshift(n)};return e.ngInherit=!0,e}function w5(n){let e=[],r=!1,t=null,i=null;for(let o=0;o<n.length;o++){let s=n[o];if(s.hostDirectives!==null){let a=e.length;t??=new Map,i??=new Map,Dk(s,e,t),i.set(s,[a,e.length-1])}o===0&&wi(s)&&(r=!0,e.push(s))}for(let o=r?1:0;o<n.length;o++)e.push(n[o]);return[e,t,i]}function Dk(n,e,r){if(n.hostDirectives!==null)for(let t of n.hostDirectives)if(typeof t=="function"){let i=t();for(let o of i)Tx(RD(o),e,r)}else Tx(t,e,r)}function Tx(n,e,r){let t=UE(n.directive);b5(t.declaredInputs,n.inputs),Dk(t,e,r),r.set(t,n),e.push(t)}function RD(n){return typeof n=="function"?{directive:hn(n),inputs:Ci,outputs:Ci}:{directive:hn(n.directive),inputs:Ix(n.inputs),outputs:Ix(n.outputs)}}function Ix(n){if(n===void 0||n.length===0)return Ci;let e={};for(let r=0;r<n.length;r+=2)e[n[r]]=n[r+1];return e}function b5(n,e){for(let r in e)if(e.hasOwnProperty(r)){let t=e[r],i=n[r];n[t]=i}}function Rk(n,e,r,t,i,o,s,a){if(r.firstCreatePass){n.mergedAttrs=Ku(n.mergedAttrs,n.attrs);let u=n.tView=XD(2,n,i,o,s,r.directiveRegistry,r.pipeRegistry,null,r.schemas,r.consts,null);r.queries!==null&&(r.queries.template(r,n),u.queries=r.queries.embeddedTView(n))}a&&(n.flags|=a),Gc(n,!1);let c=M5(r,e,n,t);KE()&&oR(r,e,c,n),Yu(c,e);let l=WF(c,e,c,n);e[t+et]=l,ZD(e,l),i5(l,n,e)}function L5(n,e,r,t,i,o,s,a,c,l,u){let d=r+et,f;return e.firstCreatePass?(f=Qc(e,d,4,s||null,a||null),jE()&&JF(e,n,f,Ur(e.consts,l),aR),Px(e,f)):f=e.data[d],Rk(f,n,e,r,t,i,o,c),Vu(f)&&U_(e,n,f),l!=null&&Wf(n,f,u),f}function nd(n,e,r,t,i,o,s,a,c,l,u){let d=r+et,f;if(e.firstCreatePass){if(f=Qc(e,d,4,s||null,a||null),l!=null){let g=Ur(e.consts,l);f.localNames=[];for(let p=0;p<g.length;p+=2)f.localNames.push(g[p],-1)}}else f=e.data[d];return Rk(f,n,e,r,t,i,o,c),l!=null&&Wf(n,f,u),f}function Ck(n,e,r,t,i,o,s,a){let c=ce(),l=tt(),u=Ur(l.consts,o);return L5(c,l,n,e,r,t,i,u,void 0,s,a),Ck}function Nk(n,e,r,t,i,o,s,a){let c=ce(),l=tt(),u=Ur(l.consts,o);return nd(c,l,n,e,r,t,i,u,void 0,s,a),Nk}var M5=P5;function P5(n,e,r,t){return xf(!0),e[Ze].createComment("")}var H_=new Z(""),cd=new Z(""),Xf=(()=>{class n{_ngZone;registry;_isZoneStable=!0;_callbacks=[];_taskTrackingZone=null;_destroyRef;constructor(r,t,i){this._ngZone=r,this.registry=t,mA()&&(this._destroyRef=ne(ar,{optional:!0})??void 0),_R||(Ok(i),i.addToWindow(t)),this._watchAngularEvents(),r.run(()=>{this._taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){let r=this._ngZone.onUnstable.subscribe({next:()=>{this._isZoneStable=!1}}),t=this._ngZone.runOutsideAngular(()=>this._ngZone.onStable.subscribe({next:()=>{be.assertNotInAngularZone(),queueMicrotask(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}}));this._destroyRef?.onDestroy(()=>{r.unsubscribe(),t.unsubscribe()})}isStable(){return this._isZoneStable&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())queueMicrotask(()=>{for(;this._callbacks.length!==0;){let r=this._callbacks.pop();clearTimeout(r.timeoutId),r.doneCb()}});else{let r=this.getPendingTasks();this._callbacks=this._callbacks.filter(t=>t.updateCb&&t.updateCb(r)?(clearTimeout(t.timeoutId),!1):!0)}}getPendingTasks(){return this._taskTrackingZone?this._taskTrackingZone.macroTasks.map(r=>({source:r.source,creationLocation:r.creationLocation,data:r.data})):[]}addCallback(r,t,i){let o=-1;t&&t>0&&(o=setTimeout(()=>{this._callbacks=this._callbacks.filter(s=>s.timeoutId!==o),r()},t)),this._callbacks.push({doneCb:r,timeoutId:o,updateCb:i})}whenStable(r,t,i){if(i&&!this._taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(r,t,i),this._runCallbacksIfReady()}registerApplication(r){this.registry.registerApplication(r,this)}unregisterApplication(r){this.registry.unregisterApplication(r)}findProviders(r,t,i){return[]}static \u0275fac=function(t){return new(t||n)(w(be),w(Jf),w(cd))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),Jf=(()=>{class n{_applications=new Map;registerApplication(r,t){this._applications.set(r,t)}unregisterApplication(r){this._applications.delete(r)}unregisterAllApplications(){this._applications.clear()}getTestability(r){return this._applications.get(r)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(r,t=!0){return _R?.findTestabilityInTree(this,r,t)??null}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"platform"})}return n})();function Ok(n){_R=n}var _R;function W_(n){return!!n&&typeof n.then=="function"}function TR(n){return!!n&&typeof n.subscribe=="function"}var wk=new Z("");var IR=(()=>{class n{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((r,t)=>{this.resolve=r,this.reject=t});appInits=ne(wk,{optional:!0})??[];injector=ne(St);constructor(){}runInitializers(){if(this.initialized)return;let r=[];for(let i of this.appInits){let o=ho(this.injector,i);if(W_(o))r.push(o);else if(TR(o)){let s=new Promise((a,c)=>{o.subscribe({complete:a,error:c})});r.push(s)}}let t=()=>{this.done=!0,this.resolve()};Promise.all(r).then(()=>{t()}).catch(i=>{this.reject(i)}),r.length===0&&t(),this.initialized=!0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),bk=new Z("");function Lk(){PS(()=>{let n="";throw new oe(600,n)})}function Mk(n){return n.isBoundToModule}var x5=10;function vR(n,e){return Array.isArray(e)?e.reduce(vR,n):P(P({},n),e)}var aa=(()=>{class n{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=ne(Eo);afterRenderManager=ne(rR);zonelessEnabled=ne(Wu);rootEffectScheduler=ne(Ff);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new Ot;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=ne(ra);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(fe(r=>!r))}constructor(){ne(Yc,{optional:!0})}whenStable(){let r;return new Promise(t=>{r=this.isStable.subscribe({next:i=>{i&&t()}})}).finally(()=>{r.unsubscribe()})}_injector=ne(Kn);_rendererFactory=null;get injector(){return this._injector}bootstrap(r,t){return this.bootstrapImpl(r,t)}bootstrapImpl(r,t,i=St.NULL){return this._injector.get(be).run(()=>{lt(10);let s=r instanceof G_;if(!this._injector.get(IR).done){let p="";throw new oe(405,p)}let c;s?c=r:c=this._injector.get(Kf).resolveComponentFactory(r),this.componentTypes.push(c.componentType);let l=Mk(c)?void 0:this._injector.get(qc),u=t||c.selector,d=c.create(i,[],u,l),f=d.location.nativeElement,g=d.injector.get(H_,null);return g?.registerApplication(f),d.onDestroy(()=>{this.detachView(d.hostView),Uf(this.components,d),g?.unregisterApplication(f)}),this._loadComponent(d),lt(11,d),d})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){lt(12),this.tracingSnapshot!==null?this.tracingSnapshot.run(x_.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw new oe(101,!1);let r=Se(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,Se(r),this.afterTick.next(),lt(13)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(us,null,{optional:!0}));let r=0;for(;this.dirtyFlags!==0&&r++<x5;)lt(14),this.synchronizeOnce(),lt(15)}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let r=!1;if(this.dirtyFlags&7){let t=!!(this.dirtyFlags&1);this.dirtyFlags&=-8,this.dirtyFlags|=8;for(let{_lView:i}of this.allViews){if(!t&&!Gu(i))continue;let o=t&&!this.zonelessEnabled?0:1;GF(i,o),r=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}r||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:r})=>Gu(r))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(r){let t=r;this._views.push(t),t.attachToAppRef(this)}detachView(r){let t=r;Uf(this._views,t),t.detachFromAppRef()}_loadComponent(r){this.attachView(r.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(r),this._injector.get(bk,[]).forEach(i=>i(r))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(r=>r()),this._views.slice().forEach(r=>r.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(r){return this._destroyListeners.push(r),()=>Uf(this._destroyListeners,r)}destroy(){if(this._destroyed)throw new oe(406,!1);let r=this._injector;r.destroy&&!r.destroyed&&r.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Uf(n,e){let r=n.indexOf(e);r>-1&&n.splice(r,1)}function Pk(n,e){let r=ce(),t=po();if(Pn(r,t,e)){let i=tt(),o=ju();if(V_(o,i,r,n,e))ss(o)&&PF(r,o.index);else{let a=ni(o,r);xF(r[Ze],a,null,o.value,n,e,null)}}return Pk}function xk(n,e,r,t){let i=ce(),o=po();if(Pn(i,o,e)){let s=tt(),a=ju();n8(a,i,n,e,r,t)}return xk}var Lpe=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";function F5(){return ce()[Yn][$t]}var CD=class{destroy(e){}updateValue(e,r){}swap(e,r){let t=Math.min(e,r),i=Math.max(e,r),o=this.detach(i);if(i-t>1){let s=this.detach(t);this.attach(t,o),this.attach(i,s)}else this.attach(t,o)}move(e,r){this.attach(r,this.detach(e))}};function qA(n,e,r,t,i){return n===r&&Object.is(e,t)?1:Object.is(i(n,e),i(r,t))?-1:0}function k5(n,e,r){let t,i,o=0,s=n.length-1,a=void 0;if(Array.isArray(e)){let c=e.length-1;for(;o<=s&&o<=c;){let l=n.at(o),u=e[o],d=qA(o,l,o,u,r);if(d!==0){d<0&&n.updateValue(o,u),o++;continue}let f=n.at(s),g=e[c],p=qA(s,f,c,g,r);if(p!==0){p<0&&n.updateValue(s,g),s--,c--;continue}let _=r(o,l),T=r(s,f),S=r(o,u);if(Object.is(S,T)){let b=r(c,g);Object.is(b,_)?(n.swap(o,s),n.updateValue(s,g),c--,s--):n.move(s,o),n.updateValue(o,u),o++;continue}if(t??=new R_,i??=yx(n,o,s,r),ND(n,t,o,S))n.updateValue(o,u),o++,s++;else if(i.has(S))t.set(_,n.detach(o)),s--;else{let b=n.create(o,e[o]);n.attach(o,b),o++,s++}}for(;o<=c;)vx(n,t,r,o,e[o]),o++}else if(e!=null){let c=e[Symbol.iterator](),l=c.next();for(;!l.done&&o<=s;){let u=n.at(o),d=l.value,f=qA(o,u,o,d,r);if(f!==0)f<0&&n.updateValue(o,d),o++,l=c.next();else{t??=new R_,i??=yx(n,o,s,r);let g=r(o,d);if(ND(n,t,o,g))n.updateValue(o,d),o++,s++,l=c.next();else if(!i.has(g))n.attach(o,n.create(o,d)),o++,s++,l=c.next();else{let p=r(o,u);t.set(p,n.detach(o)),s--}}}for(;!l.done;)vx(n,t,r,n.length,l.value),l=c.next()}for(;o<=s;)n.destroy(n.detach(s--));t?.forEach(c=>{n.destroy(c)})}function ND(n,e,r,t){return e!==void 0&&e.has(t)?(n.attach(r,e.get(t)),e.delete(t),!0):!1}function vx(n,e,r,t,i){if(ND(n,e,t,r(t,i)))n.updateValue(t,i);else{let o=n.create(t,i);n.attach(t,o)}}function yx(n,e,r,t){let i=new Set;for(let o=e;o<=r;o++)i.add(t(o,n.at(o)));return i}var R_=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let r=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(r)?(this.kvMap.set(e,this._vMap.get(r)),this._vMap.delete(r)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,r){if(this.kvMap.has(e)){let t=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let i=this._vMap;for(;i.has(t);)t=i.get(t);i.set(t,r)}else this.kvMap.set(e,r)}forEach(e){for(let[r,t]of this.kvMap)if(e(t,r),this._vMap!==void 0){let i=this._vMap;for(;i.has(t);)t=i.get(t),e(t,r)}}};function U5(n,e,r,t,i,o,s,a){fs("NgControlFlow");let c=ce(),l=tt(),u=Ur(l.consts,o);return nd(c,l,n,e,r,t,i,u,256,s,a),yR}function yR(n,e,r,t,i,o,s,a){fs("NgControlFlow");let c=ce(),l=tt(),u=Ur(l.consts,o);return nd(c,l,n,e,r,t,i,u,512,s,a),yR}function V5(n,e){fs("NgControlFlow");let r=ce(),t=po(),i=r[t]!==Rn?r[t]:-1,o=i!==-1?C_(r,et+i):void 0,s=0;if(Pn(r,t,n)){let a=Se(null);try{if(o!==void 0&&qF(o,s),n!==-1){let c=et+n,l=C_(r,c),u=LD(r[Te],c),d=YF(l,u,r),f=zf(r,u,e,{dehydratedView:d});qf(l,f,s,Xu(u,d))}}finally{Se(a)}}else if(o!==void 0){let a=zF(o,s);a!==void 0&&(a[$t]=e)}}var OD=class{lContainer;$implicit;$index;constructor(e,r,t){this.lContainer=e,this.$implicit=r,this.$index=t}get $count(){return this.lContainer.length-jt}};function B5(n){return n}function G5(n,e){return e}var wD=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,r,t){this.hasEmptyBlock=e,this.trackByFn=r,this.liveCollection=t}};function $5(n,e,r,t,i,o,s,a,c,l,u,d,f){fs("NgControlFlow");let g=ce(),p=tt(),_=c!==void 0,T=ce(),S=a?s.bind(T[Yn][$t]):s,b=new wD(_,S);T[et+n]=b,nd(g,p,n+1,e,r,t,i,Ur(p.consts,o),256),_&&nd(g,p,n+2,c,l,u,d,Ur(p.consts,f),512)}var bD=class extends CD{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,r,t){super(),this.lContainer=e,this.hostLView=r,this.templateTNode=t}get length(){return this.lContainer.length-jt}at(e){return this.getLView(e)[$t].$implicit}attach(e,r){let t=r[Mc];this.needsIndexUpdate||=e!==this.length,qf(this.lContainer,r,e,Xu(this.templateTNode,t)),H5(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,W5(this.lContainer,e),z5(this.lContainer,e)}create(e,r){let t=E_(this.lContainer,this.templateTNode.tView.ssrId),i=zf(this.hostLView,this.templateTNode,new OD(this.lContainer,r,e),{dehydratedView:t});return this.operationsCounter?.recordCreate(),i}destroy(e){F_(e[Te],e),this.operationsCounter?.recordDestroy()}updateValue(e,r){this.getLView(e)[$t].$implicit=r}reset(){this.needsIndexUpdate=!1,this.operationsCounter?.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let e=0;e<this.length;e++)this.getLView(e)[$t].$index=e}getLView(e){return q5(this.lContainer,e)}};function j5(n){let e=Se(null),r=ii();try{let t=ce(),i=t[Te],o=t[r],s=r+1,a=C_(t,s);if(o.liveCollection===void 0){let l=LD(i,s);o.liveCollection=new bD(a,t,l)}else o.liveCollection.reset();let c=o.liveCollection;if(k5(c,n,o.trackByFn),c.updateIndexes(),o.hasEmptyBlock){let l=po(),u=c.length===0;if(Pn(t,l,u)){let d=r+2,f=C_(t,d);if(u){let g=LD(i,d),p=YF(f,g,t),_=zf(t,g,void 0,{dehydratedView:p});qf(f,_,0,Xu(g,p))}else i.firstUpdatePass&&C8(f),qF(f,0)}}}finally{Se(e)}}function C_(n,e){return n[e]}function H5(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r],i=t?t[kc]:void 0;if(t&&i&&i.detachedLeaveAnimationFns&&i.detachedLeaveAnimationFns.length>0){let o=t[is];xq(o,i),zc.delete(t),i.detachedLeaveAnimationFns=void 0}}function W5(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r],i=t?t[kc]:void 0;i&&i.leave&&i.leave.size>0&&(i.detachedLeaveAnimationFns=[])}function z5(n,e){return Gf(n,e)}function q5(n,e){return zF(n,e)}function LD(n,e){return bf(n,e)}function Fk(n,e,r){let t=ce(),i=po();if(Pn(t,i,e)){let o=tt(),s=ju();LF(s,t,n,e,t[Ze],r)}return Fk}function MD(n,e,r,t,i){V_(e,n,r,i?"class":"style",t)}function SR(n,e,r,t){let i=ce(),o=i[Te],s=n+et,a=o.firstCreatePass?hR(s,i,2,e,aR,jE(),r,t):o.data[s];if(cR(a,i,n,e,Vk),Vu(a)){let c=i[Te];U_(c,i,a),jD(c,a,i)}return t!=null&&Wf(i,a),SR}function AR(){let n=tt(),e=gn(),r=lR(e);return n.firstCreatePass&&fR(n,r),NA(r)&&OA(),RA(),r.classesWithoutHost!=null&&i4(r)&&MD(n,r,ce(),r.classesWithoutHost,!0),r.stylesWithoutHost!=null&&o4(r)&&MD(n,r,ce(),r.stylesWithoutHost,!1),AR}function kk(n,e,r,t){return SR(n,e,r,t),AR(),kk}function DR(n,e,r,t){let i=ce(),o=i[Te],s=n+et,a=o.firstCreatePass?$8(s,o,2,e,r,t):o.data[s];return cR(a,i,n,e,Vk),t!=null&&Wf(i,a),DR}function RR(){let n=gn(),e=lR(n);return NA(e)&&OA(),RA(),RR}function Uk(n,e,r,t){return DR(n,e,r,t),RR(),Uk}var Vk=(n,e,r,t,i)=>(xf(!0),lF(e[Ze],t,j0()));function CR(n,e,r){let t=ce(),i=t[Te],o=n+et,s=i.firstCreatePass?hR(o,t,8,"ng-container",aR,jE(),e,r):i.data[o];if(cR(s,t,n,"ng-container",K5),Vu(s)){let a=t[Te];U_(a,t,s),jD(a,s,t)}return r!=null&&Wf(t,s),CR}function NR(){let n=tt(),e=gn(),r=lR(e);return n.firstCreatePass&&fR(n,r),NR}function Bk(n,e,r){return CR(n,e,r),NR(),Bk}var K5=(n,e,r,t,i)=>(xf(!0),eq(e[Ze],""));function Y5(){return ce()}function Gk(n,e,r){let t=ce(),i=po();if(Pn(t,i,e)){let o=tt(),s=ju();MF(s,t,n,e,t[Ze],r)}return Gk}var e_=void 0;function Q5(n){let e=Math.floor(Math.abs(n)),r=n.toString().replace(/^[^.]*\.?/,"").length;return e===1&&r===0?1:5}var X5=["en",[["a","p"],["AM","PM"]],[["AM","PM"]],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],e_,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],e_,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm a","h:mm:ss a","h:mm:ss a z","h:mm:ss a zzzz"],["{1}, {0}",e_,"{1} 'at' {0}",e_],[".",",",";","%","+","-","E","\xD7","\u2030","\u221E","NaN",":"],["#,##0.###","#,##0%","\xA4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",Q5],KA={};function Br(n){let e=J5(n),r=Sx(e);if(r)return r;let t=e.split("-")[0];if(r=Sx(t),r)return r;if(t==="en")return X5;throw new oe(701,!1)}function Sx(n){return n in KA||(KA[n]=tn.ng&&tn.ng.common&&tn.ng.common.locales&&tn.ng.common.locales[n]),KA[n]}var Yt=(function(n){return n[n.LocaleId=0]="LocaleId",n[n.DayPeriodsFormat=1]="DayPeriodsFormat",n[n.DayPeriodsStandalone=2]="DayPeriodsStandalone",n[n.DaysFormat=3]="DaysFormat",n[n.DaysStandalone=4]="DaysStandalone",n[n.MonthsFormat=5]="MonthsFormat",n[n.MonthsStandalone=6]="MonthsStandalone",n[n.Eras=7]="Eras",n[n.FirstDayOfWeek=8]="FirstDayOfWeek",n[n.WeekendRange=9]="WeekendRange",n[n.DateFormat=10]="DateFormat",n[n.TimeFormat=11]="TimeFormat",n[n.DateTimeFormat=12]="DateTimeFormat",n[n.NumberSymbols=13]="NumberSymbols",n[n.NumberFormats=14]="NumberFormats",n[n.CurrencyCode=15]="CurrencyCode",n[n.CurrencySymbol=16]="CurrencySymbol",n[n.CurrencyName=17]="CurrencyName",n[n.Currencies=18]="Currencies",n[n.Directionality=19]="Directionality",n[n.PluralCase=20]="PluralCase",n[n.ExtraData=21]="ExtraData",n})(Yt||{});function J5(n){return n.toLowerCase().replace(/_/g,"-")}var Zf="en-US";var Z5=Zf;function $k(n){typeof n=="string"&&(Z5=n.toLowerCase().replace(/_/g,"-"))}function jk(n,e,r){let t=ce(),i=tt(),o=gn();return Wk(i,t,t[Ze],o,n,e,r),jk}function Hk(n,e,r){let t=ce(),i=tt(),o=gn();return(o.type&3||r)&&tk(o,i,t,r,t[Ze],n,e,a_(o,t,e)),Hk}function Wk(n,e,r,t,i,o,s){let a=!0,c=null;if((t.type&3||s)&&(c??=a_(t,e,o),tk(t,n,e,s,r,i,o,c)&&(a=!1)),a){let l=t.outputs?.[i],u=t.hostDirectiveOutputs?.[i];if(u&&u.length)for(let d=0;d<u.length;d+=2){let f=u[d],g=u[d+1];c??=a_(t,e,o),px(t,e,f,g,i,c)}if(l&&l.length)for(let d of l)c??=a_(t,e,o),px(t,e,d,i,i,c)}}function e9(n=1){return B0(n)}function t9(n,e){let r=null,t=gq(n);for(let i=0;i<e.length;i++){let o=e[i];if(o==="*"){r=i;continue}if(t===null?gF(n,o,!0):Eq(t,o))return i}return r}function n9(n){let e=ce()[Yn][or];if(!e.projection){let r=n?n.length:1,t=e.projection=f0(r,null),i=t.slice(),o=e.child;for(;o!==null;){if(o.type!==128){let s=n?t9(o,n):0;s!==null&&(i[s]?i[s].projectionNext=o:t[s]=o,i[s]=o)}o=o.next}}}function r9(n,e=0,r,t,i,o){let s=ce(),a=tt(),c=t?n+1:null;c!==null&&nd(s,a,c,t,i,o,null,r);let l=Qc(a,et+n,16,null,r||null);l.projection===null&&(l.projection=e),LA();let d=!s[Mc]||CA();s[Yn][or].projection[l.projection]===null&&c!==null?i9(s,a,c):d&&!b_(l)&&zq(a,s,l)}function i9(n,e,r){let t=et+r,i=e.data[t],o=n[t],s=E_(o,i.tView.ssrId),a=zf(n,i,void 0,{dehydratedView:s});qf(o,a,0,Xu(i,s))}function o9(n,e,r,t){u5(n,e,r,t)}function s9(n,e,r){ck(n,e,r)}function a9(n){let e=ce(),r=tt(),t=WE();Pf(t+1);let i=ER(r,t);if(n.dirty&&y0(e)===((i.metadata.flags&2)===2)){if(i.matches===null)n.reset([]);else{let o=uk(e,t);n.reset(o,Wx),n.notifyOnChanges()}return!0}return!1}function c9(){return pR(ce(),WE())}function l9(n,e,r,t){f5(n,ck(e,r,t))}function u9(n=1){Pf(WE()+n)}function d9(n){let e=MA();return Bc(e,et+n)}function t_(n,e){return n<<17|e<<2}function Kc(n){return n>>17&32767}function h9(n){return(n&2)==2}function f9(n,e){return n&131071|e<<17}function PD(n){return n|2}function rd(n){return(n&131068)>>2}function YA(n,e){return n&-131069|e<<2}function g9(n){return(n&1)===1}function xD(n){return n|1}function m9(n,e,r,t,i,o){let s=o?e.classBindings:e.styleBindings,a=Kc(s),c=rd(s);n[t]=r;let l=!1,u;if(Array.isArray(r)){let d=r;u=d[1],(u===null||xu(d,u)>0)&&(l=!0)}else u=r;if(i)if(c!==0){let f=Kc(n[a+1]);n[t+1]=t_(f,a),f!==0&&(n[f+1]=YA(n[f+1],t)),n[a+1]=f9(n[a+1],t)}else n[t+1]=t_(a,0),a!==0&&(n[a+1]=YA(n[a+1],t)),a=t;else n[t+1]=t_(c,0),a===0?a=t:n[c+1]=YA(n[c+1],t),c=t;l&&(n[t+1]=PD(n[t+1])),Ax(n,u,t,!0),Ax(n,u,t,!1),p9(e,u,n,t,o),s=t_(a,c),o?e.classBindings=s:e.styleBindings=s}function p9(n,e,r,t,i){let o=i?n.residualClasses:n.residualStyles;o!=null&&typeof e=="string"&&xu(o,e)>=0&&(r[t+1]=xD(r[t+1]))}function Ax(n,e,r,t){let i=n[r+1],o=e===null,s=t?Kc(i):rd(i),a=!1;for(;s!==0&&(a===!1||o);){let c=n[s],l=n[s+1];E9(c,e)&&(a=!0,n[s+1]=t?xD(l):PD(l)),s=t?Kc(l):rd(l)}a&&(n[r+1]=t?PD(i):xD(i))}function E9(n,e){return n===null||e==null||(Array.isArray(n)?n[1]:n)===e?!0:Array.isArray(n)&&typeof e=="string"?xu(n,e)>=0:!1}var mn={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function zk(n){return n.substring(mn.key,mn.keyEnd)}function _9(n){return n.substring(mn.value,mn.valueEnd)}function T9(n){return Yk(n),qk(n,id(n,0,mn.textEnd))}function qk(n,e){let r=mn.textEnd;return r===e?-1:(e=mn.keyEnd=v9(n,mn.key=e,r),id(n,e,r))}function I9(n){return Yk(n),Kk(n,id(n,0,mn.textEnd))}function Kk(n,e){let r=mn.textEnd,t=mn.key=id(n,e,r);return r===t?-1:(t=mn.keyEnd=y9(n,t,r),t=Dx(n,t,r,58),t=mn.value=id(n,t,r),t=mn.valueEnd=S9(n,t,r),Dx(n,t,r,59))}function Yk(n){mn.key=0,mn.keyEnd=0,mn.value=0,mn.valueEnd=0,mn.textEnd=n.length}function id(n,e,r){for(;e<r&&n.charCodeAt(e)<=32;)e++;return e}function v9(n,e,r){for(;e<r&&n.charCodeAt(e)>32;)e++;return e}function y9(n,e,r){let t;for(;e<r&&((t=n.charCodeAt(e))===45||t===95||(t&-33)>=65&&(t&-33)<=90||t>=48&&t<=57);)e++;return e}function Dx(n,e,r,t){return e=id(n,e,r),e<r&&e++,e}function S9(n,e,r){let t=-1,i=-1,o=-1,s=e,a=s;for(;s<r;){let c=n.charCodeAt(s++);if(c===59)return a;c===34||c===39?a=s=Rx(n,c,s,r):e===s-4&&o===85&&i===82&&t===76&&c===40?a=s=Rx(n,41,s,r):c>32&&(a=s),o=i,i=t,t=c&-33}return a}function Rx(n,e,r,t){let i=-1,o=r;for(;o<t;){let s=n.charCodeAt(o++);if(s==e&&i!==92)return o;s==92&&i===92?i=0:i=s}throw new Error}function Qk(n,e,r){return Jk(n,e,r,!1),Qk}function Xk(n,e){return Jk(n,e,null,!0),Xk}function A9(n){Zk(nU,D9,n,!1)}function D9(n,e){for(let r=I9(e);r>=0;r=Kk(e,r))nU(n,zk(e),_9(e))}function R9(n){Zk(M9,C9,n,!0)}function C9(n,e){for(let r=T9(e);r>=0;r=qk(e,r))Cf(n,zk(e),!0)}function Jk(n,e,r,t){let i=ce(),o=tt(),s=Mf(2);if(o.firstUpdatePass&&tU(o,n,s,t),e!==Rn&&Pn(i,s,e)){let a=o.data[ii()];rU(o,a,i,i[Ze],n,i[s+1]=x9(e,r),t,s)}}function Zk(n,e,r,t){let i=tt(),o=Mf(2);i.firstUpdatePass&&tU(i,null,o,t);let s=ce();if(r!==Rn&&Pn(s,o,r)){let a=i.data[ii()];if(iU(a,t)&&!eU(i,o)){let c=t?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(r=bE(c,r||"")),MD(i,a,s,r,t)}else P9(i,a,s,s[Ze],s[o+1],s[o+1]=L9(n,e,r),t,o)}}function eU(n,e){return e>=n.expandoStartIndex}function tU(n,e,r,t){let i=n.data;if(i[r+1]===null){let o=i[ii()],s=eU(n,r);iU(o,t)&&e===null&&!s&&(e=!1),e=N9(i,o,e,t),m9(i,o,e,r,s,t)}}function N9(n,e,r,t){let i=F0(n),o=t?e.residualClasses:e.residualStyles;if(i===null)(t?e.classBindings:e.styleBindings)===0&&(r=QA(null,n,e,r,t),r=$f(r,e.attrs,t),o=null);else{let s=e.directiveStylingLast;if(s===-1||n[s]!==i)if(r=QA(i,n,e,r,t),o===null){let c=O9(n,e,t);c!==void 0&&Array.isArray(c)&&(c=QA(null,n,e,c[1],t),c=$f(c,e.attrs,t),w9(n,e,t,c))}else o=b9(n,e,t)}return o!==void 0&&(t?e.residualClasses=o:e.residualStyles=o),r}function O9(n,e,r){let t=r?e.classBindings:e.styleBindings;if(rd(t)!==0)return n[Kc(t)]}function w9(n,e,r,t){let i=r?e.classBindings:e.styleBindings;n[Kc(i)]=t}function b9(n,e,r){let t,i=e.directiveEnd;for(let o=1+e.directiveStylingLast;o<i;o++){let s=n[o].hostAttrs;t=$f(t,s,r)}return $f(t,e.attrs,r)}function QA(n,e,r,t,i){let o=null,s=r.directiveEnd,a=r.directiveStylingLast;for(a===-1?a=r.directiveStart:a++;a<s&&(o=e[a],t=$f(t,o.hostAttrs,i),o!==n);)a++;return n!==null&&(r.directiveStylingLast=a),t}function $f(n,e,r){let t=r?1:2,i=-1;if(e!==null)for(let o=0;o<e.length;o++){let s=e[o];typeof s=="number"?i=s:i===t&&(Array.isArray(n)||(n=n===void 0?[]:["",n]),Cf(n,s,r?!0:e[++o]))}return n===void 0?null:n}function L9(n,e,r){if(r==null||r==="")return qn;let t=[],i=Vr(r);if(Array.isArray(i))for(let o=0;o<i.length;o++)n(t,i[o],!0);else if(typeof i=="object")for(let o in i)i.hasOwnProperty(o)&&n(t,o,i[o]);else typeof i=="string"&&e(t,i);return t}function nU(n,e,r){Cf(n,e,Vr(r))}function M9(n,e,r){let t=String(e);t!==""&&!t.includes(" ")&&Cf(n,t,r)}function P9(n,e,r,t,i,o,s,a){i===Rn&&(i=qn);let c=0,l=0,u=0<i.length?i[0]:null,d=0<o.length?o[0]:null;for(;u!==null||d!==null;){let f=c<i.length?i[c+1]:void 0,g=l<o.length?o[l+1]:void 0,p=null,_;u===d?(c+=2,l+=2,f!==g&&(p=d,_=g)):d===null||u!==null&&u<d?(c+=2,p=u):(l+=2,p=d,_=g),p!==null&&rU(n,e,r,t,p,_,s,a),u=c<i.length?i[c]:null,d=l<o.length?o[l]:null}}function rU(n,e,r,t,i,o,s,a){if(!(e.type&3))return;let c=n.data,l=c[a+1],u=g9(l)?Cx(c,e,r,i,rd(l),s):void 0;if(!N_(u)){N_(o)||h9(l)&&(o=Cx(c,null,r,i,a,s));let d=vA(ii(),r);Kq(t,s,d,i,o)}}function Cx(n,e,r,t,i,o){let s=e===null,a;for(;i>0;){let c=n[i],l=Array.isArray(c),u=l?c[1]:c,d=u===null,f=r[i+1];f===Rn&&(f=d?qn:void 0);let g=d?kE(f,t):u===t?f:void 0;if(l&&!N_(g)&&(g=kE(c,t)),N_(g)&&(a=g,s))return a;let p=n[i+1];i=s?Kc(p):rd(p)}if(e!==null){let c=o?e.residualClasses:e.residualStyles;c!=null&&(a=kE(c,t))}return a}function N_(n){return n!==void 0}function x9(n,e){return n==null||n===""||(typeof e=="string"?n=n+e:typeof n=="object"&&(n=ns(Vr(n)))),n}function iU(n,e){return(n.flags&(e?8:16))!==0}function F9(n,e=""){let r=ce(),t=tt(),i=n+et,o=t.firstCreatePass?Qc(t,i,1,e,null):t.data[i],s=k9(t,r,o,e,n);r[i]=s,KE()&&oR(t,r,s,o),Gc(o,!1)}var k9=(n,e,r,t,i)=>(xf(!0),J4(e[Ze],t));function oU(n,e,r,t=""){return Pn(n,po(),r)?e+Fr(r)+t:Rn}function U9(n,e,r,t,i,o=""){let s=xA(),a=Ju(n,s,r,i);return Mf(2),a?e+Fr(r)+t+Fr(i)+o:Rn}function V9(n,e,r,t,i,o,s,a=""){let c=xA(),l=mR(n,c,r,i,s);return Mf(3),l?e+Fr(r)+t+Fr(i)+o+Fr(s)+a:Rn}function sU(n){return OR("",n),sU}function OR(n,e,r){let t=ce(),i=oU(t,n,e,r);return i!==Rn&&wR(t,ii(),i),OR}function aU(n,e,r,t,i){let o=ce(),s=U9(o,n,e,r,t,i);return s!==Rn&&wR(o,ii(),s),aU}function cU(n,e,r,t,i,o,s){let a=ce(),c=V9(a,n,e,r,t,i,o,s);return c!==Rn&&wR(a,ii(),c),cU}function wR(n,e,r){let t=vA(e,n);Z4(n[Ze],t,r)}function lU(n,e,r){BA(e)&&(e=e());let t=ce(),i=po();if(Pn(t,i,e)){let o=tt(),s=ju();LF(s,t,n,e,t[Ze],r)}return lU}function B9(n,e){let r=BA(n);return r&&n.set(e),r}function uU(n,e){let r=ce(),t=tt(),i=gn();return Wk(t,r,r[Ze],i,n,e),uU}var dU={};function hU(n){let e=tt(),r=ce(),t=n+et,i=Qc(e,t,128,null,null);return Gc(i,!1),Lf(e,r,t,dU),hU}function G9(n){fs("NgLet");let e=tt(),r=ce(),t=ii();return Lf(e,r,t,n),n}function $9(n){let e=MA(),r=Bc(e,et+n);if(r===dU)throw new oe(314,!1);return r}function j9(n){return Pn(ce(),po(),n)?Fr(n):Rn}function H9(n,e,r=""){return oU(ce(),n,e,r)}function W9(n,e,r){let t=tt();if(t.firstCreatePass){let i=wi(n);FD(r,t.data,t.blueprint,i,!0),FD(e,t.data,t.blueprint,i,!1)}}function FD(n,e,r,t,i){if(n=hn(n),Array.isArray(n))for(let o=0;o<n.length;o++)FD(n[o],e,r,t,i);else{let o=tt(),s=ce(),a=gn(),c=wc(n)?n:hn(n.provide),l=gA(n),u=a.providerIndexes&1048575,d=a.directiveStart,f=a.providerIndexes>>20;if(wc(n)||!n.multi){let g=new Wc(l,i,ut,null),p=JA(c,e,i?u:u+f,d);p===-1?(eD(h_(a,s),o,c),XA(o,n,e.length),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),r.push(g),s.push(g)):(r[p]=g,s[p]=g)}else{let g=JA(c,e,u+f,d),p=JA(c,e,u,u+f),_=g>=0&&r[g],T=p>=0&&r[p];if(i&&!T||!i&&!_){eD(h_(a,s),o,c);let S=K9(i?q9:z9,r.length,i,t,l,n);!i&&T&&(r[p].providerFactory=S),XA(o,n,e.length,0),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),r.push(S),s.push(S)}else{let S=fU(r[i?p:g],l,!i&&t);XA(o,n,g>-1?g:p,S)}!i&&t&&T&&r[p].componentProviders++}}}function XA(n,e,r,t){let i=wc(e),o=T0(e);if(i||o){let c=(o?hn(e.useClass):e).prototype.ngOnDestroy;if(c){let l=n.destroyHooks||(n.destroyHooks=[]);if(!i&&e.multi){let u=l.indexOf(r);u===-1?l.push(r,[t,c]):l[u+1].push(t,c)}else l.push(r,c)}}}function fU(n,e,r){return r&&n.componentProviders++,n.multi.push(e)-1}function JA(n,e,r,t){for(let i=r;i<t;i++)if(e[i]===n)return i;return-1}function z9(n,e,r,t,i){return kD(this.multi,[])}function q9(n,e,r,t,i){let o=this.multi,s;if(this.providerFactory){let a=this.providerFactory.componentProviders,c=Vf(t,t[Te],this.providerFactory.index,i);s=c.slice(0,a),kD(o,s);for(let l=a;l<c.length;l++)s.push(c[l])}else s=[],kD(o,s);return s}function kD(n,e){for(let r=0;r<n.length;r++){let t=n[r];e.push(t())}return e}function K9(n,e,r,t,i,o){let s=new Wc(n,r,ut,null);return s.multi=[],s.index=e,s.componentProviders=0,fU(s,i,t&&!r),s}function Y9(n,e=[]){return r=>{r.providersResolver=(t,i)=>W9(t,i?i(n):n,e)}}function Q9(n,e,r){let t=n.\u0275cmp;t.directiveDefs=D_(e,vk),t.pipeDefs=D_(r,dA)}function X9(n,e,r){let t=sr()+n,i=ce();return i[t]===Rn?So(i,t,r?e.call(r):e()):Yf(i,t)}function J9(n,e,r,t){return gU(ce(),sr(),n,e,r,t)}function Z9(n,e,r,t,i){return mU(ce(),sr(),n,e,r,t,i)}function eK(n,e,r,t,i,o){return pU(ce(),sr(),n,e,r,t,i,o)}function tK(n,e,r,t,i,o,s){return aK(ce(),sr(),n,e,r,t,i,o,s)}function nK(n,e,r,t,i,o,s,a){let c=sr()+n,l=ce(),u=Zu(l,c,r,t,i,o);return Pn(l,c+4,s)||u?So(l,c+5,a?e.call(a,r,t,i,o,s):e(r,t,i,o,s)):Yf(l,c+5)}function rK(n,e,r,t,i,o,s,a,c){let l=sr()+n,u=ce(),d=Zu(u,l,r,t,i,o);return Ju(u,l+4,s,a)||d?So(u,l+6,c?e.call(c,r,t,i,o,s,a):e(r,t,i,o,s,a)):Yf(u,l+6)}function iK(n,e,r,t,i,o,s,a,c,l){let u=sr()+n,d=ce(),f=Zu(d,u,r,t,i,o);return mR(d,u+4,s,a,c)||f?So(d,u+7,l?e.call(l,r,t,i,o,s,a,c):e(r,t,i,o,s,a,c)):Yf(d,u+7)}function oK(n,e,r,t,i,o,s,a,c,l,u){let d=sr()+n,f=ce(),g=Zu(f,d,r,t,i,o);return Zu(f,d+4,s,a,c,l)||g?So(f,d+8,u?e.call(u,r,t,i,o,s,a,c,l):e(r,t,i,o,s,a,c,l)):Yf(f,d+8)}function sK(n,e,r,t){return EU(ce(),sr(),n,e,r,t)}function eg(n,e){let r=n[e];return r===Rn?void 0:r}function gU(n,e,r,t,i,o){let s=e+r;return Pn(n,s,i)?So(n,s+1,o?t.call(o,i):t(i)):eg(n,s+1)}function mU(n,e,r,t,i,o,s){let a=e+r;return Ju(n,a,i,o)?So(n,a+2,s?t.call(s,i,o):t(i,o)):eg(n,a+2)}function pU(n,e,r,t,i,o,s,a){let c=e+r;return mR(n,c,i,o,s)?So(n,c+3,a?t.call(a,i,o,s):t(i,o,s)):eg(n,c+3)}function aK(n,e,r,t,i,o,s,a,c){let l=e+r;return Zu(n,l,i,o,s,a)?So(n,l+4,c?t.call(c,i,o,s,a):t(i,o,s,a)):eg(n,l+4)}function EU(n,e,r,t,i,o){let s=e+r,a=!1;for(let c=0;c<i.length;c++)Pn(n,s++,i[c])&&(a=!0);return a?So(n,s,t.apply(o,i)):eg(n,s)}function cK(n,e){let r=tt(),t,i=n+et;r.firstCreatePass?(t=lK(e,r.pipeRegistry),r.data[i]=t,t.onDestroy&&(r.destroyHooks??=[]).push(i,t.onDestroy)):t=r.data[i];let o=t.factory||(t.factory=Ks(t.type,!0)),s,a=ir(ut);try{let c=d_(!1),l=o();return d_(c),Lf(r,ce(),i,l),l}finally{ir(a)}}function lK(n,e){if(e)for(let r=e.length-1;r>=0;r--){let t=e[r];if(n===t.name)return t}}function uK(n,e,r){let t=n+et,i=ce(),o=Bc(i,t);return z_(i,t)?gU(i,sr(),e,o.transform,r,o):o.transform(r)}function dK(n,e,r,t){let i=n+et,o=ce(),s=Bc(o,i);return z_(o,i)?mU(o,sr(),e,s.transform,r,t,s):s.transform(r,t)}function hK(n,e,r,t,i){let o=n+et,s=ce(),a=Bc(s,o);return z_(s,o)?pU(s,sr(),e,a.transform,r,t,i,a):a.transform(r,t,i)}function fK(n,e,r){let t=n+et,i=ce(),o=Bc(i,t);return z_(i,t)?EU(i,sr(),e,o.transform,r,o):o.transform.apply(o,r)}function z_(n,e){return n[Te].data[e].pure}function gK(n,e){return B_(n,e)}var n_=null;function _U(n){n_!==null&&(n.defaultEncapsulation!==n_.defaultEncapsulation||n.preserveWhitespaces!==n_.preserveWhitespaces)||(n_=n)}var TU=new Z("");var mK=(()=>{class n{zone=ne(be);changeDetectionScheduler=ne(Zr);applicationRef=ne(aa);applicationErrorHandler=ne(Eo);_onMicrotaskEmptySubscription;initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.changeDetectionScheduler.runningTick||this.zone.run(()=>{try{this.applicationRef.dirtyFlags|=1,this.applicationRef._tick()}catch(r){this.applicationErrorHandler(r)}})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function IU({ngZoneFactory:n,ignoreChangesOutsideZone:e,scheduleInRootZone:r}){return n??=()=>new be(le(P({},bR()),{scheduleInRootZone:r})),[{provide:be,useFactory:n},{provide:Xs,multi:!0,useFactory:()=>{let t=ne(mK,{optional:!0});return()=>t.initialize()}},{provide:Xs,multi:!0,useFactory:()=>{let t=ne(pK);return()=>{t.initialize()}}},e===!0?{provide:GA,useValue:!0}:[],{provide:YE,useValue:r??_F},{provide:Eo,useFactory:()=>{let t=ne(be),i=ne(Kn),o;return s=>{t.runOutsideAngular(()=>{i.destroyed&&!o?setTimeout(()=>{throw s}):(o??=i.get(xr),o.handleError(s))})}}}]}function bR(n){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:n?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:n?.runCoalescing??!1}}var pK=(()=>{class n{subscription=new gt;initialized=!1;zone=ne(be);pendingTasks=ne(ra);initialize(){if(this.initialized)return;this.initialized=!0;let r=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(r=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{be.assertNotInAngularZone(),queueMicrotask(()=>{r!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(r),r=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{be.assertInAngularZone(),r??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var LR=(()=>{class n{applicationErrorHandler=ne(Eo);appRef=ne(aa);taskService=ne(ra);ngZone=ne(be);zonelessEnabled=ne(Wu);tracing=ne(Yc,{optional:!0});disableScheduling=ne(GA,{optional:!0})??!1;zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new gt;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(m_):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(ne(YE,{optional:!0})??!1);cancelScheduledCallback=null;useMicrotaskScheduler=!1;runningTick=!1;pendingRenderTaskId=null;constructor(){this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{this.runningTick||this.cleanup()})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()})),this.disableScheduling||=!this.zonelessEnabled&&(this.ngZone instanceof Qu||!this.zoneIsDefined)}notify(r){if(!this.zonelessEnabled&&r===5)return;let t=!1;switch(r){case 0:{this.appRef.dirtyFlags|=2;break}case 3:case 2:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 6:{this.appRef.dirtyFlags|=2,t=!0;break}case 12:{this.appRef.dirtyFlags|=16,t=!0;break}case 13:{this.appRef.dirtyFlags|=2,t=!0;break}case 11:{t=!0;break}default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=this.tracing?.snapshot(this.appRef.tracingSnapshot)??null,!this.shouldScheduleTick(t))return;let i=this.useMicrotaskScheduler?sx:TF;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>i(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>i(()=>this.tick()))}shouldScheduleTick(r){return!(this.disableScheduling&&!r||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(m_+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let r=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(t){this.taskService.remove(r),this.applicationErrorHandler(t)}finally{this.cleanup()}this.useMicrotaskScheduler=!0,sx(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(r)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let r=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(r)}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function EK(){return fs("NgZoneless"),mr([{provide:Zr,useExisting:LR},{provide:be,useClass:Qu},{provide:Wu,useValue:!0},{provide:YE,useValue:!1},[]])}function _K(){return typeof $localize<"u"&&$localize.locale||Zf}var tg=new Z("",{providedIn:"root",factory:()=>ne(tg,{optional:!0,skipSelf:!0})||_K()});var q_=class{destroyed=!1;listeners=null;errorHandler=ne(xr,{optional:!0});destroyRef=ne(ar);constructor(){this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.listeners=null})}subscribe(e){if(this.destroyed)throw new oe(953,!1);return(this.listeners??=[]).push(e),{unsubscribe:()=>{let r=this.listeners?.indexOf(e);r!==void 0&&r!==-1&&this.listeners?.splice(r,1)}}}emit(e){if(this.destroyed){console.warn(Qs(953,!1));return}if(this.listeners===null)return;let r=Se(null);try{for(let t of this.listeners)try{t(e)}catch(i){this.errorHandler?.handleError(i)}}finally{Se(r)}}};function ng(n){return t0(n)}function rg(n,e){return If(n,e?.equal)}var MR=class{[An];constructor(e){this[An]=e}destroy(){this[An].destroy()}};function PR(n,e){let r=e?.injector??ne(St),t=e?.manualCleanup!==!0?r.get(ar):null,i,o=r.get(Hu,null,{optional:!0}),s=r.get(Zr);return o!==null?(i=vK(o.view,s,n),t instanceof Df&&t._lView===o.view&&(t=null)):i=yK(n,r.get(Ff),s),i.injector=r,t!==null&&(i.onDestroyFn=t.onDestroy(()=>i.destroy())),new MR(i)}var vU=le(P({},n0),{cleanupFns:void 0,zone:null,onDestroyFn:jc,run(){let n=$u(!1);try{r0(this)}finally{$u(n)}},cleanup(){if(!this.cleanupFns?.length)return;let n=Se(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],Se(n)}}}),TK=le(P({},vU),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){Rc(this),this.onDestroyFn(),this.cleanup(),this.scheduler.remove(this)}}),IK=le(P({},vU),{consumerMarkedDirty(){this.view[Ae]|=8192,ta(this.view),this.notifier.notify(13)},destroy(){Rc(this),this.onDestroyFn(),this.cleanup(),this.view[os]?.delete(this)}});function vK(n,e,r){let t=Object.create(IK);return t.view=n,t.zone=typeof Zone<"u"?Zone.current:null,t.notifier=e,t.fn=yU(t,r),n[os]??=new Set,n[os].add(t),t.consumerMarkedDirty(t),t}function yK(n,e,r){let t=Object.create(TK);return t.fn=yU(t,n),t.scheduler=e,t.notifier=r,t.zone=typeof Zone<"u"?Zone.current:null,t.scheduler.add(t),t.notifier.notify(12),t}function yU(n,e){return()=>{e(r=>(n.cleanupFns??=[]).push(r))}}var wU=Symbol("InputSignalNode#UNSET"),PK=le(P({},IE),{transformFn:void 0,applyValueToInputSignal(n,e){bu(n,e)}});function bU(n,e){let r=Object.create(PK);r.value=n,r.transformFn=e?.transform;function t(){if(Cu(r),r.value===wU){let i=null;throw new oe(-950,i)}return r.value}return t[An]=r,t}var xK=new Z("");xK.__NG_ELEMENT_ID__=n=>{let e=gn();if(e===null)throw new oe(204,!1);if(e.type&2)return e.value;if(n&8)return null;throw new oe(204,!1)};function zve(n){return new q_}function SU(n,e){return bU(n,e)}function FK(n){return bU(wU,n)}var qve=(SU.required=FK,SU);function AU(n,e){return hk(e)}function kK(n,e){return fk(e)}var Kve=(AU.required=kK,AU);function UK(n,e,r){let t=new S_(r);return Promise.resolve(t)}function DU(n){for(let e=n.length-1;e>=0;e--)if(n[e]!==void 0)return n[e]}var K_=new Z(""),VK=new Z("");function ig(n){return!n.moduleRef}function BK(n){let e=ig(n)?n.r3Injector:n.moduleRef.injector,r=e.get(be);return r.run(()=>{ig(n)?n.r3Injector.resolveInjectorInitializers():n.moduleRef.resolveInjectorInitializers();let t=e.get(Eo),i;if(r.runOutsideAngular(()=>{i=r.onError.subscribe({next:t})}),ig(n)){let o=()=>e.destroy(),s=n.platformInjector.get(K_);s.add(o),e.onDestroy(()=>{i.unsubscribe(),s.delete(o)})}else{let o=()=>n.moduleRef.destroy(),s=n.platformInjector.get(K_);s.add(o),n.moduleRef.onDestroy(()=>{Uf(n.allPlatformModules,n.moduleRef),i.unsubscribe(),s.delete(o)})}return $K(t,r,()=>{let o=e.get(ra),s=o.add(),a=e.get(IR);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(tg,Zf);if($k(c||Zf),!e.get(VK,!0))return ig(n)?e.get(aa):(n.allPlatformModules.push(n.moduleRef),n.moduleRef);if(ig(n)){let u=e.get(aa);return n.rootComponent!==void 0&&u.bootstrap(n.rootComponent),u}else return LU?.(n.moduleRef,n.allPlatformModules),n.moduleRef}).finally(()=>{o.remove(s)})})})}var LU;function RU(){LU=GK}function GK(n,e){let r=n.injector.get(aa);if(n._bootstrapComponents.length>0)n._bootstrapComponents.forEach(t=>r.bootstrap(t));else if(n.instance.ngDoBootstrap)n.instance.ngDoBootstrap(r);else throw new oe(-403,!1);e.push(n)}function $K(n,e,r){try{let t=r();return W_(t)?t.catch(i=>{throw e.runOutsideAngular(()=>n(i)),i}):t}catch(t){throw e.runOutsideAngular(()=>n(t)),t}}var MU=(()=>{class n{_injector;_modules=[];_destroyListeners=[];_destroyed=!1;constructor(r){this._injector=r}bootstrapModuleFactory(r,t){let i=t?.scheduleInRootZone,o=()=>vF(t?.ngZone,le(P({},bR({eventCoalescing:t?.ngZoneEventCoalescing,runCoalescing:t?.ngZoneRunCoalescing})),{scheduleInRootZone:i})),s=t?.ignoreChangesOutsideZone,a=[IU({ngZoneFactory:o,ignoreChangesOutsideZone:s}),{provide:Zr,useExisting:LR},W0],c=Tk(r.moduleType,this.injector,a);return RU(),BK({moduleRef:c,allPlatformModules:this._modules,platformInjector:this.injector})}bootstrapModule(r,t=[]){let i=vR({},t);return RU(),UK(this.injector,i,r).then(o=>this.bootstrapModuleFactory(o,i))}onDestroy(r){this._destroyListeners.push(r)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new oe(404,!1);this._modules.slice().forEach(t=>t.destroy()),this._destroyListeners.forEach(t=>t());let r=this._injector.get(K_,null);r&&(r.forEach(t=>t()),r.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}static \u0275fac=function(t){return new(t||n)(w(St))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"platform"})}return n})(),$R=null;function jK(n){if(HR())throw new oe(400,!1);Lk(),$R=n;let e=n.get(MU);return zK(n),e}function jR(n,e,r=[]){let t=`Platform: ${e}`,i=new Z(t);return(o=[])=>{let s=HR();if(!s){let a=[...r,...o,{provide:i,useValue:!0}];s=n?.(a)??jK(HK(a,t))}return WK(i)}}function HK(n=[],e){return St.create({name:e,providers:[{provide:Nf,useValue:"platform"},{provide:K_,useValue:new Set([()=>$R=null])},...n]})}function WK(n){let e=HR();if(!e)throw new oe(-401,!1);return e}function HR(){return $R?.get(MU)??null}function zK(n){let e=n.get(w_,null);ho(n,()=>{e?.forEach(r=>r())})}function WR(){return!1}var qK=(()=>{class n{static __NG_ELEMENT_ID__=KK}return n})();function KK(n){return YK(gn(),ce(),(n&16)===16)}function YK(n,e,r){if(ss(n)&&!r){let t=ri(n.index,e);return new ia(t,t)}else if(n.type&175){let t=e[Yn];return new ia(t,e)}return null}var xR=class{constructor(){}supports(e){return gR(e)}create(e){return new FR(e)}},QK=(n,e)=>e,FR=class{length=0;collection;_linkedRecords=null;_unlinkedRecords=null;_previousItHead=null;_itHead=null;_itTail=null;_additionsHead=null;_additionsTail=null;_movesHead=null;_movesTail=null;_removalsHead=null;_removalsTail=null;_identityChangesHead=null;_identityChangesTail=null;_trackByFn;constructor(e){this._trackByFn=e||QK}forEachItem(e){let r;for(r=this._itHead;r!==null;r=r._next)e(r)}forEachOperation(e){let r=this._itHead,t=this._removalsHead,i=0,o=null;for(;r||t;){let s=!t||r&&r.currentIndex<CU(t,i,o)?r:t,a=CU(s,i,o),c=s.currentIndex;if(s===t)i--,t=t._nextRemoved;else if(r=r._next,s.previousIndex==null)i++;else{o||(o=[]);let l=a-i,u=c-i;if(l!=u){for(let f=0;f<l;f++){let g=f<o.length?o[f]:o[f]=0,p=g+f;u<=p&&p<l&&(o[f]=g+1)}let d=s.previousIndex;o[d]=u-l}}a!==c&&e(s,a,c)}}forEachPreviousItem(e){let r;for(r=this._previousItHead;r!==null;r=r._nextPrevious)e(r)}forEachAddedItem(e){let r;for(r=this._additionsHead;r!==null;r=r._nextAdded)e(r)}forEachMovedItem(e){let r;for(r=this._movesHead;r!==null;r=r._nextMoved)e(r)}forEachRemovedItem(e){let r;for(r=this._removalsHead;r!==null;r=r._nextRemoved)e(r)}forEachIdentityChange(e){let r;for(r=this._identityChangesHead;r!==null;r=r._nextIdentityChange)e(r)}diff(e){if(e==null&&(e=[]),!gR(e))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let r=this._itHead,t=!1,i,o,s;if(Array.isArray(e)){this.length=e.length;for(let a=0;a<this.length;a++)o=e[a],s=this._trackByFn(a,o),r===null||!Object.is(r.trackById,s)?(r=this._mismatch(r,o,s,a),t=!0):(t&&(r=this._verifyReinsertion(r,o,s,a)),Object.is(r.item,o)||this._addIdentityChange(r,o)),r=r._next}else i=0,ek(e,a=>{s=this._trackByFn(i,a),r===null||!Object.is(r.trackById,s)?(r=this._mismatch(r,a,s,i),t=!0):(t&&(r=this._verifyReinsertion(r,a,s,i)),Object.is(r.item,a)||this._addIdentityChange(r,a)),r=r._next,i++}),this.length=i;return this._truncate(r),this.collection=e,this.isDirty}get isDirty(){return this._additionsHead!==null||this._movesHead!==null||this._removalsHead!==null||this._identityChangesHead!==null}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;e!==null;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;e!==null;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,r,t,i){let o;return e===null?o=this._itTail:(o=e._prev,this._remove(e)),e=this._unlinkedRecords===null?null:this._unlinkedRecords.get(t,null),e!==null?(Object.is(e.item,r)||this._addIdentityChange(e,r),this._reinsertAfter(e,o,i)):(e=this._linkedRecords===null?null:this._linkedRecords.get(t,i),e!==null?(Object.is(e.item,r)||this._addIdentityChange(e,r),this._moveAfter(e,o,i)):e=this._addAfter(new kR(r,t),o,i)),e}_verifyReinsertion(e,r,t,i){let o=this._unlinkedRecords===null?null:this._unlinkedRecords.get(t,null);return o!==null?e=this._reinsertAfter(o,e._prev,i):e.currentIndex!=i&&(e.currentIndex=i,this._addToMoves(e,i)),e}_truncate(e){for(;e!==null;){let r=e._next;this._addToRemovals(this._unlink(e)),e=r}this._unlinkedRecords!==null&&this._unlinkedRecords.clear(),this._additionsTail!==null&&(this._additionsTail._nextAdded=null),this._movesTail!==null&&(this._movesTail._nextMoved=null),this._itTail!==null&&(this._itTail._next=null),this._removalsTail!==null&&(this._removalsTail._nextRemoved=null),this._identityChangesTail!==null&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,r,t){this._unlinkedRecords!==null&&this._unlinkedRecords.remove(e);let i=e._prevRemoved,o=e._nextRemoved;return i===null?this._removalsHead=o:i._nextRemoved=o,o===null?this._removalsTail=i:o._prevRemoved=i,this._insertAfter(e,r,t),this._addToMoves(e,t),e}_moveAfter(e,r,t){return this._unlink(e),this._insertAfter(e,r,t),this._addToMoves(e,t),e}_addAfter(e,r,t){return this._insertAfter(e,r,t),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,r,t){let i=r===null?this._itHead:r._next;return e._next=i,e._prev=r,i===null?this._itTail=e:i._prev=e,r===null?this._itHead=e:r._next=e,this._linkedRecords===null&&(this._linkedRecords=new Y_),this._linkedRecords.put(e),e.currentIndex=t,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){this._linkedRecords!==null&&this._linkedRecords.remove(e);let r=e._prev,t=e._next;return r===null?this._itHead=t:r._next=t,t===null?this._itTail=r:t._prev=r,e}_addToMoves(e,r){return e.previousIndex===r||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new Y_),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,this._removalsTail===null?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,r){return e.item=r,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},kR=class{item;trackById;currentIndex=null;previousIndex=null;_nextPrevious=null;_prev=null;_next=null;_prevDup=null;_nextDup=null;_prevRemoved=null;_nextRemoved=null;_nextAdded=null;_nextMoved=null;_nextIdentityChange=null;constructor(e,r){this.item=e,this.trackById=r}},UR=class{_head=null;_tail=null;add(e){this._head===null?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,r){let t;for(t=this._head;t!==null;t=t._nextDup)if((r===null||r<=t.currentIndex)&&Object.is(t.trackById,e))return t;return null}remove(e){let r=e._prevDup,t=e._nextDup;return r===null?this._head=t:r._nextDup=t,t===null?this._tail=r:t._prevDup=r,this._head===null}},Y_=class{map=new Map;put(e){let r=e.trackById,t=this.map.get(r);t||(t=new UR,this.map.set(r,t)),t.add(e)}get(e,r){let t=e,i=this.map.get(t);return i?i.get(e,r):null}remove(e){let r=e.trackById;return this.map.get(r).remove(e)&&this.map.delete(r),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function CU(n,e,r){let t=n.previousIndex;if(t===null)return t;let i=0;return r&&t<r.length&&(i=r[t]),t+e+i}var VR=class{constructor(){}supports(e){return e instanceof Map||j_(e)}create(){return new BR}},BR=class{_records=new Map;_mapHead=null;_appendAfter=null;_previousMapHead=null;_changesHead=null;_changesTail=null;_additionsHead=null;_additionsTail=null;_removalsHead=null;_removalsTail=null;get isDirty(){return this._additionsHead!==null||this._changesHead!==null||this._removalsHead!==null}forEachItem(e){let r;for(r=this._mapHead;r!==null;r=r._next)e(r)}forEachPreviousItem(e){let r;for(r=this._previousMapHead;r!==null;r=r._nextPrevious)e(r)}forEachChangedItem(e){let r;for(r=this._changesHead;r!==null;r=r._nextChanged)e(r)}forEachAddedItem(e){let r;for(r=this._additionsHead;r!==null;r=r._nextAdded)e(r)}forEachRemovedItem(e){let r;for(r=this._removalsHead;r!==null;r=r._nextRemoved)e(r)}diff(e){if(!e)e=new Map;else if(!(e instanceof Map||j_(e)))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let r=this._mapHead;if(this._appendAfter=null,this._forEach(e,(t,i)=>{if(r&&r.key===i)this._maybeAddToChanges(r,t),this._appendAfter=r,r=r._next;else{let o=this._getOrCreateRecordForKey(i,t);r=this._insertBeforeOrAppend(r,o)}}),r){r._prev&&(r._prev._next=null),this._removalsHead=r;for(let t=r;t!==null;t=t._nextRemoved)t===this._mapHead&&(this._mapHead=null),this._records.delete(t.key),t._nextRemoved=t._next,t.previousValue=t.currentValue,t.currentValue=null,t._prev=null,t._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(e,r){if(e){let t=e._prev;return r._next=e,r._prev=t,e._prev=r,t&&(t._next=r),e===this._mapHead&&(this._mapHead=r),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=r,r._prev=this._appendAfter):this._mapHead=r,this._appendAfter=r,null}_getOrCreateRecordForKey(e,r){if(this._records.has(e)){let i=this._records.get(e);this._maybeAddToChanges(i,r);let o=i._prev,s=i._next;return o&&(o._next=s),s&&(s._prev=o),i._next=null,i._prev=null,i}let t=new GR(e);return this._records.set(e,t),t.currentValue=r,this._addToAdditions(t),t}_reset(){if(this.isDirty){let e;for(this._previousMapHead=this._mapHead,e=this._previousMapHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._changesHead;e!==null;e=e._nextChanged)e.previousValue=e.currentValue;for(e=this._additionsHead;e!=null;e=e._nextAdded)e.previousValue=e.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(e,r){Object.is(r,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=r,this._addToChanges(e))}_addToAdditions(e){this._additionsHead===null?this._additionsHead=this._additionsTail=e:(this._additionsTail._nextAdded=e,this._additionsTail=e)}_addToChanges(e){this._changesHead===null?this._changesHead=this._changesTail=e:(this._changesTail._nextChanged=e,this._changesTail=e)}_forEach(e,r){e instanceof Map?e.forEach(r):Object.keys(e).forEach(t=>r(e[t],t))}},GR=class{key;previousValue=null;currentValue=null;_nextPrevious=null;_next=null;_prev=null;_nextAdded=null;_nextRemoved=null;_nextChanged=null;constructor(e){this.key=e}};function NU(){return new zR([new xR])}var zR=(()=>{class n{factories;static \u0275prov=K({token:n,providedIn:"root",factory:NU});constructor(r){this.factories=r}static create(r,t){if(t!=null){let i=t.factories.slice();r=r.concat(i)}return new n(r)}static extend(r){return{provide:n,useFactory:()=>{let t=ne(n,{optional:!0,skipSelf:!0});return n.create(r,t||NU())}}}find(r){let t=this.factories.find(i=>i.supports(r));if(t!=null)return t;throw new oe(901,!1)}}return n})();function OU(){return new Q_([new VR])}var Q_=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:OU});factories;constructor(r){this.factories=r}static create(r,t){if(t){let i=t.factories.slice();r=r.concat(i)}return new n(r)}static extend(r){return{provide:n,useFactory:()=>{let t=ne(n,{optional:!0,skipSelf:!0});return n.create(r,t||OU())}}}find(r){let t=this.factories.find(i=>i.supports(r));if(t)return t;throw new oe(901,!1)}}return n})();var PU=jR(null,"core",[]),xU=(()=>{class n{constructor(r){}static \u0275fac=function(t){return new(t||n)(w(aa))};static \u0275mod=sa({type:n});static \u0275inj=rs({})}return n})();function Yve(n){return typeof n=="boolean"?n:n!=null&&n!=="false"}function Qve(n,e=NaN){return!isNaN(parseFloat(n))&&!isNaN(Number(n))?Number(n):e}function Xve(n,e){let r=Js(n),t=e.elementInjector||Fu();return new ed(r).create(t,e.projectableNodes,e.hostElement,e.environmentInjector,e.directives,e.bindings)}var UU=null;function Ro(){return UU}function qR(n){UU??=n}var og=class{},KR=(()=>{class n{historyGo(r){throw new Error("")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>ne(VU),providedIn:"platform"})}return n})();var VU=(()=>{class n extends KR{_location;_history;_doc=ne(Dn);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return Ro().getBaseHref(this._doc)}onPopState(r){let t=Ro().getGlobalEventTarget(this._doc,"window");return t.addEventListener("popstate",r,!1),()=>t.removeEventListener("popstate",r)}onHashChange(r){let t=Ro().getGlobalEventTarget(this._doc,"window");return t.addEventListener("hashchange",r,!1),()=>t.removeEventListener("hashchange",r)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(r){this._location.pathname=r}pushState(r,t,i){this._history.pushState(r,t,i)}replaceState(r,t,i){this._history.replaceState(r,t,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(r=0){this._history.go(r)}getState(){return this._history.state}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>new n,providedIn:"platform"})}return n})();function BU(n,e){return n?e?n.endsWith("/")?e.startsWith("/")?n+e.slice(1):n+e:e.startsWith("/")?n+e:`${n}/${e}`:n:e}function FU(n){let e=n.search(/#|\?|$/);return n[e-1]==="/"?n.slice(0,e-1)+n.slice(e):n}function ca(n){return n&&n[0]!=="?"?`?${n}`:n}var X_=(()=>{class n{historyGo(r){throw new Error("")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>ne($U),providedIn:"root"})}return n})(),GU=new Z(""),$U=(()=>{class n extends X_{_platformLocation;_baseHref;_removeListenerFns=[];constructor(r,t){super(),this._platformLocation=r,this._baseHref=t??this._platformLocation.getBaseHrefFromDOM()??ne(Dn).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(r){this._removeListenerFns.push(this._platformLocation.onPopState(r),this._platformLocation.onHashChange(r))}getBaseHref(){return this._baseHref}prepareExternalUrl(r){return BU(this._baseHref,r)}path(r=!1){let t=this._platformLocation.pathname+ca(this._platformLocation.search),i=this._platformLocation.hash;return i&&r?`${t}${i}`:t}pushState(r,t,i,o){let s=this.prepareExternalUrl(i+ca(o));this._platformLocation.pushState(r,t,s)}replaceState(r,t,i,o){let s=this.prepareExternalUrl(i+ca(o));this._platformLocation.replaceState(r,t,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(r=0){this._platformLocation.historyGo?.(r)}static \u0275fac=function(t){return new(t||n)(w(KR),w(GU,8))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),jU=(()=>{class n{_subject=new Ot;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(r){this._locationStrategy=r;let t=this._locationStrategy.getBaseHref();this._basePath=ZK(FU(kU(t))),this._locationStrategy.onPopState(i=>{this._subject.next({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(r=!1){return this.normalize(this._locationStrategy.path(r))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(r,t=""){return this.path()==this.normalize(r+ca(t))}normalize(r){return n.stripTrailingSlash(JK(this._basePath,kU(r)))}prepareExternalUrl(r){return r&&r[0]!=="/"&&(r="/"+r),this._locationStrategy.prepareExternalUrl(r)}go(r,t="",i=null){this._locationStrategy.pushState(i,"",r,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(r+ca(t)),i)}replaceState(r,t="",i=null){this._locationStrategy.replaceState(i,"",r,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(r+ca(t)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(r=0){this._locationStrategy.historyGo?.(r)}onUrlChange(r){return this._urlChangeListeners.push(r),this._urlChangeSubscription??=this.subscribe(t=>{this._notifyUrlChangeListeners(t.url,t.state)}),()=>{let t=this._urlChangeListeners.indexOf(r);this._urlChangeListeners.splice(t,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(r="",t){this._urlChangeListeners.forEach(i=>i(r,t))}subscribe(r,t,i){return this._subject.subscribe({next:r,error:t??void 0,complete:i??void 0})}static normalizeQueryParams=ca;static joinWithSlash=BU;static stripTrailingSlash=FU;static \u0275fac=function(t){return new(t||n)(w(X_))};static \u0275prov=K({token:n,factory:()=>XK(),providedIn:"root"})}return n})();function XK(){return new jU(w(X_))}function JK(n,e){if(!n||!e.startsWith(n))return e;let r=e.substring(n.length);return r===""||["/",";","?","#"].includes(r[0])?r:e}function kU(n){return n.replace(/\/index.html$/,"")}function ZK(n){if(new RegExp("^(https?:)?//").test(n)){let[,r]=n.split(/\/\/[^\/]+/);return r}return n}var Qn=(function(n){return n[n.Format=0]="Format",n[n.Standalone=1]="Standalone",n})(Qn||{}),ot=(function(n){return n[n.Narrow=0]="Narrow",n[n.Abbreviated=1]="Abbreviated",n[n.Wide=2]="Wide",n[n.Short=3]="Short",n})(ot||{}),pr=(function(n){return n[n.Short=0]="Short",n[n.Medium=1]="Medium",n[n.Long=2]="Long",n[n.Full=3]="Full",n})(pr||{}),ms={Decimal:0,Group:1,List:2,PercentSign:3,PlusSign:4,MinusSign:5,Exponential:6,SuperscriptingExponent:7,PerMille:8,Infinity:9,NaN:10,TimeSeparator:11,CurrencyDecimal:12,CurrencyGroup:13};function YU(n){return Br(n)[Yt.LocaleId]}function QU(n,e,r){let t=Br(n),i=[t[Yt.DayPeriodsFormat],t[Yt.DayPeriodsStandalone]],o=si(i,e);return si(o,r)}function XU(n,e,r){let t=Br(n),i=[t[Yt.DaysFormat],t[Yt.DaysStandalone]],o=si(i,e);return si(o,r)}function JU(n,e,r){let t=Br(n),i=[t[Yt.MonthsFormat],t[Yt.MonthsStandalone]],o=si(i,e);return si(o,r)}function ZU(n,e){let t=Br(n)[Yt.Eras];return si(t,e)}function sg(n,e){let r=Br(n);return si(r[Yt.DateFormat],e)}function ag(n,e){let r=Br(n);return si(r[Yt.TimeFormat],e)}function cg(n,e){let t=Br(n)[Yt.DateTimeFormat];return si(t,e)}function lg(n,e){let r=Br(n),t=r[Yt.NumberSymbols][e];if(typeof t>"u"){if(e===ms.CurrencyDecimal)return r[Yt.NumberSymbols][ms.Decimal];if(e===ms.CurrencyGroup)return r[Yt.NumberSymbols][ms.Group]}return t}function e1(n){if(!n[Yt.ExtraData])throw new oe(2303,!1)}function t1(n){let e=Br(n);return e1(e),(e[Yt.ExtraData][2]||[]).map(t=>typeof t=="string"?YR(t):[YR(t[0]),YR(t[1])])}function n1(n,e,r){let t=Br(n);e1(t);let i=[t[Yt.ExtraData][0],t[Yt.ExtraData][1]],o=si(i,e)||[];return si(o,r)||[]}function si(n,e){for(let r=e;r>-1;r--)if(typeof n[r]<"u")return n[r];throw new oe(2304,!1)}function YR(n){let[e,r]=n.split(":");return{hours:+e,minutes:+r}}var eY=/^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/,J_={},tY=/((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;function r1(n,e,r,t){let i=uY(n);e=gs(r,e)||e;let s=[],a;for(;e;)if(a=tY.exec(e),a){s=s.concat(a.slice(1));let u=s.pop();if(!u)break;e=u}else{s.push(e);break}let c=i.getTimezoneOffset();t&&(c=o1(t,c),i=lY(i,t));let l="";return s.forEach(u=>{let d=aY(u);l+=d?d(i,r,c):u==="''"?"'":u.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}function rT(n,e,r){let t=new Date(0);return t.setFullYear(n,e,r),t.setHours(0,0,0),t}function gs(n,e){let r=YU(n);if(J_[r]??={},J_[r][e])return J_[r][e];let t="";switch(e){case"shortDate":t=sg(n,pr.Short);break;case"mediumDate":t=sg(n,pr.Medium);break;case"longDate":t=sg(n,pr.Long);break;case"fullDate":t=sg(n,pr.Full);break;case"shortTime":t=ag(n,pr.Short);break;case"mediumTime":t=ag(n,pr.Medium);break;case"longTime":t=ag(n,pr.Long);break;case"fullTime":t=ag(n,pr.Full);break;case"short":let i=gs(n,"shortTime"),o=gs(n,"shortDate");t=Z_(cg(n,pr.Short),[i,o]);break;case"medium":let s=gs(n,"mediumTime"),a=gs(n,"mediumDate");t=Z_(cg(n,pr.Medium),[s,a]);break;case"long":let c=gs(n,"longTime"),l=gs(n,"longDate");t=Z_(cg(n,pr.Long),[c,l]);break;case"full":let u=gs(n,"fullTime"),d=gs(n,"fullDate");t=Z_(cg(n,pr.Full),[u,d]);break}return t&&(J_[r][e]=t),t}function Z_(n,e){return e&&(n=n.replace(/\{([^}]+)}/g,function(r,t){return e!=null&&t in e?e[t]:r})),n}function Mi(n,e,r="-",t,i){let o="";(n<0||i&&n<=0)&&(i?n=-n+1:(n=-n,o=r));let s=String(n);for(;s.length<e;)s="0"+s;return t&&(s=s.slice(s.length-e)),o+s}function nY(n,e){return Mi(n,3).substring(0,e)}function nn(n,e,r=0,t=!1,i=!1){return function(o,s){let a=rY(n,o);if((r>0||a>-r)&&(a+=r),n===3)a===0&&r===-12&&(a=12);else if(n===6)return nY(a,e);let c=lg(s,ms.MinusSign);return Mi(a,e,c,t,i)}}function rY(n,e){switch(n){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate();case 3:return e.getHours();case 4:return e.getMinutes();case 5:return e.getSeconds();case 6:return e.getMilliseconds();case 7:return e.getDay();default:throw new oe(2301,!1)}}function pt(n,e,r=Qn.Format,t=!1){return function(i,o){return iY(i,o,n,e,r,t)}}function iY(n,e,r,t,i,o){switch(r){case 2:return JU(e,i,t)[n.getMonth()];case 1:return XU(e,i,t)[n.getDay()];case 0:let s=n.getHours(),a=n.getMinutes();if(o){let l=t1(e),u=n1(e,i,t),d=l.findIndex(f=>{if(Array.isArray(f)){let[g,p]=f,_=s>=g.hours&&a>=g.minutes,T=s<p.hours||s===p.hours&&a<p.minutes;if(g.hours<p.hours){if(_&&T)return!0}else if(_||T)return!0}else if(f.hours===s&&f.minutes===a)return!0;return!1});if(d!==-1)return u[d]}return QU(e,i,t)[s<12?0:1];case 3:return ZU(e,t)[n.getFullYear()<=0?0:1];default:let c=r;throw new oe(2302,!1)}}function eT(n){return function(e,r,t){let i=-1*t,o=lg(r,ms.MinusSign),s=i>0?Math.floor(i/60):Math.ceil(i/60);switch(n){case 0:return(i>=0?"+":"")+Mi(s,2,o)+Mi(Math.abs(i%60),2,o);case 1:return"GMT"+(i>=0?"+":"")+Mi(s,1,o);case 2:return"GMT"+(i>=0?"+":"")+Mi(s,2,o)+":"+Mi(Math.abs(i%60),2,o);case 3:return t===0?"Z":(i>=0?"+":"")+Mi(s,2,o)+":"+Mi(Math.abs(i%60),2,o);default:throw new oe(2310,!1)}}}var oY=0,nT=4;function sY(n){let e=rT(n,oY,1).getDay();return rT(n,0,1+(e<=nT?nT:nT+7)-e)}function i1(n){let e=n.getDay(),r=e===0?-3:nT-e;return rT(n.getFullYear(),n.getMonth(),n.getDate()+r)}function QR(n,e=!1){return function(r,t){let i;if(e){let o=new Date(r.getFullYear(),r.getMonth(),1).getDay()-1,s=r.getDate();i=1+Math.floor((s+o)/7)}else{let o=i1(r),s=sY(o.getFullYear()),a=o.getTime()-s.getTime();i=1+Math.round(a/6048e5)}return Mi(i,n,lg(t,ms.MinusSign))}}function tT(n,e=!1){return function(r,t){let o=i1(r).getFullYear();return Mi(o,n,lg(t,ms.MinusSign),e)}}var XR={};function aY(n){if(XR[n])return XR[n];let e;switch(n){case"G":case"GG":case"GGG":e=pt(3,ot.Abbreviated);break;case"GGGG":e=pt(3,ot.Wide);break;case"GGGGG":e=pt(3,ot.Narrow);break;case"y":e=nn(0,1,0,!1,!0);break;case"yy":e=nn(0,2,0,!0,!0);break;case"yyy":e=nn(0,3,0,!1,!0);break;case"yyyy":e=nn(0,4,0,!1,!0);break;case"Y":e=tT(1);break;case"YY":e=tT(2,!0);break;case"YYY":e=tT(3);break;case"YYYY":e=tT(4);break;case"M":case"L":e=nn(1,1,1);break;case"MM":case"LL":e=nn(1,2,1);break;case"MMM":e=pt(2,ot.Abbreviated);break;case"MMMM":e=pt(2,ot.Wide);break;case"MMMMM":e=pt(2,ot.Narrow);break;case"LLL":e=pt(2,ot.Abbreviated,Qn.Standalone);break;case"LLLL":e=pt(2,ot.Wide,Qn.Standalone);break;case"LLLLL":e=pt(2,ot.Narrow,Qn.Standalone);break;case"w":e=QR(1);break;case"ww":e=QR(2);break;case"W":e=QR(1,!0);break;case"d":e=nn(2,1);break;case"dd":e=nn(2,2);break;case"c":case"cc":e=nn(7,1);break;case"ccc":e=pt(1,ot.Abbreviated,Qn.Standalone);break;case"cccc":e=pt(1,ot.Wide,Qn.Standalone);break;case"ccccc":e=pt(1,ot.Narrow,Qn.Standalone);break;case"cccccc":e=pt(1,ot.Short,Qn.Standalone);break;case"E":case"EE":case"EEE":e=pt(1,ot.Abbreviated);break;case"EEEE":e=pt(1,ot.Wide);break;case"EEEEE":e=pt(1,ot.Narrow);break;case"EEEEEE":e=pt(1,ot.Short);break;case"a":case"aa":case"aaa":e=pt(0,ot.Abbreviated);break;case"aaaa":e=pt(0,ot.Wide);break;case"aaaaa":e=pt(0,ot.Narrow);break;case"b":case"bb":case"bbb":e=pt(0,ot.Abbreviated,Qn.Standalone,!0);break;case"bbbb":e=pt(0,ot.Wide,Qn.Standalone,!0);break;case"bbbbb":e=pt(0,ot.Narrow,Qn.Standalone,!0);break;case"B":case"BB":case"BBB":e=pt(0,ot.Abbreviated,Qn.Format,!0);break;case"BBBB":e=pt(0,ot.Wide,Qn.Format,!0);break;case"BBBBB":e=pt(0,ot.Narrow,Qn.Format,!0);break;case"h":e=nn(3,1,-12);break;case"hh":e=nn(3,2,-12);break;case"H":e=nn(3,1);break;case"HH":e=nn(3,2);break;case"m":e=nn(4,1);break;case"mm":e=nn(4,2);break;case"s":e=nn(5,1);break;case"ss":e=nn(5,2);break;case"S":e=nn(6,1);break;case"SS":e=nn(6,2);break;case"SSS":e=nn(6,3);break;case"Z":case"ZZ":case"ZZZ":e=eT(0);break;case"ZZZZZ":e=eT(3);break;case"O":case"OO":case"OOO":case"z":case"zz":case"zzz":e=eT(1);break;case"OOOO":case"ZZZZ":case"zzzz":e=eT(2);break;default:return null}return XR[n]=e,e}function o1(n,e){n=n.replace(/:/g,"");let r=Date.parse("Jan 01, 1970 00:00:00 "+n)/6e4;return isNaN(r)?e:r}function cY(n,e){return n=new Date(n.getTime()),n.setMinutes(n.getMinutes()+e),n}function lY(n,e,r){let i=n.getTimezoneOffset(),o=o1(e,i);return cY(n,-1*(o-i))}function uY(n){if(HU(n))return n;if(typeof n=="number"&&!isNaN(n))return new Date(n);if(typeof n=="string"){if(n=n.trim(),/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(n)){let[i,o=1,s=1]=n.split("-").map(a=>+a);return rT(i,o-1,s)}let r=parseFloat(n);if(!isNaN(n-r))return new Date(r);let t;if(t=n.match(eY))return dY(t)}let e=new Date(n);if(!HU(e))throw new oe(2311,!1);return e}function dY(n){let e=new Date(0),r=0,t=0,i=n[8]?e.setUTCFullYear:e.setFullYear,o=n[8]?e.setUTCHours:e.setHours;n[9]&&(r=Number(n[9]+n[10]),t=Number(n[9]+n[11])),i.call(e,Number(n[1]),Number(n[2])-1,Number(n[3]));let s=Number(n[4]||0)-r,a=Number(n[5]||0)-t,c=Number(n[6]||0),l=Math.floor(parseFloat("0."+(n[7]||0))*1e3);return o.call(e,s,a,c,l),e}function HU(n){return n instanceof Date&&!isNaN(n.valueOf())}var JR=/\s+/,WU=[],hY=(()=>{class n{_ngEl;_renderer;initialClasses=WU;rawClass;stateMap=new Map;constructor(r,t){this._ngEl=r,this._renderer=t}set klass(r){this.initialClasses=r!=null?r.trim().split(JR):WU}set ngClass(r){this.rawClass=typeof r=="string"?r.trim().split(JR):r}ngDoCheck(){for(let t of this.initialClasses)this._updateState(t,!0);let r=this.rawClass;if(Array.isArray(r)||r instanceof Set)for(let t of r)this._updateState(t,!0);else if(r!=null)for(let t of Object.keys(r))this._updateState(t,!!r[t]);this._applyStateDiff()}_updateState(r,t){let i=this.stateMap.get(r);i!==void 0?(i.enabled!==t&&(i.changed=!0,i.enabled=t),i.touched=!0):this.stateMap.set(r,{enabled:t,changed:!0,touched:!0})}_applyStateDiff(){for(let r of this.stateMap){let t=r[0],i=r[1];i.changed?(this._toggleClass(t,i.enabled),i.changed=!1):i.touched||(i.enabled&&this._toggleClass(t,!1),this.stateMap.delete(t)),i.touched=!1}}_toggleClass(r,t){r=r.trim(),r.length>0&&r.split(JR).forEach(i=>{t?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(t){return new(t||n)(ut(oa),ut($_))};static \u0275dir=Do({type:n,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return n})();var iT=class{$implicit;ngForOf;index;count;constructor(e,r,t,i){this.$implicit=e,this.ngForOf=r,this.index=t,this.count=i}get first(){return this.index===0}get last(){return this.index===this.count-1}get even(){return this.index%2===0}get odd(){return!this.even}},s1=(()=>{class n{_viewContainer;_template;_differs;set ngForOf(r){this._ngForOf=r,this._ngForOfDirty=!0}set ngForTrackBy(r){this._trackByFn=r}get ngForTrackBy(){return this._trackByFn}_ngForOf=null;_ngForOfDirty=!0;_differ=null;_trackByFn;constructor(r,t,i){this._viewContainer=r,this._template=t,this._differs=i}set ngForTemplate(r){r&&(this._template=r)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let r=this._ngForOf;!this._differ&&r&&(this._differ=this._differs.find(r).create(this.ngForTrackBy))}if(this._differ){let r=this._differ.diff(this._ngForOf);r&&this._applyChanges(r)}}_applyChanges(r){let t=this._viewContainer;r.forEachOperation((i,o,s)=>{if(i.previousIndex==null)t.createEmbeddedView(this._template,new iT(i.item,this._ngForOf,-1,-1),s===null?void 0:s);else if(s==null)t.remove(o===null?void 0:o);else if(o!==null){let a=t.get(o);t.move(a,s),zU(a,i)}});for(let i=0,o=t.length;i<o;i++){let a=t.get(i).context;a.index=i,a.count=o,a.ngForOf=this._ngForOf}r.forEachIdentityChange(i=>{let o=t.get(i.currentIndex);zU(o,i)})}static ngTemplateContextGuard(r,t){return!0}static \u0275fac=function(t){return new(t||n)(ut(Ao),ut(vo),ut(zR))};static \u0275dir=Do({type:n,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}})}return n})();function zU(n,e){n.context.$implicit=e.item}var fY=(()=>{class n{_viewContainer;_context=new oT;_thenTemplateRef=null;_elseTemplateRef=null;_thenViewRef=null;_elseViewRef=null;constructor(r,t){this._viewContainer=r,this._thenTemplateRef=t}set ngIf(r){this._context.$implicit=this._context.ngIf=r,this._updateView()}set ngIfThen(r){qU(r,!1),this._thenTemplateRef=r,this._thenViewRef=null,this._updateView()}set ngIfElse(r){qU(r,!1),this._elseTemplateRef=r,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngIfUseIfTypeGuard;static ngTemplateGuard_ngIf;static ngTemplateContextGuard(r,t){return!0}static \u0275fac=function(t){return new(t||n)(ut(Ao),ut(vo))};static \u0275dir=Do({type:n,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}})}return n})(),oT=class{$implicit=null;ngIf=null};function qU(n,e){if(n&&!n.createEmbeddedView)throw new oe(2020,!1)}var sT=class{_viewContainerRef;_templateRef;_created=!1;constructor(e,r){this._viewContainerRef=e,this._templateRef=r}create(){this._created=!0,this._viewContainerRef.createEmbeddedView(this._templateRef)}destroy(){this._created=!1,this._viewContainerRef.clear()}enforceState(e){e&&!this._created?this.create():!e&&this._created&&this.destroy()}},ZR=(()=>{class n{_defaultViews=[];_defaultUsed=!1;_caseCount=0;_lastCaseCheckIndex=0;_lastCasesMatched=!1;_ngSwitch;set ngSwitch(r){this._ngSwitch=r,this._caseCount===0&&this._updateDefaultCases(!0)}_addCase(){return this._caseCount++}_addDefault(r){this._defaultViews.push(r)}_matchCase(r){let t=r===this._ngSwitch;return this._lastCasesMatched||=t,this._lastCaseCheckIndex++,this._lastCaseCheckIndex===this._caseCount&&(this._updateDefaultCases(!this._lastCasesMatched),this._lastCaseCheckIndex=0,this._lastCasesMatched=!1),t}_updateDefaultCases(r){if(this._defaultViews.length>0&&r!==this._defaultUsed){this._defaultUsed=r;for(let t of this._defaultViews)t.enforceState(r)}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Do({type:n,selectors:[["","ngSwitch",""]],inputs:{ngSwitch:"ngSwitch"}})}return n})(),gY=(()=>{class n{ngSwitch;_view;ngSwitchCase;constructor(r,t,i){this.ngSwitch=i,i._addCase(),this._view=new sT(r,t)}ngDoCheck(){this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase))}static \u0275fac=function(t){return new(t||n)(ut(Ao),ut(vo),ut(ZR,9))};static \u0275dir=Do({type:n,selectors:[["","ngSwitchCase",""]],inputs:{ngSwitchCase:"ngSwitchCase"}})}return n})(),mY=(()=>{class n{constructor(r,t,i){i._addDefault(new sT(r,t))}static \u0275fac=function(t){return new(t||n)(ut(Ao),ut(vo),ut(ZR,9))};static \u0275dir=Do({type:n,selectors:[["","ngSwitchDefault",""]]})}return n})();var pY=(()=>{class n{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(r,t,i){this._ngEl=r,this._differs=t,this._renderer=i}set ngStyle(r){this._ngStyle=r,!this._differ&&r&&(this._differ=this._differs.find(r).create())}ngDoCheck(){if(this._differ){let r=this._differ.diff(this._ngStyle);r&&this._applyChanges(r)}}_setStyle(r,t){let[i,o]=r.split("."),s=i.indexOf("-")===-1?void 0:Li.DashCase;t!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,o?`${t}${o}`:t,s):this._renderer.removeStyle(this._ngEl.nativeElement,i,s)}_applyChanges(r){r.forEachRemovedItem(t=>this._setStyle(t.key,null)),r.forEachAddedItem(t=>this._setStyle(t.key,t.currentValue)),r.forEachChangedItem(t=>this._setStyle(t.key,t.currentValue))}static \u0275fac=function(t){return new(t||n)(ut(oa),ut(Q_),ut($_))};static \u0275dir=Do({type:n,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return n})(),EY=(()=>{class n{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(r){this._viewContainerRef=r}ngOnChanges(r){if(this._shouldRecreateView(r)){let t=this._viewContainerRef;if(this._viewRef&&t.remove(t.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let i=this._createContextForwardProxy();this._viewRef=t.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(r){return!!r.ngTemplateOutlet||!!r.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(r,t,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,t,i):!1,get:(r,t,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,t,i)}})}static \u0275fac=function(t){return new(t||n)(ut(Ao))};static \u0275dir=Do({type:n,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[UD]})}return n})();function a1(n,e){return new oe(2100,!1)}var _Y=/(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])\S*/g,TY=(()=>{class n{transform(r){if(r==null)return null;if(typeof r!="string")throw a1(n,r);return r.replace(_Y,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Qf({name:"titlecase",type:n,pure:!0})}return n})();var IY="mediumDate",c1=new Z(""),l1=new Z(""),vY=(()=>{class n{locale;defaultTimezone;defaultOptions;constructor(r,t,i){this.locale=r,this.defaultTimezone=t,this.defaultOptions=i}transform(r,t,i,o){if(r==null||r===""||r!==r)return null;try{let s=t??this.defaultOptions?.dateFormat??IY,a=i??this.defaultOptions?.timezone??this.defaultTimezone??void 0;return r1(r,s,o||this.locale,a)}catch(s){throw a1(n,s.message)}}static \u0275fac=function(t){return new(t||n)(ut(tg,16),ut(c1,24),ut(l1,24))};static \u0275pipe=Qf({name:"date",type:n,pure:!0})}return n})();function yY(n,e){return{key:n,value:e}}var SY=(()=>{class n{differs;constructor(r){this.differs=r}differ;keyValues=[];compareFn=KU;transform(r,t=KU){if(!r||!(r instanceof Map)&&typeof r!="object")return null;this.differ??=this.differs.find(r).create();let i=this.differ.diff(r),o=t!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(s=>{this.keyValues.push(yY(s.key,s.currentValue))})),(i||o)&&(t&&this.keyValues.sort(t),this.compareFn=t),this.keyValues}static \u0275fac=function(t){return new(t||n)(ut(Q_,16))};static \u0275pipe=Qf({name:"keyvalue",type:n,pure:!1})}return n})();function KU(n,e){let r=n.key,t=e.key;if(r===t)return 0;if(r==null)return 1;if(t==null)return-1;if(typeof r=="string"&&typeof t=="string")return r<t?-1:1;if(typeof r=="number"&&typeof t=="number")return r-t;if(typeof r=="boolean"&&typeof t=="boolean")return r<t?-1:1;let i=String(r),o=String(t);return i==o?0:i<o?-1:1}var eC=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=sa({type:n});static \u0275inj=rs({})}return n})();function ug(n,e){e=encodeURIComponent(e);for(let r of n.split(";")){let t=r.indexOf("="),[i,o]=t==-1?[r,""]:[r.slice(0,t),r.slice(t+1)];if(i.trim()===e)return decodeURIComponent(o)}return null}var Xc=class{};var tC="browser";function u1(n){return n===tC}var dg=class{_doc;constructor(e){this._doc=e}manager},aT=(()=>{class n extends dg{constructor(r){super(r)}supports(r){return!0}addEventListener(r,t,i,o){return r.addEventListener(t,i,o),()=>this.removeEventListener(r,t,i,o)}removeEventListener(r,t,i,o){return r.removeEventListener(t,i,o)}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),lT=new Z(""),sC=(()=>{class n{_zone;_plugins;_eventNameToPlugin=new Map;constructor(r,t){this._zone=t,r.forEach(s=>{s.manager=this});let i=r.filter(s=>!(s instanceof aT));this._plugins=i.slice().reverse();let o=r.find(s=>s instanceof aT);o&&this._plugins.push(o)}addEventListener(r,t,i,o){return this._findPluginFor(t).addEventListener(r,t,i,o)}getZone(){return this._zone}_findPluginFor(r){let t=this._eventNameToPlugin.get(r);if(t)return t;if(t=this._plugins.find(o=>o.supports(r)),!t)throw new oe(5101,!1);return this._eventNameToPlugin.set(r,t),t}static \u0275fac=function(t){return new(t||n)(w(lT),w(be))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),nC="ng-app-id";function d1(n){for(let e of n)e.remove()}function h1(n,e){let r=e.createElement("style");return r.textContent=n,r}function AY(n,e,r,t){let i=n.head?.querySelectorAll(`style[${nC}="${e}"],link[${nC}="${e}"]`);if(i)for(let o of i)o.removeAttribute(nC),o instanceof HTMLLinkElement?t.set(o.href.slice(o.href.lastIndexOf("/")+1),{usage:0,elements:[o]}):o.textContent&&r.set(o.textContent,{usage:0,elements:[o]})}function iC(n,e){let r=e.createElement("link");return r.setAttribute("rel","stylesheet"),r.setAttribute("href",n),r}var aC=(()=>{class n{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(r,t,i,o={}){this.doc=r,this.appId=t,this.nonce=i,AY(r,t,this.inline,this.external),this.hosts.add(r.head)}addStyles(r,t){for(let i of r)this.addUsage(i,this.inline,h1);t?.forEach(i=>this.addUsage(i,this.external,iC))}removeStyles(r,t){for(let i of r)this.removeUsage(i,this.inline);t?.forEach(i=>this.removeUsage(i,this.external))}addUsage(r,t,i){let o=t.get(r);o?o.usage++:t.set(r,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(r,this.doc)))})}removeUsage(r,t){let i=t.get(r);i&&(i.usage--,i.usage<=0&&(d1(i.elements),t.delete(r)))}ngOnDestroy(){for(let[,{elements:r}]of[...this.inline,...this.external])d1(r);this.hosts.clear()}addHost(r){this.hosts.add(r);for(let[t,{elements:i}]of this.inline)i.push(this.addElement(r,h1(t,this.doc)));for(let[t,{elements:i}]of this.external)i.push(this.addElement(r,iC(t,this.doc)))}removeHost(r){this.hosts.delete(r)}addElement(r,t){return this.nonce&&t.setAttribute("nonce",this.nonce),r.appendChild(t)}static \u0275fac=function(t){return new(t||n)(w(Dn),w(O_),w(ad,8),w(ds))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),rC={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},cC=/%COMP%/g;var g1="%COMP%",DY=`_nghost-${g1}`,RY=`_ngcontent-${g1}`,CY=!0,NY=new Z("",{providedIn:"root",factory:()=>CY});function OY(n){return RY.replace(cC,n)}function wY(n){return DY.replace(cC,n)}function m1(n,e){return e.map(r=>r.replace(cC,n))}var lC=(()=>{class n{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;platformIsServer;constructor(r,t,i,o,s,a,c=null,l=null){this.eventManager=r,this.sharedStylesHost=t,this.appId=i,this.removeStylesOnCompDestroy=o,this.doc=s,this.ngZone=a,this.nonce=c,this.tracingService=l,this.platformIsServer=!1,this.defaultRenderer=new hg(r,s,a,this.platformIsServer,this.tracingService)}createRenderer(r,t){if(!r||!t)return this.defaultRenderer;let i=this.getOrCreateRenderer(r,t);return i instanceof cT?i.applyToHost(r):i instanceof fg&&i.applyStyles(),i}getOrCreateRenderer(r,t){let i=this.rendererByCompId,o=i.get(t.id);if(!o){let s=this.doc,a=this.ngZone,c=this.eventManager,l=this.sharedStylesHost,u=this.removeStylesOnCompDestroy,d=this.platformIsServer,f=this.tracingService;switch(t.encapsulation){case cs.Emulated:o=new cT(c,l,t,this.appId,u,s,a,d,f);break;case cs.ShadowDom:return new oC(c,l,r,t,s,a,this.nonce,d,f);default:o=new fg(c,l,t,u,s,a,d,f);break}i.set(t.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(r){this.rendererByCompId.delete(r)}static \u0275fac=function(t){return new(t||n)(w(sC),w(aC),w(O_),w(NY),w(Dn),w(be),w(ad),w(Yc,8))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),hg=class{eventManager;doc;ngZone;platformIsServer;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,r,t,i,o){this.eventManager=e,this.doc=r,this.ngZone=t,this.platformIsServer=i,this.tracingService=o}destroy(){}destroyNode=null;createElement(e,r){return r?this.doc.createElementNS(rC[r]||r,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,r){(f1(e)?e.content:e).appendChild(r)}insertBefore(e,r,t){e&&(f1(e)?e.content:e).insertBefore(r,t)}removeChild(e,r){r.remove()}selectRootElement(e,r){let t=typeof e=="string"?this.doc.querySelector(e):e;if(!t)throw new oe(-5104,!1);return r||(t.textContent=""),t}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,r,t,i){if(i){r=i+":"+r;let o=rC[i];o?e.setAttributeNS(o,r,t):e.setAttribute(r,t)}else e.setAttribute(r,t)}removeAttribute(e,r,t){if(t){let i=rC[t];i?e.removeAttributeNS(i,r):e.removeAttribute(`${t}:${r}`)}else e.removeAttribute(r)}addClass(e,r){e.classList.add(r)}removeClass(e,r){e.classList.remove(r)}setStyle(e,r,t,i){i&(Li.DashCase|Li.Important)?e.style.setProperty(r,t,i&Li.Important?"important":""):e.style[r]=t}removeStyle(e,r,t){t&Li.DashCase?e.style.removeProperty(r):e.style[r]=""}setProperty(e,r,t){e!=null&&(e[r]=t)}setValue(e,r){e.nodeValue=r}listen(e,r,t,i){if(typeof e=="string"&&(e=Ro().getGlobalEventTarget(this.doc,e),!e))throw new oe(5102,!1);let o=this.decoratePreventDefault(t);return this.tracingService?.wrapEventListener&&(o=this.tracingService.wrapEventListener(e,r,o)),this.eventManager.addEventListener(e,r,o,i)}decoratePreventDefault(e){return r=>{if(r==="__ngUnwrap__")return e;e(r)===!1&&r.preventDefault()}}};function f1(n){return n.tagName==="TEMPLATE"&&n.content!==void 0}var oC=class extends hg{sharedStylesHost;hostEl;shadowRoot;constructor(e,r,t,i,o,s,a,c,l){super(e,o,s,c,l),this.sharedStylesHost=r,this.hostEl=t,this.shadowRoot=t.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let u=i.styles;u=m1(i.id,u);for(let f of u){let g=document.createElement("style");a&&g.setAttribute("nonce",a),g.textContent=f,this.shadowRoot.appendChild(g)}let d=i.getExternalStyles?.();if(d)for(let f of d){let g=iC(f,o);a&&g.setAttribute("nonce",a),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,r){return super.appendChild(this.nodeOrShadowRoot(e),r)}insertBefore(e,r,t){return super.insertBefore(this.nodeOrShadowRoot(e),r,t)}removeChild(e,r){return super.removeChild(null,r)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},fg=class extends hg{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,r,t,i,o,s,a,c,l){super(e,o,s,a,c),this.sharedStylesHost=r,this.removeStylesOnCompDestroy=i;let u=t.styles;this.styles=l?m1(l,u):u,this.styleUrls=t.getExternalStyles?.(l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&zc.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},cT=class extends fg{contentAttr;hostAttr;constructor(e,r,t,i,o,s,a,c,l){let u=i+"-"+t.id;super(e,r,t,o,s,a,c,l,u),this.contentAttr=OY(u),this.hostAttr=wY(u)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,r){let t=super.createElement(e,r);return super.setAttribute(t,this.contentAttr,""),t}};var uT=class n extends og{supportsDOMEvents=!0;static makeCurrent(){qR(new n)}onAndCancel(e,r,t,i){return e.addEventListener(r,t,i),()=>{e.removeEventListener(r,t,i)}}dispatchEvent(e,r){e.dispatchEvent(r)}remove(e){e.remove()}createElement(e,r){return r=r||this.getDefaultDocument(),r.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,r){return r==="window"?window:r==="document"?e:r==="body"?e.body:null}getBaseHref(e){let r=bY();return r==null?null:LY(r)}resetBaseElement(){gg=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return ug(document.cookie,e)}},gg=null;function bY(){return gg=gg||document.head.querySelector("base"),gg?gg.getAttribute("href"):null}function LY(n){return new URL(n,document.baseURI).pathname}var dT=class{addToWindow(e){tn.getAngularTestability=(t,i=!0)=>{let o=e.findTestabilityInTree(t,i);if(o==null)throw new oe(5103,!1);return o},tn.getAllAngularTestabilities=()=>e.getAllTestabilities(),tn.getAllAngularRootElements=()=>e.getAllRootElements();let r=t=>{let i=tn.getAllAngularTestabilities(),o=i.length,s=function(){o--,o==0&&t()};i.forEach(a=>{a.whenStable(s)})};tn.frameworkStabilizers||(tn.frameworkStabilizers=[]),tn.frameworkStabilizers.push(r)}findTestabilityInTree(e,r,t){if(r==null)return null;let i=e.getTestability(r);return i??(t?Ro().isShadowRoot(r)?this.findTestabilityInTree(e,r.host,!0):this.findTestabilityInTree(e,r.parentElement,!0):null)}},MY=(()=>{class n{build(){return new XMLHttpRequest}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),p1=["alt","control","meta","shift"],PY={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},xY={alt:n=>n.altKey,control:n=>n.ctrlKey,meta:n=>n.metaKey,shift:n=>n.shiftKey},E1=(()=>{class n extends dg{constructor(r){super(r)}supports(r){return n.parseEventName(r)!=null}addEventListener(r,t,i,o){let s=n.parseEventName(t),a=n.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Ro().onAndCancel(r,s.domEventName,a,o))}static parseEventName(r){let t=r.toLowerCase().split("."),i=t.shift();if(t.length===0||!(i==="keydown"||i==="keyup"))return null;let o=n._normalizeKey(t.pop()),s="",a=t.indexOf("code");if(a>-1&&(t.splice(a,1),s="code."),p1.forEach(l=>{let u=t.indexOf(l);u>-1&&(t.splice(u,1),s+=l+".")}),s+=o,t.length!=0||o.length===0)return null;let c={};return c.domEventName=i,c.fullKey=s,c}static matchEventFullKeyCode(r,t){let i=PY[r.key]||r.key,o="";return t.indexOf("code.")>-1&&(i=r.code,o="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),p1.forEach(s=>{if(s!==i){let a=xY[s];a(r)&&(o+=s+".")}}),o+=i,o===t)}static eventCallback(r,t,i){return o=>{n.matchEventFullKeyCode(o,r)&&i.runGuarded(()=>t(o))}}static _normalizeKey(r){return r==="esc"?"escape":r}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();function FY(){uT.makeCurrent()}function kY(){return new xr}function UY(){return GD(document),document}var VY=[{provide:ds,useValue:tC},{provide:w_,useValue:FY,multi:!0},{provide:Dn,useFactory:UY}],BY=jR(PU,"browser",VY);var GY=[{provide:cd,useClass:dT},{provide:H_,useClass:Xf,deps:[be,Jf,cd]},{provide:Xf,useClass:Xf,deps:[be,Jf,cd]}],$Y=[{provide:Nf,useValue:"root"},{provide:xr,useFactory:kY},{provide:lT,useClass:aT,multi:!0,deps:[Dn]},{provide:lT,useClass:E1,multi:!0,deps:[Dn]},lC,aC,sC,{provide:us,useExisting:lC},{provide:Xc,useClass:MY},[]],jY=(()=>{class n{constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275mod=sa({type:n});static \u0275inj=rs({providers:[...$Y,...GY],imports:[eC,xU]})}return n})();var dd=class{},mg=class{},la=class n{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(e){e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(`
5
+ `).forEach(r=>{let t=r.indexOf(":");if(t>0){let i=r.slice(0,t),o=r.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((r,t)=>{this.addHeaderEntry(t,r)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([r,t])=>{this.setHeaderEntries(r,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let r=this.headers.get(e.toLowerCase());return r&&r.length>0?r[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,r){return this.clone({name:e,value:r,op:"a"})}set(e,r){return this.clone({name:e,value:r,op:"s"})}delete(e,r){return this.clone({name:e,value:r,op:"d"})}maybeSetNormalizedName(e,r){this.normalizedNames.has(r)||this.normalizedNames.set(r,e)}init(){this.lazyInit&&(this.lazyInit instanceof n?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(e=>this.applyUpdate(e)),this.lazyUpdate=null))}copyFrom(e){e.init(),Array.from(e.headers.keys()).forEach(r=>{this.headers.set(r,e.headers.get(r)),this.normalizedNames.set(r,e.normalizedNames.get(r))})}clone(e){let r=new n;return r.lazyInit=this.lazyInit&&this.lazyInit instanceof n?this.lazyInit:this,r.lazyUpdate=(this.lazyUpdate||[]).concat([e]),r}applyUpdate(e){let r=e.name.toLowerCase();switch(e.op){case"a":case"s":let t=e.value;if(typeof t=="string"&&(t=[t]),t.length===0)return;this.maybeSetNormalizedName(e.name,r);let i=(e.op==="a"?this.headers.get(r):void 0)||[];i.push(...t),this.headers.set(r,i);break;case"d":let o=e.value;if(!o)this.headers.delete(r),this.normalizedNames.delete(r);else{let s=this.headers.get(r);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(r),this.normalizedNames.delete(r)):this.headers.set(r,s)}break}}addHeaderEntry(e,r){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(r):this.headers.set(t,[r])}setHeaderEntries(e,r){let t=(Array.isArray(r)?r:[r]).map(o=>o.toString()),i=e.toLowerCase();this.headers.set(i,t),this.maybeSetNormalizedName(e,i)}forEach(e){this.init(),Array.from(this.normalizedNames.keys()).forEach(r=>e(this.normalizedNames.get(r),this.headers.get(r)))}};var fT=class{encodeKey(e){return _1(e)}encodeValue(e){return _1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function HY(n,e){let r=new Map;return n.length>0&&n.replace(/^\?/,"").split("&").forEach(i=>{let o=i.indexOf("="),[s,a]=o==-1?[e.decodeKey(i),""]:[e.decodeKey(i.slice(0,o)),e.decodeValue(i.slice(o+1))],c=r.get(s)||[];c.push(a),r.set(s,c)}),r}var WY=/%(\d[a-f0-9])/gi,zY={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function _1(n){return encodeURIComponent(n).replace(WY,(e,r)=>zY[r]??e)}function hT(n){return`${n}`}var ps=class n{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new fT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=HY(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(r=>{let t=e.fromObject[r],i=Array.isArray(t)?t.map(hT):[hT(t)];this.map.set(r,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let r=this.map.get(e);return r?r[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,r){return this.clone({param:e,value:r,op:"a"})}appendAll(e){let r=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{r.push({param:t,value:o,op:"a"})}):r.push({param:t,value:i,op:"a"})}),this.clone(r)}set(e,r){return this.clone({param:e,value:r,op:"s"})}delete(e,r){return this.clone({param:e,value:r,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let r=this.encoder.encodeKey(e);return this.map.get(e).map(t=>r+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let r=new n({encoder:this.encoder});return r.cloneFrom=this.cloneFrom||this,r.updates=(this.updates||[]).concat(e),r}init(){this.map===null&&(this.map=new Map),this.cloneFrom!==null&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(e=>this.map.set(e,this.cloneFrom.map.get(e))),this.updates.forEach(e=>{switch(e.op){case"a":case"s":let r=(e.op==="a"?this.map.get(e.param):void 0)||[];r.push(hT(e.value)),this.map.set(e.param,r);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(hT(e.value));i!==-1&&t.splice(i,1),t.length>0?this.map.set(e.param,t):this.map.delete(e.param)}else{this.map.delete(e.param);break}}}),this.cloneFrom=this.updates=null)}};var gT=class{map=new Map;set(e,r){return this.map.set(e,r),this}get(e){return this.map.has(e)||this.map.set(e,e.defaultValue()),this.map.get(e)}delete(e){return this.map.delete(e),this}has(e){return this.map.has(e)}keys(){return this.map.keys()}};function qY(n){switch(n){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function T1(n){return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer}function I1(n){return typeof Blob<"u"&&n instanceof Blob}function v1(n){return typeof FormData<"u"&&n instanceof FormData}function KY(n){return typeof URLSearchParams<"u"&&n instanceof URLSearchParams}var y1="Content-Type",S1="Accept",D1="X-Request-URL",R1="text/plain",C1="application/json",YY=`${C1}, ${R1}, */*`,ld=class n{url;body=null;headers;context;reportProgress=!1;withCredentials=!1;credentials;keepalive=!1;cache;priority;mode;redirect;referrer;integrity;responseType="json";method;params;urlWithParams;transferCache;timeout;constructor(e,r,t,i){this.url=r,this.method=e.toUpperCase();let o;if(qY(this.method)||i?(this.body=t!==void 0?t:null,o=i):o=t,o){if(this.reportProgress=!!o.reportProgress,this.withCredentials=!!o.withCredentials,this.keepalive=!!o.keepalive,o.responseType&&(this.responseType=o.responseType),o.headers&&(this.headers=o.headers),o.context&&(this.context=o.context),o.params&&(this.params=o.params),o.priority&&(this.priority=o.priority),o.cache&&(this.cache=o.cache),o.credentials&&(this.credentials=o.credentials),typeof o.timeout=="number"){if(o.timeout<1||!Number.isInteger(o.timeout))throw new oe(2822,"");this.timeout=o.timeout}o.mode&&(this.mode=o.mode),o.redirect&&(this.redirect=o.redirect),o.integrity&&(this.integrity=o.integrity),o.referrer&&(this.referrer=o.referrer),this.transferCache=o.transferCache}if(this.headers??=new la,this.context??=new gT,!this.params)this.params=new ps,this.urlWithParams=r;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=r;else{let a=r.indexOf("?"),c=a===-1?"?":a<r.length-1?"&":"";this.urlWithParams=r+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||T1(this.body)||I1(this.body)||v1(this.body)||KY(this.body)?this.body:this.body instanceof ps?this.body.toString():typeof this.body=="object"||typeof this.body=="boolean"||Array.isArray(this.body)?JSON.stringify(this.body):this.body.toString()}detectContentTypeHeader(){return this.body===null||v1(this.body)?null:I1(this.body)?this.body.type||null:T1(this.body)?null:typeof this.body=="string"?R1:this.body instanceof ps?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?C1:null}clone(e={}){let r=e.method||this.method,t=e.url||this.url,i=e.responseType||this.responseType,o=e.keepalive??this.keepalive,s=e.priority||this.priority,a=e.cache||this.cache,c=e.mode||this.mode,l=e.redirect||this.redirect,u=e.credentials||this.credentials,d=e.referrer||this.referrer,f=e.integrity||this.integrity,g=e.transferCache??this.transferCache,p=e.timeout??this.timeout,_=e.body!==void 0?e.body:this.body,T=e.withCredentials??this.withCredentials,S=e.reportProgress??this.reportProgress,b=e.headers||this.headers,B=e.params||this.params,x=e.context??this.context;return e.setHeaders!==void 0&&(b=Object.keys(e.setHeaders).reduce((U,$)=>U.set($,e.setHeaders[$]),b)),e.setParams&&(B=Object.keys(e.setParams).reduce((U,$)=>U.set($,e.setParams[$]),B)),new n(r,t,_,{params:B,headers:b,context:x,reportProgress:S,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},Jc=(function(n){return n[n.Sent=0]="Sent",n[n.UploadProgress=1]="UploadProgress",n[n.ResponseHeader=2]="ResponseHeader",n[n.DownloadProgress=3]="DownloadProgress",n[n.Response=4]="Response",n[n.User=5]="User",n})(Jc||{}),hd=class{headers;status;statusText;url;ok;type;redirected;constructor(e,r=200,t="OK"){this.headers=e.headers||new la,this.status=e.status!==void 0?e.status:r,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},mT=class n extends hd{constructor(e={}){super(e)}type=Jc.ResponseHeader;clone(e={}){return new n({headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0})}},pg=class n extends hd{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=Jc.Response;clone(e={}){return new n({body:e.body!==void 0?e.body:this.body,headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0,redirected:e.redirected??this.redirected})}},ud=class extends hd{name="HttpErrorResponse";message;error;ok=!1;constructor(e){super(e,0,"Unknown Error"),this.status>=200&&this.status<300?this.message=`Http failure during parsing for ${e.url||"(unknown url)"}`:this.message=`Http failure response for ${e.url||"(unknown url)"}: ${e.status} ${e.statusText}`,this.error=e.error||null}},QY=200,XY=204;function uC(n,e){return{body:e,headers:n.headers,context:n.context,observe:n.observe,params:n.params,reportProgress:n.reportProgress,responseType:n.responseType,withCredentials:n.withCredentials,credentials:n.credentials,transferCache:n.transferCache,timeout:n.timeout,keepalive:n.keepalive,priority:n.priority,cache:n.cache,mode:n.mode,redirect:n.redirect,integrity:n.integrity,referrer:n.referrer}}var N1=(()=>{class n{handler;constructor(r){this.handler=r}request(r,t,i={}){let o;if(r instanceof ld)o=r;else{let c;i.headers instanceof la?c=i.headers:c=new la(i.headers);let l;i.params&&(i.params instanceof ps?l=i.params:l=new ps({fromObject:i.params})),o=new ld(r,t,i.body!==void 0?i.body:null,{headers:c,context:i.context,params:l,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache,keepalive:i.keepalive,priority:i.priority,cache:i.cache,mode:i.mode,redirect:i.redirect,credentials:i.credentials,referrer:i.referrer,integrity:i.integrity,timeout:i.timeout})}let s=ue(o).pipe(vS(c=>this.handler.handle(c)));if(r instanceof ld||i.observe==="events")return s;let a=s.pipe(Ct(c=>c instanceof pg));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof ArrayBuffer))throw new oe(2806,!1);return c.body}));case"blob":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof Blob))throw new oe(2807,!1);return c.body}));case"text":return a.pipe(fe(c=>{if(c.body!==null&&typeof c.body!="string")throw new oe(2808,!1);return c.body}));default:return a.pipe(fe(c=>c.body))}case"response":return a;default:throw new oe(2809,!1)}}delete(r,t={}){return this.request("DELETE",r,t)}get(r,t={}){return this.request("GET",r,t)}head(r,t={}){return this.request("HEAD",r,t)}jsonp(r,t){return this.request("JSONP",r,{params:new ps().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(r,t={}){return this.request("OPTIONS",r,t)}patch(r,t,i={}){return this.request("PATCH",r,uC(i,t))}post(r,t,i={}){return this.request("POST",r,uC(i,t))}put(r,t,i={}){return this.request("PUT",r,uC(i,t))}static \u0275fac=function(t){return new(t||n)(w(dd))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var JY=new Z("");function O1(n,e){return e(n)}function ZY(n,e){return(r,t)=>e.intercept(r,{handle:i=>n(i,t)})}function e7(n,e,r){return(t,i)=>ho(r,()=>e(t,o=>n(o,i)))}var w1=new Z(""),hC=new Z(""),b1=new Z(""),fC=new Z("",{providedIn:"root",factory:()=>!0});function t7(){let n=null;return(e,r)=>{n===null&&(n=(ne(w1,{optional:!0})??[]).reduceRight(ZY,O1));let t=ne(To);if(ne(fC)){let o=t.add();return n(e,r).pipe(yc(o))}else return n(e,r)}}var pT=(()=>{class n extends dd{backend;injector;chain=null;pendingTasks=ne(To);contributeToStability=ne(fC);constructor(r,t){super(),this.backend=r,this.injector=t}handle(r){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(hC),...this.injector.get(b1,[])]));this.chain=t.reduceRight((i,o)=>e7(i,o,this.injector),O1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(r,i=>this.backend.handle(i)).pipe(yc(t))}else return this.chain(r,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||n)(w(mg),w(Kn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var n7=/^\)\]\}',?\n/,r7=RegExp(`^${D1}:`,"m");function i7(n){return"responseURL"in n&&n.responseURL?n.responseURL:r7.test(n.getAllResponseHeaders())?n.getResponseHeader(D1):null}var dC=(()=>{class n{xhrFactory;constructor(r){this.xhrFactory=r}handle(r){if(r.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return ue(null).pipe(mt(()=>new ge(o=>{let s=t.build();if(s.open(r.method,r.urlWithParams),r.withCredentials&&(s.withCredentials=!0),r.headers.forEach((T,S)=>s.setRequestHeader(T,S.join(","))),r.headers.has(S1)||s.setRequestHeader(S1,YY),!r.headers.has(y1)){let T=r.detectContentTypeHeader();T!==null&&s.setRequestHeader(y1,T)}if(r.timeout&&(s.timeout=r.timeout),r.responseType){let T=r.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=r.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",S=new la(s.getAllResponseHeaders()),b=i7(s)||r.url;return c=new mT({headers:S,status:s.status,statusText:T,url:b}),c},u=()=>{let{headers:T,status:S,statusText:b,url:B}=l(),x=null;S!==XY&&(x=typeof s.response>"u"?s.responseText:s.response),S===0&&(S=x?QY:0);let U=S>=200&&S<300;if(r.responseType==="json"&&typeof x=="string"){let $=x;x=x.replace(n7,"");try{x=x!==""?JSON.parse(x):null}catch(A){x=$,U&&(U=!1,x={error:A,text:x})}}U?(o.next(new pg({body:x,headers:T,status:S,statusText:b,url:B||void 0})),o.complete()):o.error(new ud({error:x,headers:T,status:S,statusText:b,url:B||void 0}))},d=T=>{let{url:S}=l(),b=new ud({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:S||void 0});o.error(b)},f=d;r.timeout&&(f=T=>{let{url:S}=l(),b=new ud({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:S||void 0});o.error(b)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let S={type:Jc.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(S.total=T.total),r.responseType==="text"&&s.responseText&&(S.partialText=s.responseText),o.next(S)},_=T=>{let S={type:Jc.UploadProgress,loaded:T.loaded};T.lengthComputable&&(S.total=T.total),o.next(S)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),r.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:Jc.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),r.reportProgress&&(s.removeEventListener("progress",p),a!==null&&s.upload&&s.upload.removeEventListener("progress",_)),s.readyState!==s.DONE&&s.abort()}})))}static \u0275fac=function(t){return new(t||n)(w(Xc))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),L1=new Z(""),o7="XSRF-TOKEN",s7=new Z("",{providedIn:"root",factory:()=>o7}),a7="X-XSRF-TOKEN",c7=new Z("",{providedIn:"root",factory:()=>a7}),Eg=class{},l7=(()=>{class n{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(r,t){this.doc=r,this.cookieName=t}getToken(){let r=this.doc.cookie||"";return r!==this.lastCookieString&&(this.parseCount++,this.lastToken=ug(r,this.cookieName),this.lastCookieString=r),this.lastToken}static \u0275fac=function(t){return new(t||n)(w(Dn),w(s7))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),u7=/^(?:https?:)?\/\//i;function d7(n,e){if(!ne(L1)||n.method==="GET"||n.method==="HEAD"||u7.test(n.url))return e(n);let r=ne(Eg).getToken(),t=ne(c7);return r!=null&&!n.headers.has(t)&&(n=n.clone({headers:n.headers.set(t,r)})),e(n)}var gC=(function(n){return n[n.Interceptors=0]="Interceptors",n[n.LegacyInterceptors=1]="LegacyInterceptors",n[n.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",n[n.NoXsrfProtection=3]="NoXsrfProtection",n[n.JsonpSupport=4]="JsonpSupport",n[n.RequestsMadeViaParent=5]="RequestsMadeViaParent",n[n.Fetch=6]="Fetch",n})(gC||{});function h7(n,e){return{\u0275kind:n,\u0275providers:e}}function f7(...n){let e=[N1,dC,pT,{provide:dd,useExisting:pT},{provide:mg,useFactory:()=>ne(JY,{optional:!0})??ne(dC)},{provide:hC,useValue:d7,multi:!0},{provide:L1,useValue:!0},{provide:Eg,useClass:l7}];for(let r of n)e.push(...r.\u0275providers);return mr(e)}var A1=new Z("");function g7(){return h7(gC.LegacyInterceptors,[{provide:A1,useFactory:t7},{provide:hC,useExisting:A1,multi:!0}])}var mC=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:function(t){let i=null;return t?i=new(t||n):i=w(m7),i},providedIn:"root"})}return n})(),m7=(()=>{class n extends mC{_doc;constructor(r){super(),this._doc=r}sanitize(r,t){if(t==null)return null;switch(r){case oi.NONE:return t;case oi.HTML:return yo(t,"HTML")?Vr(t):M_(this._doc,String(t)).toString();case oi.STYLE:return yo(t,"Style")?Vr(t):t;case oi.SCRIPT:if(yo(t,"Script"))return Vr(t);throw new oe(5200,!1);case oi.URL:return yo(t,"URL")?Vr(t):jf(String(t));case oi.RESOURCE_URL:if(yo(t,"ResourceURL"))return Vr(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(r){return HD(r)}bypassSecurityTrustStyle(r){return WD(r)}bypassSecurityTrustScript(r){return zD(r)}bypassSecurityTrustUrl(r){return qD(r)}bypassSecurityTrustResourceUrl(r){return KD(r)}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var st={production:!1,staging:!0,firebaseLogLevel:"error",firebaseConfig:{apiKey:"AIzaSyAzcW2n1JhY_zhkXmuFcwe550AkwmYeJ0w",authDomain:"snipply-sdk-staging.firebaseapp.com",projectId:"snipply-sdk-staging",storageBucket:"snipply-sdk-staging.appspot.com",messagingSenderId:"877538579326",appId:"1:877538579326:web:f793f73f2b7dc770c4992f"},firebaseNotificationsDatabaseURL:"https://snipply-sdk-staging-notifications.firebaseio.com",segmentAnalyticsWriteKey:"ndJ0KZs5LkL6jny5a43FXXQkTF5bgPFt",useEmulators:!1,debugMode:!1,cloudFunction:{sa:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",getIceServers:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/geticeservers",validateClient:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/validateclient",convertRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/convertrecordingv2",chatgptCompletion:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/chatgptcompletion",rewriterAskAi:"https://staging.velt.dev/v2/rewriter/ask-ai",whisperTranscription:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/whispertranscription",getPlanDetails:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getplandetails",getAllowedDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getalloweddocuments",getNotificationsForDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getnotificationsfordocuments",videoBackend:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/videobackend",processRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/processrecording",sdkProxy:"https://staging.velt.dev/v2/core/a",screenshot:"https://staging.velt.dev/v2/screenshots/capture",usCentral1:{setEncryptedData:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/setencrypteddata"},asiaSouthEast1:{setEncryptedData:"https://asia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau"},europeWest1:{setEncryptedData:"https://europe-west1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataeu"},asiaNorthEast1:{setEncryptedData:"https://asia-northeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddatajp"},australiaSouthEast1:{setEncryptedData:"https://australia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau1"}}};var Be=(function(n){return n.NEWLY_ADDED="newlyAdded",n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.ASSIGNED="assigned",n.STATUS_CHANGED="statusChanged",n.PRIORITY_CHANGED="priorityChanged",n.ACCESS_MODE_CHANGED="accessModeChanged",n.CUSTOM_LIST_CHANGED="customListChanged",n.ACCEPTED="accepted",n.REJECTED="rejected",n.REACTION_ADDED="reactionAdded",n.REACTION_DELETED="reactionDeleted",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",n.SUGGESTION_ACCEPTED="suggestionAccepted",n.SUGGESTION_REJECTED="suggestionRejected",n})(Be||{}),Qt=(function(n){return n.COMMENT_ANNOTATION_ADD="comment_annotation.add",n.COMMENT_ANNOTATION_DELETE="comment_annotation.delete",n.COMMENT_ADD="comment.add",n.COMMENT_DELETE="comment.delete",n.COMMENT_UPDATE="comment.update",n.REACTION_ADD="reaction.add",n.REACTION_DELETE="reaction.delete",n.ATTACHMENT_ADD="attachment.add",n.ATTACHMENT_DELETE="attachment.delete",n.RECORDER_ANNOTATION_ADD="recorder_annotation.add",n.RECORDER_ANNOTATION_UPDATE="recorder_annotation.update",n.RECORDER_ANNOTATION_DELETE="recorder_annotation.delete",n.ACTIVITY_SAVE="activity.save",n})(Qt||{}),mAe={ADD_COMMENT_ANNOTATION:"addCommentAnnotation",ADD_COMMENT_ANNOTATION_DRAFT:"addCommentAnnotationDraft",DELETE_COMMENT_ANNOTATION:"deleteCommentAnnotation",APPROVE_COMMENT_ANNOTATION:"approveCommentAnnotation",ACCEPT_COMMENT_ANNOTATION:"acceptCommentAnnotation",REJECT_COMMENT_ANNOTATION:"rejectCommentAnnotation",SUBSCRIBE_COMMENT_ANNOTATION:"subscribeCommentAnnotation",UNSUBSCRIBE_COMMENT_ANNOTATION:"unsubscribeCommentAnnotation",ASSIGN_USER:"assignUser",UPDATE_STATUS:"updateStatus",UPDATE_PRIORITY:"updatePriority",UPDATE_ACCESS:"updateAccess",RESOLVE_COMMENT:"resolveComment",ADD_COMMENT:"addComment",ADD_COMMENT_DRAFT:"addCommentDraft",UPDATE_COMMENT:"updateComment",DELETE_COMMENT:"deleteComment",ADD_ATTACHMENT:"addAttachment",DELETE_ATTACHMENT:"deleteAttachment",DELETE_RECORDING:"deleteRecording",COPY_LINK:"copyLink",ADD_REACTION:"addReaction",DELETE_REACTION:"deleteReaction",TOGGLE_REACTION:"toggleReaction",COMMENT_SIDEBAR_DATA_INIT:"commentSidebarDataInit",COMMENT_SIDEBAR_DATA_UPDATE:"commentSidebarDataUpdate",AUTOCOMPLETE_SEARCH:"autocompleteSearch",COMPOSER_CLICKED:"composerClicked",COMPOSER_TEXT_CHANGE:"composerTextChange",LINK_CLICKED:"linkClicked",COMMENT_PIN_CLICKED:"commentPinClicked",COMMENT_BUBBLE_CLICKED:"commentBubbleClicked",COMMENT_TOOL_CLICK:"commentToolClick",COMMENT_TOOL_CLICKED:"commentToolClicked",SIDEBAR_BUTTON_CLICK:"sidebarButtonClick",SIDEBAR_BUTTON_CLICKED:"sidebarButtonClicked",ATTACHMENT_DOWNLOAD_CLICKED:"attachmentDownloadClicked",COMMENT_SAVED:"commentSaved",COMMENT_SAVE_TRIGGERED:"commentSaveTriggered",VISIBILITY_OPTION_CLICKED:"visibilityOptionClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},pAe={TRANSCRIPTION_DONE:"transcriptionDone",RECORDING_DONE:"recordingDone",RECORDING_EDIT_DONE:"recordingEditDone",DELETE_RECORDING:"deleteRecording",ERROR:"error",RECORDING_SAVE_INITIATED:"recordingSaveInitiated",RECORDING_STARTED:"recordingStarted",RECORDING_PAUSED:"recordingPaused",RECORDING_RESUMED:"recordingResumed",RECORDING_CANCELLED:"recordingCancelled",RECORDING_STOPPED:"recordingStopped",RECORDING_DONE_LOCAL:"recordingDoneLocal"},EAe={TEXT_SELECTED:"textSelected"},_Ae={SUGGESTION_CREATED:"suggestionCreated",SUGGESTION_APPROVED:"suggestionApproved",SUGGESTION_REJECTED:"suggestionRejected",SUGGESTION_STALE:"suggestionStale",TARGET_EDIT_START:"targetEditStart",TARGET_EDIT_COMMIT:"targetEditCommit"},G={PERMISSION_PROVIDER:"permissionProvider",USER_RESOLVER:"userResolver",COMMENT_RESOLVER:"commentResolver",ATTACHMENT_RESOLVER:"attachmentResolver",REACTION_RESOLVER:"reactionResolver",RECORDER_RESOLVER:"recorderResolver",NOTIFICATION_RESOLVER:"notificationResolver",ACTIVITY_RESOLVER:"activityResolver",VELT_BUTTON_CLICK:"veltButtonClick",USER_UPDATE:"userUpdate",INIT_UPDATE:"initUpdate",DOCUMENT_INIT:"documentInit",ERROR:"error"},TAe={ACCESS_REQUESTED:"accessRequested",ACCESS_REQUEST_CANCELED:"accessRequestCanceled",ACCESS_ACCEPTED:"accessAccepted",ACCESS_REJECTED:"accessRejected",EDITOR_ASSIGNED:"editorAssigned",VIEWER_ASSIGNED:"viewerAssigned",EDITOR_ON_DIFFERENT_TAB_DETECTED:"editorOnDifferentTabDetected"},IAe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},vAe={SETTINGS_UPDATED:"settingsUpdated"},yAe={UPDATE_DATA:"updateData"},E7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(E7||{}),_7=(function(n){return n.INVITE="invite",n.REMOVE="remove",n})(_7||{}),T7=(function(n){return n.CREATED="created",n.JOINED="joined",n})(T7||{}),I7=(function(n){return n.UPDATE_DATA="updateData",n})(I7||{}),ET=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(ET||{}),v7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(v7||{}),y7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(y7||{}),S7=(function(n){return n.FIRST_VIEWED="firstViewed",n})(S7||{}),pC=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.ACTIVITY="activity",n.VIEWS="views",n.USER_INVITE="userInvite",n.USER_REQUEST="userRequest",n.VIDEO_PLAYER="videoPlayer",n.CRDT="crdt",n})(pC||{}),A7=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.AREA_COMMENT="areaComment",n.INLINE_COMMENT="inlineComment",n.COMMENT_SIDEBAR="commentSidebar",n})(A7||{}),Gr=(function(n){return n.DESKTOP="Desktop",n.MOBILE="Mobile",n.TABLET="Tablet",n.MONITOR="Monitor",n.UNKNOWN="Unknown",n})(Gr||{}),fd=(function(n){return n.PORTRAIT="portrait",n.LANDSCAPE="landscape",n.UNKNOWN="unknown",n})(fd||{}),_T=(function(n){return n.Portrait="(orientation: portrait)",n.Landscape="(orientation: landscape)",n})(_T||{}),D7=(function(n){return n.DIFFERENT_DEVICE="differentDevice",n.ELEMENT_DELETED="elementDeleted",n})(D7||{}),gd=(function(n){return n.ADMIN="Admin",n.COMMENTER="Commenter",n})(gd||{}),wt=(function(n){return n.PUBLIC="public",n.RESTRICTED="restricted",n.ORGANIZATION_PRIVATE="organizationPrivate",n})(wt||{}),R7=(function(n){return n.DEFAULT="default",n.DYNAMIC_ID="dynamicId",n})(R7||{}),_g=(function(n){return n.PUBLIC="public",n.PRIVATE="private",n})(_g||{}),C7=(function(n){return n.MINIMAL="minimal",n.VERBOSE="verbose",n})(C7||{}),N7=(function(n){return n.DEFAULT="default",n.EXPANDED="expanded",n})(N7||{}),O7=(function(n){return n.TOTAL="total",n.UNREAD="unread",n})(O7||{}),w7=(function(n){return n.ONLINE="online",n.OFFLINE="offline",n.PENDING_INIT="pendingInit",n.PENDING_DATA="pendingData",n})(w7||{}),b7=(function(n){return n.ALL="all",n.ORGANIZATION="organization",n.ORGANIZATION_USER_GROUP="organizationUserGroup",n.DOCUMENT="document",n.FOLDER="folder",n})(b7||{}),L7=(function(n){return n.AND="and",n.OR="or",n})(L7||{}),M7=(function(n){return n.RESTRICTED_SELF="restrictedSelf",n.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",n.ORGANIZATION_PRIVATE="organizationPrivate",n.PUBLIC="public",n})(M7||{});var q=class q{};q.SNIPPYLY_HOST_URL_PROD="https://snippyly.com",q.SNIPPYLY_HOST_URL_STAGING="https://snippyly-staging.web.app",q.USER_TYPE_ANONYMOUS="anonymous",q.USER_TYPE_SIGNED_IN="signedIn",q.LOCALSTORAGE_DATA_ID="snippylytempdata",q.NO_ORGANIZATION_ID="veltNoOrganization",q.DEFAULT_QUERY_HASH="default",q.LISTENER_BATCH_SIZE=5,q.LISTENER_CONTEXT_BATCH_SIZE=25,q.DEFAULT_VELT_CONTEXT="default:velt",q.VISIBILITY_SELF_PREFIX="__velt_private_self:",q.FIREBASE_PARTIAL_PATH_ORGANIZATIONS="organizations",q.FIREBASE_PARTIAL_PATH_FOLDERS="folders",q.FIREBASE_PARTIAL_PATH_DOCS="docs",q.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS="documentConfigurations",q.FIREBASE_PARTIAL_PATH_PRESENCE="presence",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS="orgIamUsers",q.FIREBASE_PARTIAL_PATH_CENTRAL_USERS="users",q.FIREBASE_PARTIAL_PATH_FOLDER_USERS="folderIamUsers",q.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS="docIamUsers",q.FIREBASE_PARTIAL_PATH_CURSOR="cursor",q.FIREBASE_PARTIAL_PATH_ARROW="arrow",q.FIREBASE_PARTIAL_PATH_AREA="area",q.FIREBASE_PARTIAL_PATH_COMMENT="comment",q.FIREBASE_PARTIAL_PATH_LOCATION="location",q.FIREBASE_PARTIAL_PATH_MULTI_THREAD="multiThread",q.FIREBASE_PARTIAL_PATH_TAG="tag",q.FIREBASE_PARTIAL_PATH_SELECTION="selection",q.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE="audioHuddle",q.FIREBASE_PARTIAL_PATH_HUDDLE="huddle",q.FIREBASE_PARTIAL_PATH_CONTACTS="contacts",q.FIREBASE_PARTIAL_PATH_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS="notificationsDocs",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS="notificationsUsers",q.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION="notificationsDocs__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION="notificationsUsers__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX="userNotificationIndex",q.FIREBASE_PARTIAL_PATH_GLOBAL="global",q.FIREBASE_PARTIAL_PATH_LOGINS="logins",q.FIREBASE_PARTIAL_PATH_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_LOCATIONS="locations",q.FIREBASE_PARTIAL_PATH_RECORDER="recorder",q.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG="flock",q.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER="syncVideoPlayer",q.FIREBASE_PARTIAL_PATH_LIVE_STATE="liveState",q.FIREBASE_PARTIAL_PATH_IAM="iam",q.FIREBASE_PARTIAL_PATH_REACTION="reaction",q.FIREBASE_PARTIAL_PATH_CRDT="crdt",q.FIREBASE_PARTIAL_PATH_VIEWS="views",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS="notificationViews",q.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS="documentViews",q.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS="locationViews",q.FIREBASE_PARTIAL_PATH_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP="lastNotificationTimestamp",q.FIREBASE_PARTIAL_PATH_ACTIVITIES="activities",q.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP="lastActivityTimestamp",q.FIREBASE_PARTIAL_PATH_HEARTBEAT="heartbeat",q.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT="heartbeatByDocument",q.FIREBASE_PARTIAL_PATH_USERS="users",q.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS="permissions",q.FIREBASE_PARTIAL_PATH_USER_REQUESTS="userRequests",q.FIREBASE_PARTIAL_PATH_FEEDBACK="feedback",q.FIREBASE_PARTIAL_PATH_BUGS="bugs",q.FIREBASE_PARTIAL_PATH_CONTACT_US="contactUs",q.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA="metadata",q.PRESENCE_STATUS_ONLINE="online",q.PRESENCE_STATUS_OFFLINE="offline",q.PRESENCE_STATUS_AWAY="away",q.IMG_URL_NOT_FOUND="https://snippyly.com/assets/icons/anon-user.svg",q.IMG_CLASS_NOT_FOUND="presence-avatar-image-small",q.AVATAR_COLOR_LIST=["#a259fe","#9746ff","#19bcfe","#FE8947","#2c83fc","#0dcf82","#ffcb00","#ff7162","#FFD600","#A5A7FE","#67DBF4","#FDA192"],q.TEXT_COLOR_MAP={"#a259fe":"#ffffff","#9746ff":"#ffffff","#19bcfe":"#ffffff","#FE8947":"#ffffff","#2c83fc":"#ffffff","#0dcf82":"#141416","#ffcb00":"#141416","#ff7162":"#ffffff","#FFD600":"#141416","#A5A7FE":"#141416","#67DBF4":"#141416","#FDA192":"#141416"},q.UNREAD_COMMENTS_CHECK_FROM_DATE="2024-02-05",q.DEFAULT_ANNOTATION_COLOR="#a259fe",q.REGEX_EMAIL=/(\+|@)+([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,q.REGEX_URL=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)(?::[0-9]+)?((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_0-9]*)#?(?:[\.\!\/\\\w0-9=]*))?)/gi,q.REGEX_URL_FOR_USER_NAME=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,q.REGEX_SPECIAL_CHARS=/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,q.SNIPPYLY_HIGHLIGHT="snippyly-highlight",q.SNIPPYLY_HIGHLIGHT_PREVIEW="snippyly-highlight-preview",q.SNIPPYLY_HIGHLIGHT_USER="snippyly-highlight-user",q.SNIPPYLY_HIGHLIGHT_USER_NAME="snippyly-highlight-user-name",q.SNIPPYLY_HIGHLIGHT_USER_TEXT="snippyly-highlight-user-text",q.VELT_LIVE_SELECTION_ON_ELEMENT="velt-live-selection-on-element",q.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT="velt-live-selection-on-element-default",q.VELT_LIVE_SELECTION_ON_TEXT="velt-live-selection-on-text",q.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT="velt-live-selection-on-text-default",q.VELT_IGNORE_CHANGE_DETECTION="velt-ignore-change-detection",q.VELT_CUSTOM_CSS="velt-custom-css",q.TAGS={SNIPPYLY_ROOT:"snippyly-root",SNIPPYLY_PRESENCE:"snippyly-presence",SNIPPYLY_CURSOR:"snippyly-cursor",SNIPPYLY_COMMENT_TOOL:"snippyly-comment-tool",SNIPPYLY_COMMENTS:"snippyly-comments",SNIPPYLY_TAG_TOOL:"snippyly-tag-tool",SNIPPYLY_TAGS:"snippyly-tags",SNIPPYLY_RECORDER_NOTES:"snippyly-recorder-notes",SNIPPYLY_RECORDER_CONTROL_PANEL:"snippyly-recorder-control-panel",SNIPPYLY_RECORDER_CONTROL_PANEL_INTERNAL:"snippyly-recorder-control-panel-internal",SNIPPYLY_RECORDER_PLAYER:"snippyly-recorder-player",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",SNIPPYLY_COMMENT_TEXT_PORTAL:"snippyly-comment-text-portal",SNIPPYLY_COMMENT_TEXT:"snippyly-comment-text",SNIPPYLY_COMMENTS_SIDEBAR:"snippyly-comments-sidebar",SNIPPYLY_COMMENT_BUBBLE:"snippyly-comment-bubble",SNIPPYLY_HIGHLIGHT_USER_TEXT:"snippyly-highlight-user-text",SNIPPYLY_AUDIO_HUDDLE:"snippyly-audio-huddle",SNIPPYLY_VIDEO_HUDDLE:"snippyly-video-huddle",SNIPPYLY_HUDDLE:"snippyly-huddle",SNIPPYLY_HUDDLE_TOOL:"snippyly-huddle-tool",SNIPPYLY_RECORDER_TOOL:"snippyly-recorder-tool",SNIPPYLY_PLUGIN:"snippyly-plugin",SNIPPYLY_MENU:"snippyly-menu",SNIPPYLY_COMMENT_DIALOG:"snippyly-comment-dialog",SNIPPYLY_SIDEBAR_BUTTON:"snippyly-sidebar-button",SNIPPYLY_REWRITER:"snippyly-rewriter",SNIPPYLY_USER_INVITE_TOOL:"snippyly-user-invite-tool",SNIPPYLY_USER_REQUEST_TOOL:"snippyly-user-request-tool",SNIPPYLY_USER_AVATAR:"snippyly-user-avatar",SNIPPYLY_ARROW_TOOL:"snippyly-arrow-tool",SNIPPYLY_ARROWS:"snippyly-arrows",SNIPPYLY_AREA_TOOL:"snippyly-area-tool",SNIPPYLY_AREAS:"snippyly-areas",VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",VELT_TAG_TOOL:"velt-tag-tool",VELT_TAGS:"velt-tags",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_RECORDER_CONTROL_PANEL_EMBED:"velt-recorder-control-panel-embed",SNIPPYLY_RECORDER_CONTROL_PANEL_EMBED:"snippyly-recorder-control-panel-embed",VELT_RECORDER_PLAYER:"velt-recorder-player",VELT_RECORDER_PLAYER_EMBED:"velt-recorder-player-embed",SNIPPYLY_RECORDER_PLAYER_EMBED:"snippyly-recorder-player-embed",VELT_VIDEO_EDITOR:"velt-video-editor",VELT_TEXT_HIGHLIGHT:"velt-text-highlight",VELT_COMMENT_TEXT_PORTAL:"velt-comment-text-portal",VELT_COMMENTS_SIDEBAR:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_COMMENT_SIDEBAR_SKELETON_V2:"velt-comment-sidebar-skeleton-v2",VELT_COMMENT_SIDEBAR_PANEL_V2:"velt-comment-sidebar-panel-v2",VELT_COMMENT_SIDEBAR_LIST_V2:"velt-comment-sidebar-list-v2",VELT_COMMENT_SIDEBAR_LIST_ITEM_V2:"velt-comment-sidebar-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_V2:"velt-comment-sidebar-filter-dropdown-content-list-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-content-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_INDICATOR_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-indicator-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_COUNT_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-count-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_V2:"velt-comment-sidebar-filter-dropdown-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_TRIGGER_V2:"velt-comment-sidebar-filter-dropdown-trigger-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2:"velt-comment-sidebar-filter-button-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2_APPLIED_ICON:"velt-comment-sidebar-filter-button-v2-applied-icon",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2:"velt-comment-sidebar-filter-container-v2",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION:"velt-comment-sidebar-filter-container-v2-section",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_FIELD:"velt-comment-sidebar-filter-container-v2-section-field",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LIST:"velt-comment-sidebar-filter-container-v2-section-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LABEL:"velt-comment-sidebar-filter-container-v2-section-label",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL:"velt-comment-sidebar-filter-container-v2-section-control",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_LIST:"velt-comment-sidebar-filter-container-v2-section-option-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION:"velt-comment-sidebar-filter-container-v2-section-option",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_CHECKBOX:"velt-comment-sidebar-filter-container-v2-section-option-checkbox",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_VALUE:"velt-comment-sidebar-filter-container-v2-section-control-value",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP:"velt-comment-sidebar-filter-container-v2-section-control-chip",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP_LIST:"velt-comment-sidebar-filter-container-v2-section-control-chip-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_SEARCH:"velt-comment-sidebar-filter-container-v2-section-control-search",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHEVRON:"velt-comment-sidebar-filter-container-v2-section-control-chevron",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_NAME:"velt-comment-sidebar-filter-container-v2-section-option-name",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_COUNT:"velt-comment-sidebar-filter-container-v2-section-option-count",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_TITLE:"velt-comment-sidebar-filter-container-v2-title",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_CLOSE_BUTTON:"velt-comment-sidebar-filter-container-v2-close-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_GROUP_BY:"velt-comment-sidebar-filter-container-v2-group-by",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_RESET_BUTTON:"velt-comment-sidebar-filter-container-v2-reset-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_APPLY_BUTTON:"velt-comment-sidebar-filter-container-v2-apply-button",VELT_COMMENT_SIDEBAR_SEARCH_V2:"velt-comment-sidebar-search-v2",VELT_COMMENT_SIDEBAR_SEARCH_V2_ICON:"velt-comment-sidebar-search-v2-icon",VELT_COMMENT_SIDEBAR_SEARCH_V2_INPUT:"velt-comment-sidebar-search-v2-input",VELT_COMMENT_SIDEBAR_FULLSCREEN_BUTTON_V2:"velt-comment-sidebar-fullscreen-button-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2:"velt-comment-sidebar-list-group-header-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_LABEL:"velt-comment-sidebar-list-group-header-v2-label",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_COUNT:"velt-comment-sidebar-list-group-header-v2-count",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_SEPARATOR:"velt-comment-sidebar-list-group-header-v2-separator",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_CHEVRON:"velt-comment-sidebar-list-group-header-v2-chevron",VELT_COMMENT_SIDEBAR_HEADER_V2:"velt-comment-sidebar-header-v2",VELT_COMMENT_SIDEBAR_CLOSE_BUTTON_V2:"velt-comment-sidebar-close-button-v2",VELT_COMMENT_SIDEBAR_EMPTY_PLACEHOLDER_V2:"velt-comment-sidebar-empty-placeholder-v2",VELT_COMMENT_SIDEBAR_RESET_FILTER_BUTTON_V2:"velt-comment-sidebar-reset-filter-button-v2",VELT_COMMENT_SIDEBAR_PAGE_MODE_COMPOSER_V2:"velt-comment-sidebar-page-mode-composer-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_V2:"velt-comment-sidebar-focused-thread-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_BACK_BUTTON_V2:"velt-comment-sidebar-focused-thread-back-button-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_DIALOG_CONTAINER_V2:"velt-comment-sidebar-focused-thread-dialog-container-v2",VELT_COMMENT_BUBBLE:"velt-comment-bubble",VELT_COMMENT_BUBBLE_AVATAR:"velt-comment-bubble-avatar",VELT_COMMENT_BUBBLE_COMMENTS_COUNT:"velt-comment-bubble-comments-count",VELT_COMMENT_BUBBLE_UNREAD_ICON:"velt-comment-bubble-unread-icon",VELT_COMMENT_THREAD:"velt-comment-thread",VELT_COMMENT_PIN:"velt-comment-pin",VELT_COMMENT_PIN_EMBED:"velt-comment-pin-embed",SNIPPYLY_COMMENT_PIN_EMBED:"snippyly-comment-pin-embed",VELT_COMMENT_PIN_NUMBER:"velt-comment-pin-number",VELT_COMMENT_PIN_INDEX:"velt-comment-pin-index",VELT_COMMENT_PIN_TRIANGLE:"velt-comment-pin-triangle",VELT_COMMENT_PIN_PRIVATE_COMMENT_INDICATOR:"velt-comment-pin-private-comment-indicator",VELT_COMMENT_PIN_GHOST_COMMENT_INDICATOR:"velt-comment-pin-ghost-comment-indicator",VELT_COMMENT_PIN_UNREAD_COMMENT_INDICATOR:"velt-comment-pin-unread-comment-indicator",VELT_SIDEBAR_BUTTON_ICON:"velt-sidebar-button-icon",VELT_SIDEBAR_BUTTON_COMMENTS_COUNT:"velt-sidebar-button-comments-count",VELT_SIDEBAR_BUTTON_UNREAD_ICON:"velt-sidebar-button-unread-icon",VELT_COMMENT_TEXT:"velt-comment-text",VELT_CHART_COMMENT:"velt-chart-comment",VELT_CANVAS_COMMENT:"velt-canvas-comment",VELT_INLINE_COMMENTS_SECTION:"velt-inline-comments-section",VELT_INLINE_COMMENTS_SECTION_SKELETON:"velt-inline-comments-section-skeleton",VELT_INLINE_COMMENTS_SECTION_PANEL:"velt-inline-comments-section-panel",VELT_INLINE_COMMENTS_SECTION_LIST:"velt-inline-comments-section-list",VELT_INLINE_COMMENTS_SECTION_COMPOSER_CONTAINER:"velt-inline-comments-section-composer-container",VELT_INLINE_COMMENTS_SECTION_COMMENT_COUNT:"velt-inline-comments-section-comment-count",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN:"velt-inline-comments-section-sorting-dropdown",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER:"velt-inline-comments-section-sorting-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-sorting-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_ICON:"velt-inline-comments-section-sorting-dropdown-trigger-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT:"velt-inline-comments-section-sorting-dropdown-content",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM:"velt-inline-comments-section-sorting-dropdown-content-item",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_ICON:"velt-inline-comments-section-sorting-dropdown-content-item-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_TICK:"velt-inline-comments-section-sorting-dropdown-content-item-tick",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_NAME:"velt-inline-comments-section-sorting-dropdown-content-item-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN:"velt-inline-comments-section-filter-dropdown",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER:"velt-inline-comments-section-filter-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-filter-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_ARROW:"velt-inline-comments-section-filter-dropdown-trigger-arrow",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT:"velt-inline-comments-section-filter-dropdown-content",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST:"velt-inline-comments-section-filter-dropdown-content-list",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM:"velt-inline-comments-section-filter-dropdown-content-list-item",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_CHECKBOX:"velt-inline-comments-section-filter-dropdown-content-list-item-checkbox",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL:"velt-inline-comments-section-filter-dropdown-content-list-item-label",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_APPLY_BUTTON:"velt-inline-comments-section-filter-dropdown-content-apply-button",VELT_COMMENTS_MINIMAP:"velt-comments-minimap",VELT_HIGHLIGHT_USER_TEXT:"velt-highlight-user-text",VELT_AUDIO_HUDDLE:"velt-audio-huddle",VELT_VIDEO_HUDDLE:"velt-video-huddle",VELT_HUDDLE:"velt-huddle",VELT_HUDDLE_TOOL:"velt-huddle-tool",VELT_RECORDER_TOOL:"velt-recorder-tool",SUPERFLOW_TOOLBAR:"superflow-toolbar",VELT_MENU:"velt-menu",VELT_COMMENT_DIALOG:"velt-comment-dialog-internal",VELT_SIDEBAR_BUTTON:"velt-sidebar-button",VELT_COMMENTS_SIDEBAR_BUTTON:"velt-comments-sidebar-button",VELT_REWRITER:"velt-rewriter",VELT_USER_INVITE_TOOL:"velt-user-invite-tool",VELT_USER_REQUEST_TOOL:"velt-user-request-tool",VELT_USER_AVATAR:"velt-user-avatar",VELT_ARROW_TOOL:"velt-arrow-tool",VELT_ARROWS:"velt-arrows",VELT_AREA_TOOL:"velt-area-tool",VELT_AREAS:"velt-areas",VELT_INLINE_COMMENT:"velt-inline-comment",VELT_VIDEO_PLAYER:"velt-video-player",VELT_VIDEO_COMMENTS_TIMELINE:"velt-comment-player-timeline",VELT_REACTION_TOOL:"velt-reaction-tool",SNIPPYLY_REACTION_TOOL:"snippyly-reaction-tool",VELT_REACTION_PIN:"velt-reaction-pin",SNIPPYLY_REACTION_PIN:"snippyly-reaction-pin",VELT_INLINE_REACTIONS_SECTION:"velt-inline-reactions-section",SNIPPYLY_INLINE_REACTIONS_SECTION:"snippyly-inline-reactions-section",VELT_VIEW_ANALYTICS:"velt-view-analytics",VELT_NOTIFICATIONS_TOOL:"velt-notifications-tool",VELT_NOTIFICATIONS_TOOL_ICON:"velt-notifications-tool-icon",VELT_NOTIFICATIONS_TOOL_UNREAD_ICON:"velt-notifications-tool-unread-icon",VELT_NOTIFICATIONS_TOOL_LABEL:"velt-notifications-tool-label",VELT_NOTIFICATIONS_TOOL_UNREAD_COUNT:"velt-notifications-tool-unread-count",VELT_NOTIFICATIONS_PANEL:"velt-notifications-panel",VELT_NOTIFICATIONS_PANEL_TITLE:"velt-notifications-panel-title",VELT_NOTIFICATIONS_PANEL_TITLE_TEXT:"velt-notifications-panel-title-text",VELT_NOTIFICATIONS_PANEL_HEADER:"velt-notifications-panel-header",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_FOR_YOU:"velt-notifications-panel-header-tab-for-you",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_PEOPLE:"velt-notifications-panel-header-tab-people",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_DOCUMENTS:"velt-notifications-panel-header-tab-documents",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_ALL:"velt-notifications-panel-header-tab-all",VELT_NOTIFICATIONS_PANEL_CONTENT:"velt-notifications-panel-content",VELT_NOTIFICATIONS_PANEL_CONTENT_FOR_YOU:"velt-notifications-panel-content-for-you",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL:"velt-notifications-panel-content-all",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE:"velt-notifications-panel-content-people",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS:"velt-notifications-panel-content-documents",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST:"velt-notifications-panel-content-list",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM:"velt-notifications-panel-content-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_AVATAR:"velt-notifications-panel-content-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_UNREAD:"velt-notifications-panel-content-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_HEADLINE:"velt-notifications-panel-content-list-item-headline",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_BODY:"velt-notifications-panel-content-list-item-body",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_FILE_NAME:"velt-notifications-panel-content-list-item-file-name",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_TIME:"velt-notifications-panel-content-list-item-time",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST:"velt-notifications-panel-content-all-list",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM:"velt-notifications-panel-content-all-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_LABEL:"velt-notifications-panel-content-all-list-item-label",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_CONTENT:"velt-notifications-panel-content-all-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST:"velt-notifications-panel-content-people-list",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM:"velt-notifications-panel-content-people-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_AVATAR:"velt-notifications-panel-content-people-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_NAME:"velt-notifications-panel-content-people-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_COUNT:"velt-notifications-panel-content-people-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_CONTENT:"velt-notifications-panel-content-people-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST:"velt-notifications-panel-content-documents-list",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM:"velt-notifications-panel-content-documents-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_NAME:"velt-notifications-panel-content-documents-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_COUNT:"velt-notifications-panel-content-documents-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_CONTENT:"velt-notifications-panel-content-documents-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_UNREAD:"velt-notifications-panel-content-documents-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LOAD_MORE:"velt-notifications-panel-content-load-more",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_READ_CONTAINER:"velt-notifications-panel-content-all-read-container",VELT_NOTIFICATIONS_PANEL_CLOSE_BUTTON:"velt-notifications-panel-close-button",VELT_NOTIFICATIONS_PANEL_READ_ALL_BUTTON:"velt-notifications-panel-read-all-button",VELT_NOTIFICATIONS_PANEL_VIEW_ALL_BUTTON:"velt-notifications-panel-view-all-button",VELT_NOTIFICATIONS_PANEL_SKELETON:"velt-notifications-panel-skeleton",VELT_NOTIFICATIONS_PANEL_SETTINGS_BUTTON:"velt-notifications-panel-settings-button",VELT_NOTIFICATIONS_PANEL_SETTINGS:"velt-notifications-panel-settings",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER:"velt-notifications-panel-settings-header",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER_TITLE:"velt-notifications-panel-settings-header-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_TITLE:"velt-notifications-panel-settings-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_DESCRIPTION:"velt-notifications-panel-settings-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_LIST:"velt-notifications-panel-settings-list",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TITLE:"velt-notifications-panel-settings-mute-all-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_DESCRIPTION:"velt-notifications-panel-settings-mute-all-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TOGGLE:"velt-notifications-panel-settings-mute-all-toggle",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION:"velt-notifications-panel-settings-accordion",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER:"velt-notifications-panel-settings-accordion-trigger",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_LABEL:"velt-notifications-panel-settings-accordion-trigger-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_ICON:"velt-notifications-panel-settings-accordion-trigger-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_SELECTED_VALUE:"velt-notifications-panel-settings-accordion-trigger-selected-value",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT:"velt-notifications-panel-settings-accordion-content",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM:"velt-notifications-panel-settings-accordion-content-item",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_LABEL:"velt-notifications-panel-settings-accordion-content-item-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_ICON:"velt-notifications-panel-settings-accordion-content-item-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_BACK_BUTTON:"velt-notifications-panel-settings-back-button",VELT_NOTIFICATIONS_PANEL_SETTINGS_FOOTER:"velt-notifications-panel-settings-footer",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel",VELT_WIREFRAME:"velt-wireframe",VELT_AUTOCOMPLETE:"velt-autocomplete",VELT_AUTOCOMPLETE_PANEL:"velt-autocomplete-panel",VELT_AUTOCOMPLETE_OPTION:"velt-autocomplete-option",VELT_AUTOCOMPLETE_OPTION_ICON:"velt-autocomplete-option-icon",VELT_AUTOCOMPLETE_OPTION_NAME:"velt-autocomplete-option-name",VELT_AUTOCOMPLETE_OPTION_DESCRIPTION:"velt-autocomplete-option-description",VELT_AUTOCOMPLETE_OPTION_ERROR_ICON:"velt-autocomplete-option-error-icon",VELT_AUTOCOMPLETE_GROUP_OPTION:"velt-autocomplete-group-option",VELT_AUTOCOMPLETE_TOOL:"velt-autocomplete-tool",VELT_AUTOCOMPLETE_EMPTY:"velt-autocomplete-empty",VELT_AUTOCOMPLETE_CHIP:"velt-autocomplete-chip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP:"velt-autocomplete-chip-tooltip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_ICON:"velt-autocomplete-chip-tooltip-icon",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_NAME:"velt-autocomplete-chip-tooltip-name",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_DESCRIPTION:"velt-autocomplete-chip-tooltip-description",VELT_AUTOCOMPLETE_CONTEXT_WRAPPER:"velt-autocomplete-context-wrapper",VELT_ACTIVITY_LOG:"velt-activity-log",VELT_ACTIVITY_LOG_HEADER:"velt-activity-log-header",VELT_ACTIVITY_LOG_HEADER_TITLE:"velt-activity-log-header-title",VELT_ACTIVITY_LOG_HEADER_CLOSE_BUTTON:"velt-activity-log-header-close-button",VELT_ACTIVITY_LOG_HEADER_FILTER:"velt-activity-log-header-filter",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER:"velt-activity-log-header-filter-trigger",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_LABEL:"velt-activity-log-header-filter-trigger-label",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_ICON:"velt-activity-log-header-filter-trigger-icon",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT:"velt-activity-log-header-filter-content",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM:"velt-activity-log-header-filter-content-item",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_LABEL:"velt-activity-log-header-filter-content-item-label",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_ICON:"velt-activity-log-header-filter-content-item-icon",VELT_ACTIVITY_LOG_LOADING:"velt-activity-log-loading",VELT_ACTIVITY_LOG_LIST:"velt-activity-log-list",VELT_ACTIVITY_LOG_LIST_DATE_GROUP:"velt-activity-log-list-date-group",VELT_ACTIVITY_LOG_LIST_DATE_GROUP_LABEL:"velt-activity-log-list-date-group-label",VELT_ACTIVITY_LOG_LIST_ITEM:"velt-activity-log-list-item",VELT_ACTIVITY_LOG_LIST_ITEM_ICON:"velt-activity-log-list-item-icon",VELT_ACTIVITY_LOG_LIST_ITEM_AVATAR:"velt-activity-log-list-item-avatar",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT:"velt-activity-log-list-item-content",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_USER:"velt-activity-log-list-item-content-user",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_ACTION:"velt-activity-log-list-item-content-action",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_TARGET:"velt-activity-log-list-item-content-target",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_DETAIL:"velt-activity-log-list-item-content-detail",VELT_ACTIVITY_LOG_LIST_ITEM_TIME:"velt-activity-log-list-item-time",VELT_ACTIVITY_LOG_LIST_SHOW_MORE:"velt-activity-log-list-show-more",VELT_ACTIVITY_LOG_EMPTY:"velt-activity-log-empty",VELT_ACTIVITY_LOG_CONTEXT_WRAPPER:"velt-activity-log-context-wrapper",VELT_COMMENT_DIALOG_VISIBILITY_BANNER:"velt-comment-dialog-visibility-banner",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_ICON:"velt-comment-dialog-visibility-banner-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_TEXT:"velt-comment-dialog-visibility-banner-text",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN:"velt-comment-dialog-visibility-banner-dropdown",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER:"velt-comment-dialog-visibility-banner-dropdown-trigger",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_LABEL:"velt-comment-dialog-visibility-banner-dropdown-trigger-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_ITEM:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_REMAINING_COUNT:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-remaining-count",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_ICON:"velt-comment-dialog-visibility-banner-dropdown-trigger-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT:"velt-comment-dialog-visibility-banner-dropdown-content",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM:"velt-comment-dialog-visibility-banner-dropdown-content-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_ICON:"velt-comment-dialog-visibility-banner-dropdown-content-item-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_LABEL:"velt-comment-dialog-visibility-banner-dropdown-content-item-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_USER_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-user-picker",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ORG_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-org-picker",VELT_COMMENT_COMPOSER:"velt-comment-composer",VELT_SKELETON_LOADER:"velt-skeleton-loader",VELT_SHADOW_DOM_INTERNAL:"velt-shadow-dom-internal",VELT_SINGLE_EDITOR_MODE_PANEL:"velt-single-editor-mode-panel",VELT_MULTI_THREAD_COMMENT_DIALOG:"velt-multi-thread-comment-dialog",VELT_MULTI_THREAD_COMMENT_DIALOG_LIST:"velt-multi-thread-comment-dialog-list",VELT_MULTI_THREAD_COMMENT_DIALOG_PANEL:"velt-multi-thread-comment-dialog-panel",VELT_MULTI_THREAD_COMMENT_DIALOG_COMPOSER_CONTAINER:"velt-multi-thread-comment-dialog-composer-container",VELT_MULTI_THREAD_COMMENT_DIALOG_COMMENT_COUNT:"velt-multi-thread-comment-dialog-comment-count",VELT_MULTI_THREAD_COMMENT_DIALOG_EMPTY_PLACEHOLDER:"velt-multi-thread-comment-dialog-empty-placeholder",VELT_MULTI_THREAD_COMMENT_DIALOG_CLOSE_BUTTON:"velt-multi-thread-comment-dialog-close-button",VELT_MULTI_THREAD_COMMENT_DIALOG_NEW_THREAD_BUTTON:"velt-multi-thread-comment-dialog-new-thread-button",VELT_MULTI_THREAD_COMMENT_DIALOG_RESET_FILTER_BUTTON:"velt-multi-thread-comment-dialog-reset-filter-button",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-filter-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_ALL:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-all",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_READ:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_RESOLVED:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-resolved",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SELECTED_ICON:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-selected-icon",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_DATE:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-date",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-actions-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_READ:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_RESOLVED:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-resolved",VELT_TEXT_COMMENT:"velt-text-comment",VELT_TEXT_COMMENT_TOOL:"velt-text-comment-tool",VELT_TEXT_COMMENT_TOOLBAR:"velt-text-comment-toolbar",VELT_TEXT_COMMENT_TOOLBAR_COMMENT_ANNOTATION:"velt-text-comment-toolbar-comment-annotation",VELT_TEXT_COMMENT_TOOLBAR_DIVIDER:"velt-text-comment-toolbar-divider",VELT_TEXT_COMMENT_TOOLBAR_COPYWRITER:"velt-text-comment-toolbar-copywriter",VELT_TEXT_COMMENT_TOOLBAR_GENERIC:"velt-text-comment-toolbar-generic"},q.ATTRIBUTES={VELT_COMMENT_CONTAINER:"data-velt-comment-container",VELT_TARGET_COMMENT_ELEMENT_ID:"data-velt-target-comment-element-id",VELT_COMMENT_TYPE:"data-velt-comment-type",TARGET_INLINE_COMMENT_ELEMENT_ID:"target-inline-comment-element-id",TARGET_COMMENT_ELEMENT_ID:"target-comment-element-id",TARGET_ELEMENT_ID:"target-element-id",VELT_ID:"data-velt-id",VELT_ELEMENT:"data-velt-element",VELT_SCREEN_RECORDER_PANEL:"data-velt-screen-recorder-panel",VELT_SOURCE_ID:"data-velt-source-id",VELT_ANNOTATION_ID:"data-velt-annotation-id",VELT_ANNOTATION_IDS:"data-velt-annotation-ids",VELT_COMMENT_PIN_HOST:"data-velt-comment-pin-host",VELT_COMMENT_PIN_HOST_STATIC:"data-velt-comment-pin-host-static",VELT_COMMENT_DISABLED:"data-velt-comment-disabled",VELT_MANUAL_COMMENT_CONTAINER:"data-velt-manual-comment-container",VELT_COMMENT_PIN_ACTIVE:"data-velt-comment-pin-active",VELT_INLINE_COMMENT_SECTION_CONFIG:"data-velt-inline-comment-section-config",VELT_TARGET_INLINE_COMMENT_ELEMENT_ID:"data-velt-target-inline-comment-element-id",VELT_TAG_PIN_HOST:"data-velt-tag-pin-host",VELT_TAG_PIN_HOST_STATIC:"data-velt-tag-pin-host-static",VELT_TAG_DISABLED:"data-velt-tag-disabled",VELT_RECORDER_PIN_HOST:"data-velt-recorder-pin-host",VELT_RECORDER_PIN_HOST_STATIC:"data-velt-recorder-pin-host-static",VELT_RECORDER_DISABLED:"data-velt-recorder-disabled",VELT_ANNOTATION_DRAFT:"data-velt-annotation-draft",VELT_ANNOTATION_EDIT_COMMENT:"data-velt-annotation-edit-comment",VELT_DOCUMENT_ID:"data-velt-document-id",VELT_LOCATION:"data-velt-location",VELT_LOCATION_ID:"data-velt-location-id",VELT_THEME:"data-velt-theme",VELT_IGNORE:"data-velt-ignore",EMBED_MODE:"embed-mode",DEFAULT_CURSOR:"default-cursor",VELT_HUDDLE_ON_CURSOR_MODE:"data-velt-huddle-on-cursor-mode",VELT_SELECTION_ENABLED:"data-live-selection-enabled",VELT_LIVE_SELECTION_ENABLED:"data-velt-live-selection-enabled",VELT_LIVE_SELECTION_USER_INDICATOR_POSITION:"data-velt-live-selection-user-indicator-position",VELT_LIVE_SELECTION_USER_INDICATOR_TYPE:"data-velt-live-selection-user-indicator-type",VELT_SELECTION_CONFIG:"data-live-selection-config",VELT_POPOVER_MODE:"data-velt-popover-mode",VELT_ELEMENT_CACHE_ID:"data-velt-cache-id",VELT_ARROW_PIN_HOST:"data-velt-arrow-pin-host",VELT_ARROW_PIN_HOST_STATIC:"data-velt-arrow-pin-host-static",VELT_ARROW_DISABLED:"data-velt-arrow-disabled",VELT_AREA_PIN_HOST:"data-velt-area-pin-host",VELT_AREA_PIN_HOST_STATIC:"data-velt-area-pin-host-static",VELT_AREA_DISABLED:"data-velt-area-disabled",VELT_AREA_PIN_ACTIVE:"data-velt-area-pin-active",VELT_SUGGESTION_TARGET:"data-velt-suggestion-target",VELT_ONGOING_RECORDING:"data-velt-ongoing-recording",VELT_COMMENT_RECORDING:"data-velt-comment-recording",SYNC_VIDEO_PLAYER_ID:"data-sync-video-player-id",SYNC_VIDEO_PLAYER:"data-sync-video-player",VELT_INLINE_COMMENT_ID:"inline-comment-id",VELT_PDF_VIEWER:"data-velt-pdf-viewer",VELT_SYNC_STATE:"data-velt-sync-state",VELT_SYNC_ACCESS:"data-velt-sync-access",VELT_SYNC_ACCESS_AUTO:"data-velt-sync-access-auto",VELT_SYNC_ACCESS_DISABLED:"data-velt-sync-access-disabled",VELT_SINGLE_EDITOR_MODE_CONTAINER:"data-velt-single-editor-mode-container",VELT_IFRAME_CONTAINER:"data-velt-iframe-container",VELT_IFRAME_CONTAINER_STATIC:"data-velt-iframe-container-static",VELT_IS_FIRST_COMPONENT:"data-velt-is-first-component",VELT_DOWNLOAD_BUTTON:"velt-download-button",VELT_COMMENT_DIALOG_PORTAL_INTERNAL:"velt-comment-dialog-portal-internal",ANNOTATION_ID:"annotation-id",MULTI_THREAD_ANNOTATION_ID:"multi-thread-annotation-id",SLATE_EDITOR:"data-slate-editor"},q.INJECTION_STYLE_PROPS={VELT_AVATAR_COLOR:"data-velt-avatar-color",VELT_COMMENT_PRIORITY_COLOR:"data-velt-priority-color"},q.BODY_CLASSES={VELT_PIN_DRAGGING:"velt-pin-dragging"},q.INJECTION_ATTRIBUTES={VELT_AVATAR_IMG:"data-velt-avatar-img",VELT_COMMENT_LENGTH:"data-velt-comment-thread-length"},q.SESSION_STORAGE={SNIPPYLY_AUTO_SELECT_ANNOTATION_ID:"snippylyAutoSelectAnnotationId",SNIPPYLY_SELECTED_ANNOTATION_ID:"snippylySelectedAnnotationId",SNIPPYLY_COMMENT_SIDEBAR_FILTERS:"snippylyCommentSidebarFilters",SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY:"snippylyCommentSidebarGroupBy",SNIPPYLY_COMMENT_DIALOG_AUTO_POPULATE_TEXT:"snippylyCommentDialogAutoPopulateText",SNIPPYLY_HUDDLE_DATA:"snippylyHuddleData",VELT_TAB_ID:"veltTabId",VELT_COMMENT_SIDEBAR_FILTERS_RESET:"veltCommentSidebarFiltersReset",VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE:"veltCommentSidebarCustomActionsState",VELT_CURSOR_MULTIPLE_USERS_DETECTED:"veltCursorMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_DETECTED:"veltPresenceMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_ONLINE:"veltPresenceMultipleUsersOnline",VELT_CUSTOM_PRIORITY_MAP:"veltCustomPriorityMap",VELT_CUSTOM_STATUS_MAP:"veltCustomStatusMap",VELT_CUSTOM_CATEGORY_MAP:"veltCustomCategoryMap"},q.LOCAL_STORAGE={SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS:"snippylyDefaultMediaSourceOptions",SNIPPYLY_QUEUED_COMMENT:"snippylyQueuedComment",VELT_USER:"_vu",VELT_IDENTIFY_USER:"_viu",VELT_USER_FORCE_RE_LOGGED_IN:"_vurli",VELT_VERSION:"_vv",VELT_ADVANCED_QUERIES:"_vadq",VELT_COMMENT_VIEWS_MIGRATED:"_vcvm",VELT_AUTH_PROXY_HOST:"_vaph"},q.NON_NESTABLE_ELEMENTS={img:!0,video:!0,audio:!0,input:!0,meter:!0,progress:!0,select:!0,textarea:!0,svg:!0,"lottie-player":!0,"ng-lottie":!0,canvas:!0,hr:!0,iframe:!0},q.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS={svg:!0},q.SELECTION_ENABLED_ELEMENTS={input:!0,textarea:!0,select:!0,button:!0},q.URL_PARAMS={REVIEW_MODE:"review",REVIEW_DOC_ID:"sreviewId",SNIPPYLY_USER:"snippyly-user",COMMENT_ID:"scommentId",TAG_ID:"stagId",RECORDER_ID:"srecorderId",PROJECT_INSTALL:"sprojectInstall"},q.VELT_BASE_REM_UNIT="--velt-base-rem-unit",q.VELT_VIEWPORT_WIDTH="--legacy-velt-viewport-width",q.VELT_VIEWPORT_HEIGHT="--legacy-velt-viewport-height",q.VELT_SELECTION_COLOR="--velt-selection-color",q.VELT_MIN_ARROW_LENGTH=100,q.VELT_ARROW_VIEWPORT_PADDING=20,q.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME=5,q.CURSOR={COMMENT_PIN:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==') 0 31, auto",TAG_PIN:"url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==') 16 16, auto",ARROW_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0, auto",AREA_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 16 0, auto"},q.VIDEO_POSTER_DEFAULT_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURQAAAAEAAKSl0/gAAAAxSURBVFjD7dBBDQAgCABARjKjGZUofi0Ac+4uwkUAAAAAAMCIpYD/bQVNSsEtFfCaA8vLAaMbkVUtAAAAAElFTkSuQmCC",q.HUDDLE_TYPE_CONFIGS={audio:{audio:!0,video:!1,presentation:!1},video:{audio:!0,video:!0,presentation:!1},presentation:{audio:!1,video:!1,presentation:!0}},q.RecorderModes={VIDEO:"video",AUDIO:"audio",SCREEN:"screen",ALL:"all"},q.CommentAnnotationStatusMap={OPEN:{id:"OPEN",name:"Open",color:"var(--velt-accent, #625DF5)",lightColor:"var(--velt-accent-light, #E7E8FA)",type:"default",svg:`
6
+ <svg
7
+ width="16"
8
+ height="16"
9
+ viewBox="0 0 16 16"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ fill-rule="evenodd"
15
+ clip-rule="evenodd"
16
+ d="M8.00016 13.3333C10.9457 13.3333 13.3335 10.9455 13.3335 8.00001C13.3335 5.05449 10.9457 2.66668 8.00016 2.66668C5.05464 2.66668 2.66683 5.05449 2.66683 8.00001C2.66683 10.9455 5.05464 13.3333 8.00016 13.3333ZM8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8.00001C14.6668 4.31811 11.6821 1.33334 8.00016 1.33334C4.31826 1.33334 1.3335 4.31811 1.3335 8.00001C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z"
17
+ fill="currentColor"
18
+ />
19
+ </svg>
20
+ `},IN_PROGRESS:{id:"IN_PROGRESS",name:"In Progress",color:"var(--velt-warning, #ECB000)",lightColor:"var(--velt-warning-light, #FEFCEA)",type:"ongoing",svg:`
21
+ <svg
22
+ width="16"
23
+ height="16"
24
+ viewBox="0 0 16 16"
25
+ fill="none"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ >
28
+ <path
29
+ fill-rule="evenodd"
30
+ clip-rule="evenodd"
31
+ d="M8.00016 13.3333C10.9457 13.3333 13.3335 10.9455 13.3335 8.00001C13.3335 5.05449 10.9457 2.66668 8.00016 2.66668C5.05464 2.66668 2.66683 5.05449 2.66683 8.00001C2.66683 10.9455 5.05464 13.3333 8.00016 13.3333ZM8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8.00001C14.6668 4.31811 11.6821 1.33334 8.00016 1.33334C4.31826 1.33334 1.3335 4.31811 1.3335 8.00001C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z"
32
+ fill="currentColor"
33
+ />
34
+ <path
35
+ fill-rule="evenodd"
36
+ clip-rule="evenodd"
37
+ d="M8.00016 4C8.36835 4 8.66683 4.29848 8.66683 4.66667V7.72386L10.1382 9.19526C10.3986 9.45561 10.3986 9.87772 10.1382 10.1381C9.87788 10.3984 9.45577 10.3984 9.19542 10.1381L7.52876 8.4714C7.40373 8.34638 7.3335 8.17681 7.3335 8V4.66667C7.3335 4.29848 7.63197 4 8.00016 4Z"
38
+ fill="currentColor"
39
+ />
40
+ </svg>
41
+ `},RESOLVED:{id:"RESOLVED",name:"Resolved",color:"var(--velt-success, #00C48C)",lightColor:"var(--velt-success-light, #E7FAF2)",type:"terminal",svg:`
42
+ <svg
43
+ width="17"
44
+ height="16"
45
+ viewBox="0 0 17 16"
46
+ fill="none"
47
+ xmlns="http://www.w3.org/2000/svg"
48
+ >
49
+ <path
50
+ fill-rule="evenodd"
51
+ clip-rule="evenodd"
52
+ d="M8.50016 13.3333C11.4457 13.3333 13.8335 10.9455 13.8335 8.00001C13.8335 5.05449 11.4457 2.66668 8.50016 2.66668C5.55464 2.66668 3.16683 5.05449 3.16683 8.00001C3.16683 10.9455 5.55464 13.3333 8.50016 13.3333ZM8.50016 14.6667C12.1821 14.6667 15.1668 11.6819 15.1668 8.00001C15.1668 4.31811 12.1821 1.33334 8.50016 1.33334C4.81826 1.33334 1.8335 4.31811 1.8335 8.00001C1.8335 11.6819 4.81826 14.6667 8.50016 14.6667Z"
53
+ fill="currentColor"
54
+ />
55
+ <path
56
+ d="M5.8335 8L7.8335 10L11.8335 6"
57
+ class="checkmark"
58
+ stroke="currentColor"
59
+ stroke-width="1.2"
60
+ stroke-miterlimit="10"
61
+ stroke-linecap="round"
62
+ stroke-linejoin="round"
63
+ />
64
+ </svg>
65
+ `}},q.CommentAcceptStatus={id:"ACCEPTED",name:"Accepted",color:"var(--velt-success, #00C48C)",lightColor:"var(--velt-success-light, #E7FAF2)",type:"terminal",svg:`
66
+ <svg
67
+ width="17"
68
+ height="16"
69
+ viewBox="0 0 17 16"
70
+ fill="none"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ >
73
+ <path
74
+ fill-rule="evenodd"
75
+ clip-rule="evenodd"
76
+ d="M8.50016 13.3333C11.4457 13.3333 13.8335 10.9455 13.8335 8.00001C13.8335 5.05449 11.4457 2.66668 8.50016 2.66668C5.55464 2.66668 3.16683 5.05449 3.16683 8.00001C3.16683 10.9455 5.55464 13.3333 8.50016 13.3333ZM8.50016 14.6667C12.1821 14.6667 15.1668 11.6819 15.1668 8.00001C15.1668 4.31811 12.1821 1.33334 8.50016 1.33334C4.81826 1.33334 1.8335 4.31811 1.8335 8.00001C1.8335 11.6819 4.81826 14.6667 8.50016 14.6667Z"
77
+ fill="currentColor"
78
+ />
79
+ <path
80
+ d="M5.8335 8L7.8335 10L11.8335 6"
81
+ class="checkmark"
82
+ stroke="currentColor"
83
+ stroke-width="1.2"
84
+ stroke-miterlimit="10"
85
+ stroke-linecap="round"
86
+ stroke-linejoin="round"
87
+ />
88
+ </svg>
89
+ `},q.CommentRejectStatus={id:"REJECTED",name:"Rejected",color:"var(--velt-error, #ff0000)",lightColor:"var(--velt-error-light, #f7e7e7)",type:"terminal",svg:`
90
+ <svg
91
+ xmlns="http://www.w3.org/2000/svg"
92
+ width="16" height="16"
93
+ fill="currentColor"
94
+ class="bi bi-x-circle"
95
+ viewBox="0 0 16 16"
96
+ >
97
+ <path
98
+ d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"
99
+ />
100
+ <path
101
+ d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
102
+ />
103
+ </svg>
104
+ `},q.CommentAnnotationPriorityMap={P0:{id:"P0",name:"P0",color:"var(--velt-error, #FF7162)",lightColor:"var(--velt-error-light, #F7E7E7)",svg:`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
105
+ <g>
106
+ <path d="M3.33301 1.33333C3.33301 0.873096 3.7061 0.5 4.16634 0.5C4.62658 0.5 4.99967 0.873096 4.99967 1.33333V19.6667C4.99967 20.1269 4.62658 20.5 4.16634 20.5C3.7061 20.5 3.33301 20.1269 3.33301 19.6667V1.33333Z" fill="currentColor"/>
107
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.3086 12.167H3.33301V2.16699H8.33301C9.42152 2.16699 10.3476 2.86267 10.6908 3.83366H14.803C16.0419 3.83366 16.8477 5.13751 16.2937 6.24568L14.9997 8.83366L16.2937 11.4216C16.8477 12.5298 16.0419 13.8337 14.803 13.8337H11.6663C10.5778 13.8337 9.65179 13.138 9.3086 12.167ZM4.99967 3.83366H8.33301C8.79324 3.83366 9.16634 4.20675 9.16634 4.66699V10.5003H4.99967V3.83366ZM10.833 11.3337C10.833 11.7939 11.2061 12.167 11.6663 12.167H14.803L13.1363 8.83366L14.803 5.50033H10.833V11.3337Z" fill="currentColor"/>
108
+ </g>
109
+ </svg>`},P1:{id:"P1",name:"P1",color:"var(--velt-warning, #ECB000)",lightColor:"var(--velt-warning-light, #FEFCEA)",svg:`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
110
+ <g>
111
+ <path d="M3.33301 1.33333C3.33301 0.873096 3.7061 0.5 4.16634 0.5C4.62658 0.5 4.99967 0.873096 4.99967 1.33333V19.6667C4.99967 20.1269 4.62658 20.5 4.16634 20.5C3.7061 20.5 3.33301 20.1269 3.33301 19.6667V1.33333Z" fill="currentColor"/>
112
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.3086 12.167H3.33301V2.16699H8.33301C9.42152 2.16699 10.3476 2.86267 10.6908 3.83366H14.803C16.0419 3.83366 16.8477 5.13751 16.2937 6.24568L14.9997 8.83366L16.2937 11.4216C16.8477 12.5298 16.0419 13.8337 14.803 13.8337H11.6663C10.5778 13.8337 9.65179 13.138 9.3086 12.167ZM4.99967 3.83366H8.33301C8.79324 3.83366 9.16634 4.20675 9.16634 4.66699V10.5003H4.99967V3.83366ZM10.833 11.3337C10.833 11.7939 11.2061 12.167 11.6663 12.167H14.803L13.1363 8.83366L14.803 5.50033H10.833V11.3337Z" fill="currentColor"/>
113
+ </g>
114
+ </svg>`},P2:{id:"P2",name:"P2",color:"var(--velt-text-7, #777E91)",lightColor:"var(--velt-background-1, #F3F3F5)",svg:`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
115
+ <g>
116
+ <path d="M3.33301 1.33333C3.33301 0.873096 3.7061 0.5 4.16634 0.5C4.62658 0.5 4.99967 0.873096 4.99967 1.33333V19.6667C4.99967 20.1269 4.62658 20.5 4.16634 20.5C3.7061 20.5 3.33301 20.1269 3.33301 19.6667V1.33333Z" fill="currentColor"/>
117
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.3086 12.167H3.33301V2.16699H8.33301C9.42152 2.16699 10.3476 2.86267 10.6908 3.83366H14.803C16.0419 3.83366 16.8477 5.13751 16.2937 6.24568L14.9997 8.83366L16.2937 11.4216C16.8477 12.5298 16.0419 13.8337 14.803 13.8337H11.6663C10.5778 13.8337 9.65179 13.138 9.3086 12.167ZM4.99967 3.83366H8.33301C8.79324 3.83366 9.16634 4.20675 9.16634 4.66699V10.5003H4.99967V3.83366ZM10.833 11.3337C10.833 11.7939 11.2061 12.167 11.6663 12.167H14.803L13.1363 8.83366L14.803 5.50033H10.833V11.3337Z" fill="currentColor"/>
118
+ </g>
119
+ </svg>`}},q.WorkspaceRoles=[{id:gd.COMMENTER?.toLowerCase(),name:gd.COMMENTER,description:"Can comment on this project",permissions:[]},{id:gd.ADMIN?.toLowerCase(),name:gd.ADMIN,description:"Can comment on all projects and has access to the portal",permissions:[]}],q.DocumentAccessTypeMap={[wt.PUBLIC]:{id:wt.PUBLIC,name:wt.PUBLIC,description:"Anyone with link can view"},[wt.RESTRICTED]:{id:wt.RESTRICTED,name:wt.RESTRICTED,description:"Only people with access can view"}},q.DocumentAccessTypeMapSF={[wt.PUBLIC]:{id:wt.PUBLIC,name:wt.PUBLIC,description:"Anyone with the link can comment after logging in."},[wt.RESTRICTED]:{id:wt.RESTRICTED,name:wt.RESTRICTED,description:"Only people added to this project can comment."}},q.CommentCategoryMap={bug:{id:"bug",name:"Bug",color:"#FF7162"},feedback:{id:"feedback",name:"Feedback",color:"#00C48C"},question:{id:"question",name:"Question",color:"#FFD166"}},q.OVERLAY_POSITIONS=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}],q.OVERLAY_POSITIONS_FOR_POPOVER_MODE=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"}],q.VIDEO_EDITOR={ZOOM_IN_DURATION:500,ZOOM_OUT_DURATION:500,DEFAULT_ZOOM_FACTOR:1.5,MAX_ZOOM_FACTOR:3,ZOOM_FACTOR_OPTIONS:[{value:2,label:"2x"},{value:1.7,label:"1.7x"},{value:1.5,label:"1.5x"},{value:1.2,label:"1.2x"}],MIN_DRAG_AREA_MULTIPLIER:.015,PREFERRED_SECTION_DURATION_MULTIPLIER:.15,SELECTION_MIN_DRAG_DISTANCE:2,MIN_DURATION_THRESHOLD:.01,TIME_BUFFER:.1,SHORT_VIDEO_THRESHOLD:3,SMALL_VIDEO_THRESHOLD:5,MILLISECOND_PRECISION_MULTIPLIER:1e3,TENTH_SECOND_PRECISION_MULTIPLIER:10,DEBOUNCE_DELAY:200,DECIMAL_PRECISION:2,MAX_MARKER_COUNT:10,MARKER_INTERVAL:5,FAST_TIMEOUT:50,STANDARD_TIMEOUT:100,RECTANGLE_POSITIONING:{FULL_PERCENT:100,HALF_PERCENT:50,QUARTER_PERCENT:25},EASING:{QUAD_IN_OUT_MULTIPLIER:2,QUAD_IN_OUT_POWER:2,HALF_THRESHOLD:.5},PERCENTAGE:{HALF:50,FULL:100},MILLISECONDS_TO_SECONDS:1e3};var v=q;var TT=new Z("arrow-utils"),CAe=new Z("notification-service"),NAe=new Z("notifications-actions"),Pi=new Z("notification-utils"),OAe=new Z("cursor-service"),IT=new Z("cursor-utils"),wAe=new Z("presence-service"),bAe=new Z("presence-actions"),vT=new Z("presence-utils"),LAe=new Z("huddle-service"),yT=new Z("huddle-utils"),MAe=new Z("recorder-service"),ST=new Z("recorder-annotation-service"),PAe=new Z("recorder-actions"),ai=new Z("recorder-utils"),xAe=new Z("recorder-pin-portal"),md=new Z("comment-service"),FAe=new Z("comment-actions"),kAe=new Z("comment-dialog-core"),UAe=new Z("comment-dialog-action"),VAe=new Z("comment-text-service"),BAe=new Z("comment-text-portal"),GAe=new Z("comment-pin-portal"),$Ae=new Z("comment-views"),AT=new Z("reaction-service"),jAe=new Z("rewriter-service"),HAe=new Z("rewriter-actions"),DT=new Z("area-service"),RT=new Z("activity-service"),M1=new Z("views-service"),P1=new Z("crdt-service"),x1=new Z("live-state-service");var Xn=class Xn{static showLogs(){try{return st.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(e){return Xn.catch("Error in showLogs: ",e),!1}}};Xn.log=Xn.showLogs()?console.log:()=>{},Xn.warn=Xn.showLogs()?console.warn:()=>{},Xn.error=Xn.showLogs()?console.error:()=>{},Xn.debug=Xn.showLogs()?console.debug:()=>{},Xn.info=Xn.showLogs()?console.info:()=>{},Xn.logsEnabled=!0,Xn.catch=(e,r)=>{try{Xn.logsEnabled&&(r!==void 0?console.warn("Velt: ",e,r):console.warn("Velt: ",e))}catch{}};var H=Xn;var ci=(()=>{let e=class e{constructor(){this.subjects=new Map,H.log("%c[WB] Creating CLASS: ServiceBook","color: blue;")}set(t,i){try{H.log(`%c[WB] ServiceBook.set: ${t.toString()}`,"color: green;"),this.getOrCreateSubject(t).next(i)}catch(o){H.catch("Error in ServiceBook set: ",o)}}get(t){return this.subjects.get(t)?.value??null}observe(t){return this.getOrCreateSubject(t).asObservable()}getOrCreateSubject(t){let i=this.subjects.get(t);return i||(i=new Y(null),this.subjects.set(t,i)),i}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var L=(()=>{let e=class e{};e.Events={Core:{IDENTIFY:"identify",SDK_VALIDATE_CLIENT_TRIGGERED:"sdkValidateClientTriggered",SDK_VALIDATE_CLIENT_SUCCESS:"sdkValidateClientSuccess",SDK_VALIDATE_CLIENT_FAILED:"sdkValidateClientFailed",SDK_USER_AUTH_SUCCESS:"sdkUserAuthSuccess",SDK_USER_AUTH_FAILED:"sdkUserAuthFailed",SDK_USER_SIGN_OUT:"sdkUserSignOut",SDK_PLAN_EXPIRED:"sdkPlanExpired",SDK_ERROR:"error",SDK_UNCAUGHT_ERROR:"uncaughtError",SDK_SESSION_RE_LOGIN_TRIGGERED:"sdkSessionReLoginTriggered",SDK_SESSION_TOKEN_EXPIRED:"sdkSessionTokenExpired",SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED:"sdkSessionReLoginCountExceeded",SDK_JWT_EXPIRED_RETRY_EXCEEDED:"sdkJwtExpiredRetryExceeded",SDK_EVENT_RATE_LIMIT_EXCEEDED:"sdkEventRateLimitExceeded",SET_PERMISSION_PROVIDER_TRIGGERED:"setPermissionProviderTriggered",SIGN_OUT_USER_TRIGGERED:"signOutUserTriggered",SET_DOCUMENTS_TRIGGERED:"setDocumentsTriggered",SET_ROOT_LOCATION_TRIGGERED:"setRootLocationTriggered",SET_ROOT_DOCUMENT_TRIGGERED:"setRootDocumentTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",FETCH_DOCUMENTS_TRIGGERED:"fetchDocumentsTriggered",UPDATE_DOCUMENTS_TRIGGERED:"updateDocumentsTriggered",UPDATE_LOCATIONS_TRIGGERED:"updateLocationsTriggered",FETCH_FOLDERS_TRIGGERED:"fetchFoldersTriggered",SET_USER_DATA_PROVIDER_TRIGGERED:"setUserDataProviderTriggered",SET_ANONYMOUS_USER_DATA_PROVIDER_TRIGGERED:"setAnonymousUserDataProviderTriggered",SET_DATA_PROVIDERS_TRIGGERED:"setDataProvidersTriggered",SET_ENCRYPTION_PROVIDER_TRIGGERED:"setEncryptionProviderTriggered",SET_VELT_AUTH_PROVIDER_TRIGGERED:"setVeltAuthProviderTriggered",GET_DOCUMENT_ID_TRIGGERED:"getDocumentIdTriggered",SET_LOCATIONS_TRIGGERED:"setLocationsTriggered",SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"setScrollableElementsIdsTriggered",REMOVE_LOCATIONS_TRIGGERED:"removeLocationsTriggered",UNSET_LOCATIONS_TRIGGERED:"unsetLocationsTriggered",EXCLUDE_LOCATION_IDS_TRIGGERED:"excludeLocationIdsTriggered",UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"removeScrollableElementsIdsTriggered",GET_PRESENCE_ELEMENT_TRIGGERED:"getPresenceElementTriggered",GET_CURSOR_ELEMENT_TRIGGERED:"getCursorElementTriggered",GET_COMMENT_ELEMENT_TRIGGERED:"getCommentElementTriggered",GET_TAG_ELEMENT_TRIGGERED:"getTagElementTriggered",GET_SELECTION_ELEMENT_TRIGGERED:"getSelectionElementTriggered",GET_RECORDER_ELEMENT_TRIGGERED:"getRecorderElementTriggered",GET_CONTACT_ELEMENT_TRIGGERED:"getContactElementTriggered",GET_REWRITER_ELEMENT_TRIGGERED:"getRewriterElementTriggered",GET_HUDDLE_ELEMENT_TRIGGERED:"getHuddleElementTriggered",GET_LIVE_STATE_SYNC_ELEMENT_TRIGGERED:"getLiveStateSyncElementTriggered",GET_ARROW_ELEMENT_TRIGGERED:"getArrowElementTriggered",GET_VIEWS_ELEMENT_TRIGGERED:"getViewsElementTriggered",GET_NOTIFICATION_ELEMENT_TRIGGERED:"getNotificationElementTriggered",GET_AUTOCOMPLETE_ELEMENT_TRIGGERED:"getAutocompleteElementTriggered",GET_DOC_ELEMENT_TRIGGERED:"getDocElementTriggered",GET_AREA_ELEMENT_TRIGGERED:"getAreaElementTriggered",GET_REACTION_ELEMENT_TRIGGERED:"getReactionElementTriggered",GET_METADATA_TRIGGERED:"getMetadataTriggered",FETCH_DEBUG_INFO_TRIGGERED:"fetchDebugInfoTriggered",GET_DEBUG_INFO_TRIGGERED:"getDebugInfoTriggered",DISABLE_FEATURES_TRIGGERED:"disableFeaturesTriggered",SET_DARK_MODE_TRIGGERED:"setDarkModeTriggered",ENABLE_LOGS_TRIGGERED:"enableLogsTriggered",DISABLE_LOGS_TRIGGERED:"disableLogsTriggered",IS_USER_ALLOWED_TRIGGERED:"isUserAllowedTriggered",GET_USER_TRIGGERED:"getUserTriggered",GET_CURRENT_USER_TRIGGERED:"getCurrentUserTriggered",GET_HEARTBEAT_TRIGGERED:"getHeartbeatTriggered",GET_USER_ROLE_TRIGGERED:"getUserRoleTriggered",GET_USER_PERMISSIONS_TRIGGERED:"getUserPermissionsTriggered",GET_CURRENT_USER_PERMISSIONS_TRIGGERED:"getCurrentUserPermissionsTriggered",GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED:"getFeaturesAccessLevelIamTriggered",IS_PLAN_EXPIRED_TRIGGERED:"isPlanExpiredTriggered",GET_CUSTOMER_METADATA_TRIGGERED:"getCustomerMetadataTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered",REMOVE_VELT_CONTENT_TRIGGERED:"removeVeltContentTriggered",INJECT_CUSTOM_CSS_TRIGGERED:"injectCustomCssTriggered",SET_LANGUAGE_TRIGGERED:"setLanguageTriggered",SET_TRANSLATIONS_TRIGGERED:"setTranslationsTriggered",ENABLE_AUTO_TRANSLATION_TRIGGERED:"enableAutoTranslationTriggered",DISABLE_AUTO_TRANSLATION_TRIGGERED:"disableAutoTranslationTriggered",SF_TRIGGERED:"sfTriggered",SET_UI_STATE_TRIGGERED:"setUiStateTriggered",GET_UI_STATE_TRIGGERED:"getUiStateTriggered",ENABLE_SAFE_EVAL_TRIGGERED:"enableSafeEvalTriggered",DISABLE_SAFE_EVAL_TRIGGERED:"disableSafeEvalTriggered",ENABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"enableFirestorePersistentCacheTriggered",DISABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"disableFirestorePersistentCacheTriggered",RESET_VELT_BUTTON_STATE_TRIGGERED:"resetVeltButtonStateTriggered"},PermissionProvider:{RESOURCE_ACCESS_REQUEST_FORMED:"resourceAccessRequestFormed",RESOURCE_ACCESS_REQUEST_TRIGGERED:"resourceAccessRequestTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED:"revokeAccessOnDocumentUnsetTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED:"revokeAccessOnDocumentUnsetFormed",REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT:"revokeAccessOnDocumentUnsetResult",REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED:"revokeAccessOnUserLogoutTriggered",REVOKE_ACCESS_ON_USER_LOGOUT_FORMED:"revokeAccessOnUserLogoutFormed",REVOKE_ACCESS_ON_USER_LOGOUT_RESULT:"revokeAccessOnUserLogoutResult",RESOURCE_ACCESS_RESULT:"resourceAccessResult",RESOURCE_ACCESS_ERROR:"resourceAccessError",RESOURCE_ACCESS_RESULT_FROM_CACHE:"resourceAccessResultFromCache",REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR:"revokeAccessOnDocumentUnsetError",REVOKE_ACCESS_ON_USER_LOGOUT_ERROR:"revokeAccessOnUserLogoutError"},Resolver:{COMMENT_RESOLVER_GET:"comment_resolver_get",COMMENT_RESOLVER_SAVE:"comment_resolver_save",COMMENT_RESOLVER_DELETE:"comment_resolver_delete",COMMENT_RESOLUTION_REQUEST_FORMED:"commentResolutionRequestFormed",COMMENT_RESOLUTION_REQUEST_TRIGGERED:"commentResolutionRequestTriggered",COMMENT_RESOLUTION_RESULT:"commentResolutionResult",COMMENT_RESOLUTION_ERROR:"commentResolutionError",COMMENT_RESOLUTION_RESULT_FROM_CACHE:"commentResolutionResultFromCache",COMMENT_SAVE_REQUEST_FORMED:"commentSaveRequestFormed",COMMENT_SAVE_REQUEST_TRIGGERED:"commentSaveRequestTriggered",COMMENT_SAVE_RESULT:"commentSaveResult",COMMENT_SAVE_ERROR:"commentSaveError",COMMENT_DELETE_REQUEST_FORMED:"commentDeleteRequestFormed",COMMENT_DELETE_REQUEST_TRIGGERED:"commentDeleteRequestTriggered",COMMENT_DELETE_RESULT:"commentDeleteResult",COMMENT_DELETE_ERROR:"commentDeleteError",REACTION_RESOLVER_GET:"reaction_resolver_get",REACTION_RESOLVER_SAVE:"reaction_resolver_save",REACTION_RESOLVER_DELETE:"reaction_resolver_delete",REACTION_RESOLUTION_REQUEST_FORMED:"reactionResolutionRequestFormed",REACTION_RESOLUTION_REQUEST_TRIGGERED:"reactionResolutionRequestTriggered",REACTION_RESOLUTION_RESULT:"reactionResolutionResult",REACTION_RESOLUTION_ERROR:"reactionResolutionError",REACTION_RESOLUTION_RESULT_FROM_CACHE:"reactionResolutionResultFromCache",REACTION_SAVE_REQUEST_FORMED:"reactionSaveRequestFormed",REACTION_SAVE_REQUEST_TRIGGERED:"reactionSaveRequestTriggered",REACTION_SAVE_RESULT:"reactionSaveResult",REACTION_SAVE_ERROR:"reactionSaveError",REACTION_DELETE_REQUEST_FORMED:"reactionDeleteRequestFormed",REACTION_DELETE_REQUEST_TRIGGERED:"reactionDeleteRequestTriggered",REACTION_DELETE_RESULT:"reactionDeleteResult",REACTION_DELETE_ERROR:"reactionDeleteError",NOTIFICATION_RESOLVER_GET:"notification_resolver_get",NOTIFICATION_RESOLVER_DELETE:"notification_resolver_delete",NOTIFICATION_RESOLUTION_REQUEST_FORMED:"notificationResolutionRequestFormed",NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED:"notificationResolutionRequestTriggered",NOTIFICATION_RESOLUTION_RESULT:"notificationResolutionResult",NOTIFICATION_RESOLUTION_ERROR:"notificationResolutionError",NOTIFICATION_DELETE_REQUEST_FORMED:"notificationDeleteRequestFormed",NOTIFICATION_DELETE_REQUEST_TRIGGERED:"notificationDeleteRequestTriggered",NOTIFICATION_DELETE_RESULT:"notificationDeleteResult",NOTIFICATION_DELETE_ERROR:"notificationDeleteError",USER_RESOLVER_GET:"user_resolver_get",USER_RESOLUTION_REQUEST_FORMED:"userResolutionRequestFormed",USER_RESOLUTION_REQUEST_TRIGGERED:"userResolutionRequestTriggered",USER_RESOLUTION_RESULT:"userResolutionResult",USER_RESOLUTION_ERROR:"userResolutionError",USER_RESOLUTION_RESULT_FROM_CACHE:"userResolutionResultFromCache",EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED:"emailUserIdResolutionRequestFormed",EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED:"emailUserIdResolutionRequestTriggered",EMAIL_USER_ID_RESOLUTION_RESULT:"emailUserIdResolutionResult",EMAIL_USER_ID_RESOLUTION_ERROR:"emailUserIdResolutionError",ATTACHMENT_RESOLVER_SAVE:"attachment_resolver_save",ATTACHMENT_RESOLVER_DELETE:"attachment_resolver_delete",ATTACHMENT_SAVE_REQUEST_FORMED:"attachmentSaveRequestFormed",ATTACHMENT_SAVE_REQUEST_TRIGGERED:"attachmentSaveRequestTriggered",ATTACHMENT_SAVE_RESULT:"attachmentSaveResult",ATTACHMENT_SAVE_ERROR:"attachmentSaveError",ATTACHMENT_DELETE_REQUEST_FORMED:"attachmentDeleteRequestFormed",ATTACHMENT_DELETE_REQUEST_TRIGGERED:"attachmentDeleteRequestTriggered",ATTACHMENT_DELETE_RESULT:"attachmentDeleteResult",ATTACHMENT_DELETE_ERROR:"attachmentDeleteError",RECORDER_RESOLVER_GET:"recorder_resolver_get",RECORDER_RESOLVER_SAVE:"recorder_resolver_save",RECORDER_RESOLVER_DELETE:"recorder_resolver_delete",RECORDER_RESOLUTION_REQUEST_FORMED:"recorderResolutionRequestFormed",RECORDER_RESOLUTION_REQUEST_TRIGGERED:"recorderResolutionRequestTriggered",RECORDER_RESOLUTION_RESULT:"recorderResolutionResult",RECORDER_RESOLUTION_ERROR:"recorderResolutionError",RECORDER_RESOLUTION_RESULT_FROM_CACHE:"recorderResolutionResultFromCache",RECORDER_SAVE_REQUEST_FORMED:"recorderSaveRequestFormed",RECORDER_SAVE_REQUEST_TRIGGERED:"recorderSaveRequestTriggered",RECORDER_SAVE_RESULT:"recorderSaveResult",RECORDER_SAVE_ERROR:"recorderSaveError",RECORDER_DELETE_REQUEST_FORMED:"recorderDeleteRequestFormed",RECORDER_DELETE_REQUEST_TRIGGERED:"recorderDeleteRequestTriggered",RECORDER_DELETE_RESULT:"recorderDeleteResult",RECORDER_DELETE_ERROR:"recorderDeleteError",ACTIVITY_RESOLVER_GET:"activity_resolver_get",ACTIVITY_RESOLVER_SAVE:"activity_resolver_save",ACTIVITY_RESOLUTION_REQUEST_FORMED:"activityResolutionRequestFormed",ACTIVITY_RESOLUTION_REQUEST_TRIGGERED:"activityResolutionRequestTriggered",ACTIVITY_RESOLUTION_RESULT:"activityResolutionResult",ACTIVITY_RESOLUTION_ERROR:"activityResolutionError",ACTIVITY_RESOLUTION_RESULT_FROM_CACHE:"activityResolutionResultFromCache",ACTIVITY_SAVE_REQUEST_FORMED:"activitySaveRequestFormed",ACTIVITY_SAVE_REQUEST_TRIGGERED:"activitySaveRequestTriggered",ACTIVITY_SAVE_RESULT:"activitySaveResult",ACTIVITY_SAVE_ERROR:"activitySaveError"},Autocomplete:{CREATE_TRIGGERED:"createTriggered",ON_AUTOCOMPLETE_CHIP_CLICK_TRIGGERED:"onAutocompleteChipClickTriggered"},Comments:{COMMENT_TOOL_CLICKED:"commentToolClicked",COMMENT_DRAFT_ADDED:"commentDraftAdded",COMMENT_ADD_CONTEXT_TRIGGERED:"commentAddContextTriggered",COMMENT_UPDATE_CONTEXT_TRIGGERED:"commentUpdateContextTriggered",COMMENT_UPDATE_CONTEXT_SUCCESS:"commentUpdateContextSuccess",COMMENT_UPDATE_CONTEXT_FAILED:"commentUpdateContextFailed",COMMENT_ADDED:"commentAdded",COMMENT_READ:"commentRead",COMMENT_STATUS_CHANGED:"commentStatusChanged",COMMENT_PRIORITY_CHANGED:"commentPriorityChanged",COMMENT_CUSTOM_CHIPS_CHANGED:"commentCustomChipsChanged",COMMENT_APPROVED:"commentApproved",COMMENT_ACCEPTED:"commentAccepted",COMMENT_REJECTED:"commentRejected",COMMENT_ASSIGNED:"commentAssigned",COMMENT_DELETE_TRIGGERED:"commentDeleteTriggered",COMMENT_DELETED:"commentDeleted",COMMENT_THREAD_DELETED:"commentThreadDeleted",COMMENT_LINK_COPIED:"commentLinkCopied",COMMENT_EDIT_BUTTON_CLICKED:"commentEditButtonClicked",COMMENT_EDITED:"commentEdited",COMMENT_SIDEBAR_OPENED:"commentSidebarOpened",COMMENT_SIDEBAR_CLOSED:"commentSidebarClosed",COMMENT_SIDEBAR_TOGGLED:"commentSidebarToggled",COMMENT_TAG_BUTTON_CLICKED:"commentTagButtonClicked",COMMENT_TAG_ADDED:"commentTagAdded",COMMENT_PIN_DRAGGED:"commentPinDragged",COMMENT_ADD_MODE_ENABLED:"commentAddModeEnabled",COMMENT_ADD_MODE_DISABLED:"commentAddModeDisabled",COMMENT_TEXT_MODE_ENABLED:"commentTextModeEnabled",COMMENT_TEXT_MODE_DISABLED:"commentTextModeDisabled",COMMENT_POPOVER_MODE_ENABLED:"commentPopoverModeEnabled",COMMENT_POPOVER_MODE_DISABLED:"commentPopoverModeDisabled",COMMENT_STREAM_MODE_ENABLED:"commentStreamModeEnabled",COMMENT_STREAM_MODE_DISABLED:"commentStreamModeDisabled",COMMENT_SIDEBAR_EMBED_MODE_ENABLED:"commentSidebarEmbedModeEnabled",COMMENT_SIDEBAR_FLOATING_MODE_ENABLED:"commentSidebarFloatingModeEnabled",COMMENT_ATTACHMENT_SET_ALLOWED_FILE_TYPES_TRIGGERED:"commentAttachmentSetAllowedFileTypesTriggered",ENABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"enableForceCloseAllOnEscTriggered",DISABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"disableForceCloseAllOnEscTriggered",COMMENT_ATTACHMENT_BUTTON_CLICKED:"commentAttachmentButtonClicked",COMMENT_ATTACHMENT_ADDED:"commentAttachmentAdded",COMMENT_ATTACHMENT_DOWNLOADED:"commentAttachmentDownloaded",COMMENT_ATTACHMENT_DELETED:"commentAttachmentDeleted",COMMENT_ATTACHMENT_SIZE_EXCEEDED:"commentAttachmentSizeExceeded",COMMENT_SUBMIT_TRIGGERED:"commentSubmitTriggered",COMMENT_APPROVE_BUTTON_CLICKED:"commentApproveButtonClicked",COMMENT_ACCEPT_BUTTON_CLICKED:"commentAcceptButtonClicked",COMMENT_REJECT_BUTTON_CLICKED:"commentRejectButtonClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected",COMMENT_SIGN_IN_BUTTON_CLICKED:"commentSignInButtonClicked",COMMENT_UPGRADE_BUTTON_CLICKED:"commentUpgradeButtonClicked",COMMENT_RECORDING_TOOL_CLICKED:"commentRecordingToolClicked",COMMENT_RECORDING_ADDED:"commentRecordingAdded",COMMENT_RECORDING_DELETED:"commentRecordingDeleted",COMMENT_MORE_REPLY_OPTION_CLICKED:"commentMoreReplyOptionClicked",COMMENT_PRIVATE_COMMENT_MODE_ENABLED:"commentPrivateCommentModeEnabled",COMMENT_PRIVATE_COMMENT_MODE_DISABLED:"commentPrivateCommentModeDisabled",COMMENT_ACCESS_MODE_CHANGED:"commentAccessModeChanged",SET_COMPOSER_FILE_ATTACHMENTS_TRIGGERED:"setComposerFileAttachmentsTriggered",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED_INTERNAL:"getAllCommentAnnotationsTriggered_internal",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED:"getAllCommentAnnotationsTriggered",DELETE_SELECTED_COMMENT_TRIGGERED:"deleteSelectedCommentTriggered",ENABLE_TEXT_COMMENTS_TRIGGERED:"enableTextCommentsTriggered",DISABLE_TEXT_COMMENTS_TRIGGERED:"disableTextCommentsTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ALLOWED_ELEMENT_CLASS_NAMES_TRIGGERED:"allowedElementClassNamesTriggered",ALLOWED_ELEMENT_QUERY_SELECTORS_TRIGGERED:"allowedElementQuerySelectorsTriggered",ENABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"enableFloatingCommentDialogTriggered",DISABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"disableFloatingCommentDialogTriggered",ATTACH_COMMENT_TRIGGERED:"attachCommentTriggered",OPEN_COMMENT_SIDEBAR_TRIGGERED:"openCommentSidebarTriggered",CLOSE_COMMENT_SIDEBAR_TRIGGERED:"closeCommentSidebarTriggered",TOGGLE_COMMENT_SIDEBAR_TRIGGERED:"toggleCommentSidebarTriggered",SET_ASSIGN_TO_TYPE_TRIGGERED:"setAssignToTypeTriggered",ENABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"enableContextInPageModeComposerTriggered",DISABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"disableContextInPageModeComposerTriggered",CLEAR_PAGE_MODE_COMPOSER_CONTEXT_TRIGGERED:"clearPageModeComposerContextTriggered",SET_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"setContextInPageModeComposerTriggered",FOCUS_PAGE_MODE_COMPOSER_TRIGGERED:"focusPageModeComposerTriggered",ENABLE_MODERATOR_MODE_TRIGGERED:"enableModeratorModeTriggered",DISABLE_MODERATOR_MODE_TRIGGERED:"disableModeratorModeTriggered",ENABLE_STREAM_MODE_TRIGGERED:"enableStreamModeTriggered",DISABLE_STREAM_MODE_TRIGGERED:"disableStreamModeTriggered",ENABLE_SIGN_IN_BUTTON_TRIGGERED:"enableSignInButtonTriggered",DISABLE_SIGN_IN_BUTTON_TRIGGERED:"disableSignInButtonTriggered",ENABLE_UPGRADE_BUTTON_TRIGGERED:"enableUpgradeButtonTriggered",DISABLE_UPGRADE_BUTTON_TRIGGERED:"disableUpgradeButtonTriggered",ON_COMMENT_MODE_CHANGE_TRIGGERED:"onCommentModeChangeTriggered",ENABLE_ATTACHMENTS_TRIGGERED:"enableAttachmentsTriggered",DISABLE_ATTACHMENTS_TRIGGERED:"disableAttachmentsTriggered",ENABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"enableAttachmentDownloadTriggered",DISABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"disableAttachmentDownloadTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ENABLE_DEVICE_INFO_TRIGGERED:"enableDeviceInfoTriggered",DISABLE_DEVICE_INFO_TRIGGERED:"disableDeviceInfoTriggered",ENABLE_COMMENT_MODE_TRIGGERED:"enableCommentModeTriggered",DISABLE_COMMENT_MODE_TRIGGERED:"disableCommentModeTriggered",ENABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"enablePersistentCommentModeTriggered",DISABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"disablePersistentCommentModeTriggered",SHOW_COMMENT_INDEX_TRIGGERED:"showCommentIndexTriggered",ENABLE_COMMENT_INDEX_TRIGGERED:"enableCommentIndexTriggered",DISABLE_COMMENT_INDEX_TRIGGERED:"disableCommentIndexTriggered",ENABLE_POPOVER_MODE_TRIGGERED:"enablePopoverModeTriggered",DISABLE_POPOVER_MODE_TRIGGERED:"disablePopoverModeTriggered",ENABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"enablePopoverTriangleComponentTriggered",DISABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"disablePopoverTriangleComponentTriggered",ENABLE_DIALOG_ON_HOVER_TRIGGERED:"enableDialogOnHoverTriggered",DISABLE_DIALOG_ON_HOVER_TRIGGERED:"disableDialogOnHoverTriggered",ENABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"enableDialogOnTargetElementClickTriggered",DISABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"disableDialogOnTargetElementClickTriggered",ENABLE_PRIORITY_TRIGGERED:"enablePriorityTriggered",DISABLE_PRIORITY_TRIGGERED:"disablePriorityTriggered",ENABLE_STATUS_TRIGGERED:"enableStatusTriggered",DISABLE_STATUS_TRIGGERED:"disableStatusTriggered",ENABLE_VISIBILITY_OPTIONS_TRIGGERED:"enableVisibilityOptionsTriggered",DISABLE_VISIBILITY_OPTIONS_TRIGGERED:"disableVisibilityOptionsTriggered",ENABLE_RESOLVE_BUTTON_TRIGGERED:"enableResolveButtonTriggered",DISABLE_RESOLVE_BUTTON_TRIGGERED:"disableResolveButtonTriggered",ENABLE_GHOST_COMMENTS_TRIGGERED:"enableGhostCommentsTriggered",DISABLE_GHOST_COMMENTS_TRIGGERED:"disableGhostCommentsTriggered",ENABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"enableGhostCommentsIndicatorTriggered",DISABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"disableGhostCommentsIndicatorTriggered",SET_CUSTOM_STATUS_TRIGGERED:"setCustomStatusTriggered",SET_CUSTOM_PRIORITY_TRIGGERED:"setCustomPriorityTriggered",SET_CUSTOM_CATEGORY_TRIGGERED:"setCustomCategoryTriggered",ENABLE_INBOX_MODE_TRIGGERED:"enableInboxModeTriggered",DISABLE_INBOX_MODE_TRIGGERED:"disableInboxModeTriggered",ENABLE_AUTO_CATEGORIZE_TRIGGERED:"enableAutoCategorizeTriggered",DISABLE_AUTO_CATEGORIZE_TRIGGERED:"disableAutoCategorizeTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CONTEXT_PROVIDER_TRIGGERED:"setContextProviderTriggered",ENABLE_SUGGESTION_MODE_TRIGGERED:"enableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"disableSuggestionModeTriggered",ENABLE_MOBILE_MODE_TRIGGERED:"enableMobileModeTriggered",DISABLE_MOBILE_MODE_TRIGGERED:"disableMobileModeTriggered",ENABLE_INLINE_COMMENT_MODE_TRIGGERED:"enableInlineCommentModeTriggered",DISABLE_INLINE_COMMENT_MODE_TRIGGERED:"disableInlineCommentModeTriggered",ENABLE_MINIMAP_TRIGGERED:"enableMinimapTriggered",DISABLE_MINIMAP_TRIGGERED:"disableMinimapTriggered",SHOW_COMMENTS_ON_DOM_TRIGGERED:"showCommentsOnDomTriggered",HIDE_COMMENTS_ON_DOM_TRIGGERED:"hideCommentsOnDomTriggered",ENABLE_COMMENT_TOOL_TRIGGERED:"enableCommentToolTriggered",DISABLE_COMMENT_TOOL_TRIGGERED:"disableCommentToolTriggered",SET_TOTAL_MEDIA_LENGTH_TRIGGERED:"setTotalMediaLengthTriggered",ON_COMMENT_ADD_TRIGGERED:"onCommentAddTriggered",ON_COMMENT_UPDATE_TRIGGERED:"onCommentUpdateTriggered",ADD_COMMENT_ON_SELECTED_TEXT_TRIGGERED:"addCommentOnSelectedTextTriggered",ENABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"enableSidebarUrlNavigationTriggered",DISABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"disableSidebarUrlNavigationTriggered",SET_D_STRATEGY_TRIGGERED:"setDStrategyTriggered",ENABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"enableSidebarButtonOnCommentDialogTriggered",DISABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"disableSidebarButtonOnCommentDialogTriggered",ON_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_CLICK_TRIGGERED:"onSidebarButtonOnCommentDialogClickTriggered",ENABLE_REACTIONS_TRIGGERED:"enableReactionsTriggered",DISABLE_REACTIONS_TRIGGERED:"disableReactionsTriggered",ENABLE_ANONYMOUS_EMAIL_TRIGGERED:"enableAnonymousEmailTriggered",DISABLE_ANONYMOUS_EMAIL_TRIGGERED:"disableAnonymousEmailTriggered",SET_RECORDINGS_TRIGGERED:"setRecordingsTriggered",ADD_COMMENT_ON_ELEMENT_TRIGGERED:"addCommentOnElementTriggered",ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"enablePrivateCommentModeTriggered",DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"disablePrivateCommentModeTriggered",ENABLE_PRIVATE_MODE_TRIGGERED:"enablePrivateModeTriggered",DISABLE_PRIVATE_MODE_TRIGGERED:"disablePrivateModeTriggered",ENABLE_SCROLL_TO_COMMENT_TRIGGERED:"enableScrollToCommentTriggered",DISABLE_SCROLL_TO_COMMENT_TRIGGERED:"disableScrollToCommentTriggered",ENABLE_USER_MENTIONS_TRIGGERED:"enableUserMentionsTriggered",DISABLE_USER_MENTIONS_TRIGGERED:"disableUserMentionsTriggered",SET_COMMENT_SIDEBAR_FILTERS_TRIGGERED:"setCommentSidebarFiltersTriggered",SET_SYSTEM_FILTERS_OPERATOR_TRIGGERED:"setSystemFiltersOperatorTriggered",ENABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"enableCommentPinHighlighterTriggered",DISABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"disableCommentPinHighlighterTriggered",ENABLE_DELETE_ON_BACKSPACE_TRIGGERED:"enableDeleteOnBackspaceTriggered",DISABLE_DELETE_ON_BACKSPACE_TRIGGERED:"disableDeleteOnBackspaceTriggered",ENABLE_HOTKEY_TRIGGERED:"enableHotkeyTriggered",DISABLE_HOTKEY_TRIGGERED:"disableHotkeyTriggered",ENABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"enableDeviceIndicatorOnCommentPinsTriggered",DISABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"disableDeviceIndicatorOnCommentPinsTriggered",GET_ELEMENT_REF_BY_ANNOTATION_ID_TRIGGERED:"getElementRefByAnnotationIdTriggered",SCROLL_TO_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"scrollToCommentByAnnotationIdTriggered",SELECT_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"selectCommentByAnnotationIdTriggered",ENABLE_RECORDING_SUMMARY_TRIGGERED:"enableRecordingSummaryTriggered",DISABLE_RECORDING_SUMMARY_TRIGGERED:"disableRecordingSummaryTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",SET_UNREAD_INDICATOR_MODE_TRIGGERED:"setUnreadIndicatorModeTriggered",ENABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"enableEnterKeyToSubmitTriggered",DISABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"disableEnterKeyToSubmitTriggered",ENABLE_PIN_SHADOW_DOM_TRIGGERED:"enablePinShadowDOMTriggered",DISABLE_PIN_SHADOW_DOM_TRIGGERED:"disablePinShadowDOMTriggered",ENABLE_DIALOG_SHADOW_DOM_TRIGGERED:"enableDialogShadowDOMTriggered",DISABLE_DIALOG_SHADOW_DOM_TRIGGERED:"disableDialogShadowDOMTriggered",ENABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"enableSidebarShadowDOMTriggered",DISABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"disableSidebarShadowDOMTriggered",ENABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"enableChangeDetectionInCommentModeTriggered",DISABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"disableChangeDetectionInCommentModeTriggered",SHOW_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"showResolvedCommentsOnDomTriggered",HIDE_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"hideResolvedCommentsOnDomTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered",ON_COMMENT_SELECTION_CHANGE_TRIGGERED:"onCommentSelectionChangeTriggered",GET_UNREAD_COMMENT_COUNT_BY_ANNOTATION_ID_TRIGGERED:"getUnreadCommentCountByAnnotationIdTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentAnnotationCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentAnnotationCountByLocationIdTriggered",GET_UNREAD_COMMENT_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentCountByLocationIdTriggered",UPDATE_COMMENT_DIALOG_POSITION_TRIGGERED:"updateCommentDialogPositionTriggered",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered",SET_PIN_CURSOR_IMAGE_TRIGGERED:"setPinCursorImageTriggered",ADD_MANUAL_COMMENT_TRIGGERED:"addManualCommentTriggered",CREATE_CUSTOM_LIST_DATA_ON_ANNOTATION_TRIGGERED:"createCustomListDataOnAnnotationTriggered",CREATE_CUSTOM_LIST_DATA_ON_COMMENT_TRIGGERED:"createCustomListDataOnCommentTriggered",EXCLUDE_LOCATION_IDS_FROM_SIDEBAR_TRIGGERED:"excludeLocationIdsFromSidebarTriggered",ENABLE_BUBBLE_ON_PIN_TRIGGERED:"enableBubbleOnPinTriggered",DISABLE_BUBBLE_ON_PIN_TRIGGERED:"disableBubbleOnPinTriggered",ENABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"enableBubbleOnPinHoverTriggered",DISABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"disableBubbleOnPinHoverTriggered",ENABLE_PIN_DRAG_TRIGGERED:"enablePinDragTriggered",DISABLE_PIN_DRAG_TRIGGERED:"disablePinDragTriggered",ENABLE_MULTI_THREAD_MODE_TRIGGERED:"enableMultiThreadModeTriggered",DISABLE_MULTI_THREAD_MODE_TRIGGERED:"disableMultiThreadModeTriggered",ENABLE_MULTI_THREAD_TRIGGERED:"enableMultiThreadTriggered",DISABLE_MULTI_THREAD_TRIGGERED:"disableMultiThreadTriggered",ENABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"enableGroupMatchedCommentsTriggered",DISABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"disableGroupMatchedCommentsTriggered",UPDATE_CONTEXT_TRIGGERED:"updateContextTriggered",UPDATE_VISIBILITY_TRIGGERED:"updateVisibilityTriggered",GET_SELECTED_COMMENTS_TRIGGERED:"getSelectedCommentsTriggered",ENABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"enableDeleteReplyConfirmationTriggered",DISABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"disableDeleteReplyConfirmationTriggered",ON_COPY_LINK_TRIGGERED:"onCopyLinkTriggered",GET_COMMENT_ANNOTATION_BY_ID_TRIGGERED:"getCommentAnnotationByIdTriggered",ENABLE_COLLAPSED_COMMENTS_TRIGGERED:"enableCollapsedCommentsTriggered",DISABLE_COLLAPSED_COMMENTS_TRIGGERED:"disableCollapsedCommentsTriggered",SET_COMMENT_SIDEBAR_DATA_TRIGGERED:"setCommentSidebarDataTriggered",ON_COMMENT_SIDEBAR_INIT_TRIGGERED:"onCommentSidebarInitTriggered",ON_COMMENT_SIDEBAR_DATA_TRIGGERED:"onCommentSidebarDataTriggered",SET_COMMENT_SIDEBAR_DEFAULT_CUSTOM_ACTIONS_TRIGGERED:"setCommentSidebarDefaultCustomActionsTriggered",ENABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"enableSidebarCustomActionsTriggered",DISABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"disableSidebarCustomActionsTriggered",ENABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"enableQueryParamsCommentsTriggered",DISABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"disableQueryParamsCommentsTriggered",ENABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"enableResolveStatusAccessAdminOnlyTriggered",DISABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"disableResolveStatusAccessAdminOnlyTriggered",ENABLE_LINK_CALLBACK_TRIGGERED:"enableLinkCallbackTriggered",DISABLE_LINK_CALLBACK_TRIGGERED:"disableLinkCallbackTriggered",ENABLE_SEEN_BY_USERS_TRIGGERED:"enableSeenByUsersTriggered",DISABLE_SEEN_BY_USERS_TRIGGERED:"disableSeenByUsersTriggered",ENABLE_SHORT_USER_NAME_TRIGGERED:"enableShortUserNameTriggered",DISABLE_SHORT_USER_NAME_TRIGGERED:"disableShortUserNameTriggered",ENABLE_READ_ONLY_TRIGGERED:"enableReadOnlyTriggered",DISABLE_READ_ONLY_TRIGGERED:"disableReadOnlyTriggered",ADD_COMMENT_ANNOTATION_TRIGGERED:"addCommentAnnotationTriggered",APPROVE_COMMENT_ANNOTATION_TRIGGERED:"approveCommentAnnotationTriggered",ACCEPT_COMMENT_ANNOTATION_TRIGGERED:"acceptCommentAnnotationTriggered",REJECT_COMMENT_ANNOTATION_TRIGGERED:"rejectCommentAnnotationTriggered",SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"subscribeCommentAnnotationTriggered",UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"unsubscribeCommentAnnotationTriggered",DELETE_COMMENT_ANNOTATION_TRIGGERED:"deleteCommentAnnotationTriggered",GET_COMMENT_ANNOTATIONS_TRIGGERED:"getCommentAnnotationsTriggered",GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED:"getCommentAnnotationsCountTriggered",ASSIGN_USER_TRIGGERED:"assignUserTriggered",UPDATE_PRIORITY_TRIGGERED:"updatePriorityTriggered",UPDATE_STATUS_TRIGGERED:"updateStatusTriggered",UPDATE_ACCESS_TRIGGERED:"updateAccessTriggered",RESOLVE_COMMENT_ANNOTATION_TRIGGERED:"resolveCommentAnnotationTriggered",GET_LINK_TRIGGERED:"getLinkTriggered",COPY_LINK_TRIGGERED:"copyLinkTriggered",ADD_COMMENT_TRIGGERED:"addCommentTriggered",UPDATE_COMMENT_TRIGGERED:"updateCommentTriggered",DELETE_COMMENT_TRIGGERED:"deleteCommentTriggered",GET_COMMENT_TRIGGERED:"getCommentTriggered",MARK_AS_READ_TRIGGERED:"markAsReadTriggered",MARK_AS_UNREAD_TRIGGERED:"markAsUnreadTriggered",ENABLE_SCREENSHOT_TRIGGERED:"enableScreenshotTriggered",DISABLE_SCREENSHOT_TRIGGERED:"disableScreenshotTriggered",ENABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"enablePaginatedContactListTriggered",DISABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"disablePaginatedContactListTriggered",SUBMIT_COMMENT_TRIGGERED:"submitCommentTriggered",CLEAR_COMPOSER_TRIGGERED:"clearComposerTriggered",GET_COMPOSER_DATA_TRIGGERED:"getComposerDataTriggered",ENABLE_FORMAT_OPTIONS_TRIGGERED:"enableFormatOptionsTriggered",DISABLE_FORMAT_OPTIONS_TRIGGERED:"disableFormatOptionsTriggered",SET_FORMAT_CONFIG_TRIGGERED:"setFormatConfigTriggered",ADD_ATTACHMENT_TRIGGERED:"addAttachmentTriggered",DELETE_ATTACHMENT_TRIGGERED:"deleteAttachmentTriggered",GET_ATTACHMENT_TRIGGERED:"getAttachmentTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",GET_RECORDING_TRIGGERED:"getRecordingTriggered",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",ADD_REACTION_TRIGGERED:"addReactionTriggered",DELETE_REACTION_TRIGGERED:"deleteReactionTriggered",TOGGLE_REACTION_TRIGGERED:"toggleReactionTriggered",ENABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"enableCustomAutocompleteSearchTriggered",DISABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"disableCustomAutocompleteSearchTriggered",FETCH_COMMENT_ANNOTATIONS_TRIGGERED:"fetchCommentAnnotationsTriggered",SET_TRANSFORM_CONTEXT_TRIGGERED:"setTransformContextTriggered",ENABLE_SVG_AS_IMG_TRIGGERED:"enableSvgAsImgTriggered",DISABLE_SVG_AS_IMG_TRIGGERED:"disableSvgAsImgTriggered",ENABLE_FULL_EXPANDED_TRIGGERED:"enableFullExpandedTriggered",DISABLE_FULL_EXPANDED_TRIGGERED:"disableFullExpandedTriggered",ENABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"enableCommentToNearestAllowedElementTriggered",DISABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"disableCommentToNearestAllowedElementTriggered",ENABLE_DRAFT_MODE_TRIGGERED:"enableDraftModeTriggered",DISABLE_DRAFT_MODE_TRIGGERED:"disableDraftModeTriggered",ENABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"enableFilterCommentsOnDomTriggered",DISABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"disableFilterCommentsOnDomTriggered",ENABLE_REPLY_AVATARS_TRIGGERED:"enableReplyAvatarsTriggered",DISABLE_REPLY_AVATARS_TRIGGERED:"disableReplyAvatarsTriggered",SET_MAX_REPLY_AVATARS_TRIGGERED:"setMaxReplyAvatarsTriggered",SET_SIDEBAR_BUTTON_COUNT_TYPE_TRIGGERED:"setSidebarButtonCountTypeTriggered",ENABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"enableFilterGhostCommentsInSidebarTriggered",DISABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"disableFilterGhostCommentsInSidebarTriggered",ENABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"enableFullScreenInSidebarTriggered",DISABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"disableFullScreenInSidebarTriggered"},Recording:{RECORDING_TOOL_CLICKED:"recordingToolClicked",RECORDING_ADDED:"recordingAdded",RECORDING_PANEL_SAVE_BUTTON_CLICKED:"recordingPanelSaveButtonClicked",RECORDING_PANEL_CANCEL_BUTTON_CLICKED:"recordingPanelCancelButtonClicked",RECORDING_PANEL_PAUSE_BUTTON_CLICKED:"recordingPanelPauseButtonClicked",RECORDING_PANEL_RESUME_BUTTON_CLICKED:"recordingPanelResumeButtonClicked",RECORDING_PANEL_VIDEO_ON_BUTTON_CLICKED:"recordingPanelVideoOnButtonClicked",RECORDING_PANEL_VIDEO_OFF_BUTTON_CLICKED:"recordingPanelVideoOffButtonClicked",RECORDING_PANEL_AUDIO_ON_BUTTON_CLICKED:"recordingPanelAudioOnButtonClicked",RECORDING_PANEL_AUDIO_OFF_BUTTON_CLICKED:"recordingPanelAudioOffButtonClicked",RECORDING_PANEL_START_BUTTON_CLICKED:"recordingPanelStartButtonClicked",RECORDING_PANEL_PIP_BUTTON_CLICKED:"recordingPanelPipButtonClicked",RECORDING_PLAYED:"recordingPlayed",RECORDING_PAUSED:"recordingPaused",RECORDING_DELETE_TRIGGERED:"recordingDeleteTriggered",RECORDING_DELETED:"recordingDeleted",RECORDING_DRAGGED:"recordingDragged",RECORDING_DRAFT_DRAGGED:"recordingDraftDragged",TRANSCRIPTION_CLICKED:"transcriptionClicked",SUBTITLES_CLICKED:"subtitlesClicked",VIEW_TRANSCRIPTION_SUMMARY_CLICKED:"viewTranscriptionSummaryClicked",TRANSCRIPTION_SUMMARY_COPIED:"transcriptionSummaryCopied",TRANSCRIPTION_TIMESTAMP_CLICKED:"transcriptionTimestampClicked",TRANSCRIPTION_PANEL_DRAGGED:"transcriptionPanelDragged",SUBTITLES_PANEL_DRAGGED:"subtitlesPanelDragged",ENABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"enablePlaybackOnPreviewClickTriggered",DISABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"disablePlaybackOnPreviewClickTriggered",REQUEST_SCREEN_PERMISSION_TRIGGERED:"requestScreenPermissionTriggered",INIT_RECORDING_TRIGGERED:"initRecordingTriggered",ON_RECORDED_DATA_TRIGGERED:"onRecordedDataTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED:"getRecordingDataByRecorderIdTriggered",GET_RECORDINGS_TRIGGERED:"getRecordingsTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",GET_RECORDING_DATA_TRIGGERED:"getRecordingDataTriggered",FETCH_RECORDINGS_TRIGGERED:"fetchRecordingsTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",ENABLE_VIDEO_EDITOR_TRIGGERED:"enableVideoEditorTriggered",DISABLE_VIDEO_EDITOR_TRIGGERED:"disableVideoEditorTriggered",SET_RECORDING_QUALITY_CONSTRAINTS_TRIGGERED:"setRecordingQualityConstraintsTriggered",SET_RECORDING_ENCODING_OPTIONS_TRIGGERED:"setRecordingEncodingOptionsTriggered",DOWNLOAD_LATEST_VIDEO_TRIGGERED:"downloadLatestVideoTriggered",ENABLE_RECORDING_MIC_TRIGGERED:"enableRecordingMicTriggered",DISABLE_RECORDING_MIC_TRIGGERED:"disableRecordingMicTriggered",ENABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"enableRetakeOnVideoEditorTriggered",DISABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"disableRetakeOnVideoEditorTriggered",ASK_DEVICE_PERMISSION_TRIGGERED:"askDevicePermissionTriggered",ENABLE_ONBOARDING_TOOLTIP_TRIGGERED:"enableOnboardingTooltipTriggered",DISABLE_ONBOARDING_TOOLTIP_TRIGGERED:"disableOnboardingTooltipTriggered",SET_MAX_LENGTH_TRIGGERED:"setMaxLengthTriggered",OPEN_PICTURE_IN_PICTURE_TRIGGERED:"openPictureInPictureTriggered",EXIT_PICTURE_IN_PICTURE_TRIGGERED:"exitPictureInPictureTriggered",ENABLE_PICTURE_IN_PICTURE_TRIGGERED:"enablePictureInPictureTriggered",DISABLE_PICTURE_IN_PICTURE_TRIGGERED:"disablePictureInPictureTriggered"},Huddle:{HUDDLE_TOOL_CLICKED:"huddleToolClicked",HUDDLE_CREATED:"huddleCreated",HUDDLE_JOIN_BUTTON_CLICKED:"huddleJoinButtonClicked",HUDDLE_JOINED:"huddleJoined",HUDDLE_LEFT:"huddleLeft",HUDDLE_AUDIO_BUTTON_CLICKED:"huddleAudioButtonClicked",HUDDLE_AUDIO_MUTED:"huddleAudioMuted",HUDDLE_AUDIO_UNMUTED:"huddleAudioUnmuted",HUDDLE_VIDEO_BUTTON_CLICKED:"huddleVideoButtonClicked",HUDDLE_VIDEO_TURNED_ON:"huddleVideoTurnedOn",HUDDLE_VIDEO_TURNED_OFF:"huddleVideoTurnedOff",HUDDLE_SCREENSHARING_BUTTON_CLICKED:"huddleScreensharingButtonClicked",HUDDLE_SCREENSHARING_STARTED:"huddleScreensharingStarted",HUDDLE_SCREENSHARING_STOPPED:"huddleScreensharingStopped",ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"enableHuddleOnCursorModeTriggered",DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"disableHuddleOnCursorModeTriggered",ENABLE_CHAT_TRIGGERED:"enableChatTriggered",DISABLE_CHAT_TRIGGERED:"disableChatTriggered",ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"enableFlockModeOnAvatarClickTriggered",DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"disableFlockModeOnAvatarClickTriggered"},Presence:{PRESENCE_MULTIPLE_USERS_DETECTED:"presenceMultipleUsersDetected",PRESENCE_USER_STATUS_CHANGED:"presenceUserStatusChanged",PRESENCE_USER_CLICKED:"presenceUserClicked",PRESENCE_SET_CUSTOM_INACTIVITY_TIMER:"presenceSetCustomInactivityTimer",PRESENCE_SET_CUSTOM_OFFLINE_INACTIVITY_TIMER:"presenceSetCustomOfflineInactivityTimer",PRESENCE_SET_CUSTOM_MAX_USERS:"presenceSetCustomMaxUsers",MULTIPLE_USERS_ONLINE:"multipleUsersOnline",ON_USER_STATE_CHANGE:"onUserStateChange",GET_PRESENCE_DATA_TRIGGERED:"getPresenceDataTriggered",GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED:"getOnlineUsersOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ENABLE_FLOCK_MODE_TRIGGERED:"enableFlockModeTriggered",DISABLE_FLOCK_MODE_TRIGGERED:"disableFlockModeTriggered",START_FOLLOWING_USER_TRIGGERED:"startFollowingUserTriggered",STOP_FOLLOWING_USER_TRIGGERED:"stopFollowingUserTriggered",ENABLE_SELF_TRIGGERED:"enableSelfTriggered",DISABLE_SELF_TRIGGERED:"disableSelfTriggered",ADD_USER_TRIGGERED:"addUserTriggered",REMOVE_USER_TRIGGERED:"removeUserTriggered"},Cursor:{CURSOR_MULTIPLE_USERS_DETECTED:"cursorMultipleUsersDetected",CURSOR_SET_CUSTOM_INACTIVITY_TIMER:"cursorSetCustomInactivityTimer",GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED:"getLiveCursorsOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Selection:{SELECTION_CREATED_WHEN_MULTIPLE_USERS_DETECTED:"selectionCreatedWhenMultipleUsersDetected",SELECTION_SET_CUSTOM_INACTIVITY_TIMER:"selectionSetCustomInactivityTimer",ENABLE_LIVE_SELECTION_TRIGGERED:"enableLiveSelectionTriggered",DISABLE_LIVE_SELECTION_TRIGGERED:"disableLiveSelectionTriggered",ENABLE_USER_INDICATOR_TRIGGERED:"enableUserIndicatorTriggered",DISABLE_USER_INDICATOR_TRIGGERED:"disableUserIndicatorTriggered",SET_USER_INDICATOR_POSITION_TRIGGERED:"setUserIndicatorPositionTriggered",SET_USER_INDICATOR_TYPE_TRIGGERED:"setUserIndicatorTypeTriggered",ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"enableDefaultElementsTrackingTriggered",DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"disableDefaultElementsTrackingTriggered",ENABLE_DEFAULT_STYLING_TRIGGERED:"enableDefaultStylingTriggered",DISABLE_DEFAULT_STYLING_TRIGGERED:"disableDefaultStylingTriggered",GET_LIVE_SELECTION_DATA_TRIGGERED:"getLiveSelectionDataTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered"},LiveStateSync:{SET_USER_AS_EDITOR_TRIGGERED:"setUserAsEditorTriggered",SET_USER_AS_EDITOR_ERROR:"setUserAsEditorError",REQUEST_EDITOR_ACCESS_TRIGGERED:"requestEditorAccessTriggered",ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED:"acceptEditorAccessRequestTriggered",REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED:"rejectEditorAccessRequestTriggered",CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED:"cancelEditorAccessRequestTriggered",EDIT_CURRENT_TAB_TRIGGERED:"editCurrentTabTriggered",SEM_ACCESS_REQUESTED:"semAccessRequested",SEM_ACCESS_REQUEST_CANCELED:"semAccessRequestCanceled",SEM_ACCESS_ACCEPTED:"semAccessAccepted",SEM_ACCESS_REJECTED:"semAccessRejected",SEM_EDITOR_ASSIGNED:"semEditorAssigned",SEM_VIEWER_ASSIGNED:"semViewerAssigned",SEM_EDITOR_ON_DIFFERENT_TAB_DETECTED:"semEditorOnDifferentTabDetected",SEM_MAKE_EDITOR_TRIGGERED:"semMakeEditorTriggered",SEM_MAKE_READER_TRIGGERED:"semMakeReaderTriggered",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_STATS:"semSingleEditorLiveStateDataStats",SEM_SINGLE_EDITOR_LIVE_STATE_EMPTY_DATA_STATS:"semSingleEditorLiveStateEmptyDataStats",SEM_SINGLE_EDITOR_DETERMINE_EDITOR_STATUS:"semSingleEditorDetermineEditorStatus",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_MISMATCH:"semSingleEditorLiveStateDataMismatch",SEM_SINGLE_EDITOR_DATA_MISMATCH_WITH_EXTERNAL:"semSingleEditorLiveStateDataMismatchWithExternal",SEM_USER_EDITOR_STATS:"semUserEditorStats",REMOVE_EDITOR_ACCESS:"removeEditorAccess",REMOVE_EDITOR_ACCESS_ERROR:"removeEditorAccessError",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_EDITOR:"semSingleEditorLiveStateDataOnMakeEditor",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_READER:"semSingleEditorLiveStateDataOnMakeReader",GET_LIVE_STATE_DATA_TRIGGERED:"getLiveStateDataTriggered",FETCH_LIVE_STATE_DATA_TRIGGERED:"fetchLiveStateDataTriggered",ENABLE_SINGLE_EDITOR_MODE_TRIGGERED:"enableSingleEditorModeTriggered",DISABLE_SINGLE_EDITOR_MODE_TRIGGERED:"disableSingleEditorModeTriggered",IS_USER_EDITOR_TRIGGERED:"isUserEditorTriggered",GET_EDITOR_TRIGGERED:"getEditorTriggered",RESET_USER_ACCESS_TRIGGERED:"resetUserAccessTriggered",SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED:"singleEditorModeContainerIdsTriggered",ENABLE_AUTO_SYNC_STATE_TRIGGERED:"enableAutoSyncStateTriggered",DISABLE_AUTO_SYNC_STATE_TRIGGERED:"disableAutoSyncStateTriggered",IS_EDITOR_ACCESS_REQUESTED_TRIGGERED:"isEditorAccessRequestedTriggered",EDITOR_ACCESS_REQUESTED_BY_TRIGGERED:"editorAccessRequestedByTriggered",EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"editorAccessTransferOnTimeoutTriggered",SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED:"setEditorAccessTimeoutTriggered",ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"enableEditorAccessTransferOnTimeoutTriggered",DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"disableEditorAccessTransferOnTimeoutTriggered",ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"enableDefaultSingleEditorUiTriggered",DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"disableDefaultSingleEditorUiTriggered",GET_EDITOR_ACCESS_TIMER_TRIGGERED:"getEditorAccessTimerTriggered",ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED:"onServerConnectionStateChangeTriggered",UPDATE_USER_PRESENCE_TRIGGERED:"updateUserPresenceTriggered",ENABLE_HEARTBEAT_TRIGGERED:"enableHeartbeatTriggered",DISABLE_HEARTBEAT_TRIGGERED:"disableHeartbeatTriggered"},Tag:{TAG_TOOL_CLICKED:"tagToolClicked",TAG_DRAFT_ADDED:"tagDraftAdded",TAG_ADDED:"tagAdded",TAG_READ:"tagRead",TAG_RESOLVED:"tagResolved",TAG_DRAGGED:"tagDragged",TAG_LINK_COPIED:"tagLinkCopied",TAG_ADD_MODE_ENABLED:"tagAddModeEnabled",TAG_ADD_MODE_DISABLED:"tagAddModeDisabled",TAG_DELETE_TRIGGERED:"tagDeleteTriggered",TAG_DELETED:"tagDeleted",GET_ALL_TAG_ANNOTATIONS_TRIGGERED:"getAllTagAnnotationsTriggered",DELETE_TAG_TRIGGERED:"deleteTagTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ATTACH_TAG_TRIGGERED:"attachTagTriggered",ADD_TAG_MODE_CHANGE_TRIGGERED:"addTagModeChangeTriggered"},Rewriter:{REWRITER_ENABLED:"rewriterEnabled",REWRITER_MIN_CHARACTER_NOT_MET:"rewriterMinCharacterNotMet",REWRITER_MAX_CHARACTER_NOT_MET:"rewriterMaxCharacterNotMet",REWRITE_BUTTON_CLICKED:"rewriteButtonClicked",REWRITE_PROMPT_BUTTON_CLICKED:"rewritePromptButtonClicked",REWRITE_REFRESH_BUTTON_CLICKED:"rewriteRefreshButtonClicked",REWRITE_OPTION_SELECTED:"rewriteOptionSelected",REWRITE_TASK_CREATED:"rewriteTaskCreated",REWRITE_DIALOG_DRAGGED:"rewriteDialogDragged",REWRITE_SHOW_ORIGINAL_TEXT_CLICKED:"rewriteShowOriginalTextClicked",REWRITE_CLOSE_BUTTON_CLICKED:"rewriteCloseButtonClicked",REWRITE_PROMPT_SUBMITTED:"rewritePromptSubmitted",ENABLE_REWRITER_TRIGGERED:"enableRewriterTriggered",DISABLE_REWRITER_TRIGGERED:"disableRewriterTriggered",ON_TEXT_SELECTED_SUBSCRIBED:"onTextSelectedSubscribed",ASK_AI_TRIGGERED:"askAiTriggered",REPLACE_TEXT_TRIGGERED:"replaceTextTriggered",ADD_COMMENT_FROM_AI_TRIGGERED:"addCommentFromAITriggered"},Feedback:{FEEDBACK_BUTTON_CLICKED:"feedbackButtonClicked",FEEDBACK_SUBMITTED:"feedbackSubmitted"},Contact:{UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ON_CONTACT_SELECTED_TRIGGERED:"onContactSelectedTriggered",ENABLE_AT_HERE_TRIGGERED:"enableAtHereTriggered",DISABLE_AT_HERE_TRIGGERED:"disableAtHereTriggered",SET_AT_HERE_LABEL_TRIGGERED:"setAtHereLabelTriggered",SET_AT_HERE_DESCRIPTION_TRIGGERED:"setAtHereDescriptionTriggered",UPDATE_CONTACT_LIST_SCOPE_FOR_ORGANIZATION_USERS_TRIGGERED:"updateContactListScopeForOrganizationUsersTriggered",GET_CONTACT_LIST_TRIGGERED:"getContactListTriggered"},ContactUs:{CONTACT_BUTTON_CLICKED:"contactButtonClicked",CONTACT_SUBMITTED:"contactSubmitted"},Bug:{BUG_BUTTON_CLICKED:"bugButtonClicked",BUG_SUBMITTED:"bugSubmitted"},ShareDialog:{SHARE_BUTTON_CLICKED:"shareButtonClicked",DOCUMENT_ACCESS_CHANGED:"documentAccessChanged",DOCUMENT_USER_ACCESS_ADDED:"documentUserAccessAdded",DOCUMENT_USER_ACCESS_REMOVED:"documentUserAccessRemoved",SHARE_LINK_COPIED:"shareLinkCopied"},InviteDialog:{USER_INVITED:"userInvited",INVITE_LINK_COPIED:"inviteLinkCopied"},Iam:{USER_ACCESS_DENIED:"userAccessDenied"},Arrow:{ARROW_TOOL_CLICKED:"arrowToolClicked",ARROW_DRAFT_ADDED:"arrowDraftAdded",ARROW_ADDED:"arrowAdded",ARROW_READ:"arrowRead",ARROW_RESOLVED:"arrowResolved",ARROW_DRAGGED:"arrowDragged",ARROW_LINK_COPIED:"arrowLinkCopied",ARROW_ADD_MODE_ENABLED:"arrowAddModeEnabled",ARROW_ADD_MODE_DISABLED:"arrowAddModeDisabled",ARROW_DELETE_TRIGGERED:"arrowDeleteTriggered",ARROW_DELETED:"arrowDeleted",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Area:{AREA_TOOL_CLICKED:"areaToolClicked",AREA_ADDED:"areaAdded",AREA_DRAGGED:"areaDragged",AREA_LINK_COPIED:"areaLinkCopied",AREA_ADD_MODE_ENABLED:"areaAddModeEnabled",AREA_ADD_MODE_DISABLED:"areaAddModeDisabled",AREA_DELETE_TRIGGERED:"areaDeleteTriggered",AREA_DELETED:"areaDeleted",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered"},Doc:{DOCUMENT_ID_SET_TRIGGERED:"documentIdSetTriggered",SET_DOCUMENTS_SUCCESS:"setDocumentsSuccess",SET_LOCATIONS_SUCCESS:"setLocationsSuccess",REMOVE_LOCATIONS_SUCCESS:"removeLocationsSuccess",UNSET_LOCATIONS_SUCCESS:"unsetLocationsSuccess",DOCUMENT_SET_TRIGGERED:"documentSetTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",UNSET_DOCUMENTS_SUCCESS:"unsetDocumentsSuccess",DOCUMENTS_SET_TRIGGERED:"documentsSetTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered"},Reactions:{ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered"},Views:{GET_UNIQUE_VIEWS_BY_USER_TRIGGERED:"getUniqueViewsByUserTriggered",GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED:"getUniqueViewsByDateTriggered"},Notifications:{NOTIFICATION_HISTORY_PANEL_OPENED:"notificationHistoryPanelOpened",ENABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"enableSettingsAtOrganizationLevelTriggered",DISABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"disableSettingsAtOrganizationLevelTriggered",NOTIFICATION_HISTORY_PANEL_CLOSED:"notificationHistoryPanelClosed",NOTIFICATION_HISTORY_PANEL_TOGGLED:"notificationHistoryPanelToggled",NOTIFICATION_MARK_ALL_AS_READ_CLICKED:"notificationMarkAllAsReadClicked",NOTIFICATION_CLICKED:"notificationClicked",NOTIFICATION_TAB_CLICKED:"notificationTabClicked",NOTIFICATION_READ:"notificationRead",GET_NOTIFICATIONS_FOR_YOU$_TRIGGERED_INTERNAL:"getNotificationsForYou$Triggered_internal",GET_NOTIFICATIONS_BY_DOCUMENT_ID$_TRIGGERED_INTERNAL:"getNotificationsByDocumentId$Triggered_internal",GET_ALL_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getAllNotifications$Triggered_internal",GET_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getNotifications$Triggered_internal",OPEN_HISTORY_PANEL_TRIGGERED:"openHistoryPanelTriggered",CLOSE_HISTORY_PANEL_TRIGGERED:"closeHistoryPanelTriggered",TOGGLE_HISTORY_PANEL_TRIGGERED:"toggleHistoryPanelTriggered",GET_NOTIFICATIONS_DATA_TRIGGERED:"getNotificationsDataTriggered",SET_MAX_DAYS_TRIGGERED:"setMaxDaysTriggered",SET_TAB_CONFIG_TRIGGERED:"setTabConfigTriggered",ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"enableReadNotificationsOnForYouTabTriggered",DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"disableReadNotificationsOnForYouTabTriggered",SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED:"setAllNotificationsAsReadTriggered",GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED:"getUnreadNotificationsCountTriggered",MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED:"markNotificationAsReadByIdTriggered",SET_SETTINGS_TRIGGERED:"setSettingsTriggered",GET_SETTINGS_TRIGGERED:"getSettingsTriggered",MUTE_ALL_NOTIFICATIONS_TRIGGERED:"muteAllNotificationsTriggered",ENABLE_SETTINGS_TRIGGERED:"enableSettingsTriggered",ENABLE_SELF_NOTIFICATIONS_TRIGGERED:"enableSelfNotificationsTriggered",DISABLE_SELF_NOTIFICATIONS_TRIGGERED:"disableSelfNotificationsTriggered",DISABLE_SETTINGS_TRIGGERED:"disableSettingsTriggered",SET_SETTINGS_INITIAL_CONFIG_TRIGGERED:"setSettingsInitialConfigTriggered",OPEN_NOTIFICATIONS_PANEL_TRIGGERED:"openNotificationsPanelTriggered",CLOSE_NOTIFICATIONS_PANEL_TRIGGERED:"closeNotificationsPanelTriggered",ENABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"enableCurrentDocumentOnlyTriggered",DISABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"disableCurrentDocumentOnlyTriggered"},Crdt:{CRDT_DATA_UPDATED:"crdtDataUpdated"},Suggestions:{ENABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsEnableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsDisableSuggestionModeTriggered",IS_SUGGESTION_MODE_ENABLED_TRIGGERED:"suggestionsIsSuggestionModeEnabledTriggered",IS_SUGGESTION_MODE_ENABLED_STREAM_TRIGGERED:"suggestionsIsSuggestionModeEnabledStreamTriggered",REGISTER_TARGET_TRIGGERED:"suggestionsRegisterTargetTriggered",UNREGISTER_TARGET_TRIGGERED:"suggestionsUnregisterTargetTriggered",START_SUGGESTION_TRIGGERED:"suggestionsStartSuggestionTriggered",COMMIT_SUGGESTION_TRIGGERED:"suggestionsCommitSuggestionTriggered",GET_SUGGESTIONS_TRIGGERED:"suggestionsGetSuggestionsTriggered",GET_SUGGESTIONS_STREAM_TRIGGERED:"suggestionsGetSuggestionsStreamTriggered",GET_PENDING_SUGGESTION_TRIGGERED:"suggestionsGetPendingSuggestionTriggered",GET_PENDING_SUGGESTION_STREAM_TRIGGERED:"suggestionsGetPendingSuggestionStreamTriggered",ON_TRIGGERED:"suggestionsOnTriggered"}};let n=e;return n})(),F1=[L.Events.Rewriter.REWRITER_ENABLED];var k1=class{constructor(){this.attachmentId=Math.floor(1e5+Math.random()*9e5)}};var Pe={ANNOTATION_ADD:"comment_annotation.add",ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_UPDATE:"comment.update",COMMENT_DELETE:"comment.delete",STATUS_CHANGE:"comment_annotation.status_change",PRIORITY_CHANGE:"comment_annotation.priority_change",ASSIGN:"comment_annotation.assign",ACCESS_MODE_CHANGE:"comment_annotation.access_mode_change",CUSTOM_LIST_CHANGE:"comment_annotation.custom_list_change",APPROVE:"comment_annotation.approve",ACCEPT:"comment.accept",REJECT:"comment.reject",SUGGESTION_ACCEPT:"comment_annotation.suggestion_accept",SUGGESTION_REJECT:"comment_annotation.suggestion_reject",REACTION_ADD:"comment.reaction_add",REACTION_DELETE:"comment.reaction_delete",SUBSCRIBE:"comment_annotation.subscribe",UNSUBSCRIBE:"comment_annotation.unsubscribe"},Ig={RECORDING_ADD:"recording.add",RECORDING_DELETE:"recording.delete"},vg={REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete"},eDe={EDITOR_EDIT:"crdt.editor_edit"};var Ed=class{};var EC,CT=new Map,U1,NT=n=>n!=null?String(n):void 0,P7=n=>{if(n.url)try{let e=new URL(n.url);n.baseUrl===void 0&&(n.baseUrl=e.origin),n.path===void 0&&(n.path=e.pathname),n.queryParams===void 0&&(n.queryParams=e.search)}catch{}},V1=n=>{U1=n},iDe=(n,e)=>{try{if(!n||typeof n!="object")return;let r=JSON.parse(JSON.stringify(n));P7(r);let t=NT(e);t?CT.set(t,r):EC=r}catch(r){H.catch("Error in setClientPageInfo: ",r)}},oDe=n=>{try{let e=NT(n);e?CT.delete(e):EC=void 0}catch(e){H.catch("Error in clearClientPageInfo: ",e)}},OT=n=>{try{let e=NT(n)??NT(U1?.());return e&&CT.has(e)?CT.get(e):EC}catch(e){H.catch("Error in getClientPageInfo: ",e);return}};var _C;try{_C=typeof Intl<"u"&&Intl.v8BreakIterator}catch{_C=!1}var B1=(()=>{class n{_platformId=ne(ds);isBrowser=this._platformId?u1(this._platformId):typeof document=="object"&&!!document;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||_C)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function TC(n){return Array.isArray(n)?n:[n]}var G1=new Set,Zc,j1=(()=>{class n{_platform=ne(B1);_nonce=ne(ad,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):F7}matchMedia(r){return(this._platform.WEBKIT||this._platform.BLINK)&&x7(r,this._nonce),this._matchMedia(r)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function x7(n,e){if(!G1.has(n))try{Zc||(Zc=document.createElement("style"),e&&Zc.setAttribute("nonce",e),Zc.setAttribute("type","text/css"),document.head.appendChild(Zc)),Zc.sheet&&(Zc.sheet.insertRule(`@media ${n} {body{ }}`,0),G1.add(n))}catch(r){console.error(r)}}function F7(n){return{matches:n==="all"||n==="",media:n,addListener:()=>{},removeListener:()=>{}}}var k7=(()=>{class n{_mediaMatcher=ne(j1);_zone=ne(be);_queries=new Map;_destroySubject=new Ot;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(r){return $1(TC(r)).some(i=>this._registerQuery(i).mql.matches)}observe(r){let i=$1(TC(r)).map(s=>this._registerQuery(s).observable),o=Jr(i);return o=Ws(o.pipe(Nt(1)),o.pipe(NS(1),Su(0))),o.pipe(fe(s=>{let a={matches:!1,breakpoints:{}};return s.forEach(({matches:c,query:l})=>{a.matches=a.matches||c,a.breakpoints[l]=c}),a}))}_registerQuery(r){if(this._queries.has(r))return this._queries.get(r);let t=this._mediaMatcher.matchMedia(r),o={observable:new ge(s=>{let a=c=>this._zone.run(()=>s.next(c));return t.addListener(a),()=>{t.removeListener(a)}}).pipe(Du(t),fe(({matches:s})=>({query:r,matches:s})),zs(this._destroySubject)),mql:t};return this._queries.set(r,o),o}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function $1(n){return n.map(e=>e.split(",")).reduce((e,r)=>e.concat(r)).map(e=>e.trim())}var yg={XSmall:"(max-width: 599.98px)",Small:"(min-width: 600px) and (max-width: 959.98px)",Medium:"(min-width: 960px) and (max-width: 1279.98px)",Large:"(min-width: 1280px) and (max-width: 1919.98px)",XLarge:"(min-width: 1920px)",Handset:"(max-width: 599.98px) and (orientation: portrait), (max-width: 959.98px) and (orientation: landscape)",Tablet:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), (min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",Web:"(min-width: 840px) and (orientation: portrait), (min-width: 1280px) and (orientation: landscape)",HandsetPortrait:"(max-width: 599.98px) and (orientation: portrait)",TabletPortrait:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)",WebPortrait:"(min-width: 840px) and (orientation: portrait)",HandsetLandscape:"(max-width: 959.98px) and (orientation: landscape)",TabletLandscape:"(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",WebLandscape:"(min-width: 1280px) and (orientation: landscape)"};var li=(()=>{let e=class e{constructor(){try{this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight()}catch{}}getBrowserName(){try{return(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))!=-1?"Opera":navigator.userAgent.indexOf("Chrome")!=-1?"Chrome":navigator.userAgent.indexOf("Safari")!=-1?"Safari":navigator.userAgent.indexOf("Firefox")!=-1?"Firefox":navigator.userAgent.indexOf("MSIE")!=-1||document?.documentMode?"IE":"Unknown"}catch{return"Unknown"}}getDeviceType(){try{return e.Breakpoints[yg.Handset]?Gr.MOBILE:e.Breakpoints[yg.Tablet]?Gr.TABLET:e.Breakpoints[yg.XLarge]?Gr.MONITOR:e.Breakpoints[yg.Web]?Gr.DESKTOP:Gr.UNKNOWN}catch{return Gr.UNKNOWN}}getOrientation(){try{return e.Orientations[_T.Portrait]?fd.PORTRAIT:e.Orientations[_T.Landscape]?fd.LANDSCAPE:fd.UNKNOWN}catch{return fd.UNKNOWN}}getOSName(){try{return navigator.userAgent.indexOf("Windows")!=-1?"Windows":navigator.userAgent.indexOf("Macintosh")!=-1?"Macintosh":navigator.userAgent.indexOf("Linux")!=-1?"Linux":"Unknown"}catch{return"Unknown"}}getOSVersion(){try{let s=navigator?.userAgent,a="Unknown";if(s.indexOf("Windows")!==-1)s.indexOf("Windows NT 5.1")!==-1?a="Windows XP":s.indexOf("Windows NT 6.0")!==-1?a="Windows Vista":s.indexOf("Windows NT 6.1")!==-1?a="Windows 7":s.indexOf("Windows NT 6.2")!==-1?a="Windows 8":s.indexOf("Windows NT 6.3")!==-1?a="Windows 8.1":s.indexOf("Windows NT 10.0")!==-1&&(a="Windows 10");else if(s.indexOf("Mac OS X")!==-1)a=s.match(/Mac OS X ([0-9_.]+)/)[1],a=a.replace(/_/g,".");else if(s.indexOf("iOS")!==-1)a=s.match(/OS ([0-9_.]+) like Mac OS X/)[1],a=a.replace(/_/g,".");else if(s.indexOf("Firefox")!==-1){var t=/\(([^)]+)\)/,i=t.exec(s)[1],o=i.split("; ");a=o[2]}return a||"Unknown"}catch{return"Unknown"}}getBrowserVersion(){try{return this.browserName=="Opera"?this.getOperaVersion():this.browserName=="Chrome"?this.getChromeVersion():this.browserName=="Safari"?this.getSafariVersion():this.browserName=="Firefox"?this.getFirefoxVersion():this.browserName=="IE"?this.getIEVersion():"Unknown"}catch{return"Unknown"}}getOperaVersion(){try{var t=navigator.userAgent.match(/(?:Opera|OPR)\/(\d+)/);return t?t[1]:"Unknown"}catch{return"Unknown"}}getChromeVersion(){try{var t=navigator.userAgent.match(/(?:Chrome|Chromium)\/(\d+)/);return t?t[1]:"Unknown"}catch{return"Unknown"}}getSafariVersion(){try{var t=navigator.userAgent.match(/Version\/(\d+)/);return t?t[1]:"Unknown"}catch{return"Unknown"}}getFirefoxVersion(){try{var t=navigator.userAgent.match(/Firefox\/(\d+)/);return t?t[1]:"Unknown"}catch{return"Unknown"}}getIEVersion(){try{var t=navigator.userAgent.match(/MSIE (\d+)/);return t?t[1]:"Unknown"}catch{return"Unknown"}}getScreenWidth(){try{return window.screen.width}catch{return 0}}getScreenHeight(){try{return window.screen.height}catch{return 0}}getDeviceInfo(){try{return this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight(),JSON.parse(JSON.stringify(this))}catch{return{browserName:"Unknown",browserVersion:"Unknown",deviceType:"Unknown",osName:"Unknown",osVersion:"Unknown",screenWidth:0,screenHeight:0,userAgent:"Unknown"}}}};e.Breakpoints={},e.Orientations={};let n=e;return n})();var bt=class{constructor(e=!0){this.deviceInfo=new li().getDeviceInfo();try{if(e){let r=OT();r&&Object.assign(this,r)}}catch{}}};var H1=class{constructor(){this.targetElements=[],this.type="area",this.props=new Ed,this.pageInfo=new bt,this.targetAnnotations=[]}};var W1=class{constructor(){this.type="arrow",this.props=new Ed,this.pageInfo=new bt}};var PDe={COPY_LINK:"copy-link",DELETE:"delete"},xDe={COPY_LINK:"Copy link",LINK_COPIED:"Link copied!",DELETE_THREAD:"Delete thread"};var wT=class{constructor(){this.comments=[],this.commentCategories=[],this.type="comment",this.status=v.CommentAnnotationStatusMap.OPEN,this.pageInfo=new bt,this.iam=new IC,this.customList=[],this.subscribedUsers={},this.unsubscribedUsers={},this.subscribedGroups={}}};var IC=class{constructor(){this.accessMode=_g.PUBLIC}};var bT=class{constructor(){this.commentId=Math.floor(1e5+Math.random()*9e5),this.type="text",this.to=[],this.status="added",this.attachments=[],this.recorders=[],this.reactionAnnotationIds=[],this.taggedUserContacts=[],this.customList=[],this.toOrganizationUserGroup=[],this.reactionAnnotations=[]}};var LT=class{constructor(){this.urlAllowList=[],this.featureAllowList=[],this.userPlanAllowList=[],this.userIdAllowList=[],this.userGroupIdAllowList=[],this.debugMode=!1,this.usePrefersColorScheme=!1,this.advancedQueriesDisabled=!1,this.globalStyles=!0}};var xn=(function(n){return n.RESOLVE_USERS="resolveUsers",n.FORMAT_RESPONSE="formatResponse",n.MERGE_USER_WITH_PROVIDED_USER_DATA="mergeUserWithProvidedUserData",n.GET_TEMPORARY_USERS="getTemporaryUsers",n.SET_SINGLE_EDITOR_MODE_LIVE_STATE_DATA_FOR_DIFFERENT_USER_PRESENT_ON_TAB="setSingleEditorModeLiveStateDataForDifferentUserPresentOnTab",n.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER="resolveAndMergeSingleEditorLiveStateDataWithUser",n.GET_SINGLE_EDITOR_MODE_DATA="getSingleEditorModeData",n.RESOLVE_USERS_FROM_HUDDLE_MESSAGES="resolveUsersFromHuddleMessages",n.RESOLVE_USER_IDS_BY_EMAIL="resolveUserIdsByEmail",n})(xn||{}),el=(function(n){return n.IDENTIFY="identify/authProvider",n.GET_TEMPORARY_USERS="getTemporaryUsers",n.GET_USERS="getUsers",n.GET_HUDDLE_USERS="getHuddleUsers",n.GET_SINGLE_EDITOR_USERS="getSingleEditorUsers",n})(el||{}),Et=(function(n){return n.RESOLVE_COMMENT_ANNOTATIONS="resolveCommentAnnotations",n.SAVE_COMMENT_ANNOTATION="saveCommentAnnotation",n.DELETE_COMMENT_ANNOTATION="deleteCommentAnnotation",n.FORMAT_RESPONSE="formatResponse",n.INIT_DOCUMENTS="initDocuments",n.SET_DATA="setData",n.UPDATE_DATA="updateData",n.DELETE_DATA="deleteData",n})(Et||{}),Co=(function(n){return n.SAVE_ATTACHMENT="saveAttachment",n.DELETE_ATTACHMENT="deleteAttachment",n.UPLOAD_TO_RESOLVER="uploadToResolver",n})(Co||{}),_t=(function(n){return n.RESOLVE_REACTION_ANNOTATIONS="resolveReactionAnnotations",n.SAVE_REACTION_ANNOTATION="saveReactionAnnotation",n.DELETE_REACTION_ANNOTATION="deleteReactionAnnotation",n.FORMAT_RESPONSE="formatResponse",n.INIT_DOCUMENTS="initDocuments",n.SET_DATA="setData",n.UPDATE_DATA="updateData",n.DELETE_DATA="deleteData",n})(_t||{}),z1;z1||(z1={});var _d=(function(n){return n.SET_DOCUMENTS="setDocuments",n.GET_COMMENT_ANNOTATIONS="getCommentAnnotations",n.GET_NOTIFICATIONS="getNotifications",n})(_d||{}),q1;q1||(q1={});var Td=(function(n){return n.SET_DOCUMENTS="setDocuments",n.GET_REACTION_ANNOTATIONS="getReactionAnnotations",n})(Td||{}),Tt=(function(n){return n.RESOLVE_RECORDER_ANNOTATIONS="resolveRecorderAnnotations",n.SAVE_RECORDER_ANNOTATION="saveRecorderAnnotation",n.DELETE_RECORDER_ANNOTATION="deleteRecorderAnnotation",n.FORMAT_RESPONSE="formatResponse",n.INIT_DOCUMENTS="initDocuments",n.SET_DATA="setData",n.UPDATE_DATA="updateData",n.DELETE_DATA="deleteData",n})(Tt||{}),Id=(function(n){return n.GET_RECORDER_ANNOTATIONS="getRecorderAnnotations",n})(Id||{}),Fn=(function(n){return n.RESOLVE_NOTIFICATIONS="resolveNotifications",n.DELETE_NOTIFICATION="deleteNotification",n.DELETE_DATA="deleteData",n.FORMAT_RESPONSE="formatResponse",n})(Fn||{}),vC=(function(n){return n.GET_NOTIFICATIONS="getNotifications",n})(vC||{}),cr=(function(n){return n.RESOLVE_ACTIVITIES="resolveActivities",n.SAVE_ACTIVITY="saveActivity",n.FORMAT_RESPONSE="formatResponse",n})(cr||{}),yC=(function(n){return n.GET_ACTIVITIES="getActivities",n})(yC||{}),kn=(function(n){return n.SET_DOCUMENTS="setDocuments",n.SET_ROOT_DOCUMENT="setRootDocument",n.SET_DOCUMENT_ID="setDocumentId",n.UNSET_DOCUMENT_ID="unsetDocumentId",n.UNSET_DOCUMENTS="unsetDocuments",n.SET_LOCATION="setLocation",n.SET_LOCATIONS="setLocations",n.SET_ROOT_LOCATION="setRootLocation",n.ADD_LOCATION="addLocation",n.REMOVE_LOCATION="removeLocation",n.REMOVE_LOCATIONS="removeLocations",n.UNSET_LOCATION_IDS="unsetLocationIds",n.REMOVE_LOCATIONS_SUCCESS="removeLocationsSuccess",n})(kn||{});var K1=class{constructor(){this.pageInfo=new bt}};var Y1=class{constructor(){this.documentAccessType=wt.PUBLIC,this.accessType=wt.PUBLIC,this.disabled=!1,this.features={},this.users={}}};var MT=class{};var PT=class{};var Q1=class{};var Es=class{constructor(){this.contacts=[]}};var U7=(function(n){return n.DOCUMENT_UNSET="document_unset",n.USER_LOGOUT="user_logout",n})(U7||{}),Un=(function(n){return n.SET_DOCUMENTS="setDocuments",n.IDENTIFY="identify",n.GET_NOTIFICATIONS="getNotifications",n.SET_NOTIFICATIONS="setNotifications",n.REVOKE_ACCESS_ON_USER_LOGOUT="revokeAccessOnUserLogout",n.REVOKE_ACCESS_ON_DOCUMENT_UNSET="revokeAccessOnDocumentUnset",n})(Un||{}),ui=(function(n){return n.FOLDER="folder",n.DOCUMENT="document",n.ORGANIZATION="organization",n.CONTEXT="context",n})(ui||{});var X1=class{constructor(){this.id=Math.floor(1e5+Math.random()*9e5)}};var J1=class{constructor(){this.singleTabEditor=!0}};var Z1=class{constructor(){this.state="idle"}};var tl=class{};var xT=class{};var eV=class{constructor(){this.type="multiThread"}};var tV=class{constructor(){this.pageInfo=new bt}};var nV=class{constructor(){this.type="audio"}},rV=class{constructor(){this.type="audio"}},iV=class{constructor(){this.getThumbnailTag=e=>`
120
+ <a href="${this.videoPlayerUrl}" target="_blank">
121
+ <img src="${e||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
122
+ </a>
123
+ `}};var oV=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new bt}};var sV=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new bt}};var Sg=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var aV=class{constructor(){this.pageInfo=new bt}},V7=(function(n){return n.Start="start",n.End="end",n})(V7||{}),B7=(function(n){return n.Avatar="avatar",n.Label="label",n})(B7||{});var cV=class{constructor(){this.sources=[],this.playerState=new SC}},SC=class{constructor(){this.volume=1}};var lV=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new bt}};var uV=class{constructor(){this.visibility="private"}};var hV=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new bt,this.isReactionResolverUsed=!1}};var FT=class{};var G7=(function(n){return n.EDITOR="editor",n.VIEWER="viewer",n})(G7||{}),No=(function(n){return n.DOES_NOT_EXIST="does_not_exist",n.PERMISSION_DENIED="permission_denied",n.SOMETHING_WENT_WRONG="something_went_wrong",n})(No||{});var $7=(function(n){return n.INTERNAL="internal",n.EXTERNAL="external",n})($7||{}),j7=(function(n){return n.UPDATE_DATA="updateData",n})(j7||{});var Vn=class n{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,r=!1){return this.onePassHasher.start().appendStr(e).end(r)}static hashAsciiStr(e,r=!1){return this.onePassHasher.start().appendAsciiStr(e).end(r)}static _hex(e){let r=n.hexChars,t=n.hexOut,i,o,s,a;for(a=0;a<4;a+=1)for(o=a*8,i=e[a],s=0;s<8;s+=2)t[o+1+s]=r.charAt(i&15),i>>>=4,t[o+0+s]=r.charAt(i&15),i>>>=4;return t.join("")}static _md5cycle(e,r){let t=e[0],i=e[1],o=e[2],s=e[3];t+=(i&o|~i&s)+r[0]-680876936|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+r[1]-389564586|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+r[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+r[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+r[4]-176418897|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+r[5]+1200080426|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+r[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+r[7]-45705983|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+r[8]+1770035416|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+r[9]-1958414417|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+r[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+r[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+r[12]+1804603682|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+r[13]-40341101|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+r[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+r[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,t+=(i&s|o&~s)+r[1]-165796510|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+r[6]-1069501632|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+r[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+r[0]-373897302|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+r[5]-701558691|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+r[10]+38016083|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+r[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+r[4]-405537848|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+r[9]+568446438|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+r[14]-1019803690|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+r[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+r[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+r[13]-1444681467|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+r[2]-51403784|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+r[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+r[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,t+=(i^o^s)+r[5]-378558|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+r[8]-2022574463|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+r[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+r[14]-35309556|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+r[1]-1530992060|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+r[4]+1272893353|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+r[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+r[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+r[13]+681279174|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+r[0]-358537222|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+r[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+r[6]+76029189|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+r[9]-640364487|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+r[12]-421815835|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+r[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+r[2]-995338651|0,i=(i<<23|i>>>9)+o|0,t+=(o^(i|~s))+r[0]-198630844|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+r[7]+1126891415|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+r[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+r[5]-57434055|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+r[12]+1700485571|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+r[3]-1894986606|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+r[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+r[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+r[8]+1873313359|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+r[15]-30611744|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+r[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+r[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+r[4]-145523070|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+r[11]-1120210379|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+r[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+r[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=t+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(n.stateIdentity),this}appendStr(e){let r=this._buffer8,t=this._buffer32,i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)r[i++]=o;else if(o<2048)r[i++]=(o>>>6)+192,r[i++]=o&63|128;else if(o<55296||o>56319)r[i++]=(o>>>12)+224,r[i++]=o>>>6&63|128,r[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");r[i++]=(o>>>18)+240,r[i++]=o>>>12&63|128,r[i++]=o>>>6&63|128,r[i++]=o&63|128}i>=64&&(this._dataLength+=64,n._md5cycle(this._state,t),i-=64,t[0]=t[16])}return this._bufferLength=i,this}appendAsciiStr(e){let r=this._buffer8,t=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)r[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,t),i=0}return this._bufferLength=i,this}appendByteArray(e){let r=this._buffer8,t=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)r[i++]=e[s++];if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,t),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let r=e.buffer,t=e.state,i=this._state,o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],o=0;o<r.length;o+=1)this._buffer8[o]=r.charCodeAt(o)}end(e=!1){let r=this._bufferLength,t=this._buffer8,i=this._buffer32,o=(r>>2)+1;this._dataLength+=r;let s=this._dataLength*8;if(t[r]=128,t[r+1]=t[r+2]=t[r+3]=0,i.set(n.buffer32Identity.subarray(o),o),r>55&&(n._md5cycle(this._state,i),i.set(n.buffer32Identity)),s<=4294967295)i[14]=s;else{let a=s.toString(16).match(/(.*?)(.{0,8})$/);if(a===null)return;let c=parseInt(a[2],16),l=parseInt(a[1],16)||0;i[14]=c,i[15]=l}return n._md5cycle(this._state,i),e?this._state:n._hex(this._state)}};Vn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);Vn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Vn.hexChars="0123456789abcdef";Vn.hexOut=[];Vn.onePassHasher=new Vn;if(Vn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var fV=["annotationId","annotationNumber","visibilityConfig","comments","commentCategories","from","color","resolved","inProgress","lastUpdated","createdAt","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","taggedElementPath","taggedElementRect","targetElement","targetElementId","position","documentParamsId","documentParams","locationId","location","type","commentType","sourceType","metadata","targetTextRange","selectAllContent","approved","status","statusUpdatedByUserId","annotationIndex","pageInfo","assignedTo","priority","ghostComment","areaAnnotationId","context","contextId","iam","isPageAnnotation","targetInlineCommentElementId","inlineCommentSectionConfig","customList","subscribedUsers","unsubscribedUsers","subscribedGroups","resolvedByUserId","resolvedByUser","multiThreadAnnotationId","isDraft","sourceId","views","viewedByUserIds","viewedBy","unread","suggestion","agent","involvedUserIds","mentionedUserIds"];var gV=["commentId","context","type","isCommentTextAvailable","isCommentResolverUsed","replaceContentHtml","replaceContentText","commentVoiceUrl","from","to","lastUpdated","createdAt","status","attachments","recorders","reactionAnnotationIds","taggedUserContacts","customList","toOrganizationUserGroup","isDraft","editedAt","isEdited","reactionAnnotations","sourceType","agent","metadata"];var mV=["annotationId","context","commentAnnotationId","reactions","lastUpdated","targetElement","targetElementId","position","locationId","location","type","annotationIndex","pageInfo","from","isReactionResolverUsed","iconUrl","iconEmoji","metadata","involvedUserIds"];var pV=["context","annotationId","commentAnnotationId","from","color","lastUpdated","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","recorderedElementPath","recorderedElementRect","targetElement","position","locationId","location","type","recordingType","mode","approved","attachment","attachments","annotationIndex","pageInfo","recordedTime","waveformData","displayName","metadata","latestVersion","recordingEditVersions","chunkUrls","isRecorderResolverUsed","isUrlAvailable"];var IOe=["id","featureType","actionType","eventType","actionUser","timestamp","metadata","targetEntityId","targetSubEntityId","changes","entityData","entityTargetData","displayMessageTemplate","displayMessageTemplateData","displayMessage","actionIcon","immutable","isActivityResolverUsed"];var EV=["userId"];var _V=["commonAncestorContainer","commonAncestorContainerFXpath","commonAncestorContainerCFXpath","commonAncestorContainerAnchor","occurrence"],TV=["attachmentId","isAttachmentResolverUsed","name","bucketPath","size","type","url","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages"],IV=["attachmentId","isAttachmentResolverUsed","bucketPath","size","type","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages"];var vV=["id","tag","type","thumbnailUrl","thumbnailWithPlayIconUrl","videoUrl","audioUrl","videoPlayerUrl","chunkUrls"];var NV=(n,e)=>{try{let r=new URL(n),t=r.hostname.split("."),i=t.length>=3?t[0]:"",o=n.replace(r.host,e);if(i){let s=o.includes("?")?"&":"?";o+=`${s}ns=${i}`}return o}catch(r){return H.catch("Error in getProxiedDatabaseUrl: ",r),n}},_r=(n,e=0)=>{try{let r=3735928559^e,t=1103547991^e;for(let i=0,o;i<n.length;i++)o=n.charCodeAt(i),r=Math.imul(r^o,2654435761),t=Math.imul(t^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),t=Math.imul(t^t>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&t)+(r>>>0)}catch(r){return H.catch("Error in cyrb53: ",r),0}},H7=()=>{try{return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+n/4).toString(16))}catch(n){return H.catch("Error in uuidv4: ",n),""}},xi=n=>{try{return Vn.hashStr(n)}catch(e){return H.catch("Error in hashStr: ",e),n}},OV=n=>{try{return!n||n.trim().length===0?void 0:Vn.hashStr(n)}catch(e){H.catch("Error in hashForAnchor: ",e);return}},ua=n=>_r(n).toString(),RC=n=>xi(n),_s=n=>xi(n).toString(),Oo=n=>xi(n).toString(),bOe=(n,e)=>{try{let r=n.userIds?.length?[...n.userIds]:[];return r.includes(e)||r.push(e),le(P({},n),{userIds:r})}catch(r){return H.catch("Error in ensureUserIdInVisibility: ",r),n}},LOe=n=>{try{if(!n)return!1;if(n.iam?.accessMode===_g.PRIVATE)return!0;let e=n.visibilityConfig?.type;return e==="restricted"||e==="organizationPrivate"}catch(e){return H.catch("Error in isAnnotationPrivate: ",e),!1}},MOe=(n,e)=>{let r=[];switch(n.type){case"public":return r.push(v.DEFAULT_VELT_CONTEXT),r;case"organizationPrivate":{let t=[...n.organizationId?[n.organizationId]:[],...n.organizationIds??[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);if(!t.length)throw new Error("organizationId is required for organizationPrivate visibility type");t.forEach(i=>{let o=_s(i);r.push(`organizationPrivate:${o}`)});break}case"restricted":{if(!n.userIds?.length)throw new Error("userIds is required for restricted visibility type");n.userIds.filter((i,o,s)=>!!i&&s.indexOf(i)===o).forEach(i=>{let o=xi(i).toString();r.push(`${v.VISIBILITY_SELF_PREFIX}${o}`)});break}default:throw new Error(`Invalid visibility type: ${n.type}`)}if(e){let t=`${v.VISIBILITY_SELF_PREFIX}${xi(e).toString()}`;r.includes(t)||r.push(t)}return r},POe=n=>{let e=[v.DEFAULT_VELT_CONTEXT];try{n?.userId&&e.push(`${v.VISIBILITY_SELF_PREFIX}${xi(n.userId).toString()}`),n?.clientOrganizationId?e.push(`organizationPrivate:${_s(n.clientOrganizationId)}`):n?.fallbackServerOrganizationId&&e.push(`organizationPrivate:${n.fallbackServerOrganizationId}`)}catch(r){H.catch("Error in buildViewerVisibilityTokens: ",r)}return e},xOe=(n,e)=>{try{if(!n?.length)return n??[];let r=new Set(e?.tokens??[]);return n.filter(t=>{try{let i=t?.visibilityConfig?.type;if(i!=="organizationPrivate"&&i!=="restricted")return!0;let o=t?.context?.accessFields;return!!(!o?.length||e?.userId&&t?.from?.userId===e.userId||o.some(s=>r.has(s))||e?.userId&&t?.visibilityConfig?.userIds?.includes(e.userId))}catch(i){return H.catch("Error filtering annotation visibility: ",i),!0}})}catch(r){return H.catch("Error in filterAnnotationsVisibleToUser: ",r),n}},FOe=n=>{try{if(n)return typeof n=="string"?Vn.hashStr(n):Array.isArray(n)?Vn.hashStr(n.join("-")):"";{let e=H7();return Vn.hashStr(e)}}catch(e){return H.catch("Error in getMultiThreadAnnotationId: ",e),""}},wV=(n,e,r)=>{try{if(n&&e){if(n.featureAllowList&&n.featureAllowList.length&&!n.featureAllowList.includes(r)||n.userIdAllowList&&n.userIdAllowList.length&&!n.userIdAllowList.includes(e.userId)||n.userGroupIdAllowList&&n.userGroupIdAllowList.length&&!n.userGroupIdAllowList.includes(e.groupId||"")||n.userPlanAllowList&&n.userPlanAllowList.length&&!n.userPlanAllowList.includes(e.plan||""))return!1;if(n.urlAllowList){let t=window.location.href;if(n.urlAllowList.length&&!n.urlAllowList.filter(i=>t.includes(i)).length)return!1}return!0}return!1}catch(t){return H.catch("Error in isFeatureAllowed: ",t),!1}},J=()=>{try{let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let r=0;r<20;r++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}catch(n){return H.catch("Error in utils generateId: ",n),""}},kOe=n=>{try{let e=0;if(n){let r=new Date().getTime();e=Math.abs(r-n)}return e}catch(e){return H.catch("Error in utils getFirebaseTimeDiffInMins: ",e),0}};var bV=()=>{try{return st.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(n){return H.catch("Error in showLogs: ",n),!1}},LV=()=>{try{return!!sessionStorage.getItem("debugContextMode")}catch(n){return H.catch("Error in showContextLogs: ",n),!1}},yd=n=>{try{return typeof n!="object"?Object.assign({},...Object.keys(n).sort().map(e=>({[e]:n[e]&&typeof n[e]=="object"?yd(n[e]):n[e]}))):n}catch(e){return H.catch("Error in sortObjectByKeys: ",e),n}},AC=n=>{try{return n!==null&&typeof n=="object"&&!Array.isArray(n)}catch{return!1}},yV=n=>{try{return AC(n)?Object.fromEntries(Object.entries(n).sort(([e],[r])=>e.localeCompare(r)).map(([e,r])=>[e,AC(r)?yV(r):Array.isArray(r)?r.map(t=>AC(t)?yV(t):t):r])):n}catch{return n}},SV=(n,e)=>{try{return typeof e!="object"||e===null?n===e:typeof n!="object"||n===null?!1:Array.isArray(e)?Array.isArray(n)?e.every(r=>n.some(t=>SV(t,r))):!1:Object.keys(e).every(r=>Object.prototype.hasOwnProperty.call(n,r)?SV(n[r],e[r]):!1)}catch{return!1}},W7=(n,e,r)=>I(null,null,function*(){try{let t=yield K7(e),i=new Uint8Array(new TextEncoder().encode(r)).slice(0,16),o=new TextEncoder().encode(n),s=yield window.crypto.subtle.encrypt({name:"AES-CBC",iv:i},t,o);return btoa(String.fromCharCode(...new Uint8Array(s)))}catch(t){return H.catch("Error in encrypt: ",t),n}}),z7=(n,e,r)=>I(null,null,function*(){try{let t=yield q7(e),i=new Uint8Array(new TextEncoder().encode(r)).slice(0,16),o=new Uint8Array(atob(n).split("").map(a=>a.charCodeAt(0))),s=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:i},t,o);return new TextDecoder().decode(s)}catch(t){return H.catch("Error in decrypt: ",t),n}}),q7=n=>I(null,null,function*(){try{let e=new TextEncoder().encode(n),r=new Uint8Array(32);return r.fill(0),r.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",r,"AES-CBC",!1,["decrypt"])}catch(e){throw H.catch("Error in importDecryptKey:",e),e}}),rl=(n,e)=>I(null,null,function*(){try{let r="Velt"+e;return yield W7(JSON.stringify(n),r,xi(r))}catch(r){return H.catch("Error in encryptData: ",r),n}}),CC=(n,e)=>I(null,null,function*(){try{let r="Velt"+e,t=yield z7(n,r,xi(r));return JSON.parse(t)}catch(r){return H.catch("Error in decryptData: ",r),null}}),GT=n=>{try{switch(n?.region){case"asiaSouthEast1":return"asiaSouthEast1";case"asiaNorthEast1":return"asiaNorthEast1";case"europeWest1":return"europeWest1";case"australiaSouthEast1":return"australiaSouthEast1";default:return"usCentral1"}}catch(e){return H.catch("Error in getRegion: ",e),"usCentral1"}},K7=n=>I(null,null,function*(){try{let e=new TextEncoder().encode(n),r=new Uint8Array(32);return r.fill(0),r.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",r,"AES-CBC",!1,["encrypt"])}catch(e){throw H.catch("Error in importKey:",e),e}}),UOe=n=>{try{if(n&&typeof n=="object"){let e=yd(n);return _r(JSON.stringify(e))}else return null}catch(e){return H.catch("Error in utils generateLocationId: ",e),null}},wo=(n,e=[])=>(n?.tagName?.toLowerCase().indexOf("velt-")>=0&&![v.TAGS.VELT_VIDEO_PLAYER.toLowerCase()].includes(n?.tagName?.toLowerCase())||n?.tagName?.toLowerCase().indexOf("snippyly-")>=0||n?.className?.split&&(n?.className?.split(" ")?.indexOf("snippyly-overlay-panel")>=0||n?.className?.split(" ")?.indexOf("cdk-overlay-container")>=0))&&!e?.includes(n?.tagName?.toLowerCase())?!0:n?.parentNode&&wo(n?.parentNode,e),VOe=(n,e=[])=>{try{let r=typeof n.composedPath=="function"?n.composedPath():[],t=r.length>0?r:[n?.target];for(let i of t){let o=i;if(!(!o||typeof o.tagName!="string")&&wo(o,e))return!0}}catch(r){H.catch("Error in utils isSnippylyEventTarget: ",r)}return!1},Dg=n=>{try{return!!document?.body?.contains(n)}catch(e){return H.catch("Error in utils isElementInsideBody: ",e),!1}};var Fi=(n,e)=>{try{return Object.prototype.toString.call(n)===Object.prototype.toString.call(e)?Object.prototype.toString.call(n)==="[object Object]"||Object.prototype.toString.call(n)==="[object Array]"?Object.keys(n).length!==Object.keys(e).length?!1:Object.keys(n).every(r=>Fi(n[r],e[r])):n===e:!1}catch(r){return H.catch("Error in utils deepCompare: ",r),!1}},BOe=(n,e,r=1)=>{try{if(e){let t=AV(e.textContent,n,r);if(t>=0){let i=e.querySelector("script")!==null,o=(e?.ownerDocument).createNodeIterator(e,NodeFilter.SHOW_TEXT,i?{acceptNode:g=>g.parentElement?.tagName==="SCRIPT"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}:null),s,a=[];for(;s=o.nextNode();)a.push(s);let c=t;if(i){let g=a.reduce((_,T)=>_+(T.textContent||""),""),p=AV(g,n,r);if(p<0)return[];c=p}let l=[],u=n.length,d=c+u,f=0;for(let g=0;g<a.length;g++){let p=a[g],_=f;if(f+=p.textContent?.length,f>=c&&!l.length?l.push({textNode:p,startOffset:c-_}):f>=c&&f<d&&l.push({textNode:p}),f>=d){if(l.length===1&&l[0].textNode===p){l.push({textNode:p,endOffset:c-_+n.length});break}let T=u;l.forEach(S=>{T-=S.textNode.textContent?.length-(S.startOffset||0)}),l.push({textNode:p,endOffset:T});break}}return l}}return[]}catch(t){return H.catch("Error in utils calculateNodes: ",t),[]}},AV=(n,e,r=1)=>{try{if(n?.includes(e)){let t=n.split(e,r);return t.length===r?t.join(e).length:-1}else return-1}catch(t){return H.catch("Error in utils getTextPosition: ",t),-1}},NC=(n,e,r,t,i)=>{try{let o=new Range;o.setStart(n,e),o.setEnd(r,t);let s=o.commonAncestorContainer,c=(s.nodeType===Node.ELEMENT_NODE?s:s.parentElement)?.querySelector("script")!==null,l;if(c){let d=o.cloneContents();d.querySelectorAll("script").forEach(f=>f.remove()),l=d.textContent||""}else l=o.toString();let u=0;if(n.nodeType===Node.TEXT_NODE){let d=n,f="";if(d)for(;d=d.previousSibling;)if(c){if(d.nodeType===Node.ELEMENT_NODE&&d.tagName==="SCRIPT")continue;if(d.nodeType===Node.ELEMENT_NODE){let g=d;if(g.querySelector("script")){let p=g.cloneNode(!0);p.querySelectorAll("script").forEach(_=>_.remove()),f=(p.textContent||"")+f}else f=(d.textContent||"")+f}else d.parentElement?.tagName!=="SCRIPT"&&(f=(d.textContent||"")+f)}else f=(d.textContent||"")+f;if(f){let g=new RegExp(nl(i),"g");u=(f.match(g)||[]).length}}if(l){let d=new RegExp(nl(i),"g");return(l.match(d)||[]).length+u}else return u}catch(o){return H.catch("Error in utils getSelectedTextOccurrenceInRange: ",o),0}},nl=n=>{try{return n&&typeof n=="string"?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):n}catch(e){return H.catch("Error in utils escapeRegExp: ",e),n}},Y7=n=>{try{return n==null?null:n.scrollHeight>n.clientHeight?n:Y7(n?.parentNode)}catch(e){return H.catch("Error in utils getScrollableParent: ",e),null}},UT=n=>{try{return n==null?[]:n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth?[n,...UT(n?.parentNode)]:UT(n?.parentNode)}catch(e){return H.catch("Error in utils getScrollableParents: ",e),[]}};function GOe(n){try{if(!n)return[];let e=UT(n),r=n;for(;r;){let t=r.getRootNode();if(t instanceof ShadowRoot)e.push(...UT(t.host)),r=t.host;else break}return e}catch(e){return H.catch("Error in utils getScrollableParentsCrossingShadowBoundary: ",e),[]}}var $Oe=(n,e)=>{try{if(n&&e){let r=n.getBoundingClientRect(),t=e.getBoundingClientRect(),i=r.top-t.top+(e.tagName?.toLowerCase()==="html"?0:e.scrollTop),o=r.left-t.left;return{top:i,left:o}}else return null}catch(r){return H.catch("Error in utils getRelativeTopLeftPosition: ",r),null}},MV=(n,e)=>`${_r(n+"_"+e)}`,Rg=n=>{try{let e=OT(n),r=new bt(!1);return e&&Object.assign(r,e),r.url=e?.url??window.location.href,r.path=e?.path??window.location.pathname,r.queryParams=e?.queryParams??window.location.search,r.baseUrl=e?.baseUrl??window.location.origin,r.title=e?.title??document.title,r}catch(e){H.catch("Error in utils getPageInfo: ",e);return}},Q7=n=>{try{return n?n?.hasAttribute&&n?.hasAttribute(v.ATTRIBUTES.VELT_COMMENT_DISABLED)?!0:Q7(n?.parentElement):!1}catch(e){return H.catch("Error in utils isCommentDisabledOnElement: ",e),!1}},X7=n=>{try{return n?n?.hasAttribute&&n?.hasAttribute(v.ATTRIBUTES.VELT_TAG_DISABLED)?!0:X7(n?.parentElement):!1}catch(e){return H.catch("Error in utils isTagDisabledOnElement: ",e),!1}},J7=n=>{try{return n?n?.hasAttribute&&n?.hasAttribute(v.ATTRIBUTES.VELT_ARROW_DISABLED)?!0:J7(n?.parentElement):!1}catch(e){return H.catch("Error in utils isArrowDisabledOnElement: ",e),!1}},Z7=n=>{try{return n?n?.hasAttribute&&n?.hasAttribute(v.ATTRIBUTES.VELT_AREA_DISABLED)?!0:Z7(n?.parentElement):!1}catch(e){return H.catch("Error in utils isAreaDisabledOnElement: ",e),!1}},eQ=n=>{try{return n?n?.hasAttribute&&n?.hasAttribute(v.ATTRIBUTES.VELT_RECORDER_DISABLED)?!0:eQ(n?.parentElement):!1}catch(e){return H.catch("Error in utils isRecorderDisabledOnElement: ",e),!1}};var $r=()=>{try{return window?.Snippyly?.version}catch(n){return H.catch("Error in utils getSdkVersion: ",n),null}},$T=n=>{try{return Object.fromEntries(Object.entries(n).filter(([e,r])=>r!==void 0))}catch(e){return H.catch("Error in utils removeUndefinedKeys: ",e),n}},jT=n=>{try{let e=new URL(n);return Object.values(v.URL_PARAMS).forEach(r=>{e.searchParams.delete(r)}),e.href}catch(e){return H.catch("Error in utils excludeSnippylyParamsFromUrl: ",e),n}},jOe=n=>{try{navigator.clipboard.writeText(n)}catch(e){H.catch("Error in copyToClipboard: ",e)}},DC=n=>{try{let e=PV(n);return e&&typeof e=="string"&&e.includes("/svg")&&(e=e.split("/svg")[0]+"/*[name()='svg']"),e}catch(e){H.catch("Error in utils getXPath:",e)}},PV=n=>{try{if(n){if(typeof n=="string")return document.evaluate(n,document,null,0,null);if(!n||n.nodeType!=1)return"";if(n.id&&n?.tagName?.toLowerCase()!=="svg"&&document.querySelectorAll(`[id='${n.id}']`)?.length===1)return"//*[@id='"+n.id+"']";let e=[].filter.call(n.parentNode?.children?n.parentNode?.children:[],function(r){return r.tagName==n.tagName});return PV(n.parentNode)+"/"+n.tagName.toLowerCase()+(e.length>1?"["+([].indexOf.call(e,n)+1)+"]":"")}}catch(e){H.catch("Error in utils calculateXPath:",e)}},HOe=n=>{try{let e=[];return n.forEach(r=>{let t={};t.commonAncestorContainer=tQ(r.commonAncestorContainer),t.text=r.toString(),t.occurrence=NC(r.commonAncestorContainer,0,r.startContainer,r.startOffset,r.toString())+1,e.push(t)}),e}catch{return[]}},tQ=n=>{try{if(n.nodeType===Node.TEXT_NODE){let e=1,r=n.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&e++,r=r.previousSibling;return DC(n.parentElement)}else return DC(n)}catch(e){return H.catch("Error in utils getXPathForText: ",e),DC(n)}},nQ=(n,e)=>{try{return n?n?.hasAttribute&&(e&&n.hasAttribute("contenteditable")||n?.getAttribute(v.ATTRIBUTES.VELT_LIVE_SELECTION_ENABLED)==="true")?n:nQ(n?.parentElement,e):null}catch(r){return H.catch("Error in utils getSelectionEnabledElement: ",r),null}},WOe=n=>{try{let e,r=[],t=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);for(;e=t.nextNode();)r.push(e);return r}catch(e){return H.catch("Error in utils getTextNodesInsideElement: ",e),[]}},zOe=n=>{try{return n<576||n>=576&&n<767?"Mobile":n>=768&&n<992?"Tablet":n>=992&&n<1520?"Desktop":"Monitor"}catch(e){return H.catch("Error in utils getDeviceTypeFromDeviceWidth: ",e),""}},xV=n=>new Promise(e=>setTimeout(e,n)),qOe=(n,e=0)=>new Promise((r,t)=>{let i=document.createElement("video"),o=navigator.userAgent.includes("Firefox");o&&(i.preload="auto"),i.setAttribute("src",URL.createObjectURL(n)),i.load(),i.addEventListener("error",s=>{t("error when loading video file: "+s)}),i.addEventListener("loadedmetadata",()=>{let s=()=>{if(i.duration<e){t("video is too short.");return}setTimeout(()=>{i.currentTime=e},200),i.addEventListener("seeked",()=>{let a=document.createElement("canvas");a.width=i.videoWidth,a.height=i.videoHeight;let c=a.getContext("2d");c.drawImage(i,0,0,a.width,a.height),c.canvas.toBlob(l=>{i.remove(),r(l)},"image/jpeg",.75)})};if(o&&i.duration>0&&i.duration<10&&n.size>1e6){setTimeout(()=>{i.duration<e&&(e=Math.max(.1,i.duration/2)),s()},1e3);return}s()})}),KOe=n=>{try{return new Promise((e,r)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.readAsDataURL(n)})}catch(e){return H.catch("Error in utils blobToBase64: ",e),Promise.resolve("")}},YOe=(n,e="image/jpeg")=>{try{let r=atob(n.split(",")[1]),t=new ArrayBuffer(r.length),i=new Uint8Array(t);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return new Blob([t],{type:e})}catch(r){return H.catch("Error in utils base64ToBlob: ",r),null}},QOe=(n,e,r=20)=>new Promise((t,i)=>{let o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{let s=o.width,a=o.height,c=600,l=a/s*c,u="http://www.w3.org/2000/svg",d=document.createElementNS(u,"svg");d.setAttribute("xmlns",u),d.setAttribute("width",c.toString()),d.setAttribute("height",l.toString()),d.setAttribute("viewBox",`0 0 ${c} ${l}`);let f=document.createElementNS(u,"circle"),g=document.createElementNS(u,"polygon"),p=16,_=p+16,T=c/2,S=l/2;if(f.setAttribute("cx",T.toString()),f.setAttribute("cy",S.toString()),f.setAttribute("r",_.toString()),f.setAttribute("fill","lightgrey"),g.setAttribute("points",`${T-p/2},${S-p} ${T-p/2},${S+p} ${T+p},${S}`),g.setAttribute("fill","#ffffff"),d.appendChild(f),d.appendChild(g),e){let A=e.length*16-10,D=16*1.5,C=(c-A)/2,O=l-D-10,M=document.createElementNS(u,"rect");M.setAttribute("x",C.toString()),M.setAttribute("y",O.toString()),M.setAttribute("width",A.toString()),M.setAttribute("height",D.toString()),M.setAttribute("fill","#353945b3"),M.setAttribute("rx","12"),d.appendChild(M);let F=document.createElementNS(u,"text");F.textContent=e,F.setAttribute("x",(c/2).toString()),F.setAttribute("y",(O+16).toString()),F.setAttribute("font-size","16"),F.setAttribute("text-anchor","middle"),F.setAttribute("fill","white"),d.appendChild(F)}let b=new XMLSerializer().serializeToString(d),B=new Image,x=new Blob([b],{type:"image/svg+xml;charset=utf-8"}),U=URL.createObjectURL(x);B.onload=()=>{let $=document.createElement("canvas");$.width=c,$.height=l;let A=$.getContext("2d");A.beginPath(),A.moveTo(r,0),A.lineTo(c-r,0),A.quadraticCurveTo(c,0,c,r),A.lineTo(c,l-r),A.quadraticCurveTo(c,l,c-r,l),A.lineTo(r,l),A.quadraticCurveTo(0,l,0,l-r),A.lineTo(0,r),A.quadraticCurveTo(0,0,r,0),A.closePath(),A.clip(),A.drawImage(o,0,0,c,l),A.drawImage(B,0,0,c,l);let D=$.toDataURL("image/png");t(D)},B.onerror=i,B.src=U},o.onerror=i,o.src=n});var XOe=n=>{try{return n?.replace(/[\n\t\u200D]/g,"")?.split(/\s+/)?.filter(t=>t?.trim()?.length)||[]}catch(e){return H.catch("Error in utils getWords: ",e),[]}},JOe=(n,e=[])=>{try{let r=e.map(t=>`[${t}="${n}"]`).join(",");return document.querySelector(r)}catch(r){return H.catch("Error in utils getElementByAttributes: ",r),null}},ZOe=(n,e=[])=>{try{let r=e.map(t=>`[${t}="${n}"]`).join(",");return document.querySelectorAll(r)}catch(r){return H.catch("Error in utils getElementsByAttributes: ",r),[]}},kT=n=>{try{let e=Math.floor(n/3600),r=Math.floor((n-e*3600)/60),t=Math.floor(n-e*3600-r*60);return e&&e<10&&(e="0"+e),r<10&&(r="0"+r),t<10&&(t="0"+t),(e?e+":":"")+r+":"+t}catch{return""}},rQ=10,ewe=n=>{try{if(typeof n!="number"||!isFinite(n))return 0;let e=1e3/rQ;return Math.round(n*e)/e}catch{return n}},twe=n=>{try{if(!n||typeof n!="object")return;let e={videoPlayerId:n.videoPlayerId,currentMediaPosition:n.currentMediaPosition,locationName:n.locationName};return n.version?.id&&n.version?.name&&(e.version={id:n.version.id,name:n.version.name}),e}catch{return}},nwe=(n,e=10)=>{try{if(!n||!n.currentTime)throw new Error("Invalid video element reference provided");let r=n.currentTime,t=Math.floor(r/e)*e,i=t+e;return{startSlot:kT(t),endSlot:kT(i),timeSlot:kT(t)+" - "+kT(i)}}catch{return null}},rwe=(n,e=["@"])=>{try{let r="",t,i=n.getRootNode();if(i instanceof ShadowRoot?t=i?.getSelection():t=window.getSelection(),t?.rangeCount){let o=t.getRangeAt(0),s=o.startOffset,a=o.endOffset,c=o?.commonAncestorContainer?.textContent;c?r=iQ(c,a,e):r=""}return r}catch(r){return H.catch("Error in utils getWordAtCursor: ",r),""}};var iQ=(n,e,r=["@"])=>{try{let t=-1,i=!1;for(let o of r){let s=n.lastIndexOf(o,e),a=s>0?n.lastIndexOf(o,s-1):-1;if(s>t){let c=VT(n,s,e),l=BT(n,s,e);if(c||l){if(a!==-1){let u=VT(n,a,s),d=BT(n,a,s);!u&&!d&&(t=a,i=!0)}}else t=s,i=!0}}return t!==-1&&i?n.substring(t,e):""}catch(t){return H.catch("Error in utils getStringFromLastAtSymbol: ",t),""}},VT=(n,e,r)=>{try{if(e===0)return!1;let t=n.charAt(e-1);return!(t===" "||t==="\xA0"||t===`
124
+ `||t===" "||[",",":",";"].includes(t))}catch(t){return H.catch("Error in utils isHotkeyDisabledForAutocomplete: ",t),!1}},BT=(n,e,r)=>{try{return!!n.substring(e+1,r).startsWith(" ")}catch(t){return H.catch("Error in utils isHotkeyFollowedBySpace: ",t),!1}},iwe=(n,e,r=["@"])=>{try{let t=oQ(n),i=null;try{t&&typeof t.getSelection=="function"&&(i=t.getSelection())}catch{}if(i||(i=window.getSelection()),i?.rangeCount){let o=i.getRangeAt(0),s=o.startOffset,a=o?.commonAncestorContainer?.textContent;if(a){let c=-1;for(let l of r){let u=a.lastIndexOf(l,s),d=u>0?a.lastIndexOf(l,u-1):-1;if(u>c){let f=VT(a,u,s),g=BT(a,u,s);if(f||g){if(d!==-1){let p=VT(a,d,u),_=BT(a,d,u);!p&&!_&&(c=d)}}else c=u}}if(c!==-1){let l=a.substring(0,c),u=a.substring(o.endOffset),d=document.createElement("span");d.textContent=e,d.style.color="var(--velt-accent)";let f=e.startsWith("@")?e.substring(1):e;d.classList.add("velt-mention"),d.classList.add(f.includes("@")?"velt-mention--email":"velt-mention--name");let g=Date.now()+"_"+Math.random().toString(36).substr(2,9);d.setAttribute("data-recently-added",g),setTimeout(()=>{d.hasAttribute("data-recently-added")&&d.removeAttribute("data-recently-added")},5e3);let p=o.commonAncestorContainer;if(p.nodeType===Node.TEXT_NODE){let _=p.parentNode;if(_){let T=document.createTextNode(l),S=document.createTextNode(u);_.replaceChild(S,p),_.insertBefore(d,S),_.insertBefore(T,d);try{let b=document.createRange();b.setStartAfter(d),b.collapse(!0),i?.removeAllRanges(),i?.addRange(b)}catch(b){H.catch("Error positioning cursor after span:",b);try{let B=document.createRange();B.selectNodeContents(n),B.collapse(!1),i?.removeAllRanges(),i?.addRange(B)}catch(B){H.catch("Error with fallback cursor positioning:",B)}}}}}}}}catch(t){H.catch("Error in utils replaceWordAtCursor: ",t)}},owe=()=>{try{let e=window.getSelection()?.getRangeAt(0),r=e?.commonAncestorContainer,t=e?.startContainer,i=e?.endContainer,o=[];o.push(r),o.push(t),o.push(i);let s=!1;for(let a of o)if(a&&wo(a,[v.TAGS.SNIPPYLY_TEXT_HIGHLIGHT,v.TAGS.SNIPPYLY_COMMENT_TEXT_PORTAL,v.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT,v.TAGS.SNIPPYLY_COMMENT_TEXT])){s=!0;break}return s}catch(n){return H.catch("Error in utils isTextSelectionIncludesSnippylyElement: ",n),!1}},FV=(n,e,r)=>{try{let t=document.querySelector(`[id=${n}]`);if(t)t.name=e,t.content=r;else{let i=document.createElement("meta");i.id=n,i.name=e,i.content=r,document.getElementsByTagName("head")[0].appendChild(i)}}catch{}},kV=n=>{try{if(n){let e=document.querySelector(`[id=${n}]`);e&&e.remove()}}catch{}},UV=()=>{try{let e=new Date().getTimezoneOffset(),r=Math.floor(Math.abs(e)/60),t=Math.abs(e)%60;return`UTC${e>0?"-":"+"}${r?.toString()?.padStart(2,"0")}:${t?.toString()?.padStart(2,"0")}`}catch(n){return H.catch("Error in utils getTimezone: ",n),""}},swe=()=>{try{let n=[];return document.querySelectorAll("*").forEach(r=>{(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth||["auto","scroll"].includes(getComputedStyle(r).overflow))&&n.push(r)}),n}catch(n){return H.catch("Error in utils getScrollableElements: ",n),[]}},VV=(n,e)=>Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2),awe=(n,e={x:window.innerWidth/2,y:window.innerHeight/2})=>{try{let r=n;for(;r.children.length>0;){let t=null,i=Number.MAX_SAFE_INTEGER;for(let o=0;o<r.children.length;o++){let s=r.children[o],a=s.getBoundingClientRect(),c={x:a.left+a.width/2,y:a.top+a.height/2},l=VV(c,e);(a.top>=0||a.bottom<=window.innerHeight)&&a.width>0&&a.height>0&&l<=i&&(t=s,i=l)}if(t===null)break;r=t}return r}catch(r){return H.catch("Error in utils getInnermostElement: ",r),null}},cwe=n=>{try{let{offsetWidth:e,offsetHeight:r,scrollTop:t}=n,i=n,o={x:e/2,y:t+r/2};for(;i.children.length>0;){let s=null,a=Number.MAX_SAFE_INTEGER;for(let c=0;c<i.children.length;c++){let l=i.children[c],u={x:l.offsetLeft+l.offsetWidth/2,y:l.offsetTop+l.offsetHeight/2},d=VV(u,o);l.offsetTop>=0&&l.offsetWidth>0&&l.offsetHeight>0&&d<=a&&(s=l,a=d)}if(s===null)break;i=s}return i}catch(e){return H.catch("Error in utils getNestedInnermostElement: ",e),null}},lwe=()=>{try{let n=window.innerWidth/2,e=window.innerHeight/2,r=document.elementFromPoint(n,e);for(;r&&r.tagName==="BODY";)e+=2,r=document.elementFromPoint(n,e);return r}catch(n){return H.catch("Error in utils getCenteredBackgroundElement: ",n),null}},uwe=(n,e,r=!1)=>{try{let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),o=e.offsetTop;r&&(o=o-t.height/2+i.height/2),n.scrollTo({top:o,behavior:"smooth"})}catch(t){H.catch("Error in utils nestedScrollIntoView: ",t)}},dwe=(n,e=!0)=>{try{let r=document.body.getBoundingClientRect(),t=n.getBoundingClientRect(),i=t.top-r.top,o=window.innerHeight,s=i;e&&(s=s-o/2+t.height/2),window.scrollTo({top:s,behavior:"smooth"})}catch(r){H.catch("Error in utils scrollIntoView: ",r)}},hwe=(n=!1)=>{try{let e=!0;return n&&(e=/\sChrome\/[\d.]+ Mobile\s/.test(navigator.userAgent)),"ontouchstart"in window||navigator.maxTouchPoints>0||e}catch(e){return H.catch("Error in utils isTouchDevice: ",e),!1}},fwe=(n,e,r)=>{try{return(1-r)*n+r*e}catch(t){H.catch("Error in utils lerp: ",t)}return 0},gwe=(n,e)=>{try{if(n===void 0)return n;if(n=n.replace("#",""),n.length===6){let r=parseInt(n,16),t=(r>>16)+e;t>255&&(t=255),t<0&&(t=0);let i=(r&255)+e;i>255&&(i=255),i<0&&(i=0);let o=(r>>8&255)+e;return o>255&&(o=255),o<0&&(o=0),`#${(i|o<<8|t<<16).toString(16)}`}else return n}catch(r){H.catch("Error in utils multiplyColor: ",r)}return n},mwe=n=>{try{return n in v.TEXT_COLOR_MAP?v.TEXT_COLOR_MAP[n]:"#141416"}catch(e){return H.catch("Error in generateUserColor:",e),"#141416"}},pwe=()=>{try{let n=localStorage.getItem(v.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS);if(n)return JSON.parse(n)}catch(n){return H.catch("Error in getDefaultMediaStreamOptions:",n),{}}},Ewe=(n,e)=>{try{let r=e*(Math.PI/180),t=Math.cos(r);return t?n/t:n}catch(r){return H.catch("Error in calculateHypotenuse:",r),0}},_we=(n,e,r=!0)=>{try{let t=[],i=r?n:n.parentNode;for(;i;)t.push(i),i=i.parentNode;let o=r?e:e.parentNode;for(;o;){if(t.indexOf(o)!==-1)return o;o=o.parentNode}return null}catch(t){return H.catch("Error in utils findCommonParent: ",t),null}},Twe=(n,e,r,t,i=!1)=>{try{let o,s;if(i){let a=r,c=t;if(a===c)o=n,s=e;else{let l=0,u=0,d=a;for(;d&&d!==c;)l+=d.offsetLeft,u+=d.offsetTop,d=d.parentElement;o=l+n,s=u+e}}else{let a=r.getBoundingClientRect(),c=t.getBoundingClientRect(),l=a.left+n,u=a.top+e;o=l-c.left,s=u-c.top}return{x:o,y:s}}catch(o){return H.catch("Error in utils calculateParentCoordinates: ",o),{x:n,y:e}}},Iwe=n=>{try{let e={height:0,width:0};if(typeof n?.getBBox=="function"){let r=n?.getBBox(),t=n?.getBoundingClientRect();e.height=parseFloat(t?.height||r.height||0),e.width=parseFloat(t?.width||r.width||0)}else{let r=window.getComputedStyle(n);if(e.height=n?.clientHeight||parseFloat(r.getPropertyValue("height"))||0,e.width=n?.clientWidth||parseFloat(r.getPropertyValue("width"))||0,n?.getBoundingClientRect&&typeof n?.getBoundingClientRect=="function"){let t=n?.getBoundingClientRect();e?.height||(e.height=t?.height||n?.clientHeight||n?.offsetHeight||0),e?.width||(e.width=t?.width||n?.clientWidth||n?.offsetWidth||0)}}return e}catch(e){return H.catch("Error in utils getElementDimensions: ",e),{height:0,width:0}}},vwe=n=>{try{let e=n;for(;e;){if(window?.getComputedStyle(e)?.getPropertyValue("background-clip")=="text")return!0;e=e?.parentElement}return!1}catch(e){return H.catch("Error in utils hasParentWithBackgroundClip: ",e),!1}},oQ=n=>{try{let e=n;for(;e;){if(e.toString()==="[object ShadowRoot]")return e;e=e.parentNode}}catch(e){H.catch("Error in utils findShadowRoot: ",e)}return null},ywe=n=>{try{let e=["attachment","attachments","chunkUrls","transcription","color","position","positionX","positionY","resolved","inProgress","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","taggedElementPath","taggedElementRect","targetElement","documentParamsId","documentParams","ghostComment","areaAnnotationId","iam","commentSource"],r=JSON.parse(JSON.stringify(n)),t={};return Object.keys(r).forEach(i=>{e.includes(i)||(t[i]=r[i])}),JSON.parse(JSON.stringify(t))}catch(e){return H.catch("Error in utils getRecorderAnnotationForClient: ",e),null}},Swe=n=>n===null||typeof n>"u",Awe=(n,e)=>{try{return!!n?.closest(`[${e}]`)}catch(r){return H.catch("Error in utils hasParentWithAttribute: ",r),!1}},sQ=(n,e=!0)=>{try{let r=[];if(!n||!(n instanceof HTMLElement))return[];e&&r.push(n);for(let t=0;t<n.children.length;t++){let i=n.children[t];r=r.concat(sQ(i))}return r}catch(r){return H.catch("Error in utils getAllNestedChildren: ",r),[]}},Dwe=()=>{try{return document.visibilityState==="hidden"?!1:document.hasFocus()}catch(n){return H.catch("Error in utils isTabActive: ",n),!1}},Rwe=n=>{try{let e="",r=n?.getAttribute("src");if(r)e=`${_r(r)}`;else{let t=n?.querySelectorAll("source");if(t&&t.length>0){let o=t[0]?.getAttribute("src");o&&(e=`${_r(o)}`)}}return e}catch{return""}},Cwe=n=>{try{return!(n&&(n?.children?.length>0||n?.textContent?.trim()?.length>0))}catch(e){return H.catch("Error in utils isTemplateEmpty: ",e),!0}},DV=(n,e)=>{try{if(!n||!e)return;let r=[],t="",i=0;for(let c=0;c<e.length;c++){let l=e[c];l==="["?(i++,i===1&&t&&(r.push(t),t=""),t+=l):l==="]"?(i--,t+=l,i===0&&(r.push(t),t="")):l==="."&&i===0?t&&(r.push(t),t=""):t+=l}t&&r.push(t);let o,s=P({},n),a=r.reduce((c,l)=>{if(c==null)return;_o(c)&&(o=c,c=c());let u=l.match(/^\[([^\[\]]+|(\[[^\[\]]*\]))\]$/);if(u){let f=u[1];if(/^\d+$/.test(f)){let g=parseInt(f,10);return Array.isArray(c)?c[g]:void 0}if(f.startsWith("'")&&f.endsWith("'")||f.startsWith('"')&&f.endsWith('"')){let g=f.slice(1,-1);return c[g]}if(f.includes(".")||f.includes("[")){let g=DV(s,f);_o(g)&&(g=g());let p=g?.toString()||"";return c[p]}if(s[f]!==void 0){let g=s[f];return _o(g)&&(g=g()),c[g]}return c[f]}let d=l;return(l.startsWith("'")&&l.endsWith("'")||l.startsWith('"')&&l.endsWith('"'))&&(d=l.slice(1,-1)),d==="length"&&Array.isArray(c)?c.length:c[d]},n);return o?rg(()=>{try{let c=P({},n);return r.reduce((l,u)=>{if(l==null)return;_o(l)&&(l=l());let d=u.match(/^\[([^\[\]]+|(\[[^\[\]]*\]))\]$/);if(d){let g=d[1];if(/^\d+$/.test(g)){let p=parseInt(g,10);return Array.isArray(l)?l[p]:void 0}if(g.startsWith("'")&&g.endsWith("'")||g.startsWith('"')&&g.endsWith('"')){let p=g.slice(1,-1);return l[p]}if(g.includes(".")||g.includes("[")){let p=DV(c,g);_o(p)&&(p=p());let _=p?.toString()||"";return l[_]}if(c[g]!==void 0){let p=c[g];return _o(p)&&(p=p()),l[p]}return l[g]}let f=u;return(u.startsWith("'")&&u.endsWith("'")||u.startsWith('"')&&u.endsWith('"'))&&(f=u.slice(1,-1)),l[f]},n)}catch{return""}}):a}catch{return""}},Nwe=(n,e)=>{try{return!!(n?.locationId&&(n.locationId===e?.locationId||e?.location?.id===String(n.locationId))||n?.location?.id&&(n.location.id===e?.location?.id||n.location.id===String(e?.locationId)))}catch(r){return H.catch("Error in utils isLocationSame: ",r),!1}},Owe=()=>{try{let n=document.activeElement,e=new Set,r=10,t=0;for(;n&&n.shadowRoot&&!(e.has(n)||(e.add(n),n=n.shadowRoot.activeElement,t++,t>r)););return n}catch(n){return H.catch("Error in utils getActiveElement: ",n),null}},Ft=(n,e)=>{try{return typeof n=="object"&&typeof e=="object"?JSON.stringify(n)===JSON.stringify(e):n===e}catch{return!1}},Cn=(n,e=0)=>{try{let r=JSON.parse(JSON.stringify(n));return n?.clientDocumentId&&(r.documentId=n.clientDocumentId),n?.clientOrganizationId&&(r.organizationId=n.clientOrganizationId),n?.documentMetadata&&e<5&&(r.documentMetadata=Cn(n.documentMetadata,e+1)),delete r?.clientDocumentId,delete r?.clientOrganizationId,delete r?.veltFolderId,delete r?.parentVeltFolderId,delete r?.pageInfo,r}catch{return n}},wwe=n=>{try{if(!n.some(s=>s?.value?.data))return{};let e=null,r=n.reduce((s,a)=>Math.max(s,a.timestamp),0),t=n.find(s=>s.timestamp===r);if(!t)return{};t?.value?.operation?.type==="removed"&&(e=t?.value?.operation);let o=n.map(s=>s.value).reduce((s,a)=>({data:P(P({},s?.data??{}),a?.data??{})}),{});return o.operation=e,o}catch{return{}}},kt=(n,e,r)=>I(null,null,function*(){try{let t=0;for(;t<=(r.retryCount||0);)try{let i=yield n();if(!i)return{success:!1,statusCode:400,message:`${e} failed: No response received`};if(i.statusCode===void 0)return{success:!1,statusCode:400,message:`${e} failed: Response missing statusCode`};if(i.statusCode!==200){if(t++,t>(r.retryCount||0))return{success:!1,statusCode:i.statusCode,message:`${e} failed after ${t} attempts with status code ${i.statusCode}`};r.retryDelay&&(yield new Promise(o=>setTimeout(o,r.retryDelay)));continue}return i}catch(i){if(t++,t>(r.retryCount||0))return{success:!1,statusCode:500,message:`${e} failed with error: ${i instanceof Error?i.message:"Unknown error"}`};r.retryDelay&&(yield new Promise(o=>setTimeout(o,r.retryDelay)))}return{success:!1,statusCode:500,message:`${e} failed: Maximum retry attempts exceeded`}}catch(t){return{success:!1,statusCode:500,message:`${e} failed with unexpected error: ${t instanceof Error?t.message:"Unknown error"}`}}}),Ht=(n,e,r,t)=>I(null,null,function*(){try{let o=P(P({},{"Content-Type":"application/json"}),e||{}),s=yield fetch(n,{method:"POST",headers:o,body:JSON.stringify(r)});if(!s.ok)return H.catch(`Error in makeConfigBasedRequest: ${s.status} ${s.statusText}`),t?{data:{},success:!1,statusCode:s.status}:{success:!1,statusCode:s.status};let a=yield s.json();return t?{data:a?.data??{},success:!0,statusCode:200}:{success:!0,statusCode:200}}catch(i){return H.catch("Error in makeConfigBasedRequest:",i),t?{data:{},success:!1,statusCode:500}:{success:!1,statusCode:500}}}),BV=n=>{try{return!n||!n?.access?[]:Object.keys(n.access).sort().map(i=>n.access?.[i]?.map(o=>`${i}:${o}`)??[]).reduce((i,o)=>i.flatMap(s=>o.map(a=>[...s,a])),[[]]).map(i=>i.join("_"))}catch(e){return H.catch("Error in utils generateProcessedContext: ",e),[]}},bwe=n=>{try{if(!n||!n?.access)return[];let e=Object.keys(n.access).sort(),t=(o=>{let s=[],a=Math.pow(2,o.length);for(let c=1;c<a;c++){let l=[];for(let u=0;u<o.length;u++)c&1<<u&&l.push(o[u]);s.push(l)}return s})(e),i=[];for(let o of t){let s=o.map(a=>{let c=n.access?.[a];return c==null?null:`${a}:${c}`}).filter(a=>a!==null);s.length>0&&i.push(s.join("_"))}return[...new Set(i)]}catch(e){return H.catch("Error in utils generateAllContextCombos: ",e),[]}},GV=({input:n})=>{try{if(!n||!n?.access)return[];let e=n?.access,r=Object.keys(e).sort(),t=[];for(let o of r){let s=e[o];s!=null&&Array.isArray(s)&&s.length>0&&t.push({key:o,values:s})}return t.length===0?[]:t.reduce((o,{key:s,values:a})=>o.length===0?a.map(c=>[{key:s,value:c}]):o.flatMap(c=>a.map(l=>[...c,{key:s,value:l}])),[]).map(o=>{let s={};return o.forEach(({key:a,value:c})=>{s[a]=c}),{access:s}})}catch(e){return H.catch("Error in utils expandContextArraysToSingleValues: ",e),[]}},$V=({input:n})=>{try{if(!n||n.length===0)return{access:{}};let e=new Set;n.forEach(t=>{t?.access&&Object.keys(t.access).forEach(i=>e.add(i))});let r={};for(let t of Array.from(e).sort()){let i=new Set;n.forEach(o=>{if(o?.access){let s=o.access[t];s!=null&&i.add(s)}}),r[t]=i.size>0?Array.from(i).sort():null}return{access:r}}catch(e){return H.catch("Error in utils combineContextsToArrays: ",e),{access:{}}}},Sd=i=>I(null,[i],function*({data:n,getSdkProxy:e,userId:r,methodName:t}){try{let o="sdkproxyencryptionanddecryptiononsdk"+(r??""),s=yield aQ({data:n,key:o}),a=(yield e({veltData:s}))?.data?.data?.veltData||{};return yield CC(a,o)}catch(o){return H.catch("Error in utils sdkProxyEncryptDecrypt: "+(t??""),o),n}}),aQ=r=>I(null,[r],function*({data:n,key:e}){try{return yield rl(n,e)}catch{return n}}),OC=(n,e)=>I(null,null,function*(){try{let r=0;for(;r<=(e.retryCount||0);)try{let t=yield n();if(!t)throw new Error("No response received");return t}catch{if(r++,r>=(e.retryCount||0))return null;e.retryDelay&&(yield new Promise(i=>setTimeout(i,e.retryDelay)))}return null}catch{return null}}),wC=n=>{try{if(n&&typeof n=="object"){let e=JSON.parse(JSON.stringify(n));return e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.userSnippylyId&&delete e.userSnippylyId,delete e?.email_lowercase,delete e?.name_lowercase,e}else return null}catch(e){return H.catch("Error in utils getUserForClient: ",e),null}},Tr=({url:n,apiProxyDomain:e})=>{try{if(e){let r=new URL(n);r.origin&&(n=n.replace(r.origin,e))}return n}catch(r){return H.catch("Error in utils getResolvedApiUrl: ",r),n}},Lwe=(n,e)=>{try{if(!n||!(n instanceof Element))return!1;let r,t;if(e&&typeof e.x=="number"&&typeof e.y=="number")r=e.x,t=e.y;else{let o=n.getBoundingClientRect();r=o.left+o.width/2,t=o.top+o.height/2}let i=document.elementFromPoint(r,t);return!(!i||i===n||n.contains(i))}catch{return!1}};function RV(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return n;let r={};for(let t of e)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t]);return r}function CV(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}function vd(n,e){switch(e.kind){case"type":return RV(n,e.safeKeys);case"array":return Array.isArray(n)?n.map(r=>vd(r,e.item)):n;case"record":{if(!CV(n))return n;let r={};for(let t of Object.keys(n))r[t]=vd(n[t],e.value);return r}case"object":{if(!CV(n))return n;let r=e.selfKeys?RV(n,e.selfKeys):P({},n);for(let t of Object.keys(e.fields))Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=vd(r[t],e.fields[t]));return r}default:return n}}var Er={kind:"type",safeKeys:EV},cQ={kind:"type",safeKeys:_V},lQ={kind:"type",safeKeys:vV},uQ={kind:"type",safeKeys:IV},Ag={kind:"type",safeKeys:TV};function dQ(n){return{kind:"object",selfKeys:gV,fields:{from:Er,to:{kind:"array",item:Er},attachments:{kind:"array",item:n},recorders:{kind:"array",item:lQ},taggedUserContacts:{kind:"array",item:{kind:"object",fields:{contact:Er}}}}}}function jV(n){return{kind:"object",selfKeys:fV,fields:{from:Er,assignedTo:Er,resolvedByUser:Er,viewedBy:{kind:"array",item:Er},subscribedUsers:{kind:"record",value:{kind:"object",fields:{user:Er}}},unsubscribedUsers:{kind:"record",value:{kind:"object",fields:{user:Er}}},suggestion:{kind:"object",fields:{resolvedBy:Er}},targetTextRange:cQ,comments:{kind:"array",item:dQ(n)}}}}var hQ=jV(uQ),fQ=jV(Ag),gQ={kind:"object",selfKeys:mV,fields:{from:Er,reactions:{kind:"array",item:{kind:"object",fields:{from:Er}}}}},mQ={kind:"object",selfKeys:pV,fields:{from:Er,attachment:Ag,attachments:{kind:"array",item:Ag},recordingEditVersions:{kind:"record",value:{kind:"object",fields:{from:Er,attachment:Ag,attachments:{kind:"array",item:Ag}}}}}};function HV(n,e){let r=e?.stripAttachmentFiles?hQ:fQ;return vd(n,r)}function WV(n){return vd(n,gQ)}function zV(n){return vd(n,mQ)}var qV=()=>{};var LC={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};var ee=function(n,e){if(!n)throw il(e)},il=function(n){return new Error("Firebase Database ("+LC.SDK_VERSION+") INTERNAL ASSERT FAILED: "+n)};var QV=function(n){let e=[],r=0;for(let t=0;t<n.length;t++){let i=n.charCodeAt(t);i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&t+1<n.length&&(n.charCodeAt(t+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++t)&1023),e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128)}return e},pQ=function(n){let e=[],r=0,t=0;for(;r<n.length;){let i=n[r++];if(i<128)e[t++]=String.fromCharCode(i);else if(i>191&&i<224){let o=n[r++];e[t++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=n[r++],s=n[r++],a=n[r++],c=((i&7)<<18|(o&63)<<12|(s&63)<<6|a&63)-65536;e[t++]=String.fromCharCode(55296+(c>>10)),e[t++]=String.fromCharCode(56320+(c&1023))}else{let o=n[r++],s=n[r++];e[t++]=String.fromCharCode((i&15)<<12|(o&63)<<6|s&63)}}return e.join("")},Rd={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i<n.length;i+=3){let o=n[i],s=i+1<n.length,a=s?n[i+1]:0,c=i+2<n.length,l=c?n[i+2]:0,u=o>>2,d=(o&3)<<4|a>>4,f=(a&15)<<2|l>>6,g=l&63;c||(g=64,s||(f=64)),t.push(r[u],r[d],r[f],r[g])}return t.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(QV(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):pQ(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let r=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i<n.length;){let o=r[n.charAt(i++)],a=i<n.length?r[n.charAt(i)]:0;++i;let l=i<n.length?r[n.charAt(i)]:64;++i;let d=i<n.length?r[n.charAt(i)]:64;if(++i,o==null||a==null||l==null||d==null)throw new MC;let f=o<<2|a>>4;if(t.push(f),l!==64){let g=a<<4&240|l>>2;if(t.push(g),d!==64){let p=l<<6&192|d;t.push(p)}}}return t},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},MC=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},xC=function(n){let e=QV(n);return Rd.encodeByteArray(e,!0)},Ng=function(n){return xC(n).replace(/\./g,"")},Ad=function(n){try{return Rd.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function XV(n){return JV(void 0,n)}function JV(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:let r=e;return new Date(r.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(let r in e)!e.hasOwnProperty(r)||!EQ(r)||(n[r]=JV(n[r],e[r]));return n}function EQ(n){return n!=="__proto__"}function WT(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var _Q=()=>WT().__FIREBASE_DEFAULTS__,TQ=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},IQ=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Ad(n[1]);return e&&JSON.parse(e)},zT=()=>{try{return qV()||_Q()||TQ()||IQ()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},ZV=n=>{var e,r;return(r=(e=zT())===null||e===void 0?void 0:e.emulatorHosts)===null||r===void 0?void 0:r[n]},Cd=n=>{let e=ZV(n);if(!e)return;let r=e.lastIndexOf(":");if(r<=0||r+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let t=parseInt(e.substring(r+1),10);return e[0]==="["?[e.substring(1,r-1),t]:[e.substring(0,r),t]},FC=()=>{var n;return(n=zT())===null||n===void 0?void 0:n.config},eB=n=>{var e;return(e=zT())===null||e===void 0?void 0:e[`_${n}`]};var Nn=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}wrapCallback(e){return(r,t)=>{r?this.reject(r):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(r):e(r,t))}}};function jr(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}function da(n){return I(this,null,function*(){return(yield fetch(n,{credentials:"include"})).ok})}function qT(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let r={alg:"none",type:"JWT"},t=e||"demo-project",i=n.iat||0,o=n.sub||n.user_id;if(!o)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${t}`,aud:t,iat:i,exp:i+3600,auth_time:i,sub:o,user_id:o,firebase:{sign_in_provider:"custom",identities:{}}},n);return[Ng(JSON.stringify(r)),Ng(JSON.stringify(s)),""].join(".")}var Cg={};function vQ(){let n={prod:[],emulator:[]};for(let e of Object.keys(Cg))Cg[e]?n.emulator.push(e):n.prod.push(e);return n}function yQ(n){let e=document.getElementById(n),r=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),r=!0),{created:r,element:e}}var KV=!1;function ol(n,e){if(typeof window>"u"||typeof document>"u"||!jr(window.location.host)||Cg[n]===e||Cg[n]||KV)return;Cg[n]=e;function r(f){return`__firebase__banner__${f}`}let t="__firebase__banner",o=vQ().prod.length>0;function s(){let f=document.getElementById(t);f&&f.remove()}function a(f){f.style.display="flex",f.style.background="#7faaf0",f.style.position="fixed",f.style.bottom="5px",f.style.left="5px",f.style.padding=".5em",f.style.borderRadius="5px",f.style.alignItems="center"}function c(f,g){f.setAttribute("width","24"),f.setAttribute("id",g),f.setAttribute("height","24"),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("fill","none"),f.style.marginLeft="-6px"}function l(){let f=document.createElement("span");return f.style.cursor="pointer",f.style.marginLeft="16px",f.style.fontSize="24px",f.innerHTML=" &times;",f.onclick=()=>{KV=!0,s()},f}function u(f,g){f.setAttribute("id",g),f.innerText="Learn more",f.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",f.setAttribute("target","__blank"),f.style.paddingLeft="5px",f.style.textDecoration="underline"}function d(){let f=yQ(t),g=r("text"),p=document.getElementById(g)||document.createElement("span"),_=r("learnmore"),T=document.getElementById(_)||document.createElement("a"),S=r("preprendIcon"),b=document.getElementById(S)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(f.created){let B=f.element;a(B),u(T,_);let x=l();c(b,S),B.append(b,p,T,x),document.body.appendChild(B)}o?(p.innerText="Preview backend disconnected.",b.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
125
+ <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
126
+ </g>
127
+ <defs>
128
+ <clipPath id="clip0_6013_33858">
129
+ <rect width="24" height="24" fill="white"/>
130
+ </clipPath>
131
+ </defs>`):(b.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
132
+ <path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
133
+ </g>
134
+ <defs>
135
+ <clipPath id="clip0_6083_34804">
136
+ <rect width="24" height="24" fill="white"/>
137
+ </clipPath>
138
+ </defs>`,p.innerText="Preview backend running in this workspace."),p.setAttribute("id",g)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",d):d()}function En(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Og(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(En())}function tB(){var n;let e=(n=zT())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function nB(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function rB(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function KT(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function iB(){let n=En();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function bo(){return LC.NODE_CLIENT===!0||LC.NODE_ADMIN===!0}function kC(){return!tB()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function UC(){return!tB()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function Nd(){try{return typeof indexedDB=="object"}catch{return!1}}function oB(){return new Promise((n,e)=>{try{let r=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(t),n(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var o;e(((o=i.error)===null||o===void 0?void 0:o.message)||"")}}catch(r){e(r)}})}var SQ="FirebaseError",Ir=class n extends Error{constructor(e,r,t){super(r),this.code=e,this.customData=t,this.name=SQ,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ki.prototype.create)}},ki=class{constructor(e,r,t){this.service=e,this.serviceName=r,this.errors=t}create(e,...r){let t=r[0]||{},i=`${this.service}/${e}`,o=this.errors[e],s=o?AQ(o,t):"Error",a=`${this.serviceName}: ${s} (${i}).`;return new Ir(i,a,t)}};function AQ(n,e){return n.replace(DQ,(r,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var DQ=/\{\$([^}]+)}/g;function Dd(n){return JSON.parse(n)}function rn(n){return JSON.stringify(n)}var sB=function(n){let e={},r={},t={},i="";try{let o=n.split(".");e=Dd(Ad(o[0])||""),r=Dd(Ad(o[1])||""),i=o[2],t=r.d||{},delete r.d}catch{}return{header:e,claims:r,data:t,signature:i}};var aB=function(n){let e=sB(n),r=e.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},cB=function(n){let e=sB(n).claims;return typeof e=="object"&&e.admin===!0};function di(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function ha(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}function wg(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function bg(n,e,r){let t={};for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=e.call(r,n[i],i,n));return t}function Ui(n,e){if(n===e)return!0;let r=Object.keys(n),t=Object.keys(e);for(let i of r){if(!t.includes(i))return!1;let o=n[i],s=e[i];if(YV(o)&&YV(s)){if(!Ui(o,s))return!1}else if(o!==s)return!1}for(let i of t)if(!r.includes(i))return!1;return!0}function YV(n){return n!==null&&typeof n=="object"}function Lg(n){let e=[];for(let[r,t]of Object.entries(n))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(r)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}var HT=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,r){r||(r=0);let t=this.W_;if(typeof e=="string")for(let d=0;d<16;d++)t[d]=e.charCodeAt(r)<<24|e.charCodeAt(r+1)<<16|e.charCodeAt(r+2)<<8|e.charCodeAt(r+3),r+=4;else for(let d=0;d<16;d++)t[d]=e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3],r+=4;for(let d=16;d<80;d++){let f=t[d-3]^t[d-8]^t[d-14]^t[d-16];t[d]=(f<<1|f>>>31)&4294967295}let i=this.chain_[0],o=this.chain_[1],s=this.chain_[2],a=this.chain_[3],c=this.chain_[4],l,u;for(let d=0;d<80;d++){d<40?d<20?(l=a^o&(s^a),u=1518500249):(l=o^s^a,u=1859775393):d<60?(l=o&s|a&(o|s),u=2400959708):(l=o^s^a,u=3395469782);let f=(i<<5|i>>>27)+l+c+u+t[d]&4294967295;c=a,a=s,s=(o<<30|o>>>2)&4294967295,o=i,i=f}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+s&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(e,r){if(e==null)return;r===void 0&&(r=e.length);let t=r-this.blockSize,i=0,o=this.buf_,s=this.inbuf_;for(;i<r;){if(s===0)for(;i<=t;)this.compress_(e,i),i+=this.blockSize;if(typeof e=="string"){for(;i<r;)if(o[s]=e.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}else for(;i<r;)if(o[s]=e[i],++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}this.inbuf_=s,this.total_+=r}digest(){let e=[],r=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let i=this.blockSize-1;i>=56;i--)this.buf_[i]=r&255,r/=256;this.compress_(this.buf_);let t=0;for(let i=0;i<5;i++)for(let o=24;o>=0;o-=8)e[t]=this.chain_[i]>>o&255,++t;return e}};function lB(n,e){let r=new PC(n,e);return r.subscribe.bind(r)}var PC=class{constructor(e,r){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=r,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(r=>{r.next(e)})}error(e){this.forEachObserver(r=>{r.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,r,t){let i;if(e===void 0&&r===void 0&&t===void 0)throw new Error("Missing Observer.");RQ(e,["next","error","complete"])?i=e:i={next:e,error:r,complete:t},i.next===void 0&&(i.next=bC),i.error===void 0&&(i.error=bC),i.complete===void 0&&(i.complete=bC);let o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),o}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let r=0;r<this.observers.length;r++)this.sendOne(r,e)}sendOne(e,r){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{r(this.observers[e])}catch(t){typeof console<"u"&&console.error&&console.error(t)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function RQ(n,e){if(typeof n!="object"||n===null)return!1;for(let r of e)if(r in n&&typeof n[r]=="function")return!0;return!1}function bC(){}function fa(n,e){return`${n} failed: ${e} argument `}var uB=function(n){let e=[],r=0;for(let t=0;t<n.length;t++){let i=n.charCodeAt(t);if(i>=55296&&i<=56319){let o=i-55296;t++,ee(t<n.length,"Surrogate pair missing trail surrogate.");let s=n.charCodeAt(t)-56320;i=65536+(o<<10)+s}i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):i<65536?(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128)}return e},Mg=function(n){let e=0;for(let r=0;r<n.length;r++){let t=n.charCodeAt(r);t<128?e++:t<2048?e+=2:t>=55296&&t<=56319?(e+=4,r++):e+=3}return e};var kwe=14400*1e3;function Ge(n){return n&&n._delegate?n._delegate:n}var _n=class{constructor(e,r,t){this.name=e,this.instanceFactory=r,this.type=t,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var sl="[DEFAULT]";var YT=class{constructor(e,r){this.name=e,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let r=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(r)){let t=new Nn;if(this.instancesDeferred.set(r,t),this.isInitialized(r)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:r});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(e){var r;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(r=e?.optional)!==null&&r!==void 0?r:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(o){if(i)return null;throw o}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(NQ(e))try{this.getOrInitializeService({instanceIdentifier:sl})}catch{}for(let[r,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(r);try{let o=this.getOrInitializeService({instanceIdentifier:i});t.resolve(o)}catch{}}}}clearInstance(e=sl){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}delete(){return I(this,null,function*(){let e=Array.from(this.instances.values());yield Promise.all([...e.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...e.filter(r=>"_delete"in r).map(r=>r._delete())])})}isComponentSet(){return this.component!=null}isInitialized(e=sl){return this.instances.has(e)}getOptions(e=sl){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:r={}}=e,t=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(t))throw Error(`${this.name}(${t}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:t,options:r});for(let[o,s]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(o);t===a&&s.resolve(i)}return i}onInit(e,r){var t;let i=this.normalizeInstanceIdentifier(r),o=(t=this.onInitCallbacks.get(i))!==null&&t!==void 0?t:new Set;o.add(e),this.onInitCallbacks.set(i,o);let s=this.instances.get(i);return s&&e(s,i),()=>{o.delete(e)}}invokeOnInitCallbacks(e,r){let t=this.onInitCallbacks.get(r);if(t)for(let i of t)try{i(e,r)}catch{}}getOrInitializeService({instanceIdentifier:e,options:r={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:CQ(e),options:r}),this.instances.set(e,t),this.instancesOptions.set(e,r),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=sl){return this.component?this.component.multipleInstances?e:sl:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function CQ(n){return n===sl?void 0:n}function NQ(n){return n.instantiationMode==="EAGER"}var Pg=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let r=this.getProvider(e.name);if(r.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);r.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let r=new YT(e,this);return this.providers.set(e,r),r}getProviders(){return Array.from(this.providers.values())}};var dB=[],xe=(function(n){return n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT",n})(xe||{}),OQ={debug:xe.DEBUG,verbose:xe.VERBOSE,info:xe.INFO,warn:xe.WARN,error:xe.ERROR,silent:xe.SILENT},wQ=xe.INFO,bQ={[xe.DEBUG]:"log",[xe.VERBOSE]:"log",[xe.INFO]:"info",[xe.WARN]:"warn",[xe.ERROR]:"error"},LQ=(n,e,...r)=>{if(e<n.logLevel)return;let t=new Date().toISOString(),i=bQ[e];if(i)console[i](`[${t}] ${n.name}:`,...r);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},hi=class{constructor(e){this.name=e,this._logLevel=wQ,this._logHandler=LQ,this._userLogHandler=null,dB.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in xe))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?OQ[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,xe.DEBUG,...e),this._logHandler(this,xe.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,xe.VERBOSE,...e),this._logHandler(this,xe.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,xe.INFO,...e),this._logHandler(this,xe.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,xe.WARN,...e),this._logHandler(this,xe.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,xe.ERROR,...e),this._logHandler(this,xe.ERROR,...e)}};function hB(n){dB.forEach(e=>{e.setLogLevel(n)})}var MQ=(n,e)=>e.some(r=>n instanceof r),fB,gB;function PQ(){return fB||(fB=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xQ(){return gB||(gB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var mB=new WeakMap,BC=new WeakMap,pB=new WeakMap,VC=new WeakMap,$C=new WeakMap;function FQ(n){let e=new Promise((r,t)=>{let i=()=>{n.removeEventListener("success",o),n.removeEventListener("error",s)},o=()=>{r(Lo(n.result)),i()},s=()=>{t(n.error),i()};n.addEventListener("success",o),n.addEventListener("error",s)});return e.then(r=>{r instanceof IDBCursor&&mB.set(r,n)}).catch(()=>{}),$C.set(e,n),e}function kQ(n){if(BC.has(n))return;let e=new Promise((r,t)=>{let i=()=>{n.removeEventListener("complete",o),n.removeEventListener("error",s),n.removeEventListener("abort",s)},o=()=>{r(),i()},s=()=>{t(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",o),n.addEventListener("error",s),n.addEventListener("abort",s)});BC.set(n,e)}var GC={get(n,e,r){if(n instanceof IDBTransaction){if(e==="done")return BC.get(n);if(e==="objectStoreNames")return n.objectStoreNames||pB.get(n);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Lo(n[e])},set(n,e,r){return n[e]=r,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function EB(n){GC=n(GC)}function UQ(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let t=n.call(QT(this),e,...r);return pB.set(t,e.sort?e.sort():[e]),Lo(t)}:xQ().includes(n)?function(...e){return n.apply(QT(this),e),Lo(mB.get(this))}:function(...e){return Lo(n.apply(QT(this),e))}}function VQ(n){return typeof n=="function"?UQ(n):(n instanceof IDBTransaction&&kQ(n),MQ(n,PQ())?new Proxy(n,GC):n)}function Lo(n){if(n instanceof IDBRequest)return FQ(n);if(VC.has(n))return VC.get(n);let e=VQ(n);return e!==n&&(VC.set(n,e),$C.set(e,n)),e}var QT=n=>$C.get(n);function TB(n,e,{blocked:r,upgrade:t,blocking:i,terminated:o}={}){let s=indexedDB.open(n,e),a=Lo(s);return t&&s.addEventListener("upgradeneeded",c=>{t(Lo(s.result),c.oldVersion,c.newVersion,Lo(s.transaction),c)}),r&&s.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{o&&c.addEventListener("close",()=>o()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var BQ=["get","getKey","getAll","getAllKeys","count"],GQ=["put","add","delete","clear"],jC=new Map;function _B(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(jC.get(e))return jC.get(e);let r=e.replace(/FromIndex$/,""),t=e!==r,i=GQ.includes(r);if(!(r in(t?IDBIndex:IDBObjectStore).prototype)||!(i||BQ.includes(r)))return;let o=function(s,...a){return I(this,null,function*(){let c=this.transaction(s,i?"readwrite":"readonly"),l=c.store;return t&&(l=l.index(a.shift())),(yield Promise.all([l[r](...a),i&&c.done]))[0]})};return jC.set(e,o),o}EB(n=>le(P({},n),{get:(e,r,t)=>_B(e,r)||n.get(e,r,t),has:(e,r)=>!!_B(e,r)||n.has(e,r)}));var WC=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(r=>{if($Q(r)){let t=r.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(r=>r).join(" ")}};function $Q(n){let e=n.getComponent();return e?.type==="VERSION"}var zC="@firebase/app",IB="0.13.2";var Ts=new hi("@firebase/app"),jQ="@firebase/app-compat",HQ="@firebase/analytics-compat",WQ="@firebase/analytics",zQ="@firebase/app-check-compat",qQ="@firebase/app-check",KQ="@firebase/auth",YQ="@firebase/auth-compat",QQ="@firebase/database",XQ="@firebase/data-connect",JQ="@firebase/database-compat",ZQ="@firebase/functions",eX="@firebase/functions-compat",tX="@firebase/installations",nX="@firebase/installations-compat",rX="@firebase/messaging",iX="@firebase/messaging-compat",oX="@firebase/performance",sX="@firebase/performance-compat",aX="@firebase/remote-config",cX="@firebase/remote-config-compat",lX="@firebase/storage",uX="@firebase/storage-compat",dX="@firebase/firestore",hX="@firebase/ai",fX="@firebase/firestore-compat",gX="firebase",mX="11.10.0";var qC="[DEFAULT]",pX={[zC]:"fire-core",[jQ]:"fire-core-compat",[WQ]:"fire-analytics",[HQ]:"fire-analytics-compat",[qQ]:"fire-app-check",[zQ]:"fire-app-check-compat",[KQ]:"fire-auth",[YQ]:"fire-auth-compat",[QQ]:"fire-rtdb",[XQ]:"fire-data-connect",[JQ]:"fire-rtdb-compat",[ZQ]:"fire-fn",[eX]:"fire-fn-compat",[tX]:"fire-iid",[nX]:"fire-iid-compat",[rX]:"fire-fcm",[iX]:"fire-fcm-compat",[oX]:"fire-perf",[sX]:"fire-perf-compat",[aX]:"fire-rc",[cX]:"fire-rc-compat",[lX]:"fire-gcs",[uX]:"fire-gcs-compat",[dX]:"fire-fst",[fX]:"fire-fst-compat",[hX]:"fire-vertex","fire-js":"fire-js",[gX]:"fire-js-all"};var xg=new Map,EX=new Map,KC=new Map;function vB(n,e){try{n.container.addComponent(e)}catch(r){Ts.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,r)}}function lr(n){let e=n.name;if(KC.has(e))return Ts.debug(`There were multiple attempts to register component ${e}.`),!1;KC.set(e,n);for(let r of xg.values())vB(r,n);for(let r of EX.values())vB(r,n);return!0}function Mo(n,e){let r=n.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),n.container.getProvider(e)}function vr(n){return n==null?!1:n.settings!==void 0}var _X={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ga=new ki("app","Firebase",_X);var YC=class{constructor(e,r,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},r),this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new _n("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 ga.create("app-deleted",{appName:this._name})}};var ma=mX;function JC(n,e={}){let r=n;typeof e!="object"&&(e={name:e});let t=Object.assign({name:qC,automaticDataCollectionEnabled:!0},e),i=t.name;if(typeof i!="string"||!i)throw ga.create("bad-app-name",{appName:String(i)});if(r||(r=FC()),!r)throw ga.create("no-options");let o=xg.get(i);if(o){if(Ui(r,o.options)&&Ui(t,o.config))return o;throw ga.create("duplicate-app",{appName:i})}let s=new Pg(i);for(let c of KC.values())s.addComponent(c);let a=new YC(r,t,s);return xg.set(i,a),a}function yr(n=qC){let e=xg.get(n);if(!e&&n===qC&&FC())return JC();if(!e)throw ga.create("no-app",{appName:n});return e}function XT(){return Array.from(xg.values())}function Qe(n,e,r){var t;let i=(t=pX[n])!==null&&t!==void 0?t:n;r&&(i+=`-${r}`);let o=i.match(/\s|\//),s=e.match(/\s|\//);if(o||s){let a=[`Unable to register library "${i}" with version "${e}":`];o&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Ts.warn(a.join(" "));return}lr(new _n(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function TX(n){hB(n)}var IX="firebase-heartbeat-database",vX=1,Fg="firebase-heartbeat-store",HC=null;function DB(){return HC||(HC=TB(IX,vX,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(Fg)}catch(r){console.warn(r)}}}}).catch(n=>{throw ga.create("idb-open",{originalErrorMessage:n.message})})),HC}function yX(n){return I(this,null,function*(){try{let r=(yield DB()).transaction(Fg),t=yield r.objectStore(Fg).get(RB(n));return yield r.done,t}catch(e){if(e instanceof Ir)Ts.warn(e.message);else{let r=ga.create("idb-get",{originalErrorMessage:e?.message});Ts.warn(r.message)}}})}function yB(n,e){return I(this,null,function*(){try{let t=(yield DB()).transaction(Fg,"readwrite");yield t.objectStore(Fg).put(e,RB(n)),yield t.done}catch(r){if(r instanceof Ir)Ts.warn(r.message);else{let t=ga.create("idb-set",{originalErrorMessage:r?.message});Ts.warn(t.message)}}})}function RB(n){return`${n.name}!${n.options.appId}`}var SX=1024,AX=30,QC=class{constructor(e){this.container=e,this._heartbeatsCache=null;let r=this.container.getProvider("app").getImmediate();this._storage=new XC(r),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}triggerHeartbeat(){return I(this,null,function*(){var e,r;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=SB();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,((r=this._heartbeatsCache)===null||r===void 0?void 0:r.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(s=>s.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:i}),this._heartbeatsCache.heartbeats.length>AX){let s=RX(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){Ts.warn(t)}})}getHeartbeatsHeader(){return I(this,null,function*(){var e;try{if(this._heartbeatsCache===null&&(yield this._heartbeatsCachePromise),((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let r=SB(),{heartbeatsToSend:t,unsentEntries:i}=DX(this._heartbeatsCache.heartbeats),o=Ng(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=r,i.length>0?(this._heartbeatsCache.heartbeats=i,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(r){return Ts.warn(r),""}})}};function SB(){return new Date().toISOString().substring(0,10)}function DX(n,e=SX){let r=[],t=n.slice();for(let i of n){let o=r.find(s=>s.agent===i.agent);if(o){if(o.dates.push(i.date),AB(r)>e){o.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),AB(r)>e){r.pop();break}t=t.slice(1)}return{heartbeatsToSend:r,unsentEntries:t}}var XC=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return I(this,null,function*(){return Nd()?oB().then(()=>!0).catch(()=>!1):!1})}read(){return I(this,null,function*(){if(yield this._canUseIndexedDBPromise){let r=yield yX(this.app);return r?.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(e){return I(this,null,function*(){var r;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return yB(this.app,{lastSentHeartbeatDate:(r=e.lastSentHeartbeatDate)!==null&&r!==void 0?r:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return})}add(e){return I(this,null,function*(){var r;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return yB(this.app,{lastSentHeartbeatDate:(r=e.lastSentHeartbeatDate)!==null&&r!==void 0?r:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return})}};function AB(n){return Ng(JSON.stringify({version:2,heartbeats:n})).length}function RX(n){if(n.length===0)return-1;let e=0,r=n[0].date;for(let t=1;t<n.length;t++)n[t].date<r&&(r=n[t].date,e=t);return e}function CX(n){lr(new _n("platform-logger",e=>new WC(e),"PRIVATE")),lr(new _n("heartbeat",e=>new QC(e),"PRIVATE")),Qe(zC,IB,n),Qe(zC,IB,"esm2017"),Qe("fire-js","")}CX("");var NX="firebase",OX="11.10.0";Qe(NX,OX,"app");function gbe(n){n||(n=ne(ar));let e=new ge(r=>{if(n.destroyed){r.next();return}return n.onDestroy(r.next.bind(r))});return r=>r.pipe(zs(e))}function mbe(n,e){let r=e?.injector??ne(St),t=new Sc(1),i=PR(()=>{let o;try{o=n()}catch(s){ng(()=>t.error(s));return}ng(()=>t.next(o))},{injector:r,manualCleanup:!0});return r.get(ar).onDestroy(()=>{i.destroy(),t.complete()}),t.asObservable()}function pbe(n,e){let t=!e?.manualCleanup?e?.injector?.get(ar)??ne(ar):null,i=wX(e?.equal),o;e?.requireSync?o=$c({kind:0},{equal:i}):o=$c({kind:1,value:e?.initialValue},{equal:i});let s,a=n.subscribe({next:c=>o.set({kind:1,value:c}),error:c=>{o.set({kind:2,error:c}),s?.()},complete:()=>{s?.()}});if(e?.requireSync&&o().kind===0)throw new oe(601,!1);return s=t?.onDestroy(a.unsubscribe.bind(a)),rg(()=>{let c=o();switch(c.kind){case 1:return c.value;case 2:throw c.error;case 0:throw new oe(601,!1)}},{equal:e?.equal})}function wX(n=Object.is){return(e,r)=>e.kind===1&&r.kind===1&&n(e.value,r.value)}function CB(n){n===void 0&&(n=ne(St));let e=n.get(To);return r=>new ge(t=>{let i=e.add(),o=!1;function s(){o||(i(),o=!0)}let a=r.subscribe({next:c=>{t.next(c),s()},complete:()=>{t.complete(),s()},error:c=>{t.error(c),s()}});return a.add(()=>{t.unsubscribe(),s()}),a})}var Vi=new Nc("ANGULARFIRE2_VERSION");function pa(n,e,r){if(e){if(e.length===1)return e[0];let o=e.filter(s=>s.app===r);if(o.length===1)return o[0]}return r.container.getProvider(n).getImmediate({optional:!0})}var Is=(n,e)=>{let r=e?[e]:XT(),t=[];return r.forEach(i=>{i.container.getProvider(n).instances.forEach(s=>{t.includes(s)||t.push(s)})}),t},Od=(function(n){return n[n.SILENT=0]="SILENT",n[n.WARN=1]="WARN",n[n.VERBOSE=2]="VERBOSE",n})(Od||{}),NB=WR()&&typeof Zone<"u"?Od.WARN:Od.SILENT;var JT=class{zone;delegate;constructor(e,r=VS){this.zone=e,this.delegate=r}now(){return this.delegate.now()}schedule(e,r,t){let i=this.zone,o=function(s){i?i.runGuarded(()=>{e.apply(this,[s])}):e.apply(this,[s])};return this.delegate.schedule(o,r,t)}},Bi=(()=>{class n{outsideAngular;insideAngular;constructor(){let r=ne(be);this.outsideAngular=r.runOutsideAngular(()=>new JT(typeof Zone>"u"?void 0:Zone.current)),this.insideAngular=r.run(()=>new JT(typeof Zone>"u"?void 0:Zone.current,Hn))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),OB=!1;function bX(n,e){!OB&&(NB>Od.SILENT||WR())&&(OB=!0,console.warn("Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. Find more at https://github.com/angular/angularfire/blob/main/docs/zones.md")),NB>=e&&console.warn(`Firebase API called outside injection context: ${n.name}`)}function LX(n){let e=ne(be,{optional:!0});return e?e.runOutsideAngular(()=>n()):n()}function al(n){let e=ne(be,{optional:!0});return e?e.run(()=>n()):n()}var MX=(n,e,r)=>(...t)=>(e&&setTimeout(e,0),ho(r,()=>al(()=>n.apply(void 0,t)))),pe=(n,e,r)=>(r||=e?Od.WARN:Od.VERBOSE,function(){let t,i=arguments,o,s,a;try{o=ne(Bi),s=ne(To),a=ne(Kn)}catch{return bX(n,r),n.apply(this,i)}for(let l=0;l<arguments.length;l++)typeof i[l]=="function"&&(e&&(t||=al(()=>s.add())),i[l]=MX(i[l],t,a));let c=LX(()=>n.apply(this,i));return e?c instanceof ge?c.pipe(Hs(o.outsideAngular),js(o.insideAngular),CB(a)):c instanceof Promise?al(()=>{let l=s.add();return new Promise((u,d)=>{c.then(f=>ho(a,()=>al(()=>u(f))),f=>ho(a,()=>al(()=>d(f)))).finally(l)})}):typeof c=="function"&&t?function(){return setTimeout(t,0),c.apply(this,arguments)}:al(()=>c):c instanceof ge?c.pipe(Hs(o.outsideAngular),js(o.insideAngular)):al(()=>c)});var Gi=class{constructor(e){return e}},vs=class{constructor(){return XT()}};function PX(n){return n&&n.length===1?n[0]:new Gi(yr())}var ZC=new Z("angularfire2._apps"),xX={provide:Gi,useFactory:PX,deps:[[new pn,ZC]]},FX={provide:vs,deps:[[new pn,ZC]]};function kX(n){return(e,r)=>{let t=r.get(ds);Qe("angularfire",Vi.full,"core"),Qe("angularfire",Vi.full,"app"),Qe("angular",JS.full,t.toString());let i=e.runOutsideAngular(()=>n(r));return new Gi(i)}}function Pbe(n,...e){return mr([xX,FX,{provide:ZC,useFactory:kX(n),multi:!0,deps:[be,St,Bi,...e]}])}var xbe=pe(yr,!0);var Fbe=pe(JC,!0);var UX=new Map,VX={activated:!1,tokenObservers:[]},BX={initialized:!1,enabled:!1};function $i(n){return UX.get(n)||Object.assign({},VX)}function MB(){return BX}var GX="https://content-firebaseappcheck.googleapis.com/v1";var $X="exchangeDebugToken",wB={OFFSET_DURATION:300*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:960*1e3},Wbe=1440*60*1e3;var nN=class{constructor(e,r,t,i,o){if(this.operation=e,this.retryPolicy=r,this.getWaitDuration=t,this.lowerBound=i,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=i,i>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(e){return I(this,null,function*(){this.stop();try{this.pending=new Nn,this.pending.promise.catch(r=>{}),yield jX(this.getNextRun(e)),this.pending.resolve(),yield this.pending.promise,this.pending=new Nn,this.pending.promise.catch(r=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(r){this.retryPolicy(r)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let r=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),r}}};function jX(n){return new Promise(e=>{setTimeout(e,n)})}var HX={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"},Ea=new ki("appCheck","AppCheck",HX);function PB(n){if(!$i(n).activated)throw Ea.create("use-before-activation",{appName:n.name})}function xB(t,i){return I(this,arguments,function*({url:n,body:e},r){let o={"Content-Type":"application/json"},s=r.getImmediate({optional:!0});if(s){let g=yield s.getHeartbeatsHeader();g&&(o["X-Firebase-Client"]=g)}let a={method:"POST",body:JSON.stringify(e),headers:o},c;try{c=yield fetch(n,a)}catch(g){throw Ea.create("fetch-network-error",{originalErrorMessage:g?.message})}if(c.status!==200)throw Ea.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(g){throw Ea.create("fetch-parse-error",{originalErrorMessage:g?.message})}let u=l.ttl.match(/^([\d.]+)(s)$/);if(!u||!u[2]||isNaN(Number(u[1])))throw Ea.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${l.ttl}`});let d=Number(u[1])*1e3,f=Date.now();return{token:l.token,expireTimeMillis:f+d,issuedAtTimeMillis:f}})}function FB(n,e){let{projectId:r,appId:t,apiKey:i}=n.options;return{url:`${GX}/projects/${r}/apps/${t}:${$X}?key=${i}`,body:{debug_token:e}}}var WX="firebase-app-check-database",zX=1,rN="firebase-app-check-store";var ZT=null;function qX(){return ZT||(ZT=new Promise((n,e)=>{try{let r=indexedDB.open(WX,zX);r.onsuccess=t=>{n(t.target.result)},r.onerror=t=>{var i;e(Ea.create("storage-open",{originalErrorMessage:(i=t.target.error)===null||i===void 0?void 0:i.message}))},r.onupgradeneeded=t=>{let i=t.target.result;t.oldVersion===0&&i.createObjectStore(rN,{keyPath:"compositeKey"})}}catch(r){e(Ea.create("storage-open",{originalErrorMessage:r?.message}))}}),ZT)}function KX(n,e){return YX(QX(n),e)}function YX(n,e){return I(this,null,function*(){let t=(yield qX()).transaction(rN,"readwrite"),o=t.objectStore(rN).put({compositeKey:n,value:e});return new Promise((s,a)=>{o.onsuccess=c=>{s()},t.onerror=c=>{var l;a(Ea.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function QX(n){return`${n.options.appId}-${n.name}`}var kg=new hi("@firebase/app-check");function eN(n,e){return Nd()?KX(n,e).catch(r=>{kg.warn(`Failed to write token to IndexedDB. Error: ${r}`)}):Promise.resolve()}function kB(){return MB().enabled}function UB(){return I(this,null,function*(){let n=MB();if(n.enabled&&n.token)return n.token.promise;throw Error(`
139
+ Can't get debug token in production mode.
140
+ `)})}var XX={error:"UNKNOWN_ERROR"};function JX(n){return Rd.encodeString(JSON.stringify(n),!1)}function iN(n,e=!1,r=!1){return I(this,null,function*(){let t=n.app;PB(t);let i=$i(t),o=i.token,s;if(o&&!Ug(o)&&(i.token=void 0,o=void 0),!o){let l=yield i.cachedTokenPromise;l&&(Ug(l)?o=l:yield eN(t,void 0))}if(!e&&o&&Ug(o))return{token:o.token};let a=!1;if(kB())try{i.exchangeTokenPromise||(i.exchangeTokenPromise=xB(FB(t,yield UB()),n.heartbeatServiceProvider).finally(()=>{i.exchangeTokenPromise=void 0}),a=!0);let l=yield i.exchangeTokenPromise;return yield eN(t,l),i.token=l,{token:l.token}}catch(l){return l.code==="appCheck/throttled"||l.code==="appCheck/initial-throttle"?kg.warn(l.message):r&&kg.error(l),tN(l)}try{i.exchangeTokenPromise||(i.exchangeTokenPromise=i.provider.getToken().finally(()=>{i.exchangeTokenPromise=void 0}),a=!0),o=yield $i(t).exchangeTokenPromise}catch(l){l.code==="appCheck/throttled"||l.code==="appCheck/initial-throttle"?kg.warn(l.message):r&&kg.error(l),s=l}let c;return o?s?Ug(o)?c={token:o.token,internalError:s}:c=tN(s):(c={token:o.token},i.token=o,yield eN(t,o)):c=tN(s),a&&nJ(t,c),c})}function ZX(n){return I(this,null,function*(){let e=n.app;PB(e);let{provider:r}=$i(e);if(kB()){let t=yield UB(),{token:i}=yield xB(FB(e,t),n.heartbeatServiceProvider);return{token:i}}else{let{token:t}=yield r.getToken();return{token:t}}})}function eJ(n,e,r,t){let{app:i}=n,o=$i(i),s={next:r,error:t,type:e};if(o.tokenObservers=[...o.tokenObservers,s],o.token&&Ug(o.token)){let a=o.token;Promise.resolve().then(()=>{r({token:a.token}),bB(n)}).catch(()=>{})}o.cachedTokenPromise.then(()=>bB(n))}function VB(n,e){let r=$i(n),t=r.tokenObservers.filter(i=>i.next!==e);t.length===0&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=t}function bB(n){let{app:e}=n,r=$i(e),t=r.tokenRefresher;t||(t=tJ(n),r.tokenRefresher=t),!t.isRunning()&&r.isTokenAutoRefreshEnabled&&t.start()}function tJ(n){let{app:e}=n;return new nN(()=>I(null,null,function*(){let r=$i(e),t;if(r.token?t=yield iN(n,!0):t=yield iN(n),t.error)throw t.error;if(t.internalError)throw t.internalError}),()=>!0,()=>{let r=$i(e);if(r.token){let t=r.token.issuedAtTimeMillis+(r.token.expireTimeMillis-r.token.issuedAtTimeMillis)*.5+3e5,i=r.token.expireTimeMillis-300*1e3;return t=Math.min(t,i),Math.max(0,t-Date.now())}else return 0},wB.RETRIAL_MIN_WAIT,wB.RETRIAL_MAX_WAIT)}function nJ(n,e){let r=$i(n).tokenObservers;for(let t of r)try{t.type==="EXTERNAL"&&e.error!=null?t.error(e.error):t.next(e)}catch{}}function Ug(n){return n.expireTimeMillis-Date.now()>0}function tN(n){return{token:JX(XX),error:n}}var oN=class{constructor(e,r){this.app=e,this.heartbeatServiceProvider=r}_delete(){let{tokenObservers:e}=$i(this.app);for(let r of e)VB(this.app,r.next);return Promise.resolve()}};function rJ(n,e){return new oN(n,e)}function iJ(n){return{getToken:e=>iN(n,e),getLimitedUseToken:()=>ZX(n),addTokenListener:e=>eJ(n,"INTERNAL",e),removeTokenListener:e=>VB(n.app,e)}}var oJ="@firebase/app-check",sJ="0.10.1";var aJ="app-check",LB="app-check-internal";function cJ(){lr(new _n(aJ,n=>{let e=n.getProvider("app").getImmediate(),r=n.getProvider("heartbeat");return rJ(e,r)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((n,e,r)=>{n.getProvider(LB).initialize()})),lr(new _n(LB,n=>{let e=n.getProvider("app-check").getImmediate();return iJ(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),Qe(oJ,sJ)}cJ();var lJ="app-check";var _a=class{constructor(){return Is(lJ)}};var uJ=["localhost","0.0.0.0","127.0.0.1"],iLe=typeof window<"u"&&uJ.includes(window.location.hostname);function QB(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}var XB=QB,JB=new ki("auth","Firebase",QB());var nI=new hi("@firebase/auth");function dJ(n,...e){nI.logLevel<=xe.WARN&&nI.warn(`Auth (${ma}): ${n}`,...e)}function tI(n,...e){nI.logLevel<=xe.ERROR&&nI.error(`Auth (${ma}): ${n}`,...e)}function rI(n,...e){throw IN(n,...e)}function TN(n,...e){return IN(n,...e)}function ZB(n,e,r){let t=Object.assign(Object.assign({},XB()),{[e]:r});return new ki("auth","Firebase",t).create(e,{appName:n.name})}function Vg(n){return ZB(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function IN(n,...e){if(typeof n!="string"){let r=e[0],t=[...e.slice(1)];return t[0]&&(t[0].appName=n.name),n._errorFactory.create(r,...t)}return JB.create(n,...e)}function Xe(n,e,...r){if(!n)throw IN(e,...r)}function Bg(n){let e="INTERNAL ASSERTION FAILED: "+n;throw tI(e),new Error(e)}function iI(n,e){n||Bg(e)}function hJ(){return BB()==="http:"||BB()==="https:"}function BB(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}function fJ(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(hJ()||rB()||"connection"in navigator)?navigator.onLine:!0}function gJ(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}var ll=class{constructor(e,r){this.shortDelay=e,this.longDelay=r,iI(r>e,"Short delay should be less than long delay!"),this.isMobile=Og()||KT()}get(){return fJ()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function mJ(n,e){iI(n.emulator,"Emulator should always be set here");let{url:r}=n.emulator;return e?`${r}${e.startsWith("/")?e.slice(1):e}`:r}var oI=class{static initialize(e,r,t){this.fetchImpl=e,r&&(this.headersImpl=r),t&&(this.responseImpl=t)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Bg("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Bg("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Bg("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var pJ={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var EJ=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],_J=new ll(3e4,6e4);function vN(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}function Hg(o,s,a,c){return I(this,arguments,function*(n,e,r,t,i={}){return eG(n,i,()=>I(null,null,function*(){let l={},u={};t&&(e==="GET"?u=t:l={body:JSON.stringify(t)});let d=Lg(Object.assign({key:n.config.apiKey},u)).slice(1),f=yield n._getAdditionalHeaders();f["Content-Type"]="application/json",n.languageCode&&(f["X-Firebase-Locale"]=n.languageCode);let g=Object.assign({method:e,headers:f},l);return nB()||(g.referrerPolicy="no-referrer"),n.emulatorConfig&&jr(n.emulatorConfig.host)&&(g.credentials="include"),oI.fetch()(yield tG(n,n.config.apiHost,r,d),g)}))})}function eG(n,e,r){return I(this,null,function*(){n._canInitEmulator=!1;let t=Object.assign(Object.assign({},pJ),e);try{let i=new cN(n),o=yield Promise.race([r(),i.promise]);i.clearNetworkTimeout();let s=yield o.json();if("needConfirmation"in s)throw eI(n,"account-exists-with-different-credential",s);if(o.ok&&!("errorMessage"in s))return s;{let a=o.ok?s.errorMessage:s.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw eI(n,"credential-already-in-use",s);if(c==="EMAIL_EXISTS")throw eI(n,"email-already-in-use",s);if(c==="USER_DISABLED")throw eI(n,"user-disabled",s);let u=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw ZB(n,u,l);rI(n,u)}}catch(i){if(i instanceof Ir)throw i;rI(n,"network-request-failed",{message:String(i)})}})}function TJ(o,s,a,c){return I(this,arguments,function*(n,e,r,t,i={}){let l=yield Hg(n,e,r,t,i);return"mfaPendingCredential"in l&&rI(n,"multi-factor-auth-required",{_serverResponse:l}),l})}function tG(n,e,r,t){return I(this,null,function*(){let i=`${e}${r}?${t}`,o=n,s=o.config.emulator?mJ(n.config,i):`${n.config.apiScheme}://${i}`;return EJ.includes(r)&&(yield o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(s).toString():s})}var cN=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((r,t)=>{this.timer=setTimeout(()=>t(TN(this.auth,"network-request-failed")),_J.get())})}};function eI(n,e,r){let t={appName:n.name};r.email&&(t.email=r.email),r.phoneNumber&&(t.phoneNumber=r.phoneNumber);let i=TN(n,e,t);return i.customData._tokenResponse=r,i}function IJ(n,e){return I(this,null,function*(){return Hg(n,"POST","/v1/accounts:delete",e)})}function sI(n,e){return I(this,null,function*(){return Hg(n,"POST","/v1/accounts:lookup",e)})}function Gg(n){if(n)try{let e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function fI(n,e=!1){return I(this,null,function*(){let r=Ge(n),t=yield r.getIdToken(e),i=nG(t);Xe(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");let o=typeof i.firebase=="object"?i.firebase:void 0,s=o?.sign_in_provider;return{claims:i,token:t,authTime:Gg(sN(i.auth_time)),issuedAtTime:Gg(sN(i.iat)),expirationTime:Gg(sN(i.exp)),signInProvider:s||null,signInSecondFactor:o?.sign_in_second_factor||null}})}function sN(n){return Number(n)*1e3}function nG(n){let[e,r,t]=n.split(".");if(e===void 0||r===void 0||t===void 0)return tI("JWT malformed, contained fewer than 3 sections"),null;try{let i=Ad(r);return i?JSON.parse(i):(tI("Failed to decode base64 JWT payload"),null)}catch(i){return tI("Caught error parsing JWT payload as JSON",i?.toString()),null}}function GB(n){let e=nG(n);return Xe(e,"internal-error"),Xe(typeof e.exp<"u","internal-error"),Xe(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}function lN(n,e,r=!1){return I(this,null,function*(){if(r)return e;try{return yield e}catch(t){throw t instanceof Ir&&vJ(t)&&n.auth.currentUser===n&&(yield n.auth.signOut()),t}})}function vJ({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}var uN=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var r;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((r=this.user.stsTokenManager.expirationTime)!==null&&r!==void 0?r:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let r=this.getInterval(e);this.timerId=setTimeout(()=>I(this,null,function*(){yield this.iteration()}),r)}iteration(){return I(this,null,function*(){try{yield this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()})}};var jg=class{constructor(e,r){this.createdAt=e,this.lastLoginAt=r,this._initializeTime()}_initializeTime(){this.lastSignInTime=Gg(this.lastLoginAt),this.creationTime=Gg(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};function aI(n){return I(this,null,function*(){var e;let r=n.auth,t=yield n.getIdToken(),i=yield lN(n,sI(r,{idToken:t}));Xe(i?.users.length,r,"internal-error");let o=i.users[0];n._notifyReloadListener(o);let s=!((e=o.providerUserInfo)===null||e===void 0)&&e.length?rG(o.providerUserInfo):[],a=yJ(n.providerData,s),c=n.isAnonymous,l=!(n.email&&o.passwordHash)&&!a?.length,u=c?l:!1,d={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new jg(o.createdAt,o.lastLoginAt),isAnonymous:u};Object.assign(n,d)})}function yN(n){return I(this,null,function*(){let e=Ge(n);yield aI(e),yield e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)})}function yJ(n,e){return[...n.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function rG(n){return n.map(e=>{var{providerId:r}=e,t=_S(e,["providerId"]);return{providerId:r,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}function SJ(n,e){return I(this,null,function*(){let r=yield eG(n,{},()=>I(null,null,function*(){let t=Lg({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:o}=n.config,s=yield tG(n,i,"/v1/token",`key=${o}`),a=yield n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let c={method:"POST",headers:a,body:t};return n.emulatorConfig&&jr(n.emulatorConfig.host)&&(c.credentials="include"),oI.fetch()(s,c)}));return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}})}function AJ(n,e){return I(this,null,function*(){return Hg(n,"POST","/v2/accounts:revokeToken",vN(n,e))})}var $g=class n{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Xe(e.idToken,"internal-error"),Xe(typeof e.idToken<"u","internal-error"),Xe(typeof e.refreshToken<"u","internal-error");let r="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):GB(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,r)}updateFromIdToken(e){Xe(e.length!==0,"internal-error");let r=GB(e);this.updateTokensAndExpiration(e,null,r)}getToken(e,r=!1){return I(this,null,function*(){return!r&&this.accessToken&&!this.isExpired?this.accessToken:(Xe(this.refreshToken,e,"user-token-expired"),this.refreshToken?(yield this.refresh(e,this.refreshToken),this.accessToken):null)})}clearRefreshToken(){this.refreshToken=null}refresh(e,r){return I(this,null,function*(){let{accessToken:t,refreshToken:i,expiresIn:o}=yield SJ(e,r);this.updateTokensAndExpiration(t,i,Number(o))})}updateTokensAndExpiration(e,r,t){this.refreshToken=r||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,r){let{refreshToken:t,accessToken:i,expirationTime:o}=r,s=new n;return t&&(Xe(typeof t=="string","internal-error",{appName:e}),s.refreshToken=t),i&&(Xe(typeof i=="string","internal-error",{appName:e}),s.accessToken=i),o&&(Xe(typeof o=="number","internal-error",{appName:e}),s.expirationTime=o),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new n,this.toJSON())}_performRefresh(){return Bg("not implemented")}};function Ta(n,e){Xe(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}var Ia=class n{constructor(e){var{uid:r,auth:t,stsTokenManager:i}=e,o=_S(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new uN(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=r,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=o.displayName||null,this.email=o.email||null,this.emailVerified=o.emailVerified||!1,this.phoneNumber=o.phoneNumber||null,this.photoURL=o.photoURL||null,this.isAnonymous=o.isAnonymous||!1,this.tenantId=o.tenantId||null,this.providerData=o.providerData?[...o.providerData]:[],this.metadata=new jg(o.createdAt||void 0,o.lastLoginAt||void 0)}getIdToken(e){return I(this,null,function*(){let r=yield lN(this,this.stsTokenManager.getToken(this.auth,e));return Xe(r,this.auth,"internal-error"),this.accessToken!==r&&(this.accessToken=r,yield this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),r})}getIdTokenResult(e){return fI(this,e)}reload(){return yN(this)}_assign(e){this!==e&&(Xe(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(r=>Object.assign({},r)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let r=new n(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return r.metadata._copy(this.metadata),r}_onReload(e){Xe(!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()}_updateTokensIfNecessary(e,r=!1){return I(this,null,function*(){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),r&&(yield aI(this)),yield this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)})}delete(){return I(this,null,function*(){if(vr(this.auth.app))return Promise.reject(Vg(this.auth));let e=yield this.getIdToken();return yield lN(this,IJ(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()})}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,r){var t,i,o,s,a,c,l,u;let d=(t=r.displayName)!==null&&t!==void 0?t:void 0,f=(i=r.email)!==null&&i!==void 0?i:void 0,g=(o=r.phoneNumber)!==null&&o!==void 0?o:void 0,p=(s=r.photoURL)!==null&&s!==void 0?s:void 0,_=(a=r.tenantId)!==null&&a!==void 0?a:void 0,T=(c=r._redirectEventId)!==null&&c!==void 0?c:void 0,S=(l=r.createdAt)!==null&&l!==void 0?l:void 0,b=(u=r.lastLoginAt)!==null&&u!==void 0?u:void 0,{uid:B,emailVerified:x,isAnonymous:U,providerData:$,stsTokenManager:A}=r;Xe(B&&A,e,"internal-error");let D=$g.fromJSON(this.name,A);Xe(typeof B=="string",e,"internal-error"),Ta(d,e.name),Ta(f,e.name),Xe(typeof x=="boolean",e,"internal-error"),Xe(typeof U=="boolean",e,"internal-error"),Ta(g,e.name),Ta(p,e.name),Ta(_,e.name),Ta(T,e.name),Ta(S,e.name),Ta(b,e.name);let C=new n({uid:B,auth:e,email:f,emailVerified:x,displayName:d,isAnonymous:U,photoURL:p,phoneNumber:g,tenantId:_,stsTokenManager:D,createdAt:S,lastLoginAt:b});return $&&Array.isArray($)&&(C.providerData=$.map(O=>Object.assign({},O))),T&&(C._redirectEventId=T),C}static _fromIdTokenResponse(e,r,t=!1){return I(this,null,function*(){let i=new $g;i.updateFromServerResponse(r);let o=new n({uid:r.localId,auth:e,stsTokenManager:i,isAnonymous:t});return yield aI(o),o})}static _fromGetAccountInfoResponse(e,r,t){return I(this,null,function*(){let i=r.users[0];Xe(i.localId!==void 0,"internal-error");let o=i.providerUserInfo!==void 0?rG(i.providerUserInfo):[],s=!(i.email&&i.passwordHash)&&!o?.length,a=new $g;a.updateFromIdToken(t);let c=new n({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:s}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new jg(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!o?.length};return Object.assign(c,l),c})}};var $B=new Map;function cl(n){iI(n instanceof Function,"Expected a class definition");let e=$B.get(n);return e?(iI(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,$B.set(n,e),e)}var DJ=(()=>{class n{constructor(){this.type="NONE",this.storage={}}_isAvailable(){return I(this,null,function*(){return!0})}_set(r,t){return I(this,null,function*(){this.storage[r]=t})}_get(r){return I(this,null,function*(){let t=this.storage[r];return t===void 0?null:t})}_remove(r){return I(this,null,function*(){delete this.storage[r]})}_addListener(r,t){}_removeListener(r,t){}}return n.type="NONE",n})(),dN=DJ;function aN(n,e,r){return`firebase:${n}:${e}:${r}`}var cI=class n{constructor(e,r,t){this.persistence=e,this.auth=r,this.userKey=t;let{config:i,name:o}=this.auth;this.fullUserKey=aN(this.userKey,i.apiKey,o),this.fullPersistenceKey=aN("persistence",i.apiKey,o),this.boundEventHandler=r._onStorageEvent.bind(r),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}getCurrentUser(){return I(this,null,function*(){let e=yield this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let r=yield sI(this.auth,{idToken:e}).catch(()=>{});return r?Ia._fromGetAccountInfoResponse(this.auth,r,e):null}return Ia._fromJSON(this.auth,e)})}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}setPersistence(e){return I(this,null,function*(){if(this.persistence===e)return;let r=yield this.getCurrentUser();if(yield this.removeCurrentUser(),this.persistence=e,r)return this.setCurrentUser(r)})}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static create(e,r,t="authUser"){return I(this,null,function*(){if(!r.length)return new n(cl(dN),e,t);let i=(yield Promise.all(r.map(l=>I(null,null,function*(){if(yield l._isAvailable())return l})))).filter(l=>l),o=i[0]||cl(dN),s=aN(t,e.config.apiKey,e.name),a=null;for(let l of r)try{let u=yield l._get(s);if(u){let d;if(typeof u=="string"){let f=yield sI(e,{idToken:u}).catch(()=>{});if(!f)break;d=yield Ia._fromGetAccountInfoResponse(e,f,u)}else d=Ia._fromJSON(e,u);l!==o&&(a=d),o=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!o._shouldAllowMigration||!c.length?new n(o,e,t):(o=c[0],a&&(yield o._set(s,a.toJSON())),yield Promise.all(r.map(l=>I(null,null,function*(){if(l!==o)try{yield l._remove(s)}catch{}}))),new n(o,e,t))})}};function jB(n){let e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(iG(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(RJ(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(sG(e))return"Blackberry";if(aG(e))return"Webos";if(CJ(e))return"Safari";if((e.includes("chrome/")||NJ(e))&&!e.includes("edge/"))return"Chrome";if(oG(e))return"Android";{let r=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=n.match(r);if(t?.length===2)return t[1]}return"Other"}function RJ(n=En()){return/firefox\//i.test(n)}function CJ(n=En()){let e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function NJ(n=En()){return/crios\//i.test(n)}function iG(n=En()){return/iemobile/i.test(n)}function oG(n=En()){return/android/i.test(n)}function sG(n=En()){return/blackberry/i.test(n)}function aG(n=En()){return/webos/i.test(n)}function OJ(n=En()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function wJ(){return iB()&&document.documentMode===10}function bJ(n=En()){return OJ(n)||oG(n)||aG(n)||sG(n)||/windows phone/i.test(n)||iG(n)}function cG(n,e=[]){let r;switch(n){case"Browser":r=jB(En());break;case"Worker":r=`${jB(En())}-${n}`;break;default:r=n}let t=e.length?e.join(","):"FirebaseCore-web";return`${r}/JsCore/${ma}/${t}`}var hN=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,r){let t=o=>new Promise((s,a)=>{try{let c=e(o);s(c)}catch(c){a(c)}});t.onAbort=r,this.queue.push(t);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}runMiddleware(e){return I(this,null,function*(){if(this.auth.currentUser===e)return;let r=[];try{for(let t of this.queue)yield t(e),t.onAbort&&r.push(t.onAbort)}catch(t){r.reverse();for(let i of r)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}})}};function LJ(r){return I(this,arguments,function*(n,e={}){return Hg(n,"GET","/v2/passwordPolicy",vN(n,e))})}var MJ=6,fN=class{constructor(e){var r,t,i,o;let s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(r=s.minPasswordLength)!==null&&r!==void 0?r:MJ,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),s.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),s.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),s.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),s.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(t=e.allowedNonAlphanumericCharacters)===null||t===void 0?void 0:t.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(o=e.forceUpgradeOnSignin)!==null&&o!==void 0?o:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var r,t,i,o,s,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(r=c.meetsMinPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(t=c.meetsMaxPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(o=c.containsUppercaseLetter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(s=c.containsNumericCharacter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,r){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(r.meetsMinPasswordLength=e.length>=t),i&&(r.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,r){this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);let t;for(let i=0;i<e.length;i++)t=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(r,t>="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,r,t,i,o){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=r)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=t)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=o))}};var gN=class{constructor(e,r,t,i){this.app=e,this.heartbeatServiceProvider=r,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new lI(this),this.idTokenSubscription=new lI(this),this.beforeStateQueue=new hN(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=JB,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=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(e,r){return r&&(this._popupRedirectResolver=cl(r)),this._initializationPromise=this.queue(()=>I(this,null,function*(){var t,i,o;if(!this._deleted&&(this.persistenceManager=yield cI.create(this,e),(t=this._resolvePersistenceManagerAvailable)===null||t===void 0||t.call(this),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{yield this._popupRedirectResolver._initialize(this)}catch{}yield this.initializeCurrentUser(r),this.lastNotifiedUid=((o=this.currentUser)===null||o===void 0?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}})),this._initializationPromise}_onStorageEvent(){return I(this,null,function*(){if(this._deleted)return;let e=yield this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),yield this.currentUser.getIdToken();return}yield this._updateCurrentUser(e,!0)}})}initializeCurrentUserFromIdToken(e){return I(this,null,function*(){try{let r=yield sI(this,{idToken:e}),t=yield Ia._fromGetAccountInfoResponse(this,r,e);yield this.directlySetCurrentUser(t)}catch(r){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",r),yield this.directlySetCurrentUser(null)}})}initializeCurrentUser(e){return I(this,null,function*(){var r;if(vr(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}let t=yield this.assertedPersistence.getCurrentUser(),i=t,o=!1;if(e&&this.config.authDomain){yield this.getOrInitRedirectPersistenceManager();let s=(r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId,a=i?._redirectEventId,c=yield this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(i=c.user,o=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(o)try{yield this.beforeStateQueue.runMiddleware(i)}catch(s){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return Xe(this._popupRedirectResolver,this,"argument-error"),yield this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)})}tryRedirectSignIn(e){return I(this,null,function*(){let r=null;try{r=yield this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{yield this._setRedirectUser(null)}return r})}reloadAndSetCurrentUserOrClear(e){return I(this,null,function*(){try{yield aI(e)}catch(r){if(r?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)})}useDeviceLanguage(){this.languageCode=gJ()}_delete(){return I(this,null,function*(){this._deleted=!0})}updateCurrentUser(e){return I(this,null,function*(){if(vr(this.app))return Promise.reject(Vg(this));let r=e?Ge(e):null;return r&&Xe(r.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(r&&r._clone(this))})}_updateCurrentUser(e,r=!1){return I(this,null,function*(){if(!this._deleted)return e&&Xe(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),r||(yield this.beforeStateQueue.runMiddleware(e)),this.queue(()=>I(this,null,function*(){yield this.directlySetCurrentUser(e),this.notifyAuthListeners()}))})}signOut(){return I(this,null,function*(){return vr(this.app)?Promise.reject(Vg(this)):(yield this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&(yield this._setRedirectUser(null)),this._updateCurrentUser(null,!0))})}setPersistence(e){return vr(this.app)?Promise.reject(Vg(this)):this.queue(()=>I(this,null,function*(){yield this.assertedPersistence.setPersistence(cl(e))}))}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}validatePassword(e){return I(this,null,function*(){this._getPasswordPolicyInternal()||(yield this._updatePasswordPolicy());let r=this._getPasswordPolicyInternal();return r.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):r.validatePassword(e)})}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}_updatePasswordPolicy(){return I(this,null,function*(){let e=yield LJ(this),r=new fN(e);this.tenantId===null?this._projectPasswordPolicy=r:this._tenantPasswordPolicies[this.tenantId]=r})}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new ki("auth","Firebase",e())}onAuthStateChanged(e,r,t){return this.registerStateListener(this.authStateSubscription,e,r,t)}beforeAuthStateChanged(e,r){return this.beforeStateQueue.pushCallback(e,r)}onIdTokenChanged(e,r,t){return this.registerStateListener(this.idTokenSubscription,e,r,t)}authStateReady(){return new Promise((e,r)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},r)}})}revokeAccessToken(e){return I(this,null,function*(){if(this.currentUser){let r=yield this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:r};this.tenantId!=null&&(t.tenantId=this.tenantId),yield AJ(this,t)}})}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}_setRedirectUser(e,r){return I(this,null,function*(){let t=yield this.getOrInitRedirectPersistenceManager(r);return e===null?t.removeCurrentUser():t.setCurrentUser(e)})}getOrInitRedirectPersistenceManager(e){return I(this,null,function*(){if(!this.redirectPersistenceManager){let r=e&&cl(e)||this._popupRedirectResolver;Xe(r,this,"argument-error"),this.redirectPersistenceManager=yield cI.create(this,[cl(r._redirectPersistence)],"redirectUser"),this.redirectUser=yield this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager})}_redirectUserForId(e){return I(this,null,function*(){var r,t;return this._isInitialized&&(yield this.queue(()=>I(this,null,function*(){}))),((r=this._currentUser)===null||r===void 0?void 0:r._redirectEventId)===e?this._currentUser:((t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId)===e?this.redirectUser:null})}_persistUserIfCurrent(e){return I(this,null,function*(){if(e===this.currentUser)return this.queue(()=>I(this,null,function*(){return this.directlySetCurrentUser(e)}))})}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,r;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(r=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&r!==void 0?r:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,r,t,i){if(this._deleted)return()=>{};let o=typeof r=="function"?r:r.next.bind(r),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Xe(a,this,"internal-error"),a.then(()=>{s||o(this.currentUser)}),typeof r=="function"){let c=e.addObserver(r,t,i);return()=>{s=!0,c()}}else{let c=e.addObserver(r);return()=>{s=!0,c()}}}directlySetCurrentUser(e){return I(this,null,function*(){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?yield this.assertedPersistence.setCurrentUser(e):yield this.assertedPersistence.removeCurrentUser()})}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Xe(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=cG(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getAdditionalHeaders(){return I(this,null,function*(){var e;let r={"X-Client-Version":this.clientVersion};this.app.options.appId&&(r["X-Firebase-gmpid"]=this.app.options.appId);let t=yield(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader();t&&(r["X-Firebase-Client"]=t);let i=yield this._getAppCheckToken();return i&&(r["X-Firebase-AppCheck"]=i),r})}_getAppCheckToken(){return I(this,null,function*(){var e;if(vr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let r=yield(e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken();return r?.error&&dJ(`Error while retrieving App Check token: ${r.error}`),r?.token})}};function lG(n){return Ge(n)}var lI=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=lB(r=>this.observer=r)}get next(){return Xe(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var PJ={loadJS(){return I(this,null,function*(){throw new Error("Unable to load external scripts")})},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function xJ(n){PJ=n}function FJ(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function SN(n,e){let r=Mo(n,"auth");if(r.isInitialized()){let i=r.getImmediate(),o=r.getOptions();if(Ui(o,e??{}))return i;rI(i,"already-initialized")}return r.initialize({options:e})}function kJ(n,e){let r=e?.persistence||[],t=(Array.isArray(r)?r:[r]).map(cl);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(t,e?.popupRedirectResolver)}var mN=class n{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static _fromIdTokenResponse(e,r,t,i=!1){return I(this,null,function*(){let o=yield Ia._fromIdTokenResponse(e,t,i),s=HB(t);return new n({user:o,providerId:s,_tokenResponse:t,operationType:r})})}static _forOperation(e,r,t){return I(this,null,function*(){yield e._updateTokensIfNecessary(t,!0);let i=HB(t);return new n({user:e,providerId:i,_tokenResponse:t,operationType:r})})}};function HB(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}function UJ(n,e){return I(this,null,function*(){return TJ(n,"POST","/v1/accounts:signInWithCustomToken",vN(n,e))})}function AN(n,e){return I(this,null,function*(){if(vr(n.app))return Promise.reject(Vg(n));let r=lG(n),t=yield UJ(r,{token:e,returnSecureToken:!0}),i=yield mN._fromIdTokenResponse(r,"signIn",t);return yield r._updateCurrentUser(i.user),i})}function gI(n,e,r,t){return Ge(n).onAuthStateChanged(e,r,t)}function DN(n){return Ge(n).signOut()}var uI="__sak";var dI=class{constructor(e,r){this.storageRetriever=e,this.type=r}_isAvailable(){try{return this.storage?(this.storage.setItem(uI,"1"),this.storage.removeItem(uI),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,r){return this.storage.setItem(e,JSON.stringify(r)),Promise.resolve()}_get(e){let r=this.storage.getItem(e);return Promise.resolve(r?JSON.parse(r):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var VJ=1e3,BJ=10,GJ=(()=>{class n extends dI{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(r,t)=>this.onStorageEvent(r,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=bJ(),this._shouldAllowMigration=!0}forAllChangedKeys(r){for(let t of Object.keys(this.listeners)){let i=this.storage.getItem(t),o=this.localCache[t];i!==o&&r(t,o,i)}}onStorageEvent(r,t=!1){if(!r.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}let i=r.key;t?this.detachListener():this.stopPolling();let o=()=>{let a=this.storage.getItem(i);!t&&this.localCache[i]===a||this.notifyListeners(i,a)},s=this.storage.getItem(i);wJ()&&s!==r.newValue&&r.newValue!==r.oldValue?setTimeout(o,BJ):o()}notifyListeners(r,t){this.localCache[r]=t;let i=this.listeners[r];if(i)for(let o of Array.from(i))o(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((r,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:r,oldValue:t,newValue:i}),!0)})},VJ)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(r,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[r]||(this.listeners[r]=new Set,this.localCache[r]=this.storage.getItem(r)),this.listeners[r].add(t)}_removeListener(r,t){this.listeners[r]&&(this.listeners[r].delete(t),this.listeners[r].size===0&&delete this.listeners[r]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}_set(r,t){return I(this,null,function*(){yield mc(n.prototype,this,"_set").call(this,r,t),this.localCache[r]=JSON.stringify(t)})}_get(r){return I(this,null,function*(){let t=yield mc(n.prototype,this,"_get").call(this,r);return this.localCache[r]=JSON.stringify(t),t})}_remove(r){return I(this,null,function*(){yield mc(n.prototype,this,"_remove").call(this,r),delete this.localCache[r]})}}return n.type="LOCAL",n})(),$J=GJ;var jJ=(()=>{class n extends dI{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(r,t){}_removeListener(r,t){}}return n.type="SESSION",n})(),HJ=jJ;function WJ(n){return Promise.all(n.map(e=>I(null,null,function*(){try{return{fulfilled:!0,value:yield e}}catch(r){return{fulfilled:!1,reason:r}}})))}var zJ=(()=>{class n{constructor(r){this.eventTarget=r,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(r){let t=this.receivers.find(o=>o.isListeningto(r));if(t)return t;let i=new n(r);return this.receivers.push(i),i}isListeningto(r){return this.eventTarget===r}handleEvent(r){return I(this,null,function*(){let t=r,{eventId:i,eventType:o,data:s}=t.data,a=this.handlersMap[o];if(!a?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:o});let c=Array.from(a).map(u=>I(this,null,function*(){return u(t.origin,s)})),l=yield WJ(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:o,response:l})})}_subscribe(r,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[r]||(this.handlersMap[r]=new Set),this.handlersMap[r].add(t)}_unsubscribe(r,t){this.handlersMap[r]&&t&&this.handlersMap[r].delete(t),(!t||this.handlersMap[r].size===0)&&delete this.handlersMap[r],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}n.receivers=[];return n})();function qJ(n="",e=10){let r="";for(let t=0;t<e;t++)r+=Math.floor(Math.random()*10);return n+r}var pN=class{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}_send(e,r,t=50){return I(this,null,function*(){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let o,s;return new Promise((a,c)=>{let l=qJ("",20);i.port1.start();let u=setTimeout(()=>{c(new Error("unsupported_event"))},t);s={messageChannel:i,onMessage(d){let f=d;if(f.data.eventId===l)switch(f.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(f.data.response);break;default:clearTimeout(u),clearTimeout(o),c(new Error("invalid_response"));break}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:l,data:r},[i.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})})}};function WB(){return window}function uG(){return typeof WB().WorkerGlobalScope<"u"&&typeof WB().importScripts=="function"}function KJ(){return I(this,null,function*(){if(!navigator?.serviceWorker)return null;try{return(yield navigator.serviceWorker.ready).active}catch{return null}})}function YJ(){var n;return((n=navigator?.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function QJ(){return uG()?self:null}var dG="firebaseLocalStorageDb",XJ=1,hI="firebaseLocalStorage",hG="fbase_key",ul=class{constructor(e){this.request=e}toPromise(){return new Promise((e,r)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{r(this.request.error)})})}};function mI(n,e){return n.transaction([hI],e?"readwrite":"readonly").objectStore(hI)}function JJ(){let n=indexedDB.deleteDatabase(dG);return new ul(n).toPromise()}function EN(){let n=indexedDB.open(dG,XJ);return new Promise((e,r)=>{n.addEventListener("error",()=>{r(n.error)}),n.addEventListener("upgradeneeded",()=>{let t=n.result;try{t.createObjectStore(hI,{keyPath:hG})}catch(i){r(i)}}),n.addEventListener("success",()=>I(null,null,function*(){let t=n.result;t.objectStoreNames.contains(hI)?e(t):(t.close(),yield JJ(),e(yield EN()))}))})}function zB(n,e,r){return I(this,null,function*(){let t=mI(n,!0).put({[hG]:e,value:r});return new ul(t).toPromise()})}function ZJ(n,e){return I(this,null,function*(){let r=mI(n,!1).get(e),t=yield new ul(r).toPromise();return t===void 0?null:t.value})}function qB(n,e){let r=mI(n,!0).delete(e);return new ul(r).toPromise()}var eZ=800,tZ=3,nZ=(()=>{class n{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}_openDb(){return I(this,null,function*(){return this.db?this.db:(this.db=yield EN(),this.db)})}_withRetries(r){return I(this,null,function*(){let t=0;for(;;)try{let i=yield this._openDb();return yield r(i)}catch(i){if(t++>tZ)throw i;this.db&&(this.db.close(),this.db=void 0)}})}initializeServiceWorkerMessaging(){return I(this,null,function*(){return uG()?this.initializeReceiver():this.initializeSender()})}initializeReceiver(){return I(this,null,function*(){this.receiver=zJ._getInstance(QJ()),this.receiver._subscribe("keyChanged",(r,t)=>I(this,null,function*(){return{keyProcessed:(yield this._poll()).includes(t.key)}})),this.receiver._subscribe("ping",(r,t)=>I(this,null,function*(){return["keyChanged"]}))})}initializeSender(){return I(this,null,function*(){var r,t;if(this.activeServiceWorker=yield KJ(),!this.activeServiceWorker)return;this.sender=new pN(this.activeServiceWorker);let i=yield this.sender._send("ping",{},800);i&&!((r=i[0])===null||r===void 0)&&r.fulfilled&&!((t=i[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)})}notifyServiceWorker(r){return I(this,null,function*(){if(!(!this.sender||!this.activeServiceWorker||YJ()!==this.activeServiceWorker))try{yield this.sender._send("keyChanged",{key:r},this.serviceWorkerReceiverAvailable?800:50)}catch{}})}_isAvailable(){return I(this,null,function*(){try{if(!indexedDB)return!1;let r=yield EN();return yield zB(r,uI,"1"),yield qB(r,uI),!0}catch{}return!1})}_withPendingWrite(r){return I(this,null,function*(){this.pendingWrites++;try{yield r()}finally{this.pendingWrites--}})}_set(r,t){return I(this,null,function*(){return this._withPendingWrite(()=>I(this,null,function*(){return yield this._withRetries(i=>zB(i,r,t)),this.localCache[r]=t,this.notifyServiceWorker(r)}))})}_get(r){return I(this,null,function*(){let t=yield this._withRetries(i=>ZJ(i,r));return this.localCache[r]=t,t})}_remove(r){return I(this,null,function*(){return this._withPendingWrite(()=>I(this,null,function*(){return yield this._withRetries(t=>qB(t,r)),delete this.localCache[r],this.notifyServiceWorker(r)}))})}_poll(){return I(this,null,function*(){let r=yield this._withRetries(o=>{let s=mI(o,!1).getAll();return new ul(s).toPromise()});if(!r)return[];if(this.pendingWrites!==0)return[];let t=[],i=new Set;if(r.length!==0)for(let{fbase_key:o,value:s}of r)i.add(o),JSON.stringify(this.localCache[o])!==JSON.stringify(s)&&(this.notifyListeners(o,s),t.push(o));for(let o of Object.keys(this.localCache))this.localCache[o]&&!i.has(o)&&(this.notifyListeners(o,null),t.push(o));return t})}notifyListeners(r,t){this.localCache[r]=t;let i=this.listeners[r];if(i)for(let o of Array.from(i))o(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>I(this,null,function*(){return this._poll()}),eZ)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(r,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[r]||(this.listeners[r]=new Set,this._get(r)),this.listeners[r].add(t)}_removeListener(r,t){this.listeners[r]&&(this.listeners[r].delete(t),this.listeners[r].size===0&&delete this.listeners[r]),Object.keys(this.listeners).length===0&&this.stopPolling()}}return n.type="LOCAL",n})(),rZ=nZ;var gLe=FJ("rcb"),mLe=new ll(3e4,6e4);var pLe=new ll(2e3,1e4);var ELe=600*1e3;var _Le=new ll(3e4,6e4);var TLe=new ll(5e3,15e3);var ILe=encodeURIComponent("fac");var KB="@firebase/auth",YB="1.10.8";var _N=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}getToken(e){return I(this,null,function*(){return this.assertAuthConfigured(),yield this.auth._initializationPromise,this.auth.currentUser?{accessToken:yield this.auth.currentUser.getIdToken(e)}:null})}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let r=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,r),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let r=this.internalListeners.get(e);r&&(this.internalListeners.delete(e),r(),this.updateProactiveRefresh())}assertAuthConfigured(){Xe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function iZ(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function oZ(n){lr(new _n("auth",(e,{options:r})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=t.options;Xe(s&&!s.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:s,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:cG(n)},l=new gN(t,i,o,c);return kJ(l,r),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,r,t)=>{e.getProvider("auth-internal").initialize()})),lr(new _n("auth-internal",e=>{let r=lG(e.getProvider("auth").getImmediate());return(t=>new _N(t))(r)},"PRIVATE").setInstantiationMode("EXPLICIT")),Qe(KB,YB,iZ(n)),Qe(KB,YB,"esm2017")}var sZ=300,vLe=eB("authIdTokenMaxAge")||sZ;function aZ(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}xJ({loadJS(n){return new Promise((e,r)=>{let t=document.createElement("script");t.setAttribute("src",n),t.onload=e,t.onerror=i=>{let o=TN("internal-error");o.customData=i,r(o)},t.type="text/javascript",t.charset="UTF-8",aZ().appendChild(t)})},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="});oZ("Browser");function mG(n){return new ge(function(e){var r=gI(n,e.next.bind(e),e.error.bind(e),e.complete.bind(e));return{unsubscribe:r}})}var pG="auth",dl=class{constructor(e){return e}},hl=class{constructor(){return Is(pG)}};var RN=new Z("angularfire2.auth-instances");function ZZ(n,e){let r=pa(pG,n,e);return r&&new dl(r)}function eee(n){return(e,r)=>{let t=e.runOutsideAngular(()=>n(r));return new dl(t)}}var tee={provide:hl,deps:[[new pn,RN]]},nee={provide:dl,useFactory:ZZ,deps:[[new pn,RN],Gi]};function _Me(n,...e){return Qe("angularfire",Vi.full,"auth"),mr([nee,tee,{provide:RN,useFactory:eee(n),multi:!0,deps:[be,St,Bi,vs,[new pn,_a],...e]}])}var wd=pe(mG,!0);var pI=pe(fI,!0);var TMe=pe(SN,!0);var EG=pe(AN,!0,2);var _G=pe(DN,!0,2);var iee="type.googleapis.com/google.protobuf.Int64Value",oee="type.googleapis.com/google.protobuf.UInt64Value";function yG(n,e){let r={};for(let t in n)n.hasOwnProperty(t)&&(r[t]=e(n[t]));return r}function EI(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>EI(e));if(typeof n=="function"||typeof n=="object")return yG(n,e=>EI(e));throw new Error("Data cannot be encoded in JSON: "+n)}function bd(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case iee:case oee:{let e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>bd(e)):typeof n=="function"||typeof n=="object"?yG(n,e=>bd(e)):n}var wN="functions";var TG={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"},Sr=class n extends Ir{constructor(e,r,t){super(`${wN}/${e}`,r||""),this.details=t,Object.setPrototypeOf(this,n.prototype)}};function see(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function _I(n,e){let r=see(n),t=r,i;try{let o=e&&e.error;if(o){let s=o.status;if(typeof s=="string"){if(!TG[s])return new Sr("internal","internal");r=TG[s],t=s}let a=o.message;typeof a=="string"&&(t=a),i=o.details,i!==void 0&&(i=bd(i))}}catch{}return r==="ok"?null:new Sr(r,t,i)}var CN=class{constructor(e,r,t,i){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,vr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=r.getImmediate({optional:!0}),this.messaging=t.getImmediate({optional:!0}),this.auth||r.get().then(o=>this.auth=o,()=>{}),this.messaging||t.get().then(o=>this.messaging=o,()=>{}),this.appCheck||i?.get().then(o=>this.appCheck=o,()=>{})}getAuthToken(){return I(this,null,function*(){if(this.auth)try{let e=yield this.auth.getToken();return e?.accessToken}catch{return}})}getMessagingToken(){return I(this,null,function*(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return yield this.messaging.getToken()}catch{return}})}getAppCheckToken(e){return I(this,null,function*(){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){let r=e?yield this.appCheck.getLimitedUseToken():yield this.appCheck.getToken();return r.error?null:r.token}return null})}getContext(e){return I(this,null,function*(){let r=yield this.getAuthToken(),t=yield this.getMessagingToken(),i=yield this.getAppCheckToken(e);return{authToken:r,messagingToken:t,appCheckToken:i}})}};var NN="us-central1",aee=/^data: (.*?)(?:\n|$)/;function cee(n){let e=null;return{promise:new Promise((r,t)=>{e=setTimeout(()=>{t(new Sr("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}var ON=class{constructor(e,r,t,i,o=NN,s=(...a)=>fetch(...a)){this.app=e,this.fetchImpl=s,this.emulatorOrigin=null,this.contextProvider=new CN(e,r,t,i),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{let a=new URL(o);this.customDomain=a.origin+(a.pathname==="/"?"":a.pathname),this.region=NN}catch{this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(e){let r=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${r}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${r}.cloudfunctions.net/${e}`}};function lee(n,e,r){let t=jr(e);n.emulatorOrigin=`http${t?"s":""}://${e}:${r}`,t&&(da(n.emulatorOrigin),ol("Functions",!0))}function uee(n,e,r){let t=i=>hee(n,e,i,r||{});return t.stream=(i,o)=>fee(n,e,i,o||{}),t}function dee(n,e,r,t){return I(this,null,function*(){r["Content-Type"]="application/json";let i;try{i=yield t(n,{method:"POST",body:JSON.stringify(e),headers:r})}catch{return{status:0,json:null}}let o=null;try{o=yield i.json()}catch{}return{status:i.status,json:o}})}function SG(n,e){return I(this,null,function*(){let r={},t=yield n.contextProvider.getContext(e.limitedUseAppCheckTokens);return t.authToken&&(r.Authorization="Bearer "+t.authToken),t.messagingToken&&(r["Firebase-Instance-ID-Token"]=t.messagingToken),t.appCheckToken!==null&&(r["X-Firebase-AppCheck"]=t.appCheckToken),r})}function hee(n,e,r,t){return I(this,null,function*(){r=EI(r);let i={data:r},o=yield SG(n,t),s=t.timeout||7e4,a=cee(s),c=yield Promise.race([dee(e,i,o,n.fetchImpl),a.promise,n.cancelAllRequests]);if(a.cancel(),!c)throw new Sr("cancelled","Firebase Functions instance was deleted.");let l=_I(c.status,c.json);if(l)throw l;if(!c.json)throw new Sr("internal","Response is not valid JSON object.");let u=c.json.data;if(typeof u>"u"&&(u=c.json.result),typeof u>"u")throw new Sr("internal","Response is missing data field.");return{data:bd(u)}})}function fee(n,e,r,t){return I(this,null,function*(){var i;r=EI(r);let o={data:r},s=yield SG(n,t);s["Content-Type"]="application/json",s.Accept="text/event-stream";let a;try{a=yield n.fetchImpl(e,{method:"POST",body:JSON.stringify(o),headers:s,signal:t?.signal})}catch(g){if(g instanceof Error&&g.name==="AbortError"){let _=new Sr("cancelled","Request was cancelled.");return{data:Promise.reject(_),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(_)}}}}}}let p=_I(0,null);return{data:Promise.reject(p),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(p)}}}}}}let c,l,u=new Promise((g,p)=>{c=g,l=p});(i=t?.signal)===null||i===void 0||i.addEventListener("abort",()=>{let g=new Sr("cancelled","Request was cancelled.");l(g)});let d=a.body.getReader(),f=gee(d,c,l,t?.signal);return{stream:{[Symbol.asyncIterator](){let g=f.getReader();return{next(){return I(this,null,function*(){let{value:_,done:T}=yield g.read();return{value:_,done:T}})},return(){return I(this,null,function*(){return yield g.cancel(),{done:!0,value:void 0}})}}}},data:u}})}function gee(n,e,r,t){let i=(s,a)=>{let c=s.match(aee);if(!c)return;let l=c[1];try{let u=JSON.parse(l);if("result"in u){e(bd(u.result));return}if("message"in u){a.enqueue(bd(u.message));return}if("error"in u){let d=_I(0,u);a.error(d),r(d);return}}catch(u){if(u instanceof Sr){a.error(u),r(u);return}}},o=new TextDecoder;return new ReadableStream({start(s){let a="";return c();function c(){return I(this,null,function*(){if(t?.aborted){let l=new Sr("cancelled","Request was cancelled");return s.error(l),r(l),Promise.resolve()}try{let{value:l,done:u}=yield n.read();if(u){a.trim()&&i(a.trim(),s),s.close();return}if(t?.aborted){let f=new Sr("cancelled","Request was cancelled");s.error(f),r(f),yield n.cancel();return}a+=o.decode(l,{stream:!0});let d=a.split(`
141
+ `);a=d.pop()||"";for(let f of d)f.trim()&&i(f.trim(),s);return c()}catch(l){let u=l instanceof Sr?l:_I(0,null);s.error(u),r(u)}})}},cancel(){return n.cancel()}})}var IG="@firebase/functions",vG="0.12.9";var mee="auth-internal",pee="app-check-internal",Eee="messaging-internal";function _ee(n){let e=(r,{instanceIdentifier:t})=>{let i=r.getProvider("app").getImmediate(),o=r.getProvider(mee),s=r.getProvider(Eee),a=r.getProvider(pee);return new ON(i,o,s,a,t)};lr(new _n(wN,e,"PUBLIC").setMultipleInstances(!0)),Qe(IG,vG,n),Qe(IG,vG,"esm2017")}function AG(n=yr(),e=NN){let t=Mo(Ge(n),wN).getImmediate({identifier:e}),i=Cd("functions");return i&&bN(t,...i),t}function bN(n,e,r){lee(Ge(n),e,r)}function DG(n,e,r){return uee(Ge(n),e,r)}_ee();var ur=class{constructor(e){return e}},RG="functions",LN=class{constructor(){return Is(RG)}};var MN=new Z("angularfire2.functions-instances");function Tee(n,e){let r=pa(RG,n,e);return r&&new ur(r)}function Iee(n){return(e,r)=>{let t=e.runOutsideAngular(()=>n(r));return new ur(t)}}var vee={provide:LN,deps:[[new pn,MN]]},yee={provide:ur,useFactory:Tee,deps:[[new pn,MN],Gi]};function kMe(n,...e){return Qe("angularfire",Vi.full,"fn"),mr([yee,vee,{provide:MN,useFactory:Iee(n),multi:!0,deps:[be,St,Bi,vs,[new pn,hl],[new pn,_a],...e]}])}var UMe=pe(bN,!0),VMe=pe(AG,!0);var Ar=pe(DG,!0);var Lt=(()=>{let e=class e{constructor(t,i){this.functions=t,this.serviceBook=i,this.sf=!1,this.defaultProperties={},this.draftEvents=[],this.liveStateSyncEvents=Object.values(L.Events.LiveStateSync||{}),this.eventRateLimitCache={},this.EVENT_LIMIT=50,this.TIME_WINDOW_MS=60*1e3,this.analyticsQueue=[],this.batchTimer=null,this.BATCH_WINDOW_MS=5*1e3,this.MAX_BATCH_SIZE=50,this.liveStateService=null;try{this.updateDefaultProperties({sdkVersion:$r()}),window?.location?.href&&(this.defaultProperties.pageUrl=window.location.href),this.serviceBook.observe(md).subscribe(o=>{this.commentService=o??void 0}),this.serviceBook.observe(AT).subscribe(o=>{this.reactionService=o??void 0}),this.serviceBook.observe(DT).subscribe(o=>{this.areaService=o??void 0}),this.serviceBook.observe(x1).subscribe(o=>{this.liveStateService=o??null})}catch(o){H.catch("Error in AnalyticsService constructor: ",o)}}updateDefaultProperties(t={}){this.defaultProperties=P(P({},this.defaultProperties),t)}setInstalledFeature(t){try{this.defaultProperties?.installedFeatures||(this.defaultProperties.installedFeatures=[]),this.defaultProperties.installedFeatures.includes(t)||this.defaultProperties.installedFeatures.push(t)}catch(i){H.catch("Error in AnalyticsService setInstalledFeature: ",i)}}setFeatureConfig({feature:t,config:i}){try{this.defaultProperties.featureConfigs||(this.defaultProperties.featureConfigs={}),this.defaultProperties.featureConfigs[t]||(this.defaultProperties.featureConfigs[t]={}),this.defaultProperties.featureConfigs[t]=P(P({},this.defaultProperties.featureConfigs[t]),i)}catch(o){H.catch("Error in AnalyticsService setFeatureConfig: ",o)}}setSF(t){try{this.sf=t}catch(i){H.catch("Error in AnalyticsService setSF: ",i)}}setAuthService(t){try{this.authService=t}catch(i){H.catch("Error in AnalyticsService setAuthService: ",i)}}setCommentService(t){try{this.commentService=t}catch(i){H.catch("Error in AnalyticsService setCommentService: ",i)}}setConfigService(t){try{this.configService=t}catch(i){H.catch("Error in AnalyticsService setConfigService: ",i)}}setDomService(t){try{this.domService=t}catch(i){H.catch("Error in AnalyticsService setDomService: ",i)}}setUserService(t){try{this.userService=t}catch(i){H.catch("Error in AnalyticsService setUserService: ",i)}}identifyUser(t,i,o={}){try{this.userId=t;let s=typeof i=="object"?JSON.parse(JSON.stringify(i)):i;this.userService?.externalUserDataProviderAvailable()&&s?.userId&&(s={userId:s.userId}),this.user=s;let a=this.defaultProperties?this.defaultProperties.apiKey:null;if(st.production||st.staging){let c=Date.now(),l={userId:t,clientUserId:this.user?.userId,traits:le(P({},s),{apiKey:a,forceReset:o?.forceReset,eventTimestamp:c}),properties:le(P({},this.defaultProperties),{eventTimestamp:c}),sf:this.sf,context:this.getContext(),eventTimestamp:c};this.setAnalytics("identify",l)}if(this.userId&&this.draftEvents?.length){let c=this.draftEvents?.slice();this.draftEvents=[],c?.forEach(l=>{l.type==="track"&&l?.data?.eventName&&this.trackEvent(l.data.eventName,l.data.properties,l.data.mergeDefaultProperties,l.data.userId,l.data.clientUserId)})}}catch(s){H.catch("Error in AnalyticsService identifyUser: ",s)}}trackPage(t,i="",o={}){try{if((st.production||st.staging)&&this.userId){let s={userId:this.userId,clientUserId:this.user?.userId,name:t,properties:o,sf:this.sf,context:this.getContext()};this.setAnalytics("page",s)}}catch(s){H.catch("Error in AnalyticsService trackPage: ",s)}}trackEvent(c){return I(this,arguments,function*(t,i={},o=!0,s,a){try{if(this.sf&&F1.includes(t))return Promise.resolve();if(st.production||st.staging)if(this.userId||s){if(this.eventRateLimitCache[t]?.blockedForSession)return Promise.resolve();let l=Date.now();if(this.eventRateLimitCache[t]&&l-this.eventRateLimitCache[t].timestamp<this.TIME_WINDOW_MS){if(this.eventRateLimitCache[t].count>=this.EVENT_LIMIT){if(!this.eventRateLimitCache[t].rateLimitExceededEventTriggered){this.eventRateLimitCache[t].rateLimitExceededEventTriggered=!0,this.eventRateLimitCache[t].blockedForSession=!0;let u=P({eventName:t},i||{});this.triggerTrackEvent(L.Events.Core.SDK_EVENT_RATE_LIMIT_EXCEEDED,u,o,s,a)}return Promise.resolve()}this.eventRateLimitCache[t].count++}else this.eventRateLimitCache[t]={count:1,timestamp:l,rateLimitExceededEventTriggered:!1,blockedForSession:!1};return this.triggerTrackEvent(t,i,o,s,a)}else return i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.draftEvents.push({type:"track",data:{eventName:t,properties:i,mergeDefaultProperties:o,userId:s,clientUserId:a}}),Promise.resolve();return Promise.resolve()}catch(l){return H.catch("Error in AnalyticsService trackEvent: ",l),Promise.resolve()}})}triggerTrackEvent(c){return I(this,arguments,function*(t,i={},o=!0,s,a){try{o&&(i||(i={}),i=P(P({},i),this.defaultProperties));let l;if(i?.annotationId){let d=i.annotationId;if(!l&&this.commentService){let f=this.commentService.getAnnotationById(d);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId);let g=this.commentService.getMultiThreadAnnotationById(d);g?.metadata&&(l=g.metadata),g?.targetElementId&&(i.targetElementId=g.targetElementId)}if(!l){let f=this.serviceBook.get(ST)?.getAnnotationById(d);f?.metadata&&(l=f.metadata)}if(!l&&this.reactionService){let f=this.reactionService.getAnnotationById(d);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId)}if(!l&&this.areaService){let f=this.areaService.getAnnotationById(d);f?.metadata&&(l=f.metadata)}}if(l&&typeof l=="object"&&(i=P(P({},i),l)),i&&typeof i=="object"&&(i=le(P({},i),{userId:this.userId||s,clientUserId:this.user?.userId||a}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),i?.sessionTabId||(i.sessionTabId=this.domService?.getTabId()),this.liveStateSyncEvents.includes(t))){let d=this.liveStateService?.getSemStats();d&&!i?.semStats&&(i.semStats=d)}let u={userId:this.userId||s,clientUserId:this.user?.userId||a,event:t,properties:i,sf:this.sf,context:this.getContext(),eventTimestamp:i?.eventTimestamp};return this.setAnalytics("track",u)}catch(l){return H.catch("Error in AnalyticsService triggerTrackEvent: ",l),Promise.resolve()}})}setAnalytics(t,i){return I(this,null,function*(){try{return navigator.onLine?new Promise((o,s)=>{this.analyticsQueue.push({type:t,body:i,resolve:o,reject:s}),this.analyticsQueue.length>=this.MAX_BATCH_SIZE?this.flushAnalyticsQueue():this.scheduleBatchFlush()}):void 0}catch(o){return H.catch("Error in AnalyticsService setAnalytics: ",o),Promise.resolve()}})}scheduleBatchFlush(){try{this.batchTimer||(this.batchTimer=setTimeout(()=>{this.batchTimer=null,this.flushAnalyticsQueue()},this.BATCH_WINDOW_MS))}catch(t){H.catch("Error in AnalyticsService scheduleBatchFlush: ",t)}}flushAnalyticsQueue(){return I(this,null,function*(){try{if(this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null),this.analyticsQueue.length===0||!navigator.onLine)return;let t=[...this.analyticsQueue];this.analyticsQueue=[];try{let i=Ar(this.functions,Tr({url:st.cloudFunction.sa,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),o=t.map(s=>({type:s.type,data:s.body}));try{yield i({type:"batch",data:o}),t.forEach(s=>{try{s.resolve&&s.resolve()}catch(a){H.warn("Error resolving analytics promise: ",a)}})}catch(s){H.warn("Error in AnalyticsService batch flush: ",s),t.forEach(a=>{try{a.reject&&a.reject(s)}catch(c){H.warn("Error rejecting analytics promise: ",c)}})}}catch(i){H.catch("Error in AnalyticsService flushAnalyticsQueue: ",i),t.forEach(o=>{try{o.reject&&o.reject(i)}catch(s){H.warn("Error rejecting analytics promise: ",s)}})}}catch(t){H.catch("Error in AnalyticsService flushAnalyticsQueue: ",t)}})}trackAuthenticatedEvent(t,i={},o=!0){try{this.authService?.getUser$&&typeof this.authService?.getUser$()?.subscribe=="function"&&(this.authService.getUser()?this.trackEvent(t,i,o):((!i||typeof i!="object")&&(i={}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.authService?.getUser$()?.pipe(Ct(s=>!!s),Nt(1))?.subscribe(()=>{this.trackEvent(t,i,o)})))}catch(s){H.catch("Error in AnalyticsService trackAuthenticatedEvent: ",s)}}getContext(){try{let t={},i=Rg();return t.os={name:i?.deviceInfo?.osName,version:i?.deviceInfo?.osVersion},t.page={path:i?.path,title:i?.title,url:i?.url},t.screen={height:i?.deviceInfo?.screenHeight,width:i?.deviceInfo?.screenWidth},t.app={name:i?.deviceInfo?.browserName,version:i?.deviceInfo?.browserVersion},t.device={type:i?.deviceInfo?.deviceType},t.timezone=UV(),t.userAgent=i?.deviceInfo?.userAgent,t}catch(t){H.catch("Error in AnalyticsService getContext: ",t)}}};e.\u0275fac=function(i){return new(i||e)(w(ur),w(ci))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var _e=(()=>{let e=class e{get debugMode(){return bV()}get debugContextMode(){return LV()}get logsEnabled(){return this.logsEnabled$.value}constructor(t){this.analyticsService=t,this.logsEnabled$=new Y(!0),this.log("%c[WB] Creating SERVICE LoggingService","color: blue;")}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(t){this.catch("Error in LoggingService enableLogs: ",t)}}disableLogs(){try{if(this.logsEnabled$.value===!1)return;this.logsEnabled$.next(!1)}catch(t){this.catch("Error in LoggingService disableLogs: ",t)}}log(t,...i){this.debugMode&&console.log(t,...i)}logContext(t,...i){this.debugContextMode&&console.log(t,...i)}warn(t,...i){this.debugMode&&console.warn(t,...i)}error(t,...i){this.debugMode&&console.error(t,...i)}debug(t,...i){this.debugMode&&console.debug(t,...i)}info(t,...i){this.debugMode&&console.info(t,...i)}catch(t,i,o,s=!1){try{let a=i?.message;this.logsEnabled$.value&&(a?.toLowerCase()?.includes("permission denied")||a?.toLowerCase()?.includes("permission_denied")||(i!==void 0?console.warn("Velt: ",t,i):console.warn("Velt: ",t))),s||this.analyticsService.trackEvent(L.Events.Core.SDK_ERROR,P({sourceMethod:t,message:(i?.message?i?.message:i)||t,clientUserId:this.analyticsService?.user?.userId,snippylyUserId:this.analyticsService?.user?.userSnippylyId,source:"sdk"},o||{}))}catch{}}};e.\u0275fac=function(i){return new(i||e)(w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var CG="@firebase/database",NG="1.0.20";var VO="";function See(n){VO=n}var GN=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,r){r==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),rn(r))}get(e){let r=this.domStorage_.getItem(this.prefixedName_(e));return r==null?null:Dd(r)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var $N=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,r){r==null?delete this.cache_[e]:this.cache_[e]=r}get(e){return di(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var s$=function(n){try{if(typeof window<"u"&&typeof window[n]<"u"){let e=window[n];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new GN(e)}}catch{}return new $N},gl=s$("localStorage"),jN=s$("sessionStorage");var xd=new hi("@firebase/database"),a$=(function(){let n=1;return function(){return n++}})(),c$=function(n){let e=uB(n),r=new HT;r.update(e);let t=r.digest();return Rd.encodeByteArray(t)},fm=function(...n){let e="";for(let r=0;r<n.length;r++){let t=n[r];Array.isArray(t)||t&&typeof t=="object"&&typeof t.length=="number"?e+=fm.apply(null,t):typeof t=="object"?e+=rn(t):e+=t,e+=" "}return e},ml=null,OG=!0,Aee=function(n,e){ee(!e||n===!0||n===!1,"Can't turn on custom loggers persistently."),n===!0?(xd.logLevel=xe.VERBOSE,ml=xd.log.bind(xd),e&&jN.set("logging_enabled",!0)):typeof n=="function"?ml=n:(ml=null,jN.remove("logging_enabled"))},On=function(...n){if(OG===!0&&(OG=!1,ml===null&&jN.get("logging_enabled")===!0&&Aee(!0)),ml){let e=fm.apply(null,n);ml(e)}},gm=function(n){return function(...e){On(n,...e)}},HN=function(...n){let e="FIREBASE INTERNAL ERROR: "+fm(...n);xd.error(e)},ys=function(...n){let e=`FIREBASE FATAL ERROR: ${fm(...n)}`;throw xd.error(e),new Error(e)},Jn=function(...n){let e="FIREBASE WARNING: "+fm(...n);xd.warn(e)},Dee=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&Jn("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},WI=function(n){return typeof n=="number"&&(n!==n||n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY)},Ree=function(n){if(bo()||document.readyState==="complete")n();else{let e=!1,r=function(){if(!document.body){setTimeout(r,Math.floor(10));return}e||(e=!0,n())};document.addEventListener?(document.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},El="[MIN_NAME]",Da="[MAX_NAME]",Sl=function(n,e){if(n===e)return 0;if(n===El||e===Da)return-1;if(e===El||n===Da)return 1;{let r=wG(n),t=wG(e);return r!==null?t!==null?r-t===0?n.length-e.length:r-t:-1:t!==null?1:n<e?-1:1}},Cee=function(n,e){return n===e?0:n<e?-1:1},zg=function(n,e){if(e&&n in e)return e[n];throw new Error("Missing required key ("+n+") in object: "+rn(e))},BO=function(n){if(typeof n!="object"||n===null)return rn(n);let e=[];for(let t in n)e.push(t);e.sort();let r="{";for(let t=0;t<e.length;t++)t!==0&&(r+=","),r+=rn(e[t]),r+=":",r+=BO(n[e[t]]);return r+="}",r},l$=function(n,e){let r=n.length;if(r<=e)return[n];let t=[];for(let i=0;i<r;i+=e)i+e>r?t.push(n.substring(i,r)):t.push(n.substring(i,i+e));return t};function wn(n,e){for(let r in n)n.hasOwnProperty(r)&&e(r,n[r])}var u$=function(n){ee(!WI(n),"Invalid JSON number");let e=11,r=52,t=(1<<e-1)-1,i,o,s,a,c;n===0?(o=0,s=0,i=1/n===-1/0?1:0):(i=n<0,n=Math.abs(n),n>=Math.pow(2,1-t)?(a=Math.min(Math.floor(Math.log(n)/Math.LN2),t),o=a+t,s=Math.round(n*Math.pow(2,r-a)-Math.pow(2,r))):(o=0,s=Math.round(n/Math.pow(2,1-t-r))));let l=[];for(c=r;c;c-=1)l.push(s%2?1:0),s=Math.floor(s/2);for(c=e;c;c-=1)l.push(o%2?1:0),o=Math.floor(o/2);l.push(i?1:0),l.reverse();let u=l.join(""),d="";for(c=0;c<64;c+=8){let f=parseInt(u.substr(c,8),2).toString(16);f.length===1&&(f="0"+f),d=d+f}return d.toLowerCase()},Nee=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},Oee=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function wee(n,e){let r="Unknown Error";n==="too_big"?r="The data requested exceeds the maximum size that can be accessed with a single request.":n==="permission_denied"?r="Client doesn't have permission to access the desired data.":n==="unavailable"&&(r="The service is unavailable");let t=new Error(n+" at "+e._path.toString()+": "+r);return t.code=n.toUpperCase(),t}var bee=new RegExp("^-?(0*)\\d{1,10}$"),Lee=-2147483648,Mee=2147483647,wG=function(n){if(bee.test(n)){let e=Number(n);if(e>=Lee&&e<=Mee)return e}return null},Hd=function(n){try{n()}catch(e){setTimeout(()=>{let r=e.stack||"";throw Jn("Exception was thrown by user callback.",r),e},Math.floor(0))}},Pee=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},Qg=function(n,e){let r=setTimeout(n,e);return typeof r=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(r):typeof r=="object"&&r.unref&&r.unref(),r};var WN=class{constructor(e,r){this.appCheckProvider=r,this.appName=e.name,vr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=r?.getImmediate({optional:!0}),this.appCheck||r?.get().then(t=>this.appCheck=t)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((r,t)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(r,t):r(null)},0)})}addTokenChangeListener(e){var r;(r=this.appCheckProvider)===null||r===void 0||r.get().then(t=>t.addTokenListener(e))}notifyForInvalidToken(){Jn(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}};var zN=class{constructor(e,r,t){this.appName_=e,this.firebaseOptions_=r,this.authProvider_=t,this.auth_=null,this.auth_=t.getImmediate({optional:!0}),this.auth_||t.onInit(i=>this.auth_=i)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(r=>r&&r.code==="auth/token-not-initialized"?(On("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(r)):new Promise((r,t)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(r,t):r(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(r=>r.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(r=>r.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Jn(e)}},Xg=(()=>{class n{constructor(r){this.accessToken=r}getToken(r){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(r){r(this.accessToken)}removeTokenChangeListener(r){}notifyForInvalidToken(){}}n.OWNER="owner";return n})(),II="5",d$="v",h$="s",f$="r",g$="f",m$=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,p$="ls",E$="p",qN="ac",_$="websocket",T$="long_polling";var vI=class{constructor(e,r,t,i,o=!1,s="",a=!1,c=!1,l=null){this.secure=r,this.namespace=t,this.webSocketOnly=i,this.nodeAdmin=o,this.persistenceKey=s,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=c,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=gl.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&gl.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",r=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${r}`}};function xee(n){return n.host!==n.internalHost||n.isCustomHost()||n.includeNamespaceInQueryParams}function I$(n,e,r){ee(typeof e=="string","typeof type must == string"),ee(typeof r=="object","typeof params must == object");let t;if(e===_$)t=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?";else if(e===T$)t=(n.secure?"https://":"http://")+n.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);xee(n)&&(r.ns=n.namespace);let i=[];return wn(r,(o,s)=>{i.push(o+"="+s)}),t+i.join("&")}var KN=class{constructor(){this.counters_={}}incrementCounter(e,r=1){di(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=r}get(){return XV(this.counters_)}};var PN={},xN={};function GO(n){let e=n.toString();return PN[e]||(PN[e]=new KN),PN[e]}function Fee(n,e){let r=n.toString();return xN[r]||(xN[r]=e()),xN[r]}var YN=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,r){this.closeAfterResponse=e,this.onClose=r,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,r){for(this.pendingResponses[e]=r;this.pendingResponses[this.currentResponseNum];){let t=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let i=0;i<t.length;++i)t[i]&&Hd(()=>{this.onMessage_(t[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var bG="start",kee="close",Uee="pLPCommand",Vee="pRTLPCB",v$="id",y$="pw",S$="ser",Bee="cb",Gee="seg",$ee="ts",jee="d",Hee="dframe",A$=1870,D$=30,Wee=A$-D$,zee=25e3,qee=3e4,yI=class n{constructor(e,r,t,i,o,s,a){this.connId=e,this.repoInfo=r,this.applicationId=t,this.appCheckToken=i,this.authToken=o,this.transportSessionId=s,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=gm(e),this.stats_=GO(r),this.urlFn=c=>(this.appCheckToken&&(c[qN]=this.appCheckToken),I$(r,T$,c))}open(e,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new YN(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(qee)),Ree(()=>{if(this.isClosed_)return;this.scriptTagHolder=new QN((...o)=>{let[s,a,c,l,u]=o;if(this.incrementIncomingBytes_(o),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,s===bG)this.id=a,this.password=c;else if(s===kee)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+s)},(...o)=>{let[s,a]=o;this.incrementIncomingBytes_(o),this.myPacketOrderer.handleResponse(s,a)},()=>{this.onClosed_()},this.urlFn);let t={};t[bG]="t",t[S$]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(t[Bee]=this.scriptTagHolder.uniqueCallbackIdentifier),t[d$]=II,this.transportSessionId&&(t[h$]=this.transportSessionId),this.lastSessionId&&(t[p$]=this.lastSessionId),this.applicationId&&(t[E$]=this.applicationId),this.appCheckToken&&(t[qN]=this.appCheckToken),typeof location<"u"&&location.hostname&&m$.test(location.hostname)&&(t[f$]=g$);let i=this.urlFn(t);this.log_("Connecting via long-poll to "+i),this.scriptTagHolder.addTag(i,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){n.forceAllow_=!0}static forceDisallow(){n.forceDisallow_=!0}static isAvailable(){return bo()?!1:n.forceAllow_?!0:!n.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!Nee()&&!Oee()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let r=rn(e);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);let t=xC(r),i=l$(t,Wee);for(let o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++}addDisconnectPingFrame(e,r){if(bo())return;this.myDisconnFrame=document.createElement("iframe");let t={};t[Hee]="t",t[v$]=e,t[y$]=r,this.myDisconnFrame.src=this.urlFn(t),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let r=rn(e).length;this.bytesReceived+=r,this.stats_.incrementCounter("bytes_received",r)}},QN=class n{constructor(e,r,t,i){if(this.onDisconnect=t,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0,bo())this.commandCB=e,this.onMessageCB=r;else{this.uniqueCallbackIdentifier=a$(),window[Uee+this.uniqueCallbackIdentifier]=e,window[Vee+this.uniqueCallbackIdentifier]=r,this.myIFrame=n.createIFrame_();let o="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(o='<script>document.domain="'+document.domain+'";<\/script>');let s="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(a){On("frame writing exception"),a.stack&&On(a.stack),On(a)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||On("No IE domain setting required")}catch{let t=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+t+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,r){for(this.myID=e,this.myPW=r,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;let e={};e[v$]=this.myID,e[y$]=this.myPW,e[S$]=this.currentSerial;let r=this.urlFn(e),t="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+D$+t.length<=A$;){let s=this.pendingSegs.shift();t=t+"&"+Gee+i+"="+s.seg+"&"+$ee+i+"="+s.ts+"&"+jee+i+"="+s.d,i++}return r=r+t,this.addLongPollTag_(r,this.currentSerial),!0}else return!1}enqueueSegment(e,r,t){this.pendingSegs.push({seg:e,ts:r,d:t}),this.alive&&this.newRequest_()}addLongPollTag_(e,r){this.outstandingRequests.add(r);let t=()=>{this.outstandingRequests.delete(r),this.newRequest_()},i=setTimeout(t,Math.floor(zee)),o=()=>{clearTimeout(i),t()};this.addTag(e,o)}addTag(e,r){bo()?this.doNodeLongPoll(e,r):setTimeout(()=>{try{if(!this.sendNewPolls)return;let t=this.myIFrame.doc.createElement("script");t.type="text/javascript",t.async=!0,t.src=e,t.onload=t.onreadystatechange=function(){let i=t.readyState;(!i||i==="loaded"||i==="complete")&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),r())},t.onerror=()=>{On("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(t)}catch{}},Math.floor(1))}};var Kee=16384,Yee=45e3,SI=null;typeof MozWebSocket<"u"?SI=MozWebSocket:typeof WebSocket<"u"&&(SI=WebSocket);var Md=(()=>{class n{constructor(r,t,i,o,s,a,c){this.connId=r,this.applicationId=i,this.appCheckToken=o,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=gm(this.connId),this.stats_=GO(t),this.connURL=n.connectionURL_(t,a,c,o,i),this.nodeAdmin=t.nodeAdmin}static connectionURL_(r,t,i,o,s){let a={};return a[d$]=II,!bo()&&typeof location<"u"&&location.hostname&&m$.test(location.hostname)&&(a[f$]=g$),t&&(a[h$]=t),i&&(a[p$]=i),o&&(a[qN]=o),s&&(a[E$]=s),I$(r,_$,a)}open(r,t){this.onDisconnect=t,this.onMessage=r,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,gl.set("previous_websocket_failure",!0);try{let i;if(bo()){let o=this.nodeAdmin?"AdminNode":"Node";i={headers:{"User-Agent":`Firebase/${II}/${VO}/${process.platform}/${o}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(i.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(i.headers["X-Firebase-AppCheck"]=this.appCheckToken);let s=process.env,a=this.connURL.indexOf("wss://")===0?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;a&&(i.proxy={origin:a})}this.mySock=new SI(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error. Closing connection.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){n.forceDisallow_=!0}static isAvailable(){let r=!1;if(typeof navigator<"u"&&navigator.userAgent){let t=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(t);i&&i.length>1&&parseFloat(i[1])<4.4&&(r=!0)}return!r&&SI!==null&&!n.forceDisallow_}static previouslyFailed(){return gl.isInMemoryStorage||gl.get("previous_websocket_failure")===!0}markConnectionHealthy(){gl.remove("previous_websocket_failure")}appendFrame_(r){if(this.frames.push(r),this.frames.length===this.totalFrames){let t=this.frames.join("");this.frames=null;let i=Dd(t);this.onMessage(i)}}handleNewFrameCount_(r){this.totalFrames=r,this.frames=[]}extractFrameCount_(r){if(ee(this.frames===null,"We already have a frame buffer"),r.length<=6){let t=Number(r);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),r}handleIncomingFrame(r){if(this.mySock===null)return;let t=r.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(t);else{let i=this.extractFrameCount_(t);i!==null&&this.appendFrame_(i)}}send(r){this.resetKeepAlive();let t=rn(r);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let i=l$(t,Kee);i.length>1&&this.sendString_(String(i.length));for(let o=0;o<i.length;o++)this.sendString_(i[o])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(Yee))}sendString_(r){try{this.mySock.send(r)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}n.responsesRequiredToBeHealthy=2,n.healthyTimeout=3e4;return n})(),R$=(()=>{class n{static get ALL_TRANSPORTS(){return[yI,Md]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(r){this.initTransports_(r)}initTransports_(r){let t=Md&&Md.isAvailable(),i=t&&!Md.previouslyFailed();if(r.webSocketOnly&&(t||Jn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[Md];else{let o=this.transports_=[];for(let s of n.ALL_TRANSPORTS)s&&s.isAvailable()&&o.push(s);n.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}n.globalTransportInitialized_=!1;return n})(),Qee=6e4,Xee=5e3,Jee=10*1024,Zee=100*1024,FN="t",LG="d",ete="s",MG="r",tte="e",PG="o",xG="a",FG="n",kG="p",nte="h",XN=class{constructor(e,r,t,i,o,s,a,c,l,u){this.id=e,this.repoInfo_=r,this.applicationId_=t,this.appCheckToken_=i,this.authToken_=o,this.onMessage_=s,this.onReady_=a,this.onDisconnect_=c,this.onKill_=l,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=gm("c:"+this.id+":"),this.transportManager_=new R$(r),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let r=this.connReceiver_(this.conn_),t=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(r,t)},Math.floor(0));let i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=Qg(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Zee?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Jee?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return r=>{e===this.conn_?this.onConnectionLost_(r):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return r=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(r):e===this.secondaryConn_?this.onSecondaryMessageReceived_(r):this.log_("message on old connection"))}}sendRequest(e){let r={t:"d",d:e};this.sendData_(r)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(FN in e){let r=e[FN];r===xG?this.upgradeIfSecondaryHealthy_():r===MG?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===PG&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let r=zg("t",e),t=zg("d",e);if(r==="c")this.onSecondaryControl_(t);else if(r==="d")this.pendingDataMessages.push(t);else throw new Error("Unknown protocol layer: "+r)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:kG,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:xG,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:FG,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let r=zg("t",e),t=zg("d",e);r==="c"?this.onControl_(t):r==="d"&&this.onDataMessage_(t)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let r=zg(FN,e);if(LG in e){let t=e[LG];if(r===nte){let i=Object.assign({},t);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(r===FG){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let i=0;i<this.pendingDataMessages.length;++i)this.onDataMessage_(this.pendingDataMessages[i]);this.pendingDataMessages=[],this.tryCleanupConnection()}else r===ete?this.onConnectionShutdown_(t):r===MG?this.onReset_(t):r===tte?HN("Server Error: "+t):r===PG?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):HN("Unknown control packet command: "+r)}}onHandshake_(e){let r=e.ts,t=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.host=i,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,r),II!==t&&Jn("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let r=this.connReceiver_(this.secondaryConn_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(r,t),Qg(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Qee))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,r){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(r,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Qg(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Xee))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:kG,d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(gl.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}};var AI=class{put(e,r,t,i){}merge(e,r,t,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,r,t){}onDisconnectMerge(e,r,t){}onDisconnectCancel(e,r){}reportStats(e){}};var DI=class{constructor(e){this.allowedEvents_=e,this.listeners_={},ee(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...r){if(Array.isArray(this.listeners_[e])){let t=[...this.listeners_[e]];for(let i=0;i<t.length;i++)t[i].callback.apply(t[i].context,r)}}on(e,r,t){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:r,context:t});let i=this.getInitialEvent(e);i&&r.apply(t,i)}off(e,r,t){this.validateEventType_(e);let i=this.listeners_[e]||[];for(let o=0;o<i.length;o++)if(i[o].callback===r&&(!t||t===i[o].context)){i.splice(o,1);return}}validateEventType_(e){ee(this.allowedEvents_.find(r=>r===e),"Unknown event: "+e)}};var RI=class n extends DI{static getInstance(){return new n}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!Og()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return ee(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var UG=32,VG=768,Ke=class{constructor(e,r){if(r===void 0){this.pieces_=e.split("/");let t=0;for(let i=0;i<this.pieces_.length;i++)this.pieces_[i].length>0&&(this.pieces_[t]=this.pieces_[i],t++);this.pieces_.length=t,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=r}toString(){let e="";for(let r=this.pieceNum_;r<this.pieces_.length;r++)this.pieces_[r]!==""&&(e+="/"+this.pieces_[r]);return e||"/"}};function qe(){return new Ke("")}function Fe(n){return n.pieceNum_>=n.pieces_.length?null:n.pieces_[n.pieceNum_]}function Ra(n){return n.pieces_.length-n.pieceNum_}function ht(n){let e=n.pieceNum_;return e<n.pieces_.length&&e++,new Ke(n.pieces_,e)}function $O(n){return n.pieceNum_<n.pieces_.length?n.pieces_[n.pieces_.length-1]:null}function rte(n){let e="";for(let r=n.pieceNum_;r<n.pieces_.length;r++)n.pieces_[r]!==""&&(e+="/"+encodeURIComponent(String(n.pieces_[r])));return e||"/"}function tm(n,e=0){return n.pieces_.slice(n.pieceNum_+e)}function C$(n){if(n.pieceNum_>=n.pieces_.length)return null;let e=[];for(let r=n.pieceNum_;r<n.pieces_.length-1;r++)e.push(n.pieces_[r]);return new Ke(e,0)}function Vt(n,e){let r=[];for(let t=n.pieceNum_;t<n.pieces_.length;t++)r.push(n.pieces_[t]);if(e instanceof Ke)for(let t=e.pieceNum_;t<e.pieces_.length;t++)r.push(e.pieces_[t]);else{let t=e.split("/");for(let i=0;i<t.length;i++)t[i].length>0&&r.push(t[i])}return new Ke(r,0)}function ke(n){return n.pieceNum_>=n.pieces_.length}function dr(n,e){let r=Fe(n),t=Fe(e);if(r===null)return e;if(r===t)return dr(ht(n),ht(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+n+")")}function ite(n,e){let r=tm(n,0),t=tm(e,0);for(let i=0;i<r.length&&i<t.length;i++){let o=Sl(r[i],t[i]);if(o!==0)return o}return r.length===t.length?0:r.length<t.length?-1:1}function jO(n,e){if(Ra(n)!==Ra(e))return!1;for(let r=n.pieceNum_,t=e.pieceNum_;r<=n.pieces_.length;r++,t++)if(n.pieces_[r]!==e.pieces_[t])return!1;return!0}function gi(n,e){let r=n.pieceNum_,t=e.pieceNum_;if(Ra(n)>Ra(e))return!1;for(;r<n.pieces_.length;){if(n.pieces_[r]!==e.pieces_[t])return!1;++r,++t}return!0}var JN=class{constructor(e,r){this.errorPrefix_=r,this.parts_=tm(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let t=0;t<this.parts_.length;t++)this.byteLength_+=Mg(this.parts_[t]);N$(this)}};function ote(n,e){n.parts_.length>0&&(n.byteLength_+=1),n.parts_.push(e),n.byteLength_+=Mg(e),N$(n)}function ste(n){let e=n.parts_.pop();n.byteLength_-=Mg(e),n.parts_.length>0&&(n.byteLength_-=1)}function N$(n){if(n.byteLength_>VG)throw new Error(n.errorPrefix_+"has a key path longer than "+VG+" bytes ("+n.byteLength_+").");if(n.parts_.length>UG)throw new Error(n.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+UG+") or object contains a cycle "+fl(n))}function fl(n){return n.parts_.length===0?"":"in property '"+n.parts_.join(".")+"'"}var ZN=class n extends DI{static getInstance(){return new n}constructor(){super(["visible"]);let e,r;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(r="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(r="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(r="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(r="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,r&&document.addEventListener(r,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}getInitialEvent(e){return ee(e==="visible","Unknown event type: "+e),[this.visible_]}};var qg=1e3,ate=300*1e3,BG=30*1e3,cte=1.3,lte=3e4,ute="server_kill",GG=3,HO=(()=>{class n extends AI{constructor(r,t,i,o,s,a,c,l){if(super(),this.repoInfo_=r,this.applicationId_=t,this.onDataUpdate_=i,this.onConnectStatus_=o,this.onServerInfoUpdate_=s,this.authTokenProvider_=a,this.appCheckTokenProvider_=c,this.authOverride_=l,this.id=n.nextPersistentConnectionId_++,this.log_=gm("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=qg,this.maxReconnectDelay_=ate,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!bo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");ZN.getInstance().on("visible",this.onVisible_,this),r.host.indexOf("fblocal")===-1&&RI.getInstance().on("online",this.onOnline_,this)}sendRequest(r,t,i){let o=++this.requestNumber_,s={r:o,a:r,b:t};this.log_(rn(s)),ee(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),i&&(this.requestCBHash_[o]=i)}get(r){this.initConnection_();let t=new Nn,o={action:"g",request:{p:r._path.toString(),q:r._queryObject},onComplete:a=>{let c=a.d;a.s==="ok"?t.resolve(c):t.reject(c)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;let s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),t.promise}listen(r,t,i,o){this.initConnection_();let s=r._queryIdentifier,a=r._path.toString();this.log_("Listen called for "+a+" "+s),this.listens.has(a)||this.listens.set(a,new Map),ee(r._queryParams.isDefault()||!r._queryParams.loadsAllData(),"listen() called for non-default but complete query"),ee(!this.listens.get(a).has(s),"listen() called twice for same path/queryId.");let c={onComplete:o,hashFn:t,query:r,tag:i};this.listens.get(a).set(s,c),this.connected_&&this.sendListen_(c)}sendGet_(r){let t=this.outstandingGets_[r];this.sendRequest("g",t.request,i=>{delete this.outstandingGets_[r],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(i)})}sendListen_(r){let t=r.query,i=t._path.toString(),o=t._queryIdentifier;this.log_("Listen on "+i+" for "+o);let s={p:i},a="q";r.tag&&(s.q=t._queryObject,s.t=r.tag),s.h=r.hashFn(),this.sendRequest(a,s,c=>{let l=c.d,u=c.s;n.warnOnListenWarnings_(l,t),(this.listens.get(i)&&this.listens.get(i).get(o))===r&&(this.log_("listen response",c),u!=="ok"&&this.removeListen_(i,o),r.onComplete&&r.onComplete(u,l))})}static warnOnListenWarnings_(r,t){if(r&&typeof r=="object"&&di(r,"w")){let i=ha(r,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){let o='".indexOn": "'+t._queryParams.getIndex().toString()+'"',s=t._path.toString();Jn(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(r){this.authToken_=r,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(r)}reduceReconnectDelayIfAdminCredential_(r){(r&&r.length===40||cB(r))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=BG)}refreshAppCheckToken(r){this.appCheckToken_=r,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let r=this.authToken_,t=aB(r)?"auth":"gauth",i={cred:r};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(t,i,o=>{let s=o.s,a=o.d||"error";this.authToken_===r&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},r=>{let t=r.s,i=r.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,i)})}unlisten(r,t){let i=r._path.toString(),o=r._queryIdentifier;this.log_("Unlisten called for "+i+" "+o),ee(r._queryParams.isDefault()||!r._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,o)&&this.connected_&&this.sendUnlisten_(i,o,r._queryObject,t)}sendUnlisten_(r,t,i,o){this.log_("Unlisten on "+r+" for "+t);let s={p:r},a="n";o&&(s.q=i,s.t=o),this.sendRequest(a,s)}onDisconnectPut(r,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",r,t,i):this.onDisconnectRequestQueue_.push({pathString:r,action:"o",data:t,onComplete:i})}onDisconnectMerge(r,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",r,t,i):this.onDisconnectRequestQueue_.push({pathString:r,action:"om",data:t,onComplete:i})}onDisconnectCancel(r,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",r,null,t):this.onDisconnectRequestQueue_.push({pathString:r,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(r,t,i,o){let s={p:t,d:i};this.log_("onDisconnect "+r,s),this.sendRequest(r,s,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(r,t,i,o){this.putInternal("p",r,t,i,o)}merge(r,t,i,o){this.putInternal("m",r,t,i,o)}putInternal(r,t,i,o,s){this.initConnection_();let a={p:t,d:i};s!==void 0&&(a.h=s),this.outstandingPuts_.push({action:r,request:a,onComplete:o}),this.outstandingPutCount_++;let c=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(c):this.log_("Buffering put: "+t)}sendPut_(r){let t=this.outstandingPuts_[r].action,i=this.outstandingPuts_[r].request,o=this.outstandingPuts_[r].onComplete;this.outstandingPuts_[r].queued=this.connected_,this.sendRequest(t,i,s=>{this.log_(t+" response",s),delete this.outstandingPuts_[r],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(s.s,s.d)})}reportStats(r){if(this.connected_){let t={c:r};this.log_("reportStats",t),this.sendRequest("s",t,i=>{if(i.s!=="ok"){let s=i.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(r){if("r"in r){this.log_("from server: "+rn(r));let t=r.r,i=this.requestCBHash_[t];i&&(delete this.requestCBHash_[t],i(r.b))}else{if("error"in r)throw"A server-side error has occurred: "+r.error;"a"in r&&this.onDataPush_(r.a,r.b)}}onDataPush_(r,t){this.log_("handleServerMessage",r,t),r==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):r==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):r==="c"?this.onListenRevoked_(t.p,t.q):r==="ac"?this.onAuthRevoked_(t.s,t.d):r==="apc"?this.onAppCheckRevoked_(t.s,t.d):r==="sd"?this.onSecurityDebugPacket_(t):HN("Unrecognized action received from server: "+rn(r)+`
142
+ Are you using the latest client?`)}onReady_(r,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(r),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(r){ee(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(r))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(r){r&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=qg,this.realtime_||this.scheduleConnect_(0)),this.visible_=r}onOnline_(r){r?(this.log_("Browser went online."),this.reconnectDelay_=qg,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>lte&&(this.reconnectDelay_=qg),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let r=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),t=Math.max(0,this.reconnectDelay_-r);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*cte)}this.onConnectStatus_(!1)}establishConnection_(){return I(this,null,function*(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let r=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+n.nextConnectionId_++,s=this.lastSessionId,a=!1,c=null,l=function(){c?c.close():(a=!0,i())},u=function(f){ee(c,"sendRequest call when we're not connected not allowed."),c.sendRequest(f)};this.realtime_={close:l,sendRequest:u};let d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[f,g]=yield Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);a?On("getToken() completed but was canceled"):(On("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=g&&g.token,c=new XN(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,r,t,i,p=>{Jn(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(ute)},s))}catch(f){this.log_("Failed to get token: "+f),a||(this.repoInfo_.nodeAdmin&&Jn(f),l())}}})}interrupt(r){On("Interrupting connection for reason: "+r),this.interruptReasons_[r]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(r){On("Resuming connection for reason: "+r),delete this.interruptReasons_[r],wg(this.interruptReasons_)&&(this.reconnectDelay_=qg,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(r){let t=r-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let r=0;r<this.outstandingPuts_.length;r++){let t=this.outstandingPuts_[r];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[r],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(r,t){let i;t?i=t.map(s=>BO(s)).join("$"):i="default";let o=this.removeListen_(r,i);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(r,t){let i=new Ke(r).toString(),o;if(this.listens.has(i)){let s=this.listens.get(i);o=s.get(t),s.delete(t),s.size===0&&this.listens.delete(i)}else o=void 0;return o}onAuthRevoked_(r,t){On("Auth token revoked: "+r+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(r==="invalid_token"||r==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=GG&&(this.reconnectDelay_=BG,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(r,t){On("App check token revoked: "+r+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(r==="invalid_token"||r==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=GG&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(r){this.securityDebugCallback_?this.securityDebugCallback_(r):"msg"in r&&console.log("FIREBASE: "+r.msg.replace(`
143
+ `,`
144
+ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(let r of this.listens.values())for(let t of r.values())this.sendListen_(t);for(let r=0;r<this.outstandingPuts_.length;r++)this.outstandingPuts_[r]&&this.sendPut_(r);for(;this.onDisconnectRequestQueue_.length;){let r=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(r.action,r.pathString,r.data,r.onComplete)}for(let r=0;r<this.outstandingGets_.length;r++)this.outstandingGets_[r]&&this.sendGet_(r)}sendConnectStats_(){let r={},t="js";bo()&&(this.repoInfo_.nodeAdmin?t="admin_node":t="node"),r["sdk."+t+"."+VO.replace(/\./g,"-")]=1,Og()?r["framework.cordova"]=1:KT()&&(r["framework.reactnative"]=1),this.reportStats(r)}shouldReconnect_(){let r=RI.getInstance().currentlyOnline();return wg(this.interruptReasons_)&&r}}n.nextPersistentConnectionId_=0,n.nextConnectionId_=0;return n})(),Ve=class n{constructor(e,r){this.name=e,this.node=r}static Wrap(e,r){return new n(e,r)}};var Fd=class{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,r){let t=new Ve(El,e),i=new Ve(El,r);return this.compare(t,i)!==0}minPost(){return Ve.MIN}};var TI,CI=class extends Fd{static get __EMPTY_NODE(){return TI}static set __EMPTY_NODE(e){TI=e}compare(e,r){return Sl(e.name,r.name)}isDefinedOn(e){throw il("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,r){return!1}minPost(){return Ve.MIN}maxPost(){return new Ve(Da,TI)}makePost(e,r){return ee(typeof e=="string","KeyIndex indexValue must always be a string."),new Ve(e,TI)}toString(){return".key"}},pl=new CI;var Pd=class{constructor(e,r,t,i,o=null){this.isReverse_=i,this.resultGenerator_=o,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(e=e,s=r?t(e.key,r):1,i&&(s*=-1),s<0)this.isReverse_?e=e.left:e=e.right;else if(s===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),r;if(this.resultGenerator_?r=this.resultGenerator_(e.key,e.value):r={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return r}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}},ji=(()=>{class n{constructor(r,t,i,o,s){this.key=r,this.value=t,this.color=i??n.RED,this.left=o??mi.EMPTY_NODE,this.right=s??mi.EMPTY_NODE}copy(r,t,i,o,s){return new n(r??this.key,t??this.value,i??this.color,o??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(r){return this.left.inorderTraversal(r)||!!r(this.key,this.value)||this.right.inorderTraversal(r)}reverseTraversal(r){return this.right.reverseTraversal(r)||r(this.key,this.value)||this.left.reverseTraversal(r)}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(r,t,i){let o=this,s=i(r,o.key);return s<0?o=o.copy(null,null,null,o.left.insert(r,t,i),null):s===0?o=o.copy(null,t,null,null,null):o=o.copy(null,null,null,null,o.right.insert(r,t,i)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return mi.EMPTY_NODE;let r=this;return!r.left.isRed_()&&!r.left.left.isRed_()&&(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.removeMin_(),null),r.fixUp_()}remove(r,t){let i,o;if(i=this,t(r,i.key)<0)!i.left.isEmpty()&&!i.left.isRed_()&&!i.left.left.isRed_()&&(i=i.moveRedLeft_()),i=i.copy(null,null,null,i.left.remove(r,t),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),t(r,i.key)===0){if(i.right.isEmpty())return mi.EMPTY_NODE;o=i.right.min_(),i=i.copy(o.key,o.value,null,null,i.right.removeMin_())}i=i.copy(null,null,null,null,i.right.remove(r,t))}return i.fixUp_()}isRed_(){return this.color}fixUp_(){let r=this;return r.right.isRed_()&&!r.left.isRed_()&&(r=r.rotateLeft_()),r.left.isRed_()&&r.left.left.isRed_()&&(r=r.rotateRight_()),r.left.isRed_()&&r.right.isRed_()&&(r=r.colorFlip_()),r}moveRedLeft_(){let r=this.colorFlip_();return r.right.left.isRed_()&&(r=r.copy(null,null,null,null,r.right.rotateRight_()),r=r.rotateLeft_(),r=r.colorFlip_()),r}moveRedRight_(){let r=this.colorFlip_();return r.left.left.isRed_()&&(r=r.rotateRight_(),r=r.colorFlip_()),r}rotateLeft_(){let r=this.copy(null,null,n.RED,null,this.right.left);return this.right.copy(null,null,this.color,r,null)}rotateRight_(){let r=this.copy(null,null,n.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,r)}colorFlip_(){let r=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,r,t)}checkMaxDepth_(){let r=this.check_();return Math.pow(2,r)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");let r=this.left.check_();if(r!==this.right.check_())throw new Error("Black depths differ");return r+(this.isRed_()?0:1)}}return n.RED=!0,n.BLACK=!1,n})(),eO=class{copy(e,r,t,i,o){return this}insert(e,r,t){return new ji(e,r,null)}remove(e,r){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}},mi=class n{constructor(e,r=n.EMPTY_NODE){this.comparator_=e,this.root_=r}insert(e,r){return new n(this.comparator_,this.root_.insert(e,r,this.comparator_).copy(null,null,ji.BLACK,null,null))}remove(e){return new n(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,ji.BLACK,null,null))}get(e){let r,t=this.root_;for(;!t.isEmpty();){if(r=this.comparator_(e,t.key),r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}getPredecessorKey(e){let r,t=this.root_,i=null;for(;!t.isEmpty();)if(r=this.comparator_(e,t.key),r===0){if(t.left.isEmpty())return i?i.key:null;for(t=t.left;!t.right.isEmpty();)t=t.right;return t.key}else r<0?t=t.left:r>0&&(i=t,t=t.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new Pd(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,r){return new Pd(this.root_,e,this.comparator_,!1,r)}getReverseIteratorFrom(e,r){return new Pd(this.root_,e,this.comparator_,!0,r)}getReverseIterator(e){return new Pd(this.root_,null,this.comparator_,!0,e)}};mi.EMPTY_NODE=new eO;function dte(n,e){return Sl(n.name,e.name)}function WO(n,e){return Sl(n,e)}var tO;function hte(n){tO=n}var O$=function(n){return typeof n=="number"?"number:"+u$(n):"string:"+n},w$=function(n){if(n.isLeafNode()){let e=n.val();ee(typeof e=="string"||typeof e=="number"||typeof e=="object"&&di(e,".sv"),"Priority must be a string or number.")}else ee(n===tO||n.isEmpty(),"priority of unexpected type.");ee(n===tO||n.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};var $G,kd=(()=>{class n{static set __childrenNodeConstructor(r){$G=r}static get __childrenNodeConstructor(){return $G}constructor(r,t=n.__childrenNodeConstructor.EMPTY_NODE){this.value_=r,this.priorityNode_=t,this.lazyHash_=null,ee(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),w$(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(r){return new n(this.value_,r)}getImmediateChild(r){return r===".priority"?this.priorityNode_:n.__childrenNodeConstructor.EMPTY_NODE}getChild(r){return ke(r)?this:Fe(r)===".priority"?this.priorityNode_:n.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(r,t){return null}updateImmediateChild(r,t){return r===".priority"?this.updatePriority(t):t.isEmpty()&&r!==".priority"?this:n.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(r,t).updatePriority(this.priorityNode_)}updateChild(r,t){let i=Fe(r);return i===null?t:t.isEmpty()&&i!==".priority"?this:(ee(i!==".priority"||Ra(r)===1,".priority must be the last token in a path"),this.updateImmediateChild(i,n.__childrenNodeConstructor.EMPTY_NODE.updateChild(ht(r),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(r,t){return!1}val(r){return r&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let r="";this.priorityNode_.isEmpty()||(r+="priority:"+O$(this.priorityNode_.val())+":");let t=typeof this.value_;r+=t+":",t==="number"?r+=u$(this.value_):r+=this.value_,this.lazyHash_=c$(r)}return this.lazyHash_}getValue(){return this.value_}compareTo(r){return r===n.__childrenNodeConstructor.EMPTY_NODE?1:r instanceof n.__childrenNodeConstructor?-1:(ee(r.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(r))}compareToLeafNode_(r){let t=typeof r.value_,i=typeof this.value_,o=n.VALUE_TYPE_ORDER.indexOf(t),s=n.VALUE_TYPE_ORDER.indexOf(i);return ee(o>=0,"Unknown leaf type: "+t),ee(s>=0,"Unknown leaf type: "+i),o===s?i==="object"?0:this.value_<r.value_?-1:this.value_===r.value_?0:1:s-o}withIndex(){return this}isIndexed(){return!0}equals(r){if(r===this)return!0;if(r.isLeafNode()){let t=r;return this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_)}else return!1}}n.VALUE_TYPE_ORDER=["object","boolean","number","string"];return n})(),b$,L$;function fte(n){b$=n}function gte(n){L$=n}var nO=class extends Fd{compare(e,r){let t=e.node.getPriority(),i=r.node.getPriority(),o=t.compareTo(i);return o===0?Sl(e.name,r.name):o}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,r){return!e.getPriority().equals(r.getPriority())}minPost(){return Ve.MIN}maxPost(){return new Ve(Da,new kd("[PRIORITY-POST]",L$))}makePost(e,r){let t=b$(e);return new Ve(r,new kd("[PRIORITY-POST]",t))}toString(){return".priority"}},At=new nO;var mte=Math.log(2),rO=class{constructor(e){let r=o=>parseInt(Math.log(o)/mte,10),t=o=>parseInt(Array(o+1).join("1"),2);this.count=r(e+1),this.current_=this.count-1;let i=t(this.count);this.bits_=e+1&i}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}},NI=function(n,e,r,t){n.sort(e);let i=function(c,l){let u=l-c,d,f;if(u===0)return null;if(u===1)return d=n[c],f=r?r(d):d,new ji(f,d.node,ji.BLACK,null,null);{let g=parseInt(u/2,10)+c,p=i(c,g),_=i(g+1,l);return d=n[g],f=r?r(d):d,new ji(f,d.node,ji.BLACK,p,_)}},o=function(c){let l=null,u=null,d=n.length,f=function(p,_){let T=d-p,S=d;d-=p;let b=i(T+1,S),B=n[T],x=r?r(B):B;g(new ji(x,B.node,_,null,b))},g=function(p){l?(l.left=p,l=p):(u=p,l=p)};for(let p=0;p<c.count;++p){let _=c.nextBitIsOne(),T=Math.pow(2,c.count-(p+1));_?f(T,ji.BLACK):(f(T,ji.BLACK),f(T,ji.RED))}return u},s=new rO(n.length),a=o(s);return new mi(t||e,a)};var kN,Ld={},Ud=class n{static get Default(){return ee(Ld&&At,"ChildrenNode.ts has not been loaded"),kN=kN||new n({".priority":Ld},{".priority":At}),kN}constructor(e,r){this.indexes_=e,this.indexSet_=r}get(e){let r=ha(this.indexes_,e);if(!r)throw new Error("No index defined for "+e);return r instanceof mi?r:null}hasIndex(e){return di(this.indexSet_,e.toString())}addIndex(e,r){ee(e!==pl,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let t=[],i=!1,o=r.getIterator(Ve.Wrap),s=o.getNext();for(;s;)i=i||e.isDefinedOn(s.node),t.push(s),s=o.getNext();let a;i?a=NI(t,e.getCompare()):a=Ld;let c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;let u=Object.assign({},this.indexes_);return u[c]=a,new n(u,l)}addToIndexes(e,r){let t=bg(this.indexes_,(i,o)=>{let s=ha(this.indexSet_,o);if(ee(s,"Missing index implementation for "+o),i===Ld)if(s.isDefinedOn(e.node)){let a=[],c=r.getIterator(Ve.Wrap),l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),NI(a,s.getCompare())}else return Ld;else{let a=r.get(e.name),c=i;return a&&(c=c.remove(new Ve(e.name,a))),c.insert(e,e.node)}});return new n(t,this.indexSet_)}removeFromIndexes(e,r){let t=bg(this.indexes_,i=>{if(i===Ld)return i;{let o=r.get(e.name);return o?i.remove(new Ve(e.name,o)):i}});return new n(t,this.indexSet_)}};var Kg,Ne=(()=>{class n{static get EMPTY_NODE(){return Kg||(Kg=new n(new mi(WO),null,Ud.Default))}constructor(r,t,i){this.children_=r,this.priorityNode_=t,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&w$(this.priorityNode_),this.children_.isEmpty()&&ee(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Kg}updatePriority(r){return this.children_.isEmpty()?this:new n(this.children_,r,this.indexMap_)}getImmediateChild(r){if(r===".priority")return this.getPriority();{let t=this.children_.get(r);return t===null?Kg:t}}getChild(r){let t=Fe(r);return t===null?this:this.getImmediateChild(t).getChild(ht(r))}hasChild(r){return this.children_.get(r)!==null}updateImmediateChild(r,t){if(ee(t,"We should always be passing snapshot nodes"),r===".priority")return this.updatePriority(t);{let i=new Ve(r,t),o,s;t.isEmpty()?(o=this.children_.remove(r),s=this.indexMap_.removeFromIndexes(i,this.children_)):(o=this.children_.insert(r,t),s=this.indexMap_.addToIndexes(i,this.children_));let a=o.isEmpty()?Kg:this.priorityNode_;return new n(o,a,s)}}updateChild(r,t){let i=Fe(r);if(i===null)return t;{ee(Fe(r)!==".priority"||Ra(r)===1,".priority must be the last token in a path");let o=this.getImmediateChild(i).updateChild(ht(r),t);return this.updateImmediateChild(i,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(r){if(this.isEmpty())return null;let t={},i=0,o=0,s=!0;if(this.forEachChild(At,(a,c)=>{t[a]=c.val(r),i++,s&&n.INTEGER_REGEXP_.test(a)?o=Math.max(o,Number(a)):s=!1}),!r&&s&&o<2*i){let a=[];for(let c in t)a[c]=t[c];return a}else return r&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let r="";this.getPriority().isEmpty()||(r+="priority:"+O$(this.getPriority().val())+":"),this.forEachChild(At,(t,i)=>{let o=i.hash();o!==""&&(r+=":"+t+":"+o)}),this.lazyHash_=r===""?"":c$(r)}return this.lazyHash_}getPredecessorChildName(r,t,i){let o=this.resolveIndex_(i);if(o){let s=o.getPredecessorKey(new Ve(r,t));return s?s.name:null}else return this.children_.getPredecessorKey(r)}getFirstChildName(r){let t=this.resolveIndex_(r);if(t){let i=t.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(r){let t=this.getFirstChildName(r);return t?new Ve(t,this.children_.get(t)):null}getLastChildName(r){let t=this.resolveIndex_(r);if(t){let i=t.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(r){let t=this.getLastChildName(r);return t?new Ve(t,this.children_.get(t)):null}forEachChild(r,t){let i=this.resolveIndex_(r);return i?i.inorderTraversal(o=>t(o.name,o.node)):this.children_.inorderTraversal(t)}getIterator(r){return this.getIteratorFrom(r.minPost(),r)}getIteratorFrom(r,t){let i=this.resolveIndex_(t);if(i)return i.getIteratorFrom(r,o=>o);{let o=this.children_.getIteratorFrom(r.name,Ve.Wrap),s=o.peek();for(;s!=null&&t.compare(s,r)<0;)o.getNext(),s=o.peek();return o}}getReverseIterator(r){return this.getReverseIteratorFrom(r.maxPost(),r)}getReverseIteratorFrom(r,t){let i=this.resolveIndex_(t);if(i)return i.getReverseIteratorFrom(r,o=>o);{let o=this.children_.getReverseIteratorFrom(r.name,Ve.Wrap),s=o.peek();for(;s!=null&&t.compare(s,r)>0;)o.getNext(),s=o.peek();return o}}compareTo(r){return this.isEmpty()?r.isEmpty()?0:-1:r.isLeafNode()||r.isEmpty()?1:r===mm?-1:0}withIndex(r){if(r===pl||this.indexMap_.hasIndex(r))return this;{let t=this.indexMap_.addIndex(r,this.children_);return new n(this.children_,this.priorityNode_,t)}}isIndexed(r){return r===pl||this.indexMap_.hasIndex(r)}equals(r){if(r===this)return!0;if(r.isLeafNode())return!1;{let t=r;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){let i=this.getIterator(At),o=t.getIterator(At),s=i.getNext(),a=o.getNext();for(;s&&a;){if(s.name!==a.name||!s.node.equals(a.node))return!1;s=i.getNext(),a=o.getNext()}return s===null&&a===null}else return!1;else return!1}}resolveIndex_(r){return r===pl?null:this.indexMap_.get(r.toString())}}return n.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,n})(),iO=class extends Ne{constructor(){super(new mi(WO),Ne.EMPTY_NODE,Ud.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return Ne.EMPTY_NODE}isEmpty(){return!1}},mm=new iO;Object.defineProperties(Ve,{MIN:{value:new Ve(El,Ne.EMPTY_NODE)},MAX:{value:new Ve(Da,mm)}});CI.__EMPTY_NODE=Ne.EMPTY_NODE;kd.__childrenNodeConstructor=Ne;hte(mm);gte(mm);var pte=!0;function Ut(n,e=null){if(n===null)return Ne.EMPTY_NODE;if(typeof n=="object"&&".priority"in n&&(e=n[".priority"]),ee(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof n=="object"&&".value"in n&&n[".value"]!==null&&(n=n[".value"]),typeof n!="object"||".sv"in n){let r=n;return new kd(r,Ut(e))}if(!(n instanceof Array)&&pte){let r=[],t=!1;if(wn(n,(s,a)=>{if(s.substring(0,1)!=="."){let c=Ut(a);c.isEmpty()||(t=t||!c.getPriority().isEmpty(),r.push(new Ve(s,c)))}}),r.length===0)return Ne.EMPTY_NODE;let o=NI(r,dte,s=>s.name,WO);if(t){let s=NI(r,At.getCompare());return new Ne(o,Ut(e),new Ud({".priority":s},{".priority":At}))}else return new Ne(o,Ut(e),Ud.Default)}else{let r=Ne.EMPTY_NODE;return wn(n,(t,i)=>{if(di(n,t)&&t.substring(0,1)!=="."){let o=Ut(i);(o.isLeafNode()||!o.isEmpty())&&(r=r.updateImmediateChild(t,o))}}),r.updatePriority(Ut(e))}}fte(Ut);var nm=class extends Fd{constructor(e){super(),this.indexPath_=e,ee(!ke(e)&&Fe(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,r){let t=this.extractChild(e.node),i=this.extractChild(r.node),o=t.compareTo(i);return o===0?Sl(e.name,r.name):o}makePost(e,r){let t=Ut(e),i=Ne.EMPTY_NODE.updateChild(this.indexPath_,t);return new Ve(r,i)}maxPost(){let e=Ne.EMPTY_NODE.updateChild(this.indexPath_,mm);return new Ve(Da,e)}toString(){return tm(this.indexPath_,0).join("/")}};var oO=class extends Fd{compare(e,r){let t=e.node.compareTo(r.node);return t===0?Sl(e.name,r.name):t}isDefinedOn(e){return!0}indexedValueChanged(e,r){return!e.equals(r)}minPost(){return Ve.MIN}maxPost(){return Ve.MAX}makePost(e,r){let t=Ut(e);return new Ve(r,t)}toString(){return".value"}},M$=new oO;function P$(n){return{type:"value",snapshotNode:n}}function Vd(n,e){return{type:"child_added",snapshotNode:e,childName:n}}function rm(n,e){return{type:"child_removed",snapshotNode:e,childName:n}}function im(n,e,r){return{type:"child_changed",snapshotNode:e,childName:n,oldSnap:r}}function Ete(n,e){return{type:"child_moved",snapshotNode:e,childName:n}}var om=class{constructor(e){this.index_=e}updateChild(e,r,t,i,o,s){ee(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let a=e.getImmediateChild(r);return a.getChild(i).equals(t.getChild(i))&&a.isEmpty()===t.isEmpty()||(s!=null&&(t.isEmpty()?e.hasChild(r)?s.trackChildChange(rm(r,a)):ee(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?s.trackChildChange(Vd(r,t)):s.trackChildChange(im(r,t,a))),e.isLeafNode()&&t.isEmpty())?e:e.updateImmediateChild(r,t).withIndex(this.index_)}updateFullNode(e,r,t){return t!=null&&(e.isLeafNode()||e.forEachChild(At,(i,o)=>{r.hasChild(i)||t.trackChildChange(rm(i,o))}),r.isLeafNode()||r.forEachChild(At,(i,o)=>{if(e.hasChild(i)){let s=e.getImmediateChild(i);s.equals(o)||t.trackChildChange(im(i,o,s))}else t.trackChildChange(Vd(i,o))})),r.withIndex(this.index_)}updatePriority(e,r){return e.isEmpty()?Ne.EMPTY_NODE:e.updatePriority(r)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}};var OI=class n{constructor(e){this.indexedFilter_=new om(e.getIndex()),this.index_=e.getIndex(),this.startPost_=n.getStartPost_(e),this.endPost_=n.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let r=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,t=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return r&&t}updateChild(e,r,t,i,o,s){return this.matches(new Ve(r,t))||(t=Ne.EMPTY_NODE),this.indexedFilter_.updateChild(e,r,t,i,o,s)}updateFullNode(e,r,t){r.isLeafNode()&&(r=Ne.EMPTY_NODE);let i=r.withIndex(this.index_);i=i.updatePriority(Ne.EMPTY_NODE);let o=this;return r.forEachChild(At,(s,a)=>{o.matches(new Ve(s,a))||(i=i.updateImmediateChild(s,Ne.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,t)}updatePriority(e,r){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){let r=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),r)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){let r=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),r)}else return e.getIndex().maxPost()}};var sO=class{constructor(e){this.withinDirectionalStart=r=>this.reverse_?this.withinEndPost(r):this.withinStartPost(r),this.withinDirectionalEnd=r=>this.reverse_?this.withinStartPost(r):this.withinEndPost(r),this.withinStartPost=r=>{let t=this.index_.compare(this.rangedFilter_.getStartPost(),r);return this.startIsInclusive_?t<=0:t<0},this.withinEndPost=r=>{let t=this.index_.compare(r,this.rangedFilter_.getEndPost());return this.endIsInclusive_?t<=0:t<0},this.rangedFilter_=new OI(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,r,t,i,o,s){return this.rangedFilter_.matches(new Ve(r,t))||(t=Ne.EMPTY_NODE),e.getImmediateChild(r).equals(t)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,r,t,i,o,s):this.fullLimitUpdateChild_(e,r,t,o,s)}updateFullNode(e,r,t){let i;if(r.isLeafNode()||r.isEmpty())i=Ne.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<r.numChildren()&&r.isIndexed(this.index_)){i=Ne.EMPTY_NODE.withIndex(this.index_);let o;this.reverse_?o=r.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):o=r.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let s=0;for(;o.hasNext()&&s<this.limit_;){let a=o.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))i=i.updateImmediateChild(a.name,a.node),s++;else break;else continue}}else{i=r.withIndex(this.index_),i=i.updatePriority(Ne.EMPTY_NODE);let o;this.reverse_?o=i.getReverseIterator(this.index_):o=i.getIterator(this.index_);let s=0;for(;o.hasNext();){let a=o.getNext();s<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?s++:i=i.updateImmediateChild(a.name,Ne.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,i,t)}updatePriority(e,r){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,r,t,i,o){let s;if(this.reverse_){let d=this.index_.getCompare();s=(f,g)=>d(g,f)}else s=this.index_.getCompare();let a=e;ee(a.numChildren()===this.limit_,"");let c=new Ve(r,t),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(c);if(a.hasChild(r)){let d=a.getImmediateChild(r),f=i.getChildAfterChild(this.index_,l,this.reverse_);for(;f!=null&&(f.name===r||a.hasChild(f.name));)f=i.getChildAfterChild(this.index_,f,this.reverse_);let g=f==null?1:s(f,c);if(u&&!t.isEmpty()&&g>=0)return o?.trackChildChange(im(r,t,d)),a.updateImmediateChild(r,t);{o?.trackChildChange(rm(r,d));let _=a.updateImmediateChild(r,Ne.EMPTY_NODE);return f!=null&&this.rangedFilter_.matches(f)?(o?.trackChildChange(Vd(f.name,f.node)),_.updateImmediateChild(f.name,f.node)):_}}else return t.isEmpty()?e:u&&s(l,c)>=0?(o!=null&&(o.trackChildChange(rm(l.name,l.node)),o.trackChildChange(Vd(r,t))),a.updateImmediateChild(r,t).updateImmediateChild(l.name,Ne.EMPTY_NODE)):e}};var aO=class n{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=At}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return ee(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return ee(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:El}hasEnd(){return this.endSet_}getIndexEndValue(){return ee(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return ee(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Da}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return ee(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===At}copy(){let e=new n;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}};function _te(n){return n.loadsAllData()?new om(n.getIndex()):n.hasLimit()?new sO(n):new OI(n)}function Tte(n,e){let r=n.copy();return r.limitSet_=!0,r.limit_=e,r.viewFrom_="r",r}function Ite(n,e,r){let t=n.copy();return t.startSet_=!0,e===void 0&&(e=null),t.indexStartValue_=e,r!=null?(t.startNameSet_=!0,t.indexStartName_=r):(t.startNameSet_=!1,t.indexStartName_=""),t}function vte(n,e,r){let t=n.copy();return t.endSet_=!0,e===void 0&&(e=null),t.indexEndValue_=e,r!==void 0?(t.endNameSet_=!0,t.indexEndName_=r):(t.endNameSet_=!1,t.indexEndName_=""),t}function yte(n,e){let r=n.copy();return r.index_=e,r}function jG(n){let e={};if(n.isDefault())return e;let r;if(n.index_===At?r="$priority":n.index_===M$?r="$value":n.index_===pl?r="$key":(ee(n.index_ instanceof nm,"Unrecognized index type!"),r=n.index_.toString()),e.orderBy=rn(r),n.startSet_){let t=n.startAfterSet_?"startAfter":"startAt";e[t]=rn(n.indexStartValue_),n.startNameSet_&&(e[t]+=","+rn(n.indexStartName_))}if(n.endSet_){let t=n.endBeforeSet_?"endBefore":"endAt";e[t]=rn(n.indexEndValue_),n.endNameSet_&&(e[t]+=","+rn(n.indexEndName_))}return n.limitSet_&&(n.isViewFromLeft()?e.limitToFirst=n.limit_:e.limitToLast=n.limit_),e}function HG(n){let e={};if(n.startSet_&&(e.sp=n.indexStartValue_,n.startNameSet_&&(e.sn=n.indexStartName_),e.sin=!n.startAfterSet_),n.endSet_&&(e.ep=n.indexEndValue_,n.endNameSet_&&(e.en=n.indexEndName_),e.ein=!n.endBeforeSet_),n.limitSet_){e.l=n.limit_;let r=n.viewFrom_;r===""&&(n.isViewFromLeft()?r="l":r="r"),e.vf=r}return n.index_!==At&&(e.i=n.index_.toString()),e}var cO=class n extends AI{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,r){return r!==void 0?"tag$"+r:(ee(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,r,t,i){super(),this.repoInfo_=e,this.onDataUpdate_=r,this.authTokenProvider_=t,this.appCheckTokenProvider_=i,this.log_=gm("p:rest:"),this.listens_={}}listen(e,r,t,i){let o=e._path.toString();this.log_("Listen called for "+o+" "+e._queryIdentifier);let s=n.getListenId_(e,t),a={};this.listens_[s]=a;let c=jG(e._queryParams);this.restRequest_(o+".json",c,(l,u)=>{let d=u;if(l===404&&(d=null,l=null),l===null&&this.onDataUpdate_(o,d,!1,t),ha(this.listens_,s)===a){let f;l?l===401?f="permission_denied":f="rest_error:"+l:f="ok",i(f,null)}})}unlisten(e,r){let t=n.getListenId_(e,r);delete this.listens_[t]}get(e){let r=jG(e._queryParams),t=e._path.toString(),i=new Nn;return this.restRequest_(t+".json",r,(o,s)=>{let a=s;o===404&&(a=null,o=null),o===null?(this.onDataUpdate_(t,a,!1,null),i.resolve(a)):i.reject(new Error(a))}),i.promise}refreshAuthToken(e){}restRequest_(e,r={},t){return r.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,o])=>{i&&i.accessToken&&(r.auth=i.accessToken),o&&o.token&&(r.ac=o.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+Lg(r);this.log_("Sending REST request for "+s);let a=new XMLHttpRequest;a.onreadystatechange=()=>{if(t&&a.readyState===4){this.log_("REST Response for "+s+" received. status:",a.status,"response:",a.responseText);let c=null;if(a.status>=200&&a.status<300){try{c=Dd(a.responseText)}catch{Jn("Failed to parse JSON response for "+s+": "+a.responseText)}t(null,c)}else a.status!==401&&a.status!==404&&Jn("Got unsuccessful REST response for "+s+" Status: "+a.status),t(a.status);t=null}},a.open("GET",s,!0),a.send()})}};var lO=class{constructor(){this.rootNode_=Ne.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,r){this.rootNode_=this.rootNode_.updateChild(e,r)}};function wI(){return{value:null,children:new Map}}function Wd(n,e,r){if(ke(e))n.value=r,n.children.clear();else if(n.value!==null)n.value=n.value.updateChild(e,r);else{let t=Fe(e);n.children.has(t)||n.children.set(t,wI());let i=n.children.get(t);e=ht(e),Wd(i,e,r)}}function uO(n,e){if(ke(e))return n.value=null,n.children.clear(),!0;if(n.value!==null){if(n.value.isLeafNode())return!1;{let r=n.value;return n.value=null,r.forEachChild(At,(t,i)=>{Wd(n,new Ke(t),i)}),uO(n,e)}}else if(n.children.size>0){let r=Fe(e);return e=ht(e),n.children.has(r)&&uO(n.children.get(r),e)&&n.children.delete(r),n.children.size===0}else return!0}function dO(n,e,r){n.value!==null?r(e,n.value):Ste(n,(t,i)=>{let o=new Ke(e.toString()+"/"+t);dO(i,o,r)})}function Ste(n,e){n.children.forEach((r,t)=>{e(t,r)})}var hO=class{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),r=Object.assign({},e);return this.last_&&wn(this.last_,(t,i)=>{r[t]=r[t]-i}),this.last_=e,r}};var WG=10*1e3,Ate=30*1e3,Dte=300*1e3,fO=class{constructor(e,r){this.server_=r,this.statsToReport_={},this.statsListener_=new hO(e);let t=WG+(Ate-WG)*Math.random();Qg(this.reportStats_.bind(this),Math.floor(t))}reportStats_(){let e=this.statsListener_.get(),r={},t=!1;wn(e,(i,o)=>{o>0&&di(this.statsToReport_,i)&&(r[i]=o,t=!0)}),t&&this.server_.reportStats(r),Qg(this.reportStats_.bind(this),Math.floor(Math.random()*2*Dte))}};var Po=(function(n){return n[n.OVERWRITE=0]="OVERWRITE",n[n.MERGE=1]="MERGE",n[n.ACK_USER_WRITE=2]="ACK_USER_WRITE",n[n.LISTEN_COMPLETE=3]="LISTEN_COMPLETE",n})(Po||{});function zO(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function qO(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function KO(n){return{fromUser:!1,fromServer:!0,queryId:n,tagged:!0}}var gO=class n{constructor(e,r,t){this.path=e,this.affectedTree=r,this.revert=t,this.type=Po.ACK_USER_WRITE,this.source=zO()}operationForChild(e){if(ke(this.path)){if(this.affectedTree.value!=null)return ee(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let r=this.affectedTree.subtree(new Ke(e));return new n(qe(),r,this.revert)}}else return ee(Fe(this.path)===e,"operationForChild called for unrelated child."),new n(ht(this.path),this.affectedTree,this.revert)}};var bI=class n{constructor(e,r){this.source=e,this.path=r,this.type=Po.LISTEN_COMPLETE}operationForChild(e){return ke(this.path)?new n(this.source,qe()):new n(this.source,ht(this.path))}};var Bd=class n{constructor(e,r,t){this.source=e,this.path=r,this.snap=t,this.type=Po.OVERWRITE}operationForChild(e){return ke(this.path)?new n(this.source,qe(),this.snap.getImmediateChild(e)):new n(this.source,ht(this.path),this.snap)}};var sm=class n{constructor(e,r,t){this.source=e,this.path=r,this.children=t,this.type=Po.MERGE}operationForChild(e){if(ke(this.path)){let r=this.children.subtree(new Ke(e));return r.isEmpty()?null:r.value?new Bd(this.source,qe(),r.value):new n(this.source,qe(),r)}else return ee(Fe(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new n(this.source,ht(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}};var xo=class{constructor(e,r,t){this.node_=e,this.fullyInitialized_=r,this.filtered_=t}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(ke(e))return this.isFullyInitialized()&&!this.filtered_;let r=Fe(e);return this.isCompleteForChild(r)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}};var mO=class{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}};function Rte(n,e,r,t){let i=[],o=[];return e.forEach(s=>{s.type==="child_changed"&&n.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&o.push(Ete(s.childName,s.snapshotNode))}),Yg(n,i,"child_removed",e,t,r),Yg(n,i,"child_added",e,t,r),Yg(n,i,"child_moved",o,t,r),Yg(n,i,"child_changed",e,t,r),Yg(n,i,"value",e,t,r),i}function Yg(n,e,r,t,i,o){let s=t.filter(a=>a.type===r);s.sort((a,c)=>Nte(n,a,c)),s.forEach(a=>{let c=Cte(n,a,o);i.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,n.query_))})})}function Cte(n,e,r){return e.type==="value"||e.type==="child_removed"||(e.prevName=r.getPredecessorChildName(e.childName,e.snapshotNode,n.index_)),e}function Nte(n,e,r){if(e.childName==null||r.childName==null)throw il("Should only compare child_ events.");let t=new Ve(e.childName,e.snapshotNode),i=new Ve(r.childName,r.snapshotNode);return n.index_.compare(t,i)}function zI(n,e){return{eventCache:n,serverCache:e}}function Jg(n,e,r,t){return zI(new xo(e,r,t),n.serverCache)}function x$(n,e,r,t){return zI(n.eventCache,new xo(e,r,t))}function LI(n){return n.eventCache.isFullyInitialized()?n.eventCache.getNode():null}function _l(n){return n.serverCache.isFullyInitialized()?n.serverCache.getNode():null}var UN,Ote=()=>(UN||(UN=new mi(Cee)),UN),hr=class n{static fromObject(e){let r=new n(null);return wn(e,(t,i)=>{r=r.set(new Ke(t),i)}),r}constructor(e,r=Ote()){this.value=e,this.children=r}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,r){if(this.value!=null&&r(this.value))return{path:qe(),value:this.value};if(ke(e))return null;{let t=Fe(e),i=this.children.get(t);if(i!==null){let o=i.findRootMostMatchingPathAndValue(ht(e),r);return o!=null?{path:Vt(new Ke(t),o.path),value:o.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(ke(e))return this;{let r=Fe(e),t=this.children.get(r);return t!==null?t.subtree(ht(e)):new n(null)}}set(e,r){if(ke(e))return new n(r,this.children);{let t=Fe(e),o=(this.children.get(t)||new n(null)).set(ht(e),r),s=this.children.insert(t,o);return new n(this.value,s)}}remove(e){if(ke(e))return this.children.isEmpty()?new n(null):new n(null,this.children);{let r=Fe(e),t=this.children.get(r);if(t){let i=t.remove(ht(e)),o;return i.isEmpty()?o=this.children.remove(r):o=this.children.insert(r,i),this.value===null&&o.isEmpty()?new n(null):new n(this.value,o)}else return this}}get(e){if(ke(e))return this.value;{let r=Fe(e),t=this.children.get(r);return t?t.get(ht(e)):null}}setTree(e,r){if(ke(e))return r;{let t=Fe(e),o=(this.children.get(t)||new n(null)).setTree(ht(e),r),s;return o.isEmpty()?s=this.children.remove(t):s=this.children.insert(t,o),new n(this.value,s)}}fold(e){return this.fold_(qe(),e)}fold_(e,r){let t={};return this.children.inorderTraversal((i,o)=>{t[i]=o.fold_(Vt(e,i),r)}),r(e,this.value,t)}findOnPath(e,r){return this.findOnPath_(e,qe(),r)}findOnPath_(e,r,t){let i=this.value?t(r,this.value):!1;if(i)return i;if(ke(e))return null;{let o=Fe(e),s=this.children.get(o);return s?s.findOnPath_(ht(e),Vt(r,o),t):null}}foreachOnPath(e,r){return this.foreachOnPath_(e,qe(),r)}foreachOnPath_(e,r,t){if(ke(e))return this;{this.value&&t(r,this.value);let i=Fe(e),o=this.children.get(i);return o?o.foreachOnPath_(ht(e),Vt(r,i),t):new n(null)}}foreach(e){this.foreach_(qe(),e)}foreach_(e,r){this.children.inorderTraversal((t,i)=>{i.foreach_(Vt(e,t),r)}),this.value&&r(e,this.value)}foreachChild(e){this.children.inorderTraversal((r,t)=>{t.value&&e(r,t.value)})}};var Hi=class n{constructor(e){this.writeTree_=e}static empty(){return new n(new hr(null))}};function Zg(n,e,r){if(ke(e))return new Hi(new hr(r));{let t=n.writeTree_.findRootMostValueAndPath(e);if(t!=null){let i=t.path,o=t.value,s=dr(i,e);return o=o.updateChild(s,r),new Hi(n.writeTree_.set(i,o))}else{let i=new hr(r),o=n.writeTree_.setTree(e,i);return new Hi(o)}}}function pO(n,e,r){let t=n;return wn(r,(i,o)=>{t=Zg(t,Vt(e,i),o)}),t}function zG(n,e){if(ke(e))return Hi.empty();{let r=n.writeTree_.setTree(e,new hr(null));return new Hi(r)}}function EO(n,e){return Al(n,e)!=null}function Al(n,e){let r=n.writeTree_.findRootMostValueAndPath(e);return r!=null?n.writeTree_.get(r.path).getChild(dr(r.path,e)):null}function qG(n){let e=[],r=n.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(At,(t,i)=>{e.push(new Ve(t,i))}):n.writeTree_.children.inorderTraversal((t,i)=>{i.value!=null&&e.push(new Ve(t,i.value))}),e}function Sa(n,e){if(ke(e))return n;{let r=Al(n,e);return r!=null?new Hi(new hr(r)):new Hi(n.writeTree_.subtree(e))}}function _O(n){return n.writeTree_.isEmpty()}function Gd(n,e){return F$(qe(),n.writeTree_,e)}function F$(n,e,r){if(e.value!=null)return r.updateChild(n,e.value);{let t=null;return e.children.inorderTraversal((i,o)=>{i===".priority"?(ee(o.value!==null,"Priority writes must always be leaf nodes"),t=o.value):r=F$(Vt(n,i),o,r)}),!r.getChild(n).isEmpty()&&t!==null&&(r=r.updateChild(Vt(n,".priority"),t)),r}}function qI(n,e){return B$(e,n)}function wte(n,e,r,t,i){ee(t>n.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),n.allWrites.push({path:e,snap:r,writeId:t,visible:i}),i&&(n.visibleWrites=Zg(n.visibleWrites,e,r)),n.lastWriteId=t}function bte(n,e,r,t){ee(t>n.lastWriteId,"Stacking an older merge on top of newer ones"),n.allWrites.push({path:e,children:r,writeId:t,visible:!0}),n.visibleWrites=pO(n.visibleWrites,e,r),n.lastWriteId=t}function Lte(n,e){for(let r=0;r<n.allWrites.length;r++){let t=n.allWrites[r];if(t.writeId===e)return t}return null}function Mte(n,e){let r=n.allWrites.findIndex(a=>a.writeId===e);ee(r>=0,"removeWrite called with nonexistent writeId.");let t=n.allWrites[r];n.allWrites.splice(r,1);let i=t.visible,o=!1,s=n.allWrites.length-1;for(;i&&s>=0;){let a=n.allWrites[s];a.visible&&(s>=r&&Pte(a,t.path)?i=!1:gi(t.path,a.path)&&(o=!0)),s--}if(i){if(o)return xte(n),!0;if(t.snap)n.visibleWrites=zG(n.visibleWrites,t.path);else{let a=t.children;wn(a,c=>{n.visibleWrites=zG(n.visibleWrites,Vt(t.path,c))})}return!0}else return!1}function Pte(n,e){if(n.snap)return gi(n.path,e);for(let r in n.children)if(n.children.hasOwnProperty(r)&&gi(Vt(n.path,r),e))return!0;return!1}function xte(n){n.visibleWrites=k$(n.allWrites,Fte,qe()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1}function Fte(n){return n.visible}function k$(n,e,r){let t=Hi.empty();for(let i=0;i<n.length;++i){let o=n[i];if(e(o)){let s=o.path,a;if(o.snap)gi(r,s)?(a=dr(r,s),t=Zg(t,a,o.snap)):gi(s,r)&&(a=dr(s,r),t=Zg(t,qe(),o.snap.getChild(a)));else if(o.children){if(gi(r,s))a=dr(r,s),t=pO(t,a,o.children);else if(gi(s,r))if(a=dr(s,r),ke(a))t=pO(t,qe(),o.children);else{let c=ha(o.children,Fe(a));if(c){let l=c.getChild(ht(a));t=Zg(t,qe(),l)}}}else throw il("WriteRecord should have .snap or .children")}}return t}function U$(n,e,r,t,i){if(!t&&!i){let o=Al(n.visibleWrites,e);if(o!=null)return o;{let s=Sa(n.visibleWrites,e);if(_O(s))return r;if(r==null&&!EO(s,qe()))return null;{let a=r||Ne.EMPTY_NODE;return Gd(s,a)}}}else{let o=Sa(n.visibleWrites,e);if(!i&&_O(o))return r;if(!i&&r==null&&!EO(o,qe()))return null;{let s=function(l){return(l.visible||i)&&(!t||!~t.indexOf(l.writeId))&&(gi(l.path,e)||gi(e,l.path))},a=k$(n.allWrites,s,e),c=r||Ne.EMPTY_NODE;return Gd(a,c)}}}function kte(n,e,r){let t=Ne.EMPTY_NODE,i=Al(n.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(At,(o,s)=>{t=t.updateImmediateChild(o,s)}),t;if(r){let o=Sa(n.visibleWrites,e);return r.forEachChild(At,(s,a)=>{let c=Gd(Sa(o,new Ke(s)),a);t=t.updateImmediateChild(s,c)}),qG(o).forEach(s=>{t=t.updateImmediateChild(s.name,s.node)}),t}else{let o=Sa(n.visibleWrites,e);return qG(o).forEach(s=>{t=t.updateImmediateChild(s.name,s.node)}),t}}function Ute(n,e,r,t,i){ee(t||i,"Either existingEventSnap or existingServerSnap must exist");let o=Vt(e,r);if(EO(n.visibleWrites,o))return null;{let s=Sa(n.visibleWrites,o);return _O(s)?i.getChild(r):Gd(s,i.getChild(r))}}function Vte(n,e,r,t){let i=Vt(e,r),o=Al(n.visibleWrites,i);if(o!=null)return o;if(t.isCompleteForChild(r)){let s=Sa(n.visibleWrites,i);return Gd(s,t.getNode().getImmediateChild(r))}else return null}function Bte(n,e){return Al(n.visibleWrites,e)}function Gte(n,e,r,t,i,o,s){let a,c=Sa(n.visibleWrites,e),l=Al(c,qe());if(l!=null)a=l;else if(r!=null)a=Gd(c,r);else return[];if(a=a.withIndex(s),!a.isEmpty()&&!a.isLeafNode()){let u=[],d=s.getCompare(),f=o?a.getReverseIteratorFrom(t,s):a.getIteratorFrom(t,s),g=f.getNext();for(;g&&u.length<i;)d(g,t)!==0&&u.push(g),g=f.getNext();return u}else return[]}function $te(){return{visibleWrites:Hi.empty(),allWrites:[],lastWriteId:-1}}function MI(n,e,r,t){return U$(n.writeTree,n.treePath,e,r,t)}function YO(n,e){return kte(n.writeTree,n.treePath,e)}function KG(n,e,r,t){return Ute(n.writeTree,n.treePath,e,r,t)}function PI(n,e){return Bte(n.writeTree,Vt(n.treePath,e))}function jte(n,e,r,t,i,o){return Gte(n.writeTree,n.treePath,e,r,t,i,o)}function QO(n,e,r){return Vte(n.writeTree,n.treePath,e,r)}function V$(n,e){return B$(Vt(n.treePath,e),n.writeTree)}function B$(n,e){return{treePath:n,writeTree:e}}var TO=class{constructor(){this.changeMap=new Map}trackChildChange(e){let r=e.type,t=e.childName;ee(r==="child_added"||r==="child_changed"||r==="child_removed","Only child changes supported for tracking"),ee(t!==".priority","Only non-priority child changes can be tracked.");let i=this.changeMap.get(t);if(i){let o=i.type;if(r==="child_added"&&o==="child_removed")this.changeMap.set(t,im(t,e.snapshotNode,i.snapshotNode));else if(r==="child_removed"&&o==="child_added")this.changeMap.delete(t);else if(r==="child_removed"&&o==="child_changed")this.changeMap.set(t,rm(t,i.oldSnap));else if(r==="child_changed"&&o==="child_added")this.changeMap.set(t,Vd(t,e.snapshotNode));else if(r==="child_changed"&&o==="child_changed")this.changeMap.set(t,im(t,e.snapshotNode,i.oldSnap));else throw il("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(t,e)}getChanges(){return Array.from(this.changeMap.values())}};var IO=class{getCompleteChild(e){return null}getChildAfterChild(e,r,t){return null}},G$=new IO,am=class{constructor(e,r,t=null){this.writes_=e,this.viewCache_=r,this.optCompleteServerCache_=t}getCompleteChild(e){let r=this.viewCache_.eventCache;if(r.isCompleteForChild(e))return r.getNode().getImmediateChild(e);{let t=this.optCompleteServerCache_!=null?new xo(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return QO(this.writes_,e,t)}}getChildAfterChild(e,r,t){let i=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:_l(this.viewCache_),o=jte(this.writes_,i,r,1,t,e);return o.length===0?null:o[0]}};function Hte(n){return{filter:n}}function Wte(n,e){ee(e.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),ee(e.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed")}function zte(n,e,r,t,i){let o=new TO,s,a;if(r.type===Po.OVERWRITE){let l=r;l.source.fromUser?s=vO(n,e,l.path,l.snap,t,i,o):(ee(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!ke(l.path),s=xI(n,e,l.path,l.snap,t,i,a,o))}else if(r.type===Po.MERGE){let l=r;l.source.fromUser?s=Kte(n,e,l.path,l.children,t,i,o):(ee(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),s=yO(n,e,l.path,l.children,t,i,a,o))}else if(r.type===Po.ACK_USER_WRITE){let l=r;l.revert?s=Xte(n,e,l.path,t,i,o):s=Yte(n,e,l.path,l.affectedTree,t,i,o)}else if(r.type===Po.LISTEN_COMPLETE)s=Qte(n,e,r.path,t,o);else throw il("Unknown operation type: "+r.type);let c=o.getChanges();return qte(e,s,c),{viewCache:s,changes:c}}function qte(n,e,r){let t=e.eventCache;if(t.isFullyInitialized()){let i=t.getNode().isLeafNode()||t.getNode().isEmpty(),o=LI(n);(r.length>0||!n.eventCache.isFullyInitialized()||i&&!t.getNode().equals(o)||!t.getNode().getPriority().equals(o.getPriority()))&&r.push(P$(LI(e)))}}function $$(n,e,r,t,i,o){let s=e.eventCache;if(PI(t,r)!=null)return e;{let a,c;if(ke(r))if(ee(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){let l=_l(e),u=l instanceof Ne?l:Ne.EMPTY_NODE,d=YO(t,u);a=n.filter.updateFullNode(e.eventCache.getNode(),d,o)}else{let l=MI(t,_l(e));a=n.filter.updateFullNode(e.eventCache.getNode(),l,o)}else{let l=Fe(r);if(l===".priority"){ee(Ra(r)===1,"Can't have a priority with additional path components");let u=s.getNode();c=e.serverCache.getNode();let d=KG(t,r,u,c);d!=null?a=n.filter.updatePriority(u,d):a=s.getNode()}else{let u=ht(r),d;if(s.isCompleteForChild(l)){c=e.serverCache.getNode();let f=KG(t,r,s.getNode(),c);f!=null?d=s.getNode().getImmediateChild(l).updateChild(u,f):d=s.getNode().getImmediateChild(l)}else d=QO(t,l,e.serverCache);d!=null?a=n.filter.updateChild(s.getNode(),l,d,u,i,o):a=s.getNode()}}return Jg(e,a,s.isFullyInitialized()||ke(r),n.filter.filtersNodes())}}function xI(n,e,r,t,i,o,s,a){let c=e.serverCache,l,u=s?n.filter:n.filter.getIndexedFilter();if(ke(r))l=u.updateFullNode(c.getNode(),t,null);else if(u.filtersNodes()&&!c.isFiltered()){let g=c.getNode().updateChild(r,t);l=u.updateFullNode(c.getNode(),g,null)}else{let g=Fe(r);if(!c.isCompleteForPath(r)&&Ra(r)>1)return e;let p=ht(r),T=c.getNode().getImmediateChild(g).updateChild(p,t);g===".priority"?l=u.updatePriority(c.getNode(),T):l=u.updateChild(c.getNode(),g,T,p,G$,null)}let d=x$(e,l,c.isFullyInitialized()||ke(r),u.filtersNodes()),f=new am(i,d,o);return $$(n,d,r,i,f,a)}function vO(n,e,r,t,i,o,s){let a=e.eventCache,c,l,u=new am(i,e,o);if(ke(r))l=n.filter.updateFullNode(e.eventCache.getNode(),t,s),c=Jg(e,l,!0,n.filter.filtersNodes());else{let d=Fe(r);if(d===".priority")l=n.filter.updatePriority(e.eventCache.getNode(),t),c=Jg(e,l,a.isFullyInitialized(),a.isFiltered());else{let f=ht(r),g=a.getNode().getImmediateChild(d),p;if(ke(f))p=t;else{let _=u.getCompleteChild(d);_!=null?$O(f)===".priority"&&_.getChild(C$(f)).isEmpty()?p=_:p=_.updateChild(f,t):p=Ne.EMPTY_NODE}if(g.equals(p))c=e;else{let _=n.filter.updateChild(a.getNode(),d,p,f,u,s);c=Jg(e,_,a.isFullyInitialized(),n.filter.filtersNodes())}}}return c}function YG(n,e){return n.eventCache.isCompleteForChild(e)}function Kte(n,e,r,t,i,o,s){let a=e;return t.foreach((c,l)=>{let u=Vt(r,c);YG(e,Fe(u))&&(a=vO(n,a,u,l,i,o,s))}),t.foreach((c,l)=>{let u=Vt(r,c);YG(e,Fe(u))||(a=vO(n,a,u,l,i,o,s))}),a}function QG(n,e,r){return r.foreach((t,i)=>{e=e.updateChild(t,i)}),e}function yO(n,e,r,t,i,o,s,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;ke(r)?l=t:l=new hr(null).setTree(r,t);let u=e.serverCache.getNode();return l.children.inorderTraversal((d,f)=>{if(u.hasChild(d)){let g=e.serverCache.getNode().getImmediateChild(d),p=QG(n,g,f);c=xI(n,c,new Ke(d),p,i,o,s,a)}}),l.children.inorderTraversal((d,f)=>{let g=!e.serverCache.isCompleteForChild(d)&&f.value===null;if(!u.hasChild(d)&&!g){let p=e.serverCache.getNode().getImmediateChild(d),_=QG(n,p,f);c=xI(n,c,new Ke(d),_,i,o,s,a)}}),c}function Yte(n,e,r,t,i,o,s){if(PI(i,r)!=null)return e;let a=e.serverCache.isFiltered(),c=e.serverCache;if(t.value!=null){if(ke(r)&&c.isFullyInitialized()||c.isCompleteForPath(r))return xI(n,e,r,c.getNode().getChild(r),i,o,a,s);if(ke(r)){let l=new hr(null);return c.getNode().forEachChild(pl,(u,d)=>{l=l.set(new Ke(u),d)}),yO(n,e,r,l,i,o,a,s)}else return e}else{let l=new hr(null);return t.foreach((u,d)=>{let f=Vt(r,u);c.isCompleteForPath(f)&&(l=l.set(u,c.getNode().getChild(f)))}),yO(n,e,r,l,i,o,a,s)}}function Qte(n,e,r,t,i){let o=e.serverCache,s=x$(e,o.getNode(),o.isFullyInitialized()||ke(r),o.isFiltered());return $$(n,s,r,t,G$,i)}function Xte(n,e,r,t,i,o){let s;if(PI(t,r)!=null)return e;{let a=new am(t,e,i),c=e.eventCache.getNode(),l;if(ke(r)||Fe(r)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=MI(t,_l(e));else{let d=e.serverCache.getNode();ee(d instanceof Ne,"serverChildren would be complete if leaf node"),u=YO(t,d)}u=u,l=n.filter.updateFullNode(c,u,o)}else{let u=Fe(r),d=QO(t,u,e.serverCache);d==null&&e.serverCache.isCompleteForChild(u)&&(d=c.getImmediateChild(u)),d!=null?l=n.filter.updateChild(c,u,d,ht(r),a,o):e.eventCache.getNode().hasChild(u)?l=n.filter.updateChild(c,u,Ne.EMPTY_NODE,ht(r),a,o):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(s=MI(t,_l(e)),s.isLeafNode()&&(l=n.filter.updateFullNode(l,s,o)))}return s=e.serverCache.isFullyInitialized()||PI(t,qe())!=null,Jg(e,l,s,n.filter.filtersNodes())}}var SO=class{constructor(e,r){this.query_=e,this.eventRegistrations_=[];let t=this.query_._queryParams,i=new om(t.getIndex()),o=_te(t);this.processor_=Hte(o);let s=r.serverCache,a=r.eventCache,c=i.updateFullNode(Ne.EMPTY_NODE,s.getNode(),null),l=o.updateFullNode(Ne.EMPTY_NODE,a.getNode(),null),u=new xo(c,s.isFullyInitialized(),i.filtersNodes()),d=new xo(l,a.isFullyInitialized(),o.filtersNodes());this.viewCache_=zI(d,u),this.eventGenerator_=new mO(this.query_)}get query(){return this.query_}};function Jte(n){return n.viewCache_.serverCache.getNode()}function Zte(n){return LI(n.viewCache_)}function ene(n,e){let r=_l(n.viewCache_);return r&&(n.query._queryParams.loadsAllData()||!ke(e)&&!r.getImmediateChild(Fe(e)).isEmpty())?r.getChild(e):null}function XG(n){return n.eventRegistrations_.length===0}function tne(n,e){n.eventRegistrations_.push(e)}function JG(n,e,r){let t=[];if(r){ee(e==null,"A cancel should cancel all event registrations.");let i=n.query._path;n.eventRegistrations_.forEach(o=>{let s=o.createCancelEvent(r,i);s&&t.push(s)})}if(e){let i=[];for(let o=0;o<n.eventRegistrations_.length;++o){let s=n.eventRegistrations_[o];if(!s.matches(e))i.push(s);else if(e.hasAnyCallback()){i=i.concat(n.eventRegistrations_.slice(o+1));break}}n.eventRegistrations_=i}else n.eventRegistrations_=[];return t}function ZG(n,e,r,t){e.type===Po.MERGE&&e.source.queryId!==null&&(ee(_l(n.viewCache_),"We should always have a full cache before handling merges"),ee(LI(n.viewCache_),"Missing event cache, even though we have a server cache"));let i=n.viewCache_,o=zte(n.processor_,i,e,r,t);return Wte(n.processor_,o.viewCache),ee(o.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),n.viewCache_=o.viewCache,j$(n,o.changes,o.viewCache.eventCache.getNode(),null)}function nne(n,e){let r=n.viewCache_.eventCache,t=[];return r.getNode().isLeafNode()||r.getNode().forEachChild(At,(o,s)=>{t.push(Vd(o,s))}),r.isFullyInitialized()&&t.push(P$(r.getNode())),j$(n,t,r.getNode(),e)}function j$(n,e,r,t){let i=t?[t]:n.eventRegistrations_;return Rte(n.eventGenerator_,e,r,i)}var FI,kI=class{constructor(){this.views=new Map}};function rne(n){ee(!FI,"__referenceConstructor has already been defined"),FI=n}function ine(){return ee(FI,"Reference.ts has not been loaded"),FI}function one(n){return n.views.size===0}function XO(n,e,r,t){let i=e.source.queryId;if(i!==null){let o=n.views.get(i);return ee(o!=null,"SyncTree gave us an op for an invalid query."),ZG(o,e,r,t)}else{let o=[];for(let s of n.views.values())o=o.concat(ZG(s,e,r,t));return o}}function H$(n,e,r,t,i){let o=e._queryIdentifier,s=n.views.get(o);if(!s){let a=MI(r,i?t:null),c=!1;a?c=!0:t instanceof Ne?(a=YO(r,t),c=!1):(a=Ne.EMPTY_NODE,c=!1);let l=zI(new xo(a,c,!1),new xo(t,i,!1));return new SO(e,l)}return s}function sne(n,e,r,t,i,o){let s=H$(n,e,t,i,o);return n.views.has(e._queryIdentifier)||n.views.set(e._queryIdentifier,s),tne(s,r),nne(s,r)}function ane(n,e,r,t){let i=e._queryIdentifier,o=[],s=[],a=Ca(n);if(i==="default")for(let[c,l]of n.views.entries())s=s.concat(JG(l,r,t)),XG(l)&&(n.views.delete(c),l.query._queryParams.loadsAllData()||o.push(l.query));else{let c=n.views.get(i);c&&(s=s.concat(JG(c,r,t)),XG(c)&&(n.views.delete(i),c.query._queryParams.loadsAllData()||o.push(c.query)))}return a&&!Ca(n)&&o.push(new(ine())(e._repo,e._path)),{removed:o,events:s}}function W$(n){let e=[];for(let r of n.views.values())r.query._queryParams.loadsAllData()||e.push(r);return e}function Aa(n,e){let r=null;for(let t of n.views.values())r=r||ene(t,e);return r}function z$(n,e){if(e._queryParams.loadsAllData())return KI(n);{let t=e._queryIdentifier;return n.views.get(t)}}function q$(n,e){return z$(n,e)!=null}function Ca(n){return KI(n)!=null}function KI(n){for(let e of n.views.values())if(e.query._queryParams.loadsAllData())return e;return null}var UI;function cne(n){ee(!UI,"__referenceConstructor has already been defined"),UI=n}function lne(){return ee(UI,"Reference.ts has not been loaded"),UI}var une=1,VI=class{constructor(e){this.listenProvider_=e,this.syncPointTree_=new hr(null),this.pendingWriteTree_=$te(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}};function JO(n,e,r,t,i){return wte(n.pendingWriteTree_,e,r,t,i),i?zd(n,new Bd(zO(),e,r)):[]}function dne(n,e,r,t){bte(n.pendingWriteTree_,e,r,t);let i=hr.fromObject(r);return zd(n,new sm(zO(),e,i))}function va(n,e,r=!1){let t=Lte(n.pendingWriteTree_,e);if(Mte(n.pendingWriteTree_,e)){let o=new hr(null);return t.snap!=null?o=o.set(qe(),!0):wn(t.children,s=>{o=o.set(new Ke(s),!0)}),zd(n,new gO(t.path,o,r))}else return[]}function pm(n,e,r){return zd(n,new Bd(qO(),e,r))}function hne(n,e,r){let t=hr.fromObject(r);return zd(n,new sm(qO(),e,t))}function fne(n,e){return zd(n,new bI(qO(),e))}function gne(n,e,r){let t=ZO(n,r);if(t){let i=ew(t),o=i.path,s=i.queryId,a=dr(o,e),c=new bI(KO(s),a);return tw(n,o,c)}else return[]}function BI(n,e,r,t,i=!1){let o=e._path,s=n.syncPointTree_.get(o),a=[];if(s&&(e._queryIdentifier==="default"||q$(s,e))){let c=ane(s,e,r,t);one(s)&&(n.syncPointTree_=n.syncPointTree_.remove(o));let l=c.removed;if(a=c.events,!i){let u=l.findIndex(f=>f._queryParams.loadsAllData())!==-1,d=n.syncPointTree_.findOnPath(o,(f,g)=>Ca(g));if(u&&!d){let f=n.syncPointTree_.subtree(o);if(!f.isEmpty()){let g=Ene(f);for(let p=0;p<g.length;++p){let _=g[p],T=_.query,S=X$(n,_);n.listenProvider_.startListening(em(T),cm(n,T),S.hashFn,S.onComplete)}}}!d&&l.length>0&&!t&&(u?n.listenProvider_.stopListening(em(e),null):l.forEach(f=>{let g=n.queryToTagMap.get(QI(f));n.listenProvider_.stopListening(em(f),g)}))}_ne(n,l)}return a}function K$(n,e,r,t){let i=ZO(n,t);if(i!=null){let o=ew(i),s=o.path,a=o.queryId,c=dr(s,e),l=new Bd(KO(a),c,r);return tw(n,s,l)}else return[]}function mne(n,e,r,t){let i=ZO(n,t);if(i){let o=ew(i),s=o.path,a=o.queryId,c=dr(s,e),l=hr.fromObject(r),u=new sm(KO(a),c,l);return tw(n,s,u)}else return[]}function AO(n,e,r,t=!1){let i=e._path,o=null,s=!1;n.syncPointTree_.foreachOnPath(i,(f,g)=>{let p=dr(f,i);o=o||Aa(g,p),s=s||Ca(g)});let a=n.syncPointTree_.get(i);a?(s=s||Ca(a),o=o||Aa(a,qe())):(a=new kI,n.syncPointTree_=n.syncPointTree_.set(i,a));let c;o!=null?c=!0:(c=!1,o=Ne.EMPTY_NODE,n.syncPointTree_.subtree(i).foreachChild((g,p)=>{let _=Aa(p,qe());_&&(o=o.updateImmediateChild(g,_))}));let l=q$(a,e);if(!l&&!e._queryParams.loadsAllData()){let f=QI(e);ee(!n.queryToTagMap.has(f),"View does not exist, but we have a tag");let g=Tne();n.queryToTagMap.set(f,g),n.tagToQueryMap.set(g,f)}let u=qI(n.pendingWriteTree_,i),d=sne(a,e,r,u,o,c);if(!l&&!s&&!t){let f=z$(a,e);d=d.concat(Ine(n,e,f))}return d}function YI(n,e,r){let i=n.pendingWriteTree_,o=n.syncPointTree_.findOnPath(e,(s,a)=>{let c=dr(s,e),l=Aa(a,c);if(l)return l});return U$(i,e,o,r,!0)}function pne(n,e){let r=e._path,t=null;n.syncPointTree_.foreachOnPath(r,(l,u)=>{let d=dr(l,r);t=t||Aa(u,d)});let i=n.syncPointTree_.get(r);i?t=t||Aa(i,qe()):(i=new kI,n.syncPointTree_=n.syncPointTree_.set(r,i));let o=t!=null,s=o?new xo(t,!0,!1):null,a=qI(n.pendingWriteTree_,e._path),c=H$(i,e,a,o?s.getNode():Ne.EMPTY_NODE,o);return Zte(c)}function zd(n,e){return Y$(e,n.syncPointTree_,null,qI(n.pendingWriteTree_,qe()))}function Y$(n,e,r,t){if(ke(n.path))return Q$(n,e,r,t);{let i=e.get(qe());r==null&&i!=null&&(r=Aa(i,qe()));let o=[],s=Fe(n.path),a=n.operationForChild(s),c=e.children.get(s);if(c&&a){let l=r?r.getImmediateChild(s):null,u=V$(t,s);o=o.concat(Y$(a,c,l,u))}return i&&(o=o.concat(XO(i,n,t,r))),o}}function Q$(n,e,r,t){let i=e.get(qe());r==null&&i!=null&&(r=Aa(i,qe()));let o=[];return e.children.inorderTraversal((s,a)=>{let c=r?r.getImmediateChild(s):null,l=V$(t,s),u=n.operationForChild(s);u&&(o=o.concat(Q$(u,a,c,l)))}),i&&(o=o.concat(XO(i,n,t,r))),o}function X$(n,e){let r=e.query,t=cm(n,r);return{hashFn:()=>(Jte(e)||Ne.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return t?gne(n,r._path,t):fne(n,r._path);{let o=wee(i,r);return BI(n,r,null,o)}}}}function cm(n,e){let r=QI(e);return n.queryToTagMap.get(r)}function QI(n){return n._path.toString()+"$"+n._queryIdentifier}function ZO(n,e){return n.tagToQueryMap.get(e)}function ew(n){let e=n.indexOf("$");return ee(e!==-1&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new Ke(n.substr(0,e))}}function tw(n,e,r){let t=n.syncPointTree_.get(e);ee(t,"Missing sync point for query tag that we're tracking");let i=qI(n.pendingWriteTree_,e);return XO(t,r,i,null)}function Ene(n){return n.fold((e,r,t)=>{if(r&&Ca(r))return[KI(r)];{let i=[];return r&&(i=W$(r)),wn(t,(o,s)=>{i=i.concat(s)}),i}})}function em(n){return n._queryParams.loadsAllData()&&!n._queryParams.isDefault()?new(lne())(n._repo,n._path):n}function _ne(n,e){for(let r=0;r<e.length;++r){let t=e[r];if(!t._queryParams.loadsAllData()){let i=QI(t),o=n.queryToTagMap.get(i);n.queryToTagMap.delete(i),n.tagToQueryMap.delete(o)}}}function Tne(){return une++}function Ine(n,e,r){let t=e._path,i=cm(n,e),o=X$(n,r),s=n.listenProvider_.startListening(em(e),i,o.hashFn,o.onComplete),a=n.syncPointTree_.subtree(t);if(i)ee(!Ca(a.value),"If we're adding a query, it shouldn't be shadowed");else{let c=a.fold((l,u,d)=>{if(!ke(l)&&u&&Ca(u))return[KI(u).query];{let f=[];return u&&(f=f.concat(W$(u).map(g=>g.query))),wn(d,(g,p)=>{f=f.concat(p)}),f}});for(let l=0;l<c.length;++l){let u=c[l];n.listenProvider_.stopListening(em(u),cm(n,u))}}return s}var DO=class n{constructor(e){this.node_=e}getImmediateChild(e){let r=this.node_.getImmediateChild(e);return new n(r)}node(){return this.node_}},RO=class n{constructor(e,r){this.syncTree_=e,this.path_=r}getImmediateChild(e){let r=Vt(this.path_,e);return new n(this.syncTree_,r)}node(){return YI(this.syncTree_,this.path_)}},vne=function(n){return n=n||{},n.timestamp=n.timestamp||new Date().getTime(),n},e$=function(n,e,r){if(!n||typeof n!="object")return n;if(ee(".sv"in n,"Unexpected leaf node or priority contents"),typeof n[".sv"]=="string")return yne(n[".sv"],e,r);if(typeof n[".sv"]=="object")return Sne(n[".sv"],e);ee(!1,"Unexpected server value: "+JSON.stringify(n,null,2))},yne=function(n,e,r){if(n==="timestamp")return r.timestamp;ee(!1,"Unexpected server value: "+n)},Sne=function(n,e,r){n.hasOwnProperty("increment")||ee(!1,"Unexpected server value: "+JSON.stringify(n,null,2));let t=n.increment;typeof t!="number"&&ee(!1,"Unexpected increment value: "+t);let i=e.node();if(ee(i!==null&&typeof i<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return t;let s=i.getValue();return typeof s!="number"?t:s+t},J$=function(n,e,r,t){return rw(e,new RO(r,n),t)},nw=function(n,e,r){return rw(n,new DO(e),r)};function rw(n,e,r){let t=n.getPriority().val(),i=e$(t,e.getImmediateChild(".priority"),r),o;if(n.isLeafNode()){let s=n,a=e$(s.getValue(),e,r);return a!==s.getValue()||i!==s.getPriority().val()?new kd(a,Ut(i)):n}else{let s=n;return o=s,i!==s.getPriority().val()&&(o=o.updatePriority(new kd(i))),s.forEachChild(At,(a,c)=>{let l=rw(c,e.getImmediateChild(a),r);l!==c&&(o=o.updateImmediateChild(a,l))}),o}}var lm=class{constructor(e="",r=null,t={children:{},childCount:0}){this.name=e,this.parent=r,this.node=t}};function XI(n,e){let r=e instanceof Ke?e:new Ke(e),t=n,i=Fe(r);for(;i!==null;){let o=ha(t.node.children,i)||{children:{},childCount:0};t=new lm(i,t,o),r=ht(r),i=Fe(r)}return t}function Dl(n){return n.node.value}function iw(n,e){n.node.value=e,CO(n)}function Z$(n){return n.node.childCount>0}function Ane(n){return Dl(n)===void 0&&!Z$(n)}function JI(n,e){wn(n.node.children,(r,t)=>{e(new lm(r,n,t))})}function e2(n,e,r,t){r&&!t&&e(n),JI(n,i=>{e2(i,e,!0,t)}),r&&t&&e(n)}function Dne(n,e,r){let t=r?n:n.parent;for(;t!==null;){if(e(t))return!0;t=t.parent}return!1}function Em(n){return new Ke(n.parent===null?n.name:Em(n.parent)+"/"+n.name)}function CO(n){n.parent!==null&&Rne(n.parent,n.name,n)}function Rne(n,e,r){let t=Ane(r),i=di(n.node.children,e);t&&i?(delete n.node.children[e],n.node.childCount--,CO(n)):!t&&!i&&(n.node.children[e]=r.node,n.node.childCount++,CO(n))}var Cne=/[\[\].#$\/\u0000-\u001F\u007F]/,Nne=/[\[\].#$\u0000-\u001F\u007F]/,VN=10*1024*1024,ZI=function(n){return typeof n=="string"&&n.length!==0&&!Cne.test(n)},t2=function(n){return typeof n=="string"&&n.length!==0&&!Nne.test(n)},One=function(n){return n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),t2(n)},um=function(n){return n===null||typeof n=="string"||typeof n=="number"&&!WI(n)||n&&typeof n=="object"&&di(n,".sv")},Tl=function(n,e,r,t){t&&e===void 0||_m(fa(n,"value"),e,r)},_m=function(n,e,r){let t=r instanceof Ke?new JN(r,n):r;if(e===void 0)throw new Error(n+"contains undefined "+fl(t));if(typeof e=="function")throw new Error(n+"contains a function "+fl(t)+" with contents = "+e.toString());if(WI(e))throw new Error(n+"contains "+e.toString()+" "+fl(t));if(typeof e=="string"&&e.length>VN/3&&Mg(e)>VN)throw new Error(n+"contains a string greater than "+VN+" utf8 bytes "+fl(t)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,o=!1;if(wn(e,(s,a)=>{if(s===".value")i=!0;else if(s!==".priority"&&s!==".sv"&&(o=!0,!ZI(s)))throw new Error(n+" contains an invalid key ("+s+") "+fl(t)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);ote(t,s),_m(n,a,t),ste(t)}),i&&o)throw new Error(n+' contains ".value" child '+fl(t)+" in addition to actual children.")}},wne=function(n,e){let r,t;for(r=0;r<e.length;r++){t=e[r];let o=tm(t);for(let s=0;s<o.length;s++)if(!(o[s]===".priority"&&s===o.length-1)){if(!ZI(o[s]))throw new Error(n+"contains an invalid key ("+o[s]+") in path "+t.toString()+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`)}}e.sort(ite);let i=null;for(r=0;r<e.length;r++){if(t=e[r],i!==null&&gi(i,t))throw new Error(n+"contains a path "+i.toString()+" that is ancestor of another path "+t.toString());i=t}},n2=function(n,e,r,t){if(t&&e===void 0)return;let i=fa(n,"values");if(!(e&&typeof e=="object")||Array.isArray(e))throw new Error(i+" must be an object containing the children to replace.");let o=[];wn(e,(s,a)=>{let c=new Ke(s);if(_m(i,a,Vt(r,c)),$O(c)===".priority"&&!um(a))throw new Error(i+"contains an invalid value for '"+c.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");o.push(c)}),wne(i,o)},bne=function(n,e,r){if(!(r&&e===void 0)){if(WI(e))throw new Error(fa(n,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!um(e))throw new Error(fa(n,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},r2=function(n,e,r,t){if(!(t&&r===void 0)&&!ZI(r))throw new Error(fa(n,e)+'was an invalid key = "'+r+`". Firebase keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]").`)},ow=function(n,e,r,t){if(!(t&&r===void 0)&&!t2(r))throw new Error(fa(n,e)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},Lne=function(n,e,r,t){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),ow(n,e,r,t)},ya=function(n,e){if(Fe(e)===".info")throw new Error(n+" failed = Can't modify data under /.info/")},Mne=function(n,e){let r=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!ZI(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!One(r))throw new Error(fa(n,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};var NO=class{constructor(){this.eventLists_=[],this.recursionDepth_=0}};function ev(n,e){let r=null;for(let t=0;t<e.length;t++){let i=e[t],o=i.getPath();r!==null&&!jO(o,r.path)&&(n.eventLists_.push(r),r=null),r===null&&(r={events:[],path:o}),r.events.push(i)}r&&n.eventLists_.push(r)}function i2(n,e,r){ev(n,r),o2(n,t=>jO(t,e))}function Hr(n,e,r){ev(n,r),o2(n,t=>gi(t,e)||gi(e,t))}function o2(n,e){n.recursionDepth_++;let r=!0;for(let t=0;t<n.eventLists_.length;t++){let i=n.eventLists_[t];if(i){let o=i.path;e(o)?(Pne(n.eventLists_[t]),n.eventLists_[t]=null):r=!1}}r&&(n.eventLists_=[]),n.recursionDepth_--}function Pne(n){for(let e=0;e<n.events.length;e++){let r=n.events[e];if(r!==null){n.events[e]=null;let t=r.getEventRunner();ml&&On("event: "+r.toString()),Hd(t)}}}var xne="repo_interrupt",Fne=25,OO=class{constructor(e,r,t,i){this.repoInfo_=e,this.forceRestClient_=r,this.authTokenProvider_=t,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new NO,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=wI(),this.transactionQueueTree_=new lm,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}};function kne(n,e,r){if(n.stats_=GO(n.repoInfo_),n.forceRestClient_||Pee())n.server_=new cO(n.repoInfo_,(t,i,o,s)=>{t$(n,t,i,o,s)},n.authTokenProvider_,n.appCheckProvider_),setTimeout(()=>n$(n,!0),0);else{if(typeof r<"u"&&r!==null){if(typeof r!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{rn(r)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}n.persistentConnection_=new HO(n.repoInfo_,e,(t,i,o,s)=>{t$(n,t,i,o,s)},t=>{n$(n,t)},t=>{Une(n,t)},n.authTokenProvider_,n.appCheckProvider_,r),n.server_=n.persistentConnection_}n.authTokenProvider_.addTokenChangeListener(t=>{n.server_.refreshAuthToken(t)}),n.appCheckProvider_.addTokenChangeListener(t=>{n.server_.refreshAppCheckToken(t.token)}),n.statsReporter_=Fee(n.repoInfo_,()=>new fO(n.stats_,n.server_)),n.infoData_=new lO,n.infoSyncTree_=new VI({startListening:(t,i,o,s)=>{let a=[],c=n.infoData_.getNode(t._path);return c.isEmpty()||(a=pm(n.infoSyncTree_,t._path,c),setTimeout(()=>{s("ok")},0)),a},stopListening:()=>{}}),sw(n,"connected",!1),n.serverSyncTree_=new VI({startListening:(t,i,o,s)=>(n.server_.listen(t,o,i,(a,c)=>{let l=s(a,c);Hr(n.eventQueue_,t._path,l)}),[]),stopListening:(t,i)=>{n.server_.unlisten(t,i)}})}function s2(n){let r=n.infoData_.getNode(new Ke(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function Tm(n){return vne({timestamp:s2(n)})}function t$(n,e,r,t,i){n.dataUpdateCount++;let o=new Ke(e);r=n.interceptServerDataCallback_?n.interceptServerDataCallback_(e,r):r;let s=[];if(i)if(t){let c=bg(r,l=>Ut(l));s=mne(n.serverSyncTree_,o,c,i)}else{let c=Ut(r);s=K$(n.serverSyncTree_,o,c,i)}else if(t){let c=bg(r,l=>Ut(l));s=hne(n.serverSyncTree_,o,c)}else{let c=Ut(r);s=pm(n.serverSyncTree_,o,c)}let a=o;s.length>0&&(a=$d(n,o)),Hr(n.eventQueue_,a,s)}function n$(n,e){sw(n,"connected",e),e===!1&&$ne(n)}function Une(n,e){wn(e,(r,t)=>{sw(n,r,t)})}function sw(n,e,r){let t=new Ke("/.info/"+e),i=Ut(r);n.infoData_.updateSnapshot(t,i);let o=pm(n.infoSyncTree_,t,i);Hr(n.eventQueue_,t,o)}function tv(n){return n.nextWriteId_++}function Vne(n,e,r){let t=pne(n.serverSyncTree_,e);return t!=null?Promise.resolve(t):n.server_.get(e).then(i=>{let o=Ut(i).withIndex(e._queryParams.getIndex());AO(n.serverSyncTree_,e,r,!0);let s;if(e._queryParams.loadsAllData())s=pm(n.serverSyncTree_,e._path,o);else{let a=cm(n.serverSyncTree_,e);s=K$(n.serverSyncTree_,e._path,o,a)}return Hr(n.eventQueue_,e._path,s),BI(n.serverSyncTree_,e,r,null,!0),o},i=>(qd(n,"get for query "+rn(e)+" failed: "+i),Promise.reject(new Error(i))))}function Bne(n,e,r,t,i){qd(n,"set",{path:e.toString(),value:r,priority:t});let o=Tm(n),s=Ut(r,t),a=YI(n.serverSyncTree_,e),c=nw(s,a,o),l=tv(n),u=JO(n.serverSyncTree_,e,c,l,!0);ev(n.eventQueue_,u),n.server_.put(e.toString(),s.val(!0),(f,g)=>{let p=f==="ok";p||Jn("set at "+e+" failed: "+f);let _=va(n.serverSyncTree_,l,!p);Hr(n.eventQueue_,e,_),Na(n,i,f,g)});let d=cw(n,e);$d(n,d),Hr(n.eventQueue_,d,[])}function Gne(n,e,r,t){qd(n,"update",{path:e.toString(),value:r});let i=!0,o=Tm(n),s={};if(wn(r,(a,c)=>{i=!1,s[a]=J$(Vt(e,a),Ut(c),n.serverSyncTree_,o)}),i)On("update() called with empty data. Don't do anything."),Na(n,t,"ok",void 0);else{let a=tv(n),c=dne(n.serverSyncTree_,e,s,a);ev(n.eventQueue_,c),n.server_.merge(e.toString(),r,(l,u)=>{let d=l==="ok";d||Jn("update at "+e+" failed: "+l);let f=va(n.serverSyncTree_,a,!d),g=f.length>0?$d(n,e):e;Hr(n.eventQueue_,g,f),Na(n,t,l,u)}),wn(r,l=>{let u=cw(n,Vt(e,l));$d(n,u)}),Hr(n.eventQueue_,e,[])}}function $ne(n){qd(n,"onDisconnectEvents");let e=Tm(n),r=wI();dO(n.onDisconnect_,qe(),(i,o)=>{let s=J$(i,o,n.serverSyncTree_,e);Wd(r,i,s)});let t=[];dO(r,qe(),(i,o)=>{t=t.concat(pm(n.serverSyncTree_,i,o));let s=cw(n,i);$d(n,s)}),n.onDisconnect_=wI(),Hr(n.eventQueue_,qe(),t)}function jne(n,e,r){n.server_.onDisconnectCancel(e.toString(),(t,i)=>{t==="ok"&&uO(n.onDisconnect_,e),Na(n,r,t,i)})}function r$(n,e,r,t){let i=Ut(r);n.server_.onDisconnectPut(e.toString(),i.val(!0),(o,s)=>{o==="ok"&&Wd(n.onDisconnect_,e,i),Na(n,t,o,s)})}function Hne(n,e,r,t,i){let o=Ut(r,t);n.server_.onDisconnectPut(e.toString(),o.val(!0),(s,a)=>{s==="ok"&&Wd(n.onDisconnect_,e,o),Na(n,i,s,a)})}function Wne(n,e,r,t){if(wg(r)){On("onDisconnect().update() called with empty data. Don't do anything."),Na(n,t,"ok",void 0);return}n.server_.onDisconnectMerge(e.toString(),r,(i,o)=>{i==="ok"&&wn(r,(s,a)=>{let c=Ut(a);Wd(n.onDisconnect_,Vt(e,s),c)}),Na(n,t,i,o)})}function zne(n,e,r){let t;Fe(e._path)===".info"?t=AO(n.infoSyncTree_,e,r):t=AO(n.serverSyncTree_,e,r),i2(n.eventQueue_,e._path,t)}function wO(n,e,r){let t;Fe(e._path)===".info"?t=BI(n.infoSyncTree_,e,r):t=BI(n.serverSyncTree_,e,r),i2(n.eventQueue_,e._path,t)}function qne(n){n.persistentConnection_&&n.persistentConnection_.interrupt(xne)}function qd(n,...e){let r="";n.persistentConnection_&&(r=n.persistentConnection_.id+":"),On(r,...e)}function Na(n,e,r,t){e&&Hd(()=>{if(r==="ok")e(null);else{let i=(r||"error").toUpperCase(),o=i;t&&(o+=": "+t);let s=new Error(o);s.code=i,e(s)}})}function Kne(n,e,r,t,i,o){qd(n,"transaction on "+e);let s={path:e,update:r,onComplete:t,status:null,order:a$(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=aw(n,e,void 0);s.currentInputSnapshot=a;let c=s.update(a.val());if(c===void 0)s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&&s.onComplete(null,!1,s.currentInputSnapshot);else{_m("transaction failed: Data returned ",c,s.path),s.status=0;let l=XI(n.transactionQueueTree_,e),u=Dl(l)||[];u.push(s),iw(l,u);let d;typeof c=="object"&&c!==null&&di(c,".priority")?(d=ha(c,".priority"),ee(um(d),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):d=(YI(n.serverSyncTree_,e)||Ne.EMPTY_NODE).getPriority().val();let f=Tm(n),g=Ut(c,d),p=nw(g,a,f);s.currentOutputSnapshotRaw=g,s.currentOutputSnapshotResolved=p,s.currentWriteId=tv(n);let _=JO(n.serverSyncTree_,e,p,s.currentWriteId,s.applyLocally);Hr(n.eventQueue_,e,_),nv(n,n.transactionQueueTree_)}}function aw(n,e,r){return YI(n.serverSyncTree_,e,r)||Ne.EMPTY_NODE}function nv(n,e=n.transactionQueueTree_){if(e||rv(n,e),Dl(e)){let r=c2(n,e);ee(r.length>0,"Sending zero length transaction queue"),r.every(i=>i.status===0)&&Yne(n,Em(e),r)}else Z$(e)&&JI(e,r=>{nv(n,r)})}function Yne(n,e,r){let t=r.map(l=>l.currentWriteId),i=aw(n,e,t),o=i,s=i.hash();for(let l=0;l<r.length;l++){let u=r[l];ee(u.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=1,u.retryCount++;let d=dr(e,u.path);o=o.updateChild(d,u.currentOutputSnapshotRaw)}let a=o.val(!0),c=e;n.server_.put(c.toString(),a,l=>{qd(n,"transaction put response",{path:c.toString(),status:l});let u=[];if(l==="ok"){let d=[];for(let f=0;f<r.length;f++)r[f].status=2,u=u.concat(va(n.serverSyncTree_,r[f].currentWriteId)),r[f].onComplete&&d.push(()=>r[f].onComplete(null,!0,r[f].currentOutputSnapshotResolved)),r[f].unwatcher();rv(n,XI(n.transactionQueueTree_,e)),nv(n,n.transactionQueueTree_),Hr(n.eventQueue_,e,u);for(let f=0;f<d.length;f++)Hd(d[f])}else{if(l==="datastale")for(let d=0;d<r.length;d++)r[d].status===3?r[d].status=4:r[d].status=0;else{Jn("transaction at "+c.toString()+" failed: "+l);for(let d=0;d<r.length;d++)r[d].status=4,r[d].abortReason=l}$d(n,e)}},s)}function $d(n,e){let r=a2(n,e),t=Em(r),i=c2(n,r);return Qne(n,i,t),t}function Qne(n,e,r){if(e.length===0)return;let t=[],i=[],s=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){let c=e[a],l=dr(r,c.path),u=!1,d;if(ee(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)u=!0,d=c.abortReason,i=i.concat(va(n.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=Fne)u=!0,d="maxretry",i=i.concat(va(n.serverSyncTree_,c.currentWriteId,!0));else{let f=aw(n,c.path,s);c.currentInputSnapshot=f;let g=e[a].update(f.val());if(g!==void 0){_m("transaction failed: Data returned ",g,c.path);let p=Ut(g);typeof g=="object"&&g!=null&&di(g,".priority")||(p=p.updatePriority(f.getPriority()));let T=c.currentWriteId,S=Tm(n),b=nw(p,f,S);c.currentOutputSnapshotRaw=p,c.currentOutputSnapshotResolved=b,c.currentWriteId=tv(n),s.splice(s.indexOf(T),1),i=i.concat(JO(n.serverSyncTree_,c.path,b,c.currentWriteId,c.applyLocally)),i=i.concat(va(n.serverSyncTree_,T,!0))}else u=!0,d="nodata",i=i.concat(va(n.serverSyncTree_,c.currentWriteId,!0))}Hr(n.eventQueue_,r,i),i=[],u&&(e[a].status=2,(function(f){setTimeout(f,Math.floor(0))})(e[a].unwatcher),e[a].onComplete&&(d==="nodata"?t.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):t.push(()=>e[a].onComplete(new Error(d),!1,null))))}rv(n,n.transactionQueueTree_);for(let a=0;a<t.length;a++)Hd(t[a]);nv(n,n.transactionQueueTree_)}function a2(n,e){let r,t=n.transactionQueueTree_;for(r=Fe(e);r!==null&&Dl(t)===void 0;)t=XI(t,r),e=ht(e),r=Fe(e);return t}function c2(n,e){let r=[];return l2(n,e,r),r.sort((t,i)=>t.order-i.order),r}function l2(n,e,r){let t=Dl(e);if(t)for(let i=0;i<t.length;i++)r.push(t[i]);JI(e,i=>{l2(n,i,r)})}function rv(n,e){let r=Dl(e);if(r){let t=0;for(let i=0;i<r.length;i++)r[i].status!==2&&(r[t]=r[i],t++);r.length=t,iw(e,r.length>0?r:void 0)}JI(e,t=>{rv(n,t)})}function cw(n,e){let r=Em(a2(n,e)),t=XI(n.transactionQueueTree_,e);return Dne(t,i=>{BN(n,i)}),BN(n,t),e2(t,i=>{BN(n,i)}),r}function BN(n,e){let r=Dl(e);if(r){let t=[],i=[],o=-1;for(let s=0;s<r.length;s++)r[s].status===3||(r[s].status===1?(ee(o===s-1,"All SENT items should be at beginning of queue."),o=s,r[s].status=3,r[s].abortReason="set"):(ee(r[s].status===0,"Unexpected transaction status in abort"),r[s].unwatcher(),i=i.concat(va(n.serverSyncTree_,r[s].currentWriteId,!0)),r[s].onComplete&&t.push(r[s].onComplete.bind(null,new Error("set"),!1,null))));o===-1?iw(e,void 0):r.length=o+1,Hr(n.eventQueue_,Em(e),i);for(let s=0;s<t.length;s++)Hd(t[s])}}function Xne(n){let e="",r=n.split("/");for(let t=0;t<r.length;t++)if(r[t].length>0){let i=r[t];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function Jne(n){let e={};n.charAt(0)==="?"&&(n=n.substring(1));for(let r of n.split("&")){if(r.length===0)continue;let t=r.split("=");t.length===2?e[decodeURIComponent(t[0])]=decodeURIComponent(t[1]):Jn(`Invalid query segment '${r}' in query '${n}'`)}return e}var i$=function(n,e){let r=Zne(n),t=r.namespace;r.domain==="firebase.com"&&ys(r.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!t||t==="undefined")&&r.domain!=="localhost"&&ys("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),r.secure||Dee();let i=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new vI(r.host,r.secure,t,i,e,"",t!==r.subdomain),path:new Ke(r.pathString)}},Zne=function(n){let e="",r="",t="",i="",o="",s=!0,a="https",c=443;if(typeof n=="string"){let l=n.indexOf("//");l>=0&&(a=n.substring(0,l-1),n=n.substring(l+2));let u=n.indexOf("/");u===-1&&(u=n.length);let d=n.indexOf("?");d===-1&&(d=n.length),e=n.substring(0,Math.min(u,d)),u<d&&(i=Xne(n.substring(u,d)));let f=Jne(n.substring(Math.min(n.length,d)));l=e.indexOf(":"),l>=0?(s=a==="https"||a==="wss",c=parseInt(e.substring(l+1),10)):l=e.length;let g=e.slice(0,l);if(g.toLowerCase()==="localhost")r="localhost";else if(g.split(".").length<=2)r=g;else{let p=e.indexOf(".");t=e.substring(0,p).toLowerCase(),r=e.substring(p+1),o=t}"ns"in f&&(o=f.ns)}return{host:e,port:c,domain:r,subdomain:t,secure:s,scheme:a,pathString:i,namespace:o}};var o$="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",ere=(function(){let n=0,e=[];return function(r){let t=r===n;n=r;let i,o=new Array(8);for(i=7;i>=0;i--)o[i]=o$.charAt(r%64),r=Math.floor(r/64);ee(r===0,"Cannot push at time == 0");let s=o.join("");if(t){for(i=11;i>=0&&e[i]===63;i--)e[i]=0;e[i]++}else for(i=0;i<12;i++)e[i]=Math.floor(Math.random()*64);for(i=0;i<12;i++)s+=o$.charAt(e[i]);return ee(s.length===20,"nextPushId: Length should be 20."),s}})();var GI=class{constructor(e,r,t,i){this.eventType=e,this.eventRegistration=r,this.snapshot=t,this.prevName=i}getPath(){let e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+rn(this.snapshot.exportVal())}},$I=class{constructor(e,r,t){this.eventRegistration=e,this.error=r,this.path=t}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}};var dm=class{constructor(e,r){this.snapshotCallback=e,this.cancelCallback=r}onValue(e,r){this.snapshotCallback.call(null,e,r)}onCancel(e){return ee(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}};var bO=class{constructor(e,r){this._repo=e,this._path=r}cancel(){let e=new Nn;return jne(this._repo,this._path,e.wrapCallback(()=>{})),e.promise}remove(){ya("OnDisconnect.remove",this._path);let e=new Nn;return r$(this._repo,this._path,null,e.wrapCallback(()=>{})),e.promise}set(e){ya("OnDisconnect.set",this._path),Tl("OnDisconnect.set",e,this._path,!1);let r=new Nn;return r$(this._repo,this._path,e,r.wrapCallback(()=>{})),r.promise}setWithPriority(e,r){ya("OnDisconnect.setWithPriority",this._path),Tl("OnDisconnect.setWithPriority",e,this._path,!1),bne("OnDisconnect.setWithPriority",r,!1);let t=new Nn;return Hne(this._repo,this._path,e,r,t.wrapCallback(()=>{})),t.promise}update(e){ya("OnDisconnect.update",this._path),n2("OnDisconnect.update",e,this._path,!1);let r=new Nn;return Wne(this._repo,this._path,e,r.wrapCallback(()=>{})),r.promise}};var Il=class n{constructor(e,r,t,i){this._repo=e,this._path=r,this._queryParams=t,this._orderByCalled=i}get key(){return ke(this._path)?null:$O(this._path)}get ref(){return new Wi(this._repo,this._path)}get _queryIdentifier(){let e=HG(this._queryParams),r=BO(e);return r==="{}"?"default":r}get _queryObject(){return HG(this._queryParams)}isEqual(e){if(e=Ge(e),!(e instanceof n))return!1;let r=this._repo===e._repo,t=jO(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return r&&t&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+rte(this._path)}};function tre(n,e){if(n._orderByCalled===!0)throw new Error(e+": You can't combine multiple orderBy calls.")}function lw(n){let e=null,r=null;if(n.hasStart()&&(e=n.getIndexStartValue()),n.hasEnd()&&(r=n.getIndexEndValue()),n.getIndex()===pl){let t="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() must be a string.";if(n.hasStart()){if(n.getIndexStartName()!==El)throw new Error(t);if(typeof e!="string")throw new Error(i)}if(n.hasEnd()){if(n.getIndexEndName()!==Da)throw new Error(t);if(typeof r!="string")throw new Error(i)}}else if(n.getIndex()===At){if(e!=null&&!um(e)||r!=null&&!um(r))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(ee(n.getIndex()instanceof nm||n.getIndex()===M$,"unknown index type."),e!=null&&typeof e=="object"||r!=null&&typeof r=="object")throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")}function u2(n){if(n.hasStart()&&n.hasEnd()&&n.hasLimit()&&!n.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")}var Wi=class n extends Il{constructor(e,r){super(e,r,new aO,!1)}get parent(){let e=C$(this._path);return e===null?null:new n(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}},jd=class n{constructor(e,r,t){this._node=e,this.ref=r,this._index=t}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){let r=new Ke(e),t=vl(this.ref,e);return new n(this._node.getChild(r),t,At)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(t,i)=>e(new n(i,vl(this.ref,t),At)))}hasChild(e){let r=new Ke(e);return!this._node.getChild(r).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}};function d2(n,e){return n=Ge(n),n._checkNotDeleted("ref"),e!==void 0?vl(n._root,e):n._root}function vl(n,e){return n=Ge(n),Fe(n._path)===null?Lne("child","path",e,!1):ow("child","path",e,!1),new Wi(n._repo,Vt(n._path,e))}function h2(n){return n=Ge(n),new bO(n._repo,n._path)}function f2(n,e){n=Ge(n),ya("push",n._path),Tl("push",e,n._path,!0);let r=s2(n._repo),t=ere(r),i=vl(n,t),o=vl(n,t),s;return e!=null?s=iv(o,e).then(()=>o):s=Promise.resolve(o),i.then=s.then.bind(s),i.catch=s.then.bind(s,void 0),i}function g2(n){return ya("remove",n._path),iv(n,null)}function iv(n,e){n=Ge(n),ya("set",n._path),Tl("set",e,n._path,!1);let r=new Nn;return Bne(n._repo,n._path,e,null,r.wrapCallback(()=>{})),r.promise}function m2(n,e){n2("update",e,n._path,!1);let r=new Nn;return Gne(n._repo,n._path,e,r.wrapCallback(()=>{})),r.promise}function ov(n){n=Ge(n);let e=new dm(()=>{}),r=new hm(e);return Vne(n._repo,n,r).then(t=>new jd(t,new Wi(n._repo,n._path),n._queryParams.getIndex()))}var hm=class n{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,r){let t=r._queryParams.getIndex();return new GI("value",this,new jd(e.snapshotNode,new Wi(r._repo,r._path),t))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,r){return this.callbackContext.hasCancelCallback?new $I(this,e,r):null}matches(e){return e instanceof n?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}},jI=class n{constructor(e,r){this.eventType=e,this.callbackContext=r}respondsTo(e){let r=e==="children_added"?"child_added":e;return r=r==="children_removed"?"child_removed":r,this.eventType===r}createCancelEvent(e,r){return this.callbackContext.hasCancelCallback?new $I(this,e,r):null}createEvent(e,r){ee(e.childName!=null,"Child events should have a childName.");let t=vl(new Wi(r._repo,r._path),e.childName),i=r._queryParams.getIndex();return new GI(e.type,this,new jd(e.snapshotNode,t,i),e.prevName)}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,e.prevName)}matches(e){return e instanceof n?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}};function Im(n,e,r,t,i){let o;if(typeof t=="object"&&(o=void 0,i=t),typeof t=="function"&&(o=t),i&&i.onlyOnce){let c=r,l=(u,d)=>{wO(n._repo,n,a),c(u,d)};l.userCallback=r.userCallback,l.context=r.context,r=l}let s=new dm(r,o||void 0),a=e==="value"?new hm(s):new jI(e,s);return zne(n._repo,n,a),()=>wO(n._repo,n,a)}function vm(n,e,r,t){return Im(n,"value",e,r,t)}function sv(n,e,r,t){return Im(n,"child_added",e,r,t)}function av(n,e,r,t){return Im(n,"child_changed",e,r,t)}function uw(n,e,r,t){return Im(n,"child_moved",e,r,t)}function cv(n,e,r,t){return Im(n,"child_removed",e,r,t)}function lv(n,e,r){let t=null,i=r?new dm(r):null;e==="value"?t=new hm(i):e&&(t=new jI(e,i)),wO(n._repo,n,t)}var yl=class{},LO=class extends yl{constructor(e,r){super(),this._value=e,this._key=r,this.type="endAt"}_apply(e){Tl("endAt",this._value,e._path,!0);let r=vte(e._queryParams,this._value,this._key);if(u2(r),lw(r),e._queryParams.hasEnd())throw new Error("endAt: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new Il(e._repo,e._path,r,e._orderByCalled)}};var HI=class extends yl{constructor(e,r){super(),this._value=e,this._key=r,this.type="startAt"}_apply(e){Tl("startAt",this._value,e._path,!0);let r=Ite(e._queryParams,this._value,this._key);if(u2(r),lw(r),e._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new Il(e._repo,e._path,r,e._orderByCalled)}};function p2(n=null,e){return r2("startAt","key",e,!0),new HI(n,e)}var MO=class extends yl{constructor(e){super(),this._limit=e,this.type="limitToLast"}_apply(e){if(e._queryParams.hasLimit())throw new Error("limitToLast: Limit was already set (by another call to limitToFirst or limitToLast).");return new Il(e._repo,e._path,Tte(e._queryParams,this._limit),e._orderByCalled)}};function E2(n){if(typeof n!="number"||Math.floor(n)!==n||n<=0)throw new Error("limitToLast: First argument must be a positive integer.");return new MO(n)}var PO=class extends yl{constructor(e){super(),this._path=e,this.type="orderByChild"}_apply(e){tre(e,"orderByChild");let r=new Ke(this._path);if(ke(r))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");let t=new nm(r),i=yte(e._queryParams,t);return lw(i),new Il(e._repo,e._path,i,!0)}};function _2(n){if(n==="$key")throw new Error('orderByChild: "$key" is invalid. Use orderByKey() instead.');if(n==="$priority")throw new Error('orderByChild: "$priority" is invalid. Use orderByPriority() instead.');if(n==="$value")throw new Error('orderByChild: "$value" is invalid. Use orderByValue() instead.');return ow("orderByChild","path",n,!1),new PO(n)}var xO=class extends yl{constructor(e,r){super(),this._value=e,this._key=r,this.type="equalTo"}_apply(e){if(Tl("equalTo",this._value,e._path,!1),e._queryParams.hasStart())throw new Error("equalTo: Starting point was already set (by another call to startAt/startAfter or equalTo).");if(e._queryParams.hasEnd())throw new Error("equalTo: Ending point was already set (by another call to endAt/endBefore or equalTo).");return new LO(this._value,this._key)._apply(new HI(this._value,this._key)._apply(e))}};function T2(n,e){return r2("equalTo","key",e,!0),new xO(n,e)}function I2(n,...e){let r=Ge(n);for(let t of e)r=t._apply(r);return r}rne(Wi);cne(Wi);var nre="FIREBASE_DATABASE_EMULATOR_HOST",FO={},rre=!1;function ire(n,e,r,t){let i=e.lastIndexOf(":"),o=e.substring(0,i),s=jr(o);n.repoInfo_=new vI(e,s,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams,!0,r),t&&(n.authTokenProvider_=t)}function ore(n,e,r,t,i){let o=t||n.options.databaseURL;o===void 0&&(n.options.projectId||ys("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),On("Using default host for project ",n.options.projectId),o=`${n.options.projectId}-default-rtdb.firebaseio.com`);let s=i$(o,i),a=s.repoInfo,c,l;typeof process<"u"&&process.env&&(l=process.env[nre]),l?(c=!0,o=`http://${l}?ns=${a.namespace}`,s=i$(o,i),a=s.repoInfo):c=!s.repoInfo.secure;let u=i&&c?new Xg(Xg.OWNER):new zN(n.name,n.options,e);Mne("Invalid Firebase Database URL",s),ke(s.path)||ys("Database URL must point to the root of a Firebase Database (not including a child path).");let d=are(a,n,u,new WN(n,r));return new kO(d,n)}function sre(n,e){let r=FO[e];(!r||r[n.key]!==n)&&ys(`Database ${e}(${n.repoInfo_}) has already been deleted.`),qne(n),delete r[n.key]}function are(n,e,r,t){let i=FO[e.name];i||(i={},FO[e.name]=i);let o=i[n.toURLString()];return o&&ys("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),o=new OO(n,rre,r,t),i[n.toURLString()]=o,o}var kO=class{constructor(e,r){this._repoInternal=e,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(kne(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Wi(this._repo,qe())),this._rootInternal}_delete(){return this._rootInternal!==null&&(sre(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&ys("Cannot call "+e+" on a deleted database.")}};function cre(){R$.IS_TRANSPORT_INITIALIZED&&Jn("Transport has already been initialized. Please call this function before calling ref or setting up a listener")}function dw(){cre(),Md.forceDisallow(),yI.forceAllow()}function uv(n=yr(),e){let r=Mo(n,"database").getImmediate({identifier:e});if(!r._instanceStarted){let t=Cd("database");t&&v2(r,...t)}return r}function v2(n,e,r,t={}){n=Ge(n),n._checkNotDeleted("useEmulator");let i=`${e}:${r}`,o=n._repoInternal;if(n._instanceStarted){if(i===n._repoInternal.repoInfo_.host&&Ui(t,o.repoInfo_.emulatorOptions))return;ys("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(o.repoInfo_.nodeAdmin)t.mockUserToken&&ys('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new Xg(Xg.OWNER);else if(t.mockUserToken){let a=typeof t.mockUserToken=="string"?t.mockUserToken:qT(t.mockUserToken,n.app.options.projectId);s=new Xg(a)}jr(e)&&(da(e),ol("Database",!0)),ire(o,i,t,s)}function lre(n){See(ma),lr(new _n("database",(e,{instanceIdentifier:r})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),o=e.getProvider("app-check-internal");return ore(t,i,o,r)},"PUBLIC").setMultipleInstances(!0)),Qe(CG,NG,n),Qe(CG,NG,"esm2017")}var UO=class{constructor(e,r){this.committed=e,this.snapshot=r}toJSON(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}}};function y2(n,e,r){var t;if(n=Ge(n),ya("Reference.transaction",n._path),n.key===".length"||n.key===".keys")throw"Reference.transaction failed: "+n.key+" is a read-only object.";let i=(t=r?.applyLocally)!==null&&t!==void 0?t:!0,o=new Nn,s=(c,l,u)=>{let d=null;c?o.reject(c):(d=new jd(u,new Wi(n._repo,n._path),At),o.resolve(new UO(l,d)))},a=vm(n,()=>{});return Kne(n._repo,n._path,e,s,a,i),o.promise}HO.prototype.simpleListen=function(n,e){this.sendRequest("q",{p:n},e)};HO.prototype.echo=function(n,e){this.sendRequest("echo",{d:n},e)};lre();var Rl,bn=(function(n){return n.added="child_added",n.removed="child_removed",n.changed="child_changed",n.moved="child_moved",n.value="value",n})(bn||{}),ure=Object.freeze((Rl={},Rl[bn.added]=sv,Rl[bn.removed]=cv,Rl[bn.changed]=av,Rl[bn.moved]=uw,Rl[bn.value]=vm,Rl));function hv(n,e){return new ge(function(r){var t=ure[e](n,function(i,o){r.next({snapshot:i,prevKey:o,event:e})},r.error.bind(r));return{unsubscribe:function(){lv(n,e,t)}}}).pipe(AS(0))}var dv=function(){return dv=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++){r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},dv.apply(this,arguments)};function hw(n,e,r){if(r||arguments.length===2)for(var t=0,i=e.length,o;t<i;t++)(o||!(t in e))&&(o||(o=Array.prototype.slice.call(e,0,t)),o[t]=e[t]);return n.concat(o||Array.prototype.slice.call(e))}function S2(n){return(n==null||n.length===0)&&(n=[bn.added,bn.removed,bn.changed,bn.moved]),n}function A2(n,e){return e===void 0&&(e={}),hv(n,bn.value).pipe(fe(function(r){return fw(r,e)}))}function fw(n,e){var r;e===void 0&&(e={});var t=n.snapshot.val();return!n.snapshot.exists()||typeof t!="object"?t:dv(dv({},t),e.keyField?(r={},r[e.keyField]=n.snapshot.key,r):null)}function D2(n,e){e===void 0&&(e={});var r=S2(e.events),t=r.map(function(i){return hv(n,i)});return Mu.apply(void 0,t)}function dre(n){return Pr(ov(n)).pipe(fe(function(e){var r=bn.value;return{snapshot:e,prevKey:null,event:r}}))}function R2(n,e){e===void 0&&(e={});var r=S2(e.events);return dre(n).pipe(mt(function(t){var i=[ue(t)];return r.forEach(function(o){i.push(hv(n,o))}),Mu.apply(void 0,i).pipe(uE(fre,[]))}),it())}function C2(n,e){return e===void 0&&(e={}),R2(n).pipe(fe(function(r){return r.map(function(t){return fw(t,e)})}))}function N2(n,e){for(var r=n.length,t=0;t<r;t++)if(n[t].snapshot.key===e)return t;return-1}function hre(n,e){if(e==null)return 0;var r=N2(n,e);return r===-1?n.length:r+1}function fre(n,e){var r=e.snapshot,t=e.prevKey,i=e.event,o=r.key,s=N2(n,o),a=hre(n,t||void 0);switch(i){case bn.value:if(e.snapshot&&e.snapshot.exists()){var c=null;e.snapshot.forEach(function(d){var f={snapshot:d,event:bn.value,prevKey:c};return c=d.key,n=hw(hw([],n,!0),[f],!1),!1})}return n;case bn.added:if(s>-1){var l=n[s-1];(l&&l.snapshot.key||null)!==t&&(n=n.filter(function(d){return d.snapshot.key!==r.key}),n.splice(a,0,e))}else{if(t==null)return hw([e],n,!0);n=n.slice(),n.splice(a,0,e)}return n;case bn.removed:return n.filter(function(d){return d.snapshot.key!==r.key});case bn.changed:return n.map(function(d){return d.snapshot.key===o?e:d});case bn.moved:if(s>-1){var u=n.splice(s,1)[0];return n=n.slice(),n.splice(a,0,u),n}return n;default:return n}}var ym=class{constructor(e){return e}},O2="database",gw=class{constructor(){return Is(O2)}};var mw=new Z("angularfire2.database-instances");function gre(n,e){let r=pa(O2,n,e);return r&&new ym(r)}function mre(n){return(e,r)=>{let t=e.runOutsideAngular(()=>n(r));return new ym(t)}}var pre={provide:gw,deps:[[new pn,mw]]},Ere={provide:ym,useFactory:gre,deps:[[new pn,mw],Gi]};function VPe(n,...e){return Qe("angularfire",Vi.full,"rtdb"),mr([Ere,pre,{provide:mw,useFactory:mre(n),multi:!0,deps:[be,St,Bi,vs,[new pn,hl],[new pn,_a],...e]}])}var BPe=pe(C2,!0);var GPe=pe(A2,!0),$Pe=pe(D2,!0);var jPe=pe(T2,!0,2);var pw=pe(ov,!0),HPe=pe(uv,!0);var WPe=pe(E2,!0,2),Sm=pe(lv,!0),Ew=pe(sv,!0),w2=pe(av,!0);var b2=pe(cv,!0),L2=pe(h2,!0),fv=pe(vm,!0),zPe=pe(_2,!0,2);var M2=pe(f2,!0,2),_w=pe(I2,!0,2),Oa=pe(d2,!0,2);var P2=pe(g2,!0,2),Tw=pe(y2,!0),Iw=pe(iv,!0,2);var qPe=pe(p2,!0,2),x2=pe(m2,!0,2);var Dr=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.analyticsService=i,this.config$=new Y(null),this.disableLogsConfig$=new Y({warnings:!0,suppressAll:!1}),this.apiKey$=new Y(""),this.baseFeatureAllowList=[],this.sf$=new Y(!1),this.sdkType$=new Y("core"),this.logsEnabled$=new Y(!0),this.safeEval$=new Y(!1),this.firestorePersistentCacheEnabled$=new Y(!1),this.encryptionProvider$=new Y(null);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(o=>{this.analyticsService.updateDefaultProperties({sdkType:o})},o=>{this.loggingService.catch("Error in ConfigService sdkType$: ",o)}),this.logsEnabled$.subscribe(o=>{o?this.loggingService.enableLogs():this.loggingService.disableLogs(),H.logsEnabled=o},o=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",o)})}catch(o){this.loggingService.catch("Error in ConfigService constructor: ",o)}}initConfig(t){try{t.featureAllowList?.length||(t.featureAllowList=Object.values(pC)),this.baseFeatureAllowList=t.featureAllowList?.slice();try{t.proxyConfig?.authHost?localStorage.setItem(v.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST,btoa(t.proxyConfig.authHost)):localStorage.removeItem(v.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST)}catch{}this.config$.next(t)}catch(i){this.loggingService.catch("Error in ConfigService initConfig: ",i)}}setApiKey(t){this.apiKey$.next(t)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(t){try{let i=this.config$.value;i&&(t?.length?i.featureAllowList=this.baseFeatureAllowList.filter(o=>!t.includes(o)):i.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService disableFeatures: ",i)}}enableFeatures(t){try{if(!t?.length)return;let i=this.config$.value;if(!i)return;let o=i.featureAllowList??[],s=t.filter(a=>!o.includes(a));if(s.length===0)return;i.featureAllowList=[...o,...s],this.baseFeatureAllowList=[...this.baseFeatureAllowList,...s.filter(a=>!this.baseFeatureAllowList.includes(a))],this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService enableFeatures: ",i)}}setSF(t){try{this.sf$.next(t),this.analyticsService.setSF(t)}catch(i){this.loggingService.catch("Error in ConfigService setSF: ",i)}}getSF(){try{return this.sf$.value}catch(t){return this.loggingService.catch("Error in ConfigService getSF: ",t),!1}}getSF$(){try{return this.sf$.asObservable().pipe(it(Ft))}catch(t){return this.loggingService.catch("Error in ConfigService getSF$: ",t),ue(!1)}}setSdkType(t){try{this.sdkType$.next(t)}catch(i){this.loggingService.catch("Error in ConfigService setSdkType: ",i)}}getSdkType(){try{return this.sdkType$.value}catch(t){return this.loggingService.catch("Error in ConfigService getSdkType: ",t),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(t){return this.loggingService.catch("Error in ConfigService getSdkType$: ",t),ue("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(t){this.loggingService.catch("Error in ConfigService enableLogs: ",t)}}disableLogs(t){try{t&&this.disableLogsConfig$.next({warnings:t.warnings??!0,suppressAll:t.suppressAll??!1}),t?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(i){this.loggingService.catch("Error in ConfigService disableLogs: ",i)}}getDisableLogsConfig(){return this.disableLogsConfig$.value}getDisableLogsConfig$(){return this.disableLogsConfig$.asObservable()}getProxyConfig(){try{return this.config$.value?.proxyConfig}catch(t){this.loggingService.catch("Error in ConfigService getProxyConfig: ",t);return}}getAuthProxyHost(){try{let t=this.config$.value?.proxyConfig?.authHost;if(t)return t;let i=localStorage.getItem(v.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);return i?atob(i):void 0}catch(t){this.loggingService.catch("Error in ConfigService getAuthProxyHost: ",t);return}}getApiHost(){try{return this.getProxyConfig()?.apiHost||this.config$.value?.apiProxyDomain}catch(t){this.loggingService.catch("Error in ConfigService getApiHost: ",t);return}}getApiProxyDomain(){return this.getApiHost()}enableSafeEval(){try{this.safeEval$.next(!0)}catch(t){this.loggingService.catch("Error in ConfigService enableSafeEval: ",t)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(t){this.loggingService.catch("Error in ConfigService disableSafeEval: ",t)}}getSafeEval(){try{return this.safeEval$.value}catch(t){return this.loggingService.catch("Error in ConfigService getSafeEval: ",t),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(t){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",t),ue(!1)}}enableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!0)}catch(t){this.loggingService.catch("Error in ConfigService enableFirestorePersistentCache: ",t)}}disableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!1)}catch(t){this.loggingService.catch("Error in ConfigService disableFirestorePersistentCache: ",t)}}isFirestorePersistentCacheEnabled(){try{return this.firestorePersistentCacheEnabled$.value}catch(t){return this.loggingService.catch("Error in ConfigService isFirestorePersistentCacheEnabled: ",t),!1}}getFirestorePersistentCacheEnabled$(){try{return this.firestorePersistentCacheEnabled$.asObservable()}catch(t){return this.loggingService.catch("Error in ConfigService getFirestorePersistentCacheEnabled$: ",t),ue(!1)}}setEncryptionProvider(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(t)}catch(i){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",i)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(t){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",t),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(t){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",t),ue(null)}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var F2=(()=>{let e=class e{constructor(t){this.loggingService=t,this.initLocalStorageData()}initLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: initLocalStorageData","color: green;"),this.getLocalStorageData(),this.getSessionStorageData()}getLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStorageData","color: green;");try{let t=localStorage?.getItem(v.LOCALSTORAGE_DATA_ID);if(t)return JSON.parse(t);{let i=new tl;return this.setLocalStorageData(i),i}}catch(t){return this.loggingService.catch("Error in getLocalStorageData:",t),new tl}}setLocalStorageData(t){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(t){let i=JSON.stringify(t);localStorage?.setItem(v.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setLocalStorageData:",i)}}deleteLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteLocalStorageData","color: green;"),localStorage?.removeItem(v.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let t=sessionStorage?.getItem(v.LOCALSTORAGE_DATA_ID);if(t)return JSON.parse(t);{let i=new tl;return this.setSessionStorageData(i),i}}catch(t){return this.loggingService.catch("Error in getSessionStorageData:",t),new tl}}setSessionStorageData(t){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(t){let i=JSON.stringify(t);sessionStorage?.setItem(v.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setSessionStorageData:",i)}}deleteSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteSessionStorageData","color: green;");try{sessionStorage?.removeItem(v.LOCALSTORAGE_DATA_ID)}catch(t){this.loggingService.catch("Error in deleteSessionStorageData:",t)}}};e.\u0275fac=function(i){return new(i||e)(w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var k2=(()=>{let e=class e{constructor(t,i){this.localStorageService=t,this.loggingService=i,this.avatarList=[{userId:"1",name:"Bear",photoUrl:"https://snippyly.com/assets/avatars/avatar-bear.svg",type:"anonymous"},{userId:"2",name:"Beaver",photoUrl:"https://snippyly.com/assets/avatars/avatar-beaver.svg",type:"anonymous"},{userId:"3",name:"Bunny",photoUrl:"https://snippyly.com/assets/avatars/avatar-bunny.svg",type:"anonymous"},{userId:"4",name:"Cat",photoUrl:"https://snippyly.com/assets/avatars/avatar-cat.svg",type:"anonymous"},{userId:"5",name:"Cow",photoUrl:"https://snippyly.com/assets/avatars/avatar-cow.svg",type:"anonymous"},{userId:"6",name:"Dinosaur",photoUrl:"https://snippyly.com/assets/avatars/avatar-dinosaur.svg",type:"anonymous"},{userId:"7",name:"Elephant",photoUrl:"https://snippyly.com/assets/avatars/avatar-elephant.svg",type:"anonymous"},{userId:"8",name:"Monkey",photoUrl:"https://snippyly.com/assets/avatars/avatar-monkey.svg",type:"anonymous"},{userId:"9",name:"Hedgehog",photoUrl:"https://snippyly.com/assets/avatars/avatar-hedgehog.svg",type:"anonymous"},{userId:"10",name:"Hippo",photoUrl:"https://snippyly.com/assets/avatars/avatar-hippo.svg",type:"anonymous"},{userId:"11",name:"Horse",photoUrl:"https://snippyly.com/assets/avatars/avatar-horse.svg",type:"anonymous"},{userId:"12",name:"Kitten",photoUrl:"https://snippyly.com/assets/avatars/avatar-kitten.svg",type:"anonymous"},{userId:"13",name:"Octopus",photoUrl:"https://snippyly.com/assets/avatars/avatar-octopus.svg",type:"anonymous"},{userId:"14",name:"Oink",photoUrl:"https://snippyly.com/assets/avatars/avatar-oink.svg",type:"anonymous"},{userId:"15",name:"Panda",photoUrl:"https://snippyly.com/assets/avatars/avatar-panda.svg",type:"anonymous"},{userId:"16",name:"Penguin",photoUrl:"https://snippyly.com/assets/avatars/avatar-penguin.svg",type:"anonymous"},{userId:"17",name:"Rabbit",photoUrl:"https://snippyly.com/assets/avatars/avatar-rabbit.svg",type:"anonymous"},{userId:"18",name:"Tiger",photoUrl:"https://snippyly.com/assets/avatars/avatar-tiger.svg",type:"anonymous"}],this.loggingService.log("%c[WB] Creating SERVICE AvatarService","color: blue;")}getSessionAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionAvatar","color: green;");try{let t=new Es,i=this.localStorageService.getSessionStorageData();if(i.snippylyAvatar)t=i.snippylyAvatar;else{let o=this.generateUserAvatar();i.snippylyAvatar=o,this.localStorageService.setSessionStorageData(i)}return t}catch(t){return this.loggingService.catch("Error in getSessionAvatar:",t),new Es}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let t=Math.floor(Math.random()*this.avatarList.length),i=this.avatarList[t];return i.color=this.generateUserColor(),i}catch(t){return this.loggingService.catch("Error in generateUserAvatar:",t),this.avatarList[0]}}generateUserColor(t){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserColor","color: green;");try{if(t)return v.AVATAR_COLOR_LIST[t%v.AVATAR_COLOR_LIST.length];let i=Math.floor(Math.random()*v.AVATAR_COLOR_LIST.length);return v.AVATAR_COLOR_LIST[i]}catch(i){return this.loggingService.catch("Error in generateUserColor:",i),""}}generateUserImage(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserImage","color: green;");try{return this.getSessionAvatar().photoUrl}catch(t){return this.loggingService.catch("Error in generateUserImage:",t),""}}};e.\u0275fac=function(i){return new(i||e)(w(F2),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var It=(()=>{let e=class e{constructor(t){this.loggingService=t,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(t,i){try{this.actionSubjects.has(t)||this.actionSubjects.set(t,new Ot),this.actionSubjects.get(t)?.next(i)}catch(o){this.loggingService.catch("Error in CoreActionsService triggerAction: ",o)}}onAction(t){try{this.actionSubjects.has(t)||this.actionSubjects.set(t,new Ot);let i=this.actionSubjects.get(t);return i?i.asObservable():ue(null)}catch(i){return this.loggingService.catch("Error in CoreActionsService onAction: ",i),ue(null)}}};e.\u0275fac=function(i){return new(i||e)(w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();function U2(n,e){(e==null||e>n.length)&&(e=n.length);for(var r=0,t=Array(e);r<e;r++)t[r]=n[r];return t}function Ire(n){if(Array.isArray(n))return n}function vre(n,e){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var t,i,o,s,a=[],c=!0,l=!1;try{if(o=(r=r.call(n)).next,e!==0)for(;!(c=(t=o.call(r)).done)&&(a.push(t.value),a.length!==e);c=!0);}catch(u){l=!0,i=u}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}function yre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
145
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sre(n,e){return Ire(n)||vre(n,e)||Are(n,e)||yre()}function Are(n,e){if(n){if(typeof n=="string")return U2(n,e);var r={}.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U2(n,e):void 0}}var X2=Object.entries,V2=Object.setPrototypeOf,Dre=Object.isFrozen,Rre=Object.getPrototypeOf,Cre=Object.getOwnPropertyDescriptor,gr=Object.freeze,pi=Object.seal,Qd=Object.create,J2=typeof Reflect<"u"&&Reflect,Rw=J2.apply,Cw=J2.construct;gr||(gr=function(e){return e});pi||(pi=function(e){return e});Rw||(Rw=function(e,r){for(var t=arguments.length,i=new Array(t>2?t-2:0),o=2;o<t;o++)i[o-2]=arguments[o];return e.apply(r,i)});Cw||(Cw=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),i=1;i<r;i++)t[i-1]=arguments[i];return new e(...t)});var Ss=on(Array.prototype.forEach),Nre=on(Array.prototype.lastIndexOf),B2=on(Array.prototype.pop),Kd=on(Array.prototype.push),Ore=on(Array.prototype.splice),fr=Array.isArray,Dm=on(String.prototype.toLowerCase),vw=on(String.prototype.toString),G2=on(String.prototype.match),Yd=on(String.prototype.replace),$2=on(String.prototype.indexOf),wre=on(String.prototype.trim),bre=on(Number.prototype.toString),Lre=on(Boolean.prototype.toString),j2=typeof BigInt>"u"?null:on(BigInt.prototype.toString),H2=typeof Symbol>"u"?null:on(Symbol.prototype.toString),Wt=on(Object.prototype.hasOwnProperty),Am=on(Object.prototype.toString),Bn=on(RegExp.prototype.test),Nl=Mre(TypeError);function on(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,t=new Array(r>1?r-1:0),i=1;i<r;i++)t[i-1]=arguments[i];return Rw(n,e,t)}}function Mre(n){return function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return Cw(n,r)}}function we(n,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dm;if(V2&&V2(n,null),!fr(e))return n;let t=e.length;for(;t--;){let i=e[t];if(typeof i=="string"){let o=r(i);o!==i&&(Dre(e)||(e[t]=o),i=o)}n[i]=!0}return n}function Pre(n){for(let e=0;e<n.length;e++)Wt(n,e)||(n[e]=null);return n}function Zn(n){let e=Qd(null);for(let t of X2(n)){var r=Sre(t,2);let i=r[0],o=r[1];Wt(n,i)&&(fr(o)?e[i]=Pre(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Zn(o):e[i]=o)}return e}function xre(n){switch(typeof n){case"string":return n;case"number":return bre(n);case"boolean":return Lre(n);case"bigint":return j2?j2(n):"0";case"symbol":return H2?H2(n):"Symbol()";case"undefined":return Am(n);case"function":case"object":{if(n===null)return Am(n);let e=n,r=ko(e,"toString");if(typeof r=="function"){let t=r(e);return typeof t=="string"?t:Am(t)}return Am(n)}default:return Am(n)}}function ko(n,e){for(;n!==null;){let t=Cre(n,e);if(t){if(t.get)return on(t.get);if(typeof t.value=="function")return on(t.value)}n=Rre(n)}function r(){return null}return r}function Fre(n){try{return Bn(n,""),!0}catch{return!1}}var W2=gr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yw=gr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Sw=gr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),kre=gr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Aw=gr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ure=gr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),z2=gr(["#text"]),q2=gr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Dw=gr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),K2=gr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),gv=gr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vre=pi(/{{[\w\W]*|^[\w\W]*}}/g),Bre=pi(/<%[\w\W]*|^[\w\W]*%>/g),Gre=pi(/\${[\w\W]*/g),$re=pi(/^data-[\-\w.\u00B7-\uFFFF]+$/),jre=pi(/^aria-[\-\w]+$/),Y2=pi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hre=pi(/^(?:\w+script|data):/i),Wre=pi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zre=pi(/^html$/i),qre=pi(/^[a-z][.\w]*(-[.\w]+)+$/i),Fo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Kre=function(){return typeof window>"u"?null:window},Yre=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let t=null,i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(t=r.getAttribute(i));let o="dompurify"+(t?"#"+t:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Q2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Z2(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Kre(),e=se=>Z2(se);if(e.version="3.4.9",e.removed=[],!n||!n.document||n.document.nodeType!==Fo.document||!n.Element)return e.isSupported=!1,e;let r=n.document,t=r,i=t.currentScript;n.DocumentFragment;let o=n.HTMLTemplateElement,s=n.Node,a=n.Element,c=n.NodeFilter,l=n.NamedNodeMap;l===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let u=n.DOMParser,d=n.trustedTypes,f=a.prototype,g=ko(f,"cloneNode"),p=ko(f,"remove"),_=ko(f,"nextSibling"),T=ko(f,"childNodes"),S=ko(f,"parentNode"),b=ko(f,"shadowRoot"),B=ko(f,"attributes"),x=s&&s.prototype?ko(s.prototype,"nodeType"):null,U=s&&s.prototype?ko(s.prototype,"nodeName"):null;if(typeof o=="function"){let se=r.createElement("template");se.content&&se.content.ownerDocument&&(r=se.content.ownerDocument)}let $,A="",D,C=!1,O=0,M=function(){if(O>0)throw Nl('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},F=function(R){M(),O++;try{return $.createHTML(R)}finally{O--}},N=function(R){M(),O++;try{return $.createScriptURL(R)}finally{O--}},_i=function(){return C||(D=Yre(d,i),C=!0),D},Zi=r,zh=Zi.implementation,Ls=Zi.createNodeIterator,tc=Zi.createDocumentFragment,qh=Zi.getElementsByTagName,Np=t.importNode,Jt=Q2();e.isSupported=typeof X2=="function"&&typeof S=="function"&&zh&&zh.createHTMLDocument!==void 0;let wr=Vre,qt=Bre,nu=Gre,nc=$re,Zy=jre,rc=Hre,Op=Wre,eS=qre,ic=Y2,ft=null,oc=we({},[...W2,...yw,...Sw,...Aw,...z2]),vt=null,sc=we({},[...q2,...Dw,...K2,...gv]),yt=Object.seal(Qd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ms=null,ac=null,eo=Object.seal(Qd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Kh=!0,ru=!0,iu=!1,Yh=!0,to=!1,qo=!0,Ti=!1,cc=!1,Zt=!1,Bt=!1,Ko=!1,lc=!1,Qh=!0,wp=!1,Ps="user-content-",ou=!0,su=!1,no={},Xr=null,Xh=we({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),au=null,Jh=we({},["audio","video","img","source","image","track"]),cu=null,xs=we({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fs="http://www.w3.org/1998/Math/MathML",ks="http://www.w3.org/2000/svg",Sn="http://www.w3.org/1999/xhtml",Yo=Sn,Us=!1,lu=null,uc=we({},[Fs,ks,Sn],vw),uu=we({},["mi","mo","mn","ms","mtext"]),dn=we({},["annotation-xml"]),bp=we({},["title","style","font","a","script"]),Ii=null,dc=["application/xhtml+xml","text/html"],tS="text/html",Rt=null,br=null,nS=r.createElement("form"),Lp=function(R){return R instanceof RegExp||R instanceof Function},Vs=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(br&&br===R)return;(!R||typeof R!="object")&&(R={}),R=Zn(R),Ii=dc.indexOf(R.PARSER_MEDIA_TYPE)===-1?tS:R.PARSER_MEDIA_TYPE,Rt=Ii==="application/xhtml+xml"?vw:Dm,ft=Wt(R,"ALLOWED_TAGS")&&fr(R.ALLOWED_TAGS)?we({},R.ALLOWED_TAGS,Rt):oc,vt=Wt(R,"ALLOWED_ATTR")&&fr(R.ALLOWED_ATTR)?we({},R.ALLOWED_ATTR,Rt):sc,lu=Wt(R,"ALLOWED_NAMESPACES")&&fr(R.ALLOWED_NAMESPACES)?we({},R.ALLOWED_NAMESPACES,vw):uc,cu=Wt(R,"ADD_URI_SAFE_ATTR")&&fr(R.ADD_URI_SAFE_ATTR)?we(Zn(xs),R.ADD_URI_SAFE_ATTR,Rt):xs,au=Wt(R,"ADD_DATA_URI_TAGS")&&fr(R.ADD_DATA_URI_TAGS)?we(Zn(Jh),R.ADD_DATA_URI_TAGS,Rt):Jh,Xr=Wt(R,"FORBID_CONTENTS")&&fr(R.FORBID_CONTENTS)?we({},R.FORBID_CONTENTS,Rt):Xh,Ms=Wt(R,"FORBID_TAGS")&&fr(R.FORBID_TAGS)?we({},R.FORBID_TAGS,Rt):Zn({}),ac=Wt(R,"FORBID_ATTR")&&fr(R.FORBID_ATTR)?we({},R.FORBID_ATTR,Rt):Zn({}),no=Wt(R,"USE_PROFILES")?R.USE_PROFILES&&typeof R.USE_PROFILES=="object"?Zn(R.USE_PROFILES):R.USE_PROFILES:!1,Kh=R.ALLOW_ARIA_ATTR!==!1,ru=R.ALLOW_DATA_ATTR!==!1,iu=R.ALLOW_UNKNOWN_PROTOCOLS||!1,Yh=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,to=R.SAFE_FOR_TEMPLATES||!1,qo=R.SAFE_FOR_XML!==!1,Ti=R.WHOLE_DOCUMENT||!1,Bt=R.RETURN_DOM||!1,Ko=R.RETURN_DOM_FRAGMENT||!1,lc=R.RETURN_TRUSTED_TYPE||!1,Zt=R.FORCE_BODY||!1,Qh=R.SANITIZE_DOM!==!1,wp=R.SANITIZE_NAMED_PROPS||!1,ou=R.KEEP_CONTENT!==!1,su=R.IN_PLACE||!1,ic=Fre(R.ALLOWED_URI_REGEXP)?R.ALLOWED_URI_REGEXP:Y2,Yo=typeof R.NAMESPACE=="string"?R.NAMESPACE:Sn,uu=Wt(R,"MATHML_TEXT_INTEGRATION_POINTS")&&R.MATHML_TEXT_INTEGRATION_POINTS&&typeof R.MATHML_TEXT_INTEGRATION_POINTS=="object"?Zn(R.MATHML_TEXT_INTEGRATION_POINTS):we({},["mi","mo","mn","ms","mtext"]),dn=Wt(R,"HTML_INTEGRATION_POINTS")&&R.HTML_INTEGRATION_POINTS&&typeof R.HTML_INTEGRATION_POINTS=="object"?Zn(R.HTML_INTEGRATION_POINTS):we({},["annotation-xml"]);let z=Wt(R,"CUSTOM_ELEMENT_HANDLING")&&R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING=="object"?Zn(R.CUSTOM_ELEMENT_HANDLING):Qd(null);if(yt=Qd(null),Wt(z,"tagNameCheck")&&Lp(z.tagNameCheck)&&(yt.tagNameCheck=z.tagNameCheck),Wt(z,"attributeNameCheck")&&Lp(z.attributeNameCheck)&&(yt.attributeNameCheck=z.attributeNameCheck),Wt(z,"allowCustomizedBuiltInElements")&&typeof z.allowCustomizedBuiltInElements=="boolean"&&(yt.allowCustomizedBuiltInElements=z.allowCustomizedBuiltInElements),to&&(ru=!1),Ko&&(Bt=!0),no&&(ft=we({},z2),vt=Qd(null),no.html===!0&&(we(ft,W2),we(vt,q2)),no.svg===!0&&(we(ft,yw),we(vt,Dw),we(vt,gv)),no.svgFilters===!0&&(we(ft,Sw),we(vt,Dw),we(vt,gv)),no.mathMl===!0&&(we(ft,Aw),we(vt,K2),we(vt,gv))),eo.tagCheck=null,eo.attributeCheck=null,Wt(R,"ADD_TAGS")&&(typeof R.ADD_TAGS=="function"?eo.tagCheck=R.ADD_TAGS:fr(R.ADD_TAGS)&&(ft===oc&&(ft=Zn(ft)),we(ft,R.ADD_TAGS,Rt))),Wt(R,"ADD_ATTR")&&(typeof R.ADD_ATTR=="function"?eo.attributeCheck=R.ADD_ATTR:fr(R.ADD_ATTR)&&(vt===sc&&(vt=Zn(vt)),we(vt,R.ADD_ATTR,Rt))),Wt(R,"ADD_URI_SAFE_ATTR")&&fr(R.ADD_URI_SAFE_ATTR)&&we(cu,R.ADD_URI_SAFE_ATTR,Rt),Wt(R,"FORBID_CONTENTS")&&fr(R.FORBID_CONTENTS)&&(Xr===Xh&&(Xr=Zn(Xr)),we(Xr,R.FORBID_CONTENTS,Rt)),Wt(R,"ADD_FORBID_CONTENTS")&&fr(R.ADD_FORBID_CONTENTS)&&(Xr===Xh&&(Xr=Zn(Xr)),we(Xr,R.ADD_FORBID_CONTENTS,Rt)),ou&&(ft["#text"]=!0),Ti&&we(ft,["html","head","body"]),ft.table&&(we(ft,["tbody"]),delete Ms.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let te=$;$=R.TRUSTED_TYPES_POLICY;try{A=F("")}catch(Ie){throw $=te,Ie}}else R.TRUSTED_TYPES_POLICY===null?($=void 0,A=""):($===void 0&&($=_i()),$&&typeof A=="string"&&(A=F("")));(Jt.uponSanitizeElement.length>0||Jt.uponSanitizeAttribute.length>0)&&ft===oc&&(ft=Zn(ft)),Jt.uponSanitizeAttribute.length>0&&vt===sc&&(vt=Zn(vt)),gr&&gr(R),br=R},Zh=we({},[...yw,...Sw,...kre]),du=we({},[...Aw,...Ure]),hu=function(R){let z=S(R);(!z||!z.tagName)&&(z={namespaceURI:Yo,tagName:"template"});let te=Dm(R.tagName),Ie=Dm(z.tagName);return lu[R.namespaceURI]?R.namespaceURI===ks?z.namespaceURI===Sn?te==="svg":z.namespaceURI===Fs?te==="svg"&&(Ie==="annotation-xml"||uu[Ie]):!!Zh[te]:R.namespaceURI===Fs?z.namespaceURI===Sn?te==="math":z.namespaceURI===ks?te==="math"&&dn[Ie]:!!du[te]:R.namespaceURI===Sn?z.namespaceURI===ks&&!dn[Ie]||z.namespaceURI===Fs&&!uu[Ie]?!1:!du[te]&&(bp[te]||!Zh[te]):!!(Ii==="application/xhtml+xml"&&lu[R.namespaceURI]):!1},en=function(R){Kd(e.removed,{element:R});try{S(R).removeChild(R)}catch{if(p(R),!S(R))throw Nl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ef=function(R){let z=T?T(R):R.childNodes;if(z){let Ie=[];Ss(z,Re=>{Kd(Ie,Re)}),Ss(Ie,Re=>{try{p(Re)}catch{}})}let te=B?B(R):null;if(te)for(let Ie=te.length-1;Ie>=0;--Ie){let Re=te[Ie],Ce=Re&&Re.name;if(typeof Ce=="string")try{R.removeAttribute(Ce)}catch{}}},ro=function(R,z){try{Kd(e.removed,{attribute:z.getAttributeNode(R),from:z})}catch{Kd(e.removed,{attribute:null,from:z})}if(z.removeAttribute(R),R==="is")if(Bt||Ko)try{en(z)}catch{}else try{z.setAttribute(R,"")}catch{}},tf=function(R){let z=B?B(R):R.attributes;if(z)for(let te=z.length-1;te>=0;--te){let Ie=z[te],Re=Ie&&Ie.name;if(!(typeof Re!="string"||vt[Rt(Re)]))try{R.removeAttribute(Re)}catch{}}},nf=function(R){let z=[R];for(;z.length>0;){let te=z.pop();(x?x(te):te.nodeType)===Fo.element&&tf(te);let Re=T?T(te):te.childNodes;if(Re)for(let Ce=Re.length-1;Ce>=0;--Ce)z.push(Re[Ce])}},rf=function(R){let z=null,te=null;if(Zt)R="<remove></remove>"+R;else{let Ce=G2(R,/^[\r\n\t ]+/);te=Ce&&Ce[0]}Ii==="application/xhtml+xml"&&Yo===Sn&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");let Ie=$?F(R):R;if(Yo===Sn)try{z=new u().parseFromString(Ie,Ii)}catch{}if(!z||!z.documentElement){z=zh.createDocument(Yo,"template",null);try{z.documentElement.innerHTML=Us?A:Ie}catch{}}let Re=z.body||z.documentElement;return R&&te&&Re.insertBefore(r.createTextNode(te),Re.childNodes[0]||null),Yo===Sn?qh.call(z,Ti?"html":"body")[0]:Ti?z.documentElement:Re},of=function(R){return Ls.call(R.ownerDocument||R,R,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},sf=function(R){var z,te;R.normalize();let Ie=Ls.call(R.ownerDocument||R,R,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),Re=Ie.nextNode();for(;Re;){let Kt=Re.data;Ss([wr,qt,nu],je=>{Kt=Yd(Kt,je," ")}),Re.data=Kt,Re=Ie.nextNode()}let Ce=(z=(te=R.querySelectorAll)===null||te===void 0?void 0:te.call(R,"template"))!==null&&z!==void 0?z:[];Ss(Array.from(Ce),Kt=>{Xo(Kt.content)&&sf(Kt.content)})},Qo=function(R){let z=U?U(R):null;return typeof z!="string"||Rt(z)!=="form"?!1:typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||R.attributes!==B(R)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function"||R.nodeType!==x(R)||R.childNodes!==T(R)},Xo=function(R){if(!x||typeof R!="object"||R===null)return!1;try{return x(R)===Fo.documentFragment}catch{return!1}},Jo=function(R){if(!x||typeof R!="object"||R===null)return!1;try{return typeof x(R)=="number"}catch{return!1}};function rr(se,R,z){Ss(se,te=>{te.call(e,R,z,br)})}let io=function(R){let z=null;if(rr(Jt.beforeSanitizeElements,R,null),Qo(R))return en(R),!0;let te=Rt(U?U(R):R.nodeName);if(rr(Jt.uponSanitizeElement,R,{tagName:te,allowedTags:ft}),qo&&R.hasChildNodes()&&!Jo(R.firstElementChild)&&Bn(/<[/\w!]/g,R.innerHTML)&&Bn(/<[/\w!]/g,R.textContent)||qo&&R.namespaceURI===Sn&&te==="style"&&Jo(R.firstElementChild)||R.nodeType===Fo.progressingInstruction||qo&&R.nodeType===Fo.comment&&Bn(/<[/\w]/g,R.data))return en(R),!0;if(Ms[te]||!(eo.tagCheck instanceof Function&&eo.tagCheck(te))&&!ft[te]){if(!Ms[te]&&af(te)&&(yt.tagNameCheck instanceof RegExp&&Bn(yt.tagNameCheck,te)||yt.tagNameCheck instanceof Function&&yt.tagNameCheck(te)))return!1;if(ou&&!Xr[te]){let Re=S(R),Ce=T(R);if(Ce&&Re){let Kt=Ce.length;for(let je=Kt-1;je>=0;--je){let Ye=su?Ce[je]:g(Ce[je],!0);Re.insertBefore(Ye,_(R))}}}return en(R),!0}return(x?x(R):R.nodeType)===Fo.element&&!hu(R)||(te==="noscript"||te==="noembed"||te==="noframes")&&Bn(/<\/no(script|embed|frames)/i,R.innerHTML)?(en(R),!0):(to&&R.nodeType===Fo.text&&(z=R.textContent,Ss([wr,qt,nu],Re=>{z=Yd(z,Re," ")}),R.textContent!==z&&(Kd(e.removed,{element:R.cloneNode()}),R.textContent=z)),rr(Jt.afterSanitizeElements,R,null),!1)},fu=function(R,z,te){if(ac[z]||Qh&&(z==="id"||z==="name")&&(te in r||te in nS))return!1;let Ie=vt[z]||eo.attributeCheck instanceof Function&&eo.attributeCheck(z,R);if(!(ru&&!ac[z]&&Bn(nc,z))){if(!(Kh&&Bn(Zy,z))){if(!Ie||ac[z]){if(!(af(R)&&(yt.tagNameCheck instanceof RegExp&&Bn(yt.tagNameCheck,R)||yt.tagNameCheck instanceof Function&&yt.tagNameCheck(R))&&(yt.attributeNameCheck instanceof RegExp&&Bn(yt.attributeNameCheck,z)||yt.attributeNameCheck instanceof Function&&yt.attributeNameCheck(z,R))||z==="is"&&yt.allowCustomizedBuiltInElements&&(yt.tagNameCheck instanceof RegExp&&Bn(yt.tagNameCheck,te)||yt.tagNameCheck instanceof Function&&yt.tagNameCheck(te))))return!1}else if(!cu[z]){if(!Bn(ic,Yd(te,Op,""))){if(!((z==="src"||z==="xlink:href"||z==="href")&&R!=="script"&&$2(te,"data:")===0&&au[R])){if(!(iu&&!Bn(rc,Yd(te,Op,"")))){if(te)return!1}}}}}}return!0},rS=we({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),af=function(R){return!rS[Dm(R)]&&Bn(eS,R)},cf=function(R){rr(Jt.beforeSanitizeAttributes,R,null);let z=R.attributes;if(!z||Qo(R))return;let te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:vt,forceKeepAttr:void 0},Ie=z.length;for(;Ie--;){let Re=z[Ie],Ce=Re.name,Kt=Re.namespaceURI,je=Re.value,Ye=Rt(Ce),Lr=je,xt=Ce==="value"?Lr:wre(Lr);if(te.attrName=Ye,te.attrValue=xt,te.keepAttr=!0,te.forceKeepAttr=void 0,rr(Jt.uponSanitizeAttribute,R,te),xt=te.attrValue,wp&&(Ye==="id"||Ye==="name")&&$2(xt,Ps)!==0&&(ro(Ce,R),xt=Ps+xt),qo&&Bn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,xt)){ro(Ce,R);continue}if(Ye==="attributename"&&G2(xt,"href")){ro(Ce,R);continue}if(te.forceKeepAttr)continue;if(!te.keepAttr){ro(Ce,R);continue}if(!Yh&&Bn(/\/>/i,xt)){ro(Ce,R);continue}to&&Ss([wr,qt,nu],rt=>{xt=Yd(xt,rt," ")});let lf=Rt(R.nodeName);if(!fu(lf,Ye,xt)){ro(Ce,R);continue}if($&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Kt)switch(d.getAttributeType(lf,Ye)){case"TrustedHTML":{xt=F(xt);break}case"TrustedScriptURL":{xt=N(xt);break}}if(xt!==Lr)try{Kt?R.setAttributeNS(Kt,Ce,xt):R.setAttribute(Ce,xt),Qo(R)?en(R):B2(e.removed)}catch{ro(Ce,R)}}rr(Jt.afterSanitizeAttributes,R,null)},hc=function(R){let z=null,te=of(R);for(rr(Jt.beforeSanitizeShadowDOM,R,null);z=te.nextNode();)if(rr(Jt.uponSanitizeShadowNode,z,null),io(z),cf(z),Xo(z.content)&&hc(z.content),(x?x(z):z.nodeType)===Fo.element){let Re=b?b(z):z.shadowRoot;Xo(Re)&&(fc(Re),hc(Re))}rr(Jt.afterSanitizeShadowDOM,R,null)},fc=function(R){let z=[{node:R,shadow:null}];for(;z.length>0;){let te=z.pop();if(te.shadow){hc(te.shadow);continue}let Ie=te.node,Ce=(x?x(Ie):Ie.nodeType)===Fo.element,Kt=T?T(Ie):Ie.childNodes;if(Kt)for(let je=Kt.length-1;je>=0;--je)z.push({node:Kt[je],shadow:null});if(Ce){let je=U?U(Ie):null;if(typeof je=="string"&&Rt(je)==="template"){let Ye=Ie.content;Xo(Ye)&&z.push({node:Ye,shadow:null})}}if(Ce){let je=b?b(Ie):Ie.shadowRoot;Xo(je)&&z.push({node:null,shadow:je},{node:je,shadow:null})}}};return e.sanitize=function(se){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=null,te=null,Ie=null,Re=null;if(Us=!se,Us&&(se="<!-->"),typeof se!="string"&&!Jo(se)&&(se=xre(se),typeof se!="string"))throw Nl("dirty is not a string, aborting");if(!e.isSupported)return se;cc||Vs(R),e.removed=[];let Ce=su&&typeof se!="string"&&Jo(se);if(Ce){let Ye=U?U(se):se.nodeName;if(typeof Ye=="string"){let Lr=Rt(Ye);if(!ft[Lr]||Ms[Lr])throw Nl("root node is forbidden and cannot be sanitized in-place")}if(Qo(se))throw Nl("root node is clobbered and cannot be sanitized in-place");try{fc(se)}catch(Lr){throw ef(se),Lr}}else if(Jo(se))z=rf("<!---->"),te=z.ownerDocument.importNode(se,!0),te.nodeType===Fo.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?z=te:z.appendChild(te),fc(te);else{if(!Bt&&!to&&!Ti&&se.indexOf("<")===-1)return $&&lc?F(se):se;if(z=rf(se),!z)return Bt?null:lc?A:""}z&&Zt&&en(z.firstChild);let Kt=of(Ce?se:z);try{for(;Ie=Kt.nextNode();)io(Ie),cf(Ie),Xo(Ie.content)&&hc(Ie.content)}catch(Ye){throw Ce&&ef(se),Ye}if(Ce)return Ss(e.removed,Ye=>{Ye.element&&nf(Ye.element)}),to&&sf(se),se;if(Bt){if(to&&sf(z),Ko)for(Re=tc.call(z.ownerDocument);z.firstChild;)Re.appendChild(z.firstChild);else Re=z;return(vt.shadowroot||vt.shadowrootmode)&&(Re=Np.call(t,Re,!0)),Re}let je=Ti?z.outerHTML:z.innerHTML;return Ti&&ft["!doctype"]&&z.ownerDocument&&z.ownerDocument.doctype&&z.ownerDocument.doctype.name&&Bn(zre,z.ownerDocument.doctype.name)&&(je="<!DOCTYPE "+z.ownerDocument.doctype.name+`>
146
+ `+je),to&&Ss([wr,qt,nu],Ye=>{je=Yd(je,Ye," ")}),$&&lc?F(je):je},e.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vs(se),cc=!0},e.clearConfig=function(){br=null,cc=!1,$=D,A=""},e.isValidAttribute=function(se,R,z){br||Vs({});let te=Rt(se),Ie=Rt(R);return fu(te,Ie,z)},e.addHook=function(se,R){typeof R=="function"&&Kd(Jt[se],R)},e.removeHook=function(se,R){if(R!==void 0){let z=Nre(Jt[se],R);return z===-1?void 0:Ore(Jt[se],z,1)[0]}return B2(Jt[se])},e.removeHooks=function(se){Jt[se]=[]},e.removeAllHooks=function(){Jt=Q2()},e}var mv=Z2();var ej={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},pv=(()=>{let e=class e{constructor(t,i,o,s){this.analyticsService=t,this.rendererFactory2=i,this.loggingService=o,this.sanitizer=s,this.smoothScrollShieldHandler=null,this.smoothScrollShieldLoadListener=null,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new Y(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new Y([]),this.mousedown=!1,this.windowMouseDown$=new Ot,this.windowPointerMove$=new Y(null),this.windowPointerUp$=new Y(null),this.documentSelectionChange$=new Y(null),this.windowClick$=new Y(null),this.windowScroll$=new Y(null),this.windowResize$=new Y(null),this.windowKeyupBackspace$=new Y(null),this.windowKeyupDelete$=new Y(null),this.windowKeyupEsc$=new Y(null),this.windowPopState$=new Y(null),this.documentClick$=new Y(null),this.documentClickSubject$=new Ot,this.documentFocus$=new Y(null),this.windowKeydownShift$=new Y(null),this.windowKeyupShift$=new Y(null),this.mutation$=new Y(null),this.childListMutation$=new Y(null),this.networkStatus$=new Y(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new Y({}),this.selectedAnnotationsLocationMap$=new Y({}),this.recordingInProgress$=new Y({}),this.deleteAnnotations$=new Y([]),this.pinHighlighterClass$=new Y(null),this.dialogOpenedInSidebar$=new Y(!1),this.textHighlighterClass$=new Y(null),this.commentPinHighlighter$=new Y(!1),this.deviceInfo$=new Y(new li),this.customCss$=new Y(null),this.mutationObserver=null,this.animationFilterEnabled=!1,this.animationLibraryDetected=null,this.staticAnimationCache=new WeakMap,this.ANIMATION_LIBRARY_SELECTOR=["[data-gsap]",".gsap-marker-start",".gsap-marker-end","[data-gsap-id]",".swiper-slide",".swiper-wrapper",".swiper-pagination",".swiper-pagination-bullet","[data-aos]"].join(", "),this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=a=>{try{let c=[];return a.forEach(l=>{if(!wo(l))if(l instanceof HTMLElement){if(l.className.includes("cdk-overlay-container")||l.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(l.className.includes("cdk-overlay")){let u=!1;l.childNodes.forEach(d=>{wo(d)&&(u=!0)}),u||c.push(l)}else c.push(l)}else c.push(l)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new Y(a),this.currentMousePosition$=new Y(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Au(),qs(([c,l])=>{try{let u=l.filter(f=>!c.includes(f)),d=c.filter(f=>!l.includes(f));d.length&&d.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll&&this.unlistenElementScroll[g.id]&&this.unlistenElementScroll[g.id]()}),u.length&&u.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll[g.id]=this.renderer.listen(g,"scroll",p=>{let _=this.calculateScreenSize();this.currentScreenSize$.next(_)})})}catch(u){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",u)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?FV("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):kV("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(t){try{this.docService=t,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}setDynamicIdPatterns(t){try{let i=t.map(o=>typeof o=="string"?new RegExp(o):o).filter(Boolean);i.length&&(this.dynamicIdPatterns=i)}catch(i){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",i)}}isLikelyDynamicId(t){try{return t?this.dynamicIdPatterns.some(i=>i.test(t)):!1}catch{return!1}}getStableAttributes(t){try{let i={};if(!t.getAttributeNames)return i;let o=new Set(["id","class","style"]);return t.getAttributeNames().forEach(a=>{if(o.has(a)||a.includes("snippyly")||a.includes("velt"))return;let c=t.getAttribute(a);c&&c.length<=256&&(i[a]=c)}),i}catch{return{}}}buildStableElementSelector(t,i){try{if(Object.keys(i).length===0)return;let s=[t.tagName?.toLowerCase()],a=["data-","aria-","role","name","title","type"];return Object.keys(i).sort((l,u)=>{let d=a.findIndex(g=>l.startsWith(g)),f=a.findIndex(g=>u.startsWith(g));return(d===-1?99:d)-(f===-1?99:f)}).slice(0,4).forEach(l=>{let u=CSS.escape(i[l]);s.push(`[${l}="${u}"]`)}),s.join("")}catch{return}}getVisibleText(t,i=400){try{let o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null),s="",a,c=0;for(;(a=o.nextNode())&&s.length<i;){let l=(a.textContent||"").replace(/\s+/g," ").trim();if(l&&(s+=(s?" ":"")+l),c++,c>100)break}return s.slice(0,i)}catch{return""}}hashText(t){try{return OV(t)}catch{return}}generateRobustXPath(t,i){try{let o=i?.maxDepth||10,s=i?.useAbsolutePath||!1,a=[],c=t,l=0;for(;c&&c!==document.documentElement&&l<o;){let g=this.buildRobustXPathSegment(c);if(g&&(a.unshift(g),this.isStrongAnchorSegment(g)))break;c=c.parentElement,l++}if(a.length===0)return;let d=(s?"/":"//")+a.join("/");return a.some(g=>g.includes("[@")||g.includes("[contains(@class"))?d:void 0}catch{return}}buildRobustXPathSegment(t){try{let i=t.tagName.toLowerCase(),o=t.id;if(o&&!this.isLikelyDynamicId(o)&&document.querySelectorAll(`[id="${CSS.escape(o)}"]`).length===1)return`*[@id=${this.escapeXPathValue(o)}]`;let s=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let g of s){let p=t.getAttribute(g);if(p)return`${i}[@${g}=${this.escapeXPathValue(p)}]`}let a=Array.from(t.attributes).filter(g=>g.name.startsWith("data-")&&!g.name.includes("snippyly")&&!g.name.includes("velt")&&g.value.length<100).sort((g,p)=>g.value.length-p.value.length);if(a.length>0){let g=a[0];return`${i}[@${g.name}=${this.escapeXPathValue(g.value)}]`}let c=t.getAttribute("role");if(c)return`${i}[@role=${this.escapeXPathValue(c)}]`;let l=t.getAttribute("aria-label");if(l&&l.length<50)return`${i}[@aria-label=${this.escapeXPathValue(l)}]`;let u=t.getAttribute("name");if(u)return`${i}[@name=${this.escapeXPathValue(u)}]`;let d=t.getAttribute("type");if(d)return`${i}[@type=${this.escapeXPathValue(d)}]`;let f=Array.from(t.classList||[]).filter(g=>g.length>0&&g.length<40&&!g.includes("yui")&&!g.includes("velt")&&!g.includes("snippyly")&&!this.excludeClassList.includes(g)).slice(0,2);if(f.length>0){let g=f.map(p=>`contains(@class, ${this.escapeXPathValue(p)})`).join(" and ");return`${i}[${g}]`}if(t.parentElement){let g=Array.from(t.parentElement.children).filter(p=>p.tagName===t.tagName);if(g.length>1){let p=g.indexOf(t)+1;return`${i}[${p}]`}}return i}catch{return}}isStrongAnchorSegment(t){try{return!!(t.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(s=>t.includes(`[@role='${s}']`))||["data-region","data-instanceid","data-activityid"].some(s=>t.includes(`[@${s}=`)))}catch{return!1}}escapeXPathValue(t,i=!0){try{return t.includes("'")?t.includes('"')?`concat(${t.split("'").map(a=>`'${a}'`).join(`,"'",`)})`:i?`"${t}"`:t:i?`'${t}'`:t}catch{try{return`concat(${t.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return i?`'${t}'`:t}}}getElementFromRobustXPath(t){try{return document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}getAllElementsFromRobustXPath(t){try{let i=document.evaluate(t,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let s=0;s<i.snapshotLength;s++){let a=i.snapshotItem(s);a instanceof Element&&o.push(a)}return o}catch{return[]}}generateAnchorRecord(t,i){try{let o=this.generateAnchorRecordForElement(t,i),s=null;if(t.parentElement&&t.parentElement instanceof HTMLElement&&Dg(t.parentElement)&&t.parentElement!==document.body&&(s=t.parentElement),o&&s){let a=this.generateAnchorRecordForElement(s,i);a&&(o.parent=a)}return o}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",o),null}}generateAnchorRecordForElement(t,i){try{if(!t)return null;let o=t,s=o.tagName?.toUpperCase();if(!s)return null;let a=o.id&&!this.isLikelyDynamicId(o.id)?o.id:void 0,c=this.getStableAttributes(o),l=this.buildStableElementSelector(o,c),u=this.getVisibleText(o),d=this.hashText(u||""),f=this.generateRobustXPath(o),g=this.getXPath(o),p=this.getXPath(o,!0),_=this.getXPath(o,!0,!0);return{version:"1.0",id:a,tagName:s,elementSelector:l,robustXPath:f||void 0,xPath:g||void 0,fXPath:p||void 0,cfXPath:_||void 0,contentHash:d?{value:d,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",o),null}}resolveAnchorRecord(t){try{let i=[],o=null,s=(d,f,g=0)=>{let p=[],_=g;if(p.push({method:f,score:g}),t.tagName&&d.tagName?.toUpperCase()===t.tagName&&(_+=10,p.push({method:"tagName-match",score:10})),t.contentHash?.value){let T=this.getVisibleText(d);this.hashText(T)===t.contentHash.value&&(_+=30,p.push({method:"contentHash-match",score:30}))}i.push({el:d,score:_,by:f,scoreBreakdown:p})};if(t.id){let d=document.querySelectorAll(`#${CSS.escape(t.id)}`);if(d.length===1)return{element:d[0],matchedBy:"id",score:90};d.length>1&&d.forEach(f=>s(f,"id-duplicate",70))}if(t.elementSelector){let d=document.querySelectorAll(t.elementSelector);if(d.length===1)return{element:d[0],matchedBy:"element-selector",score:80};d.forEach(f=>s(f,"element-selector-duplicate",60))}t.robustXPath&&this.getAllElementsFromRobustXPath(t.robustXPath).slice(0,20).forEach(p=>s(p,"robustXPath",50)),t?.parent&&(o=this.resolveAnchorRecord(t.parent),o.element&&o.element.querySelectorAll(t.tagName?.toLowerCase()||"*").forEach(f=>s(f,"parent+tag",40)));let a=(d,f,g)=>{if(!d)return;let p=this.getElementFromXPath(d);p&&s(p,f||"xpath",g||30)};if(a(t.xPath,"xPath",30),a(t.cfXPath,"cfXPath",30),a(t.fXPath,"fXPath",30),t.contentHash?.value&&i.length===0){let f=g=>{let p=0;for(let _=0;_<g.length&&p<400;_++){let T=g[_];if(p++,!this.isElementVisible(T))continue;let S=this.getVisibleText(T),b=this.hashText(S);b&&b===t.contentHash?.value&&s(T,"contentHash",15)}};if(o?.element&&o?.element instanceof Element){let g=o?.element?.querySelectorAll("*");f(g)}}if(!i.length)return{element:null};i.sort((d,f)=>f.score-d.score);let c=i[0].score,l=i.filter(d=>d.score===c);if(l.length>1){let d=[{path:t.xPath,label:"xPath"},{path:t.cfXPath,label:"cfXPath"},{path:t.fXPath,label:"fXPath"}];for(let f of d)if(f.path){let g=this.getElementFromXPath(f.path);if(g){let p=l.find(_=>_.el===g);if(p)return{element:p.el,matchedBy:`${p.by}+position`,score:p.score,scoreBreakdown:p.scoreBreakdown}}}}let u=i[0];return{element:u.el,matchedBy:u.by,score:u.score,scoreBreakdown:u.scoreBreakdown}}catch(i){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",i),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(fe(t=>{t?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentFocus(),this.setupSmoothScrollShield()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver(),this.teardownSmoothScrollShield())})).subscribe(),this.onDocumentClick()}catch(t){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",t)}}setScrollableElementsIds(t){try{t&&t.length&&this.scrollableElementsIds$.next(Array.from(new Set(t)))}catch(i){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",i)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(t){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+t,"color: green;"),this.animationFilterEnabled=this.detectAnimationLibraries(),this.loggingService.log("%c[WB] Animation filter:","color: green;",this.animationFilterEnabled?"ENABLED (library detected)":"DISABLED (no library)"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(s=>s?.attributeName===v.VELT_IGNORE_CHANGE_DETECTION))return;let o=i.filter(s=>s.type==="childList").filter(s=>{let a=s.target;return s.removedNodes.forEach(c=>{let l=c;if(typeof l.getAttribute=="function"){let u=l.getAttribute(v.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(u!==null&&u!==""){let d=this.xpathCacheId.get(u);d!==void 0&&(this.xpathCacheId.delete(u),this.xpathCache.delete(d))}}}),wo(a)?!1:!!(this.filterSnippylyNodes(s.addedNodes).length||this.filterSnippylyNodes(s.removedNodes).length)});this.animationFilterEnabled?this.childListMutation$.next(o.filter(s=>!this.isAnimatingElement(s.target))):this.childListMutation$.next(o),o.push(...i.filter(s=>s.type==="attributes").filter(s=>!wo(s.target)).filter(s=>this.filterSnippylyNodes([s.target]).length).filter(s=>{if(s){let a=s.target;return a?.classList?.contains("snippyly-sidebar-panel")?!1:a?!a.getAttribute(v.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),o=o.filter(s=>{let a=!0;return Object.keys(v.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{s.target?.closest(c)&&(a=!1)}),a}),o=o.filter(s=>s.target&&Dg(s.target)),this.animationFilterEnabled&&(o=o.filter(s=>!this.isAnimatingElement(s.target))),o.length&&this.mutation$.next(o)}catch(o){this.loggingService.catch("Error in DomService change detection: ",o)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}detectAnimationLibraries(){try{if(this.animationLibraryDetected!==null)return this.animationLibraryDetected;let t=window;return t.gsap||t.TweenMax||t.TweenLite||t.TimelineMax||t.TimelineLite?(this.loggingService.log("%c[WB] Detected animation library: GSAP","color: green;"),this.animationLibraryDetected=!0,!0):t.Swiper?(this.loggingService.log("%c[WB] Detected animation library: Swiper","color: green;"),this.animationLibraryDetected=!0,!0):t.AOS?(this.loggingService.log("%c[WB] Detected animation library: AOS","color: green;"),this.animationLibraryDetected=!0,!0):t.anime?(this.loggingService.log("%c[WB] Detected animation library: Anime.js","color: green;"),this.animationLibraryDetected=!0,!0):t.lottie||t.Lottie||t.bodymovin?(this.loggingService.log("%c[WB] Detected animation library: Lottie","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector("[data-framer-component-type]")?(this.loggingService.log("%c[WB] Detected animation library: Framer Motion","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector(this.ANIMATION_LIBRARY_SELECTOR)?(this.loggingService.log("%c[WB] Detected animation library: DOM markers","color: green;"),this.animationLibraryDetected=!0,!0):(this.loggingService.log("%c[WB] No animation library detected","color: green;"),this.animationLibraryDetected=!1,!1)}catch{return this.animationLibraryDetected=!1,!1}}isAnimatingElement(t){try{if(!t||typeof t.closest!="function")return!1;let i=window;if(i.gsap&&typeof i.gsap.isTweening=="function"){if(i.gsap.isTweening(t))return!0;if(typeof i.gsap.getTweensOf=="function")try{if(i.gsap.getTweensOf(t).length>0)return!0}catch{}}else if(i.TweenMax&&typeof i.TweenMax.isTweening=="function"){if(i.TweenMax.isTweening(t))return!0;if(typeof i.TweenMax.getTweensOf=="function")try{if(i.TweenMax.getTweensOf(t).length>0)return!0}catch{}}let o=t.style?.cssText||"";if(o){let l=o.includes("transform")||o.includes("translate3d")||o.includes("translate(")||o.includes("scale3d")||o.includes("rotate"),u=o.includes("will-change")&&o.includes("transform"),d=o.includes("transform-style")&&o.includes("preserve-3d");if(l&&(u||d))return!0}if(t.style&&(t.style.animation!==""&&t.style.animation!=="none"||t.style.transition!==""&&t.style.transition!=="none")||t.classList?.contains("animate")||t.classList?.contains("animating")||t.classList?.contains("animated")||t.classList?.contains("animation"))return!0;let s=this.staticAnimationCache.get(t);if(s!==void 0)return s;let a=!1,c=t.className||"";return typeof c=="string"&&(c.includes("slider")&&(c.includes("bullet")||c.includes("pagination"))&&(a=!0),c.includes("swiper-pagination")&&(a=!0)),!a&&(t.hasAttribute("data-aos")||t.hasAttribute("data-motion"))&&(a=!0),!a&&t.closest(this.ANIMATION_LIBRARY_SELECTOR)&&(a=!0),this.staticAnimationCache.set(t,a),a}catch{return!1}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null,this.staticAnimationCache=new WeakMap,this.animationLibraryDetected=null,this.animationFilterEnabled=!1)}catch(t){this.loggingService.catch("Error in DomService unsetMutationObserver: ",t)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{Mu(uo(window,"offline").pipe(fe(()=>!1)),uo(window,"online").pipe(fe(()=>!0)),new ge(t=>{t.next(navigator.onLine),t.complete()})).subscribe(t=>{this.networkStatus$.next(t)})}catch(t){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",t)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",t=>{this.windowResize$.next(t);let i=this.calculateScreenSize();this.deviceInfo$.next(new li),this.currentScreenSize$.next(i)})}catch(t){this.loggingService.catch("Error in DomService onWindowResize: ",t)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",t)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",t=>{this.windowScroll$.next(t);let i=this.calculateScreenSize();this.currentScreenSize$.next(i)})}catch(t){this.loggingService.catch("Error in DomService onWindowScroll: ",t)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",t)}}setupSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: setupSmoothScrollShield","color: green;");try{if(typeof window>"u"||typeof document>"u"||this.smoothScrollShieldHandler)return;if(this.isSmoothScrollLibPresent()){this.attachSmoothScrollShield();return}if(document.readyState!=="complete"&&!this.smoothScrollShieldLoadListener){let t=()=>{this.smoothScrollShieldLoadListener=null;try{if(this.smoothScrollShieldHandler)return;this.isSmoothScrollLibPresent()&&this.attachSmoothScrollShield()}catch(i){this.loggingService.catch("Error in DomService smooth-scroll shield load re-check: ",i)}};window.addEventListener("load",t,{once:!0}),this.smoothScrollShieldLoadListener=()=>window.removeEventListener("load",t)}}catch(t){this.loggingService.catch("Error in DomService setupSmoothScrollShield: ",t)}}isSmoothScrollLibPresent(){try{if(typeof window>"u"||typeof document>"u")return!1;if(window.ET_SmoothScroll)return!0;let i=document.body;return!!(i&&i.classList&&i.classList.contains("et_smooth_scroll"))}catch(t){return this.loggingService.catch("Error in DomService isSmoothScrollLibPresent: ",t),!1}}attachSmoothScrollShield(){if(this.smoothScrollShieldHandler)return;let t=/^(VELT-|SUPERFLOW-|SNIPPYLY-)/,i=s=>{try{let a=typeof s.composedPath=="function"?s.composedPath():[];for(let c=0;c<a.length;c++){let l=a[c];if(!(!l||l.nodeType!==1)&&l.tagName&&t.test(l.tagName)){s.stopImmediatePropagation();return}}}catch(a){this.loggingService.catch("Error in DomService smoothScrollShield handler: ",a)}};this.smoothScrollShieldHandler=i;let o={capture:!0,passive:!0};window.addEventListener("wheel",i,o),window.addEventListener("mousewheel",i,o),window.addEventListener("touchmove",i,o),this.unlistenWindowWheelShield=()=>window.removeEventListener("wheel",i,o),this.unlistenWindowMouseWheelShield=()=>window.removeEventListener("mousewheel",i,o),this.unlistenWindowTouchMoveShield=()=>window.removeEventListener("touchmove",i,o)}teardownSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: teardownSmoothScrollShield","color: green;");try{try{this.smoothScrollShieldLoadListener&&typeof this.smoothScrollShieldLoadListener=="function"&&(this.smoothScrollShieldLoadListener(),this.smoothScrollShieldLoadListener=null)}catch(t){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (load): ",t)}try{this.unlistenWindowWheelShield&&typeof this.unlistenWindowWheelShield=="function"&&(this.unlistenWindowWheelShield(),this.unlistenWindowWheelShield=null)}catch(t){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (wheel): ",t)}try{this.unlistenWindowMouseWheelShield&&typeof this.unlistenWindowMouseWheelShield=="function"&&(this.unlistenWindowMouseWheelShield(),this.unlistenWindowMouseWheelShield=null)}catch(t){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (mousewheel): ",t)}try{this.unlistenWindowTouchMoveShield&&typeof this.unlistenWindowTouchMoveShield=="function"&&(this.unlistenWindowTouchMoveShield(),this.unlistenWindowTouchMoveShield=null)}catch(t){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (touchmove): ",t)}this.smoothScrollShieldHandler=null}catch(t){this.loggingService.catch("Error in DomService teardownSmoothScrollShield: ",t)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",t=>{this.mousedown=!0,this.windowMouseDown$.next(t),this.setPointerPosition(t)})}catch(t){this.loggingService.catch("Error in DomService onPointerDown: ",t)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",t)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",t=>{this.windowClick$.next(t)})}catch(t){this.loggingService.catch("Error in DomService onWindowClick: ",t)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",t)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",t=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(t)})}catch(t){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",t)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",t)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",t=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(t)})}catch(t){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",t)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",t)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",t=>{this.windowKeyupEsc$.next(t)})}catch(t){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",t)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",t)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",t=>{this.windowPopState$.next(t)})}catch(t){this.loggingService.catch("Error in DomService onWindowPopState: ",t)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",t)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=t=>{t?.target?.tagName?.toLowerCase()!==v.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(t),this.documentClickSubject$.next(t))},document.addEventListener("click",this.documentClickListener,!0)}catch(t){this.loggingService.catch("Error in DomService onDocumentClick: ",t)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",t)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=t=>{this.documentFocus$.next(t)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(t){this.loggingService.catch("Error in DomService onDocumentFocus: ",t)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",t)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",t=>{this.windowKeydownShift$.next(t),this.windowKeyupShift$.next(null)})}catch(t){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",t)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",t)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",t=>{this.windowKeyupShift$.next(t),this.windowKeydownShift$.next(null)})}catch(t){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",t)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",t)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return uo(window,"keydown")}catch(t){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",t),Tc}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",t=>{this.windowPointerMove$.next(t),this.mouseMoveEvent=t})}catch(t){this.loggingService.catch("Error in DomService addPointerMoveListener: ",t)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",t)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",t=>{this.windowPointerUp$.next(t)})}catch(t){this.loggingService.catch("Error in DomService addPointerUpListener: ",t)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",t)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",t=>{this.documentSelectionChange$.next(t)})}catch(t){this.loggingService.catch("Error in DomService addPointerUpListener: ",t)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(t){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",t)}}updateCurrentMousePosition(t){try{if(this.currentMousePosition.pageX=t.pageX,this.currentMousePosition.pageY=t.pageY,this.currentMousePosition.clientX=t.clientX,this.currentMousePosition.clientY=t.clientY,t.target){let i=this.getXPath(t.target),o=t.target;if(i?.includes("name()='svg'")){let d=this.getXPath(i);d&&(o=d.iterateNext()||t.target)}let s=o.getBoundingClientRect(),a=t.clientX-s.x,c=t.clientY-s.y,l=a*100/(s.width||1),u=c*100/(s.height||1);this.currentMousePosition.element={xpath:i,topPercentage:u,leftPercentage:l}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(t,i=!0,o=!1,s=!0,a,c=!0,l){try{let u=t,d=u?.touches?.length?u.touches[0]?.clientX:u?.clientX,f=u?.touches?.length?u.touches[0]?.clientY:u?.clientY;l&&(d=l.clientX,f=l.clientY);let g=this.getBackgroundElement(d,f,i,o);if(g&&a&&typeof a=="function"&&(g=a(g)),g){let p=this.getXPath(g),_=this.getXPath(g,!0),T=g.getBoundingClientRect(),S=d-T.x,b=f-T.y,B=S*100/(T.width||1),x=b*100/(T.height||1),U={xpath:p,fXpath:_,leftPercentage:B,topPercentage:x};if(s){let $=this.getXPath(g,!0,!0);U.cfXpath=$}if(c){let $=this.generateAnchorRecord(g);$&&(U.anchor=$)}return U}else return null}catch(u){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",u),null}}getBackgroundElement(t,i,o=!0,s=!1){try{let a=document.elementsFromPoint(t,i),c=[];a.forEach(u=>{wo(u)?c=[]:Dg(u)&&c.push(u)}),s&&(c=c.filter(u=>this.isElementVisibleOnScreen(u)));let l=0;return o||c?.forEach((u,d)=>{u.tagName.toLowerCase()==="svg"&&(l=d)}),c[l]}catch(a){return this.loggingService.catch("Error in DomService getBackgroundElement: ",a),null}}getBackgroundVeltElement(t,i){try{let o=document.elementsFromPoint(t,i),s=[];return o.forEach(a=>{wo(a)&&Dg(a)&&s.push(a)}),s[0]}catch(o){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",o),null}}setPointerPosition(t){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=t.pageX,this.previousMousePosition.pageY=t.pageY,this.currentMousePosition.pageX=t.pageX,this.currentMousePosition.pageY=t.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(t){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let t=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||t.x+200,o=Math.min(i,t.width/2),s=Math.abs(t.y),a=t.y-20;return s>50&&(a=Math.abs(t.y)+180),this.loggingService.log(t),this.loggingService.log(o),this.loggingService.log(a),{topPositionX:o,topPositionY:a}}catch(t){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",t),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(t){this.pinHighlighterClass$.next(t)}setTextHighlighterClass(t){this.textHighlighterClass$.next(t)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(t,i,o){if(t){if(!o&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(t,this.pinHighlighterClass$.value):this.addClassToElement(t,v.SNIPPYLY_HIGHLIGHT)),i&&!t.hasAttribute(v.ATTRIBUTES.DEFAULT_CURSOR)){let s=t.style.getPropertyValue("cursor"),a=t.style.getPropertyPriority("cursor"),c=s?{defaultCursorValue:s,defaultCursorPriority:a}:"";t.setAttribute(v.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),t.style.setProperty("cursor",i,"important")}t.setAttribute(v.SNIPPYLY_HIGHLIGHT,"true"),t.setAttribute(v.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(t){if(t&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(t,this.pinHighlighterClass$.value),this.removeClassFromElement(t,v.SNIPPYLY_HIGHLIGHT),t.removeAttribute(v.SNIPPYLY_HIGHLIGHT),t.removeAttribute(v.VELT_IGNORE_CHANGE_DETECTION),t.hasAttribute(v.ATTRIBUTES.DEFAULT_CURSOR))){try{if(t.style.removeProperty("cursor"),t.getAttribute(v.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(t.getAttribute(v.ATTRIBUTES.DEFAULT_CURSOR));t.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}t.removeAttribute(v.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(t,i,o,s=!1){try{t&&(this.addClassToElement(t,v.VELT_LIVE_SELECTION_ON_ELEMENT),s&&this.addClassToElement(t,v.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),t.setAttribute(v.SNIPPYLY_HIGHLIGHT,"true"),t.setAttribute(v.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!t.style.getPropertyValue(v.VELT_SELECTION_COLOR)&&t.style.setProperty(v.VELT_SELECTION_COLOR,i),o&&t.setAttribute(v.SNIPPYLY_HIGHLIGHT_USER_NAME,o))}catch(a){this.loggingService.catch("Error in DomService highlightUserElement: ",a)}}removeHighlightUserFromElement(t){try{t&&(this.removeClassFromElement(t,v.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(t,v.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),t.removeAttribute(v.SNIPPYLY_HIGHLIGHT),t.removeAttribute(v.VELT_IGNORE_CHANGE_DETECTION),t.removeAttribute(v.VELT_SELECTION_COLOR),t.removeAttribute(v.SNIPPYLY_HIGHLIGHT_USER_NAME),t.style.removeProperty(v.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(t){t&&t.setAttribute(v.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(t){t&&t.removeAttribute(v.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(t,i=!1,o=!1,s){try{let a=this.calculateXPath(t,i,o,s);if(a&&typeof a=="string"&&a.includes("/svg")){let c=a.split("/"),l=!1;c.forEach((u,d)=>{u.includes("svg")&&(l=!0),l&&(c[d]="svg:"+u)}),a=c.join("/")}return a}catch(a){this.loggingService.catch("Error in DomService getXPath:",a)}}namespaceResolver(t){return t==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(t,i,o,s){try{if(t){if(typeof t=="string")return document.evaluate(t,s||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!t||t.nodeType!=1)return"";if(t.id&&document.querySelectorAll(`[id='${t.id}']`)?.length===1&&!i)return"//*[@id='"+t.id+"']";if(o&&t.className&&t.className.split){let c=t.className?.split(" ")?.filter(l=>!l?.includes("snippyly")&&!l?.includes("velt")&&!["show-pin-cursor"].includes(l))[0];if(c){let l=this.calculateXPath(t.parentNode,i,o,s)+"/"+t.tagName.toLowerCase(),u=Array.from(t.parentNode?.children||[]).filter(d=>d.nodeType===1&&d.tagName===t.tagName?d.className?.split(" ")?.filter(g=>g?.includes("snippyly")||g?.includes("velt")||["show-pin-cursor"].includes(g))[0]===c:!1);if(u.length>1){let d=u.indexOf(t)+1;l+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${d}]`}else l+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return l}}let a=[].filter.call(t.parentNode?.children?t.parentNode?.children:[],function(c){return c.tagName==t.tagName});return this.calculateXPath(t.parentNode,i,o)+"/"+t.tagName.toLowerCase()+(a.length>1?"["+([].indexOf.call(a,t)+1)+"]":"")}}catch(a){this.loggingService.catch("Error in DomService calculateXPath:",a)}}getElementFromXPath(t,i=document){try{if(this.xpathCache.has(t)){let s=this.xpathCache.get(t);if(s!==void 0&&document.contains(s))return s;this.xpathCache.delete(t)}let o=this.getXPath(t,!1,!1,i);if(o){let s=o?.iterateNext();if(s!==null&&typeof s.setAttribute=="function"){let a=J();s.setAttribute(v.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,a),this.xpathCacheId.set(a,t)}return this.xpathCache.set(t,s),s}return null}catch(o){return this.loggingService.catch("Error in DomService getElementFromXPath:",o),null}}getElementFromTargetElement(t){try{let i=null;if(t?.anchor){let o=this.resolveAnchorRecord(t.anchor);o?.element&&(i=o.element)}else t?.xpath?i=this.getElementFromXPath(t.xpath):t?.cfXpath?i=this.getElementFromXPath(t.cfXpath):t?.fXpath&&(i=this.getElementFromXPath(t.fXpath));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",i),null}}getElementFromTargetTextRange(t){try{let i=null;if(t?.commonAncestorContainerAnchor){let o=this.resolveAnchorRecord(t.commonAncestorContainerAnchor);o?.element&&(i=o.element)}else t?.commonAncestorContainer&&(i=this.getElementFromXPath(t.commonAncestorContainer));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",i),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let t=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],i=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let o=new Sg;return o.screenWidth=Math.max(...i),o.screenHeight=Math.max(...t),o.screenScrollHeight=this.pageScrollHeight,o}catch(t){return this.loggingService.catch("Error in DomService calculateScreenSize:",t),new Sg}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(t){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",t)}}removeSnippylyContent(t){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let o=new DOMParser().parseFromString(t,"text/html");o.querySelectorAll("[data-snippyly-cache-id]").forEach(f=>{f.removeAttribute("data-snippyly-cache-id")}),o.querySelectorAll("[data-velt-cache-id]").forEach(f=>{f.removeAttribute("data-velt-cache-id")}),o.querySelectorAll(".comment-text-highlight").forEach(f=>{f?.parentNode?.insertBefore(document.createTextNode(f?.textContent),f),f.remove()});let l=document.createNodeIterator(o,NodeFilter.SHOW_COMMENT),u;for(;u=l.nextNode();)u?.remove();return this.mergeAdjacentTextNodes(o.body),this.sanitizeHtml(o.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),t}}mergeAdjacentTextNodes(t){try{let i=t.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let o=i.nextSibling;for(;o&&o.nodeType===Node.TEXT_NODE;)i.textContent+=o.textContent,o.remove(),o=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(t){try{for(let i=t.length-1;i>=0;i--){if(t[i]?.scrollHeight&&t[i]?.clientHeight){let o=Math.max(t[i]?.scrollHeight,t[i]?.clientHeight);this.pageScrollHeight=Math.max(o,this.pageScrollHeight),this.nodeMap[o]=t[i]}t[i]?.childNodes?.length&&this.findLongestNode(t[i]?.childNodes)}}catch(i){this.loggingService.catch("Error in DomService findLongestNode: ",i)}}resetSelectedAnnotationsMap(t=!0,i){try{let o=Array.from(document.querySelectorAll(`[${v.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),s=this.getDraftCommentAnnotationDialogs()||[];o.push(...s),o=Array.from(new Set(o));let a=o.map(d=>d.classList.contains("velt-annotation-draft-checked")?(d.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(d,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(d,"velt-comment-dialog-shake"),d.getAttribute(v.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||d.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(d,"velt-annotation-draft-checked")},100),d.getAttribute(v.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(d=>d),c=Object.keys(this.getRecordingInProgress()||{});a=[...a,...c];let l=this.selectedAnnotationsMap$.value;if(t&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let d=[];Object.keys(l).forEach(f=>{if(l[f]?.type==="tag"){let g=l[f];g?.to?.length||a.includes(f)||d.push(g)}else l[f]?.comments?.length||a.includes(f)||d.push(l[f])}),this.deleteAnnotations$.next(d),this.deleteAnnotations$.next([])}let u={};Object.keys(l).forEach(d=>{a.includes(d)&&(u[d]=l[d]),i&&(i==="comment"?["comment","videoPin"].includes(l[d]?.type)||(u[d]=l[d]):l[d]?.type!==i&&(u[d]=l[d]))}),Object.keys(u).forEach(d=>{let f=u[d]?.multiThreadAnnotationId;f&&!u[f]&&(u[f]={annotationId:f,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(u)&&this.selectedAnnotationsMap$.next(u),this.setDialogOpenedInSidebar(!1)}catch(o){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",o)}}setRecordingInProgress(t,i){try{if(i)this.recordingInProgress$.next(le(P({},this.recordingInProgress$.value),{[t]:i}));else{let o=this.recordingInProgress$.value;delete o[t],this.recordingInProgress$.next(o)}}catch(o){this.loggingService.catch("Error in DomService setRecordingInProgress: ",o)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(t){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",t)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(t){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",t),{}}}getDraftCommentAnnotationDialogs(){try{let t=[],i=Array.from(document.querySelectorAll(`${v.TAGS.SNIPPYLY_COMMENT_DIALOG}`)),o=Array.from(document.querySelectorAll(`${v.TAGS.VELT_COMMENT_DIALOG}`));return[...i,...o].forEach(a=>{if(a?.shadowRoot){let c=a.shadowRoot.querySelector(`[${v.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);c&&t.push(c)}else{let c=a.querySelector(`${v.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(c?.shadowRoot){let l=c.shadowRoot?.querySelector(`[${v.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&t.push(l)}else{let l=a.querySelector(`[${v.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&t.push(l)}}}),t}catch(t){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",t),[]}}getSelectedAnnotationsMap(t){try{let i=this.selectedAnnotationsMap$.value;if(t){let o={};return Object.keys(i).forEach(s=>{t==="comment"?["comment","videoPin"].includes(i[s].type)&&(o[s]=i[s]):i[s].type===t&&(o[s]=i[s])}),o}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(t){return this.selectedAnnotationsMap$.asObservable().pipe(fe(i=>{if(t){let o={};return Object.keys(i).forEach(s=>{i[s].type===t&&(o[s]=i[s])}),o}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(fe(t=>Object.values(t)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",t),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(t,i,o,s=!1,a){try{o==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let c=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),l=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));c[t.annotationId]&&!s?delete c[t.annotationId]:((!this.windowKeydownShift$.value||s)&&(c={}),c[t.annotationId]=t,l[t.annotationId]=i,a=t?.multiThreadAnnotationId||a,a&&(c[a]={annotationId:a,type:"multiThread"},l[a]=i)),this.selectedAnnotationsMap$.next(c),Object.keys(l).forEach(u=>{c[u]||delete l[u]}),this.selectedAnnotationsLocationMap$.next(l)}catch(c){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",c)}}setSelectedAnnotationLocation(t,i){try{let o=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));o?.[t]!==i&&(o[t]=i,this.selectedAnnotationsLocationMap$.next(o))}catch(o){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",o)}}updateSelectedAnnotationInMap(t){try{let i=this.selectedAnnotationsMap$.value;t.forEach(o=>{i[o.annotationId]&&(i[o.annotationId]=o)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",t),ue([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(t){try{return this.mutationObserver||this.setMutationObserver(t),this.mutation$.asObservable()}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),ue([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(t,i){try{let o={offsetTop:0,offsetLeft:0},s=t;if(s===i){let a=window.getComputedStyle(t);a.position==="static"&&a.transformStyle!="preserve-3d"&&a.transform=="none"&&(o.offsetLeft=t?.offsetLeft||0,o.offsetTop=t?.offsetTop||0)}if(s!==i)if(t?.closest("svg"))for(;s&&s!==i;){let c=window.getComputedStyle(s);if(s.tagName.toLowerCase()==="svg"||s instanceof SVGElement){let l=s.parentElement;if(l){let u=l.getBoundingClientRect(),d=s.getBoundingClientRect();o.offsetLeft+=d.left-u.left,o.offsetTop+=d.top-u.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop);if(s=s.parentElement,t instanceof SVGElement&&s===i){let l=window.getComputedStyle(s);l.position==="static"&&l.transformStyle!="preserve-3d"&&l.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0)}}else{let c=window.getComputedStyle(s);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop)}return o}catch(o){return this.loggingService.catch("Error in DomService getElementOffset: ",o),{offsetTop:0,offsetLeft:0}}}isElementVisible(t){try{if(typeof t?.getBoundingClientRect=="function"){let{width:i,height:o,top:s,bottom:a}=t?.getBoundingClientRect();return i>0||o>0||s<window.innerHeight&&a>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(t){try{if(t){if(!(t instanceof Element))return!1;let i=t,o=window.getComputedStyle(i);return!(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new ge(t=>{let i=uo(document,"mousedown").pipe(fe(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),o=uo(document,"mousemove").pipe(fe(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),s=uo(document,"mouseup").pipe(fe(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),c=i.pipe(mt(l=>o.pipe(Au(),fe(([u,d])=>({startPoint:l,prevPoint:u,curPoint:d})),zs(s)))).subscribe(t);return()=>c.unsubscribe()})}drawRectangle(t,i){let o=document.querySelector(".rectangle");o||(o=document.createElement("div"),this.addClassToElement(o,"rectangle"),o.setAttribute(v.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),o.setAttribute(v.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(o));let s=Math.abs(i.x-t.x),a=Math.abs(i.y-t.y),c=Math.min(t.x,i.x),l=Math.min(t.y,i.y);return o.style.width=`${s}px`,o.style.height=`${a}px`,o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.position="absolute",o.style.border="2px dashed #f00",o.style.pointerEvents="none",o.style.zIndex="2147483577",o}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let t=window.getSelection();if(t?.rangeCount)return t.getRangeAt(0)}return null}catch(t){return this.loggingService.catch("Error in DomService getRange: ",t),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(t){this.loggingService.catch("Error in DomService clearTextSelection: ",t)}}getTargetTextRangeFromSelectionRange(t){try{let i={},o=t.commonAncestorContainer;o?.nodeType===Node.TEXT_NODE&&(o=o.parentElement);let s=document.body;if(o){let c=this.getTextXPath(o);this.isXpathWithId(c)&&(s=o)}let a=this.getAdditionalLocationContainer(o);if(a&&(s=a),i.commonAncestorContainer=this.getTextXPath(s),i.commonAncestorContainer){let c=this.getElementFromXPath(i.commonAncestorContainer);if(c){i.commonAncestorContainerFXpath=this.getXPath(c,!0),i.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let l=this.generateAnchorRecord(c);l&&(i.commonAncestorContainerAnchor=l)}}return i.text=t.toString(),i.occurrence=NC(s,0,t.startContainer,t.startOffset,t.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(t){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),t.nodeType===Node.TEXT_NODE){let i=1,o=t.previousSibling;for(;o;)o.nodeType===Node.TEXT_NODE&&i++,o=o.previousSibling;return this.getXPath(t.parentElement)}else return this.getXPath(t)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(t){try{if(v.NON_NESTABLE_ELEMENTS[t?.tagName?.toLowerCase()]){let o=t?.closest("picture");return o?o?.parentElement:t.parentElement}let i=t.closest("svg");return i?i?.parentElement:t}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),t}}isElementInsideAdditionalLocationContainer(t){try{return!!t?.closest(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(t){try{return t?.closest(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(t){try{return typeof t=="string"?!!t?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:t,elementClassNames:i,elementQuerySelectors:o}){try{let s=[];if(t?.length)for(let a=0;a<t.length;a++){let c=document.getElementById(t[a]);c&&s.push(c)}if(i?.length)for(let a=0;a<i.length;a++){let c=document.getElementsByClassName(i[a]);for(let l=0;l<c.length;l++){let u=c[l];u&&u instanceof HTMLElement&&s.push(u)}}if(o?.length)for(let a=0;a<o.length;a++){let c=document.querySelectorAll(o[a]);for(let l=0;l<c.length;l++){let u=c[l];u&&u instanceof HTMLElement&&s.push(u)}}return s}catch(s){return this.loggingService.catch("Error in DomService getListedElements: ",s),[]}}isElementInsideListedElementIds(t,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementById(i[o]);if(s&&s.contains(t))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",o),!1}}isElementInsideListedElementClassNames(t,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementsByClassName(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(t))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",o),!1}}isElementInsideListedElementQuerySelectors(t,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.querySelectorAll(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(t))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",o),!1}}addClassToElement(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),t&&(t.classList?.contains(i)||t.classList?.add(i))}catch(o){this.loggingService.catch("Error in DomService addClassToElement: ",o)}}removeClassFromElement(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),t&&t.classList?.contains(i)&&t.classList?.remove(i)}catch(o){this.loggingService.catch("Error in DomService removeClassFromElement: ",o)}}isElementInsideParentWithAttribute(t,i,o){try{let s=t;for(;s&&s!==document.body;){if(s?.getAttribute&&s?.getAttribute(i)===o)return!0;s=s.parentElement}return!1}catch(s){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",s),!1}}setVideoEditorHandlingDelete(t){try{this.isVideoEditorHandlingDelete=t}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(t){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",t),!1}}setCustomCss(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(t)}catch(i){this.loggingService.catch("Error in DomService setCustomCss: ",i)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService getCustomCss$: ",t),ue(null)}}injectCustomCss(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let o=t?.shadowRoot?.querySelector(`[${v.VELT_CUSTOM_CSS}]`);if(o&&o.remove(),i?.type==="link"){let s=document.createElement("link");s.href=i?.value,s.rel="stylesheet",s.setAttribute(v.VELT_CUSTOM_CSS,"true"),t?.shadowRoot?.appendChild(s)}else{let s=document.createElement("style");s.innerHTML=this.sanitizeHtml(i?.value),s.setAttribute(v.VELT_CUSTOM_CSS,"true"),t?.shadowRoot?.appendChild(s)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}subscribeInjectCustomCss(t){try{return this.customCss$.subscribe(()=>{this.injectCustomCss(t?.nativeElement)})}catch(i){return this.loggingService.catch("Error in DomService subscribeInjectCustomCss: ",i),new gt}}trimCommentHtml(t){try{let i=document.createElement("div");i.innerHTML=t,this.removeEmptyElements(i);let o=i.innerHTML;return o=o.replace(e.MULTIPLE_NBSP_REGEX," ").replace(e.TRIM_NBSP_REGEX,"").trim(),o}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),t}}removeEmptyElements(t){try{let s=function(a){return o.test(a.innerHTML)};var i=s;let o=/^\s*(<br\s*\/?>)?\s*$/;for(;t.firstChild&&s(t.firstChild);)t.removeChild(t.firstChild);for(;t.lastChild&&s(t.lastChild);)t.removeChild(t.lastChild)}catch(o){this.loggingService.catch("Error in DomService removeEmptyElements: ",o)}}normalizeWhitespace(t){try{t.childNodes.forEach(i=>{i.nodeType===Node.TEXT_NODE?i.nodeValue=i.nodeValue?.replace(/\s+/g," ").trim()??"":i.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(i)})}catch(i){this.loggingService.catch("Error in DomService normalizeWhitespace: ",i)}}sanitizeHtml(t){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),mv.sanitize(t,ej)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeHtmlForPaste(t){try{let i=this.convertStylesToTags(t);return mv.sanitize(i,{ALLOWED_TAGS:["b","strong","i","em","u","a","br"],ALLOWED_ATTR:["href","target","rel"]})}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtmlForPaste: ",i),""}}convertStylesToTags(t){try{let i=document.createElement("div");return i.innerHTML=t,this.convertBlockElementsToBr(i),this.processNodeStyles(i),i.innerHTML}catch(i){return this.loggingService.catch("Error in DomService convertStylesToTags: ",i),t}}convertBlockElementsToBr(t){try{let i=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","SECTION","ARTICLE","HEADER","FOOTER"],o;for(;(o=t.querySelector(i.join(",")))!==null;){let s=o.parentNode;if(!s)break;for(;o.firstChild;)s.insertBefore(o.firstChild,o);o.nextSibling&&s.insertBefore(document.createElement("br"),o),s.removeChild(o)}}catch(i){this.loggingService.catch("Error in DomService convertBlockElementsToBr: ",i)}}processNodeStyles(t){try{let i=Array.from(t.childNodes);for(let o of i)if(o.nodeType===Node.ELEMENT_NODE){this.processNodeStyles(o);let s=o,a=s.style,c=o,l=a?.fontWeight;if(l==="bold"||l==="700"||l==="800"||l==="900"){let u=s.tagName?.toLowerCase();if(u!=="b"&&u!=="strong"){let d=document.createElement("b");c.parentNode.insertBefore(d,c),d.appendChild(c),c=d}}if(a?.fontStyle==="italic"){let u=s.tagName?.toLowerCase();if(u!=="i"&&u!=="em"){let d=document.createElement("i");c.parentNode.insertBefore(d,c),d.appendChild(c),c=d}}if((a?.textDecorationLine?.includes("underline")||a?.textDecoration?.includes("underline"))&&s.tagName?.toLowerCase()!=="u"){let d=document.createElement("u");c.parentNode.insertBefore(d,c),d.appendChild(c),c=d}}}catch(i){this.loggingService.catch("Error in DomService processNodeStyles: ",i)}}sanitizeSvg(t){try{return mv.sanitize(t,ej)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),t}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let t=new li;this.deviceInfo$.next(t)}catch(t){this.loggingService.catch("Error in DomService setDeviceInfo: ",t)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",t),ue(new li)}}getTabId(){try{let t=sessionStorage.getItem(v.SESSION_STORAGE.VELT_TAB_ID);!t&&this.tabId&&(t=this.tabId,sessionStorage.setItem(v.SESSION_STORAGE.VELT_TAB_ID,t)),!this.tabId&&t&&(this.tabId=t);let i=this.getTabIdFromWindowName();return(!t||t!==i)&&(t=J(),this.tabId=t,sessionStorage.setItem(v.SESSION_STORAGE.VELT_TAB_ID,t),this.setTabIdToWindowName(t)),t}catch(t){return this.loggingService.catch("Error in DomService getTabId: ",t),null}}getTabIdFromWindowName(){try{return window.name}catch(t){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",t),null}}setTabIdToWindowName(t){try{window.name=t}catch(i){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",i)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(t){return this.loggingService.catch("Error in DomService getDeviceInfo: ",t),new li}}isMobileDevice(){try{return new li().getDeviceType()===Gr.MOBILE}catch(t){return this.loggingService.catch("Error in DomService isMobileDevice: ",t),!1}}isTabletDevice(){try{return new li().getDeviceType()===Gr.TABLET}catch(t){return this.loggingService.catch("Error in DomService isTabletDevice: ",t),!1}}isDesktopDevice(){try{return new li().getDeviceType()===Gr.DESKTOP}catch(t){return this.loggingService.catch("Error in DomService isDesktopDevice: ",t),!1}}deepCloneElement(t){try{var i=document.createElement(t?.tagName);return Array.from(t.attributes).forEach(o=>{i.setAttribute(o.nodeName,o.nodeValue)}),t.childNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(o)):o.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(o.nodeValue))}),i}catch(o){return this.loggingService.catch("Error in DomService deepCloneElement: ",o),t}}setRandomNumberToElementRecursive(t){try{if(!t)return;let i=Math.random().toString(36).substring(7);t&&t.setAttribute&&typeof t.setAttribute=="function"&&(t.getAttribute("velt-wireframe-id")||t.setAttribute("velt-wireframe-id",i)),Array.from(t.children).forEach(s=>{this.setRandomNumberToElementRecursive(s)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(t){this.dialogOpenedInSidebar$.next(t)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(t){if(!t)return;Array.from(t.children).forEach(o=>{if(this.removeWireframeSuffixFromTags(o),o.tagName.toLowerCase().endsWith("-wireframe")){let s=o.tagName.toLowerCase().replace("-wireframe",""),a=document.createElement(s);for(Array.from(o.attributes).forEach(c=>{a.setAttribute(c.name,c.value)});o.firstChild;)a.appendChild(o.firstChild);o.parentNode.replaceChild(a,o)}})}isMonitorDevice(){try{return new li().getDeviceType()===Gr.MONITOR}catch(t){return this.loggingService.catch("Error in DomService isMonitorDevice: ",t),!1}}isElementOriginallyStatic(t){try{return window.getComputedStyle(t).position==="static"||t.hasAttribute(v.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)||t.hasAttribute(v.ATTRIBUTES.VELT_AREA_PIN_HOST_STATIC)||t.hasAttribute(v.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC)||t.hasAttribute(v.ATTRIBUTES.VELT_RECORDER_PIN_HOST_STATIC)||t.hasAttribute(v.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC)}catch(i){return this.loggingService.catch("Error in DomService isElementOriginallyStatic: ",i),!1}}};e.MULTIPLE_NBSP_REGEX=/(?:&nbsp;\s*){2,}/g,e.TRIM_NBSP_REGEX=/^(?:&nbsp;\s*)+|(?:&nbsp;\s*)+$/g,e.\u0275fac=function(i){return new(i||e)(w(Lt),w(us),w(_e),w(mC))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Rr=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d){this.afAuth=t,this.configService=i,this.avatarService=o,this.coreActionsService=s,this.domService=a,this.functions=c,this.analyticsService=l,this.loggingService=u,this.serviceBook=d,this.user$=new Y(null),this.userOptions$=new Y(null),this.userContacts$=new Y(null),this.userOrganization$=new Y(null),this.isPrivateCommentsEnabled$=new Y(!1),this.providedUser=new Es,this.firebaseConfig$=new Y(null),this.advancedQueries$=new Y(null),this.planDetails$=new Y(null),this.signOutPreviousUser$=new Y(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.cachedActivityConfig=null,this.viewsService=null,this.crdtService=null,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;"),this.serviceBook.observe(md).subscribe(f=>{this.commentService=f??void 0}),this.serviceBook.observe(AT).subscribe(f=>{this.reactionService=f??void 0}),this.serviceBook.observe(DT).subscribe(f=>{this.areaService=f??void 0}),this.serviceBook.observe(RT).subscribe(f=>{this.activityService=f??void 0,f&&this.cachedActivityConfig&&f.setActivityFeatureConfig(this.cachedActivityConfig)}),this.serviceBook.observe(M1).subscribe(f=>{this.viewsService=f??null}),this.serviceBook.observe(P1).subscribe(f=>{this.crdtService=f??null});try{try{let f=this.configService.getAuthProxyHost();if(f){let g=this.afAuth?.config;g&&(g.apiHost=f,g.tokenApiHost=f)}}catch{}this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(v.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=wd(this.afAuth).pipe(Du(this.afAuth.currentUser),Au(),mt(([f,g])=>this.domService.onNetworkStatusChange$().pipe(Ct(p=>p),Nt(1),fe(()=>({previousUser:f,currentUser:g}))))).subscribe(p=>I(this,[p],function*({previousUser:f,currentUser:g}){if(!g&&f){let _=f?.stsTokenManager?.expirationTime,T=new Date().getTime(),S=_-T;T>_&&(this.analyticsService.trackEvent(L.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:S,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(L.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:S,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(L.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:S,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(it(Ft)).subscribe(f=>{let g=wC(f);this.coreActionsService.triggerAction(G.USER_UPDATE,g),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:G.USER_UPDATE,payload:{user:g}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}setApiKey(t,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",t);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=t,this.configService.setApiKey(this.apiKey),i||(i=new LT),this.configService.initConfig(i);let o=this.configService.getProxyConfig();if(o?.authHost)try{let s=this.afAuth?.config;s&&(s.apiHost=o.authHost,s.tokenApiHost=o.authHost)}catch(s){this.loggingService.catch("Error setting auth proxy config: ",s)}i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||wd(this.afAuth).pipe(Nt(1)).subscribe(s=>I(this,null,function*(){if(this.autoLoginCalled=!0,s){let a=yield pI(s,!0).catch(c=>null);if(a){let{user:c}=a?.claims;this.autoLoginRequired&&(c=yield this.updateUserWithColorAndTextColor(c),this.initializeClient(c,this.userOptions$?.value?le(P({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin"))}}}))}catch(o){this.loggingService.catch("Error in setApiKey: ",o)}}setUsersService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=t}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setUserPermissionService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=t}catch(i){this.loggingService.catch("Error in setUserPermissionService: ",i)}}setDocService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=t}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=t}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=t}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setCommentService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=t}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setCommonDbService(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=t}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(t){if(this.isVersionGreaterThanOrEqualTo4()&&!t?.organizationId)if(this.analyticsService.trackEvent(L.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t)},!0,t.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let i=null;if(!t.user)return null;t.generateToken&&typeof t.generateToken=="function"&&(i=yield t.generateToken());let o=yield OC(()=>window.Velt.identify(t.user,P(P({},t.options||{}),i&&{authToken:i}),{fromProvider:!0}).catch(s=>(t.onError&&typeof t.onError=="function"&&t.onError(s),Promise.reject(s))),t.retryConfig||{retryCount:0,retryDelay:0});return o&&t.generateToken&&typeof t.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(G.ERROR).pipe(Ct(s=>s.code==="token_expired"),Nt(10)).subscribe(s=>I(this,null,function*(){if(s.code==="token_expired"){let a=this.docService?.getDocumentIds()?.map(g=>({id:g.clientDocumentId}))??[],c=this.docService?.getOptionsFromDocumentPaths()??void 0,l=[],u=this.docService?.getLocation();u&&l.push(u.location);let d=this.docService?.getLocations();d&&Object.values(d).forEach(g=>{l.push(g.location)}),(yield OC(()=>I(this,null,function*(){try{let g=yield t.generateToken?.();return g?window.Velt.identify(t.user,P(P({},t.options||{}),g&&{authToken:g}),{fromProvider:!0}):!0}catch{return!1}}),t.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:a,options:c,source:"internal"}),yield this.docService?.setLocations({locations:l,source:"internal",options:{appendLocation:!u}}))}}))),o}catch(i){return this.loggingService.catch("Error in setVeltAuthProvider: ",i),null}})}setUserToStorage(t){return I(this,null,function*(){try{if(t){let i=yield rl(t,t?.userId??"");localStorage.setItem(v.LOCAL_STORAGE.VELT_IDENTIFY_USER,i)}}catch(i){this.loggingService.catch("Error in setUserToStorage: ",i)}})}getUserFromStorage(t){return I(this,null,function*(){try{let i=localStorage.getItem(v.LOCAL_STORAGE.VELT_IDENTIFY_USER);return i?yield CC(i,t?.userId??""):null}catch(i){return this.loggingService.catch("Error in getUserFromStorage: ",i),null}})}setIsPrivateCommentsEnabled(t){try{this.isPrivateCommentsEnabled$.next(t)}catch(i){this.loggingService.catch("Error in setIsPrivateCommentsEnabled: ",i)}}getIsPrivateCommentsEnabled(){return this.isPrivateCommentsEnabled$.value}getIsPrivateCommentsEnabled$(){return this.isPrivateCommentsEnabled$.asObservable()}updateUserWithColorAndTextColor(t){return I(this,null,function*(){try{let i=JSON.parse(JSON.stringify(t??{})),o=yield this.getUserFromStorage(i);return!o||Object.keys(o).length===0?(delete i?.color,delete i?.textColor,i):(o?.color&&(i.color=o?.color),o?.textColor&&(i.textColor=o?.textColor),i)}catch(i){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",i),t}})}updateUserIfRequired(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let i=yield this.getUserFromStorage(t),o={};t.color&&t.color!==i?.color&&(o.color=t.color),t.textColor&&t.textColor!==i?.textColor&&(o.textColor=t.textColor),Object.keys(o).length>0&&t.clientOrganizationId&&this.docService?.addUserInfoToOrganization({organizationId:t.clientOrganizationId,user:le(P({},o),{userId:t.userId})})}catch(i){this.loggingService.catch("Error in updateUserIfRequired: ",i)}})}initializeClient(t,i,o,s,a){return I(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=t,this.pendingUserLoginSource=a;else{t.userSnippylyId=MV(this.configService.getApiKey(),t.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let c=yield wd(this.afAuth).pipe(Nt(1)).toPromise().catch(u=>null),l=!0;if(this.providedUser=JSON.parse(JSON.stringify(t)),c){let u=yield pI(c,!0).catch(p=>null);if(!u)return;let{user:d,firebaseConfig:f,advancedQueries:g}=u.claims;c?.uid!==t?.userSnippylyId||t?.groupId!==d?.groupId||t?.organizationId!==d?.organizationId||i?.forceReset||!s&&t?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(t)||this.forceReLoginRequiredForRegion(t,f)||this.forceReLoginRequiredForCommentViews(t)?(localStorage.setItem(v.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(v.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal")):(this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user"),yield this.updateUserIfRequired(t),this.validateOrganizationId(t),this.setFirebaseConfig(f),this.setAdvancedQueries(g),d&&(this.providedUser.isAdmin=!!d.isAdmin),this.initializeSignedInUser(c,s,t),l=!1,this.analyticsService.trackEvent(L.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t),source:a}))}if(l){this.analyticsService.trackEvent(L.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t),source:a},!0,t.userSnippylyId,t.userId);let u=Ar(this.functions,Tr({url:st.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),d=$r(),f=(yield u({apiKey:this.apiKey,user:t,version:d,authToken:i?.authToken}))?.data;if(f.error){if(this.analyticsService.trackEvent(L.Events.Core.SDK_VALIDATE_CLIENT_FAILED,le(P({apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,message:f.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t)},f),{source:a}),!0,t.userSnippylyId,t.userId),f.error&&typeof f.error=="string")if(f.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let g={code:"token_expired",message:"Token expired",error:f?.error,source:f?.source};this.coreActionsService.triggerAction(G.ERROR,g)}else{let g={code:"too_many_retries",message:"Token expired. Too many retries.",error:f?.error,source:f?.source};this.coreActionsService.triggerAction(G.ERROR,g),this.analyticsService.trackEvent(L.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:a},!0,t.userSnippylyId,t.userId)}else{let g=f;this.coreActionsService.triggerAction(G.ERROR,g)}throw f}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(L.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t),source:a},!0,t.userSnippylyId,t.userId),this.validateOrganizationId(t),f.firebaseConfig){this.setFirebaseConfig(f.firebaseConfig),yield this.signInWithCustomToken(t,f.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let g=yield pI(this.afAuth.currentUser,!0).catch(T=>null);if(!g)return;let{user:p,advancedQueries:_}=g.claims;this.setAdvancedQueries(_),this.providedUser.isAdmin=!!p?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,s,t)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:t,userOptions:i,initializeClientToken:o,autoLogin:s},this.checkForPendingLogin()}return t}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),i?.throwError?Promise.reject(c):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let t=$r();return(t?parseInt(t.split(".")?.[0]||"0"):0)>=4}catch(t){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",t),!1}}isVersion4Point5(){try{let t=$r();if(t){let i=t.split("."),o=parseInt(i[0]||"0"),s=parseInt(i[1]||"0"),a=parseInt(i[2]||"0");if(o>=4&&s>=5)return o===4&&s===5&&a===0?!t.toLowerCase().includes("beta"):!0}return!1}catch(t){return this.loggingService.catch("Error in isVersion4Point5: ",t),!1}}forceReLoginRequiredForAdvancedQueries(t){try{let i=this.isVersionGreaterThanOrEqualTo4(),o=!1;try{let s=localStorage.getItem(v.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);s&&(o=JSON.parse(s)?.advancedQueriesEnabled)}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",s)}return!!(i&&t.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForCommentViews(t){try{let i=this.isVersion4Point5(),o=!1;try{let s=localStorage.getItem(v.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);s&&(o=JSON.parse(s))}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",s)}return!!(i&&t.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",i),!1}}forceReLoginRequiredForRegion(t,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&t.organizationId&&!i?.region)}catch(o){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",o),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(t){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:P(P({},st.firebaseConfig),t)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(t){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{t&&typeof t=="object"&&localStorage.setItem(v.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(t)),this.advancedQueries$.next(t)}catch(i){this.loggingService.catch("Error in setAdvancedQueries: ",i)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled$(){return Jr([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(fe(()=>this.getAdvancedQueriesEnabled()),es(()=>ue(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(t){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",t),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),wd(this.afAuth).pipe(mt(t=>t?this.user$.asObservable():ue(null)),it(Ft))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(t){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(t.userId&&t.userId!==i?.userId||t?.groupId&&t?.groupId!==i?.groupId||t?.organizationId&&t?.organizationId!==i?.organizationId)this.providedUser=t,this.initializeClient(t,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=P(P({},this.providedUser),t),i){let o=P(P({},i),t);this.updateUserInternally(o)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(t,i,o="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return EG(this.afAuth,i).then(s=>(this.analyticsService.trackEvent(L.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(t)}),s)).catch(s=>(this.analyticsService.trackEvent(L.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:t.userId,snippylyUserId:t.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,message:s.message,user:this.getUserWithoutContacts(t)}),s))}catch(s){return this.loggingService.catch("Error in signInWithCustomToken: ",s),Promise.reject(s)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache","color: green;");try{this.activityService?.setActivityFeatureConfig({immutable:!1,isEnabled:!1})}catch(t){this.loggingService.catch("Error in clearCache: ",t)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.crdtService?.flushAllEditorActivities(),this.clearCache(),this.commonDbService?.unsubscribeFromObservables(),this.activityService?.destroy(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.serviceBook.get(ST)?.clearCache(),this.viewsService?.clearCache()}catch(t){this.loggingService.catch("Error in resetServicesCache: ",t)}}initializeSignedInUser(t,i,o){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let s=new Es;s.userSnippylyId=t.uid,s.type="signedIn",o&&(s=P(P({},s),o)),this.setUserToStorage(s),this.mergeUserWithProvidedUserData(s,i)}catch(s){this.loggingService.catch("Error in initializeSignedInUser: ",s)}}mergeUserWithProvidedUserData(t,i){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{t.userId=this.providedUser?.userId||t.userId;let o=null;if(this.usersService?.externalUserDataProviderAvailable()){let s=J(),a=el.IDENTIFY;this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:xn.MERGE_USER_WITH_PROVIDED_USER_DATA,moduleName:a,source:"internal",payload:{userIds:[t.userId],organizationId:this.providedUser?.organizationId||t.organizationId}});let c=yield this.usersService.resolveUsers({userIds:[t.userId],organizationId:this.providedUser?.organizationId||t.organizationId,skipUserCheck:!0,uniqueId:s,moduleName:a});c&&c[t.userId]&&(o=JSON.parse(JSON.stringify(c[t.userId]||{}))),t=P(P({},t),o||{})}t.name=o?o?.name:this.providedUser?.name||t.name,t.clientUserName=o?o?.clientUserName:this.providedUser?.clientUserName||t.clientUserName,t.photoUrl=o?o?.photoUrl:this.providedUser?.photoUrl||t.photoUrl,t?.photoUrl===void 0&&(t.photoUrl=null),t.email=o?o?.email:this.providedUser?.email||t.email,t.color=o?.color||this.providedUser?.color||this.getUserAvatarColor(t.userId),t.textColor=o?.textColor||this.providedUser?.textColor||this.getUserTextColor(t.userId),t.initial=o?.initial||this.providedUser?.initial||t.initial||t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase(),t.contacts=this.providedUser?.contacts||t.contacts,t.plan=this.providedUser?.plan||t.plan,t.groupId=this.providedUser?.groupId||t.groupId,t.clientGroupId=this.providedUser?.clientGroupId||t.clientGroupId,t.clientOrganizationId=this.providedUser?.clientOrganizationId||t.clientOrganizationId,t.organizationId=this.providedUser?.organizationId||t.organizationId,t.isAdmin=this.providedUser?.isAdmin,t.isReadOnly=this.providedUser?.isReadOnly,t.isAnonymous=this.providedUser?.isAnonymous,t.isGuest=this.providedUser?.isGuest,this.updateUserInternally(t)}catch(o){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",o)}})}updateUserInternally(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},t);delete i.contacts,this.analyticsService.identifyUser(t.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||this.getPlanDetailsFromDb();let o=Ar(this.functions,Tr({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()})),s=Sd({methodName:"updateUserInternally",data:{type:"getProjectConfig"},getSdkProxy:o,userId:t?.userId??""}),a=Promise.resolve();if(this.userPermissionService?.isPermissionProviderAvailable()&&t.clientOrganizationId){let u=[{userId:t.userId,resource:{id:t.clientOrganizationId,type:ui.ORGANIZATION,source:Un.IDENTIFY,organizationId:t.clientOrganizationId}}],d=J();this.coreActionsService.triggerAction(G.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.IDENTIFY,uniqueId:d,timestamp:new Date().getTime(),source:"internal",payload:{requests:u}}),a=this.userPermissionService?.onResourceAccessRequired({requests:u,uniqueId:d,userId:t.userId,methodName:Un.IDENTIFY,fromCache:!1})??Promise.resolve()}let[c,l]=yield Promise.allSettled([s,a]);if(c.status==="fulfilled"){this.setIsPrivateCommentsEnabled(!!c.value?.data?.isPrivateCommentsEnabled);let u=c.value?.data?.activityConfig??{immutable:!1,isEnabled:!1};this.cachedActivityConfig=u,this.activityService?.setActivityFeatureConfig(u)}else this.loggingService.warn("Failed to fetch project config:",c.reason);this.afAuth.currentUser&&(this.user$.next(t),this.updateUserToFirebase(t))}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}updateUserToFirebase(t){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(t)),o=le(P({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return I(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield Ar(this.functions,Tr({url:st.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:$r(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(L.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(i?.data||{planInfo:null,isPlanExpired:!1}),i}catch(t){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",t),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Ct(t=>!!t),fe(t=>!!t?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(t,i){try{this.preSignOutFunctions.set(t,i)}catch(o){this.loggingService.catch("Error in addPreSignOutFuction: ",o)}}setUserOrganization(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===t?.organizationId?(i.metadata=t,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===i?.metadata?.organizationId&&(i.groups=t,this.userOrganization$.next(i))}catch(i){this.loggingService.catch("Error in setUserOrganizationGroups: ",i)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(mt(t=>t?this.userOrganization$.asObservable().pipe(fe(i=>i?.metadata?.organizationId===t.organizationId?i:null)):ue(null)))}signOutUser(t="internal"){return I(this,null,function*(){try{this.userPermissionService?.invalidateAllPermissionsState(),t==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(L.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:t==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:t});let i=yield wd(this.afAuth).pipe(Nt(1)).toPromise().catch(o=>null);if(i){this.resetServicesCache(),this.user$.next(null);for(let[o,s]of this.preSignOutFunctions)try{yield s(i)}catch(a){this.loggingService.catch(`Error in signOutUser ${o} function: `,a)}return this.user$.next(null),yield xV(1e3),_G(this.afAuth).catch(o=>{this.loggingService.catch("Error in signOutUser:",o)})}else return Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}})}isFeatureAllowed(t){return wV(this.config,this.user$.value,t)}getUserWithoutContacts(t){try{if(t){let i=JSON.parse(JSON.stringify(t));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForClient(t){try{return wC(t)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}getUserAvatarColor(t){try{return t?this.avatarService.generateUserColor(_r(t)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(t){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(t){try{t.forEach(i=>{try{i?.color||(i.color=this.getUserAvatarColor(i?.userId)),i?.textColor||(i.textColor=this.getUserTextColor(i?.userId)),!i?.initial&&(i?.name||i?.email)&&(i.initial=i.name?.charAt(0).toUpperCase()||i.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};e.\u0275fac=function(i){return new(i||e)(w(dl),w(Dr),w(k2),w(It),w(pv),w(ur),w(Lt),w(_e),w(ci))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var nj=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},rj={};var As,Nw;(function(){var n;function e(A,D){function C(){}C.prototype=D.prototype,A.D=D.prototype,A.prototype=new C,A.prototype.constructor=A,A.C=function(O,M,F){for(var N=Array(arguments.length-2),_i=2;_i<arguments.length;_i++)N[_i-2]=arguments[_i];return D.prototype[M].apply(O,N)}}function r(){this.blockSize=-1}function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(t,r),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(A,D,C){C||(C=0);var O=Array(16);if(typeof D=="string")for(var M=0;16>M;++M)O[M]=D.charCodeAt(C++)|D.charCodeAt(C++)<<8|D.charCodeAt(C++)<<16|D.charCodeAt(C++)<<24;else for(M=0;16>M;++M)O[M]=D[C++]|D[C++]<<8|D[C++]<<16|D[C++]<<24;D=A.g[0],C=A.g[1],M=A.g[2];var F=A.g[3],N=D+(F^C&(M^F))+O[0]+3614090360&4294967295;D=C+(N<<7&4294967295|N>>>25),N=F+(M^D&(C^M))+O[1]+3905402710&4294967295,F=D+(N<<12&4294967295|N>>>20),N=M+(C^F&(D^C))+O[2]+606105819&4294967295,M=F+(N<<17&4294967295|N>>>15),N=C+(D^M&(F^D))+O[3]+3250441966&4294967295,C=M+(N<<22&4294967295|N>>>10),N=D+(F^C&(M^F))+O[4]+4118548399&4294967295,D=C+(N<<7&4294967295|N>>>25),N=F+(M^D&(C^M))+O[5]+1200080426&4294967295,F=D+(N<<12&4294967295|N>>>20),N=M+(C^F&(D^C))+O[6]+2821735955&4294967295,M=F+(N<<17&4294967295|N>>>15),N=C+(D^M&(F^D))+O[7]+4249261313&4294967295,C=M+(N<<22&4294967295|N>>>10),N=D+(F^C&(M^F))+O[8]+1770035416&4294967295,D=C+(N<<7&4294967295|N>>>25),N=F+(M^D&(C^M))+O[9]+2336552879&4294967295,F=D+(N<<12&4294967295|N>>>20),N=M+(C^F&(D^C))+O[10]+4294925233&4294967295,M=F+(N<<17&4294967295|N>>>15),N=C+(D^M&(F^D))+O[11]+2304563134&4294967295,C=M+(N<<22&4294967295|N>>>10),N=D+(F^C&(M^F))+O[12]+1804603682&4294967295,D=C+(N<<7&4294967295|N>>>25),N=F+(M^D&(C^M))+O[13]+4254626195&4294967295,F=D+(N<<12&4294967295|N>>>20),N=M+(C^F&(D^C))+O[14]+2792965006&4294967295,M=F+(N<<17&4294967295|N>>>15),N=C+(D^M&(F^D))+O[15]+1236535329&4294967295,C=M+(N<<22&4294967295|N>>>10),N=D+(M^F&(C^M))+O[1]+4129170786&4294967295,D=C+(N<<5&4294967295|N>>>27),N=F+(C^M&(D^C))+O[6]+3225465664&4294967295,F=D+(N<<9&4294967295|N>>>23),N=M+(D^C&(F^D))+O[11]+643717713&4294967295,M=F+(N<<14&4294967295|N>>>18),N=C+(F^D&(M^F))+O[0]+3921069994&4294967295,C=M+(N<<20&4294967295|N>>>12),N=D+(M^F&(C^M))+O[5]+3593408605&4294967295,D=C+(N<<5&4294967295|N>>>27),N=F+(C^M&(D^C))+O[10]+38016083&4294967295,F=D+(N<<9&4294967295|N>>>23),N=M+(D^C&(F^D))+O[15]+3634488961&4294967295,M=F+(N<<14&4294967295|N>>>18),N=C+(F^D&(M^F))+O[4]+3889429448&4294967295,C=M+(N<<20&4294967295|N>>>12),N=D+(M^F&(C^M))+O[9]+568446438&4294967295,D=C+(N<<5&4294967295|N>>>27),N=F+(C^M&(D^C))+O[14]+3275163606&4294967295,F=D+(N<<9&4294967295|N>>>23),N=M+(D^C&(F^D))+O[3]+4107603335&4294967295,M=F+(N<<14&4294967295|N>>>18),N=C+(F^D&(M^F))+O[8]+1163531501&4294967295,C=M+(N<<20&4294967295|N>>>12),N=D+(M^F&(C^M))+O[13]+2850285829&4294967295,D=C+(N<<5&4294967295|N>>>27),N=F+(C^M&(D^C))+O[2]+4243563512&4294967295,F=D+(N<<9&4294967295|N>>>23),N=M+(D^C&(F^D))+O[7]+1735328473&4294967295,M=F+(N<<14&4294967295|N>>>18),N=C+(F^D&(M^F))+O[12]+2368359562&4294967295,C=M+(N<<20&4294967295|N>>>12),N=D+(C^M^F)+O[5]+4294588738&4294967295,D=C+(N<<4&4294967295|N>>>28),N=F+(D^C^M)+O[8]+2272392833&4294967295,F=D+(N<<11&4294967295|N>>>21),N=M+(F^D^C)+O[11]+1839030562&4294967295,M=F+(N<<16&4294967295|N>>>16),N=C+(M^F^D)+O[14]+4259657740&4294967295,C=M+(N<<23&4294967295|N>>>9),N=D+(C^M^F)+O[1]+2763975236&4294967295,D=C+(N<<4&4294967295|N>>>28),N=F+(D^C^M)+O[4]+1272893353&4294967295,F=D+(N<<11&4294967295|N>>>21),N=M+(F^D^C)+O[7]+4139469664&4294967295,M=F+(N<<16&4294967295|N>>>16),N=C+(M^F^D)+O[10]+3200236656&4294967295,C=M+(N<<23&4294967295|N>>>9),N=D+(C^M^F)+O[13]+681279174&4294967295,D=C+(N<<4&4294967295|N>>>28),N=F+(D^C^M)+O[0]+3936430074&4294967295,F=D+(N<<11&4294967295|N>>>21),N=M+(F^D^C)+O[3]+3572445317&4294967295,M=F+(N<<16&4294967295|N>>>16),N=C+(M^F^D)+O[6]+76029189&4294967295,C=M+(N<<23&4294967295|N>>>9),N=D+(C^M^F)+O[9]+3654602809&4294967295,D=C+(N<<4&4294967295|N>>>28),N=F+(D^C^M)+O[12]+3873151461&4294967295,F=D+(N<<11&4294967295|N>>>21),N=M+(F^D^C)+O[15]+530742520&4294967295,M=F+(N<<16&4294967295|N>>>16),N=C+(M^F^D)+O[2]+3299628645&4294967295,C=M+(N<<23&4294967295|N>>>9),N=D+(M^(C|~F))+O[0]+4096336452&4294967295,D=C+(N<<6&4294967295|N>>>26),N=F+(C^(D|~M))+O[7]+1126891415&4294967295,F=D+(N<<10&4294967295|N>>>22),N=M+(D^(F|~C))+O[14]+2878612391&4294967295,M=F+(N<<15&4294967295|N>>>17),N=C+(F^(M|~D))+O[5]+4237533241&4294967295,C=M+(N<<21&4294967295|N>>>11),N=D+(M^(C|~F))+O[12]+1700485571&4294967295,D=C+(N<<6&4294967295|N>>>26),N=F+(C^(D|~M))+O[3]+2399980690&4294967295,F=D+(N<<10&4294967295|N>>>22),N=M+(D^(F|~C))+O[10]+4293915773&4294967295,M=F+(N<<15&4294967295|N>>>17),N=C+(F^(M|~D))+O[1]+2240044497&4294967295,C=M+(N<<21&4294967295|N>>>11),N=D+(M^(C|~F))+O[8]+1873313359&4294967295,D=C+(N<<6&4294967295|N>>>26),N=F+(C^(D|~M))+O[15]+4264355552&4294967295,F=D+(N<<10&4294967295|N>>>22),N=M+(D^(F|~C))+O[6]+2734768916&4294967295,M=F+(N<<15&4294967295|N>>>17),N=C+(F^(M|~D))+O[13]+1309151649&4294967295,C=M+(N<<21&4294967295|N>>>11),N=D+(M^(C|~F))+O[4]+4149444226&4294967295,D=C+(N<<6&4294967295|N>>>26),N=F+(C^(D|~M))+O[11]+3174756917&4294967295,F=D+(N<<10&4294967295|N>>>22),N=M+(D^(F|~C))+O[2]+718787259&4294967295,M=F+(N<<15&4294967295|N>>>17),N=C+(F^(M|~D))+O[9]+3951481745&4294967295,A.g[0]=A.g[0]+D&4294967295,A.g[1]=A.g[1]+(M+(N<<21&4294967295|N>>>11))&4294967295,A.g[2]=A.g[2]+M&4294967295,A.g[3]=A.g[3]+F&4294967295}t.prototype.u=function(A,D){D===void 0&&(D=A.length);for(var C=D-this.blockSize,O=this.B,M=this.h,F=0;F<D;){if(M==0)for(;F<=C;)i(this,A,F),F+=this.blockSize;if(typeof A=="string"){for(;F<D;)if(O[M++]=A.charCodeAt(F++),M==this.blockSize){i(this,O),M=0;break}}else for(;F<D;)if(O[M++]=A[F++],M==this.blockSize){i(this,O),M=0;break}}this.h=M,this.o+=D},t.prototype.v=function(){var A=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);A[0]=128;for(var D=1;D<A.length-8;++D)A[D]=0;var C=8*this.o;for(D=A.length-8;D<A.length;++D)A[D]=C&255,C/=256;for(this.u(A),A=Array(16),D=C=0;4>D;++D)for(var O=0;32>O;O+=8)A[C++]=this.g[D]>>>O&255;return A};function o(A,D){var C=a;return Object.prototype.hasOwnProperty.call(C,A)?C[A]:C[A]=D(A)}function s(A,D){this.h=D;for(var C=[],O=!0,M=A.length-1;0<=M;M--){var F=A[M]|0;O&&F==D||(C[M]=F,O=!1)}this.g=C}var a={};function c(A){return-128<=A&&128>A?o(A,function(D){return new s([D|0],0>D?-1:0)}):new s([A|0],0>A?-1:0)}function l(A){if(isNaN(A)||!isFinite(A))return d;if(0>A)return T(l(-A));for(var D=[],C=1,O=0;A>=C;O++)D[O]=A/C|0,C*=4294967296;return new s(D,0)}function u(A,D){if(A.length==0)throw Error("number format error: empty string");if(D=D||10,2>D||36<D)throw Error("radix out of range: "+D);if(A.charAt(0)=="-")return T(u(A.substring(1),D));if(0<=A.indexOf("-"))throw Error('number format error: interior "-" character');for(var C=l(Math.pow(D,8)),O=d,M=0;M<A.length;M+=8){var F=Math.min(8,A.length-M),N=parseInt(A.substring(M,M+F),D);8>F?(F=l(Math.pow(D,F)),O=O.j(F).add(l(N))):(O=O.j(C),O=O.add(l(N)))}return O}var d=c(0),f=c(1),g=c(16777216);n=s.prototype,n.m=function(){if(_(this))return-T(this).m();for(var A=0,D=1,C=0;C<this.g.length;C++){var O=this.i(C);A+=(0<=O?O:4294967296+O)*D,D*=4294967296}return A},n.toString=function(A){if(A=A||10,2>A||36<A)throw Error("radix out of range: "+A);if(p(this))return"0";if(_(this))return"-"+T(this).toString(A);for(var D=l(Math.pow(A,6)),C=this,O="";;){var M=x(C,D).g;C=S(C,M.j(D));var F=((0<C.g.length?C.g[0]:C.h)>>>0).toString(A);if(C=M,p(C))return F+O;for(;6>F.length;)F="0"+F;O=F+O}},n.i=function(A){return 0>A?0:A<this.g.length?this.g[A]:this.h};function p(A){if(A.h!=0)return!1;for(var D=0;D<A.g.length;D++)if(A.g[D]!=0)return!1;return!0}function _(A){return A.h==-1}n.l=function(A){return A=S(this,A),_(A)?-1:p(A)?0:1};function T(A){for(var D=A.g.length,C=[],O=0;O<D;O++)C[O]=~A.g[O];return new s(C,~A.h).add(f)}n.abs=function(){return _(this)?T(this):this},n.add=function(A){for(var D=Math.max(this.g.length,A.g.length),C=[],O=0,M=0;M<=D;M++){var F=O+(this.i(M)&65535)+(A.i(M)&65535),N=(F>>>16)+(this.i(M)>>>16)+(A.i(M)>>>16);O=N>>>16,F&=65535,N&=65535,C[M]=N<<16|F}return new s(C,C[C.length-1]&-2147483648?-1:0)};function S(A,D){return A.add(T(D))}n.j=function(A){if(p(this)||p(A))return d;if(_(this))return _(A)?T(this).j(T(A)):T(T(this).j(A));if(_(A))return T(this.j(T(A)));if(0>this.l(g)&&0>A.l(g))return l(this.m()*A.m());for(var D=this.g.length+A.g.length,C=[],O=0;O<2*D;O++)C[O]=0;for(O=0;O<this.g.length;O++)for(var M=0;M<A.g.length;M++){var F=this.i(O)>>>16,N=this.i(O)&65535,_i=A.i(M)>>>16,Zi=A.i(M)&65535;C[2*O+2*M]+=N*Zi,b(C,2*O+2*M),C[2*O+2*M+1]+=F*Zi,b(C,2*O+2*M+1),C[2*O+2*M+1]+=N*_i,b(C,2*O+2*M+1),C[2*O+2*M+2]+=F*_i,b(C,2*O+2*M+2)}for(O=0;O<D;O++)C[O]=C[2*O+1]<<16|C[2*O];for(O=D;O<2*D;O++)C[O]=0;return new s(C,0)};function b(A,D){for(;(A[D]&65535)!=A[D];)A[D+1]+=A[D]>>>16,A[D]&=65535,D++}function B(A,D){this.g=A,this.h=D}function x(A,D){if(p(D))throw Error("division by zero");if(p(A))return new B(d,d);if(_(A))return D=x(T(A),D),new B(T(D.g),T(D.h));if(_(D))return D=x(A,T(D)),new B(T(D.g),D.h);if(30<A.g.length){if(_(A)||_(D))throw Error("slowDivide_ only works with positive integers.");for(var C=f,O=D;0>=O.l(A);)C=U(C),O=U(O);var M=$(C,1),F=$(O,1);for(O=$(O,2),C=$(C,2);!p(O);){var N=F.add(O);0>=N.l(A)&&(M=M.add(C),F=N),O=$(O,1),C=$(C,1)}return D=S(A,M.j(D)),new B(M,D)}for(M=d;0<=A.l(D);){for(C=Math.max(1,Math.floor(A.m()/D.m())),O=Math.ceil(Math.log(C)/Math.LN2),O=48>=O?1:Math.pow(2,O-48),F=l(C),N=F.j(D);_(N)||0<N.l(A);)C-=O,F=l(C),N=F.j(D);p(F)&&(F=f),M=M.add(F),A=S(A,N)}return new B(M,A)}n.A=function(A){return x(this,A).h},n.and=function(A){for(var D=Math.max(this.g.length,A.g.length),C=[],O=0;O<D;O++)C[O]=this.i(O)&A.i(O);return new s(C,this.h&A.h)},n.or=function(A){for(var D=Math.max(this.g.length,A.g.length),C=[],O=0;O<D;O++)C[O]=this.i(O)|A.i(O);return new s(C,this.h|A.h)},n.xor=function(A){for(var D=Math.max(this.g.length,A.g.length),C=[],O=0;O<D;O++)C[O]=this.i(O)^A.i(O);return new s(C,this.h^A.h)};function U(A){for(var D=A.g.length+1,C=[],O=0;O<D;O++)C[O]=A.i(O)<<1|A.i(O-1)>>>31;return new s(C,A.h)}function $(A,D){var C=D>>5;D%=32;for(var O=A.g.length-C,M=[],F=0;F<O;F++)M[F]=0<D?A.i(F+C)>>>D|A.i(F+C+1)<<32-D:A.i(F+C);return new s(M,A.h)}t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,Nw=rj.Md5=t,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.A,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=l,s.fromString=u,As=rj.Integer=s}).apply(typeof nj<"u"?nj:typeof self<"u"?self:typeof window<"u"?window:{});var Ev=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ds={};var Ow,Qre,Xd,ww,Rm,_v,bw,Lw,Mw;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(h,m,E){return h==Array.prototype||h==Object.prototype||(h[m]=E.value),h};function r(h){h=[typeof globalThis=="object"&&globalThis,h,typeof window=="object"&&window,typeof self=="object"&&self,typeof Ev=="object"&&Ev];for(var m=0;m<h.length;++m){var E=h[m];if(E&&E.Math==Math)return E}throw Error("Cannot find global object")}var t=r(this);function i(h,m){if(m)e:{var E=t;h=h.split(".");for(var y=0;y<h.length-1;y++){var k=h[y];if(!(k in E))break e;E=E[k]}h=h[h.length-1],y=E[h],m=m(y),m!=y&&m!=null&&e(E,h,{configurable:!0,writable:!0,value:m})}}function o(h,m){h instanceof String&&(h+="");var E=0,y=!1,k={next:function(){if(!y&&E<h.length){var W=E++;return{value:m(W,h[W]),done:!1}}return y=!0,{done:!0,value:void 0}}};return k[Symbol.iterator]=function(){return k},k}i("Array.prototype.values",function(h){return h||function(){return o(this,function(m,E){return E})}});var s=s||{},a=this||self;function c(h){var m=typeof h;return m=m!="object"?m:h?Array.isArray(h)?"array":m:"null",m=="array"||m=="object"&&typeof h.length=="number"}function l(h){var m=typeof h;return m=="object"&&h!=null||m=="function"}function u(h,m,E){return h.call.apply(h.bind,arguments)}function d(h,m,E){if(!h)throw Error();if(2<arguments.length){var y=Array.prototype.slice.call(arguments,2);return function(){var k=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(k,y),h.apply(m,k)}}return function(){return h.apply(m,arguments)}}function f(h,m,E){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:d,f.apply(null,arguments)}function g(h,m){var E=Array.prototype.slice.call(arguments,1);return function(){var y=E.slice();return y.push.apply(y,arguments),h.apply(this,y)}}function p(h,m){function E(){}E.prototype=m.prototype,h.aa=m.prototype,h.prototype=new E,h.prototype.constructor=h,h.Qb=function(y,k,W){for(var re=Array(arguments.length-2),ct=2;ct<arguments.length;ct++)re[ct-2]=arguments[ct];return m.prototype[k].apply(y,re)}}function _(h){let m=h.length;if(0<m){let E=Array(m);for(let y=0;y<m;y++)E[y]=h[y];return E}return[]}function T(h,m){for(let E=1;E<arguments.length;E++){let y=arguments[E];if(c(y)){let k=h.length||0,W=y.length||0;h.length=k+W;for(let re=0;re<W;re++)h[k+re]=y[re]}else h.push(y)}}class S{constructor(m,E){this.i=m,this.j=E,this.h=0,this.g=null}get(){let m;return 0<this.h?(this.h--,m=this.g,this.g=m.next,m.next=null):m=this.i(),m}}function b(h){return/^[\s\xa0]*$/.test(h)}function B(){var h=a.navigator;return h&&(h=h.userAgent)?h:""}function x(h){return x[" "](h),h}x[" "]=function(){};var U=B().indexOf("Gecko")!=-1&&!(B().toLowerCase().indexOf("webkit")!=-1&&B().indexOf("Edge")==-1)&&!(B().indexOf("Trident")!=-1||B().indexOf("MSIE")!=-1)&&B().indexOf("Edge")==-1;function $(h,m,E){for(let y in h)m.call(E,h[y],y,h)}function A(h,m){for(let E in h)m.call(void 0,h[E],E,h)}function D(h){let m={};for(let E in h)m[E]=h[E];return m}let C="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function O(h,m){let E,y;for(let k=1;k<arguments.length;k++){y=arguments[k];for(E in y)h[E]=y[E];for(let W=0;W<C.length;W++)E=C[W],Object.prototype.hasOwnProperty.call(y,E)&&(h[E]=y[E])}}function M(h){var m=1;h=h.split(":");let E=[];for(;0<m&&h.length;)E.push(h.shift()),m--;return h.length&&E.push(h.join(":")),E}function F(h){a.setTimeout(()=>{throw h},0)}function N(){var h=qh;let m=null;return h.g&&(m=h.g,h.g=h.g.next,h.g||(h.h=null),m.next=null),m}class _i{constructor(){this.h=this.g=null}add(m,E){let y=Zi.get();y.set(m,E),this.h?this.h.next=y:this.g=y,this.h=y}}var Zi=new S(()=>new zh,h=>h.reset());class zh{constructor(){this.next=this.g=this.h=null}set(m,E){this.h=m,this.g=E,this.next=null}reset(){this.next=this.g=this.h=null}}let Ls,tc=!1,qh=new _i,Np=()=>{let h=a.Promise.resolve(void 0);Ls=()=>{h.then(Jt)}};var Jt=()=>{for(var h;h=N();){try{h.h.call(h.g)}catch(E){F(E)}var m=Zi;m.j(h),100>m.h&&(m.h++,h.next=m.g,m.g=h)}tc=!1};function wr(){this.s=this.s,this.C=this.C}wr.prototype.s=!1,wr.prototype.ma=function(){this.s||(this.s=!0,this.N())},wr.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function qt(h,m){this.type=h,this.g=this.target=m,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var nu=(function(){if(!a.addEventListener||!Object.defineProperty)return!1;var h=!1,m=Object.defineProperty({},"passive",{get:function(){h=!0}});try{let E=()=>{};a.addEventListener("test",E,m),a.removeEventListener("test",E,m)}catch{}return h})();function nc(h,m){if(qt.call(this,h?h.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,h){var E=this.type=h.type,y=h.changedTouches&&h.changedTouches.length?h.changedTouches[0]:null;if(this.target=h.target||h.srcElement,this.g=m,m=h.relatedTarget){if(U){e:{try{x(m.nodeName);var k=!0;break e}catch{}k=!1}k||(m=null)}}else E=="mouseover"?m=h.fromElement:E=="mouseout"&&(m=h.toElement);this.relatedTarget=m,y?(this.clientX=y.clientX!==void 0?y.clientX:y.pageX,this.clientY=y.clientY!==void 0?y.clientY:y.pageY,this.screenX=y.screenX||0,this.screenY=y.screenY||0):(this.clientX=h.clientX!==void 0?h.clientX:h.pageX,this.clientY=h.clientY!==void 0?h.clientY:h.pageY,this.screenX=h.screenX||0,this.screenY=h.screenY||0),this.button=h.button,this.key=h.key||"",this.ctrlKey=h.ctrlKey,this.altKey=h.altKey,this.shiftKey=h.shiftKey,this.metaKey=h.metaKey,this.pointerId=h.pointerId||0,this.pointerType=typeof h.pointerType=="string"?h.pointerType:Zy[h.pointerType]||"",this.state=h.state,this.i=h,h.defaultPrevented&&nc.aa.h.call(this)}}p(nc,qt);var Zy={2:"touch",3:"pen",4:"mouse"};nc.prototype.h=function(){nc.aa.h.call(this);var h=this.i;h.preventDefault?h.preventDefault():h.returnValue=!1};var rc="closure_listenable_"+(1e6*Math.random()|0),Op=0;function eS(h,m,E,y,k){this.listener=h,this.proxy=null,this.src=m,this.type=E,this.capture=!!y,this.ha=k,this.key=++Op,this.da=this.fa=!1}function ic(h){h.da=!0,h.listener=null,h.proxy=null,h.src=null,h.ha=null}function ft(h){this.src=h,this.g={},this.h=0}ft.prototype.add=function(h,m,E,y,k){var W=h.toString();h=this.g[W],h||(h=this.g[W]=[],this.h++);var re=vt(h,m,y,k);return-1<re?(m=h[re],E||(m.fa=!1)):(m=new eS(m,this.src,W,!!y,k),m.fa=E,h.push(m)),m};function oc(h,m){var E=m.type;if(E in h.g){var y=h.g[E],k=Array.prototype.indexOf.call(y,m,void 0),W;(W=0<=k)&&Array.prototype.splice.call(y,k,1),W&&(ic(m),h.g[E].length==0&&(delete h.g[E],h.h--))}}function vt(h,m,E,y){for(var k=0;k<h.length;++k){var W=h[k];if(!W.da&&W.listener==m&&W.capture==!!E&&W.ha==y)return k}return-1}var sc="closure_lm_"+(1e6*Math.random()|0),yt={};function Ms(h,m,E,y,k){if(y&&y.once)return Kh(h,m,E,y,k);if(Array.isArray(m)){for(var W=0;W<m.length;W++)Ms(h,m[W],E,y,k);return null}return E=cc(E),h&&h[rc]?h.K(m,E,l(y)?!!y.capture:!!y,k):ac(h,m,E,!1,y,k)}function ac(h,m,E,y,k,W){if(!m)throw Error("Invalid event type");var re=l(k)?!!k.capture:!!k,ct=qo(h);if(ct||(h[sc]=ct=new ft(h)),E=ct.add(m,E,y,re,W),E.proxy)return E;if(y=eo(),E.proxy=y,y.src=h,y.listener=E,h.addEventListener)nu||(k=re),k===void 0&&(k=!1),h.addEventListener(m.toString(),y,k);else if(h.attachEvent)h.attachEvent(Yh(m.toString()),y);else if(h.addListener&&h.removeListener)h.addListener(y);else throw Error("addEventListener and attachEvent are unavailable.");return E}function eo(){function h(E){return m.call(h.src,h.listener,E)}let m=to;return h}function Kh(h,m,E,y,k){if(Array.isArray(m)){for(var W=0;W<m.length;W++)Kh(h,m[W],E,y,k);return null}return E=cc(E),h&&h[rc]?h.L(m,E,l(y)?!!y.capture:!!y,k):ac(h,m,E,!0,y,k)}function ru(h,m,E,y,k){if(Array.isArray(m))for(var W=0;W<m.length;W++)ru(h,m[W],E,y,k);else y=l(y)?!!y.capture:!!y,E=cc(E),h&&h[rc]?(h=h.i,m=String(m).toString(),m in h.g&&(W=h.g[m],E=vt(W,E,y,k),-1<E&&(ic(W[E]),Array.prototype.splice.call(W,E,1),W.length==0&&(delete h.g[m],h.h--)))):h&&(h=qo(h))&&(m=h.g[m.toString()],h=-1,m&&(h=vt(m,E,y,k)),(E=-1<h?m[h]:null)&&iu(E))}function iu(h){if(typeof h!="number"&&h&&!h.da){var m=h.src;if(m&&m[rc])oc(m.i,h);else{var E=h.type,y=h.proxy;m.removeEventListener?m.removeEventListener(E,y,h.capture):m.detachEvent?m.detachEvent(Yh(E),y):m.addListener&&m.removeListener&&m.removeListener(y),(E=qo(m))?(oc(E,h),E.h==0&&(E.src=null,m[sc]=null)):ic(h)}}}function Yh(h){return h in yt?yt[h]:yt[h]="on"+h}function to(h,m){if(h.da)h=!0;else{m=new nc(m,this);var E=h.listener,y=h.ha||h.src;h.fa&&iu(h),h=E.call(y,m)}return h}function qo(h){return h=h[sc],h instanceof ft?h:null}var Ti="__closure_events_fn_"+(1e9*Math.random()>>>0);function cc(h){return typeof h=="function"?h:(h[Ti]||(h[Ti]=function(m){return h.handleEvent(m)}),h[Ti])}function Zt(){wr.call(this),this.i=new ft(this),this.M=this,this.F=null}p(Zt,wr),Zt.prototype[rc]=!0,Zt.prototype.removeEventListener=function(h,m,E,y){ru(this,h,m,E,y)};function Bt(h,m){var E,y=h.F;if(y)for(E=[];y;y=y.F)E.push(y);if(h=h.M,y=m.type||m,typeof m=="string")m=new qt(m,h);else if(m instanceof qt)m.target=m.target||h;else{var k=m;m=new qt(y,h),O(m,k)}if(k=!0,E)for(var W=E.length-1;0<=W;W--){var re=m.g=E[W];k=Ko(re,y,!0,m)&&k}if(re=m.g=h,k=Ko(re,y,!0,m)&&k,k=Ko(re,y,!1,m)&&k,E)for(W=0;W<E.length;W++)re=m.g=E[W],k=Ko(re,y,!1,m)&&k}Zt.prototype.N=function(){if(Zt.aa.N.call(this),this.i){var h=this.i,m;for(m in h.g){for(var E=h.g[m],y=0;y<E.length;y++)ic(E[y]);delete h.g[m],h.h--}}this.F=null},Zt.prototype.K=function(h,m,E,y){return this.i.add(String(h),m,!1,E,y)},Zt.prototype.L=function(h,m,E,y){return this.i.add(String(h),m,!0,E,y)};function Ko(h,m,E,y){if(m=h.i.g[String(m)],!m)return!0;m=m.concat();for(var k=!0,W=0;W<m.length;++W){var re=m[W];if(re&&!re.da&&re.capture==E){var ct=re.listener,Mn=re.ha||re.src;re.fa&&oc(h.i,re),k=ct.call(Mn,y)!==!1&&k}}return k&&!y.defaultPrevented}function lc(h,m,E){if(typeof h=="function")E&&(h=f(h,E));else if(h&&typeof h.handleEvent=="function")h=f(h.handleEvent,h);else throw Error("Invalid listener argument");return 2147483647<Number(m)?-1:a.setTimeout(h,m||0)}function Qh(h){h.g=lc(()=>{h.g=null,h.i&&(h.i=!1,Qh(h))},h.l);let m=h.h;h.h=null,h.m.apply(null,m)}class wp extends wr{constructor(m,E){super(),this.m=m,this.l=E,this.h=null,this.i=!1,this.g=null}j(m){this.h=arguments,this.g?this.i=!0:Qh(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Ps(h){wr.call(this),this.h=h,this.g={}}p(Ps,wr);var ou=[];function su(h){$(h.g,function(m,E){this.g.hasOwnProperty(E)&&iu(m)},h),h.g={}}Ps.prototype.N=function(){Ps.aa.N.call(this),su(this)},Ps.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var no=a.JSON.stringify,Xr=a.JSON.parse,Xh=class{stringify(h){return a.JSON.stringify(h,void 0)}parse(h){return a.JSON.parse(h,void 0)}};function au(){}au.prototype.h=null;function Jh(h){return h.h||(h.h=h.i())}function cu(){}var xs={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Fs(){qt.call(this,"d")}p(Fs,qt);function ks(){qt.call(this,"c")}p(ks,qt);var Sn={},Yo=null;function Us(){return Yo=Yo||new Zt}Sn.La="serverreachability";function lu(h){qt.call(this,Sn.La,h)}p(lu,qt);function uc(h){let m=Us();Bt(m,new lu(m))}Sn.STAT_EVENT="statevent";function uu(h,m){qt.call(this,Sn.STAT_EVENT,h),this.stat=m}p(uu,qt);function dn(h){let m=Us();Bt(m,new uu(m,h))}Sn.Ma="timingevent";function bp(h,m){qt.call(this,Sn.Ma,h),this.size=m}p(bp,qt);function Ii(h,m){if(typeof h!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){h()},m)}function dc(){this.g=!0}dc.prototype.xa=function(){this.g=!1};function tS(h,m,E,y,k,W){h.info(function(){if(h.g)if(W)for(var re="",ct=W.split("&"),Mn=0;Mn<ct.length;Mn++){var ze=ct[Mn].split("=");if(1<ze.length){var $n=ze[0];ze=ze[1];var jn=$n.split("_");re=2<=jn.length&&jn[1]=="type"?re+($n+"="+ze+"&"):re+($n+"=redacted&")}}else re=null;else re=W;return"XMLHTTP REQ ("+y+") [attempt "+k+"]: "+m+`
147
+ `+E+`
148
+ `+re})}function Rt(h,m,E,y,k,W,re){h.info(function(){return"XMLHTTP RESP ("+y+") [ attempt "+k+"]: "+m+`
149
+ `+E+`
150
+ `+W+" "+re})}function br(h,m,E,y){h.info(function(){return"XMLHTTP TEXT ("+m+"): "+Lp(h,E)+(y?" "+y:"")})}function nS(h,m){h.info(function(){return"TIMEOUT: "+m})}dc.prototype.info=function(){};function Lp(h,m){if(!h.g)return m;if(!m)return null;try{var E=JSON.parse(m);if(E){for(h=0;h<E.length;h++)if(Array.isArray(E[h])){var y=E[h];if(!(2>y.length)){var k=y[1];if(Array.isArray(k)&&!(1>k.length)){var W=k[0];if(W!="noop"&&W!="stop"&&W!="close")for(var re=1;re<k.length;re++)k[re]=""}}}}return no(E)}catch{return m}}var Vs={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Zh={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},du;function hu(){}p(hu,au),hu.prototype.g=function(){return new XMLHttpRequest},hu.prototype.i=function(){return{}},du=new hu;function en(h,m,E,y){this.j=h,this.i=m,this.l=E,this.R=y||1,this.U=new Ps(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new ef}function ef(){this.i=null,this.g="",this.h=!1}var ro={},tf={};function nf(h,m,E){h.L=1,h.v=Mp(Ye(m)),h.m=E,h.P=!0,rf(h,null)}function rf(h,m){h.F=Date.now(),Qo(h),h.A=Ye(h.v);var E=h.A,y=h.R;Array.isArray(y)||(y=[String(y)]),jM(E.i,"t",y),h.C=0,E=h.j.J,h.h=new ef,h.g=aP(h.j,E?m:null,!h.m),0<h.O&&(h.M=new wp(f(h.Y,h,h.g),h.O)),m=h.U,E=h.g,y=h.ca;var k="readystatechange";Array.isArray(k)||(k&&(ou[0]=k.toString()),k=ou);for(var W=0;W<k.length;W++){var re=Ms(E,k[W],y||m.handleEvent,!1,m.h||m);if(!re)break;m.g[re.key]=re}m=h.H?D(h.H):{},h.m?(h.u||(h.u="POST"),m["Content-Type"]="application/x-www-form-urlencoded",h.g.ea(h.A,h.u,h.m,m)):(h.u="GET",h.g.ea(h.A,h.u,null,m)),uc(),tS(h.i,h.u,h.A,h.l,h.R,h.m)}en.prototype.ca=function(h){h=h.target;let m=this.M;m&&Zo(h)==3?m.j():this.Y(h)},en.prototype.Y=function(h){try{if(h==this.g)e:{let jn=Zo(this.g);var m=this.g.Ba();let pu=this.g.Z();if(!(3>jn)&&(jn!=3||this.g&&(this.h.h||this.g.oa()||QM(this.g)))){this.J||jn!=4||m==7||(m==8||0>=pu?uc(3):uc(2)),Jo(this);var E=this.g.Z();this.X=E;t:if(of(this)){var y=QM(this.g);h="";var k=y.length,W=Zo(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){io(this),rr(this);var re="";break t}this.h.i=new a.TextDecoder}for(m=0;m<k;m++)this.h.h=!0,h+=this.h.i.decode(y[m],{stream:!(W&&m==k-1)});y.length=0,this.h.g+=h,this.C=0,re=this.h.g}else re=this.g.oa();if(this.o=E==200,Rt(this.i,this.u,this.A,this.l,this.R,jn,E),this.o){if(this.T&&!this.K){t:{if(this.g){var ct,Mn=this.g;if((ct=Mn.g?Mn.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!b(ct)){var ze=ct;break t}}ze=null}if(E=ze)br(this.i,this.l,E,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,fu(this,E);else{this.o=!1,this.s=3,dn(12),io(this),rr(this);break e}}if(this.P){E=!0;let vi;for(;!this.J&&this.C<re.length;)if(vi=sf(this,re),vi==tf){jn==4&&(this.s=4,dn(14),E=!1),br(this.i,this.l,null,"[Incomplete Response]");break}else if(vi==ro){this.s=4,dn(15),br(this.i,this.l,re,"[Invalid Chunk]"),E=!1;break}else br(this.i,this.l,vi,null),fu(this,vi);if(of(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),jn!=4||re.length!=0||this.h.h||(this.s=1,dn(16),E=!1),this.o=this.o&&E,!E)br(this.i,this.l,re,"[Invalid Chunked Response]"),io(this),rr(this);else if(0<re.length&&!this.W){this.W=!0;var $n=this.j;$n.g==this&&$n.ba&&!$n.M&&($n.j.info("Great, no buffering proxy detected. Bytes received: "+re.length),aS($n),$n.M=!0,dn(11))}}else br(this.i,this.l,re,null),fu(this,re);jn==4&&io(this),this.o&&!this.J&&(jn==4?rP(this.j,this):(this.o=!1,Qo(this)))}else hz(this.g),E==400&&0<re.indexOf("Unknown SID")?(this.s=3,dn(12)):(this.s=0,dn(13)),io(this),rr(this)}}}catch{}};function of(h){return h.g?h.u=="GET"&&h.L!=2&&h.j.Ca:!1}function sf(h,m){var E=h.C,y=m.indexOf(`
151
+ `,E);return y==-1?tf:(E=Number(m.substring(E,y)),isNaN(E)?ro:(y+=1,y+E>m.length?tf:(m=m.slice(y,y+E),h.C=y+E,m)))}en.prototype.cancel=function(){this.J=!0,io(this)};function Qo(h){h.S=Date.now()+h.I,Xo(h,h.I)}function Xo(h,m){if(h.B!=null)throw Error("WatchDog timer not null");h.B=Ii(f(h.ba,h),m)}function Jo(h){h.B&&(a.clearTimeout(h.B),h.B=null)}en.prototype.ba=function(){this.B=null;let h=Date.now();0<=h-this.S?(nS(this.i,this.A),this.L!=2&&(uc(),dn(17)),io(this),this.s=2,rr(this)):Xo(this,this.S-h)};function rr(h){h.j.G==0||h.J||rP(h.j,h)}function io(h){Jo(h);var m=h.M;m&&typeof m.ma=="function"&&m.ma(),h.M=null,su(h.U),h.g&&(m=h.g,h.g=null,m.abort(),m.ma())}function fu(h,m){try{var E=h.j;if(E.G!=0&&(E.g==h||fc(E.h,h))){if(!h.K&&fc(E.h,h)&&E.G==3){try{var y=E.Da.g.parse(m)}catch{y=null}if(Array.isArray(y)&&y.length==3){var k=y;if(k[0]==0){e:if(!E.u){if(E.g)if(E.g.F+3e3<h.F)Up(E),Fp(E);else break e;sS(E),dn(18)}}else E.za=k[1],0<E.za-E.T&&37500>k[2]&&E.F&&E.v==0&&!E.C&&(E.C=Ii(f(E.Za,E),6e3));if(1>=hc(E.h)&&E.ca){try{E.ca()}catch{}E.ca=void 0}}else gc(E,11)}else if((h.K||E.g==h)&&Up(E),!b(m))for(k=E.Da.g.parse(m),m=0;m<k.length;m++){let ze=k[m];if(E.T=ze[0],ze=ze[1],E.G==2)if(ze[0]=="c"){E.K=ze[1],E.ia=ze[2];let $n=ze[3];$n!=null&&(E.la=$n,E.j.info("VER="+E.la));let jn=ze[4];jn!=null&&(E.Aa=jn,E.j.info("SVER="+E.Aa));let pu=ze[5];pu!=null&&typeof pu=="number"&&0<pu&&(y=1.5*pu,E.L=y,E.j.info("backChannelRequestTimeoutMs_="+y)),y=E;let vi=h.g;if(vi){let Bp=vi.g?vi.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Bp){var W=y.h;W.g||Bp.indexOf("spdy")==-1&&Bp.indexOf("quic")==-1&&Bp.indexOf("h2")==-1||(W.j=W.l,W.g=new Set,W.h&&(se(W,W.h),W.h=null))}if(y.D){let cS=vi.g?vi.g.getResponseHeader("X-HTTP-Session-Id"):null;cS&&(y.ya=cS,rt(y.I,y.D,cS))}}E.G=3,E.l&&E.l.ua(),E.ba&&(E.R=Date.now()-h.F,E.j.info("Handshake RTT: "+E.R+"ms")),y=E;var re=h;if(y.qa=sP(y,y.J?y.ia:null,y.W),re.K){R(y.h,re);var ct=re,Mn=y.L;Mn&&(ct.I=Mn),ct.B&&(Jo(ct),Qo(ct)),y.g=re}else tP(y);0<E.i.length&&kp(E)}else ze[0]!="stop"&&ze[0]!="close"||gc(E,7);else E.G==3&&(ze[0]=="stop"||ze[0]=="close"?ze[0]=="stop"?gc(E,7):oS(E):ze[0]!="noop"&&E.l&&E.l.ta(ze),E.v=0)}}uc(4)}catch{}}var rS=class{constructor(h,m){this.g=h,this.map=m}};function af(h){this.l=h||10,a.PerformanceNavigationTiming?(h=a.performance.getEntriesByType("navigation"),h=0<h.length&&(h[0].nextHopProtocol=="hq"||h[0].nextHopProtocol=="h2")):h=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=h?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function cf(h){return h.h?!0:h.g?h.g.size>=h.j:!1}function hc(h){return h.h?1:h.g?h.g.size:0}function fc(h,m){return h.h?h.h==m:h.g?h.g.has(m):!1}function se(h,m){h.g?h.g.add(m):h.h=m}function R(h,m){h.h&&h.h==m?h.h=null:h.g&&h.g.has(m)&&h.g.delete(m)}af.prototype.cancel=function(){if(this.i=z(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let h of this.g.values())h.cancel();this.g.clear()}};function z(h){if(h.h!=null)return h.i.concat(h.h.D);if(h.g!=null&&h.g.size!==0){let m=h.i;for(let E of h.g.values())m=m.concat(E.D);return m}return _(h.i)}function te(h){if(h.V&&typeof h.V=="function")return h.V();if(typeof Map<"u"&&h instanceof Map||typeof Set<"u"&&h instanceof Set)return Array.from(h.values());if(typeof h=="string")return h.split("");if(c(h)){for(var m=[],E=h.length,y=0;y<E;y++)m.push(h[y]);return m}m=[],E=0;for(y in h)m[E++]=h[y];return m}function Ie(h){if(h.na&&typeof h.na=="function")return h.na();if(!h.V||typeof h.V!="function"){if(typeof Map<"u"&&h instanceof Map)return Array.from(h.keys());if(!(typeof Set<"u"&&h instanceof Set)){if(c(h)||typeof h=="string"){var m=[];h=h.length;for(var E=0;E<h;E++)m.push(E);return m}m=[],E=0;for(let y in h)m[E++]=y;return m}}}function Re(h,m){if(h.forEach&&typeof h.forEach=="function")h.forEach(m,void 0);else if(c(h)||typeof h=="string")Array.prototype.forEach.call(h,m,void 0);else for(var E=Ie(h),y=te(h),k=y.length,W=0;W<k;W++)m.call(void 0,y[W],E&&E[W],h)}var Ce=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Kt(h,m){if(h){h=h.split("&");for(var E=0;E<h.length;E++){var y=h[E].indexOf("="),k=null;if(0<=y){var W=h[E].substring(0,y);k=h[E].substring(y+1)}else W=h[E];m(W,k?decodeURIComponent(k.replace(/\+/g," ")):"")}}}function je(h){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,h instanceof je){this.h=h.h,Lr(this,h.j),this.o=h.o,this.g=h.g,xt(this,h.s),this.l=h.l;var m=h.i,E=new hf;E.i=m.i,m.g&&(E.g=new Map(m.g),E.h=m.h),lf(this,E),this.m=h.m}else h&&(m=String(h).match(Ce))?(this.h=!1,Lr(this,m[1]||"",!0),this.o=uf(m[2]||""),this.g=uf(m[3]||"",!0),xt(this,m[4]),this.l=uf(m[5]||"",!0),lf(this,m[6]||"",!0),this.m=uf(m[7]||"")):(this.h=!1,this.i=new hf(null,this.h))}je.prototype.toString=function(){var h=[],m=this.j;m&&h.push(df(m,BM,!0),":");var E=this.g;return(E||m=="file")&&(h.push("//"),(m=this.o)&&h.push(df(m,BM,!0),"@"),h.push(encodeURIComponent(String(E)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),E=this.s,E!=null&&h.push(":",String(E))),(E=this.l)&&(this.g&&E.charAt(0)!="/"&&h.push("/"),h.push(df(E,E.charAt(0)=="/"?nz:tz,!0))),(E=this.i.toString())&&h.push("?",E),(E=this.m)&&h.push("#",df(E,iz)),h.join("")};function Ye(h){return new je(h)}function Lr(h,m,E){h.j=E?uf(m,!0):m,h.j&&(h.j=h.j.replace(/:$/,""))}function xt(h,m){if(m){if(m=Number(m),isNaN(m)||0>m)throw Error("Bad port number "+m);h.s=m}else h.s=null}function lf(h,m,E){m instanceof hf?(h.i=m,oz(h.i,h.h)):(E||(m=df(m,rz)),h.i=new hf(m,h.h))}function rt(h,m,E){h.i.set(m,E)}function Mp(h){return rt(h,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),h}function uf(h,m){return h?m?decodeURI(h.replace(/%25/g,"%2525")):decodeURIComponent(h):""}function df(h,m,E){return typeof h=="string"?(h=encodeURI(h).replace(m,ez),E&&(h=h.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h):null}function ez(h){return h=h.charCodeAt(0),"%"+(h>>4&15).toString(16)+(h&15).toString(16)}var BM=/[#\/\?@]/g,tz=/[#\?:]/g,nz=/[#\?]/g,rz=/[#\?@]/g,iz=/#/g;function hf(h,m){this.h=this.g=null,this.i=h||null,this.j=!!m}function Bs(h){h.g||(h.g=new Map,h.h=0,h.i&&Kt(h.i,function(m,E){h.add(decodeURIComponent(m.replace(/\+/g," ")),E)}))}n=hf.prototype,n.add=function(h,m){Bs(this),this.i=null,h=gu(this,h);var E=this.g.get(h);return E||this.g.set(h,E=[]),E.push(m),this.h+=1,this};function GM(h,m){Bs(h),m=gu(h,m),h.g.has(m)&&(h.i=null,h.h-=h.g.get(m).length,h.g.delete(m))}function $M(h,m){return Bs(h),m=gu(h,m),h.g.has(m)}n.forEach=function(h,m){Bs(this),this.g.forEach(function(E,y){E.forEach(function(k){h.call(m,k,y,this)},this)},this)},n.na=function(){Bs(this);let h=Array.from(this.g.values()),m=Array.from(this.g.keys()),E=[];for(let y=0;y<m.length;y++){let k=h[y];for(let W=0;W<k.length;W++)E.push(m[y])}return E},n.V=function(h){Bs(this);let m=[];if(typeof h=="string")$M(this,h)&&(m=m.concat(this.g.get(gu(this,h))));else{h=Array.from(this.g.values());for(let E=0;E<h.length;E++)m=m.concat(h[E])}return m},n.set=function(h,m){return Bs(this),this.i=null,h=gu(this,h),$M(this,h)&&(this.h-=this.g.get(h).length),this.g.set(h,[m]),this.h+=1,this},n.get=function(h,m){return h?(h=this.V(h),0<h.length?String(h[0]):m):m};function jM(h,m,E){GM(h,m),0<E.length&&(h.i=null,h.g.set(gu(h,m),_(E)),h.h+=E.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let h=[],m=Array.from(this.g.keys());for(var E=0;E<m.length;E++){var y=m[E];let W=encodeURIComponent(String(y)),re=this.V(y);for(y=0;y<re.length;y++){var k=W;re[y]!==""&&(k+="="+encodeURIComponent(String(re[y]))),h.push(k)}}return this.i=h.join("&")};function gu(h,m){return m=String(m),h.j&&(m=m.toLowerCase()),m}function oz(h,m){m&&!h.j&&(Bs(h),h.i=null,h.g.forEach(function(E,y){var k=y.toLowerCase();y!=k&&(GM(this,y),jM(this,k,E))},h)),h.j=m}function sz(h,m){let E=new dc;if(a.Image){let y=new Image;y.onload=g(Gs,E,"TestLoadImage: loaded",!0,m,y),y.onerror=g(Gs,E,"TestLoadImage: error",!1,m,y),y.onabort=g(Gs,E,"TestLoadImage: abort",!1,m,y),y.ontimeout=g(Gs,E,"TestLoadImage: timeout",!1,m,y),a.setTimeout(function(){y.ontimeout&&y.ontimeout()},1e4),y.src=h}else m(!1)}function az(h,m){let E=new dc,y=new AbortController,k=setTimeout(()=>{y.abort(),Gs(E,"TestPingServer: timeout",!1,m)},1e4);fetch(h,{signal:y.signal}).then(W=>{clearTimeout(k),W.ok?Gs(E,"TestPingServer: ok",!0,m):Gs(E,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(k),Gs(E,"TestPingServer: error",!1,m)})}function Gs(h,m,E,y,k){try{k&&(k.onload=null,k.onerror=null,k.onabort=null,k.ontimeout=null),y(E)}catch{}}function cz(){this.g=new Xh}function lz(h,m,E){let y=E||"";try{Re(h,function(k,W){let re=k;l(k)&&(re=no(k)),m.push(y+W+"="+encodeURIComponent(re))})}catch(k){throw m.push(y+"type="+encodeURIComponent("_badmap")),k}}function ff(h){this.l=h.Ub||null,this.j=h.eb||!1}p(ff,au),ff.prototype.g=function(){return new Pp(this.l,this.j)},ff.prototype.i=(function(h){return function(){return h}})({});function Pp(h,m){Zt.call(this),this.D=h,this.o=m,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}p(Pp,Zt),n=Pp.prototype,n.open=function(h,m){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=h,this.A=m,this.readyState=1,mf(this)},n.send=function(h){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let m={headers:this.u,method:this.B,credentials:this.m,cache:void 0};h&&(m.body=h),(this.D||a).fetch(new Request(this.A,m)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,gf(this)),this.readyState=0},n.Sa=function(h){if(this.g&&(this.l=h,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=h.headers,this.readyState=2,mf(this)),this.g&&(this.readyState=3,mf(this),this.g)))if(this.responseType==="arraybuffer")h.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in h){if(this.j=h.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;HM(this)}else h.text().then(this.Ra.bind(this),this.ga.bind(this))};function HM(h){h.j.read().then(h.Pa.bind(h)).catch(h.ga.bind(h))}n.Pa=function(h){if(this.g){if(this.o&&h.value)this.response.push(h.value);else if(!this.o){var m=h.value?h.value:new Uint8Array(0);(m=this.v.decode(m,{stream:!h.done}))&&(this.response=this.responseText+=m)}h.done?gf(this):mf(this),this.readyState==3&&HM(this)}},n.Ra=function(h){this.g&&(this.response=this.responseText=h,gf(this))},n.Qa=function(h){this.g&&(this.response=h,gf(this))},n.ga=function(){this.g&&gf(this)};function gf(h){h.readyState=4,h.l=null,h.j=null,h.v=null,mf(h)}n.setRequestHeader=function(h,m){this.u.append(h,m)},n.getResponseHeader=function(h){return this.h&&this.h.get(h.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let h=[],m=this.h.entries();for(var E=m.next();!E.done;)E=E.value,h.push(E[0]+": "+E[1]),E=m.next();return h.join(`\r
152
+ `)};function mf(h){h.onreadystatechange&&h.onreadystatechange.call(h)}Object.defineProperty(Pp.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(h){this.m=h?"include":"same-origin"}});function WM(h){let m="";return $(h,function(E,y){m+=y,m+=":",m+=E,m+=`\r
153
+ `}),m}function iS(h,m,E){e:{for(y in E){var y=!1;break e}y=!0}y||(E=WM(E),typeof h=="string"?E!=null&&encodeURIComponent(String(E)):rt(h,m,E))}function Gt(h){Zt.call(this),this.headers=new Map,this.o=h||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}p(Gt,Zt);var uz=/^https?$/i,dz=["POST","PUT"];n=Gt.prototype,n.Ha=function(h){this.J=h},n.ea=function(h,m,E,y){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+h);m=m?m.toUpperCase():"GET",this.D=h,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():du.g(),this.v=this.o?Jh(this.o):Jh(du),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(m,String(h),!0),this.B=!1}catch(W){zM(this,W);return}if(h=E||"",E=new Map(this.headers),y)if(Object.getPrototypeOf(y)===Object.prototype)for(var k in y)E.set(k,y[k]);else if(typeof y.keys=="function"&&typeof y.get=="function")for(let W of y.keys())E.set(W,y.get(W));else throw Error("Unknown input type for opt_headers: "+String(y));y=Array.from(E.keys()).find(W=>W.toLowerCase()=="content-type"),k=a.FormData&&h instanceof a.FormData,!(0<=Array.prototype.indexOf.call(dz,m,void 0))||y||k||E.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[W,re]of E)this.g.setRequestHeader(W,re);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{YM(this),this.u=!0,this.g.send(h),this.u=!1}catch(W){zM(this,W)}};function zM(h,m){h.h=!1,h.g&&(h.j=!0,h.g.abort(),h.j=!1),h.l=m,h.m=5,qM(h),xp(h)}function qM(h){h.A||(h.A=!0,Bt(h,"complete"),Bt(h,"error"))}n.abort=function(h){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=h||7,Bt(this,"complete"),Bt(this,"abort"),xp(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),xp(this,!0)),Gt.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?KM(this):this.bb())},n.bb=function(){KM(this)};function KM(h){if(h.h&&typeof s<"u"&&(!h.v[1]||Zo(h)!=4||h.Z()!=2)){if(h.u&&Zo(h)==4)lc(h.Ea,0,h);else if(Bt(h,"readystatechange"),Zo(h)==4){h.h=!1;try{let re=h.Z();e:switch(re){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var m=!0;break e;default:m=!1}var E;if(!(E=m)){var y;if(y=re===0){var k=String(h.D).match(Ce)[1]||null;!k&&a.self&&a.self.location&&(k=a.self.location.protocol.slice(0,-1)),y=!uz.test(k?k.toLowerCase():"")}E=y}if(E)Bt(h,"complete"),Bt(h,"success");else{h.m=6;try{var W=2<Zo(h)?h.g.statusText:""}catch{W=""}h.l=W+" ["+h.Z()+"]",qM(h)}}finally{xp(h)}}}}function xp(h,m){if(h.g){YM(h);let E=h.g,y=h.v[0]?()=>{}:null;h.g=null,h.v=null,m||Bt(h,"ready");try{E.onreadystatechange=y}catch{}}}function YM(h){h.I&&(a.clearTimeout(h.I),h.I=null)}n.isActive=function(){return!!this.g};function Zo(h){return h.g?h.g.readyState:0}n.Z=function(){try{return 2<Zo(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(h){if(this.g){var m=this.g.responseText;return h&&m.indexOf(h)==0&&(m=m.substring(h.length)),Xr(m)}};function QM(h){try{if(!h.g)return null;if("response"in h.g)return h.g.response;switch(h.H){case"":case"text":return h.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in h.g)return h.g.mozResponseArrayBuffer}return null}catch{return null}}function hz(h){let m={};h=(h.g&&2<=Zo(h)&&h.g.getAllResponseHeaders()||"").split(`\r
154
+ `);for(let y=0;y<h.length;y++){if(b(h[y]))continue;var E=M(h[y]);let k=E[0];if(E=E[1],typeof E!="string")continue;E=E.trim();let W=m[k]||[];m[k]=W,W.push(E)}A(m,function(y){return y.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function pf(h,m,E){return E&&E.internalChannelParams&&E.internalChannelParams[h]||m}function XM(h){this.Aa=0,this.i=[],this.j=new dc,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=pf("failFast",!1,h),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=pf("baseRetryDelayMs",5e3,h),this.cb=pf("retryDelaySeedMs",1e4,h),this.Wa=pf("forwardChannelMaxRetries",2,h),this.wa=pf("forwardChannelRequestTimeoutMs",2e4,h),this.pa=h&&h.xmlHttpFactory||void 0,this.Xa=h&&h.Tb||void 0,this.Ca=h&&h.useFetchStreams||!1,this.L=void 0,this.J=h&&h.supportsCrossDomainXhr||!1,this.K="",this.h=new af(h&&h.concurrentRequestLimit),this.Da=new cz,this.P=h&&h.fastHandshake||!1,this.O=h&&h.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=h&&h.Rb||!1,h&&h.xa&&this.j.xa(),h&&h.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&h&&h.detectBufferingProxy||!1,this.ja=void 0,h&&h.longPollingTimeout&&0<h.longPollingTimeout&&(this.ja=h.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=XM.prototype,n.la=8,n.G=1,n.connect=function(h,m,E,y){dn(0),this.W=h,this.H=m||{},E&&y!==void 0&&(this.H.OSID=E,this.H.OAID=y),this.F=this.X,this.I=sP(this,null,this.W),kp(this)};function oS(h){if(JM(h),h.G==3){var m=h.U++,E=Ye(h.I);if(rt(E,"SID",h.K),rt(E,"RID",m),rt(E,"TYPE","terminate"),Ef(h,E),m=new en(h,h.j,m),m.L=2,m.v=Mp(Ye(E)),E=!1,a.navigator&&a.navigator.sendBeacon)try{E=a.navigator.sendBeacon(m.v.toString(),"")}catch{}!E&&a.Image&&(new Image().src=m.v,E=!0),E||(m.g=aP(m.j,null),m.g.ea(m.v)),m.F=Date.now(),Qo(m)}oP(h)}function Fp(h){h.g&&(aS(h),h.g.cancel(),h.g=null)}function JM(h){Fp(h),h.u&&(a.clearTimeout(h.u),h.u=null),Up(h),h.h.cancel(),h.s&&(typeof h.s=="number"&&a.clearTimeout(h.s),h.s=null)}function kp(h){if(!cf(h.h)&&!h.s){h.s=!0;var m=h.Ga;Ls||Np(),tc||(Ls(),tc=!0),qh.add(m,h),h.B=0}}function fz(h,m){return hc(h.h)>=h.h.j-(h.s?1:0)?!1:h.s?(h.i=m.D.concat(h.i),!0):h.G==1||h.G==2||h.B>=(h.Va?0:h.Wa)?!1:(h.s=Ii(f(h.Ga,h,m),iP(h,h.B)),h.B++,!0)}n.Ga=function(h){if(this.s)if(this.s=null,this.G==1){if(!h){this.U=Math.floor(1e5*Math.random()),h=this.U++;let k=new en(this,this.j,h),W=this.o;if(this.S&&(W?(W=D(W),O(W,this.S)):W=this.S),this.m!==null||this.O||(k.H=W,W=null),this.P)e:{for(var m=0,E=0;E<this.i.length;E++){t:{var y=this.i[E];if("__data__"in y.map&&(y=y.map.__data__,typeof y=="string")){y=y.length;break t}y=void 0}if(y===void 0)break;if(m+=y,4096<m){m=E;break e}if(m===4096||E===this.i.length-1){m=E+1;break e}}m=1e3}else m=1e3;m=eP(this,k,m),E=Ye(this.I),rt(E,"RID",h),rt(E,"CVER",22),this.D&&rt(E,"X-HTTP-Session-Id",this.D),Ef(this,E),W&&(this.O?m="headers="+encodeURIComponent(String(WM(W)))+"&"+m:this.m&&iS(E,this.m,W)),se(this.h,k),this.Ua&&rt(E,"TYPE","init"),this.P?(rt(E,"$req",m),rt(E,"SID","null"),k.T=!0,nf(k,E,null)):nf(k,E,m),this.G=2}}else this.G==3&&(h?ZM(this,h):this.i.length==0||cf(this.h)||ZM(this))};function ZM(h,m){var E;m?E=m.l:E=h.U++;let y=Ye(h.I);rt(y,"SID",h.K),rt(y,"RID",E),rt(y,"AID",h.T),Ef(h,y),h.m&&h.o&&iS(y,h.m,h.o),E=new en(h,h.j,E,h.B+1),h.m===null&&(E.H=h.o),m&&(h.i=m.D.concat(h.i)),m=eP(h,E,1e3),E.I=Math.round(.5*h.wa)+Math.round(.5*h.wa*Math.random()),se(h.h,E),nf(E,y,m)}function Ef(h,m){h.H&&$(h.H,function(E,y){rt(m,y,E)}),h.l&&Re({},function(E,y){rt(m,y,E)})}function eP(h,m,E){E=Math.min(h.i.length,E);var y=h.l?f(h.l.Na,h.l,h):null;e:{var k=h.i;let W=-1;for(;;){let re=["count="+E];W==-1?0<E?(W=k[0].g,re.push("ofs="+W)):W=0:re.push("ofs="+W);let ct=!0;for(let Mn=0;Mn<E;Mn++){let ze=k[Mn].g,$n=k[Mn].map;if(ze-=W,0>ze)W=Math.max(0,k[Mn].g-100),ct=!1;else try{lz($n,re,"req"+ze+"_")}catch{y&&y($n)}}if(ct){y=re.join("&");break e}}}return h=h.i.splice(0,E),m.D=h,y}function tP(h){if(!h.g&&!h.u){h.Y=1;var m=h.Fa;Ls||Np(),tc||(Ls(),tc=!0),qh.add(m,h),h.v=0}}function sS(h){return h.g||h.u||3<=h.v?!1:(h.Y++,h.u=Ii(f(h.Fa,h),iP(h,h.v)),h.v++,!0)}n.Fa=function(){if(this.u=null,nP(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var h=2*this.R;this.j.info("BP detection timer enabled: "+h),this.A=Ii(f(this.ab,this),h)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,dn(10),Fp(this),nP(this))};function aS(h){h.A!=null&&(a.clearTimeout(h.A),h.A=null)}function nP(h){h.g=new en(h,h.j,"rpc",h.Y),h.m===null&&(h.g.H=h.o),h.g.O=0;var m=Ye(h.qa);rt(m,"RID","rpc"),rt(m,"SID",h.K),rt(m,"AID",h.T),rt(m,"CI",h.F?"0":"1"),!h.F&&h.ja&&rt(m,"TO",h.ja),rt(m,"TYPE","xmlhttp"),Ef(h,m),h.m&&h.o&&iS(m,h.m,h.o),h.L&&(h.g.I=h.L);var E=h.g;h=h.ia,E.L=1,E.v=Mp(Ye(m)),E.m=null,E.P=!0,rf(E,h)}n.Za=function(){this.C!=null&&(this.C=null,Fp(this),sS(this),dn(19))};function Up(h){h.C!=null&&(a.clearTimeout(h.C),h.C=null)}function rP(h,m){var E=null;if(h.g==m){Up(h),aS(h),h.g=null;var y=2}else if(fc(h.h,m))E=m.D,R(h.h,m),y=1;else return;if(h.G!=0){if(m.o)if(y==1){E=m.m?m.m.length:0,m=Date.now()-m.F;var k=h.B;y=Us(),Bt(y,new bp(y,E)),kp(h)}else tP(h);else if(k=m.s,k==3||k==0&&0<m.X||!(y==1&&fz(h,m)||y==2&&sS(h)))switch(E&&0<E.length&&(m=h.h,m.i=m.i.concat(E)),k){case 1:gc(h,5);break;case 4:gc(h,10);break;case 3:gc(h,6);break;default:gc(h,2)}}}function iP(h,m){let E=h.Ta+Math.floor(Math.random()*h.cb);return h.isActive()||(E*=2),E*m}function gc(h,m){if(h.j.info("Error code "+m),m==2){var E=f(h.fb,h),y=h.Xa;let k=!y;y=new je(y||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||Lr(y,"https"),Mp(y),k?sz(y.toString(),E):az(y.toString(),E)}else dn(2);h.G=0,h.l&&h.l.sa(m),oP(h),JM(h)}n.fb=function(h){h?(this.j.info("Successfully pinged google.com"),dn(2)):(this.j.info("Failed to ping google.com"),dn(1))};function oP(h){if(h.G=0,h.ka=[],h.l){let m=z(h.h);(m.length!=0||h.i.length!=0)&&(T(h.ka,m),T(h.ka,h.i),h.h.i.length=0,_(h.i),h.i.length=0),h.l.ra()}}function sP(h,m,E){var y=E instanceof je?Ye(E):new je(E);if(y.g!="")m&&(y.g=m+"."+y.g),xt(y,y.s);else{var k=a.location;y=k.protocol,m=m?m+"."+k.hostname:k.hostname,k=+k.port;var W=new je(null);y&&Lr(W,y),m&&(W.g=m),k&&xt(W,k),E&&(W.l=E),y=W}return E=h.D,m=h.ya,E&&m&&rt(y,E,m),rt(y,"VER",h.la),Ef(h,y),y}function aP(h,m,E){if(m&&!h.J)throw Error("Can't create secondary domain capable XhrIo object.");return m=h.Ca&&!h.pa?new Gt(new ff({eb:E})):new Gt(h.pa),m.Ha(h.J),m}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function cP(){}n=cP.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Vp(){}Vp.prototype.g=function(h,m){return new Mr(h,m)};function Mr(h,m){Zt.call(this),this.g=new XM(m),this.l=h,this.h=m&&m.messageUrlParams||null,h=m&&m.messageHeaders||null,m&&m.clientProtocolHeaderRequired&&(h?h["X-Client-Protocol"]="webchannel":h={"X-Client-Protocol":"webchannel"}),this.g.o=h,h=m&&m.initMessageHeaders||null,m&&m.messageContentType&&(h?h["X-WebChannel-Content-Type"]=m.messageContentType:h={"X-WebChannel-Content-Type":m.messageContentType}),m&&m.va&&(h?h["X-WebChannel-Client-Profile"]=m.va:h={"X-WebChannel-Client-Profile":m.va}),this.g.S=h,(h=m&&m.Sb)&&!b(h)&&(this.g.m=h),this.v=m&&m.supportsCrossDomainXhr||!1,this.u=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!b(m)&&(this.g.D=m,h=this.h,h!==null&&m in h&&(h=this.h,m in h&&delete h[m])),this.j=new mu(this)}p(Mr,Zt),Mr.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Mr.prototype.close=function(){oS(this.g)},Mr.prototype.o=function(h){var m=this.g;if(typeof h=="string"){var E={};E.__data__=h,h=E}else this.u&&(E={},E.__data__=no(h),h=E);m.i.push(new rS(m.Ya++,h)),m.G==3&&kp(m)},Mr.prototype.N=function(){this.g.l=null,delete this.j,oS(this.g),delete this.g,Mr.aa.N.call(this)};function lP(h){Fs.call(this),h.__headers__&&(this.headers=h.__headers__,this.statusCode=h.__status__,delete h.__headers__,delete h.__status__);var m=h.__sm__;if(m){e:{for(let E in m){h=E;break e}h=void 0}(this.i=h)&&(h=this.i,m=m!==null&&h in m?m[h]:void 0),this.data=m}else this.data=h}p(lP,Fs);function uP(){ks.call(this),this.status=1}p(uP,ks);function mu(h){this.g=h}p(mu,cP),mu.prototype.ua=function(){Bt(this.g,"a")},mu.prototype.ta=function(h){Bt(this.g,new lP(h))},mu.prototype.sa=function(h){Bt(this.g,new uP)},mu.prototype.ra=function(){Bt(this.g,"b")},Vp.prototype.createWebChannel=Vp.prototype.g,Mr.prototype.send=Mr.prototype.o,Mr.prototype.open=Mr.prototype.m,Mr.prototype.close=Mr.prototype.close,Mw=Ds.createWebChannelTransport=function(){return new Vp},Lw=Ds.getStatEventTarget=function(){return Us()},bw=Ds.Event=Sn,_v=Ds.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Vs.NO_ERROR=0,Vs.TIMEOUT=8,Vs.HTTP_ERROR=6,Rm=Ds.ErrorCode=Vs,Zh.COMPLETE="complete",ww=Ds.EventType=Zh,cu.EventType=xs,xs.OPEN="a",xs.CLOSE="b",xs.ERROR="c",xs.MESSAGE="d",Zt.prototype.listen=Zt.prototype.K,Xd=Ds.WebChannel=cu,Qre=Ds.FetchXmlHttpFactory=ff,Gt.prototype.listenOnce=Gt.prototype.L,Gt.prototype.getLastError=Gt.prototype.Ka,Gt.prototype.getLastErrorCode=Gt.prototype.Ba,Gt.prototype.getStatus=Gt.prototype.Z,Gt.prototype.getResponseJson=Gt.prototype.Oa,Gt.prototype.getResponseText=Gt.prototype.oa,Gt.prototype.send=Gt.prototype.ea,Gt.prototype.setWithCredentials=Gt.prototype.Ha,Ow=Ds.XhrIo=Gt}).apply(typeof Ev<"u"?Ev:typeof self<"u"?self:typeof window<"u"?window:{});var ij="@firebase/firestore",oj="4.8.0";var cn=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};cn.UNAUTHENTICATED=new cn(null),cn.GOOGLE_CREDENTIALS=new cn("google-credentials-uid"),cn.FIRST_PARTY=new cn("first-party-uid"),cn.MOCK_USER=new cn("mock-user");var kh="11.10.0";var Ga=new hi("@firebase/firestore");function ih(){return Ga.logLevel}function KL(n){Ga.setLogLevel(n)}function X(n,...e){if(Ga.logLevel<=xe.DEBUG){let r=e.map(YL);Ga.debug(`Firestore (${kh}): ${n}`,...r)}}function Xt(n,...e){if(Ga.logLevel<=xe.ERROR){let r=e.map(YL);Ga.error(`Firestore (${kh}): ${n}`,...r)}}function Os(n,...e){if(Ga.logLevel<=xe.WARN){let r=e.map(YL);Ga.warn(`Firestore (${kh}): ${n}`,...r)}}function YL(n){if(typeof n=="string")return n;try{return(function(r){return JSON.stringify(r)})(n)}catch{return n}}function ae(n,e,r){let t="Unexpected state";typeof e=="string"?t=e:r=e,IH(n,t,r)}function IH(n,e,r){let t=`FIRESTORE (${kh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(r!==void 0)try{t+=" CONTEXT: "+JSON.stringify(r)}catch{t+=" CONTEXT: "+r}throw Xt(t),new Error(t)}function he(n,e,r,t){let i="Unexpected state";typeof r=="string"?i=r:t=r,n||IH(e,i,t)}function de(n,e){return n}var j={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"},Q=class extends Ir{constructor(e,r){super(e,r),this.code=e,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Nr=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}};var Lv=class{constructor(e,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},Gw=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,r){e.enqueueRetryable(()=>r(cn.UNAUTHENTICATED))}shutdown(){}},$w=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,r){this.changeListener=r,e.enqueueRetryable(()=>r(this.token.user))}shutdown(){this.changeListener=null}},jw=class{constructor(e){this.t=e,this.currentUser=cn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,r){he(this.o===void 0,42304);let t=this.i,i=c=>this.i!==t?(t=this.i,r(c)):Promise.resolve(),o=new Nr;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new Nr,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let c=o;e.enqueueRetryable(()=>I(this,null,function*(){yield c.promise,yield i(this.currentUser)}))},a=c=>{X("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){let c=this.t.getImmediate({optional:!0});c?a(c):(X("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new Nr)}},0),s()}getToken(){let e=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then(t=>this.i!==e?(X("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(he(typeof t.accessToken=="string",31837,{l:t}),new Lv(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return he(e===null||typeof e=="string",2055,{h:e}),new cn(e)}},Hw=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t,this.type="FirstParty",this.user=cn.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},Ww=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t}getToken(){return Promise.resolve(new Hw(this.P,this.T,this.I))}start(e,r){e.enqueueRetryable(()=>r(cn.FIRST_PARTY))}shutdown(){}invalidateToken(){}},Mv=class{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}},zw=class{constructor(e,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,vr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,r){he(this.o===void 0,3512);let t=o=>{o.error!=null&&X("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${o.error.message}`);let s=o.token!==this.m;return this.m=o.token,X("FirebaseAppCheckTokenProvider",`Received ${s?"new":"existing"} token.`),s?r(o.token):Promise.resolve()};this.o=o=>{e.enqueueRetryable(()=>t(o))};let i=o=>{X("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=o,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(o=>i(o)),setTimeout(()=>{if(!this.appCheck){let o=this.V.getImmediate({optional:!0});o?i(o):X("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Mv(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(r=>r?(he(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new Mv(r.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Xre(n){let e=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(r);else for(let t=0;t<n;t++)r[t]=Math.floor(256*Math.random());return r}function vH(){return new TextEncoder}var $m=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=62*Math.floor(4.129032258064516),t="";for(;t.length<20;){let i=Xre(40);for(let o=0;o<i.length;++o)t.length<20&&i[o]<r&&(t+=e.charAt(i[o]%62))}return t}};function De(n,e){return n<e?-1:n>e?1:0}function qw(n,e){let r=0;for(;r<n.length&&r<e.length;){let t=n.codePointAt(r),i=e.codePointAt(r);if(t!==i){if(t<128&&i<128)return De(t,i);{let o=vH(),s=Jre(o.encode(sj(n,r)),o.encode(sj(e,r)));return s!==0?s:De(t,i)}}r+=t>65535?2:1}return De(n.length,e.length)}function sj(n,e){return n.codePointAt(e)>65535?n.substring(e,e+2):n.substring(e,e+1)}function Jre(n,e){for(let r=0;r<n.length&&r<e.length;++r)if(n[r]!==e[r])return De(n[r],e[r]);return De(n.length,e.length)}function fh(n,e,r){return n.length===e.length&&n.every((t,i)=>r(t,e[i]))}function yH(n){return n+"\0"}var aj="__name__",Pv=class n{constructor(e,r,t){r===void 0?r=0:r>e.length&&ae(637,{offset:r,range:e.length}),t===void 0?t=e.length-r:t>e.length-r&&ae(1746,{length:t,range:e.length-r}),this.segments=e,this.offset=r,this.len=t}get length(){return this.len}isEqual(e){return n.comparator(this,e)===0}child(e){let r=this.segments.slice(this.offset,this.limit());return e instanceof n?e.forEach(t=>{r.push(t)}):r.push(e),this.construct(r)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}forEach(e){for(let r=this.offset,t=this.limit();r<t;r++)e(this.segments[r])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,r){let t=Math.min(e.length,r.length);for(let i=0;i<t;i++){let o=n.compareSegments(e.get(i),r.get(i));if(o!==0)return o}return De(e.length,r.length)}static compareSegments(e,r){let t=n.isNumericId(e),i=n.isNumericId(r);return t&&!i?-1:!t&&i?1:t&&i?n.extractNumericId(e).compare(n.extractNumericId(r)):qw(e,r)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return As.fromString(e.substring(4,e.length-2))}},We=class n extends Pv{construct(e,r,t){return new n(e,r,t)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let r=[];for(let t of e){if(t.indexOf("//")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);r.push(...t.split("/").filter(i=>i.length>0))}return new n(r)}static emptyPath(){return new n([])}},Zre=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Tn=class n extends Pv{construct(e,r,t){return new n(e,r,t)}static isValidIdentifier(e){return Zre.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===aj}static keyField(){return new n([aj])}static fromServerFormat(e){let r=[],t="",i=0,o=()=>{if(t.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(t),t=""},s=!1;for(;i<e.length;){let a=e[i];if(a==="\\"){if(i+1===e.length)throw new Q(j.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[i+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new Q(j.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);t+=c,i+=2}else a==="`"?(s=!s,i++):a!=="."||s?(t+=a,i++):(o(),i++)}if(o(),s)throw new Q(j.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(r)}static emptyPath(){return new n([])}};var ie=class n{constructor(e){this.path=e}static fromPath(e){return new n(We.fromString(e))}static fromName(e){return new n(We.fromString(e).popFirst(5))}static empty(){return new n(We.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&We.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,r){return We.comparator(e.path,r.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new n(new We(e.slice()))}};function QL(n,e,r){if(!r)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function eie(n,e,r,t){if(e===!0&&t===!0)throw new Q(j.INVALID_ARGUMENT,`${n} and ${r} cannot be used together.`)}function cj(n){if(!ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function lj(n){if(ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function SH(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}function Ny(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{let e=(function(t){return t.constructor?t.constructor.name:null})(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":ae(12329,{type:typeof n})}function Or(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new Q(j.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=Ny(n);throw new Q(j.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${r}`)}}return n}function tie(n,e){if(e<=0)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}function ln(n,e){let r={typeString:n};return e&&(r.value=e),r}function pp(n,e){if(!SH(n))throw new Q(j.INVALID_ARGUMENT,"JSON must be an object");let r;for(let t in e)if(e[t]){let i=e[t].typeString,o="value"in e[t]?{value:e[t].value}:void 0;if(!(t in n)){r=`JSON missing required field: '${t}'`;break}let s=n[t];if(i&&typeof s!==i){r=`JSON field '${t}' must be a ${i}.`;break}if(o!==void 0&&s!==o.value){r=`Expected '${t}' field to equal '${o.value}'`;break}}if(r)throw new Q(j.INVALID_ARGUMENT,r);return!0}var uj=-62135596800,dj=1e6,Pt=class n{static now(){return n.fromMillis(Date.now())}static fromDate(e){return n.fromMillis(e.getTime())}static fromMillis(e){let r=Math.floor(e/1e3),t=Math.floor((e-1e3*r)*dj);return new n(r,t)}constructor(e,r){if(this.seconds=e,this.nanoseconds=r,r<0)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(e<uj)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/dj}_compareTo(e){return this.seconds===e.seconds?De(this.nanoseconds,e.nanoseconds):De(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:n._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(pp(e,n._jsonSchema))return new n(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-uj;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};Pt._jsonSchemaVersion="firestore/timestamp/1.0",Pt._jsonSchema={type:ln("string",Pt._jsonSchemaVersion),seconds:ln("number"),nanoseconds:ln("number")};var me=class n{static fromTimestamp(e){return new n(e)}static min(){return new n(new Pt(0,0))}static max(){return new n(new Pt(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};var gh=-1,mh=class{constructor(e,r,t,i){this.indexId=e,this.collectionGroup=r,this.fields=t,this.indexState=i}};function Kw(n){return n.fields.find(e=>e.kind===2)}function bl(n){return n.fields.filter(e=>e.kind!==2)}mh.UNKNOWN_ID=-1;var lh=class{constructor(e,r){this.fieldPath=e,this.kind=r}};var jm=class n{constructor(e,r){this.sequenceNumber=e,this.offset=r}static empty(){return new n(0,Ei.min())}};function AH(n,e){let r=n.toTimestamp().seconds,t=n.toTimestamp().nanoseconds+1,i=me.fromTimestamp(t===1e9?new Pt(r+1,0):new Pt(r,t));return new Ei(i,ie.empty(),e)}function DH(n){return new Ei(n.readTime,n.key,gh)}var Ei=class n{constructor(e,r,t){this.readTime=e,this.documentKey=r,this.largestBatchId=t}static min(){return new n(me.min(),ie.empty(),gh)}static max(){return new n(me.max(),ie.empty(),gh)}};function XL(n,e){let r=n.readTime.compareTo(e.readTime);return r!==0?r:(r=ie.comparator(n.documentKey,e.documentKey),r!==0?r:De(n.largestBatchId,e.largestBatchId))}var RH="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",xv=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};function Ya(n){return I(this,null,function*(){if(n.code!==j.FAILED_PRECONDITION||n.message!==RH)throw n;X("LocalStore","Unexpectedly lost primary lease")})}var V=class n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)},r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)})}catch(e){return this.next(void 0,e)}next(e,r){return this.callbackAttached&&ae(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(e,this.result):new n((t,i)=>{this.nextCallback=o=>{this.wrapSuccess(e,o).next(t,i)},this.catchCallback=o=>{this.wrapFailure(r,o).next(t,i)}})}toPromise(){return new Promise((e,r)=>{this.next(e,r)})}wrapUserFunction(e){try{let r=e();return r instanceof n?r:n.resolve(r)}catch(r){return n.reject(r)}}wrapSuccess(e,r){return e?this.wrapUserFunction(()=>e(r)):n.resolve(r)}wrapFailure(e,r){return e?this.wrapUserFunction(()=>e(r)):n.reject(r)}static resolve(e){return new n((r,t)=>{r(e)})}static reject(e){return new n((r,t)=>{t(e)})}static waitFor(e){return new n((r,t)=>{let i=0,o=0,s=!1;e.forEach(a=>{++i,a.next(()=>{++o,s&&o===i&&r()},c=>t(c))}),s=!0,o===i&&r()})}static or(e){let r=n.resolve(!1);for(let t of e)r=r.next(i=>i?n.resolve(i):t());return r}static forEach(e,r){let t=[];return e.forEach((i,o)=>{t.push(r.call(this,i,o))}),this.waitFor(t)}static mapArray(e,r){return new n((t,i)=>{let o=e.length,s=new Array(o),a=0;for(let c=0;c<o;c++){let l=c;r(e[l]).next(u=>{s[l]=u,++a,a===o&&t(s)},u=>i(u))}})}static doWhile(e,r){return new n((t,i)=>{let o=()=>{e()===!0?r().next(()=>{o()},i):t()};o()})}};var zr="SimpleDb",Fv=class n{static open(e,r,t,i){try{return new n(r,e.transaction(i,t))}catch(o){throw new Vl(r,o)}}constructor(e,r){this.action=e,this.transaction=r,this.aborted=!1,this.S=new Nr,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{r.error?this.S.reject(new Vl(e,r.error)):this.S.resolve()},this.transaction.onerror=t=>{let i=JL(t.target.error);this.S.reject(new Vl(e,i))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(X(zr,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}v(){let e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){let r=this.transaction.objectStore(e);return new Qw(r)}},ph=class n{static delete(e){return X(zr,"Removing database:",e),Ml(WT().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!Nd())return!1;if(n.F())return!0;let e=En(),r=n.M(e),t=0<r&&r<10,i=CH(e),o=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||t||o)}static F(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.O)==="YES"}static N(e,r){return e.store(r)}static M(e){let r=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=r?r[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,r,t){this.name=e,this.version=r,this.B=t,this.L=null,n.M(En())===12.2&&Xt("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}k(e){return I(this,null,function*(){return this.db||(X(zr,"Opening database:",this.name),this.db=yield new Promise((r,t)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=o=>{let s=o.target.result;r(s)},i.onblocked=()=>{t(new Vl(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=o=>{let s=o.target.error;s.name==="VersionError"?t(new Q(j.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):s.name==="InvalidStateError"?t(new Q(j.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+s)):t(new Vl(e,s))},i.onupgradeneeded=o=>{X(zr,'Database "'+this.name+'" requires upgrade from version:',o.oldVersion);let s=o.target.result;if(this.L!==null&&this.L!==o.oldVersion)throw new Error(`refusing to open IndexedDB database due to potential corruption of the IndexedDB database data; this corruption could be caused by clicking the "clear site data" button in a web browser; try reloading the web page to re-initialize the IndexedDB database: lastClosedDbVersion=${this.L}, event.oldVersion=${o.oldVersion}, event.newVersion=${o.newVersion}, db.version=${s.version}`);this.B.q(s,i.transaction,o.oldVersion,this.version).next(()=>{X(zr,"Database upgrade to version "+this.version+" complete")})}}),this.db.addEventListener("close",r=>{let t=r.target;this.L=t.version},{passive:!0})),this.db.addEventListener("versionchange",r=>{var t;r.newVersion===null&&(Os('Received "versionchange" event with newVersion===null; notifying the registered DatabaseDeletedListener, if any'),(t=this.databaseDeletedListener)===null||t===void 0||t.call(this))},{passive:!0}),this.db})}setDatabaseDeletedListener(e){if(this.databaseDeletedListener)throw new Error("setDatabaseDeletedListener() may only be called once, and it has already been called");this.databaseDeletedListener=e}runTransaction(e,r,t,i){return I(this,null,function*(){let o=r==="readonly",s=0;for(;;){++s;try{this.db=yield this.k(e);let a=Fv.open(this.db,e,o?"readonly":"readwrite",t),c=i(a).next(l=>(a.v(),l)).catch(l=>(a.abort(l),V.reject(l))).toPromise();return c.catch(()=>{}),yield a.D,c}catch(a){let c=a,l=c.name!=="FirebaseError"&&s<3;if(X(zr,"Transaction failed with error:",c.message,"Retrying:",l),this.close(),!l)return Promise.reject(c)}}})}close(){this.db&&this.db.close(),this.db=void 0}};function CH(n){let e=n.match(/Android ([\d.]+)/i),r=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(r)}var Yw=class{constructor(e){this.$=e,this.U=!1,this.K=null}get isDone(){return this.U}get W(){return this.K}set cursor(e){this.$=e}done(){this.U=!0}G(e){this.K=e}delete(){return Ml(this.$.delete())}},Vl=class extends Q{constructor(e,r){super(j.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${r}`),this.name="IndexedDbTransactionError"}};function Qa(n){return n.name==="IndexedDbTransactionError"}var Qw=class{constructor(e){this.store=e}put(e,r){let t;return r!==void 0?(X(zr,"PUT",this.store.name,e,r),t=this.store.put(r,e)):(X(zr,"PUT",this.store.name,"<auto-key>",e),t=this.store.put(e)),Ml(t)}add(e){return X(zr,"ADD",this.store.name,e,e),Ml(this.store.add(e))}get(e){return Ml(this.store.get(e)).next(r=>(r===void 0&&(r=null),X(zr,"GET",this.store.name,e,r),r))}delete(e){return X(zr,"DELETE",this.store.name,e),Ml(this.store.delete(e))}count(){return X(zr,"COUNT",this.store.name),Ml(this.store.count())}j(e,r){let t=this.options(e,r),i=t.index?this.store.index(t.index):this.store;if(typeof i.getAll=="function"){let o=i.getAll(t.range);return new V((s,a)=>{o.onerror=c=>{a(c.target.error)},o.onsuccess=c=>{s(c.target.result)}})}{let o=this.cursor(t),s=[];return this.J(o,(a,c)=>{s.push(c)}).next(()=>s)}}H(e,r){let t=this.store.getAll(e,r===null?void 0:r);return new V((i,o)=>{t.onerror=s=>{o(s.target.error)},t.onsuccess=s=>{i(s.target.result)}})}Y(e,r){X(zr,"DELETE ALL",this.store.name);let t=this.options(e,r);t.Z=!1;let i=this.cursor(t);return this.J(i,(o,s,a)=>a.delete())}X(e,r){let t;r?t=e:(t={},r=e);let i=this.cursor(t);return this.J(i,r)}ee(e){let r=this.cursor({});return new V((t,i)=>{r.onerror=o=>{let s=JL(o.target.error);i(s)},r.onsuccess=o=>{let s=o.target.result;s?e(s.primaryKey,s.value).next(a=>{a?s.continue():t()}):t()}})}J(e,r){let t=[];return new V((i,o)=>{e.onerror=s=>{o(s.target.error)},e.onsuccess=s=>{let a=s.target.result;if(!a)return void i();let c=new Yw(a),l=r(a.primaryKey,a.value,c);if(l instanceof V){let u=l.catch(d=>(c.done(),V.reject(d)));t.push(u)}c.isDone?i():c.W===null?a.continue():a.continue(c.W)}}).next(()=>V.waitFor(t))}options(e,r){let t;return e!==void 0&&(typeof e=="string"?t=e:r=e),{index:t,range:r}}cursor(e){let r="next";if(e.reverse&&(r="prev"),e.index){let t=this.store.index(e.index);return e.Z?t.openKeyCursor(e.range,r):t.openCursor(e.range,r)}return this.store.openCursor(e.range,r)}};function Ml(n){return new V((e,r)=>{n.onsuccess=t=>{let i=t.target.result;e(i)},n.onerror=t=>{let i=JL(t.target.error);r(i)}})}var hj=!1;function JL(n){let e=ph.M(En());if(e>=12.2&&e<13){let r="An internal error was encountered in the Indexed Database server";if(n.message.indexOf(r)>=0){let t=new Q("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${r}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return hj||(hj=!0,setTimeout(()=>{throw t},0)),t}}return n}var Pm="IndexBackfiller",Xw=class{constructor(e,r){this.asyncQueue=e,this.te=r,this.task=null}start(){this.ne(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}ne(e){X(Pm,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,()=>I(this,null,function*(){this.task=null;try{let r=yield this.te.re();X(Pm,`Documents written: ${r}`)}catch(r){Qa(r)?X(Pm,"Ignoring IndexedDB error during index backfill: ",r):yield Ya(r)}yield this.ne(6e4)}))}},Jw=class{constructor(e,r){this.localStore=e,this.persistence=r}re(e=50){return I(this,null,function*(){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",r=>this.ie(r,e))})}ie(e,r){let t=new Set,i=r,o=!0;return V.doWhile(()=>o===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(s=>{if(s!==null&&!t.has(s))return X(Pm,`Processing collection: ${s}`),this.se(e,s,i).next(a=>{i-=a,t.add(s)});o=!1})).next(()=>r-i)}se(e,r,t){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,r).next(i=>this.localStore.localDocuments.getNextDocuments(e,r,i,t).next(o=>{let s=o.changes;return this.localStore.indexManager.updateIndexEntries(e,s).next(()=>this.oe(i,o)).next(a=>(X(Pm,`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,r,a))).next(()=>s.size)}))}oe(e,r){let t=e;return r.changes.forEach((i,o)=>{let s=DH(o);XL(s,t)>0&&(t=s)}),new Ei(t.readTime,t.documentKey,Math.max(r.batchId,e.largestBatchId))}};var qr=(()=>{class n{constructor(r,t){this.previousValue=r,t&&(t.sequenceNumberHandler=i=>this._e(i),this.ae=i=>t.writeSequenceNumber(i))}_e(r){return this.previousValue=Math.max(r,this.previousValue),this.previousValue}next(){let r=++this.previousValue;return this.ae&&this.ae(r),r}}n.ue=-1;return n})(),Bl=-1;function Ep(n){return n==null}function Hm(n){return n===0&&1/n==-1/0}function NH(n){return typeof n=="number"&&Number.isInteger(n)&&!Hm(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}var kv="";function nr(n){let e="";for(let r=0;r<n.length;r++)e.length>0&&(e=fj(e)),e=nie(n.get(r),e);return fj(e)}function nie(n,e){let r=e,t=n.length;for(let i=0;i<t;i++){let o=n.charAt(i);switch(o){case"\0":r+="";break;case kv:r+="";break;default:r+=o}}return r}function fj(n){return n+kv+""}function Vo(n){let e=n.length;if(he(e>=2,64408,{path:n}),e===2)return he(n.charAt(0)===kv&&n.charAt(1)==="",56145,{path:n}),We.emptyPath();let r=e-2,t=[],i="";for(let o=0;o<e;){let s=n.indexOf(kv,o);switch((s<0||s>r)&&ae(50515,{path:n}),n.charAt(s+1)){case"":let a=n.substring(o,s),c;i.length===0?c=a:(i+=a,c=i,i=""),t.push(c);break;case"":i+=n.substring(o,s),i+="\0";break;case"":i+=n.substring(o,s+1);break;default:ae(61167,{path:n})}o=s+2}return new We(t)}var Ll="remoteDocuments",_p="owner",Jd="owner",Wm="mutationQueues",rie="userId",zi="mutations",gj="batchId",kl="userMutationsIndex",mj=["userId","batchId"];function Av(n,e){return[n,nr(e)]}function OH(n,e,r){return[n,nr(e),r]}var iie={},Eh="documentMutations",Uv="remoteDocumentsV14",oie=["prefixPath","collectionGroup","readTime","documentId"],Dv="documentKeyIndex",sie=["prefixPath","collectionGroup","documentId"],wH="collectionGroupIndex",aie=["collectionGroup","readTime","prefixPath","documentId"],zm="remoteDocumentGlobal",Zw="remoteDocumentGlobalKey",_h="targets",bH="queryTargetsIndex",cie=["canonicalId","targetId"],Th="targetDocuments",lie=["targetId","path"],ZL="documentTargetsIndex",uie=["path","targetId"],Vv="targetGlobalKey",Gl="targetGlobal",qm="collectionParents",die=["collectionId","parent"],Ih="clientMetadata",hie="clientId",Oy="bundles",fie="bundleId",wy="namedQueries",gie="name",eM="indexConfiguration",mie="indexId",eb="collectionGroupIndex",pie="collectionGroup",xm="indexState",Eie=["indexId","uid"],LH="sequenceNumberIndex",_ie=["uid","sequenceNumber"],Fm="indexEntries",Tie=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],MH="documentKeyIndex",Iie=["indexId","uid","orderedDocumentKey"],by="documentOverlays",vie=["userId","collectionPath","documentId"],tb="collectionPathOverlayIndex",yie=["userId","collectionPath","largestBatchId"],PH="collectionGroupOverlayIndex",Sie=["userId","collectionGroup","largestBatchId"],tM="globals",Aie="name",xH=[Wm,zi,Eh,Ll,_h,_p,Gl,Th,Ih,zm,qm,Oy,wy],Die=[...xH,by],FH=[Wm,zi,Eh,Uv,_h,_p,Gl,Th,Ih,zm,qm,Oy,wy,by],kH=FH,nM=[...kH,eM,xm,Fm],Rie=nM,UH=[...nM,tM],Cie=UH;var Km=class extends xv{constructor(e,r){super(),this.ce=e,this.currentSequenceNumber=r}};function yn(n,e){let r=de(n);return ph.N(r.ce,e)}function pj(n){let e=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e++;return e}function Xa(n,e){for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e(r,n[r])}function Nie(n,e){let r=[];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.push(e(n[t],t,n));return r}function VH(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}var Dt=class n{constructor(e,r){this.comparator=e,this.root=r||Go.EMPTY}insert(e,r){return new n(this.comparator,this.root.insert(e,r,this.comparator).copy(null,null,Go.BLACK,null,null))}remove(e){return new n(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Go.BLACK,null,null))}get(e){let r=this.root;for(;!r.isEmpty();){let t=this.comparator(e,r.key);if(t===0)return r.value;t<0?r=r.left:t>0&&(r=r.right)}return null}indexOf(e){let r=0,t=this.root;for(;!t.isEmpty();){let i=this.comparator(e,t.key);if(i===0)return r+t.left.size;i<0?t=t.left:(r+=t.left.size+1,t=t.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((r,t)=>(e(r,t),!1))}toString(){let e=[];return this.inorderTraversal((r,t)=>(e.push(`${r}:${t}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new ch(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ch(this.root,e,this.comparator,!1)}getReverseIterator(){return new ch(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ch(this.root,e,this.comparator,!0)}},ch=class{constructor(e,r,t,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!e.isEmpty();)if(o=r?t(e.key,r):1,r&&i&&(o*=-1),o<0)e=this.isReverse?e.left:e.right;else{if(o===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),r={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return r}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},Go=class n{constructor(e,r,t,i,o){this.key=e,this.value=r,this.color=t??n.RED,this.left=i??n.EMPTY,this.right=o??n.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,r,t,i,o){return new n(e??this.key,r??this.value,t??this.color,i??this.left,o??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,r,t){let i=this,o=t(e,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(e,r,t),null):o===0?i.copy(null,r,null,null,null):i.copy(null,null,null,null,i.right.insert(e,r,t)),i.fixUp()}removeMin(){if(this.left.isEmpty())return n.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,r){let t,i=this;if(r(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,r),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),r(e,i.key)===0){if(i.right.isEmpty())return n.EMPTY;t=i.right.min(),i=i.copy(t.key,t.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,r))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let e=this.copy(null,null,n.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,n.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,r)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ae(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ae(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw ae(27949);return e+(this.isRed()?0:1)}};Go.EMPTY=null,Go.RED=!0,Go.BLACK=!1;Go.EMPTY=new class{constructor(){this.size=0}get key(){throw ae(57766)}get value(){throw ae(16141)}get color(){throw ae(16727)}get left(){throw ae(29726)}get right(){throw ae(36894)}copy(e,r,t,i,o){return this}insert(e,r,t){return new Go(e,r)}remove(e,r){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var at=class n{constructor(e){this.comparator=e,this.data=new Dt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((r,t)=>(e(r),!1))}forEachInRange(e,r){let t=this.data.getIteratorFrom(e[0]);for(;t.hasNext();){let i=t.getNext();if(this.comparator(i.key,e[1])>=0)return;r(i.key)}}forEachWhile(e,r){let t;for(t=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();t.hasNext();)if(!e(t.getNext().key))return}firstAfterOrEqual(e){let r=this.data.getIteratorFrom(e);return r.hasNext()?r.getNext().key:null}getIterator(){return new Bv(this.data.getIterator())}getIteratorFrom(e){return new Bv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let r=this;return r.size<e.size&&(r=e,e=this),e.forEach(t=>{r=r.add(t)}),r}isEqual(e){if(!(e instanceof n)||this.size!==e.size)return!1;let r=this.data.getIterator(),t=e.data.getIterator();for(;r.hasNext();){let i=r.getNext().key,o=t.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){let e=[];return this.forEach(r=>{e.push(r)}),e}toString(){let e=[];return this.forEach(r=>e.push(r)),"SortedSet("+e.toString()+")"}copy(e){let r=new n(this.comparator);return r.data=e,r}},Bv=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};function Zd(n){return n.hasNext()?n.getNext():void 0}var Kr=class n{constructor(e){this.fields=e,e.sort(Tn.comparator)}static empty(){return new n([])}unionWith(e){let r=new at(Tn.comparator);for(let t of this.fields)r=r.add(t);for(let t of e)r=r.add(t);return new n(r.toArray())}covers(e){for(let r of this.fields)if(r.isPrefixOf(e))return!0;return!1}isEqual(e){return fh(this.fields,e.fields,(r,t)=>r.isEqual(t))}};var Gv=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var un=class n{constructor(e){this.binaryString=e}static fromBase64String(e){let r=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new Gv("Invalid base64 string: "+o):o}})(e);return new n(r)}static fromUint8Array(e){let r=(function(i){let o="";for(let s=0;s<i.length;++s)o+=String.fromCharCode(i[s]);return o})(e);return new n(r)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(r){return btoa(r)})(this.binaryString)}toUint8Array(){return(function(r){let t=new Uint8Array(r.length);for(let i=0;i<r.length;i++)t[i]=r.charCodeAt(i);return t})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return De(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};un.EMPTY_BYTE_STRING=new un("");var Oie=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ws(n){if(he(!!n,39018),typeof n=="string"){let e=0,r=Oie.exec(n);if(he(!!r,46558,{timestamp:n}),r[1]){let i=r[1];i=(i+"000000000").substr(0,9),e=Number(i)}let t=new Date(n);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}return{seconds:Mt(n.seconds),nanos:Mt(n.nanos)}}function Mt(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function bs(n){return typeof n=="string"?un.fromBase64String(n):un.fromUint8Array(n)}var BH="server_timestamp",GH="__type__",$H="__previous_value__",jH="__local_write_time__";function Ly(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[GH])===null||r===void 0?void 0:r.stringValue)===BH}function My(n){let e=n.mapValue.fields[$H];return Ly(e)?My(e):e}function Ym(n){let e=ws(n.mapValue.fields[jH].timestampValue);return new Pt(e.seconds,e.nanos)}var nb=class{constructor(e,r,t,i,o,s,a,c,l,u){this.databaseId=e,this.appId=r,this.persistenceKey=t,this.host=i,this.ssl=o,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=l,this.isUsingEmulator=u}},Qm="(default)",vh=class n{constructor(e,r){this.projectId=e,this.database=r||Qm}static empty(){return new n("","")}get isDefaultDatabase(){return this.database===Qm}isEqual(e){return e instanceof n&&e.projectId===this.projectId&&e.database===this.database}};var rM="__type__",HH="__max__",xa={mapValue:{fields:{__type__:{stringValue:HH}}}},iM="__vector__",yh="value",Rv={nullValue:"NULL_VALUE"};function $a(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?Ly(n)?4:WH(n)?9007199254740991:Py(n)?10:11:ae(28295,{value:n})}function $o(n,e){if(n===e)return!0;let r=$a(n);if(r!==$a(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return Ym(n).isEqual(Ym(e));case 3:return(function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;let s=ws(i.timestampValue),a=ws(o.timestampValue);return s.seconds===a.seconds&&s.nanos===a.nanos})(n,e);case 5:return n.stringValue===e.stringValue;case 6:return(function(i,o){return bs(i.bytesValue).isEqual(bs(o.bytesValue))})(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return(function(i,o){return Mt(i.geoPointValue.latitude)===Mt(o.geoPointValue.latitude)&&Mt(i.geoPointValue.longitude)===Mt(o.geoPointValue.longitude)})(n,e);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return Mt(i.integerValue)===Mt(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){let s=Mt(i.doubleValue),a=Mt(o.doubleValue);return s===a?Hm(s)===Hm(a):isNaN(s)&&isNaN(a)}return!1})(n,e);case 9:return fh(n.arrayValue.values||[],e.arrayValue.values||[],$o);case 10:case 11:return(function(i,o){let s=i.mapValue.fields||{},a=o.mapValue.fields||{};if(pj(s)!==pj(a))return!1;for(let c in s)if(s.hasOwnProperty(c)&&(a[c]===void 0||!$o(s[c],a[c])))return!1;return!0})(n,e);default:return ae(52216,{left:n})}}function Xm(n,e){return(n.values||[]).find(r=>$o(r,e))!==void 0}function ja(n,e){if(n===e)return 0;let r=$a(n),t=$a(e);if(r!==t)return De(r,t);switch(r){case 0:case 9007199254740991:return 0;case 1:return De(n.booleanValue,e.booleanValue);case 2:return(function(o,s){let a=Mt(o.integerValue||o.doubleValue),c=Mt(s.integerValue||s.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1})(n,e);case 3:return Ej(n.timestampValue,e.timestampValue);case 4:return Ej(Ym(n),Ym(e));case 5:return qw(n.stringValue,e.stringValue);case 6:return(function(o,s){let a=bs(o),c=bs(s);return a.compareTo(c)})(n.bytesValue,e.bytesValue);case 7:return(function(o,s){let a=o.split("/"),c=s.split("/");for(let l=0;l<a.length&&l<c.length;l++){let u=De(a[l],c[l]);if(u!==0)return u}return De(a.length,c.length)})(n.referenceValue,e.referenceValue);case 8:return(function(o,s){let a=De(Mt(o.latitude),Mt(s.latitude));return a!==0?a:De(Mt(o.longitude),Mt(s.longitude))})(n.geoPointValue,e.geoPointValue);case 9:return _j(n.arrayValue,e.arrayValue);case 10:return(function(o,s){var a,c,l,u;let d=o.fields||{},f=s.fields||{},g=(a=d[yh])===null||a===void 0?void 0:a.arrayValue,p=(c=f[yh])===null||c===void 0?void 0:c.arrayValue,_=De(((l=g?.values)===null||l===void 0?void 0:l.length)||0,((u=p?.values)===null||u===void 0?void 0:u.length)||0);return _!==0?_:_j(g,p)})(n.mapValue,e.mapValue);case 11:return(function(o,s){if(o===xa.mapValue&&s===xa.mapValue)return 0;if(o===xa.mapValue)return 1;if(s===xa.mapValue)return-1;let a=o.fields||{},c=Object.keys(a),l=s.fields||{},u=Object.keys(l);c.sort(),u.sort();for(let d=0;d<c.length&&d<u.length;++d){let f=qw(c[d],u[d]);if(f!==0)return f;let g=ja(a[c[d]],l[u[d]]);if(g!==0)return g}return De(c.length,u.length)})(n.mapValue,e.mapValue);default:throw ae(23264,{le:r})}}function Ej(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return De(n,e);let r=ws(n),t=ws(e),i=De(r.seconds,t.seconds);return i!==0?i:De(r.nanos,t.nanos)}function _j(n,e){let r=n.values||[],t=e.values||[];for(let i=0;i<r.length&&i<t.length;++i){let o=ja(r[i],t[i]);if(o)return o}return De(r.length,t.length)}function Sh(n){return rb(n)}function rb(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?(function(r){let t=ws(r);return`time(${t.seconds},${t.nanos})`})(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?(function(r){return bs(r).toBase64()})(n.bytesValue):"referenceValue"in n?(function(r){return ie.fromName(r).toString()})(n.referenceValue):"geoPointValue"in n?(function(r){return`geo(${r.latitude},${r.longitude})`})(n.geoPointValue):"arrayValue"in n?(function(r){let t="[",i=!0;for(let o of r.values||[])i?i=!1:t+=",",t+=rb(o);return t+"]"})(n.arrayValue):"mapValue"in n?(function(r){let t=Object.keys(r.fields||{}).sort(),i="{",o=!0;for(let s of t)o?o=!1:i+=",",i+=`${s}:${rb(r.fields[s])}`;return i+"}"})(n.mapValue):ae(61005,{value:n})}function Cv(n){switch($a(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=My(n);return e?16+Cv(e):16;case 5:return 2*n.stringValue.length;case 6:return bs(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return(function(t){return(t.values||[]).reduce((i,o)=>i+Cv(o),0)})(n.arrayValue);case 10:case 11:return(function(t){let i=0;return Xa(t.fields,(o,s)=>{i+=o.length+Cv(s)}),i})(n.mapValue);default:throw ae(13486,{value:n})}}function jl(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function ib(n){return!!n&&"integerValue"in n}function Jm(n){return!!n&&"arrayValue"in n}function Tj(n){return!!n&&"nullValue"in n}function Ij(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Nv(n){return!!n&&"mapValue"in n}function Py(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[rM])===null||r===void 0?void 0:r.stringValue)===iM}function km(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){let e={mapValue:{fields:{}}};return Xa(n.mapValue.fields,(r,t)=>e.mapValue.fields[r]=km(t)),e}if(n.arrayValue){let e={arrayValue:{values:[]}};for(let r=0;r<(n.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=km(n.arrayValue.values[r]);return e}return Object.assign({},n)}function WH(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===HH}var zH={mapValue:{fields:{[rM]:{stringValue:iM},[yh]:{arrayValue:{}}}}};function wie(n){return"nullValue"in n?Rv:"booleanValue"in n?{booleanValue:!1}:"integerValue"in n||"doubleValue"in n?{doubleValue:NaN}:"timestampValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in n?{stringValue:""}:"bytesValue"in n?{bytesValue:""}:"referenceValue"in n?jl(vh.empty(),ie.empty()):"geoPointValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in n?{arrayValue:{}}:"mapValue"in n?Py(n)?zH:{mapValue:{}}:ae(35942,{value:n})}function bie(n){return"nullValue"in n?{booleanValue:!1}:"booleanValue"in n?{doubleValue:NaN}:"integerValue"in n||"doubleValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in n?{stringValue:""}:"stringValue"in n?{bytesValue:""}:"bytesValue"in n?jl(vh.empty(),ie.empty()):"referenceValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in n?{arrayValue:{}}:"arrayValue"in n?zH:"mapValue"in n?Py(n)?{mapValue:{}}:xa:ae(61959,{value:n})}function vj(n,e){let r=ja(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?-1:!n.inclusive&&e.inclusive?1:0}function yj(n,e){let r=ja(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?1:!n.inclusive&&e.inclusive?-1:0}var tr=class n{constructor(e){this.value=e}static empty(){return new n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let r=this.value;for(let t=0;t<e.length-1;++t)if(r=(r.mapValue.fields||{})[e.get(t)],!Nv(r))return null;return r=(r.mapValue.fields||{})[e.lastSegment()],r||null}}set(e,r){this.getFieldsMap(e.popLast())[e.lastSegment()]=km(r)}setAll(e){let r=Tn.emptyPath(),t={},i=[];e.forEach((s,a)=>{if(!r.isImmediateParentOf(a)){let c=this.getFieldsMap(r);this.applyChanges(c,t,i),t={},i=[],r=a.popLast()}s?t[a.lastSegment()]=km(s):i.push(a.lastSegment())});let o=this.getFieldsMap(r);this.applyChanges(o,t,i)}delete(e){let r=this.field(e.popLast());Nv(r)&&r.mapValue.fields&&delete r.mapValue.fields[e.lastSegment()]}isEqual(e){return $o(this.value,e.value)}getFieldsMap(e){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let t=0;t<e.length;++t){let i=r.mapValue.fields[e.get(t)];Nv(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},r.mapValue.fields[e.get(t)]=i),r=i}return r.mapValue.fields}applyChanges(e,r,t){Xa(r,(i,o)=>e[i]=o);for(let i of t)delete e[i]}clone(){return new n(km(this.value))}};function qH(n){let e=[];return Xa(n.fields,(r,t)=>{let i=new Tn([r]);if(Nv(t)){let o=qH(t.mapValue).fields;if(o.length===0)e.push(i);else for(let s of o)e.push(i.child(s))}else e.push(i)}),new Kr(e)}var In=class n{constructor(e,r,t,i,o,s,a){this.key=e,this.documentType=r,this.version=t,this.readTime=i,this.createTime=o,this.data=s,this.documentState=a}static newInvalidDocument(e){return new n(e,0,me.min(),me.min(),me.min(),tr.empty(),0)}static newFoundDocument(e,r,t,i){return new n(e,1,r,me.min(),t,i,0)}static newNoDocument(e,r){return new n(e,2,r,me.min(),me.min(),tr.empty(),0)}static newUnknownDocument(e,r){return new n(e,3,r,me.min(),me.min(),tr.empty(),2)}convertToFoundDocument(e,r){return!this.createTime.isEqual(me.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=tr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=tr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=me.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof n&&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 n(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}};var jo=class{constructor(e,r){this.position=e,this.inclusive=r}};function Sj(n,e,r){let t=0;for(let i=0;i<n.position.length;i++){let o=e[i],s=n.position[i];if(o.field.isKeyField()?t=ie.comparator(ie.fromName(s.referenceValue),r.key):t=ja(s,r.data.field(o.field)),o.dir==="desc"&&(t*=-1),t!==0)break}return t}function Aj(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let r=0;r<n.position.length;r++)if(!$o(n.position[r],e.position[r]))return!1;return!0}var Hl=class{constructor(e,r="asc"){this.field=e,this.dir=r}};function Lie(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}var $v=class{},$e=class n extends $v{constructor(e,r,t){super(),this.field=e,this.op=r,this.value=t}static create(e,r,t){return e.isKeyField()?r==="in"||r==="not-in"?this.createKeyFieldInFilter(e,r,t):new ab(e,r,t):r==="array-contains"?new ub(e,t):r==="in"?new jv(e,t):r==="not-in"?new db(e,t):r==="array-contains-any"?new hb(e,t):new n(e,r,t)}static createKeyFieldInFilter(e,r,t){return r==="in"?new cb(e,t):new lb(e,t)}matches(e){let r=e.data.field(this.field);return this.op==="!="?r!==null&&r.nullValue===void 0&&this.matchesComparison(ja(r,this.value)):r!==null&&$a(this.value)===$a(r)&&this.matchesComparison(ja(r,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return ae(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},nt=class n extends $v{constructor(e,r){super(),this.filters=e,this.op=r,this.he=null}static create(e,r){return new n(e,r)}matches(e){return Ah(this)?this.filters.find(r=>!r.matches(e))===void 0:this.filters.find(r=>r.matches(e))!==void 0}getFlattenedFilters(){return this.he!==null||(this.he=this.filters.reduce((e,r)=>e.concat(r.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}};function Ah(n){return n.op==="and"}function ob(n){return n.op==="or"}function oM(n){return KH(n)&&Ah(n)}function KH(n){for(let e of n.filters)if(e instanceof nt)return!1;return!0}function sb(n){if(n instanceof $e)return n.field.canonicalString()+n.op.toString()+Sh(n.value);if(oM(n))return n.filters.map(e=>sb(e)).join(",");{let e=n.filters.map(r=>sb(r)).join(",");return`${n.op}(${e})`}}function YH(n,e){return n instanceof $e?(function(t,i){return i instanceof $e&&t.op===i.op&&t.field.isEqual(i.field)&&$o(t.value,i.value)})(n,e):n instanceof nt?(function(t,i){return i instanceof nt&&t.op===i.op&&t.filters.length===i.filters.length?t.filters.reduce((o,s,a)=>o&&YH(s,i.filters[a]),!0):!1})(n,e):void ae(19439)}function QH(n,e){let r=n.filters.concat(e);return nt.create(r,n.op)}function XH(n){return n instanceof $e?(function(r){return`${r.field.canonicalString()} ${r.op} ${Sh(r.value)}`})(n):n instanceof nt?(function(r){return r.op.toString()+" {"+r.getFilters().map(XH).join(" ,")+"}"})(n):"Filter"}var ab=class extends $e{constructor(e,r,t){super(e,r,t),this.key=ie.fromName(t.referenceValue)}matches(e){let r=ie.comparator(e.key,this.key);return this.matchesComparison(r)}},cb=class extends $e{constructor(e,r){super(e,"in",r),this.keys=JH("in",r)}matches(e){return this.keys.some(r=>r.isEqual(e.key))}},lb=class extends $e{constructor(e,r){super(e,"not-in",r),this.keys=JH("not-in",r)}matches(e){return!this.keys.some(r=>r.isEqual(e.key))}};function JH(n,e){var r;return(((r=e.arrayValue)===null||r===void 0?void 0:r.values)||[]).map(t=>ie.fromName(t.referenceValue))}var ub=class extends $e{constructor(e,r){super(e,"array-contains",r)}matches(e){let r=e.data.field(this.field);return Jm(r)&&Xm(r.arrayValue,this.value)}},jv=class extends $e{constructor(e,r){super(e,"in",r)}matches(e){let r=e.data.field(this.field);return r!==null&&Xm(this.value.arrayValue,r)}},db=class extends $e{constructor(e,r){super(e,"not-in",r)}matches(e){if(Xm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let r=e.data.field(this.field);return r!==null&&r.nullValue===void 0&&!Xm(this.value.arrayValue,r)}},hb=class extends $e{constructor(e,r){super(e,"array-contains-any",r)}matches(e){let r=e.data.field(this.field);return!(!Jm(r)||!r.arrayValue.values)&&r.arrayValue.values.some(t=>Xm(this.value.arrayValue,t))}};var fb=class{constructor(e,r=null,t=[],i=[],o=null,s=null,a=null){this.path=e,this.collectionGroup=r,this.orderBy=t,this.filters=i,this.limit=o,this.startAt=s,this.endAt=a,this.Pe=null}};function gb(n,e=null,r=[],t=[],i=null,o=null,s=null){return new fb(n,e,r,t,i,o,s)}function Wl(n){let e=de(n);if(e.Pe===null){let r=e.path.canonicalString();e.collectionGroup!==null&&(r+="|cg:"+e.collectionGroup),r+="|f:",r+=e.filters.map(t=>sb(t)).join(","),r+="|ob:",r+=e.orderBy.map(t=>(function(o){return o.field.canonicalString()+o.dir})(t)).join(","),Ep(e.limit)||(r+="|l:",r+=e.limit),e.startAt&&(r+="|lb:",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map(t=>Sh(t)).join(",")),e.endAt&&(r+="|ub:",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map(t=>Sh(t)).join(",")),e.Pe=r}return e.Pe}function Tp(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let r=0;r<n.orderBy.length;r++)if(!Lie(n.orderBy[r],e.orderBy[r]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let r=0;r<n.filters.length;r++)if(!YH(n.filters[r],e.filters[r]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Aj(n.startAt,e.startAt)&&Aj(n.endAt,e.endAt)}function Hv(n){return ie.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function Wv(n,e){return n.filters.filter(r=>r instanceof $e&&r.field.isEqual(e))}function Dj(n,e,r){let t=Rv,i=!0;for(let o of Wv(n,e)){let s=Rv,a=!0;switch(o.op){case"<":case"<=":s=wie(o.value);break;case"==":case"in":case">=":s=o.value;break;case">":s=o.value,a=!1;break;case"!=":case"not-in":s=Rv}vj({value:t,inclusive:i},{value:s,inclusive:a})<0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];vj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})<0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}function Rj(n,e,r){let t=xa,i=!0;for(let o of Wv(n,e)){let s=xa,a=!0;switch(o.op){case">=":case">":s=bie(o.value),a=!1;break;case"==":case"in":case"<=":s=o.value;break;case"<":s=o.value,a=!1;break;case"!=":case"not-in":s=xa}yj({value:t,inclusive:i},{value:s,inclusive:a})>0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];yj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})>0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}var Ho=class{constructor(e,r=null,t=[],i=[],o=null,s="F",a=null,c=null){this.path=e,this.collectionGroup=r,this.explicitOrderBy=t,this.filters=i,this.limit=o,this.limitType=s,this.startAt=a,this.endAt=c,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}};function ZH(n,e,r,t,i,o,s,a){return new Ho(n,e,r,t,i,o,s,a)}function Ip(n){return new Ho(n)}function Cj(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function sM(n){return n.collectionGroup!==null}function uh(n){let e=de(n);if(e.Te===null){e.Te=[];let r=new Set;for(let o of e.explicitOrderBy)e.Te.push(o),r.add(o.field.canonicalString());let t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(s){let a=new at(Tn.comparator);return s.filters.forEach(c=>{c.getFlattenedFilters().forEach(l=>{l.isInequality()&&(a=a.add(l.field))})}),a})(e).forEach(o=>{r.has(o.canonicalString())||o.isKeyField()||e.Te.push(new Hl(o,t))}),r.has(Tn.keyField().canonicalString())||e.Te.push(new Hl(Tn.keyField(),t))}return e.Te}function Qr(n){let e=de(n);return e.Ie||(e.Ie=eW(e,uh(n))),e.Ie}function Mie(n){let e=de(n);return e.de||(e.de=eW(e,n.explicitOrderBy)),e.de}function eW(n,e){if(n.limitType==="F")return gb(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(i=>{let o=i.dir==="desc"?"asc":"desc";return new Hl(i.field,o)});let r=n.endAt?new jo(n.endAt.position,n.endAt.inclusive):null,t=n.startAt?new jo(n.startAt.position,n.startAt.inclusive):null;return gb(n.path,n.collectionGroup,e,n.filters,n.limit,r,t)}}function mb(n,e){let r=n.filters.concat([e]);return new Ho(n.path,n.collectionGroup,n.explicitOrderBy.slice(),r,n.limit,n.limitType,n.startAt,n.endAt)}function zv(n,e,r){return new Ho(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,r,n.startAt,n.endAt)}function xy(n,e){return Tp(Qr(n),Qr(e))&&n.limitType===e.limitType}function tW(n){return`${Wl(Qr(n))}|lt:${n.limitType}`}function oh(n){return`Query(target=${(function(r){let t=r.path.canonicalString();return r.collectionGroup!==null&&(t+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(t+=`, filters: [${r.filters.map(i=>XH(i)).join(", ")}]`),Ep(r.limit)||(t+=", limit: "+r.limit),r.orderBy.length>0&&(t+=`, orderBy: [${r.orderBy.map(i=>(function(s){return`${s.field.canonicalString()} (${s.dir})`})(i)).join(", ")}]`),r.startAt&&(t+=", startAt: ",t+=r.startAt.inclusive?"b:":"a:",t+=r.startAt.position.map(i=>Sh(i)).join(",")),r.endAt&&(t+=", endAt: ",t+=r.endAt.inclusive?"a:":"b:",t+=r.endAt.position.map(i=>Sh(i)).join(",")),`Target(${t})`})(Qr(n))}; limitType=${n.limitType})`}function vp(n,e){return e.isFoundDocument()&&(function(t,i){let o=i.key.path;return t.collectionGroup!==null?i.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(o):ie.isDocumentKey(t.path)?t.path.isEqual(o):t.path.isImmediateParentOf(o)})(n,e)&&(function(t,i){for(let o of uh(t))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(n,e)&&(function(t,i){for(let o of t.filters)if(!o.matches(i))return!1;return!0})(n,e)&&(function(t,i){return!(t.startAt&&!(function(s,a,c){let l=Sj(s,a,c);return s.inclusive?l<=0:l<0})(t.startAt,uh(t),i)||t.endAt&&!(function(s,a,c){let l=Sj(s,a,c);return s.inclusive?l>=0:l>0})(t.endAt,uh(t),i))})(n,e)}function nW(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function rW(n){return(e,r)=>{let t=!1;for(let i of uh(n)){let o=Pie(i,e,r);if(o!==0)return o;t=t||i.field.isKeyField()}return 0}}function Pie(n,e,r){let t=n.field.isKeyField()?ie.comparator(e.key,r.key):(function(o,s,a){let c=s.data.field(o),l=a.data.field(o);return c!==null&&l!==null?ja(c,l):ae(42886)})(n.field,e,r);switch(n.dir){case"asc":return t;case"desc":return-1*t;default:return ae(19790,{direction:n.dir})}}var qi=class{constructor(e,r){this.mapKeyFn=e,this.equalsFn=r,this.inner={},this.innerSize=0}get(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t!==void 0){for(let[i,o]of t)if(this.equalsFn(i,e))return o}}has(e){return this.get(e)!==void 0}set(e,r){let t=this.mapKeyFn(e),i=this.inner[t];if(i===void 0)return this.inner[t]=[[e,r]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],e))return void(i[o]=[e,r]);i.push([e,r]),this.innerSize++}delete(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t===void 0)return!1;for(let i=0;i<t.length;i++)if(this.equalsFn(t[i][0],e))return t.length===1?delete this.inner[r]:t.splice(i,1),this.innerSize--,!0;return!1}forEach(e){Xa(this.inner,(r,t)=>{for(let[i,o]of t)e(i,o)})}isEmpty(){return VH(this.inner)}size(){return this.innerSize}};var xie=new Dt(ie.comparator);function Yr(){return xie}var iW=new Dt(ie.comparator);function bm(...n){let e=iW;for(let r of n)e=e.insert(r.key,r);return e}function oW(n){let e=iW;return n.forEach((r,t)=>e=e.insert(r,t.overlayedDocument)),e}function Bo(){return Um()}function sW(){return Um()}function Um(){return new qi(n=>n.toString(),(n,e)=>n.isEqual(e))}var Fie=new Dt(ie.comparator),kie=new at(ie.comparator);function Ue(...n){let e=kie;for(let r of n)e=e.add(r);return e}var Uie=new at(De);function aM(){return Uie}function cM(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Hm(e)?"-0":e}}function aW(n){return{integerValue:""+n}}function Vie(n,e){return NH(e)?aW(e):cM(n,e)}var Dh=class{constructor(){this._=void 0}};function Bie(n,e,r){return n instanceof zl?(function(i,o){let s={fields:{[GH]:{stringValue:BH},[jH]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&Ly(o)&&(o=My(o)),o&&(s.fields[$H]=o),{mapValue:s}})(r,e):n instanceof Ha?lW(n,e):n instanceof Wa?uW(n,e):(function(i,o){let s=cW(i,o),a=Nj(s)+Nj(i.Ee);return ib(s)&&ib(i.Ee)?aW(a):cM(i.serializer,a)})(n,e)}function Gie(n,e,r){return n instanceof Ha?lW(n,e):n instanceof Wa?uW(n,e):r}function cW(n,e){return n instanceof ql?(function(t){return ib(t)||(function(o){return!!o&&"doubleValue"in o})(t)})(e)?e:{integerValue:0}:null}var zl=class extends Dh{},Ha=class extends Dh{constructor(e){super(),this.elements=e}};function lW(n,e){let r=dW(e);for(let t of n.elements)r.some(i=>$o(i,t))||r.push(t);return{arrayValue:{values:r}}}var Wa=class extends Dh{constructor(e){super(),this.elements=e}};function uW(n,e){let r=dW(e);for(let t of n.elements)r=r.filter(i=>!$o(i,t));return{arrayValue:{values:r}}}var ql=class extends Dh{constructor(e,r){super(),this.serializer=e,this.Ee=r}};function Nj(n){return Mt(n.integerValue||n.doubleValue)}function dW(n){return Jm(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}var pb=class{constructor(e,r){this.field=e,this.transform=r}};function $ie(n,e){return n.field.isEqual(e.field)&&(function(t,i){return t instanceof Ha&&i instanceof Ha||t instanceof Wa&&i instanceof Wa?fh(t.elements,i.elements,$o):t instanceof ql&&i instanceof ql?$o(t.Ee,i.Ee):t instanceof zl&&i instanceof zl})(n.transform,e.transform)}var Eb=class{constructor(e,r){this.version=e,this.transformResults=r}},Gn=class n{constructor(e,r){this.updateTime=e,this.exists=r}static none(){return new n}static exists(e){return new n(void 0,e)}static updateTime(e){return new n(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function Ov(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}var Rh=class{};function hW(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Kl(n.key,Gn.none()):new za(n.key,n.data,Gn.none());{let r=n.data,t=tr.empty(),i=new at(Tn.comparator);for(let o of e.fields)if(!i.has(o)){let s=r.field(o);s===null&&o.length>1&&(o=o.popLast(),s=r.field(o)),s===null?t.delete(o):t.set(o,s),i=i.add(o)}return new Ki(n.key,t,new Kr(i.toArray()),Gn.none())}}function jie(n,e,r){n instanceof za?(function(i,o,s){let a=i.value.clone(),c=wj(i.fieldTransforms,o,s.transformResults);a.setAll(c),o.convertToFoundDocument(s.version,a).setHasCommittedMutations()})(n,e,r):n instanceof Ki?(function(i,o,s){if(!Ov(i.precondition,o))return void o.convertToUnknownDocument(s.version);let a=wj(i.fieldTransforms,o,s.transformResults),c=o.data;c.setAll(fW(i)),c.setAll(a),o.convertToFoundDocument(s.version,c).setHasCommittedMutations()})(n,e,r):(function(i,o,s){o.convertToNoDocument(s.version).setHasCommittedMutations()})(0,e,r)}function Vm(n,e,r,t){return n instanceof za?(function(o,s,a,c){if(!Ov(o.precondition,s))return a;let l=o.value.clone(),u=bj(o.fieldTransforms,c,s);return l.setAll(u),s.convertToFoundDocument(s.version,l).setHasLocalMutations(),null})(n,e,r,t):n instanceof Ki?(function(o,s,a,c){if(!Ov(o.precondition,s))return a;let l=bj(o.fieldTransforms,c,s),u=s.data;return u.setAll(fW(o)),u.setAll(l),s.convertToFoundDocument(s.version,u).setHasLocalMutations(),a===null?null:a.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map(d=>d.field))})(n,e,r,t):(function(o,s,a){return Ov(o.precondition,s)?(s.convertToNoDocument(s.version).setHasLocalMutations(),null):a})(n,e,r)}function Hie(n,e){let r=null;for(let t of n.fieldTransforms){let i=e.data.field(t.field),o=cW(t.transform,i||null);o!=null&&(r===null&&(r=tr.empty()),r.set(t.field,o))}return r||null}function Oj(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!(function(t,i){return t===void 0&&i===void 0||!(!t||!i)&&fh(t,i,(o,s)=>$ie(o,s))})(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}var za=class extends Rh{constructor(e,r,t,i=[]){super(),this.key=e,this.value=r,this.precondition=t,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},Ki=class extends Rh{constructor(e,r,t,i,o=[]){super(),this.key=e,this.data=r,this.fieldMask=t,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}};function fW(n){let e=new Map;return n.fieldMask.fields.forEach(r=>{if(!r.isEmpty()){let t=n.data.field(r);e.set(r,t)}}),e}function wj(n,e,r){let t=new Map;he(n.length===r.length,32656,{Ae:r.length,Re:n.length});for(let i=0;i<r.length;i++){let o=n[i],s=o.transform,a=e.data.field(o.field);t.set(o.field,Gie(s,a,r[i]))}return t}function bj(n,e,r){let t=new Map;for(let i of n){let o=i.transform,s=r.data.field(i.field);t.set(i.field,Bie(o,s,e))}return t}var Kl=class extends Rh{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Zm=class extends Rh{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var ep=class{constructor(e,r,t,i){this.batchId=e,this.localWriteTime=r,this.baseMutations=t,this.mutations=i}applyToRemoteDocument(e,r){let t=r.mutationResults;for(let i=0;i<this.mutations.length;i++){let o=this.mutations[i];o.key.isEqual(e.key)&&jie(o,e,t[i])}}applyToLocalView(e,r){for(let t of this.baseMutations)t.key.isEqual(e.key)&&(r=Vm(t,e,r,this.localWriteTime));for(let t of this.mutations)t.key.isEqual(e.key)&&(r=Vm(t,e,r,this.localWriteTime));return r}applyToLocalDocumentSet(e,r){let t=sW();return this.mutations.forEach(i=>{let o=e.get(i.key),s=o.overlayedDocument,a=this.applyToLocalView(s,o.mutatedFields);a=r.has(i.key)?null:a;let c=hW(s,a);c!==null&&t.set(i.key,c),s.isValidDocument()||s.convertToNoDocument(me.min())}),t}keys(){return this.mutations.reduce((e,r)=>e.add(r.key),Ue())}isEqual(e){return this.batchId===e.batchId&&fh(this.mutations,e.mutations,(r,t)=>Oj(r,t))&&fh(this.baseMutations,e.baseMutations,(r,t)=>Oj(r,t))}},_b=class n{constructor(e,r,t,i){this.batch=e,this.commitVersion=r,this.mutationResults=t,this.docVersions=i}static from(e,r,t){he(e.mutations.length===t.length,58842,{Ve:e.mutations.length,me:t.length});let i=(function(){return Fie})(),o=e.mutations;for(let s=0;s<o.length;s++)i=i.insert(o[s].key,t[s].version);return new n(e,r,t,i)}};var tp=class{constructor(e,r){this.largestBatchId=e,this.mutation=r}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
155
+ largestBatchId: ${this.largestBatchId},
156
+ mutation: ${this.mutation.toString()}
157
+ }`}};var Tb=class{constructor(e,r,t){this.alias=e,this.aggregateType=r,this.fieldPath=t}};var Ib=class{constructor(e,r){this.count=e,this.unchangedNames=r}};var sn,He;function gW(n){switch(n){case j.OK:return ae(64938);case j.CANCELLED:case j.UNKNOWN:case j.DEADLINE_EXCEEDED:case j.RESOURCE_EXHAUSTED:case j.INTERNAL:case j.UNAVAILABLE:case j.UNAUTHENTICATED:return!1;case j.INVALID_ARGUMENT:case j.NOT_FOUND:case j.ALREADY_EXISTS:case j.PERMISSION_DENIED:case j.FAILED_PRECONDITION:case j.ABORTED:case j.OUT_OF_RANGE:case j.UNIMPLEMENTED:case j.DATA_LOSS:return!0;default:return ae(15467,{code:n})}}function mW(n){if(n===void 0)return Xt("GRPC error has no .code"),j.UNKNOWN;switch(n){case sn.OK:return j.OK;case sn.CANCELLED:return j.CANCELLED;case sn.UNKNOWN:return j.UNKNOWN;case sn.DEADLINE_EXCEEDED:return j.DEADLINE_EXCEEDED;case sn.RESOURCE_EXHAUSTED:return j.RESOURCE_EXHAUSTED;case sn.INTERNAL:return j.INTERNAL;case sn.UNAVAILABLE:return j.UNAVAILABLE;case sn.UNAUTHENTICATED:return j.UNAUTHENTICATED;case sn.INVALID_ARGUMENT:return j.INVALID_ARGUMENT;case sn.NOT_FOUND:return j.NOT_FOUND;case sn.ALREADY_EXISTS:return j.ALREADY_EXISTS;case sn.PERMISSION_DENIED:return j.PERMISSION_DENIED;case sn.FAILED_PRECONDITION:return j.FAILED_PRECONDITION;case sn.ABORTED:return j.ABORTED;case sn.OUT_OF_RANGE:return j.OUT_OF_RANGE;case sn.UNIMPLEMENTED:return j.UNIMPLEMENTED;case sn.DATA_LOSS:return j.DATA_LOSS;default:return ae(39323,{code:n})}}(He=sn||(sn={}))[He.OK=0]="OK",He[He.CANCELLED=1]="CANCELLED",He[He.UNKNOWN=2]="UNKNOWN",He[He.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",He[He.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",He[He.NOT_FOUND=5]="NOT_FOUND",He[He.ALREADY_EXISTS=6]="ALREADY_EXISTS",He[He.PERMISSION_DENIED=7]="PERMISSION_DENIED",He[He.UNAUTHENTICATED=16]="UNAUTHENTICATED",He[He.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",He[He.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",He[He.ABORTED=10]="ABORTED",He[He.OUT_OF_RANGE=11]="OUT_OF_RANGE",He[He.UNIMPLEMENTED=12]="UNIMPLEMENTED",He[He.INTERNAL=13]="INTERNAL",He[He.UNAVAILABLE=14]="UNAVAILABLE",He[He.DATA_LOSS=15]="DATA_LOSS";var Lj=null;var Wie=new As([4294967295,4294967295],0);function Mj(n){let e=vH().encode(n),r=new Nw;return r.update(e),new Uint8Array(r.digest())}function Pj(n){let e=new DataView(n.buffer),r=e.getUint32(0,!0),t=e.getUint32(4,!0),i=e.getUint32(8,!0),o=e.getUint32(12,!0);return[new As([r,t],0),new As([i,o],0)]}var vb=class n{constructor(e,r,t){if(this.bitmap=e,this.padding=r,this.hashCount=t,r<0||r>=8)throw new Ul(`Invalid padding: ${r}`);if(t<0)throw new Ul(`Invalid hash count: ${t}`);if(e.length>0&&this.hashCount===0)throw new Ul(`Invalid hash count: ${t}`);if(e.length===0&&r!==0)throw new Ul(`Invalid padding when bitmap length is 0: ${r}`);this.fe=8*e.length-r,this.ge=As.fromNumber(this.fe)}pe(e,r,t){let i=e.add(r.multiply(As.fromNumber(t)));return i.compare(Wie)===1&&(i=new As([i.getBits(0),i.getBits(1)],0)),i.modulo(this.ge).toNumber()}ye(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.fe===0)return!1;let r=Mj(e),[t,i]=Pj(r);for(let o=0;o<this.hashCount;o++){let s=this.pe(t,i,o);if(!this.ye(s))return!1}return!0}static create(e,r,t){let i=e%8==0?0:8-e%8,o=new Uint8Array(Math.ceil(e/8)),s=new n(o,i,r);return t.forEach(a=>s.insert(a)),s}insert(e){if(this.fe===0)return;let r=Mj(e),[t,i]=Pj(r);for(let o=0;o<this.hashCount;o++){let s=this.pe(t,i,o);this.we(s)}}we(e){let r=Math.floor(e/8),t=e%8;this.bitmap[r]|=1<<t}},Ul=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var np=class n{constructor(e,r,t,i,o){this.snapshotVersion=e,this.targetChanges=r,this.targetMismatches=t,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,r,t){let i=new Map;return i.set(e,rp.createSynthesizedTargetChangeForCurrentChange(e,r,t)),new n(me.min(),i,new Dt(De),Yr(),Ue())}},rp=class n{constructor(e,r,t,i,o){this.resumeToken=e,this.current=r,this.addedDocuments=t,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(e,r,t){return new n(t,r,Ue(),Ue(),Ue())}};var dh=class{constructor(e,r,t,i){this.Se=e,this.removedTargetIds=r,this.key=t,this.be=i}},qv=class{constructor(e,r){this.targetId=e,this.De=r}},Kv=class{constructor(e,r,t=un.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=r,this.resumeToken=t,this.cause=i}},Yv=class{constructor(){this.ve=0,this.Ce=xj(),this.Fe=un.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return this.ve!==0}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=Ue(),r=Ue(),t=Ue();return this.Ce.forEach((i,o)=>{switch(o){case 0:e=e.add(i);break;case 2:r=r.add(i);break;case 1:t=t.add(i);break;default:ae(38017,{changeType:o})}}),new rp(this.Fe,this.Me,e,r,t)}ke(){this.xe=!1,this.Ce=xj()}qe(e,r){this.xe=!0,this.Ce=this.Ce.insert(e,r)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,he(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}},yb=class{constructor(e){this.We=e,this.Ge=new Map,this.ze=Yr(),this.je=Tv(),this.Je=Tv(),this.He=new Dt(De)}Ye(e){for(let r of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(r,e.be):this.Xe(r,e.key,e.be);for(let r of e.removedTargetIds)this.Xe(r,e.key,e.be)}et(e){this.forEachTarget(e,r=>{let t=this.tt(r);switch(e.state){case 0:this.nt(r)&&t.Be(e.resumeToken);break;case 1:t.Ue(),t.Oe||t.ke(),t.Be(e.resumeToken);break;case 2:t.Ue(),t.Oe||this.removeTarget(r);break;case 3:this.nt(r)&&(t.Ke(),t.Be(e.resumeToken));break;case 4:this.nt(r)&&(this.rt(r),t.Be(e.resumeToken));break;default:ae(56790,{state:e.state})}})}forEachTarget(e,r){e.targetIds.length>0?e.targetIds.forEach(r):this.Ge.forEach((t,i)=>{this.nt(i)&&r(i)})}it(e){let r=e.targetId,t=e.De.count,i=this.st(r);if(i){let o=i.target;if(Hv(o))if(t===0){let s=new ie(o.path);this.Xe(r,s,In.newNoDocument(s,me.min()))}else he(t===1,20013,{expectedCount:t});else{let s=this.ot(r);if(s!==t){let a=this._t(e),c=a?this.ut(a,e,s):1;if(c!==0){this.rt(r);let l=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(r,l)}Lj?.ct((function(u,d,f,g,p){var _,T,S,b,B,x;let U={localCacheCount:u,existenceFilterCount:d.count,databaseId:f.database,projectId:f.projectId},$=d.unchangedNames;return $&&(U.bloomFilter={applied:p===0,hashCount:(_=$?.hashCount)!==null&&_!==void 0?_:0,bitmapLength:(b=(S=(T=$?.bits)===null||T===void 0?void 0:T.bitmap)===null||S===void 0?void 0:S.length)!==null&&b!==void 0?b:0,padding:(x=(B=$?.bits)===null||B===void 0?void 0:B.padding)!==null&&x!==void 0?x:0,mightContain:A=>{var D;return(D=g?.mightContain(A))!==null&&D!==void 0&&D}}),U})(s,e.De,this.We.lt(),a,c))}}}}_t(e){let r=e.De.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:t="",padding:i=0},hashCount:o=0}=r,s,a;try{s=bs(t).toUint8Array()}catch(c){if(c instanceof Gv)return Os("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new vb(s,i,o)}catch(c){return Os(c instanceof Ul?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.fe===0?null:a}ut(e,r,t){return r.De.count===t-this.ht(e,r.targetId)?0:2}ht(e,r){let t=this.We.getRemoteKeysForTarget(r),i=0;return t.forEach(o=>{let s=this.We.lt(),a=`projects/${s.projectId}/databases/${s.database}/documents/${o.path.canonicalString()}`;e.mightContain(a)||(this.Xe(r,o,null),i++)}),i}Pt(e){let r=new Map;this.Ge.forEach((o,s)=>{let a=this.st(s);if(a){if(o.current&&Hv(a.target)){let c=new ie(a.target.path);this.Tt(c).has(s)||this.It(s,c)||this.Xe(s,c,In.newNoDocument(c,e))}o.Ne&&(r.set(s,o.Le()),o.ke())}});let t=Ue();this.Je.forEach((o,s)=>{let a=!0;s.forEachWhile(c=>{let l=this.st(c);return!l||l.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(t=t.add(o))}),this.ze.forEach((o,s)=>s.setReadTime(e));let i=new np(e,r,this.He,this.ze,t);return this.ze=Yr(),this.je=Tv(),this.Je=Tv(),this.He=new Dt(De),i}Ze(e,r){if(!this.nt(e))return;let t=this.It(e,r.key)?2:0;this.tt(e).qe(r.key,t),this.ze=this.ze.insert(r.key,r),this.je=this.je.insert(r.key,this.Tt(r.key).add(e)),this.Je=this.Je.insert(r.key,this.dt(r.key).add(e))}Xe(e,r,t){if(!this.nt(e))return;let i=this.tt(e);this.It(e,r)?i.qe(r,1):i.Qe(r),this.Je=this.Je.insert(r,this.dt(r).delete(e)),this.Je=this.Je.insert(r,this.dt(r).add(e)),t&&(this.ze=this.ze.insert(r,t))}removeTarget(e){this.Ge.delete(e)}ot(e){let r=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let r=this.Ge.get(e);return r||(r=new Yv,this.Ge.set(e,r)),r}dt(e){let r=this.Je.get(e);return r||(r=new at(De),this.Je=this.Je.insert(e,r)),r}Tt(e){let r=this.je.get(e);return r||(r=new at(De),this.je=this.je.insert(e,r)),r}nt(e){let r=this.st(e)!==null;return r||X("WatchChangeAggregator","Detected inactive target",e),r}st(e){let r=this.Ge.get(e);return r&&r.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new Yv),this.We.getRemoteKeysForTarget(e).forEach(r=>{this.Xe(e,r,null)})}It(e,r){return this.We.getRemoteKeysForTarget(e).has(r)}};function Tv(){return new Dt(ie.comparator)}function xj(){return new Dt(ie.comparator)}var zie={asc:"ASCENDING",desc:"DESCENDING"},qie={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Kie={and:"AND",or:"OR"},Sb=class{constructor(e,r){this.databaseId=e,this.useProto3Json=r}};function Ab(n,e){return n.useProto3Json||Ep(e)?e:{value:e}}function Ch(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function pW(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function Yie(n,e){return Ch(n,e.toTimestamp())}function Ln(n){return he(!!n,49232),me.fromTimestamp((function(r){let t=ws(r);return new Pt(t.seconds,t.nanos)})(n))}function lM(n,e){return Db(n,e).canonicalString()}function Db(n,e){let r=(function(i){return new We(["projects",i.projectId,"databases",i.database])})(n).child("documents");return e===void 0?r:r.child(e)}function EW(n){let e=We.fromString(n);return he(DW(e),10190,{key:e.toString()}),e}function ip(n,e){return lM(n.databaseId,e.path)}function Cs(n,e){let r=EW(e);if(r.get(1)!==n.databaseId.projectId)throw new Q(j.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+n.databaseId.projectId);if(r.get(3)!==n.databaseId.database)throw new Q(j.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+n.databaseId.database);return new ie(IW(r))}function _W(n,e){return lM(n.databaseId,e)}function TW(n){let e=EW(n);return e.length===4?We.emptyPath():IW(e)}function Rb(n){return new We(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function IW(n){return he(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function Fj(n,e,r){return{name:ip(n,e),fields:r.value.mapValue.fields}}function Qie(n,e,r){let t=Cs(n,e.name),i=Ln(e.updateTime),o=e.createTime?Ln(e.createTime):me.min(),s=new tr({mapValue:{fields:e.fields}}),a=In.newFoundDocument(t,i,o,s);return r&&a.setHasCommittedMutations(),r?a.setHasCommittedMutations():a}function Xie(n,e){return"found"in e?(function(t,i){he(!!i.found,43571),i.found.name,i.found.updateTime;let o=Cs(t,i.found.name),s=Ln(i.found.updateTime),a=i.found.createTime?Ln(i.found.createTime):me.min(),c=new tr({mapValue:{fields:i.found.fields}});return In.newFoundDocument(o,s,a,c)})(n,e):"missing"in e?(function(t,i){he(!!i.missing,3894),he(!!i.readTime,22933);let o=Cs(t,i.missing),s=Ln(i.readTime);return In.newNoDocument(o,s)})(n,e):ae(7234,{result:e})}function Jie(n,e){let r;if("targetChange"in e){e.targetChange;let t=(function(l){return l==="NO_CHANGE"?0:l==="ADD"?1:l==="REMOVE"?2:l==="CURRENT"?3:l==="RESET"?4:ae(39313,{state:l})})(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=(function(l,u){return l.useProto3Json?(he(u===void 0||typeof u=="string",58123),un.fromBase64String(u||"")):(he(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),un.fromUint8Array(u||new Uint8Array))})(n,e.targetChange.resumeToken),s=e.targetChange.cause,a=s&&(function(l){let u=l.code===void 0?j.UNKNOWN:mW(l.code);return new Q(u,l.message||"")})(s);r=new Kv(t,i,o,a||null)}else if("documentChange"in e){e.documentChange;let t=e.documentChange;t.document,t.document.name,t.document.updateTime;let i=Cs(n,t.document.name),o=Ln(t.document.updateTime),s=t.document.createTime?Ln(t.document.createTime):me.min(),a=new tr({mapValue:{fields:t.document.fields}}),c=In.newFoundDocument(i,o,s,a),l=t.targetIds||[],u=t.removedTargetIds||[];r=new dh(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;let t=e.documentDelete;t.document;let i=Cs(n,t.document),o=t.readTime?Ln(t.readTime):me.min(),s=In.newNoDocument(i,o),a=t.removedTargetIds||[];r=new dh([],a,s.key,s)}else if("documentRemove"in e){e.documentRemove;let t=e.documentRemove;t.document;let i=Cs(n,t.document),o=t.removedTargetIds||[];r=new dh([],o,i,null)}else{if(!("filter"in e))return ae(11601,{At:e});{e.filter;let t=e.filter;t.targetId;let{count:i=0,unchangedNames:o}=t,s=new Ib(i,o),a=t.targetId;r=new qv(a,s)}}return r}function op(n,e){let r;if(e instanceof za)r={update:Fj(n,e.key,e.value)};else if(e instanceof Kl)r={delete:ip(n,e.key)};else if(e instanceof Ki)r={update:Fj(n,e.key,e.data),updateMask:ooe(e.fieldMask)};else{if(!(e instanceof Zm))return ae(16599,{Rt:e.type});r={verify:ip(n,e.key)}}return e.fieldTransforms.length>0&&(r.updateTransforms=e.fieldTransforms.map(t=>(function(o,s){let a=s.transform;if(a instanceof zl)return{fieldPath:s.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Ha)return{fieldPath:s.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Wa)return{fieldPath:s.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof ql)return{fieldPath:s.field.canonicalString(),increment:a.Ee};throw ae(20930,{transform:s.transform})})(0,t))),e.precondition.isNone||(r.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:Yie(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:ae(27497)})(n,e.precondition)),r}function Cb(n,e){let r=e.currentDocument?(function(o){return o.updateTime!==void 0?Gn.updateTime(Ln(o.updateTime)):o.exists!==void 0?Gn.exists(o.exists):Gn.none()})(e.currentDocument):Gn.none(),t=e.updateTransforms?e.updateTransforms.map(i=>(function(s,a){let c=null;if("setToServerValue"in a)he(a.setToServerValue==="REQUEST_TIME",16630,{proto:a}),c=new zl;else if("appendMissingElements"in a){let u=a.appendMissingElements.values||[];c=new Ha(u)}else if("removeAllFromArray"in a){let u=a.removeAllFromArray.values||[];c=new Wa(u)}else"increment"in a?c=new ql(s,a.increment):ae(16584,{proto:a});let l=Tn.fromServerFormat(a.fieldPath);return new pb(l,c)})(n,i)):[];if(e.update){e.update.name;let i=Cs(n,e.update.name),o=new tr({mapValue:{fields:e.update.fields}});if(e.updateMask){let s=(function(c){let l=c.fieldPaths||[];return new Kr(l.map(u=>Tn.fromServerFormat(u)))})(e.updateMask);return new Ki(i,o,s,r,t)}return new za(i,o,r,t)}if(e.delete){let i=Cs(n,e.delete);return new Kl(i,r)}if(e.verify){let i=Cs(n,e.verify);return new Zm(i,r)}return ae(1463,{proto:e})}function Zie(n,e){return n&&n.length>0?(he(e!==void 0,14353),n.map(r=>(function(i,o){let s=i.updateTime?Ln(i.updateTime):Ln(o);return s.isEqual(me.min())&&(s=Ln(o)),new Eb(s,i.transformResults||[])})(r,e))):[]}function vW(n,e){return{documents:[_W(n,e.path)]}}function uM(n,e){let r={structuredQuery:{}},t=e.path,i;e.collectionGroup!==null?(i=t,r.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=t.popLast(),r.structuredQuery.from=[{collectionId:t.lastSegment()}]),r.parent=_W(n,i);let o=(function(l){if(l.length!==0)return AW(nt.create(l,"and"))})(e.filters);o&&(r.structuredQuery.where=o);let s=(function(l){if(l.length!==0)return l.map(u=>(function(f){return{field:Ma(f.field),direction:noe(f.dir)}})(u))})(e.orderBy);s&&(r.structuredQuery.orderBy=s);let a=Ab(n,e.limit);return a!==null&&(r.structuredQuery.limit=a),e.startAt&&(r.structuredQuery.startAt=(function(l){return{before:l.inclusive,values:l.position}})(e.startAt)),e.endAt&&(r.structuredQuery.endAt=(function(l){return{before:!l.inclusive,values:l.position}})(e.endAt)),{Vt:r,parent:i}}function eoe(n,e,r,t){let{Vt:i,parent:o}=uM(n,e),s={},a=[],c=0;return r.forEach(l=>{let u=t?l.alias:"aggregate_"+c++;s[u]=l.alias,l.aggregateType==="count"?a.push({alias:u,count:{}}):l.aggregateType==="avg"?a.push({alias:u,avg:{field:Ma(l.fieldPath)}}):l.aggregateType==="sum"&&a.push({alias:u,sum:{field:Ma(l.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:a,structuredQuery:i.structuredQuery},parent:i.parent},ft:s,parent:o}}function yW(n){let e=TW(n.parent),r=n.structuredQuery,t=r.from?r.from.length:0,i=null;if(t>0){he(t===1,65062);let u=r.from[0];u.allDescendants?i=u.collectionId:e=e.child(u.collectionId)}let o=[];r.where&&(o=(function(d){let f=SW(d);return f instanceof nt&&oM(f)?f.getFilters():[f]})(r.where));let s=[];r.orderBy&&(s=(function(d){return d.map(f=>(function(p){return new Hl(sh(p.field),(function(T){switch(T){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(p.direction))})(f))})(r.orderBy));let a=null;r.limit&&(a=(function(d){let f;return f=typeof d=="object"?d.value:d,Ep(f)?null:f})(r.limit));let c=null;r.startAt&&(c=(function(d){let f=!!d.before,g=d.values||[];return new jo(g,f)})(r.startAt));let l=null;return r.endAt&&(l=(function(d){let f=!d.before,g=d.values||[];return new jo(g,f)})(r.endAt)),ZH(e,i,s,o,a,"F",c,l)}function toe(n,e){let r=(function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ae(28987,{purpose:i})}})(e.purpose);return r==null?null:{"goog-listen-tags":r}}function SW(n){return n.unaryFilter!==void 0?(function(r){switch(r.unaryFilter.op){case"IS_NAN":let t=sh(r.unaryFilter.field);return $e.create(t,"==",{doubleValue:NaN});case"IS_NULL":let i=sh(r.unaryFilter.field);return $e.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let o=sh(r.unaryFilter.field);return $e.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let s=sh(r.unaryFilter.field);return $e.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ae(61313);default:return ae(60726)}})(n):n.fieldFilter!==void 0?(function(r){return $e.create(sh(r.fieldFilter.field),(function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return ae(58110);default:return ae(50506)}})(r.fieldFilter.op),r.fieldFilter.value)})(n):n.compositeFilter!==void 0?(function(r){return nt.create(r.compositeFilter.filters.map(t=>SW(t)),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return ae(1026)}})(r.compositeFilter.op))})(n):ae(30097,{filter:n})}function noe(n){return zie[n]}function roe(n){return qie[n]}function ioe(n){return Kie[n]}function Ma(n){return{fieldPath:n.canonicalString()}}function sh(n){return Tn.fromServerFormat(n.fieldPath)}function AW(n){return n instanceof $e?(function(r){if(r.op==="=="){if(Ij(r.value))return{unaryFilter:{field:Ma(r.field),op:"IS_NAN"}};if(Tj(r.value))return{unaryFilter:{field:Ma(r.field),op:"IS_NULL"}}}else if(r.op==="!="){if(Ij(r.value))return{unaryFilter:{field:Ma(r.field),op:"IS_NOT_NAN"}};if(Tj(r.value))return{unaryFilter:{field:Ma(r.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Ma(r.field),op:roe(r.op),value:r.value}}})(n):n instanceof nt?(function(r){let t=r.getFilters().map(i=>AW(i));return t.length===1?t[0]:{compositeFilter:{op:ioe(r.op),filters:t}}})(n):ae(54877,{filter:n})}function ooe(n){let e=[];return n.fields.forEach(r=>e.push(r.canonicalString())),{fieldPaths:e}}function DW(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}var Nh=class n{constructor(e,r,t,i,o=me.min(),s=me.min(),a=un.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=r,this.purpose=t,this.sequenceNumber=i,this.snapshotVersion=o,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new n(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,r){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,r,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var Qv=class{constructor(e){this.gt=e}};function soe(n,e){let r;if(e.document)r=Qie(n.gt,e.document,!!e.hasCommittedMutations);else if(e.noDocument){let t=ie.fromSegments(e.noDocument.path),i=Ql(e.noDocument.readTime);r=In.newNoDocument(t,i),e.hasCommittedMutations&&r.setHasCommittedMutations()}else{if(!e.unknownDocument)return ae(56709);{let t=ie.fromSegments(e.unknownDocument.path),i=Ql(e.unknownDocument.version);r=In.newUnknownDocument(t,i)}}return e.readTime&&r.setReadTime((function(i){let o=new Pt(i[0],i[1]);return me.fromTimestamp(o)})(e.readTime)),r}function kj(n,e){let r=e.key,t={prefixPath:r.getCollectionPath().popLast().toArray(),collectionGroup:r.collectionGroup,documentId:r.path.lastSegment(),readTime:Xv(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())t.document=(function(o,s){return{name:ip(o,s.key),fields:s.data.value.mapValue.fields,updateTime:Ch(o,s.version.toTimestamp()),createTime:Ch(o,s.createTime.toTimestamp())}})(n.gt,e);else if(e.isNoDocument())t.noDocument={path:r.path.toArray(),readTime:Yl(e.version)};else{if(!e.isUnknownDocument())return ae(57904,{document:e});t.unknownDocument={path:r.path.toArray(),version:Yl(e.version)}}return t}function Xv(n){let e=n.toTimestamp();return[e.seconds,e.nanoseconds]}function Yl(n){let e=n.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function Ql(n){let e=new Pt(n.seconds,n.nanoseconds);return me.fromTimestamp(e)}function Pl(n,e){let r=(e.baseMutations||[]).map(o=>Cb(n.gt,o));for(let o=0;o<e.mutations.length-1;++o){let s=e.mutations[o];if(o+1<e.mutations.length&&e.mutations[o+1].transform!==void 0){let a=e.mutations[o+1];s.updateTransforms=a.transform.fieldTransforms,e.mutations.splice(o+1,1),++o}}let t=e.mutations.map(o=>Cb(n.gt,o)),i=Pt.fromMillis(e.localWriteTimeMs);return new ep(e.batchId,i,r,t)}function Lm(n){let e=Ql(n.readTime),r=n.lastLimboFreeSnapshotVersion!==void 0?Ql(n.lastLimboFreeSnapshotVersion):me.min(),t;return t=(function(o){return o.documents!==void 0})(n.query)?(function(o){let s=o.documents.length;return he(s===1,1966,{count:s}),Qr(Ip(TW(o.documents[0])))})(n.query):(function(o){return Qr(yW(o))})(n.query),new Nh(t,n.targetId,"TargetPurposeListen",n.lastListenSequenceNumber,e,r,un.fromBase64String(n.resumeToken))}function RW(n,e){let r=Yl(e.snapshotVersion),t=Yl(e.lastLimboFreeSnapshotVersion),i;i=Hv(e.target)?vW(n.gt,e.target):uM(n.gt,e.target).Vt;let o=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:Wl(e.target),readTime:r,resumeToken:o,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:t,query:i}}function CW(n){let e=yW({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?zv(e,e.limit,"L"):e}function Pw(n,e){return new tp(e.largestBatchId,Cb(n.gt,e.overlayMutation))}function Uj(n,e){let r=e.path.lastSegment();return[n,nr(e.path.popLast()),r]}function Vj(n,e,r,t){return{indexId:n,uid:e,sequenceNumber:r,readTime:Yl(t.readTime),documentKey:nr(t.documentKey.path),largestBatchId:t.largestBatchId}}var Nb=class{getBundleMetadata(e,r){return Bj(e).get(r).next(t=>{if(t)return(function(o){return{id:o.bundleId,createTime:Ql(o.createTime),version:o.version}})(t)})}saveBundleMetadata(e,r){return Bj(e).put((function(i){return{bundleId:i.id,createTime:Yl(Ln(i.createTime)),version:i.version}})(r))}getNamedQuery(e,r){return Gj(e).get(r).next(t=>{if(t)return(function(o){return{name:o.name,query:CW(o.bundledQuery),readTime:Ql(o.readTime)}})(t)})}saveNamedQuery(e,r){return Gj(e).put((function(i){return{name:i.name,readTime:Yl(Ln(i.readTime)),bundledQuery:i.bundledQuery}})(r))}};function Bj(n){return yn(n,Oy)}function Gj(n){return yn(n,wy)}var Jv=class n{constructor(e,r){this.serializer=e,this.userId=r}static yt(e,r){let t=r.uid||"";return new n(e,t)}getOverlay(e,r){return Cm(e).get(Uj(this.userId,r)).next(t=>t?Pw(this.serializer,t):null)}getOverlays(e,r){let t=Bo();return V.forEach(r,i=>this.getOverlay(e,i).next(o=>{o!==null&&t.set(i,o)})).next(()=>t)}saveOverlays(e,r,t){let i=[];return t.forEach((o,s)=>{let a=new tp(r,s);i.push(this.wt(e,a))}),V.waitFor(i)}removeOverlaysForBatchId(e,r,t){let i=new Set;r.forEach(s=>i.add(nr(s.getCollectionPath())));let o=[];return i.forEach(s=>{let a=IDBKeyRange.bound([this.userId,s,t],[this.userId,s,t+1],!1,!0);o.push(Cm(e).Y(tb,a))}),V.waitFor(o)}getOverlaysForCollection(e,r,t){let i=Bo(),o=nr(r),s=IDBKeyRange.bound([this.userId,o,t],[this.userId,o,Number.POSITIVE_INFINITY],!0);return Cm(e).j(tb,s).next(a=>{for(let c of a){let l=Pw(this.serializer,c);i.set(l.getKey(),l)}return i})}getOverlaysForCollectionGroup(e,r,t,i){let o=Bo(),s,a=IDBKeyRange.bound([this.userId,r,t],[this.userId,r,Number.POSITIVE_INFINITY],!0);return Cm(e).X({index:PH,range:a},(c,l,u)=>{let d=Pw(this.serializer,l);o.size()<i||d.largestBatchId===s?(o.set(d.getKey(),d),s=d.largestBatchId):u.done()}).next(()=>o)}wt(e,r){return Cm(e).put((function(i,o,s){let[a,c,l]=Uj(o,s.mutation.key);return{userId:o,collectionPath:c,documentId:l,collectionGroup:s.mutation.key.getCollectionGroup(),largestBatchId:s.largestBatchId,overlayMutation:op(i.gt,s.mutation)}})(this.serializer,this.userId,r))}};function Cm(n){return yn(n,by)}var Ob=class{St(e){return yn(e,tM)}getSessionToken(e){return this.St(e).get("sessionToken").next(r=>{let t=r?.value;return t?un.fromUint8Array(t):un.EMPTY_BYTE_STRING})}setSessionToken(e,r){return this.St(e).put({name:"sessionToken",value:r.toUint8Array()})}};var Rs=class{constructor(){}bt(e,r){this.Dt(e,r),r.vt()}Dt(e,r){if("nullValue"in e)this.Ct(r,5);else if("booleanValue"in e)this.Ct(r,10),r.Ft(e.booleanValue?1:0);else if("integerValue"in e)this.Ct(r,15),r.Ft(Mt(e.integerValue));else if("doubleValue"in e){let t=Mt(e.doubleValue);isNaN(t)?this.Ct(r,13):(this.Ct(r,15),Hm(t)?r.Ft(0):r.Ft(t))}else if("timestampValue"in e){let t=e.timestampValue;this.Ct(r,20),typeof t=="string"&&(t=ws(t)),r.Mt(`${t.seconds||""}`),r.Ft(t.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,r),this.Ot(r);else if("bytesValue"in e)this.Ct(r,30),r.Nt(bs(e.bytesValue)),this.Ot(r);else if("referenceValue"in e)this.Bt(e.referenceValue,r);else if("geoPointValue"in e){let t=e.geoPointValue;this.Ct(r,45),r.Ft(t.latitude||0),r.Ft(t.longitude||0)}else"mapValue"in e?WH(e)?this.Ct(r,Number.MAX_SAFE_INTEGER):Py(e)?this.Lt(e.mapValue,r):(this.kt(e.mapValue,r),this.Ot(r)):"arrayValue"in e?(this.qt(e.arrayValue,r),this.Ot(r)):ae(19022,{Qt:e})}xt(e,r){this.Ct(r,25),this.$t(e,r)}$t(e,r){r.Mt(e)}kt(e,r){let t=e.fields||{};this.Ct(r,55);for(let i of Object.keys(t))this.xt(i,r),this.Dt(t[i],r)}Lt(e,r){var t,i;let o=e.fields||{};this.Ct(r,53);let s=yh,a=((i=(t=o[s].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.length)||0;this.Ct(r,15),r.Ft(Mt(a)),this.xt(s,r),this.Dt(o[s],r)}qt(e,r){let t=e.values||[];this.Ct(r,50);for(let i of t)this.Dt(i,r)}Bt(e,r){this.Ct(r,37),ie.fromName(e).path.forEach(t=>{this.Ct(r,60),this.$t(t,r)})}Ct(e,r){e.Ft(r)}Ot(e){e.Ft(2)}};Rs.Ut=new Rs;var eh=255;function aoe(n){if(n===0)return 8;let e=0;return n>>4||(e+=4,n<<=4),n>>6||(e+=2,n<<=2),n>>7||(e+=1),e}function $j(n){let e=64-(function(t){let i=0;for(let o=0;o<8;++o){let s=aoe(255&t[o]);if(i+=s,s!==8)break}return i})(n);return Math.ceil(e/8)}var wb=class{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Kt(e){let r=e[Symbol.iterator](),t=r.next();for(;!t.done;)this.Wt(t.value),t=r.next();this.Gt()}zt(e){let r=e[Symbol.iterator](),t=r.next();for(;!t.done;)this.jt(t.value),t=r.next();this.Jt()}Ht(e){for(let r of e){let t=r.charCodeAt(0);if(t<128)this.Wt(t);else if(t<2048)this.Wt(960|t>>>6),this.Wt(128|63&t);else if(r<"\uD800"||"\uDBFF"<r)this.Wt(480|t>>>12),this.Wt(128|63&t>>>6),this.Wt(128|63&t);else{let i=r.codePointAt(0);this.Wt(240|i>>>18),this.Wt(128|63&i>>>12),this.Wt(128|63&i>>>6),this.Wt(128|63&i)}}this.Gt()}Yt(e){for(let r of e){let t=r.charCodeAt(0);if(t<128)this.jt(t);else if(t<2048)this.jt(960|t>>>6),this.jt(128|63&t);else if(r<"\uD800"||"\uDBFF"<r)this.jt(480|t>>>12),this.jt(128|63&t>>>6),this.jt(128|63&t);else{let i=r.codePointAt(0);this.jt(240|i>>>18),this.jt(128|63&i>>>12),this.jt(128|63&i>>>6),this.jt(128|63&i)}}this.Jt()}Zt(e){let r=this.Xt(e),t=$j(r);this.en(1+t),this.buffer[this.position++]=255&t;for(let i=r.length-t;i<r.length;++i)this.buffer[this.position++]=255&r[i]}tn(e){let r=this.Xt(e),t=$j(r);this.en(1+t),this.buffer[this.position++]=~(255&t);for(let i=r.length-t;i<r.length;++i)this.buffer[this.position++]=~(255&r[i])}nn(){this.rn(eh),this.rn(255)}sn(){this._n(eh),this._n(255)}reset(){this.position=0}seed(e){this.en(e.length),this.buffer.set(e,this.position),this.position+=e.length}an(){return this.buffer.slice(0,this.position)}Xt(e){let r=(function(o){let s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,o,!1),new Uint8Array(s.buffer)})(e),t=!!(128&r[0]);r[0]^=t?255:128;for(let i=1;i<r.length;++i)r[i]^=t?255:0;return r}Wt(e){let r=255&e;r===0?(this.rn(0),this.rn(255)):r===eh?(this.rn(eh),this.rn(0)):this.rn(r)}jt(e){let r=255&e;r===0?(this._n(0),this._n(255)):r===eh?(this._n(eh),this._n(0)):this._n(e)}Gt(){this.rn(0),this.rn(1)}Jt(){this._n(0),this._n(1)}rn(e){this.en(1),this.buffer[this.position++]=e}_n(e){this.en(1),this.buffer[this.position++]=~e}en(e){let r=e+this.position;if(r<=this.buffer.length)return;let t=2*this.buffer.length;t<r&&(t=r);let i=new Uint8Array(t);i.set(this.buffer),this.buffer=i}},bb=class{constructor(e){this.un=e}Nt(e){this.un.Kt(e)}Mt(e){this.un.Ht(e)}Ft(e){this.un.Zt(e)}vt(){this.un.nn()}},Lb=class{constructor(e){this.un=e}Nt(e){this.un.zt(e)}Mt(e){this.un.Yt(e)}Ft(e){this.un.tn(e)}vt(){this.un.sn()}},xl=class{constructor(){this.un=new wb,this.cn=new bb(this.un),this.ln=new Lb(this.un)}seed(e){this.un.seed(e)}hn(e){return e===0?this.cn:this.ln}an(){return this.un.an()}reset(){this.un.reset()}};var Fl=class n{constructor(e,r,t,i){this.Pn=e,this.Tn=r,this.In=t,this.dn=i}En(){let e=this.dn.length,r=e===0||this.dn[e-1]===255?e+1:e,t=new Uint8Array(r);return t.set(this.dn,0),r!==e?t.set([0],this.dn.length):++t[t.length-1],new n(this.Pn,this.Tn,this.In,t)}An(e,r,t){return{indexId:this.Pn,uid:e,arrayValue:wv(this.In),directionalValue:wv(this.dn),orderedDocumentKey:wv(r),documentKey:t.path.toArray()}}Rn(e,r,t){let i=this.An(e,r,t);return[i.indexId,i.uid,i.arrayValue,i.directionalValue,i.orderedDocumentKey,i.documentKey]}};function wa(n,e){let r=n.Pn-e.Pn;return r!==0?r:(r=jj(n.In,e.In),r!==0?r:(r=jj(n.dn,e.dn),r!==0?r:ie.comparator(n.Tn,e.Tn)))}function jj(n,e){for(let r=0;r<n.length&&r<e.length;++r){let t=n[r]-e[r];if(t!==0)return t}return n.length-e.length}function wv(n){return UC()?(function(r){let t="";for(let i=0;i<r.length;i++)t+=String.fromCharCode(r[i]);return t})(n):n}function Hj(n){return typeof n!="string"?n:(function(r){let t=new Uint8Array(r.length);for(let i=0;i<r.length;i++)t[i]=r.charCodeAt(i);return t})(n)}var Zv=class{constructor(e){this.Vn=new at((r,t)=>Tn.comparator(r.field,t.field)),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.mn=e.orderBy,this.fn=[];for(let r of e.filters){let t=r;t.isInequality()?this.Vn=this.Vn.add(t):this.fn.push(t)}}get gn(){return this.Vn.size>1}pn(e){if(he(e.collectionGroup===this.collectionId,49279),this.gn)return!1;let r=Kw(e);if(r!==void 0&&!this.yn(r))return!1;let t=bl(e),i=new Set,o=0,s=0;for(;o<t.length&&this.yn(t[o]);++o)i=i.add(t[o].fieldPath.canonicalString());if(o===t.length)return!0;if(this.Vn.size>0){let a=this.Vn.getIterator().getNext();if(!i.has(a.field.canonicalString())){let c=t[o];if(!this.wn(a,c)||!this.Sn(this.mn[s++],c))return!1}++o}for(;o<t.length;++o){let a=t[o];if(s>=this.mn.length||!this.Sn(this.mn[s++],a))return!1}return!0}bn(){if(this.gn)return null;let e=new at(Tn.comparator),r=[];for(let t of this.fn)if(!t.field.isKeyField())if(t.op==="array-contains"||t.op==="array-contains-any")r.push(new lh(t.field,2));else{if(e.has(t.field))continue;e=e.add(t.field),r.push(new lh(t.field,0))}for(let t of this.mn)t.field.isKeyField()||e.has(t.field)||(e=e.add(t.field),r.push(new lh(t.field,t.dir==="asc"?0:1)));return new mh(mh.UNKNOWN_ID,this.collectionId,r,jm.empty())}yn(e){for(let r of this.fn)if(this.wn(r,e))return!0;return!1}wn(e,r){if(e===void 0||!e.field.isEqual(r.fieldPath))return!1;let t=e.op==="array-contains"||e.op==="array-contains-any";return r.kind===2===t}Sn(e,r){return!!e.field.isEqual(r.fieldPath)&&(r.kind===0&&e.dir==="asc"||r.kind===1&&e.dir==="desc")}};function NW(n){var e,r;if(he(n instanceof $e||n instanceof nt,20012),n instanceof $e){if(n instanceof jv){let i=((r=(e=n.value.arrayValue)===null||e===void 0?void 0:e.values)===null||r===void 0?void 0:r.map(o=>$e.create(n.field,"==",o)))||[];return nt.create(i,"or")}return n}let t=n.filters.map(i=>NW(i));return nt.create(t,n.op)}function coe(n){if(n.getFilters().length===0)return[];let e=xb(NW(n));return he(OW(e),7391),Mb(e)||Pb(e)?[e]:e.getFilters()}function Mb(n){return n instanceof $e}function Pb(n){return n instanceof nt&&oM(n)}function OW(n){return Mb(n)||Pb(n)||(function(r){if(r instanceof nt&&ob(r)){for(let t of r.getFilters())if(!Mb(t)&&!Pb(t))return!1;return!0}return!1})(n)}function xb(n){if(he(n instanceof $e||n instanceof nt,34018),n instanceof $e)return n;if(n.filters.length===1)return xb(n.filters[0]);let e=n.filters.map(t=>xb(t)),r=nt.create(e,n.op);return r=ey(r),OW(r)?r:(he(r instanceof nt,64498),he(Ah(r),40251),he(r.filters.length>1,57927),r.filters.reduce((t,i)=>dM(t,i)))}function dM(n,e){let r;return he(n instanceof $e||n instanceof nt,38388),he(e instanceof $e||e instanceof nt,25473),r=n instanceof $e?e instanceof $e?(function(i,o){return nt.create([i,o],"and")})(n,e):Wj(n,e):e instanceof $e?Wj(e,n):(function(i,o){if(he(i.filters.length>0&&o.filters.length>0,48005),Ah(i)&&Ah(o))return QH(i,o.getFilters());let s=ob(i)?i:o,a=ob(i)?o:i,c=s.filters.map(l=>dM(l,a));return nt.create(c,"or")})(n,e),ey(r)}function Wj(n,e){if(Ah(e))return QH(e,n.getFilters());{let r=e.filters.map(t=>dM(n,t));return nt.create(r,"or")}}function ey(n){if(he(n instanceof $e||n instanceof nt,11850),n instanceof $e)return n;let e=n.getFilters();if(e.length===1)return ey(e[0]);if(KH(n))return n;let r=e.map(i=>ey(i)),t=[];return r.forEach(i=>{i instanceof $e?t.push(i):i instanceof nt&&(i.op===n.op?t.push(...i.filters):t.push(i))}),t.length===1?t[0]:nt.create(t,n.op)}var Fb=class{constructor(){this.Dn=new sp}addToCollectionParentIndex(e,r){return this.Dn.add(r),V.resolve()}getCollectionParents(e,r){return V.resolve(this.Dn.getEntries(r))}addFieldIndex(e,r){return V.resolve()}deleteFieldIndex(e,r){return V.resolve()}deleteAllFieldIndexes(e){return V.resolve()}createTargetIndexes(e,r){return V.resolve()}getDocumentsMatchingTarget(e,r){return V.resolve(null)}getIndexType(e,r){return V.resolve(0)}getFieldIndexes(e,r){return V.resolve([])}getNextCollectionGroupToUpdate(e){return V.resolve(null)}getMinOffset(e,r){return V.resolve(Ei.min())}getMinOffsetFromCollectionGroup(e,r){return V.resolve(Ei.min())}updateCollectionGroup(e,r,t){return V.resolve()}updateIndexEntries(e,r){return V.resolve()}},sp=class{constructor(){this.index={}}add(e){let r=e.lastSegment(),t=e.popLast(),i=this.index[r]||new at(We.comparator),o=!i.has(t);return this.index[r]=i.add(t),o}has(e){let r=e.lastSegment(),t=e.popLast(),i=this.index[r];return i&&i.has(t)}getEntries(e){return(this.index[e]||new at(We.comparator)).toArray()}};var zj="IndexedDbIndexManager",Iv=new Uint8Array(0),kb=class{constructor(e,r){this.databaseId=r,this.vn=new sp,this.Cn=new qi(t=>Wl(t),(t,i)=>Tp(t,i)),this.uid=e.uid||""}addToCollectionParentIndex(e,r){if(!this.vn.has(r)){let t=r.lastSegment(),i=r.popLast();e.addOnCommittedListener(()=>{this.vn.add(r)});let o={collectionId:t,parent:nr(i)};return qj(e).put(o)}return V.resolve()}getCollectionParents(e,r){let t=[],i=IDBKeyRange.bound([r,""],[yH(r),""],!1,!0);return qj(e).j(i).next(o=>{for(let s of o){if(s.collectionId!==r)break;t.push(Vo(s.parent))}return t})}addFieldIndex(e,r){let t=Nm(e),i=(function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map(c=>[c.fieldPath.canonicalString(),c.kind])}})(r);delete i.indexId;let o=t.add(i);if(r.indexState){let s=nh(e);return o.next(a=>{s.put(Vj(a,this.uid,r.indexState.sequenceNumber,r.indexState.offset))})}return o.next()}deleteFieldIndex(e,r){let t=Nm(e),i=nh(e),o=th(e);return t.delete(r.indexId).next(()=>i.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0))).next(()=>o.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){let r=Nm(e),t=th(e),i=nh(e);return r.Y().next(()=>t.Y()).next(()=>i.Y())}createTargetIndexes(e,r){return V.forEach(this.Fn(r),t=>this.getIndexType(e,t).next(i=>{if(i===0||i===1){let o=new Zv(t).bn();if(o!=null)return this.addFieldIndex(e,o)}}))}getDocumentsMatchingTarget(e,r){let t=th(e),i=!0,o=new Map;return V.forEach(this.Fn(r),s=>this.Mn(e,s).next(a=>{i&&(i=!!a),o.set(s,a)})).next(()=>{if(i){let s=Ue(),a=[];return V.forEach(o,(c,l)=>{X(zj,`Using index ${(function(B){return`id=${B.indexId}|cg=${B.collectionGroup}|f=${B.fields.map(x=>`${x.fieldPath}:${x.kind}`).join(",")}`})(c)} to execute ${Wl(r)}`);let u=(function(B,x){let U=Kw(x);if(U===void 0)return null;for(let $ of Wv(B,U.fieldPath))switch($.op){case"array-contains-any":return $.value.arrayValue.values||[];case"array-contains":return[$.value]}return null})(l,c),d=(function(B,x){let U=new Map;for(let $ of bl(x))for(let A of Wv(B,$.fieldPath))switch(A.op){case"==":case"in":U.set($.fieldPath.canonicalString(),A.value);break;case"not-in":case"!=":return U.set($.fieldPath.canonicalString(),A.value),Array.from(U.values())}return null})(l,c),f=(function(B,x){let U=[],$=!0;for(let A of bl(x)){let D=A.kind===0?Dj(B,A.fieldPath,B.startAt):Rj(B,A.fieldPath,B.startAt);U.push(D.value),$&&($=D.inclusive)}return new jo(U,$)})(l,c),g=(function(B,x){let U=[],$=!0;for(let A of bl(x)){let D=A.kind===0?Rj(B,A.fieldPath,B.endAt):Dj(B,A.fieldPath,B.endAt);U.push(D.value),$&&($=D.inclusive)}return new jo(U,$)})(l,c),p=this.xn(c,l,f),_=this.xn(c,l,g),T=this.On(c,l,d),S=this.Nn(c.indexId,u,p,f.inclusive,_,g.inclusive,T);return V.forEach(S,b=>t.H(b,r.limit).next(B=>{B.forEach(x=>{let U=ie.fromSegments(x.documentKey);s.has(U)||(s=s.add(U),a.push(U))})}))}).next(()=>a)}return V.resolve(null)})}Fn(e){let r=this.Cn.get(e);return r||(e.filters.length===0?r=[e]:r=coe(nt.create(e.filters,"and")).map(t=>gb(e.path,e.collectionGroup,e.orderBy,t.getFilters(),e.limit,e.startAt,e.endAt)),this.Cn.set(e,r),r)}Nn(e,r,t,i,o,s,a){let c=(r!=null?r.length:1)*Math.max(t.length,o.length),l=c/(r!=null?r.length:1),u=[];for(let d=0;d<c;++d){let f=r?this.Bn(r[d/l]):Iv,g=this.Ln(e,f,t[d%l],i),p=this.kn(e,f,o[d%l],s),_=a.map(T=>this.Ln(e,f,T,!0));u.push(...this.createRange(g,p,_))}return u}Ln(e,r,t,i){let o=new Fl(e,ie.empty(),r,t);return i?o:o.En()}kn(e,r,t,i){let o=new Fl(e,ie.empty(),r,t);return i?o.En():o}Mn(e,r){let t=new Zv(r),i=r.collectionGroup!=null?r.collectionGroup:r.path.lastSegment();return this.getFieldIndexes(e,i).next(o=>{let s=null;for(let a of o)t.pn(a)&&(!s||a.fields.length>s.fields.length)&&(s=a);return s})}getIndexType(e,r){let t=2,i=this.Fn(r);return V.forEach(i,o=>this.Mn(e,o).next(s=>{s?t!==0&&s.fields.length<(function(c){let l=new at(Tn.comparator),u=!1;for(let d of c.filters)for(let f of d.getFlattenedFilters())f.field.isKeyField()||(f.op==="array-contains"||f.op==="array-contains-any"?u=!0:l=l.add(f.field));for(let d of c.orderBy)d.field.isKeyField()||(l=l.add(d.field));return l.size+(u?1:0)})(o)&&(t=1):t=0})).next(()=>(function(s){return s.limit!==null})(r)&&i.length>1&&t===2?1:t)}qn(e,r){let t=new xl;for(let i of bl(e)){let o=r.data.field(i.fieldPath);if(o==null)return null;let s=t.hn(i.kind);Rs.Ut.bt(o,s)}return t.an()}Bn(e){let r=new xl;return Rs.Ut.bt(e,r.hn(0)),r.an()}Qn(e,r){let t=new xl;return Rs.Ut.bt(jl(this.databaseId,r),t.hn((function(o){let s=bl(o);return s.length===0?0:s[s.length-1].kind})(e))),t.an()}On(e,r,t){if(t===null)return[];let i=[];i.push(new xl);let o=0;for(let s of bl(e)){let a=t[o++];for(let c of i)if(this.$n(r,s.fieldPath)&&Jm(a))i=this.Un(i,s,a);else{let l=c.hn(s.kind);Rs.Ut.bt(a,l)}}return this.Kn(i)}xn(e,r,t){return this.On(e,r,t.position)}Kn(e){let r=[];for(let t=0;t<e.length;++t)r[t]=e[t].an();return r}Un(e,r,t){let i=[...e],o=[];for(let s of t.arrayValue.values||[])for(let a of i){let c=new xl;c.seed(a.an()),Rs.Ut.bt(s,c.hn(r.kind)),o.push(c)}return o}$n(e,r){return!!e.filters.find(t=>t instanceof $e&&t.field.isEqual(r)&&(t.op==="in"||t.op==="not-in"))}getFieldIndexes(e,r){let t=Nm(e),i=nh(e);return(r?t.j(eb,IDBKeyRange.bound(r,r)):t.j()).next(o=>{let s=[];return V.forEach(o,a=>i.get([a.indexId,this.uid]).next(c=>{s.push((function(u,d){let f=d?new jm(d.sequenceNumber,new Ei(Ql(d.readTime),new ie(Vo(d.documentKey)),d.largestBatchId)):jm.empty(),g=u.fields.map(([p,_])=>new lh(Tn.fromServerFormat(p),_));return new mh(u.indexId,u.collectionGroup,g,f)})(a,c))})).next(()=>s)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(r=>r.length===0?null:(r.sort((t,i)=>{let o=t.indexState.sequenceNumber-i.indexState.sequenceNumber;return o!==0?o:De(t.collectionGroup,i.collectionGroup)}),r[0].collectionGroup))}updateCollectionGroup(e,r,t){let i=Nm(e),o=nh(e);return this.Wn(e).next(s=>i.j(eb,IDBKeyRange.bound(r,r)).next(a=>V.forEach(a,c=>o.put(Vj(c.indexId,this.uid,s,t)))))}updateIndexEntries(e,r){let t=new Map;return V.forEach(r,(i,o)=>{let s=t.get(i.collectionGroup);return(s?V.resolve(s):this.getFieldIndexes(e,i.collectionGroup)).next(a=>(t.set(i.collectionGroup,a),V.forEach(a,c=>this.Gn(e,i,c).next(l=>{let u=this.zn(o,c);return l.isEqual(u)?V.resolve():this.jn(e,o,c,l,u)}))))})}Jn(e,r,t,i){return th(e).put(i.An(this.uid,this.Qn(t,r.key),r.key))}Hn(e,r,t,i){return th(e).delete(i.Rn(this.uid,this.Qn(t,r.key),r.key))}Gn(e,r,t){let i=th(e),o=new at(wa);return i.X({index:MH,range:IDBKeyRange.only([t.indexId,this.uid,wv(this.Qn(t,r))])},(s,a)=>{o=o.add(new Fl(t.indexId,r,Hj(a.arrayValue),Hj(a.directionalValue)))}).next(()=>o)}zn(e,r){let t=new at(wa),i=this.qn(r,e);if(i==null)return t;let o=Kw(r);if(o!=null){let s=e.data.field(o.fieldPath);if(Jm(s))for(let a of s.arrayValue.values||[])t=t.add(new Fl(r.indexId,e.key,this.Bn(a),i))}else t=t.add(new Fl(r.indexId,e.key,Iv,i));return t}jn(e,r,t,i,o){X(zj,"Updating index entries for document '%s'",r.key);let s=[];return(function(c,l,u,d,f){let g=c.getIterator(),p=l.getIterator(),_=Zd(g),T=Zd(p);for(;_||T;){let S=!1,b=!1;if(_&&T){let B=u(_,T);B<0?b=!0:B>0&&(S=!0)}else _!=null?b=!0:S=!0;S?(d(T),T=Zd(p)):b?(f(_),_=Zd(g)):(_=Zd(g),T=Zd(p))}})(i,o,wa,a=>{s.push(this.Jn(e,r,t,a))},a=>{s.push(this.Hn(e,r,t,a))}),V.waitFor(s)}Wn(e){let r=1;return nh(e).X({index:LH,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(t,i,o)=>{o.done(),r=i.sequenceNumber+1}).next(()=>r)}createRange(e,r,t){t=t.sort((s,a)=>wa(s,a)).filter((s,a,c)=>!a||wa(s,c[a-1])!==0);let i=[];i.push(e);for(let s of t){let a=wa(s,e),c=wa(s,r);if(a===0)i[0]=e.En();else if(a>0&&c<0)i.push(s),i.push(s.En());else if(c>0)break}i.push(r);let o=[];for(let s=0;s<i.length;s+=2){if(this.Yn(i[s],i[s+1]))return[];let a=i[s].Rn(this.uid,Iv,ie.empty()),c=i[s+1].Rn(this.uid,Iv,ie.empty());o.push(IDBKeyRange.bound(a,c))}return o}Yn(e,r){return wa(e,r)>0}getMinOffsetFromCollectionGroup(e,r){return this.getFieldIndexes(e,r).next(Kj)}getMinOffset(e,r){return V.mapArray(this.Fn(r),t=>this.Mn(e,t).next(i=>i||ae(44426))).next(Kj)}};function qj(n){return yn(n,qm)}function th(n){return yn(n,Fm)}function Nm(n){return yn(n,eM)}function nh(n){return yn(n,xm)}function Kj(n){he(n.length!==0,28825);let e=n[0].indexState.offset,r=e.largestBatchId;for(let t=1;t<n.length;t++){let i=n[t].indexState.offset;XL(i,e)<0&&(e=i),r<i.largestBatchId&&(r=i.largestBatchId)}return new Ei(e.readTime,e.documentKey,r)}var Yj={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},wW=41943040,Cr=class n{static withCacheSize(e){return new n(e,n.DEFAULT_COLLECTION_PERCENTILE,n.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,r,t){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=r,this.maximumSequenceNumbersToCollect=t}};function bW(n,e,r){let t=n.store(zi),i=n.store(Eh),o=[],s=IDBKeyRange.only(r.batchId),a=0,c=t.X({range:s},(u,d,f)=>(a++,f.delete()));o.push(c.next(()=>{he(a===1,47070,{batchId:r.batchId})}));let l=[];for(let u of r.mutations){let d=OH(e,u.key.path,r.batchId);o.push(i.delete(d)),l.push(u.key)}return V.waitFor(o).next(()=>l)}function ty(n){if(!n)return 0;let e;if(n.document)e=n.document;else if(n.unknownDocument)e=n.unknownDocument;else{if(!n.noDocument)throw ae(14731);e=n.noDocument}return JSON.stringify(e).length}Cr.DEFAULT_COLLECTION_PERCENTILE=10,Cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Cr.DEFAULT=new Cr(wW,Cr.DEFAULT_COLLECTION_PERCENTILE,Cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Cr.DISABLED=new Cr(-1,0,0);var ny=class n{constructor(e,r,t,i){this.userId=e,this.serializer=r,this.indexManager=t,this.referenceDelegate=i,this.Zn={}}static yt(e,r,t,i){he(e.uid!=="",64387);let o=e.isAuthenticated()?e.uid:"";return new n(o,r,t,i)}checkEmpty(e){let r=!0,t=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return ba(e).X({index:kl,range:t},(i,o,s)=>{r=!1,s.done()}).next(()=>r)}addMutationBatch(e,r,t,i){let o=ah(e),s=ba(e);return s.add({}).next(a=>{he(typeof a=="number",49019);let c=new ep(a,r,t,i),l=(function(g,p,_){let T=_.baseMutations.map(b=>op(g.gt,b)),S=_.mutations.map(b=>op(g.gt,b));return{userId:p,batchId:_.batchId,localWriteTimeMs:_.localWriteTime.toMillis(),baseMutations:T,mutations:S}})(this.serializer,this.userId,c),u=[],d=new at((f,g)=>De(f.canonicalString(),g.canonicalString()));for(let f of i){let g=OH(this.userId,f.key.path,a);d=d.add(f.key.path.popLast()),u.push(s.put(l)),u.push(o.put(g,iie))}return d.forEach(f=>{u.push(this.indexManager.addToCollectionParentIndex(e,f))}),e.addOnCommittedListener(()=>{this.Zn[a]=c.keys()}),V.waitFor(u).next(()=>c)})}lookupMutationBatch(e,r){return ba(e).get(r).next(t=>t?(he(t.userId===this.userId,48,"Unexpected user for mutation batch",{userId:t.userId,batchId:r}),Pl(this.serializer,t)):null)}Xn(e,r){return this.Zn[r]?V.resolve(this.Zn[r]):this.lookupMutationBatch(e,r).next(t=>{if(t){let i=t.keys();return this.Zn[r]=i,i}return null})}getNextMutationBatchAfterBatchId(e,r){let t=r+1,i=IDBKeyRange.lowerBound([this.userId,t]),o=null;return ba(e).X({index:kl,range:i},(s,a,c)=>{a.userId===this.userId&&(he(a.batchId>=t,47524,{er:t}),o=Pl(this.serializer,a)),c.done()}).next(()=>o)}getHighestUnacknowledgedBatchId(e){let r=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),t=Bl;return ba(e).X({index:kl,range:r,reverse:!0},(i,o,s)=>{t=o.batchId,s.done()}).next(()=>t)}getAllMutationBatches(e){let r=IDBKeyRange.bound([this.userId,Bl],[this.userId,Number.POSITIVE_INFINITY]);return ba(e).j(kl,r).next(t=>t.map(i=>Pl(this.serializer,i)))}getAllMutationBatchesAffectingDocumentKey(e,r){let t=Av(this.userId,r.path),i=IDBKeyRange.lowerBound(t),o=[];return ah(e).X({range:i},(s,a,c)=>{let[l,u,d]=s,f=Vo(u);if(l===this.userId&&r.path.isEqual(f))return ba(e).get(d).next(g=>{if(!g)throw ae(61480,{tr:s,batchId:d});he(g.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:g.userId,batchId:d}),o.push(Pl(this.serializer,g))});c.done()}).next(()=>o)}getAllMutationBatchesAffectingDocumentKeys(e,r){let t=new at(De),i=[];return r.forEach(o=>{let s=Av(this.userId,o.path),a=IDBKeyRange.lowerBound(s),c=ah(e).X({range:a},(l,u,d)=>{let[f,g,p]=l,_=Vo(g);f===this.userId&&o.path.isEqual(_)?t=t.add(p):d.done()});i.push(c)}),V.waitFor(i).next(()=>this.nr(e,t))}getAllMutationBatchesAffectingQuery(e,r){let t=r.path,i=t.length+1,o=Av(this.userId,t),s=IDBKeyRange.lowerBound(o),a=new at(De);return ah(e).X({range:s},(c,l,u)=>{let[d,f,g]=c,p=Vo(f);d===this.userId&&t.isPrefixOf(p)?p.length===i&&(a=a.add(g)):u.done()}).next(()=>this.nr(e,a))}nr(e,r){let t=[],i=[];return r.forEach(o=>{i.push(ba(e).get(o).next(s=>{if(s===null)throw ae(35274,{batchId:o});he(s.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:s.userId,batchId:o}),t.push(Pl(this.serializer,s))}))}),V.waitFor(i).next(()=>t)}removeMutationBatch(e,r){return bW(e.ce,this.userId,r).next(t=>(e.addOnCommittedListener(()=>{this.rr(r.batchId)}),V.forEach(t,i=>this.referenceDelegate.markPotentiallyOrphaned(e,i))))}rr(e){delete this.Zn[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(r=>{if(!r)return V.resolve();let t=IDBKeyRange.lowerBound((function(s){return[s]})(this.userId)),i=[];return ah(e).X({range:t},(o,s,a)=>{if(o[0]===this.userId){let c=Vo(o[1]);i.push(c)}else a.done()}).next(()=>{he(i.length===0,56720,{ir:i.map(o=>o.canonicalString())})})})}containsKey(e,r){return LW(e,this.userId,r)}sr(e){return MW(e).get(this.userId).next(r=>r||{userId:this.userId,lastAcknowledgedBatchId:Bl,lastStreamToken:""})}};function LW(n,e,r){let t=Av(e,r.path),i=t[1],o=IDBKeyRange.lowerBound(t),s=!1;return ah(n).X({range:o,Z:!0},(a,c,l)=>{let[u,d,f]=a;u===e&&d===i&&(s=!0),l.done()}).next(()=>s)}function ba(n){return yn(n,zi)}function ah(n){return yn(n,Eh)}function MW(n){return yn(n,Wm)}var Oh=class n{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new n(0)}static ur(){return new n(-1)}};var Ub=class{constructor(e,r){this.referenceDelegate=e,this.serializer=r}allocateTargetId(e){return this.cr(e).next(r=>{let t=new Oh(r.highestTargetId);return r.highestTargetId=t.next(),this.lr(e,r).next(()=>r.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.cr(e).next(r=>me.fromTimestamp(new Pt(r.lastRemoteSnapshotVersion.seconds,r.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.cr(e).next(r=>r.highestListenSequenceNumber)}setTargetsMetadata(e,r,t){return this.cr(e).next(i=>(i.highestListenSequenceNumber=r,t&&(i.lastRemoteSnapshotVersion=t.toTimestamp()),r>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=r),this.lr(e,i)))}addTargetData(e,r){return this.hr(e,r).next(()=>this.cr(e).next(t=>(t.targetCount+=1,this.Pr(r,t),this.lr(e,t))))}updateTargetData(e,r){return this.hr(e,r)}removeTargetData(e,r){return this.removeMatchingKeysForTargetId(e,r.targetId).next(()=>rh(e).delete(r.targetId)).next(()=>this.cr(e)).next(t=>(he(t.targetCount>0,8065),t.targetCount-=1,this.lr(e,t)))}removeTargets(e,r,t){let i=0,o=[];return rh(e).X((s,a)=>{let c=Lm(a);c.sequenceNumber<=r&&t.get(c.targetId)===null&&(i++,o.push(this.removeTargetData(e,c)))}).next(()=>V.waitFor(o)).next(()=>i)}forEachTarget(e,r){return rh(e).X((t,i)=>{let o=Lm(i);r(o)})}cr(e){return Qj(e).get(Vv).next(r=>(he(r!==null,2888),r))}lr(e,r){return Qj(e).put(Vv,r)}hr(e,r){return rh(e).put(RW(this.serializer,r))}Pr(e,r){let t=!1;return e.targetId>r.highestTargetId&&(r.highestTargetId=e.targetId,t=!0),e.sequenceNumber>r.highestListenSequenceNumber&&(r.highestListenSequenceNumber=e.sequenceNumber,t=!0),t}getTargetCount(e){return this.cr(e).next(r=>r.targetCount)}getTargetData(e,r){let t=Wl(r),i=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Number.POSITIVE_INFINITY]),o=null;return rh(e).X({range:i,index:bH},(s,a,c)=>{let l=Lm(a);Tp(r,l.target)&&(o=l,c.done())}).next(()=>o)}addMatchingKeys(e,r,t){let i=[],o=Pa(e);return r.forEach(s=>{let a=nr(s.path);i.push(o.put({targetId:t,path:a})),i.push(this.referenceDelegate.addReference(e,t,s))}),V.waitFor(i)}removeMatchingKeys(e,r,t){let i=Pa(e);return V.forEach(r,o=>{let s=nr(o.path);return V.waitFor([i.delete([t,s]),this.referenceDelegate.removeReference(e,t,o)])})}removeMatchingKeysForTargetId(e,r){let t=Pa(e),i=IDBKeyRange.bound([r],[r+1],!1,!0);return t.delete(i)}getMatchingKeysForTargetId(e,r){let t=IDBKeyRange.bound([r],[r+1],!1,!0),i=Pa(e),o=Ue();return i.X({range:t,Z:!0},(s,a,c)=>{let l=Vo(s[1]),u=new ie(l);o=o.add(u)}).next(()=>o)}containsKey(e,r){let t=nr(r.path),i=IDBKeyRange.bound([t],[yH(t)],!1,!0),o=0;return Pa(e).X({index:ZL,Z:!0,range:i},([s,a],c,l)=>{s!==0&&(o++,l.done())}).next(()=>o>0)}Et(e,r){return rh(e).get(r).next(t=>t?Lm(t):null)}};function rh(n){return yn(n,_h)}function Qj(n){return yn(n,Gl)}function Pa(n){return yn(n,Th)}var Xj="LruGarbageCollector",PW=1048576;function Jj([n,e],[r,t]){let i=De(n,r);return i===0?De(e,t):i}var Vb=class{constructor(e){this.Tr=e,this.buffer=new at(Jj),this.Ir=0}dr(){return++this.Ir}Er(e){let r=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(r);else{let t=this.buffer.last();Jj(r,t)<0&&(this.buffer=this.buffer.delete(t).add(r))}}get maxValue(){return this.buffer.last()[0]}},ry=class{constructor(e,r,t){this.garbageCollector=e,this.asyncQueue=r,this.localStore=t,this.Ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return this.Ar!==null}Rr(e){X(Xj,`Garbage collection scheduled in ${e}ms`),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,()=>I(this,null,function*(){this.Ar=null;try{yield this.localStore.collectGarbage(this.garbageCollector)}catch(r){Qa(r)?X(Xj,"Ignoring IndexedDB error during garbage collection: ",r):yield Ya(r)}yield this.Rr(3e5)}))}},Bb=class{constructor(e,r){this.Vr=e,this.params=r}calculateTargetCount(e,r){return this.Vr.mr(e).next(t=>Math.floor(r/100*t))}nthSequenceNumber(e,r){if(r===0)return V.resolve(qr.ue);let t=new Vb(r);return this.Vr.forEachTarget(e,i=>t.Er(i.sequenceNumber)).next(()=>this.Vr.gr(e,i=>t.Er(i))).next(()=>t.maxValue)}removeTargets(e,r,t){return this.Vr.removeTargets(e,r,t)}removeOrphanedDocuments(e,r){return this.Vr.removeOrphanedDocuments(e,r)}collect(e,r){return this.params.cacheSizeCollectionThreshold===-1?(X("LruGarbageCollector","Garbage collection skipped; disabled"),V.resolve(Yj)):this.getCacheSize(e).next(t=>t<this.params.cacheSizeCollectionThreshold?(X("LruGarbageCollector",`Garbage collection skipped; Cache size ${t} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Yj):this.pr(e,r))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,r){let t,i,o,s,a,c,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(d=>(d>this.params.maximumSequenceNumbersToCollect?(X("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),i=this.params.maximumSequenceNumbersToCollect):i=d,s=Date.now(),this.nthSequenceNumber(e,i))).next(d=>(t=d,a=Date.now(),this.removeTargets(e,t,r))).next(d=>(o=d,c=Date.now(),this.removeOrphanedDocuments(e,t))).next(d=>(l=Date.now(),ih()<=xe.DEBUG&&X("LruGarbageCollector",`LRU Garbage Collection
158
+ Counted targets in ${s-u}ms
159
+ Determined least recently used ${i} in `+(a-s)+`ms
160
+ Removed ${o} targets in `+(c-a)+`ms
161
+ Removed ${d} documents in `+(l-c)+`ms
162
+ Total Duration: ${l-u}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:d})))}};function xW(n,e){return new Bb(n,e)}var Gb=class{constructor(e,r){this.db=e,this.garbageCollector=xW(this,r)}mr(e){let r=this.yr(e);return this.db.getTargetCache().getTargetCount(e).next(t=>r.next(i=>t+i))}yr(e){let r=0;return this.gr(e,t=>{r++}).next(()=>r)}forEachTarget(e,r){return this.db.getTargetCache().forEachTarget(e,r)}gr(e,r){return this.wr(e,(t,i)=>r(i))}addReference(e,r,t){return vv(e,t)}removeReference(e,r,t){return vv(e,t)}removeTargets(e,r,t){return this.db.getTargetCache().removeTargets(e,r,t)}markPotentiallyOrphaned(e,r){return vv(e,r)}Sr(e,r){return(function(i,o){let s=!1;return MW(i).ee(a=>LW(i,a,o).next(c=>(c&&(s=!0),V.resolve(!c)))).next(()=>s)})(e,r)}removeOrphanedDocuments(e,r){let t=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[],o=0;return this.wr(e,(s,a)=>{if(a<=r){let c=this.Sr(e,s).next(l=>{if(!l)return o++,t.getEntry(e,s).next(()=>(t.removeEntry(s,me.min()),Pa(e).delete((function(d){return[0,nr(d.path)]})(s))))});i.push(c)}}).next(()=>V.waitFor(i)).next(()=>t.apply(e)).next(()=>o)}removeTarget(e,r){let t=r.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,t)}updateLimboDocument(e,r){return vv(e,r)}wr(e,r){let t=Pa(e),i,o=qr.ue;return t.X({index:ZL},([s,a],{path:c,sequenceNumber:l})=>{s===0?(o!==qr.ue&&r(new ie(Vo(i)),o),o=l,i=c):o=qr.ue}).next(()=>{o!==qr.ue&&r(new ie(Vo(i)),o)})}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}};function vv(n,e){return Pa(n).put((function(t,i){return{targetId:0,path:nr(t.path),sequenceNumber:i}})(e,n.currentSequenceNumber))}var iy=class{constructor(){this.changes=new qi(e=>e.toString(),(e,r)=>e.isEqual(r)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,r){this.assertNotApplied(),this.changes.set(e,In.newInvalidDocument(e).setReadTime(r))}getEntry(e,r){this.assertNotApplied();let t=this.changes.get(r);return t!==void 0?V.resolve(t):this.getFromCache(e,r)}getEntries(e,r){return this.getAllFromCache(e,r)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};var $b=class{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,r,t){return wl(e).put(t)}removeEntry(e,r,t){return wl(e).delete((function(o,s){let a=o.path.toArray();return[a.slice(0,a.length-2),a[a.length-2],Xv(s),a[a.length-1]]})(r,t))}updateMetadata(e,r){return this.getMetadata(e).next(t=>(t.byteSize+=r,this.br(e,t)))}getEntry(e,r){let t=In.newInvalidDocument(r);return wl(e).X({index:Dv,range:IDBKeyRange.only(Om(r))},(i,o)=>{t=this.Dr(r,o)}).next(()=>t)}vr(e,r){let t={size:0,document:In.newInvalidDocument(r)};return wl(e).X({index:Dv,range:IDBKeyRange.only(Om(r))},(i,o)=>{t={document:this.Dr(r,o),size:ty(o)}}).next(()=>t)}getEntries(e,r){let t=Yr();return this.Cr(e,r,(i,o)=>{let s=this.Dr(i,o);t=t.insert(i,s)}).next(()=>t)}Fr(e,r){let t=Yr(),i=new Dt(ie.comparator);return this.Cr(e,r,(o,s)=>{let a=this.Dr(o,s);t=t.insert(o,a),i=i.insert(o,ty(s))}).next(()=>({documents:t,Mr:i}))}Cr(e,r,t){if(r.isEmpty())return V.resolve();let i=new at(tH);r.forEach(c=>i=i.add(c));let o=IDBKeyRange.bound(Om(i.first()),Om(i.last())),s=i.getIterator(),a=s.getNext();return wl(e).X({index:Dv,range:o},(c,l,u)=>{let d=ie.fromSegments([...l.prefixPath,l.collectionGroup,l.documentId]);for(;a&&tH(a,d)<0;)t(a,null),a=s.getNext();a&&a.isEqual(d)&&(t(a,l),a=s.hasNext()?s.getNext():null),a?u.G(Om(a)):u.done()}).next(()=>{for(;a;)t(a,null),a=s.hasNext()?s.getNext():null})}getDocumentsMatchingQuery(e,r,t,i,o){let s=r.path,a=[s.popLast().toArray(),s.lastSegment(),Xv(t.readTime),t.documentKey.path.isEmpty()?"":t.documentKey.path.lastSegment()],c=[s.popLast().toArray(),s.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return wl(e).j(IDBKeyRange.bound(a,c,!0)).next(l=>{o?.incrementDocumentReadCount(l.length);let u=Yr();for(let d of l){let f=this.Dr(ie.fromSegments(d.prefixPath.concat(d.collectionGroup,d.documentId)),d);f.isFoundDocument()&&(vp(r,f)||i.has(f.key))&&(u=u.insert(f.key,f))}return u})}getAllFromCollectionGroup(e,r,t,i){let o=Yr(),s=eH(r,t),a=eH(r,Ei.max());return wl(e).X({index:wH,range:IDBKeyRange.bound(s,a,!0)},(c,l,u)=>{let d=this.Dr(ie.fromSegments(l.prefixPath.concat(l.collectionGroup,l.documentId)),l);o=o.insert(d.key,d),o.size===i&&u.done()}).next(()=>o)}newChangeBuffer(e){return new jb(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next(r=>r.byteSize)}getMetadata(e){return Zj(e).get(Zw).next(r=>(he(!!r,20021),r))}br(e,r){return Zj(e).put(Zw,r)}Dr(e,r){if(r){let t=soe(this.serializer,r);if(!(t.isNoDocument()&&t.version.isEqual(me.min())))return t}return In.newInvalidDocument(e)}};function FW(n){return new $b(n)}var jb=class extends iy{constructor(e,r){super(),this.Or=e,this.trackRemovals=r,this.Nr=new qi(t=>t.toString(),(t,i)=>t.isEqual(i))}applyChanges(e){let r=[],t=0,i=new at((o,s)=>De(o.canonicalString(),s.canonicalString()));return this.changes.forEach((o,s)=>{let a=this.Nr.get(o);if(r.push(this.Or.removeEntry(e,o,a.readTime)),s.isValidDocument()){let c=kj(this.Or.serializer,s);i=i.add(o.path.popLast());let l=ty(c);t+=l-a.size,r.push(this.Or.addEntry(e,o,c))}else if(t-=a.size,this.trackRemovals){let c=kj(this.Or.serializer,s.convertToNoDocument(me.min()));r.push(this.Or.addEntry(e,o,c))}}),i.forEach(o=>{r.push(this.Or.indexManager.addToCollectionParentIndex(e,o))}),r.push(this.Or.updateMetadata(e,t)),V.waitFor(r)}getFromCache(e,r){return this.Or.vr(e,r).next(t=>(this.Nr.set(r,{size:t.size,readTime:t.document.readTime}),t.document))}getAllFromCache(e,r){return this.Or.Fr(e,r).next(({documents:t,Mr:i})=>(i.forEach((o,s)=>{this.Nr.set(o,{size:s,readTime:t.get(o).readTime})}),t))}};function Zj(n){return yn(n,zm)}function wl(n){return yn(n,Uv)}function Om(n){let e=n.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function eH(n,e){let r=e.documentKey.path.toArray();return[n,Xv(e.readTime),r.slice(0,r.length-2),r.length>0?r[r.length-1]:""]}function tH(n,e){let r=n.path.toArray(),t=e.path.toArray(),i=0;for(let o=0;o<r.length-2&&o<t.length-2;++o)if(i=De(r[o],t[o]),i)return i;return i=De(r.length,t.length),i||(i=De(r[r.length-2],t[t.length-2]),i||De(r[r.length-1],t[t.length-1]))}var Hb=class{constructor(e,r){this.overlayedDocument=e,this.mutatedFields=r}};var oy=class{constructor(e,r,t,i){this.remoteDocumentCache=e,this.mutationQueue=r,this.documentOverlayCache=t,this.indexManager=i}getDocument(e,r){let t=null;return this.documentOverlayCache.getOverlay(e,r).next(i=>(t=i,this.remoteDocumentCache.getEntry(e,r))).next(i=>(t!==null&&Vm(t.mutation,i,Kr.empty(),Pt.now()),i))}getDocuments(e,r){return this.remoteDocumentCache.getEntries(e,r).next(t=>this.getLocalViewOfDocuments(e,t,Ue()).next(()=>t))}getLocalViewOfDocuments(e,r,t=Ue()){let i=Bo();return this.populateOverlays(e,i,r).next(()=>this.computeViews(e,r,i,t).next(o=>{let s=bm();return o.forEach((a,c)=>{s=s.insert(a,c.overlayedDocument)}),s}))}getOverlayedDocuments(e,r){let t=Bo();return this.populateOverlays(e,t,r).next(()=>this.computeViews(e,r,t,Ue()))}populateOverlays(e,r,t){let i=[];return t.forEach(o=>{r.has(o)||i.push(o)}),this.documentOverlayCache.getOverlays(e,i).next(o=>{o.forEach((s,a)=>{r.set(s,a)})})}computeViews(e,r,t,i){let o=Yr(),s=Um(),a=(function(){return Um()})();return r.forEach((c,l)=>{let u=t.get(l.key);i.has(l.key)&&(u===void 0||u.mutation instanceof Ki)?o=o.insert(l.key,l):u!==void 0?(s.set(l.key,u.mutation.getFieldMask()),Vm(u.mutation,l,u.mutation.getFieldMask(),Pt.now())):s.set(l.key,Kr.empty())}),this.recalculateAndSaveOverlays(e,o).next(c=>(c.forEach((l,u)=>s.set(l,u)),r.forEach((l,u)=>{var d;return a.set(l,new Hb(u,(d=s.get(l))!==null&&d!==void 0?d:null))}),a))}recalculateAndSaveOverlays(e,r){let t=Um(),i=new Dt((s,a)=>s-a),o=Ue();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,r).next(s=>{for(let a of s)a.keys().forEach(c=>{let l=r.get(c);if(l===null)return;let u=t.get(c)||Kr.empty();u=a.applyToLocalView(l,u),t.set(c,u);let d=(i.get(a.batchId)||Ue()).add(c);i=i.insert(a.batchId,d)})}).next(()=>{let s=[],a=i.getReverseIterator();for(;a.hasNext();){let c=a.getNext(),l=c.key,u=c.value,d=sW();u.forEach(f=>{if(!o.has(f)){let g=hW(r.get(f),t.get(f));g!==null&&d.set(f,g),o=o.add(f)}}),s.push(this.documentOverlayCache.saveOverlays(e,l,d))}return V.waitFor(s)}).next(()=>t)}recalculateAndSaveOverlaysForDocumentKeys(e,r){return this.remoteDocumentCache.getEntries(e,r).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,r,t,i){return(function(s){return ie.isDocumentKey(s.path)&&s.collectionGroup===null&&s.filters.length===0})(r)?this.getDocumentsMatchingDocumentQuery(e,r.path):sM(r)?this.getDocumentsMatchingCollectionGroupQuery(e,r,t,i):this.getDocumentsMatchingCollectionQuery(e,r,t,i)}getNextDocuments(e,r,t,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,r,t,i).next(o=>{let s=i-o.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,r,t.largestBatchId,i-o.size):V.resolve(Bo()),a=gh,c=o;return s.next(l=>V.forEach(l,(u,d)=>(a<d.largestBatchId&&(a=d.largestBatchId),o.get(u)?V.resolve():this.remoteDocumentCache.getEntry(e,u).next(f=>{c=c.insert(u,f)}))).next(()=>this.populateOverlays(e,l,o)).next(()=>this.computeViews(e,c,l,Ue())).next(u=>({batchId:a,changes:oW(u)})))})}getDocumentsMatchingDocumentQuery(e,r){return this.getDocument(e,new ie(r)).next(t=>{let i=bm();return t.isFoundDocument()&&(i=i.insert(t.key,t)),i})}getDocumentsMatchingCollectionGroupQuery(e,r,t,i){let o=r.collectionGroup,s=bm();return this.indexManager.getCollectionParents(e,o).next(a=>V.forEach(a,c=>{let l=(function(d,f){return new Ho(f,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)})(r,c.child(o));return this.getDocumentsMatchingCollectionQuery(e,l,t,i).next(u=>{u.forEach((d,f)=>{s=s.insert(d,f)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,r,t,i){let o;return this.documentOverlayCache.getOverlaysForCollection(e,r.path,t.largestBatchId).next(s=>(o=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,r,t,o,i))).next(s=>{o.forEach((c,l)=>{let u=l.getKey();s.get(u)===null&&(s=s.insert(u,In.newInvalidDocument(u)))});let a=bm();return s.forEach((c,l)=>{let u=o.get(c);u!==void 0&&Vm(u.mutation,l,Kr.empty(),Pt.now()),vp(r,l)&&(a=a.insert(c,l))}),a})}};var Wb=class{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,r){return V.resolve(this.Br.get(r))}saveBundleMetadata(e,r){return this.Br.set(r.id,(function(i){return{id:i.id,version:i.version,createTime:Ln(i.createTime)}})(r)),V.resolve()}getNamedQuery(e,r){return V.resolve(this.Lr.get(r))}saveNamedQuery(e,r){return this.Lr.set(r.name,(function(i){return{name:i.name,query:CW(i.bundledQuery),readTime:Ln(i.readTime)}})(r)),V.resolve()}};var zb=class{constructor(){this.overlays=new Dt(ie.comparator),this.kr=new Map}getOverlay(e,r){return V.resolve(this.overlays.get(r))}getOverlays(e,r){let t=Bo();return V.forEach(r,i=>this.getOverlay(e,i).next(o=>{o!==null&&t.set(i,o)})).next(()=>t)}saveOverlays(e,r,t){return t.forEach((i,o)=>{this.wt(e,r,o)}),V.resolve()}removeOverlaysForBatchId(e,r,t){let i=this.kr.get(t);return i!==void 0&&(i.forEach(o=>this.overlays=this.overlays.remove(o)),this.kr.delete(t)),V.resolve()}getOverlaysForCollection(e,r,t){let i=Bo(),o=r.length+1,s=new ie(r.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let c=a.getNext().value,l=c.getKey();if(!r.isPrefixOf(l.path))break;l.path.length===o&&c.largestBatchId>t&&i.set(c.getKey(),c)}return V.resolve(i)}getOverlaysForCollectionGroup(e,r,t,i){let o=new Dt((l,u)=>l-u),s=this.overlays.getIterator();for(;s.hasNext();){let l=s.getNext().value;if(l.getKey().getCollectionGroup()===r&&l.largestBatchId>t){let u=o.get(l.largestBatchId);u===null&&(u=Bo(),o=o.insert(l.largestBatchId,u)),u.set(l.getKey(),l)}}let a=Bo(),c=o.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((l,u)=>a.set(l,u)),!(a.size()>=i)););return V.resolve(a)}wt(e,r,t){let i=this.overlays.get(t.key);if(i!==null){let s=this.kr.get(i.largestBatchId).delete(t.key);this.kr.set(i.largestBatchId,s)}this.overlays=this.overlays.insert(t.key,new tp(r,t));let o=this.kr.get(r);o===void 0&&(o=Ue(),this.kr.set(r,o)),this.kr.set(r,o.add(t.key))}};var qb=class{constructor(){this.sessionToken=un.EMPTY_BYTE_STRING}getSessionToken(e){return V.resolve(this.sessionToken)}setSessionToken(e,r){return this.sessionToken=r,V.resolve()}};var ap=class{constructor(){this.qr=new at(an.Qr),this.$r=new at(an.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,r){let t=new an(e,r);this.qr=this.qr.add(t),this.$r=this.$r.add(t)}Kr(e,r){e.forEach(t=>this.addReference(t,r))}removeReference(e,r){this.Wr(new an(e,r))}Gr(e,r){e.forEach(t=>this.removeReference(t,r))}zr(e){let r=new ie(new We([])),t=new an(r,e),i=new an(r,e+1),o=[];return this.$r.forEachInRange([t,i],s=>{this.Wr(s),o.push(s.key)}),o}jr(){this.qr.forEach(e=>this.Wr(e))}Wr(e){this.qr=this.qr.delete(e),this.$r=this.$r.delete(e)}Jr(e){let r=new ie(new We([])),t=new an(r,e),i=new an(r,e+1),o=Ue();return this.$r.forEachInRange([t,i],s=>{o=o.add(s.key)}),o}containsKey(e){let r=new an(e,0),t=this.qr.firstAfterOrEqual(r);return t!==null&&e.isEqual(t.key)}},an=class{constructor(e,r){this.key=e,this.Hr=r}static Qr(e,r){return ie.comparator(e.key,r.key)||De(e.Hr,r.Hr)}static Ur(e,r){return De(e.Hr,r.Hr)||ie.comparator(e.key,r.key)}};var Kb=class{constructor(e,r){this.indexManager=e,this.referenceDelegate=r,this.mutationQueue=[],this.er=1,this.Yr=new at(an.Qr)}checkEmpty(e){return V.resolve(this.mutationQueue.length===0)}addMutationBatch(e,r,t,i){let o=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new ep(o,r,t,i);this.mutationQueue.push(s);for(let a of i)this.Yr=this.Yr.add(new an(a.key,o)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return V.resolve(s)}lookupMutationBatch(e,r){return V.resolve(this.Zr(r))}getNextMutationBatchAfterBatchId(e,r){let t=r+1,i=this.Xr(t),o=i<0?0:i;return V.resolve(this.mutationQueue.length>o?this.mutationQueue[o]:null)}getHighestUnacknowledgedBatchId(){return V.resolve(this.mutationQueue.length===0?Bl:this.er-1)}getAllMutationBatches(e){return V.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,r){let t=new an(r,0),i=new an(r,Number.POSITIVE_INFINITY),o=[];return this.Yr.forEachInRange([t,i],s=>{let a=this.Zr(s.Hr);o.push(a)}),V.resolve(o)}getAllMutationBatchesAffectingDocumentKeys(e,r){let t=new at(De);return r.forEach(i=>{let o=new an(i,0),s=new an(i,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([o,s],a=>{t=t.add(a.Hr)})}),V.resolve(this.ei(t))}getAllMutationBatchesAffectingQuery(e,r){let t=r.path,i=t.length+1,o=t;ie.isDocumentKey(o)||(o=o.child(""));let s=new an(new ie(o),0),a=new at(De);return this.Yr.forEachWhile(c=>{let l=c.key.path;return!!t.isPrefixOf(l)&&(l.length===i&&(a=a.add(c.Hr)),!0)},s),V.resolve(this.ei(a))}ei(e){let r=[];return e.forEach(t=>{let i=this.Zr(t);i!==null&&r.push(i)}),r}removeMutationBatch(e,r){he(this.ti(r.batchId,"removed")===0,55003),this.mutationQueue.shift();let t=this.Yr;return V.forEach(r.mutations,i=>{let o=new an(i.key,r.batchId);return t=t.delete(o),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Yr=t})}rr(e){}containsKey(e,r){let t=new an(r,0),i=this.Yr.firstAfterOrEqual(t);return V.resolve(r.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,V.resolve()}ti(e,r){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){let r=this.Xr(e);return r<0||r>=this.mutationQueue.length?null:this.mutationQueue[r]}};var Yb=class{constructor(e){this.ni=e,this.docs=(function(){return new Dt(ie.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,r){let t=r.key,i=this.docs.get(t),o=i?i.size:0,s=this.ni(r);return this.docs=this.docs.insert(t,{document:r.mutableCopy(),size:s}),this.size+=s-o,this.indexManager.addToCollectionParentIndex(e,t.path.popLast())}removeEntry(e){let r=this.docs.get(e);r&&(this.docs=this.docs.remove(e),this.size-=r.size)}getEntry(e,r){let t=this.docs.get(r);return V.resolve(t?t.document.mutableCopy():In.newInvalidDocument(r))}getEntries(e,r){let t=Yr();return r.forEach(i=>{let o=this.docs.get(i);t=t.insert(i,o?o.document.mutableCopy():In.newInvalidDocument(i))}),V.resolve(t)}getDocumentsMatchingQuery(e,r,t,i){let o=Yr(),s=r.path,a=new ie(s.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(a);for(;c.hasNext();){let{key:l,value:{document:u}}=c.getNext();if(!s.isPrefixOf(l.path))break;l.path.length>s.length+1||XL(DH(u),t)<=0||(i.has(u.key)||vp(r,u))&&(o=o.insert(u.key,u.mutableCopy()))}return V.resolve(o)}getAllFromCollectionGroup(e,r,t,i){ae(9500)}ri(e,r){return V.forEach(this.docs,t=>r(t))}newChangeBuffer(e){return new Qb(this)}getSize(e){return V.resolve(this.size)}},Qb=class extends iy{constructor(e){super(),this.Or=e}applyChanges(e){let r=[];return this.changes.forEach((t,i)=>{i.isValidDocument()?r.push(this.Or.addEntry(e,i)):this.Or.removeEntry(t)}),V.waitFor(r)}getFromCache(e,r){return this.Or.getEntry(e,r)}getAllFromCache(e,r){return this.Or.getEntries(e,r)}};var Xb=class{constructor(e){this.persistence=e,this.ii=new qi(r=>Wl(r),Tp),this.lastRemoteSnapshotVersion=me.min(),this.highestTargetId=0,this.si=0,this.oi=new ap,this.targetCount=0,this._i=Oh.ar()}forEachTarget(e,r){return this.ii.forEach((t,i)=>r(i)),V.resolve()}getLastRemoteSnapshotVersion(e){return V.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return V.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),V.resolve(this.highestTargetId)}setTargetsMetadata(e,r,t){return t&&(this.lastRemoteSnapshotVersion=t),r>this.si&&(this.si=r),V.resolve()}hr(e){this.ii.set(e.target,e);let r=e.targetId;r>this.highestTargetId&&(this._i=new Oh(r),this.highestTargetId=r),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,r){return this.hr(r),this.targetCount+=1,V.resolve()}updateTargetData(e,r){return this.hr(r),V.resolve()}removeTargetData(e,r){return this.ii.delete(r.target),this.oi.zr(r.targetId),this.targetCount-=1,V.resolve()}removeTargets(e,r,t){let i=0,o=[];return this.ii.forEach((s,a)=>{a.sequenceNumber<=r&&t.get(a.targetId)===null&&(this.ii.delete(s),o.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),V.waitFor(o).next(()=>i)}getTargetCount(e){return V.resolve(this.targetCount)}getTargetData(e,r){let t=this.ii.get(r)||null;return V.resolve(t)}addMatchingKeys(e,r,t){return this.oi.Kr(r,t),V.resolve()}removeMatchingKeys(e,r,t){this.oi.Gr(r,t);let i=this.persistence.referenceDelegate,o=[];return i&&r.forEach(s=>{o.push(i.markPotentiallyOrphaned(e,s))}),V.waitFor(o)}removeMatchingKeysForTargetId(e,r){return this.oi.zr(r),V.resolve()}getMatchingKeysForTargetId(e,r){let t=this.oi.Jr(r);return V.resolve(t)}containsKey(e,r){return V.resolve(this.oi.containsKey(r))}};var cp=class{constructor(e,r){this.ai={},this.overlays={},this.ui=new qr(0),this.ci=!1,this.ci=!0,this.li=new qb,this.referenceDelegate=e(this),this.hi=new Xb(this),this.indexManager=new Fb,this.remoteDocumentCache=(function(i){return new Yb(i)})(t=>this.referenceDelegate.Pi(t)),this.serializer=new Qv(r),this.Ti=new Wb(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let r=this.overlays[e.toKey()];return r||(r=new zb,this.overlays[e.toKey()]=r),r}getMutationQueue(e,r){let t=this.ai[e.toKey()];return t||(t=new Kb(r,this.referenceDelegate),this.ai[e.toKey()]=t),t}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,r,t){X("MemoryPersistence","Starting transaction:",e);let i=new Jb(this.ui.next());return this.referenceDelegate.Ii(),t(i).next(o=>this.referenceDelegate.di(i).next(()=>o)).toPromise().then(o=>(i.raiseOnCommittedEvent(),o))}Ei(e,r){return V.or(Object.values(this.ai).map(t=>()=>t.containsKey(e,r)))}},Jb=class extends xv{constructor(e){super(),this.currentSequenceNumber=e}},sy=class n{constructor(e){this.persistence=e,this.Ai=new ap,this.Ri=null}static Vi(e){return new n(e)}get mi(){if(this.Ri)return this.Ri;throw ae(60996)}addReference(e,r,t){return this.Ai.addReference(t,r),this.mi.delete(t.toString()),V.resolve()}removeReference(e,r,t){return this.Ai.removeReference(t,r),this.mi.add(t.toString()),V.resolve()}markPotentiallyOrphaned(e,r){return this.mi.add(r.toString()),V.resolve()}removeTarget(e,r){this.Ai.zr(r.targetId).forEach(i=>this.mi.add(i.toString()));let t=this.persistence.getTargetCache();return t.getMatchingKeysForTargetId(e,r.targetId).next(i=>{i.forEach(o=>this.mi.add(o.toString()))}).next(()=>t.removeTargetData(e,r))}Ii(){this.Ri=new Set}di(e){let r=this.persistence.getRemoteDocumentCache().newChangeBuffer();return V.forEach(this.mi,t=>{let i=ie.fromPath(t);return this.fi(e,i).next(o=>{o||r.removeEntry(i,me.min())})}).next(()=>(this.Ri=null,r.apply(e)))}updateLimboDocument(e,r){return this.fi(e,r).next(t=>{t?this.mi.delete(r.toString()):this.mi.add(r.toString())})}Pi(e){return 0}fi(e,r){return V.or([()=>V.resolve(this.Ai.containsKey(r)),()=>this.persistence.getTargetCache().containsKey(e,r),()=>this.persistence.Ei(e,r)])}},ay=class n{constructor(e,r){this.persistence=e,this.gi=new qi(t=>nr(t.path),(t,i)=>t.isEqual(i)),this.garbageCollector=xW(this,r)}static Vi(e,r){return new n(e,r)}Ii(){}di(e){return V.resolve()}forEachTarget(e,r){return this.persistence.getTargetCache().forEachTarget(e,r)}mr(e){let r=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(t=>r.next(i=>t+i))}yr(e){let r=0;return this.gr(e,t=>{r++}).next(()=>r)}gr(e,r){return V.forEach(this.gi,(t,i)=>this.Sr(e,t,i).next(o=>o?V.resolve():r(i)))}removeTargets(e,r,t){return this.persistence.getTargetCache().removeTargets(e,r,t)}removeOrphanedDocuments(e,r){let t=0,i=this.persistence.getRemoteDocumentCache(),o=i.newChangeBuffer();return i.ri(e,s=>this.Sr(e,s,r).next(a=>{a||(t++,o.removeEntry(s,me.min()))})).next(()=>o.apply(e)).next(()=>t)}markPotentiallyOrphaned(e,r){return this.gi.set(r,e.currentSequenceNumber),V.resolve()}removeTarget(e,r){let t=r.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,t)}addReference(e,r,t){return this.gi.set(t,e.currentSequenceNumber),V.resolve()}removeReference(e,r,t){return this.gi.set(t,e.currentSequenceNumber),V.resolve()}updateLimboDocument(e,r){return this.gi.set(r,e.currentSequenceNumber),V.resolve()}Pi(e){let r=e.key.toString().length;return e.isFoundDocument()&&(r+=Cv(e.data.value)),r}Sr(e,r,t){return V.or([()=>this.persistence.Ei(e,r),()=>this.persistence.getTargetCache().containsKey(e,r),()=>{let i=this.gi.get(r);return V.resolve(i!==void 0&&i>t)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var Zb=class{constructor(e){this.serializer=e}q(e,r,t,i){let o=new Fv("createOrUpgrade",r);t<1&&i>=1&&((function(c){c.createObjectStore(_p)})(e),(function(c){c.createObjectStore(Wm,{keyPath:rie}),c.createObjectStore(zi,{keyPath:gj,autoIncrement:!0}).createIndex(kl,mj,{unique:!0}),c.createObjectStore(Eh)})(e),nH(e),(function(c){c.createObjectStore(Ll)})(e));let s=V.resolve();return t<3&&i>=3&&(t!==0&&((function(c){c.deleteObjectStore(Th),c.deleteObjectStore(_h),c.deleteObjectStore(Gl)})(e),nH(e)),s=s.next(()=>(function(c){let l=c.store(Gl),u={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:me.min().toTimestamp(),targetCount:0};return l.put(Vv,u)})(o))),t<4&&i>=4&&(t!==0&&(s=s.next(()=>(function(c,l){return l.store(zi).j().next(d=>{c.deleteObjectStore(zi),c.createObjectStore(zi,{keyPath:gj,autoIncrement:!0}).createIndex(kl,mj,{unique:!0});let f=l.store(zi),g=d.map(p=>f.put(p));return V.waitFor(g)})})(e,o))),s=s.next(()=>{(function(c){c.createObjectStore(Ih,{keyPath:hie})})(e)})),t<5&&i>=5&&(s=s.next(()=>this.pi(o))),t<6&&i>=6&&(s=s.next(()=>((function(c){c.createObjectStore(zm)})(e),this.yi(o)))),t<7&&i>=7&&(s=s.next(()=>this.wi(o))),t<8&&i>=8&&(s=s.next(()=>this.Si(e,o))),t<9&&i>=9&&(s=s.next(()=>{(function(c){c.objectStoreNames.contains("remoteDocumentChanges")&&c.deleteObjectStore("remoteDocumentChanges")})(e)})),t<10&&i>=10&&(s=s.next(()=>this.bi(o))),t<11&&i>=11&&(s=s.next(()=>{(function(c){c.createObjectStore(Oy,{keyPath:fie})})(e),(function(c){c.createObjectStore(wy,{keyPath:gie})})(e)})),t<12&&i>=12&&(s=s.next(()=>{(function(c){let l=c.createObjectStore(by,{keyPath:vie});l.createIndex(tb,yie,{unique:!1}),l.createIndex(PH,Sie,{unique:!1})})(e)})),t<13&&i>=13&&(s=s.next(()=>(function(c){let l=c.createObjectStore(Uv,{keyPath:oie});l.createIndex(Dv,sie),l.createIndex(wH,aie)})(e)).next(()=>this.Di(e,o)).next(()=>e.deleteObjectStore(Ll))),t<14&&i>=14&&(s=s.next(()=>this.Ci(e,o))),t<15&&i>=15&&(s=s.next(()=>(function(c){c.createObjectStore(eM,{keyPath:mie,autoIncrement:!0}).createIndex(eb,pie,{unique:!1}),c.createObjectStore(xm,{keyPath:Eie}).createIndex(LH,_ie,{unique:!1}),c.createObjectStore(Fm,{keyPath:Tie}).createIndex(MH,Iie,{unique:!1})})(e))),t<16&&i>=16&&(s=s.next(()=>{r.objectStore(xm).clear()}).next(()=>{r.objectStore(Fm).clear()})),t<17&&i>=17&&(s=s.next(()=>{(function(c){c.createObjectStore(tM,{keyPath:Aie})})(e)})),t<18&&i>=18&&UC()&&(s=s.next(()=>{r.objectStore(xm).clear()}).next(()=>{r.objectStore(Fm).clear()})),s}yi(e){let r=0;return e.store(Ll).X((t,i)=>{r+=ty(i)}).next(()=>{let t={byteSize:r};return e.store(zm).put(Zw,t)})}pi(e){let r=e.store(Wm),t=e.store(zi);return r.j().next(i=>V.forEach(i,o=>{let s=IDBKeyRange.bound([o.userId,Bl],[o.userId,o.lastAcknowledgedBatchId]);return t.j(kl,s).next(a=>V.forEach(a,c=>{he(c.userId===o.userId,18650,"Cannot process batch from unexpected user",{batchId:c.batchId});let l=Pl(this.serializer,c);return bW(e,o.userId,l).next(()=>{})}))}))}wi(e){let r=e.store(Th),t=e.store(Ll);return e.store(Gl).get(Vv).next(i=>{let o=[];return t.X((s,a)=>{let c=new We(s),l=(function(d){return[0,nr(d)]})(c);o.push(r.get(l).next(u=>u?V.resolve():(d=>r.put({targetId:0,path:nr(d),sequenceNumber:i.highestListenSequenceNumber}))(c)))}).next(()=>V.waitFor(o))})}Si(e,r){e.createObjectStore(qm,{keyPath:die});let t=r.store(qm),i=new sp,o=s=>{if(i.add(s)){let a=s.lastSegment(),c=s.popLast();return t.put({collectionId:a,parent:nr(c)})}};return r.store(Ll).X({Z:!0},(s,a)=>{let c=new We(s);return o(c.popLast())}).next(()=>r.store(Eh).X({Z:!0},([s,a,c],l)=>{let u=Vo(a);return o(u.popLast())}))}bi(e){let r=e.store(_h);return r.X((t,i)=>{let o=Lm(i),s=RW(this.serializer,o);return r.put(s)})}Di(e,r){let t=r.store(Ll),i=[];return t.X((o,s)=>{let a=r.store(Uv),c=(function(d){return d.document?new ie(We.fromString(d.document.name).popFirst(5)):d.noDocument?ie.fromSegments(d.noDocument.path):d.unknownDocument?ie.fromSegments(d.unknownDocument.path):ae(36783)})(s).path.toArray(),l={prefixPath:c.slice(0,c.length-2),collectionGroup:c[c.length-2],documentId:c[c.length-1],readTime:s.readTime||[0,0],unknownDocument:s.unknownDocument,noDocument:s.noDocument,document:s.document,hasCommittedMutations:!!s.hasCommittedMutations};i.push(a.put(l))}).next(()=>V.waitFor(i))}Ci(e,r){let t=r.store(zi),i=FW(this.serializer),o=new cp(sy.Vi,this.serializer.gt);return t.j().next(s=>{let a=new Map;return s.forEach(c=>{var l;let u=(l=a.get(c.userId))!==null&&l!==void 0?l:Ue();Pl(this.serializer,c).keys().forEach(d=>u=u.add(d)),a.set(c.userId,u)}),V.forEach(a,(c,l)=>{let u=new cn(l),d=Jv.yt(this.serializer,u),f=o.getIndexManager(u),g=ny.yt(u,this.serializer,f,o.referenceDelegate);return new oy(i,g,d,f).recalculateAndSaveOverlaysForDocumentKeys(new Km(r,qr.ue),c).next()})})}};function nH(n){n.createObjectStore(Th,{keyPath:lie}).createIndex(ZL,uie,{unique:!0}),n.createObjectStore(_h,{keyPath:"targetId"}).createIndex(bH,cie,{unique:!0}),n.createObjectStore(Gl)}var La="IndexedDbPersistence",xw=18e5,Fw=5e3,kw="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",loe="main",eL=class n{constructor(e,r,t,i,o,s,a,c,l,u,d=18){if(this.allowTabSynchronization=e,this.persistenceKey=r,this.clientId=t,this.Fi=o,this.window=s,this.document=a,this.Mi=l,this.xi=u,this.Oi=d,this.ui=null,this.ci=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Ni=null,this.inForeground=!1,this.Bi=null,this.Li=null,this.ki=Number.NEGATIVE_INFINITY,this.qi=f=>Promise.resolve(),!n.C())throw new Q(j.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new Gb(this,i),this.Qi=r+loe,this.serializer=new Qv(c),this.$i=new ph(this.Qi,this.Oi,new Zb(this.serializer)),this.li=new Ob,this.hi=new Ub(this.referenceDelegate,this.serializer),this.remoteDocumentCache=FW(this.serializer),this.Ti=new Nb,this.window&&this.window.localStorage?this.Ui=this.window.localStorage:(this.Ui=null,u===!1&&Xt(La,"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.Ki().then(()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new Q(j.FAILED_PRECONDITION,kw);return this.Wi(),this.Gi(),this.zi(),this.runTransaction("getHighestListenSequenceNumber","readonly",e=>this.hi.getHighestSequenceNumber(e))}).then(e=>{this.ui=new qr(e,this.Mi)}).then(()=>{this.ci=!0}).catch(e=>(this.$i&&this.$i.close(),Promise.reject(e)))}ji(e){return this.qi=r=>I(this,null,function*(){if(this.started)return e(r)}),e(this.isPrimary)}setDatabaseDeletedListener(e){this.$i.setDatabaseDeletedListener(e)}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.Fi.enqueueAndForget(()=>I(this,null,function*(){this.started&&(yield this.Ki())})))}Ki(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",e=>yv(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next(()=>{if(this.isPrimary)return this.Ji(e).next(r=>{r||(this.isPrimary=!1,this.Fi.enqueueRetryable(()=>this.qi(!1)))})}).next(()=>this.Hi(e)).next(r=>this.isPrimary&&!r?this.Yi(e).next(()=>!1):!!r&&this.Zi(e).next(()=>!0))).catch(e=>{if(Qa(e))return X(La,"Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return X(La,"Releasing owner lease after error during lease refresh",e),!1}).then(e=>{this.isPrimary!==e&&this.Fi.enqueueRetryable(()=>this.qi(e)),this.isPrimary=e})}Ji(e){return wm(e).get(Jd).next(r=>V.resolve(this.Xi(r)))}es(e){return yv(e).delete(this.clientId)}ts(){return I(this,null,function*(){if(this.isPrimary&&!this.ns(this.ki,xw)){this.ki=Date.now();let e=yield this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",r=>{let t=yn(r,Ih);return t.j().next(i=>{let o=this.rs(i,xw),s=i.filter(a=>o.indexOf(a)===-1);return V.forEach(s,a=>t.delete(a.clientId)).next(()=>s)})}).catch(()=>[]);if(this.Ui)for(let r of e)this.Ui.removeItem(this.ss(r.clientId))}})}zi(){this.Li=this.Fi.enqueueAfterDelay("client_metadata_refresh",4e3,()=>this.Ki().then(()=>this.ts()).then(()=>this.zi()))}Xi(e){return!!e&&e.ownerId===this.clientId}Hi(e){return this.xi?V.resolve(!0):wm(e).get(Jd).next(r=>{if(r!==null&&this.ns(r.leaseTimestampMs,Fw)&&!this._s(r.ownerId)){if(this.Xi(r)&&this.networkEnabled)return!0;if(!this.Xi(r)){if(!r.allowTabSynchronization)throw new Q(j.FAILED_PRECONDITION,kw);return!1}}return!(!this.networkEnabled||!this.inForeground)||yv(e).j().next(t=>this.rs(t,Fw).find(i=>{if(this.clientId!==i.clientId){let o=!this.networkEnabled&&i.networkEnabled,s=!this.inForeground&&i.inForeground,a=this.networkEnabled===i.networkEnabled;if(o||s&&a)return!0}return!1})===void 0)}).next(r=>(this.isPrimary!==r&&X(La,`Client ${r?"is":"is not"} eligible for a primary lease.`),r))}shutdown(){return I(this,null,function*(){this.ci=!1,this.us(),this.Li&&(this.Li.cancel(),this.Li=null),this.cs(),this.ls(),yield this.$i.runTransaction("shutdown","readwrite",[_p,Ih],e=>{let r=new Km(e,qr.ue);return this.Yi(r).next(()=>this.es(r))}),this.$i.close(),this.hs()})}rs(e,r){return e.filter(t=>this.ns(t.updateTimeMs,r)&&!this._s(t.clientId))}Ps(){return this.runTransaction("getActiveClients","readonly",e=>yv(e).j().next(r=>this.rs(r,xw).map(t=>t.clientId)))}get started(){return this.ci}getGlobalsCache(){return this.li}getMutationQueue(e,r){return ny.yt(e,this.serializer,r,this.referenceDelegate)}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new kb(e,this.serializer.gt.databaseId)}getDocumentOverlayCache(e){return Jv.yt(this.serializer,e)}getBundleCache(){return this.Ti}runTransaction(e,r,t){X(La,"Starting transaction:",e);let i=r==="readonly"?"readonly":"readwrite",o=(function(c){return c===18?Cie:c===17?UH:c===16?Rie:c===15?nM:c===14?kH:c===13?FH:c===12?Die:c===11?xH:void ae(60245)})(this.Oi),s;return this.$i.runTransaction(e,i,o,a=>(s=new Km(a,this.ui?this.ui.next():qr.ue),r==="readwrite-primary"?this.Ji(s).next(c=>!!c||this.Hi(s)).next(c=>{if(!c)throw Xt(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.Fi.enqueueRetryable(()=>this.qi(!1)),new Q(j.FAILED_PRECONDITION,RH);return t(s)}).next(c=>this.Zi(s).next(()=>c)):this.Ts(s).next(()=>t(s)))).then(a=>(s.raiseOnCommittedEvent(),a))}Ts(e){return wm(e).get(Jd).next(r=>{if(r!==null&&this.ns(r.leaseTimestampMs,Fw)&&!this._s(r.ownerId)&&!this.Xi(r)&&!(this.xi||this.allowTabSynchronization&&r.allowTabSynchronization))throw new Q(j.FAILED_PRECONDITION,kw)})}Zi(e){let r={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return wm(e).put(Jd,r)}static C(){return ph.C()}Yi(e){let r=wm(e);return r.get(Jd).next(t=>this.Xi(t)?(X(La,"Releasing primary lease."),r.delete(Jd)):V.resolve())}ns(e,r){let t=Date.now();return!(e<t-r)&&(!(e>t)||(Xt(`Detected an update time that is in the future: ${e} > ${t}`),!1))}Wi(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Bi=()=>{this.Fi.enqueueAndForget(()=>(this.inForeground=this.document.visibilityState==="visible",this.Ki()))},this.document.addEventListener("visibilitychange",this.Bi),this.inForeground=this.document.visibilityState==="visible")}cs(){this.Bi&&(this.document.removeEventListener("visibilitychange",this.Bi),this.Bi=null)}Gi(){var e;typeof((e=this.window)===null||e===void 0?void 0:e.addEventListener)=="function"&&(this.Ni=()=>{this.us();let r=/(?:Version|Mobile)\/1[456]/;kC()&&(navigator.appVersion.match(r)||navigator.userAgent.match(r))&&this.Fi.enterRestrictedMode(!0),this.Fi.enqueueAndForget(()=>this.shutdown())},this.window.addEventListener("pagehide",this.Ni))}ls(){this.Ni&&(this.window.removeEventListener("pagehide",this.Ni),this.Ni=null)}_s(e){var r;try{let t=((r=this.Ui)===null||r===void 0?void 0:r.getItem(this.ss(e)))!==null;return X(La,`Client '${e}' ${t?"is":"is not"} zombied in LocalStorage`),t}catch(t){return Xt(La,"Failed to get zombied client id.",t),!1}}us(){if(this.Ui)try{this.Ui.setItem(this.ss(this.clientId),String(Date.now()))}catch(e){Xt("Failed to set zombie client id.",e)}}hs(){if(this.Ui)try{this.Ui.removeItem(this.ss(this.clientId))}catch{}}ss(e){return`firestore_zombie_${this.persistenceKey}_${e}`}};function wm(n){return yn(n,_p)}function yv(n){return yn(n,Ih)}function kW(n,e){let r=n.projectId;return n.isDefaultDatabase||(r+="."+n.database),"firestore/"+e+"/"+r+"/"}var tL=class n{constructor(e,r,t,i){this.targetId=e,this.fromCache=r,this.Is=t,this.ds=i}static Es(e,r){let t=Ue(),i=Ue();for(let o of r.docChanges)switch(o.type){case 0:t=t.add(o.doc.key);break;case 1:i=i.add(o.doc.key)}return new n(e,r.fromCache,t,i)}};var nL=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var cy=class{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(function(){return kC()?8:CH(En())>0?6:4})()}initialize(e,r){this.gs=e,this.indexManager=r,this.As=!0}getDocumentsMatchingQuery(e,r,t,i){let o={result:null};return this.ps(e,r).next(s=>{o.result=s}).next(()=>{if(!o.result)return this.ys(e,r,i,t).next(s=>{o.result=s})}).next(()=>{if(o.result)return;let s=new nL;return this.ws(e,r,s).next(a=>{if(o.result=a,this.Rs)return this.Ss(e,r,s,a.size)})}).next(()=>o.result)}Ss(e,r,t,i){return t.documentReadCount<this.Vs?(ih()<=xe.DEBUG&&X("QueryEngine","SDK will not create cache indexes for query:",oh(r),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),V.resolve()):(ih()<=xe.DEBUG&&X("QueryEngine","Query:",oh(r),"scans",t.documentReadCount,"local documents and returns",i,"documents as results."),t.documentReadCount>this.fs*i?(ih()<=xe.DEBUG&&X("QueryEngine","The SDK decides to create cache indexes for query:",oh(r),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Qr(r))):V.resolve())}ps(e,r){if(Cj(r))return V.resolve(null);let t=Qr(r);return this.indexManager.getIndexType(e,t).next(i=>i===0?null:(r.limit!==null&&i===1&&(r=zv(r,null,"F"),t=Qr(r)),this.indexManager.getDocumentsMatchingTarget(e,t).next(o=>{let s=Ue(...o);return this.gs.getDocuments(e,s).next(a=>this.indexManager.getMinOffset(e,t).next(c=>{let l=this.bs(r,a);return this.Ds(r,l,s,c.readTime)?this.ps(e,zv(r,null,"F")):this.vs(e,l,r,c)}))})))}ys(e,r,t,i){return Cj(r)||i.isEqual(me.min())?V.resolve(null):this.gs.getDocuments(e,t).next(o=>{let s=this.bs(r,o);return this.Ds(r,s,t,i)?V.resolve(null):(ih()<=xe.DEBUG&&X("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),oh(r)),this.vs(e,s,r,AH(i,gh)).next(a=>a))})}bs(e,r){let t=new at(rW(e));return r.forEach((i,o)=>{vp(e,o)&&(t=t.add(o))}),t}Ds(e,r,t,i){if(e.limit===null)return!1;if(t.size!==r.size)return!0;let o=e.limitType==="F"?r.last():r.first();return!!o&&(o.hasPendingWrites||o.version.compareTo(i)>0)}ws(e,r,t){return ih()<=xe.DEBUG&&X("QueryEngine","Using full collection scan to execute query:",oh(r)),this.gs.getDocumentsMatchingQuery(e,r,Ei.min(),t)}vs(e,r,t,i){return this.gs.getDocumentsMatchingQuery(e,t,i).next(o=>(r.forEach(s=>{o=o.insert(s.key,s)}),o))}};var hM="LocalStore",uoe=3e8,rL=class{constructor(e,r,t,i){this.persistence=e,this.Cs=r,this.serializer=i,this.Fs=new Dt(De),this.Ms=new qi(o=>Wl(o),Tp),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(t)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new oy(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",r=>e.collect(r,this.Fs))}};function UW(n,e,r,t){return new rL(n,e,r,t)}function VW(n,e){return I(this,null,function*(){let r=de(n);return yield r.persistence.runTransaction("Handle user change","readonly",t=>{let i;return r.mutationQueue.getAllMutationBatches(t).next(o=>(i=o,r.Ns(e),r.mutationQueue.getAllMutationBatches(t))).next(o=>{let s=[],a=[],c=Ue();for(let l of i){s.push(l.batchId);for(let u of l.mutations)c=c.add(u.key)}for(let l of o){a.push(l.batchId);for(let u of l.mutations)c=c.add(u.key)}return r.localDocuments.getDocuments(t,c).next(l=>({Bs:l,removedBatchIds:s,addedBatchIds:a}))})})})}function doe(n,e){let r=de(n);return r.persistence.runTransaction("Acknowledge batch","readwrite-primary",t=>{let i=e.batch.keys(),o=r.Os.newChangeBuffer({trackRemovals:!0});return(function(a,c,l,u){let d=l.batch,f=d.keys(),g=V.resolve();return f.forEach(p=>{g=g.next(()=>u.getEntry(c,p)).next(_=>{let T=l.docVersions.get(p);he(T!==null,48541),_.version.compareTo(T)<0&&(d.applyToRemoteDocument(_,l),_.isValidDocument()&&(_.setReadTime(l.commitVersion),u.addEntry(_)))})}),g.next(()=>a.mutationQueue.removeMutationBatch(c,d))})(r,t,e,o).next(()=>o.apply(t)).next(()=>r.mutationQueue.performConsistencyCheck(t)).next(()=>r.documentOverlayCache.removeOverlaysForBatchId(t,i,e.batch.batchId)).next(()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,(function(a){let c=Ue();for(let l=0;l<a.mutationResults.length;++l)a.mutationResults[l].transformResults.length>0&&(c=c.add(a.batch.mutations[l].key));return c})(e))).next(()=>r.localDocuments.getDocuments(t,i))})}function BW(n){let e=de(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",r=>e.hi.getLastRemoteSnapshotVersion(r))}function hoe(n,e){let r=de(n),t=e.snapshotVersion,i=r.Fs;return r.persistence.runTransaction("Apply remote event","readwrite-primary",o=>{let s=r.Os.newChangeBuffer({trackRemovals:!0});i=r.Fs;let a=[];e.targetChanges.forEach((u,d)=>{let f=i.get(d);if(!f)return;a.push(r.hi.removeMatchingKeys(o,u.removedDocuments,d).next(()=>r.hi.addMatchingKeys(o,u.addedDocuments,d)));let g=f.withSequenceNumber(o.currentSequenceNumber);e.targetMismatches.get(d)!==null?g=g.withResumeToken(un.EMPTY_BYTE_STRING,me.min()).withLastLimboFreeSnapshotVersion(me.min()):u.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(u.resumeToken,t)),i=i.insert(d,g),(function(_,T,S){return _.resumeToken.approximateByteSize()===0||T.snapshotVersion.toMicroseconds()-_.snapshotVersion.toMicroseconds()>=uoe?!0:S.addedDocuments.size+S.modifiedDocuments.size+S.removedDocuments.size>0})(f,g,u)&&a.push(r.hi.updateTargetData(o,g))});let c=Yr(),l=Ue();if(e.documentUpdates.forEach(u=>{e.resolvedLimboDocuments.has(u)&&a.push(r.persistence.referenceDelegate.updateLimboDocument(o,u))}),a.push(foe(o,s,e.documentUpdates).next(u=>{c=u.Ls,l=u.ks})),!t.isEqual(me.min())){let u=r.hi.getLastRemoteSnapshotVersion(o).next(d=>r.hi.setTargetsMetadata(o,o.currentSequenceNumber,t));a.push(u)}return V.waitFor(a).next(()=>s.apply(o)).next(()=>r.localDocuments.getLocalViewOfDocuments(o,c,l)).next(()=>c)}).then(o=>(r.Fs=i,o))}function foe(n,e,r){let t=Ue(),i=Ue();return r.forEach(o=>t=t.add(o)),e.getEntries(n,t).next(o=>{let s=Yr();return r.forEach((a,c)=>{let l=o.get(a);c.isFoundDocument()!==l.isFoundDocument()&&(i=i.add(a)),c.isNoDocument()&&c.version.isEqual(me.min())?(e.removeEntry(a,c.readTime),s=s.insert(a,c)):!l.isValidDocument()||c.version.compareTo(l.version)>0||c.version.compareTo(l.version)===0&&l.hasPendingWrites?(e.addEntry(c),s=s.insert(a,c)):X(hM,"Ignoring outdated watch update for ",a,". Current version:",l.version," Watch version:",c.version)}),{Ls:s,ks:i}})}function goe(n,e){let r=de(n);return r.persistence.runTransaction("Get next mutation batch","readonly",t=>(e===void 0&&(e=Bl),r.mutationQueue.getNextMutationBatchAfterBatchId(t,e)))}function ly(n,e){let r=de(n);return r.persistence.runTransaction("Allocate target","readwrite",t=>{let i;return r.hi.getTargetData(t,e).next(o=>o?(i=o,V.resolve(i)):r.hi.allocateTargetId(t).next(s=>(i=new Nh(e,s,"TargetPurposeListen",t.currentSequenceNumber),r.hi.addTargetData(t,i).next(()=>i))))}).then(t=>{let i=r.Fs.get(t.targetId);return(i===null||t.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(r.Fs=r.Fs.insert(t.targetId,t),r.Ms.set(e,t.targetId)),t})}function wh(n,e,r){return I(this,null,function*(){let t=de(n),i=t.Fs.get(e),o=r?"readwrite":"readwrite-primary";try{r||(yield t.persistence.runTransaction("Release target",o,s=>t.persistence.referenceDelegate.removeTarget(s,i)))}catch(s){if(!Qa(s))throw s;X(hM,`Failed to update sequence numbers for target ${e}: ${s}`)}t.Fs=t.Fs.remove(e),t.Ms.delete(i.target)})}function iL(n,e,r){let t=de(n),i=me.min(),o=Ue();return t.persistence.runTransaction("Execute query","readwrite",s=>(function(c,l,u){let d=de(c),f=d.Ms.get(u);return f!==void 0?V.resolve(d.Fs.get(f)):d.hi.getTargetData(l,u)})(t,s,Qr(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,t.hi.getMatchingKeysForTargetId(s,a.targetId).next(c=>{o=c})}).next(()=>t.Cs.getDocumentsMatchingQuery(s,e,r?i:me.min(),r?o:Ue())).next(a=>(jW(t,nW(e),a),{documents:a,qs:o})))}function GW(n,e){let r=de(n),t=de(r.hi),i=r.Fs.get(e);return i?Promise.resolve(i.target):r.persistence.runTransaction("Get target data","readonly",o=>t.Et(o,e).next(s=>s?s.target:null))}function $W(n,e){let r=de(n),t=r.xs.get(e)||me.min();return r.persistence.runTransaction("Get new document changes","readonly",i=>r.Os.getAllFromCollectionGroup(i,e,AH(t,gh),Number.MAX_SAFE_INTEGER)).then(i=>(jW(r,e,i),i))}function jW(n,e,r){let t=n.xs.get(e)||me.min();r.forEach((i,o)=>{o.readTime.compareTo(t)>0&&(t=o.readTime)}),n.xs.set(e,t)}var HW="firestore_clients";function rH(n,e){return`${HW}_${n}_${e}`}var WW="firestore_mutations";function iH(n,e,r){let t=`${WW}_${n}_${r}`;return e.isAuthenticated()&&(t+=`_${e.uid}`),t}var zW="firestore_targets";function Uw(n,e){return`${zW}_${n}_${e}`}var Uo="SharedClientState",uy=class n{constructor(e,r,t,i){this.user=e,this.batchId=r,this.state=t,this.error=i}static Ks(e,r,t){let i=JSON.parse(t),o,s=typeof i=="object"&&["pending","acknowledged","rejected"].indexOf(i.state)!==-1&&(i.error===void 0||typeof i.error=="object");return s&&i.error&&(s=typeof i.error.message=="string"&&typeof i.error.code=="string",s&&(o=new Q(i.error.code,i.error.message))),s?new n(e,r,i.state,o):(Xt(Uo,`Failed to parse mutation state for ID '${r}': ${t}`),null)}Ws(){let e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}},Bm=class n{constructor(e,r,t){this.targetId=e,this.state=r,this.error=t}static Ks(e,r){let t=JSON.parse(r),i,o=typeof t=="object"&&["not-current","current","rejected"].indexOf(t.state)!==-1&&(t.error===void 0||typeof t.error=="object");return o&&t.error&&(o=typeof t.error.message=="string"&&typeof t.error.code=="string",o&&(i=new Q(t.error.code,t.error.message))),o?new n(e,t.state,i):(Xt(Uo,`Failed to parse target state for ID '${e}': ${r}`),null)}Ws(){let e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}},dy=class n{constructor(e,r){this.clientId=e,this.activeTargetIds=r}static Ks(e,r){let t=JSON.parse(r),i=typeof t=="object"&&t.activeTargetIds instanceof Array,o=aM();for(let s=0;i&&s<t.activeTargetIds.length;++s)i=NH(t.activeTargetIds[s]),o=o.add(t.activeTargetIds[s]);return i?new n(e,o):(Xt(Uo,`Failed to parse client data for instance '${e}': ${r}`),null)}},oL=class n{constructor(e,r){this.clientId=e,this.onlineState=r}static Ks(e){let r=JSON.parse(e);return typeof r=="object"&&["Unknown","Online","Offline"].indexOf(r.onlineState)!==-1&&typeof r.clientId=="string"?new n(r.clientId,r.onlineState):(Xt(Uo,`Failed to parse online state: ${e}`),null)}},lp=class{constructor(){this.activeTargetIds=aM()}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},Gm=class{constructor(e,r,t,i,o){this.window=e,this.Fi=r,this.persistenceKey=t,this.js=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.Js=this.Hs.bind(this),this.Ys=new Dt(De),this.started=!1,this.Zs=[];let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=o,this.Xs=rH(this.persistenceKey,this.js),this.eo=(function(c){return`firestore_sequence_number_${c}`})(this.persistenceKey),this.Ys=this.Ys.insert(this.js,new lp),this.no=new RegExp(`^${HW}_${s}_([^_]*)$`),this.ro=new RegExp(`^${WW}_${s}_(\\d+)(?:_(.*))?$`),this.io=new RegExp(`^${zW}_${s}_(\\d+)$`),this.so=(function(c){return`firestore_online_state_${c}`})(this.persistenceKey),this.oo=(function(c){return`firestore_bundle_loaded_v2_${c}`})(this.persistenceKey),this.window.addEventListener("storage",this.Js)}static C(e){return!(!e||!e.localStorage)}start(){return I(this,null,function*(){let e=yield this.syncEngine.Ps();for(let t of e){if(t===this.js)continue;let i=this.getItem(rH(this.persistenceKey,t));if(i){let o=dy.Ks(t,i);o&&(this.Ys=this.Ys.insert(o.clientId,o))}}this._o();let r=this.storage.getItem(this.so);if(r){let t=this.ao(r);t&&this.uo(t)}for(let t of this.Zs)this.Hs(t);this.Zs=[],this.window.addEventListener("pagehide",()=>this.shutdown()),this.started=!0})}writeSequenceNumber(e){this.setItem(this.eo,JSON.stringify(e))}getAllActiveQueryTargets(){return this.co(this.Ys)}isActiveQueryTarget(e){let r=!1;return this.Ys.forEach((t,i)=>{i.activeTargetIds.has(e)&&(r=!0)}),r}addPendingMutation(e){this.lo(e,"pending")}updateMutationState(e,r,t){this.lo(e,r,t),this.ho(e)}addLocalQueryTarget(e,r=!0){let t="not-current";if(this.isActiveQueryTarget(e)){let i=this.storage.getItem(Uw(this.persistenceKey,e));if(i){let o=Bm.Ks(e,i);o&&(t=o.state)}}return r&&this.Po.Gs(e),this._o(),t}removeLocalQueryTarget(e){this.Po.zs(e),this._o()}isLocalQueryTarget(e){return this.Po.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(Uw(this.persistenceKey,e))}updateQueryState(e,r,t){this.To(e,r,t)}handleUserChange(e,r,t){r.forEach(i=>{this.ho(i)}),this.currentUser=e,t.forEach(i=>{this.addPendingMutation(i)})}setOnlineState(e){this.Io(e)}notifyBundleLoaded(e){this.Eo(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.Js),this.removeItem(this.Xs),this.started=!1)}getItem(e){let r=this.storage.getItem(e);return X(Uo,"READ",e,r),r}setItem(e,r){X(Uo,"SET",e,r),this.storage.setItem(e,r)}removeItem(e){X(Uo,"REMOVE",e),this.storage.removeItem(e)}Hs(e){let r=e;if(r.storageArea===this.storage){if(X(Uo,"EVENT",r.key,r.newValue),r.key===this.Xs)return void Xt("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Fi.enqueueRetryable(()=>I(this,null,function*(){if(this.started){if(r.key!==null){if(this.no.test(r.key)){if(r.newValue==null){let t=this.Ao(r.key);return this.Ro(t,null)}{let t=this.Vo(r.key,r.newValue);if(t)return this.Ro(t.clientId,t)}}else if(this.ro.test(r.key)){if(r.newValue!==null){let t=this.mo(r.key,r.newValue);if(t)return this.fo(t)}}else if(this.io.test(r.key)){if(r.newValue!==null){let t=this.po(r.key,r.newValue);if(t)return this.yo(t)}}else if(r.key===this.so){if(r.newValue!==null){let t=this.ao(r.newValue);if(t)return this.uo(t)}}else if(r.key===this.eo){let t=(function(o){let s=qr.ue;if(o!=null)try{let a=JSON.parse(o);he(typeof a=="number",30636,{wo:o}),s=a}catch(a){Xt(Uo,"Failed to read sequence number from WebStorage",a)}return s})(r.newValue);t!==qr.ue&&this.sequenceNumberHandler(t)}else if(r.key===this.oo){let t=this.So(r.newValue);yield Promise.all(t.map(i=>this.syncEngine.bo(i)))}}}else this.Zs.push(r)}))}}get Po(){return this.Ys.get(this.js)}_o(){this.setItem(this.Xs,this.Po.Ws())}lo(e,r,t){let i=new uy(this.currentUser,e,r,t),o=iH(this.persistenceKey,this.currentUser,e);this.setItem(o,i.Ws())}ho(e){let r=iH(this.persistenceKey,this.currentUser,e);this.removeItem(r)}Io(e){let r={clientId:this.js,onlineState:e};this.storage.setItem(this.so,JSON.stringify(r))}To(e,r,t){let i=Uw(this.persistenceKey,e),o=new Bm(e,r,t);this.setItem(i,o.Ws())}Eo(e){let r=JSON.stringify(Array.from(e));this.setItem(this.oo,r)}Ao(e){let r=this.no.exec(e);return r?r[1]:null}Vo(e,r){let t=this.Ao(e);return dy.Ks(t,r)}mo(e,r){let t=this.ro.exec(e),i=Number(t[1]),o=t[2]!==void 0?t[2]:null;return uy.Ks(new cn(o),i,r)}po(e,r){let t=this.io.exec(e),i=Number(t[1]);return Bm.Ks(i,r)}ao(e){return oL.Ks(e)}So(e){return JSON.parse(e)}fo(e){return I(this,null,function*(){if(e.user.uid===this.currentUser.uid)return this.syncEngine.Do(e.batchId,e.state,e.error);X(Uo,`Ignoring mutation for non-active user ${e.user.uid}`)})}yo(e){return this.syncEngine.vo(e.targetId,e.state,e.error)}Ro(e,r){let t=r?this.Ys.insert(e,r):this.Ys.remove(e),i=this.co(this.Ys),o=this.co(t),s=[],a=[];return o.forEach(c=>{i.has(c)||s.push(c)}),i.forEach(c=>{o.has(c)||a.push(c)}),this.syncEngine.Co(s,a).then(()=>{this.Ys=t})}uo(e){this.Ys.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}co(e){let r=aM();return e.forEach((t,i)=>{r=r.unionWith(i.activeTargetIds)}),r}},hy=class{constructor(){this.Fo=new lp,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,r,t){}addLocalQueryTarget(e,r=!0){return r&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,r,t){this.Mo[e]=r}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new lp,Promise.resolve()}handleUserChange(e,r,t){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var sL=class{xo(e){}shutdown(){}};var oH="ConnectivityMonitor",fy=class{constructor(){this.Oo=()=>this.No(),this.Bo=()=>this.Lo(),this.ko=[],this.qo()}xo(e){this.ko.push(e)}shutdown(){window.removeEventListener("online",this.Oo),window.removeEventListener("offline",this.Bo)}qo(){window.addEventListener("online",this.Oo),window.addEventListener("offline",this.Bo)}No(){X(oH,"Network connectivity changed: AVAILABLE");for(let e of this.ko)e(0)}Lo(){X(oH,"Network connectivity changed: UNAVAILABLE");for(let e of this.ko)e(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var Sv=null;function aL(){return Sv===null?Sv=(function(){return 268435456+Math.round(2147483648*Math.random())})():Sv++,"0x"+Sv.toString(16)}var Vw="RestConnection",moe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},cL=class{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let r=e.ssl?"https":"http",t=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=r+"://"+e.host,this.Uo=`projects/${t}/databases/${i}`,this.Ko=this.databaseId.database===Qm?`project_id=${t}`:`project_id=${t}&database_id=${i}`}Wo(e,r,t,i,o){let s=aL(),a=this.Go(e,r.toUriEncodedString());X(Vw,`Sending RPC '${e}' ${s}:`,a,t);let c={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(c,i,o);let{host:l}=new URL(a),u=jr(l);return this.jo(e,a,c,t,u).then(d=>(X(Vw,`Received RPC '${e}' ${s}: `,d),d),d=>{throw Os(Vw,`RPC '${e}' ${s} failed with error: `,d,"url: ",a,"request:",t),d})}Jo(e,r,t,i,o,s){return this.Wo(e,r,t,i,o)}zo(e,r,t){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+kh})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,o)=>e[o]=i),t&&t.headers.forEach((i,o)=>e[o]=i)}Go(e,r){let t=moe[e];return`${this.$o}/v1/${r}:${t}`}terminate(){}};var lL=class{constructor(e){this.Ho=e.Ho,this.Yo=e.Yo}Zo(e){this.Xo=e}e_(e){this.t_=e}n_(e){this.r_=e}onMessage(e){this.i_=e}close(){this.Yo()}send(e){this.Ho(e)}s_(){this.Xo()}o_(){this.t_()}__(e){this.r_(e)}a_(e){this.i_(e)}};var er="WebChannelConnection",uL=class extends cL{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,r,t,i,o){let s=aL();return new Promise((a,c)=>{let l=new Ow;l.setWithCredentials(!0),l.listenOnce(ww.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case Rm.NO_ERROR:let d=l.getResponseJson();X(er,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(d)),a(d);break;case Rm.TIMEOUT:X(er,`RPC '${e}' ${s} timed out`),c(new Q(j.DEADLINE_EXCEEDED,"Request time out"));break;case Rm.HTTP_ERROR:let f=l.getStatus();if(X(er,`RPC '${e}' ${s} failed with status:`,f,"response text:",l.getResponseText()),f>0){let g=l.getResponseJson();Array.isArray(g)&&(g=g[0]);let p=g?.error;if(p&&p.status&&p.message){let _=(function(S){let b=S.toLowerCase().replace(/_/g,"-");return Object.values(j).indexOf(b)>=0?b:j.UNKNOWN})(p.status);c(new Q(_,p.message))}else c(new Q(j.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new Q(j.UNAVAILABLE,"Connection failed."));break;default:ae(9055,{c_:e,streamId:s,l_:l.getLastErrorCode(),h_:l.getLastError()})}}finally{X(er,`RPC '${e}' ${s} completed.`)}});let u=JSON.stringify(i);X(er,`RPC '${e}' ${s} sending request:`,i),l.send(r,"POST",u,t,15)})}P_(e,r,t){let i=aL(),o=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=Mw(),a=Lw(),c={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;l!==void 0&&(c.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(c.useFetchStreams=!0),this.zo(c.initMessageHeaders,r,t),c.encodeInitMessageHeaders=!0;let u=o.join("");X(er,`Creating RPC '${e}' stream ${i}: ${u}`,c);let d=s.createWebChannel(u,c);this.T_(d);let f=!1,g=!1,p=new lL({Ho:T=>{g?X(er,`Not sending because RPC '${e}' stream ${i} is closed:`,T):(f||(X(er,`Opening RPC '${e}' stream ${i} transport.`),d.open(),f=!0),X(er,`RPC '${e}' stream ${i} sending:`,T),d.send(T))},Yo:()=>d.close()}),_=(T,S,b)=>{T.listen(S,B=>{try{b(B)}catch(x){setTimeout(()=>{throw x},0)}})};return _(d,Xd.EventType.OPEN,()=>{g||(X(er,`RPC '${e}' stream ${i} transport opened.`),p.s_())}),_(d,Xd.EventType.CLOSE,()=>{g||(g=!0,X(er,`RPC '${e}' stream ${i} transport closed`),p.__(),this.I_(d))}),_(d,Xd.EventType.ERROR,T=>{g||(g=!0,Os(er,`RPC '${e}' stream ${i} transport errored. Name:`,T.name,"Message:",T.message),p.__(new Q(j.UNAVAILABLE,"The operation could not be completed")))}),_(d,Xd.EventType.MESSAGE,T=>{var S;if(!g){let b=T.data[0];he(!!b,16349);let B=b,x=B?.error||((S=B[0])===null||S===void 0?void 0:S.error);if(x){X(er,`RPC '${e}' stream ${i} received error:`,x);let U=x.status,$=(function(C){let O=sn[C];if(O!==void 0)return mW(O)})(U),A=x.message;$===void 0&&($=j.INTERNAL,A="Unknown error status: "+U+" with message "+x.message),g=!0,p.__(new Q($,A)),d.close()}else X(er,`RPC '${e}' stream ${i} received:`,b),p.a_(b)}}),_(a,bw.STAT_EVENT,T=>{T.stat===_v.PROXY?X(er,`RPC '${e}' stream ${i} detected buffering proxy`):T.stat===_v.NOPROXY&&X(er,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{p.o_()},0),p}terminate(){this.u_.forEach(e=>e.close()),this.u_=[]}T_(e){this.u_.push(e)}I_(e){this.u_=this.u_.filter(r=>r===e)}};function qW(){return typeof window<"u"?window:null}function bv(){return typeof document<"u"?document:null}function Fy(n){return new Sb(n,!0)}var up=class{constructor(e,r,t=1e3,i=1.5,o=6e4){this.Fi=e,this.timerId=r,this.d_=t,this.E_=i,this.A_=o,this.R_=0,this.V_=null,this.m_=Date.now(),this.reset()}reset(){this.R_=0}f_(){this.R_=this.A_}g_(e){this.cancel();let r=Math.floor(this.R_+this.p_()),t=Math.max(0,Date.now()-this.m_),i=Math.max(0,r-t);i>0&&X("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.R_} ms, delay with jitter: ${r} ms, last attempt: ${t} ms ago)`),this.V_=this.Fi.enqueueAfterDelay(this.timerId,i,()=>(this.m_=Date.now(),e())),this.R_*=this.E_,this.R_<this.d_&&(this.R_=this.d_),this.R_>this.A_&&(this.R_=this.A_)}y_(){this.V_!==null&&(this.V_.skipDelay(),this.V_=null)}cancel(){this.V_!==null&&(this.V_.cancel(),this.V_=null)}p_(){return(Math.random()-.5)*this.R_}};var sH="PersistentStream",gy=class{constructor(e,r,t,i,o,s,a,c){this.Fi=e,this.w_=t,this.S_=i,this.connection=o,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=a,this.listener=c,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new up(e,r)}M_(){return this.state===1||this.state===5||this.x_()}x_(){return this.state===2||this.state===3}start(){this.C_=0,this.state!==4?this.auth():this.O_()}stop(){return I(this,null,function*(){this.M_()&&(yield this.close(0))})}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&this.D_===null&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}L_(){return I(this,null,function*(){if(this.x_())return this.close(0)})}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}close(e,r){return I(this,null,function*(){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,e!==4?this.F_.reset():r&&r.code===j.RESOURCE_EXHAUSTED?(Xt(r.toString()),Xt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):r&&r.code===j.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,yield this.listener.n_(r)})}U_(){}auth(){this.state=1;let e=this.K_(this.b_),r=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([t,i])=>{this.b_===r&&this.W_(t,i)},t=>{e(()=>{let i=new Q(j.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(i)})})}W_(e,r){let t=this.K_(this.b_);this.stream=this.z_(e,r),this.stream.Zo(()=>{t(()=>this.listener.Zo())}),this.stream.e_(()=>{t(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(i=>{t(()=>this.G_(i))}),this.stream.onMessage(i=>{t(()=>++this.C_==1?this.j_(i):this.onNext(i))})}O_(){this.state=5,this.F_.g_(()=>I(this,null,function*(){this.state=0,this.start()}))}G_(e){return X(sH,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return r=>{this.Fi.enqueueAndForget(()=>this.b_===e?r():(X(sH,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},dL=class extends gy{constructor(e,r,t,i,o,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,t,i,s),this.serializer=o}z_(e,r){return this.connection.P_("Listen",e,r)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();let r=Jie(this.serializer,e),t=(function(o){if(!("targetChange"in o))return me.min();let s=o.targetChange;return s.targetIds&&s.targetIds.length?me.min():s.readTime?Ln(s.readTime):me.min()})(e);return this.listener.J_(r,t)}H_(e){let r={};r.database=Rb(this.serializer),r.addTarget=(function(o,s){let a,c=s.target;if(a=Hv(c)?{documents:vW(o,c)}:{query:uM(o,c).Vt},a.targetId=s.targetId,s.resumeToken.approximateByteSize()>0){a.resumeToken=pW(o,s.resumeToken);let l=Ab(o,s.expectedCount);l!==null&&(a.expectedCount=l)}else if(s.snapshotVersion.compareTo(me.min())>0){a.readTime=Ch(o,s.snapshotVersion.toTimestamp());let l=Ab(o,s.expectedCount);l!==null&&(a.expectedCount=l)}return a})(this.serializer,e);let t=toe(this.serializer,e);t&&(r.labels=t),this.k_(r)}Y_(e){let r={};r.database=Rb(this.serializer),r.removeTarget=e,this.k_(r)}},hL=class extends gy{constructor(e,r,t,i,o,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,t,i,s),this.serializer=o}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,r){return this.connection.P_("Write",e,r)}j_(e){return he(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,he(!e.writeResults||e.writeResults.length===0,55816),this.listener.ea()}onNext(e){he(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();let r=Zie(e.writeResults,e.commitTime),t=Ln(e.commitTime);return this.listener.ta(t,r)}na(){let e={};e.database=Rb(this.serializer),this.k_(e)}X_(e){let r={streamToken:this.lastStreamToken,writes:e.map(t=>op(this.serializer,t))};this.k_(r)}};var fL=class{},gL=class extends fL{constructor(e,r,t,i){super(),this.authCredentials=e,this.appCheckCredentials=r,this.connection=t,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,r,t,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,s])=>this.connection.Wo(e,Db(r,t),i,o,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===j.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new Q(j.UNKNOWN,o.toString())})}Jo(e,r,t,i,o){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.Jo(e,Db(r,t),i,s,a,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===j.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new Q(j.UNKNOWN,s.toString())})}terminate(){this.ra=!0,this.connection.terminate()}},mL=class{constructor(e,r){this.asyncQueue=e,this.onlineStateHandler=r,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){this.sa===0&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve())))}la(e){this.state==="Online"?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ua("Offline")))}set(e){this.ha(),this.sa=0,e==="Online"&&(this._a=!1),this.ua(e)}ua(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ca(e){let r=`Could not reach Cloud Firestore backend. ${e}
163
+ This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this._a?(Xt(r),this._a=!1):X("OnlineStateTracker",r)}ha(){this.oa!==null&&(this.oa.cancel(),this.oa=null)}};var Xl="RemoteStore",pL=class{constructor(e,r,t,i,o){this.localStore=e,this.datastore=r,this.asyncQueue=t,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=o,this.Ea.xo(s=>{t.enqueueAndForget(()=>I(this,null,function*(){tu(this)&&(X(Xl,"Restarting streams for network reachability change."),yield(function(c){return I(this,null,function*(){let l=de(c);l.Ia.add(4),yield yp(l),l.Aa.set("Unknown"),l.Ia.delete(4),yield ky(l)})})(this))}))}),this.Aa=new mL(t,i)}};function ky(n){return I(this,null,function*(){if(tu(n))for(let e of n.da)yield e(!0)})}function yp(n){return I(this,null,function*(){for(let e of n.da)yield e(!1)})}function Uy(n,e){let r=de(n);r.Ta.has(e.targetId)||(r.Ta.set(e.targetId,e),mM(r)?gM(r):Vh(r).x_()&&fM(r,e))}function bh(n,e){let r=de(n),t=Vh(r);r.Ta.delete(e),t.x_()&&KW(r,e),r.Ta.size===0&&(t.x_()?t.B_():tu(r)&&r.Aa.set("Unknown"))}function fM(n,e){if(n.Ra.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(me.min())>0){let r=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(r)}Vh(n).H_(e)}function KW(n,e){n.Ra.$e(e),Vh(n).Y_(e)}function gM(n){n.Ra=new yb({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),Et:e=>n.Ta.get(e)||null,lt:()=>n.datastore.serializer.databaseId}),Vh(n).start(),n.Aa.aa()}function mM(n){return tu(n)&&!Vh(n).M_()&&n.Ta.size>0}function tu(n){return de(n).Ia.size===0}function YW(n){n.Ra=void 0}function poe(n){return I(this,null,function*(){n.Aa.set("Online")})}function Eoe(n){return I(this,null,function*(){n.Ta.forEach((e,r)=>{fM(n,e)})})}function _oe(n,e){return I(this,null,function*(){YW(n),mM(n)?(n.Aa.la(e),gM(n)):n.Aa.set("Unknown")})}function Toe(n,e,r){return I(this,null,function*(){if(n.Aa.set("Online"),e instanceof Kv&&e.state===2&&e.cause)try{yield(function(i,o){return I(this,null,function*(){let s=o.cause;for(let a of o.targetIds)i.Ta.has(a)&&(yield i.remoteSyncer.rejectListen(a,s),i.Ta.delete(a),i.Ra.removeTarget(a))})})(n,e)}catch(t){X(Xl,"Failed to remove targets %s: %s ",e.targetIds.join(","),t),yield my(n,t)}else if(e instanceof dh?n.Ra.Ye(e):e instanceof qv?n.Ra.it(e):n.Ra.et(e),!r.isEqual(me.min()))try{let t=yield BW(n.localStore);r.compareTo(t)>=0&&(yield(function(o,s){let a=o.Ra.Pt(s);return a.targetChanges.forEach((c,l)=>{if(c.resumeToken.approximateByteSize()>0){let u=o.Ta.get(l);u&&o.Ta.set(l,u.withResumeToken(c.resumeToken,s))}}),a.targetMismatches.forEach((c,l)=>{let u=o.Ta.get(c);if(!u)return;o.Ta.set(c,u.withResumeToken(un.EMPTY_BYTE_STRING,u.snapshotVersion)),KW(o,c);let d=new Nh(u.target,c,l,u.sequenceNumber);fM(o,d)}),o.remoteSyncer.applyRemoteEvent(a)})(n,r))}catch(t){X(Xl,"Failed to raise snapshot:",t),yield my(n,t)}})}function my(n,e,r){return I(this,null,function*(){if(!Qa(e))throw e;n.Ia.add(1),yield yp(n),n.Aa.set("Offline"),r||(r=()=>BW(n.localStore)),n.asyncQueue.enqueueRetryable(()=>I(null,null,function*(){X(Xl,"Retrying IndexedDB access"),yield r(),n.Ia.delete(1),yield ky(n)}))})}function QW(n,e){return e().catch(r=>my(n,r,e))}function Uh(n){return I(this,null,function*(){let e=de(n),r=qa(e),t=e.Pa.length>0?e.Pa[e.Pa.length-1].batchId:Bl;for(;Ioe(e);)try{let i=yield goe(e.localStore,t);if(i===null){e.Pa.length===0&&r.B_();break}t=i.batchId,voe(e,i)}catch(i){yield my(e,i)}XW(e)&&JW(e)})}function Ioe(n){return tu(n)&&n.Pa.length<10}function voe(n,e){n.Pa.push(e);let r=qa(n);r.x_()&&r.Z_&&r.X_(e.mutations)}function XW(n){return tu(n)&&!qa(n).M_()&&n.Pa.length>0}function JW(n){qa(n).start()}function yoe(n){return I(this,null,function*(){qa(n).na()})}function Soe(n){return I(this,null,function*(){let e=qa(n);for(let r of n.Pa)e.X_(r.mutations)})}function Aoe(n,e,r){return I(this,null,function*(){let t=n.Pa.shift(),i=_b.from(t,e,r);yield QW(n,()=>n.remoteSyncer.applySuccessfulWrite(i)),yield Uh(n)})}function Doe(n,e){return I(this,null,function*(){e&&qa(n).Z_&&(yield(function(t,i){return I(this,null,function*(){if((function(s){return gW(s)&&s!==j.ABORTED})(i.code)){let o=t.Pa.shift();qa(t).N_(),yield QW(t,()=>t.remoteSyncer.rejectFailedWrite(o.batchId,i)),yield Uh(t)}})})(n,e)),XW(n)&&JW(n)})}function aH(n,e){return I(this,null,function*(){let r=de(n);r.asyncQueue.verifyOperationInProgress(),X(Xl,"RemoteStore received new credentials");let t=tu(r);r.Ia.add(3),yield yp(r),t&&r.Aa.set("Unknown"),yield r.remoteSyncer.handleCredentialChange(e),r.Ia.delete(3),yield ky(r)})}function EL(n,e){return I(this,null,function*(){let r=de(n);e?(r.Ia.delete(2),yield ky(r)):e||(r.Ia.add(2),yield yp(r),r.Aa.set("Unknown"))})}function Vh(n){return n.Va||(n.Va=(function(r,t,i){let o=de(r);return o.ia(),new dL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:poe.bind(null,n),e_:Eoe.bind(null,n),n_:_oe.bind(null,n),J_:Toe.bind(null,n)}),n.da.push(e=>I(null,null,function*(){e?(n.Va.N_(),mM(n)?gM(n):n.Aa.set("Unknown")):(yield n.Va.stop(),YW(n))}))),n.Va}function qa(n){return n.ma||(n.ma=(function(r,t,i){let o=de(r);return o.ia(),new hL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:()=>Promise.resolve(),e_:yoe.bind(null,n),n_:Doe.bind(null,n),ea:Soe.bind(null,n),ta:Aoe.bind(null,n)}),n.da.push(e=>I(null,null,function*(){e?(n.ma.N_(),yield Uh(n)):(yield n.ma.stop(),n.Pa.length>0&&(X(Xl,`Stopping write stream with ${n.Pa.length} pending writes`),n.Pa=[]))}))),n.ma}var _L=class n{constructor(e,r,t,i,o){this.asyncQueue=e,this.timerId=r,this.targetTimeMs=t,this.op=i,this.removalCallback=o,this.deferred=new Nr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(s=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,r,t,i,o){let s=Date.now()+t,a=new n(e,r,s,i,o);return a.start(t),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new Q(j.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function pM(n,e){if(Xt("AsyncQueue",`${e}: ${n}`),Qa(n))return new Q(j.UNAVAILABLE,`${e}: ${n}`);throw n}var py=class n{static emptySet(e){return new n(e.comparator)}constructor(e){this.comparator=e?(r,t)=>e(r,t)||ie.comparator(r.key,t.key):(r,t)=>ie.comparator(r.key,t.key),this.keyedMap=bm(),this.sortedSet=new Dt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let r=this.keyedMap.get(e);return r?this.sortedSet.indexOf(r):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((r,t)=>(e(r),!1))}add(e){let r=this.delete(e.key);return r.copy(r.keyedMap.insert(e.key,e),r.sortedSet.insert(e,null))}delete(e){let r=this.get(e);return r?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(r)):this}isEqual(e){if(!(e instanceof n)||this.size!==e.size)return!1;let r=this.sortedSet.getIterator(),t=e.sortedSet.getIterator();for(;r.hasNext();){let i=r.getNext().key,o=t.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){let e=[];return this.forEach(r=>{e.push(r.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
164
+ `+e.join(`
165
+ `)+`
166
+ )`}copy(e,r){let t=new n;return t.comparator=this.comparator,t.keyedMap=e,t.sortedSet=r,t}};var Ey=class{constructor(){this.fa=new Dt(ie.comparator)}track(e){let r=e.doc.key,t=this.fa.get(r);t?e.type!==0&&t.type===3?this.fa=this.fa.insert(r,e):e.type===3&&t.type!==1?this.fa=this.fa.insert(r,{type:t.type,doc:e.doc}):e.type===2&&t.type===2?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):e.type===2&&t.type===0?this.fa=this.fa.insert(r,{type:0,doc:e.doc}):e.type===1&&t.type===0?this.fa=this.fa.remove(r):e.type===1&&t.type===2?this.fa=this.fa.insert(r,{type:1,doc:t.doc}):e.type===0&&t.type===1?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):ae(63341,{At:e,ga:t}):this.fa=this.fa.insert(r,e)}pa(){let e=[];return this.fa.inorderTraversal((r,t)=>{e.push(t)}),e}},Lh=class n{constructor(e,r,t,i,o,s,a,c,l){this.query=e,this.docs=r,this.oldDocs=t,this.docChanges=i,this.mutatedKeys=o,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,r,t,i,o){let s=[];return r.forEach(a=>{s.push({type:0,doc:a})}),new n(e,r,py.emptySet(r),s,t,i,!0,!1,o)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&xy(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let r=this.docChanges,t=e.docChanges;if(r.length!==t.length)return!1;for(let i=0;i<r.length;i++)if(r[i].type!==t[i].type||!r[i].doc.isEqual(t[i].doc))return!1;return!0}};var TL=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}},IL=class{constructor(){this.queries=cH(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(r,t){let i=de(r),o=i.queries;i.queries=cH(),o.forEach((s,a)=>{for(let c of a.wa)c.onError(t)})})(this,new Q(j.ABORTED,"Firestore shutting down"))}};function cH(){return new qi(n=>tW(n),xy)}function EM(n,e){return I(this,null,function*(){let r=de(n),t=3,i=e.query,o=r.queries.get(i);o?!o.Sa()&&e.ba()&&(t=2):(o=new TL,t=e.ba()?0:1);try{switch(t){case 0:o.ya=yield r.onListen(i,!0);break;case 1:o.ya=yield r.onListen(i,!1);break;case 2:yield r.onFirstRemoteStoreListen(i)}}catch(s){let a=pM(s,`Initialization of query '${oh(e.query)}' failed`);return void e.onError(a)}r.queries.set(i,o),o.wa.push(e),e.va(r.onlineState),o.ya&&e.Ca(o.ya)&&TM(r)})}function _M(n,e){return I(this,null,function*(){let r=de(n),t=e.query,i=3,o=r.queries.get(t);if(o){let s=o.wa.indexOf(e);s>=0&&(o.wa.splice(s,1),o.wa.length===0?i=e.ba()?0:1:!o.Sa()&&e.ba()&&(i=2))}switch(i){case 0:return r.queries.delete(t),r.onUnlisten(t,!0);case 1:return r.queries.delete(t),r.onUnlisten(t,!1);case 2:return r.onLastRemoteStoreUnlisten(t);default:return}})}function Roe(n,e){let r=de(n),t=!1;for(let i of e){let o=i.query,s=r.queries.get(o);if(s){for(let a of s.wa)a.Ca(i)&&(t=!0);s.ya=i}}t&&TM(r)}function Coe(n,e,r){let t=de(n),i=t.queries.get(e);if(i)for(let o of i.wa)o.onError(r);t.queries.delete(e)}function TM(n){n.Da.forEach(e=>{e.next()})}var vL,lH;(lH=vL||(vL={})).Fa="default",lH.Cache="cache";var dp=class{constructor(e,r,t){this.query=e,this.Ma=r,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=t||{}}Ca(e){if(!this.options.includeMetadataChanges){let t=[];for(let i of e.docChanges)i.type!==3&&t.push(i);e=new Lh(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let r=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),r=!0):this.Ba(e,this.onlineState)&&(this.La(e),r=!0),this.Oa=e,r}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let r=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),r=!0),r}Ba(e,r){if(!e.fromCache||!this.ba())return!0;let t=r!=="Offline";return(!this.options.ka||!t)&&(!e.docs.isEmpty()||e.hasCachedResults||r==="Offline")}Na(e){if(e.docChanges.length>0)return!0;let r=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}La(e){e=Lh.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==vL.Cache}};var _y=class{constructor(e){this.key=e}},Ty=class{constructor(e){this.key=e}},yL=class{constructor(e,r){this.query=e,this.Ha=r,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=Ue(),this.mutatedKeys=Ue(),this.Xa=rW(e),this.eu=new py(this.Xa)}get tu(){return this.Ha}nu(e,r){let t=r?r.ru:new Ey,i=r?r.eu:this.eu,o=r?r.mutatedKeys:this.mutatedKeys,s=i,a=!1,c=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,l=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((u,d)=>{let f=i.get(u),g=vp(this.query,d)?d:null,p=!!f&&this.mutatedKeys.has(f.key),_=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations),T=!1;f&&g?f.data.isEqual(g.data)?p!==_&&(t.track({type:3,doc:g}),T=!0):this.iu(f,g)||(t.track({type:2,doc:g}),T=!0,(c&&this.Xa(g,c)>0||l&&this.Xa(g,l)<0)&&(a=!0)):!f&&g?(t.track({type:0,doc:g}),T=!0):f&&!g&&(t.track({type:1,doc:f}),T=!0,(c||l)&&(a=!0)),T&&(g?(s=s.add(g),o=_?o.add(u):o.delete(u)):(s=s.delete(u),o=o.delete(u)))}),this.query.limit!==null)for(;s.size>this.query.limit;){let u=this.query.limitType==="F"?s.last():s.first();s=s.delete(u.key),o=o.delete(u.key),t.track({type:1,doc:u})}return{eu:s,ru:t,Ds:a,mutatedKeys:o}}iu(e,r){return e.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(e,r,t,i){let o=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;let s=e.ru.pa();s.sort((u,d)=>(function(g,p){let _=T=>{switch(T){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ae(20277,{At:T})}};return _(g)-_(p)})(u.type,d.type)||this.Xa(u.doc,d.doc)),this.su(t),i=i!=null&&i;let a=r&&!i?this.ou():[],c=this.Za.size===0&&this.current&&!i?1:0,l=c!==this.Ya;return this.Ya=c,s.length!==0||l?{snapshot:new Lh(this.query,e.eu,o,s,e.mutatedKeys,c===0,l,!1,!!t&&t.resumeToken.approximateByteSize()>0),_u:a}:{_u:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Ey,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(r=>this.Ha=this.Ha.add(r)),e.modifiedDocuments.forEach(r=>{}),e.removedDocuments.forEach(r=>this.Ha=this.Ha.delete(r)),this.current=e.current)}ou(){if(!this.current)return[];let e=this.Za;this.Za=Ue(),this.eu.forEach(t=>{this.au(t.key)&&(this.Za=this.Za.add(t.key))});let r=[];return e.forEach(t=>{this.Za.has(t)||r.push(new Ty(t))}),this.Za.forEach(t=>{e.has(t)||r.push(new _y(t))}),r}uu(e){this.Ha=e.qs,this.Za=Ue();let r=this.nu(e.documents);return this.applyChanges(r,!0)}cu(){return Lh.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},Bh="SyncEngine",SL=class{constructor(e,r,t){this.query=e,this.targetId=r,this.view=t}},AL=class{constructor(e){this.key=e,this.lu=!1}},DL=class{constructor(e,r,t,i,o,s){this.localStore=e,this.remoteStore=r,this.eventManager=t,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new qi(a=>tW(a),xy),this.Tu=new Map,this.Iu=new Set,this.du=new Dt(ie.comparator),this.Eu=new Map,this.Au=new ap,this.Ru={},this.Vu=new Map,this.mu=Oh.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function Noe(n,e,r=!0){return I(this,null,function*(){let t=Vy(n),i,o=t.Pu.get(e);return o?(t.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield ZW(t,e,r,!0),i})}function Ooe(n,e){return I(this,null,function*(){let r=Vy(n);yield ZW(r,e,!0,!1)})}function ZW(n,e,r,t){return I(this,null,function*(){let i=yield ly(n.localStore,Qr(e)),o=i.targetId,s=n.sharedClientState.addLocalQueryTarget(o,r),a;return t&&(a=yield IM(n,e,o,s==="current",i.resumeToken)),n.isPrimaryClient&&r&&Uy(n.remoteStore,i),a})}function IM(n,e,r,t,i){return I(this,null,function*(){n.gu=(d,f,g)=>(function(_,T,S,b){return I(this,null,function*(){let B=T.view.nu(S);B.Ds&&(B=yield iL(_.localStore,T.query,!1).then(({documents:A})=>T.view.nu(A,B)));let x=b&&b.targetChanges.get(T.targetId),U=b&&b.targetMismatches.get(T.targetId)!=null,$=T.view.applyChanges(B,_.isPrimaryClient,x,U);return RL(_,T.targetId,$._u),$.snapshot})})(n,d,f,g);let o=yield iL(n.localStore,e,!0),s=new yL(e,o.qs),a=s.nu(o.documents),c=rp.createSynthesizedTargetChangeForCurrentChange(r,t&&n.onlineState!=="Offline",i),l=s.applyChanges(a,n.isPrimaryClient,c);RL(n,r,l._u);let u=new SL(e,r,s);return n.Pu.set(e,u),n.Tu.has(r)?n.Tu.get(r).push(e):n.Tu.set(r,[e]),l.snapshot})}function woe(n,e,r){return I(this,null,function*(){let t=de(n),i=t.Pu.get(e),o=t.Tu.get(i.targetId);if(o.length>1)return t.Tu.set(i.targetId,o.filter(s=>!xy(s,e))),void t.Pu.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(i.targetId),t.sharedClientState.isActiveQueryTarget(i.targetId)||(yield wh(t.localStore,i.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(i.targetId),r&&bh(t.remoteStore,i.targetId),Mh(t,i.targetId)}).catch(Ya))):(Mh(t,i.targetId),yield wh(t.localStore,i.targetId,!0))})}function boe(n,e){return I(this,null,function*(){let r=de(n),t=r.Pu.get(e),i=r.Tu.get(t.targetId);r.isPrimaryClient&&i.length===1&&(r.sharedClientState.removeLocalQueryTarget(t.targetId),bh(r.remoteStore,t.targetId))})}function Loe(n,e,r){return I(this,null,function*(){let t=AM(n);try{let i=yield(function(s,a){let c=de(s),l=Pt.now(),u=a.reduce((g,p)=>g.add(p.key),Ue()),d,f;return c.persistence.runTransaction("Locally write mutations","readwrite",g=>{let p=Yr(),_=Ue();return c.Os.getEntries(g,u).next(T=>{p=T,p.forEach((S,b)=>{b.isValidDocument()||(_=_.add(S))})}).next(()=>c.localDocuments.getOverlayedDocuments(g,p)).next(T=>{d=T;let S=[];for(let b of a){let B=Hie(b,d.get(b.key).overlayedDocument);B!=null&&S.push(new Ki(b.key,B,qH(B.value.mapValue),Gn.exists(!0)))}return c.mutationQueue.addMutationBatch(g,l,S,a)}).next(T=>{f=T;let S=T.applyToLocalDocumentSet(d,_);return c.documentOverlayCache.saveOverlays(g,T.batchId,S)})}).then(()=>({batchId:f.batchId,changes:oW(d)}))})(t.localStore,e);t.sharedClientState.addPendingMutation(i.batchId),(function(s,a,c){let l=s.Ru[s.currentUser.toKey()];l||(l=new Dt(De)),l=l.insert(a,c),s.Ru[s.currentUser.toKey()]=l})(t,i.batchId,r),yield Ja(t,i.changes),yield Uh(t.remoteStore)}catch(i){let o=pM(i,"Failed to persist write");r.reject(o)}})}function e3(n,e){return I(this,null,function*(){let r=de(n);try{let t=yield hoe(r.localStore,e);e.targetChanges.forEach((i,o)=>{let s=r.Eu.get(o);s&&(he(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?s.lu=!0:i.modifiedDocuments.size>0?he(s.lu,14607):i.removedDocuments.size>0&&(he(s.lu,42227),s.lu=!1))}),yield Ja(r,t,e)}catch(t){yield Ya(t)}})}function uH(n,e,r){let t=de(n);if(t.isPrimaryClient&&r===0||!t.isPrimaryClient&&r===1){let i=[];t.Pu.forEach((o,s)=>{let a=s.view.va(e);a.snapshot&&i.push(a.snapshot)}),(function(s,a){let c=de(s);c.onlineState=a;let l=!1;c.queries.forEach((u,d)=>{for(let f of d.wa)f.va(a)&&(l=!0)}),l&&TM(c)})(t.eventManager,e),i.length&&t.hu.J_(i),t.onlineState=e,t.isPrimaryClient&&t.sharedClientState.setOnlineState(e)}}function Moe(n,e,r){return I(this,null,function*(){let t=de(n);t.sharedClientState.updateQueryState(e,"rejected",r);let i=t.Eu.get(e),o=i&&i.key;if(o){let s=new Dt(ie.comparator);s=s.insert(o,In.newNoDocument(o,me.min()));let a=Ue().add(o),c=new np(me.min(),new Map,new Dt(De),s,a);yield e3(t,c),t.du=t.du.remove(o),t.Eu.delete(e),SM(t)}else yield wh(t.localStore,e,!1).then(()=>Mh(t,e,r)).catch(Ya)})}function Poe(n,e){return I(this,null,function*(){let r=de(n),t=e.batch.batchId;try{let i=yield doe(r.localStore,e);yM(r,t,null),vM(r,t),r.sharedClientState.updateMutationState(t,"acknowledged"),yield Ja(r,i)}catch(i){yield Ya(i)}})}function xoe(n,e,r){return I(this,null,function*(){let t=de(n);try{let i=yield(function(s,a){let c=de(s);return c.persistence.runTransaction("Reject batch","readwrite-primary",l=>{let u;return c.mutationQueue.lookupMutationBatch(l,a).next(d=>(he(d!==null,37113),u=d.keys(),c.mutationQueue.removeMutationBatch(l,d))).next(()=>c.mutationQueue.performConsistencyCheck(l)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(l,u,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(l,u)).next(()=>c.localDocuments.getDocuments(l,u))})})(t.localStore,e);yM(t,e,r),vM(t,e),t.sharedClientState.updateMutationState(e,"rejected",r),yield Ja(t,i)}catch(i){yield Ya(i)}})}function vM(n,e){(n.Vu.get(e)||[]).forEach(r=>{r.resolve()}),n.Vu.delete(e)}function yM(n,e,r){let t=de(n),i=t.Ru[t.currentUser.toKey()];if(i){let o=i.get(e);o&&(r?o.reject(r):o.resolve(),i=i.remove(e)),t.Ru[t.currentUser.toKey()]=i}}function Mh(n,e,r=null){n.sharedClientState.removeLocalQueryTarget(e);for(let t of n.Tu.get(e))n.Pu.delete(t),r&&n.hu.pu(t,r);n.Tu.delete(e),n.isPrimaryClient&&n.Au.zr(e).forEach(t=>{n.Au.containsKey(t)||t3(n,t)})}function t3(n,e){n.Iu.delete(e.path.canonicalString());let r=n.du.get(e);r!==null&&(bh(n.remoteStore,r),n.du=n.du.remove(e),n.Eu.delete(r),SM(n))}function RL(n,e,r){for(let t of r)t instanceof _y?(n.Au.addReference(t.key,e),Foe(n,t)):t instanceof Ty?(X(Bh,"Document no longer in limbo: "+t.key),n.Au.removeReference(t.key,e),n.Au.containsKey(t.key)||t3(n,t.key)):ae(19791,{yu:t})}function Foe(n,e){let r=e.key,t=r.path.canonicalString();n.du.get(r)||n.Iu.has(t)||(X(Bh,"New document in limbo: "+r),n.Iu.add(t),SM(n))}function SM(n){for(;n.Iu.size>0&&n.du.size<n.maxConcurrentLimboResolutions;){let e=n.Iu.values().next().value;n.Iu.delete(e);let r=new ie(We.fromString(e)),t=n.mu.next();n.Eu.set(t,new AL(r)),n.du=n.du.insert(r,t),Uy(n.remoteStore,new Nh(Qr(Ip(r.path)),t,"TargetPurposeLimboResolution",qr.ue))}}function Ja(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[],s=[];t.Pu.isEmpty()||(t.Pu.forEach((a,c)=>{s.push(t.gu(c,e,r).then(l=>{var u;if((l||r)&&t.isPrimaryClient){let d=l?!l.fromCache:(u=r?.targetChanges.get(c.targetId))===null||u===void 0?void 0:u.current;t.sharedClientState.updateQueryState(c.targetId,d?"current":"not-current")}if(l){i.push(l);let d=tL.Es(c.targetId,l);o.push(d)}}))}),yield Promise.all(s),t.hu.J_(i),yield(function(c,l){return I(this,null,function*(){let u=de(c);try{yield u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>V.forEach(l,f=>V.forEach(f.Is,g=>u.persistence.referenceDelegate.addReference(d,f.targetId,g)).next(()=>V.forEach(f.ds,g=>u.persistence.referenceDelegate.removeReference(d,f.targetId,g)))))}catch(d){if(!Qa(d))throw d;X(hM,"Failed to update sequence numbers: "+d)}for(let d of l){let f=d.targetId;if(!d.fromCache){let g=u.Fs.get(f),p=g.snapshotVersion,_=g.withLastLimboFreeSnapshotVersion(p);u.Fs=u.Fs.insert(f,_)}}})})(t.localStore,o))})}function koe(n,e){return I(this,null,function*(){let r=de(n);if(!r.currentUser.isEqual(e)){X(Bh,"User change. New user:",e.toKey());let t=yield VW(r.localStore,e);r.currentUser=e,(function(o,s){o.Vu.forEach(a=>{a.forEach(c=>{c.reject(new Q(j.CANCELLED,s))})}),o.Vu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),yield Ja(r,t.Bs)}})}function Uoe(n,e){let r=de(n),t=r.Eu.get(e);if(t&&t.lu)return Ue().add(t.key);{let i=Ue(),o=r.Tu.get(e);if(!o)return i;for(let s of o){let a=r.Pu.get(s);i=i.unionWith(a.view.tu)}return i}}function Voe(n,e){return I(this,null,function*(){let r=de(n),t=yield iL(r.localStore,e.query,!0),i=e.view.uu(t);return r.isPrimaryClient&&RL(r,e.targetId,i._u),i})}function Boe(n,e){return I(this,null,function*(){let r=de(n);return $W(r.localStore,e).then(t=>Ja(r,t))})}function Goe(n,e,r,t){return I(this,null,function*(){let i=de(n),o=yield(function(a,c){let l=de(a),u=de(l.mutationQueue);return l.persistence.runTransaction("Lookup mutation documents","readonly",d=>u.Xn(d,c).next(f=>f?l.localDocuments.getDocuments(d,f):V.resolve(null)))})(i.localStore,e);o!==null?(r==="pending"?yield Uh(i.remoteStore):r==="acknowledged"||r==="rejected"?(yM(i,e,t||null),vM(i,e),(function(a,c){de(de(a).mutationQueue).rr(c)})(i.localStore,e)):ae(6720,"Unknown batchState",{wu:r}),yield Ja(i,o)):X(Bh,"Cannot apply mutation batch with id: "+e)})}function $oe(n,e){return I(this,null,function*(){let r=de(n);if(Vy(r),AM(r),e===!0&&r.fu!==!0){let t=r.sharedClientState.getAllActiveQueryTargets(),i=yield dH(r,t.toArray());r.fu=!0,yield EL(r.remoteStore,!0);for(let o of i)Uy(r.remoteStore,o)}else if(e===!1&&r.fu!==!1){let t=[],i=Promise.resolve();r.Tu.forEach((o,s)=>{r.sharedClientState.isLocalQueryTarget(s)?t.push(s):i=i.then(()=>(Mh(r,s),wh(r.localStore,s,!0))),bh(r.remoteStore,s)}),yield i,yield dH(r,t),(function(s){let a=de(s);a.Eu.forEach((c,l)=>{bh(a.remoteStore,l)}),a.Au.jr(),a.Eu=new Map,a.du=new Dt(ie.comparator)})(r),r.fu=!1,yield EL(r.remoteStore,!1)}})}function dH(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[];for(let s of e){let a,c=t.Tu.get(s);if(c&&c.length!==0){a=yield ly(t.localStore,Qr(c[0]));for(let l of c){let u=t.Pu.get(l),d=yield Voe(t,u);d.snapshot&&o.push(d.snapshot)}}else{let l=yield GW(t.localStore,s);a=yield ly(t.localStore,l),yield IM(t,n3(l),s,!1,a.resumeToken)}i.push(a)}return t.hu.J_(o),i})}function n3(n){return ZH(n.path,n.collectionGroup,n.orderBy,n.filters,n.limit,"F",n.startAt,n.endAt)}function joe(n){return(function(r){return de(de(r).persistence).Ps()})(de(n).localStore)}function Hoe(n,e,r,t){return I(this,null,function*(){let i=de(n);if(i.fu)return void X(Bh,"Ignoring unexpected query state notification.");let o=i.Tu.get(e);if(o&&o.length>0)switch(r){case"current":case"not-current":{let s=yield $W(i.localStore,nW(o[0])),a=np.createSynthesizedRemoteEventForCurrentChange(e,r==="current",un.EMPTY_BYTE_STRING);yield Ja(i,s,a);break}case"rejected":yield wh(i.localStore,e,!0),Mh(i,e,t);break;default:ae(64155,r)}})}function Woe(n,e,r){return I(this,null,function*(){let t=Vy(n);if(t.fu){for(let i of e){if(t.Tu.has(i)&&t.sharedClientState.isActiveQueryTarget(i)){X(Bh,"Adding an already active target "+i);continue}let o=yield GW(t.localStore,i),s=yield ly(t.localStore,o);yield IM(t,n3(o),s.targetId,!1,s.resumeToken),Uy(t.remoteStore,s)}for(let i of r)t.Tu.has(i)&&(yield wh(t.localStore,i,!1).then(()=>{bh(t.remoteStore,i),Mh(t,i)}).catch(Ya))}})}function Vy(n){let e=de(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=e3.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Uoe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Moe.bind(null,e),e.hu.J_=Roe.bind(null,e.eventManager),e.hu.pu=Coe.bind(null,e.eventManager),e}function AM(n){let e=de(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Poe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=xoe.bind(null,e),e}var DM=(()=>{class n{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(r){return I(this,null,function*(){this.serializer=Fy(r.databaseInfo.databaseId),this.sharedClientState=this.bu(r),this.persistence=this.Du(r),yield this.persistence.start(),this.localStore=this.vu(r),this.gcScheduler=this.Cu(r,this.localStore),this.indexBackfillerScheduler=this.Fu(r,this.localStore)})}Cu(r,t){return null}Fu(r,t){return null}vu(r){return UW(this.persistence,new cy,r.initialUser,this.serializer)}Du(r){return new cp(sy.Vi,this.serializer)}bu(r){return new hy}terminate(){return I(this,null,function*(){var r,t;(r=this.gcScheduler)===null||r===void 0||r.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return n.provider={build:()=>new n},n})(),CL=class extends DM{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,r){he(this.persistence.referenceDelegate instanceof ay,46915);let t=this.persistence.referenceDelegate.garbageCollector;return new ry(t,e.asyncQueue,r)}Du(e){let r=this.cacheSizeBytes!==void 0?Cr.withCacheSize(this.cacheSizeBytes):Cr.DEFAULT;return new cp(t=>ay.Vi(t,r),this.serializer)}},Iy=class n extends DM{constructor(e,r,t){super(),this.Mu=e,this.cacheSizeBytes=r,this.forceOwnership=t,this.kind="persistent",this.synchronizeTabs=!1}initialize(e){return I(this,null,function*(){yield mc(n.prototype,this,"initialize").call(this,e),yield this.Mu.initialize(this,e),yield AM(this.Mu.syncEngine),yield Uh(this.Mu.remoteStore),yield this.persistence.ji(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))})}vu(e){return UW(this.persistence,new cy,e.initialUser,this.serializer)}Cu(e,r){let t=this.persistence.referenceDelegate.garbageCollector;return new ry(t,e.asyncQueue,r)}Fu(e,r){let t=new Jw(r,this.persistence);return new Xw(e.asyncQueue,t)}Du(e){let r=kW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),t=this.cacheSizeBytes!==void 0?Cr.withCacheSize(this.cacheSizeBytes):Cr.DEFAULT;return new eL(this.synchronizeTabs,r,e.clientId,t,e.asyncQueue,qW(),bv(),this.serializer,this.sharedClientState,!!this.forceOwnership)}bu(e){return new hy}},NL=class n extends Iy{constructor(e,r){super(e,r,!1),this.Mu=e,this.cacheSizeBytes=r,this.synchronizeTabs=!0}initialize(e){return I(this,null,function*(){yield mc(n.prototype,this,"initialize").call(this,e);let r=this.Mu.syncEngine;this.sharedClientState instanceof Gm&&(this.sharedClientState.syncEngine={Do:Goe.bind(null,r),vo:Hoe.bind(null,r),Co:Woe.bind(null,r),Ps:joe.bind(null,r),bo:Boe.bind(null,r)},yield this.sharedClientState.start()),yield this.persistence.ji(t=>I(this,null,function*(){yield $oe(this.Mu.syncEngine,t),this.gcScheduler&&(t&&!this.gcScheduler.started?this.gcScheduler.start():t||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(t&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():t||this.indexBackfillerScheduler.stop())}))})}bu(e){let r=qW();if(!Gm.C(r))throw new Q(j.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let t=kW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Gm(r,e.asyncQueue,t,e.clientId,e.initialUser)}},RM=(()=>{class n{initialize(r,t){return I(this,null,function*(){this.localStore||(this.localStore=r.localStore,this.sharedClientState=r.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!r.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>uH(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=koe.bind(null,this.syncEngine),yield EL(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(r){return(function(){return new IL})()}createDatastore(r){let t=Fy(r.databaseInfo.databaseId),i=(function(s){return new uL(s)})(r.databaseInfo);return(function(s,a,c,l){return new gL(s,a,c,l)})(r.authCredentials,r.appCheckCredentials,i,t)}createRemoteStore(r){return(function(i,o,s,a,c){return new pL(i,o,s,a,c)})(this.localStore,this.datastore,r.asyncQueue,t=>uH(this.syncEngine,t,0),(function(){return fy.C()?new fy:new sL})())}createSyncEngine(r,t){return(function(o,s,a,c,l,u,d){let f=new DL(o,s,a,c,l,u);return d&&(f.fu=!0),f})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,r.initialUser,r.maxConcurrentLimboResolutions,t)}terminate(){return I(this,null,function*(){var r,t;yield(function(o){return I(this,null,function*(){let s=de(o);X(Xl,"RemoteStore shutting down."),s.Ia.add(5),yield yp(s),s.Ea.shutdown(),s.Aa.set("Unknown")})})(this.remoteStore),(r=this.datastore)===null||r===void 0||r.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()})}}return n.provider={build:()=>new n},n})();var hp=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):Xt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,r){setTimeout(()=>{this.muted||e(r)},0)}};var OL=class{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}lookup(e){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new Q(j.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let r=yield(function(i,o){return I(this,null,function*(){let s=de(i),a={documents:o.map(d=>ip(s.serializer,d))},c=yield s.Jo("BatchGetDocuments",s.serializer.databaseId,We.emptyPath(),a,o.length),l=new Map;c.forEach(d=>{let f=Xie(s.serializer,d);l.set(f.key.toString(),f)});let u=[];return o.forEach(d=>{let f=l.get(d.toString());he(!!f,55234,{key:d}),u.push(f)}),u})})(this.datastore,e);return r.forEach(t=>this.recordVersion(t)),r})}set(e,r){this.write(r.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,r){try{this.write(r.toMutation(e,this.preconditionForUpdate(e)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(e.toString())}delete(e){this.write(new Kl(e,this.precondition(e))),this.writtenDocs.add(e.toString())}commit(){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;let e=this.readVersions;this.mutations.forEach(r=>{e.delete(r.key.toString())}),e.forEach((r,t)=>{let i=ie.fromPath(t);this.mutations.push(new Zm(i,this.precondition(i)))}),yield(function(t,i){return I(this,null,function*(){let o=de(t),s={writes:i.map(a=>op(o.serializer,a))};yield o.Wo("Commit",o.serializer.databaseId,We.emptyPath(),s)})})(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let r;if(e.isFoundDocument())r=e.version;else{if(!e.isNoDocument())throw ae(50498,{Wu:e.constructor.name});r=me.min()}let t=this.readVersions.get(e.key.toString());if(t){if(!r.isEqual(t))throw new Q(j.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),r)}precondition(e){let r=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&r?r.isEqual(me.min())?Gn.exists(!1):Gn.updateTime(r):Gn.none()}preconditionForUpdate(e){let r=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&r){if(r.isEqual(me.min()))throw new Q(j.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Gn.updateTime(r)}return Gn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var wL=class{constructor(e,r,t,i,o){this.asyncQueue=e,this.datastore=r,this.options=t,this.updateFunction=i,this.deferred=o,this.Gu=t.maxAttempts,this.F_=new up(this.asyncQueue,"transaction_retry")}zu(){this.Gu-=1,this.ju()}ju(){this.F_.g_(()=>I(this,null,function*(){let e=new OL(this.datastore),r=this.Ju(e);r&&r.then(t=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(t)}).catch(i=>{this.Hu(i)}))}).catch(t=>{this.Hu(t)})}))}Ju(e){try{let r=this.updateFunction(e);return!Ep(r)&&r.catch&&r.then?r:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.deferred.reject(r),null}}Hu(e){this.Gu>0&&this.Yu(e)?(this.Gu-=1,this.asyncQueue.enqueueAndForget(()=>(this.ju(),Promise.resolve()))):this.deferred.reject(e)}Yu(e){if(e.name==="FirebaseError"){let r=e.code;return r==="aborted"||r==="failed-precondition"||r==="already-exists"||!gW(r)}return!1}};var Ka="FirestoreClient",bL=class{constructor(e,r,t,i,o){this.authCredentials=e,this.appCheckCredentials=r,this.asyncQueue=t,this.databaseInfo=i,this.user=cn.UNAUTHENTICATED,this.clientId=$m.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(t,s=>I(this,null,function*(){X(Ka,"Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(t,s=>(X(Ka,"Received new app check token=",s),this.appCheckCredentialListener(s,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new Nr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(()=>I(this,null,function*(){try{this._onlineComponents&&(yield this._onlineComponents.terminate()),this._offlineComponents&&(yield this._offlineComponents.terminate()),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(r){let t=pM(r,"Failed to shutdown persistence");e.reject(t)}})),e.promise}};function Bw(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress(),X(Ka,"Initializing OfflineComponentProvider");let r=n.configuration;yield e.initialize(r);let t=r.initialUser;n.setCredentialChangeListener(i=>I(null,null,function*(){t.isEqual(i)||(yield VW(e.localStore,i),t=i)})),e.persistence.setDatabaseDeletedListener(()=>{Os("Terminating Firestore due to IndexedDb database deletion"),n.terminate().then(()=>{X("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{Os("Terminating Firestore due to IndexedDb database deletion failed",i)})}),n._offlineComponents=e})}function hH(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress();let r=yield zoe(n);X(Ka,"Initializing OnlineComponentProvider"),yield e.initialize(r,n.configuration),n.setCredentialChangeListener(t=>aH(e.remoteStore,t)),n.setAppCheckTokenChangeListener((t,i)=>aH(e.remoteStore,i)),n._onlineComponents=e})}function zoe(n){return I(this,null,function*(){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){X(Ka,"Using user provided OfflineComponentProvider");try{yield Bw(n,n._uninitializedComponentsProvider._offline)}catch(e){let r=e;if(!(function(i){return i.name==="FirebaseError"?i.code===j.FAILED_PRECONDITION||i.code===j.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(r))throw r;Os("Error using user provided cache. Falling back to memory cache: "+r),yield Bw(n,new DM)}}else X(Ka,"Using default OfflineComponentProvider"),yield Bw(n,new CL(void 0));return n._offlineComponents})}function CM(n){return I(this,null,function*(){return n._onlineComponents||(n._uninitializedComponentsProvider?(X(Ka,"Using user provided OnlineComponentProvider"),yield hH(n,n._uninitializedComponentsProvider._online)):(X(Ka,"Using default OnlineComponentProvider"),yield hH(n,new RM))),n._onlineComponents})}function qoe(n){return CM(n).then(e=>e.syncEngine)}function r3(n){return CM(n).then(e=>e.datastore)}function vy(n){return I(this,null,function*(){let e=yield CM(n),r=e.eventManager;return r.onListen=Noe.bind(null,e.syncEngine),r.onUnlisten=woe.bind(null,e.syncEngine),r.onFirstRemoteStoreListen=Ooe.bind(null,e.syncEngine),r.onLastRemoteStoreUnlisten=boe.bind(null,e.syncEngine),r})}function Koe(n,e,r={}){let t=new Nr;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new hp({next:f=>{u.Ou(),s.enqueueAndForget(()=>_M(o,d));let g=f.docs.has(a);!g&&f.fromCache?l.reject(new Q(j.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&c&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new dp(Ip(a.path),u,{includeMetadataChanges:!0,ka:!0});return EM(o,d)})(yield vy(n),n.asyncQueue,e,r,t)})),t.promise}function Yoe(n,e,r={}){let t=new Nr;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new hp({next:f=>{u.Ou(),s.enqueueAndForget(()=>_M(o,d)),f.fromCache&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new dp(a,u,{includeMetadataChanges:!0,ka:!0});return EM(o,d)})(yield vy(n),n.asyncQueue,e,r,t)})),t.promise}function Qoe(n,e,r){let t=new Nr;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){try{let i=yield r3(n);t.resolve((function(s,a,c){return I(this,null,function*(){var l;let u=de(s),{request:d,ft:f,parent:g}=eoe(u.serializer,Mie(a),c);u.connection.Qo||delete d.parent;let p=(yield u.Jo("RunAggregationQuery",u.serializer.databaseId,g,d,1)).filter(T=>!!T.result);he(p.length===1,64727);let _=(l=p[0].result)===null||l===void 0?void 0:l.aggregateFields;return Object.keys(_).reduce((T,S)=>(T[f[S]]=_[S],T),{})})})(i,e,r))}catch(i){t.reject(i)}})),t.promise}function i3(n){let e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}var fH=new Map;var o3="firestore.googleapis.com",gH=!0,yy=class{constructor(e){var r,t;if(e.host===void 0){if(e.ssl!==void 0)throw new Q(j.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=o3,this.ssl=gH}else this.host=e.host,this.ssl=(r=e.ssl)!==null&&r!==void 0?r:gH;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=wW;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<PW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}eie("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=i3((t=e.experimentalLongPollingOptions)!==null&&t!==void 0?t:{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(t,i){return t.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Jl=class{constructor(e,r,t,i){this._authCredentials=e,this._appCheckCredentials=r,this._databaseId=t,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new yy({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Q(j.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new Q(j.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 yy(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(t){if(!t)return new Gw;switch(t.type){case"firstParty":return new Ww(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Q(j.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}_restart(){return I(this,null,function*(){this._terminateTask==="notTerminated"?yield this._terminate():this._terminateTask="notTerminated"})}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){let t=fH.get(r);t&&(X("ComponentProvider","Removing Datastore"),fH.delete(r),t.terminate())})(this),Promise.resolve()}};function s3(n,e,r,t={}){var i;n=Or(n,Jl);let o=jr(e),s=n._getSettings(),a=Object.assign(Object.assign({},s),{emulatorOptions:n._getEmulatorOptions()}),c=`${e}:${r}`;o&&(da(`https://${c}`),ol("Firestore",!0)),s.host!==o3&&s.host!==c&&Os("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let l=Object.assign(Object.assign({},s),{host:c,ssl:o,emulatorOptions:t});if(!Ui(l,a)&&(n._setSettings(l),t.mockUserToken)){let u,d;if(typeof t.mockUserToken=="string")u=t.mockUserToken,d=cn.MOCK_USER;else{u=qT(t.mockUserToken,(i=n._app)===null||i===void 0?void 0:i.options.projectId);let f=t.mockUserToken.sub||t.mockUserToken.user_id;if(!f)throw new Q(j.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new cn(f)}n._authCredentials=new $w(new Lv(u,d))}}var Yi=class n{constructor(e,r,t){this.converter=r,this._query=t,this.type="query",this.firestore=e}withConverter(e){return new n(this.firestore,e,this._query)}},vn=class n{constructor(e,r,t){this.converter=r,this._key=t,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 ka(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new n(this.firestore,e,this._key)}toJSON(){return{type:n._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,r,t){if(pp(r,n._jsonSchema))return new n(e,t||null,new ie(We.fromString(r.referencePath)))}};vn._jsonSchemaVersion="firestore/documentReference/1.0",vn._jsonSchema={type:ln("string",vn._jsonSchemaVersion),referencePath:ln("string")};var ka=class n extends Yi{constructor(e,r,t){super(e,r,Ip(t)),this._path=t,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new vn(this.firestore,null,new ie(e))}withConverter(e){return new n(this.firestore,e,this._path)}};function a3(n,e,...r){if(n=Ge(n),QL("collection","path",e),n instanceof Jl){let t=We.fromString(e,...r);return lj(t),new ka(n,null,t)}{if(!(n instanceof vn||n instanceof ka))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return lj(t),new ka(n.firestore,null,t)}}function c3(n,e){if(n=Or(n,Jl),QL("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Yi(n,null,(function(t){return new Ho(We.emptyPath(),t)})(e))}function l3(n,e,...r){if(n=Ge(n),arguments.length===1&&(e=$m.newId()),QL("doc","path",e),n instanceof Jl){let t=We.fromString(e,...r);return cj(t),new vn(n,null,new ie(t))}{if(!(n instanceof vn||n instanceof ka))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return cj(t),new vn(n.firestore,n instanceof ka?n.converter:null,new ie(t))}}var mH="AsyncQueue",Sy=class{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new up(this,"async_queue_retry"),this.oc=()=>{let t=bv();t&&X(mH,"Visibility state changed to "+t.visibilityState),this.F_.y_()},this._c=e;let r=bv();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;let r=bv();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let r=new Nr;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(r.resolve,r.reject),r.promise)).then(()=>r.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}cc(){return I(this,null,function*(){if(this.Zu.length!==0){try{yield this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!Qa(e))throw e;X(mH,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(e){let r=this._c.then(()=>(this.nc=!0,e().catch(t=>{throw this.tc=t,this.nc=!1,Xt("INTERNAL UNHANDLED ERROR: ",pH(t)),t}).then(t=>(this.nc=!1,t))));return this._c=r,r}enqueueAfterDelay(e,r,t){this.ac(),this.sc.indexOf(e)>-1&&(r=0);let i=_L.createAndSchedule(this,e,r,t,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&ae(47125,{hc:pH(this.tc)})}verifyOperationInProgress(){}Pc(){return I(this,null,function*(){let e;do e=this._c,yield e;while(e!==this._c)})}Tc(e){for(let r of this.ec)if(r.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((r,t)=>r.targetTimeMs-t.targetTimeMs);for(let r of this.ec)if(r.skipDelay(),e!=="all"&&r.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let r=this.ec.indexOf(e);this.ec.splice(r,1)}};function pH(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
167
+ `+n.stack),e}function EH(n){return(function(r,t){if(typeof r!="object"||r===null)return!1;let i=r;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(n,["next","error","complete"])}var Qi=class extends Jl{constructor(e,r,t,i){super(e,r,t,i),this.type="firestore",this._queue=new Sy,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Sy(e),this._firestoreClient=void 0,yield e}})}};function By(n,e,r){r||(r=Qm);let t=Mo(n,"firestore");if(t.isInitialized(r)){let i=t.getImmediate({identifier:r}),o=t.getOptions(r);if(Ui(o,e))return i;throw new Q(j.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new Q(j.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<PW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&jr(e.host)&&da(e.host),t.initialize({options:e,instanceIdentifier:r})}function Gh(n,e){let r=typeof n=="object"?n:yr(),t=typeof n=="string"?n:e||Qm,i=Mo(r,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=Cd("firestore");o&&s3(i,...o)}return i}function $h(n){if(n._terminated)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Xoe(n),n._firestoreClient}function Xoe(n){var e,r,t;let i=n._freezeSettings(),o=(function(a,c,l,u){return new nb(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,i3(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,i);n._componentsProvider||!((r=i.localCache)===null||r===void 0)&&r._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(n._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),n._firestoreClient=new bL(n._authCredentials,n._appCheckCredentials,n._queue,o,n._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(n._componentsProvider))}var LL=class{constructor(e="count",r){this._internalFieldPath=r,this.type="AggregateField",this.aggregateType=e}},ML=class{constructor(e,r,t){this._userDataWriter=r,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Ns=class n{constructor(e){this._byteString=e}static fromBase64String(e){try{return new n(un.fromBase64String(e))}catch(r){throw new Q(j.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+r)}}static fromUint8Array(e){return new n(un.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:n._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(pp(e,n._jsonSchema))return n.fromBase64String(e.bytes)}};Ns._jsonSchemaVersion="firestore/bytes/1.0",Ns._jsonSchema={type:ln("string",Ns._jsonSchemaVersion),bytes:ln("string")};var Ph=class{constructor(...e){for(let r=0;r<e.length;++r)if(e[r].length===0)throw new Q(j.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Tn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var fp=class{constructor(e){this._methodName=e}};var Ua=class n{constructor(e,r){if(!isFinite(e)||e<-90||e>90)throw new Q(j.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(r)||r<-180||r>180)throw new Q(j.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=e,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return De(this._lat,e._lat)||De(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:n._jsonSchemaVersion}}static fromJSON(e){if(pp(e,n._jsonSchema))return new n(e.latitude,e.longitude)}};Ua._jsonSchemaVersion="firestore/geoPoint/1.0",Ua._jsonSchema={type:ln("string",Ua._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};var Va=class n{constructor(e){this._values=(e||[]).map(r=>r)}toArray(){return this._values.map(e=>e)}isEqual(e){return(function(t,i){if(t.length!==i.length)return!1;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!1;return!0})(this._values,e._values)}toJSON(){return{type:n._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(pp(e,n._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(r=>typeof r=="number"))return new n(e.vectorValues);throw new Q(j.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};Va._jsonSchemaVersion="firestore/vectorValue/1.0",Va._jsonSchema={type:ln("string",Va._jsonSchemaVersion),vectorValues:ln("object")};var Joe=/^__.*__$/,PL=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return this.fieldMask!==null?new Ki(e,this.data,this.fieldMask,r,this.fieldTransforms):new za(e,this.data,r,this.fieldTransforms)}},Ay=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return new Ki(e,this.data,this.fieldMask,r,this.fieldTransforms)}};function u3(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:n})}}var xL=class n{constructor(e,r,t,i,o,s){this.settings=e,this.databaseId=r,this.serializer=t,this.ignoreUndefinedProperties=i,o===void 0&&this.Ac(),this.fieldTransforms=o||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new n(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Ry(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(r=>e.isPrefixOf(r))!==void 0||this.fieldTransforms.find(r=>e.isPrefixOf(r.field))!==void 0}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(e.length===0)throw this.wc("Document fields must not be empty");if(u3(this.Ec)&&Joe.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},FL=class{constructor(e,r,t){this.databaseId=e,this.ignoreUndefinedProperties=r,this.serializer=t||Fy(e)}Dc(e,r,t,i=!1){return new xL({Ec:e,methodName:r,bc:t,path:Tn.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function Gy(n){let e=n._freezeSettings(),r=Fy(n._databaseId);return new FL(n._databaseId,!!e.ignoreUndefinedProperties,r)}function d3(n,e,r,t,i,o={}){let s=n.Dc(o.merge||o.mergeFields?2:0,e,r,i);NM("Data must be an object, but it was:",s,t);let a=f3(t,s),c,l;if(o.merge)c=new Kr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=kL(e,d,r);if(!s.contains(f))throw new Q(j.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);m3(u,f)||u.push(f)}c=new Kr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new PL(new tr(a),c,l)}var Dy=class n extends fp{_toFieldTransform(e){if(e.Ec!==2)throw e.Ec===1?e.wc(`${this._methodName}() can only appear at the top level of your update data`):e.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof n}};function Zoe(n,e,r,t){let i=n.Dc(1,e,r);NM("Data must be an object, but it was:",i,t);let o=[],s=tr.empty();Xa(t,(c,l)=>{let u=OM(e,c,r);l=Ge(l);let d=i.gc(u);if(l instanceof Dy)o.push(u);else{let f=Sp(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new Kr(o);return new Ay(s,a,i.fieldTransforms)}function ese(n,e,r,t,i,o){let s=n.Dc(1,e,r),a=[kL(e,t,r)],c=[i];if(o.length%2!=0)throw new Q(j.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<o.length;f+=2)a.push(kL(e,o[f])),c.push(o[f+1]);let l=[],u=tr.empty();for(let f=a.length-1;f>=0;--f)if(!m3(l,a[f])){let g=a[f],p=c[f];p=Ge(p);let _=s.gc(g);if(p instanceof Dy)l.push(g);else{let T=Sp(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new Kr(l);return new Ay(u,d,s.fieldTransforms)}function h3(n,e,r,t=!1){return Sp(r,n.Dc(t?4:3,e))}function Sp(n,e){if(g3(n=Ge(n)))return NM("Unsupported field value:",e,n),f3(n,e);if(n instanceof fp)return(function(t,i){if(!u3(i.Ec))throw i.wc(`${t._methodName}() can only be used with update() and set()`);if(!i.path)throw i.wc(`${t._methodName}() is not currently supported inside arrays`);let o=t._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.mc&&e.Ec!==4)throw e.wc("Nested arrays are not supported");return(function(t,i){let o=[],s=0;for(let a of t){let c=Sp(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(n,e)}return(function(t,i){if((t=Ge(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return Vie(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=Pt.fromDate(t);return{timestampValue:Ch(i.serializer,o)}}if(t instanceof Pt){let o=new Pt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Ch(i.serializer,o)}}if(t instanceof Ua)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Ns)return{bytesValue:pW(i.serializer,t._byteString)};if(t instanceof vn){let o=i.databaseId,s=t.firestore._databaseId;if(!s.isEqual(o))throw i.wc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${o.projectId}/${o.database}`);return{referenceValue:lM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof Va)return(function(s,a){return{mapValue:{fields:{[rM]:{stringValue:iM},[yh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return cM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${Ny(t)}`)})(n,e)}function f3(n,e){let r={};return VH(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Xa(n,(t,i)=>{let o=Sp(i,e.Vc(t));o!=null&&(r[t]=o)}),{mapValue:{fields:r}}}function g3(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof Pt||n instanceof Ua||n instanceof Ns||n instanceof vn||n instanceof fp||n instanceof Va)}function NM(n,e,r){if(!g3(r)||!SH(r)){let t=Ny(r);throw t==="an object"?e.wc(n+" a custom object"):e.wc(n+" "+t)}}function kL(n,e,r){if((e=Ge(e))instanceof Ph)return e._internalPath;if(typeof e=="string")return OM(n,e);throw Ry("Field path arguments must be of type string or ",n,!1,void 0,r)}var tse=new RegExp("[~\\*/\\[\\]]");function OM(n,e,r){if(e.search(tse)>=0)throw Ry(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,r);try{return new Ph(...e.split("."))._internalPath}catch{throw Ry(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,r)}}function Ry(n,e,r,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;r&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(o||s)&&(c+=" (found",o&&(c+=` in field ${t}`),s&&(c+=` in document ${i}`),c+=")"),new Q(j.INVALID_ARGUMENT,a+n+c)}function m3(n,e){return n.some(r=>r.isEqual(e))}var Zl=class{constructor(e,r,t,i,o){this._firestore=e,this._userDataWriter=r,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new vn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new UL(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let r=this._document.data.field($y("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r)}}},UL=class extends Zl{data(){return super.data()}};function $y(n,e){return typeof e=="string"?OM(n,e):e instanceof Ph?e._internalPath:e._delegate._internalPath}function p3(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new Q(j.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var gp=class{},xh=class extends gp{};function E3(n,e,...r){let t=[];e instanceof gp&&t.push(e),t=t.concat(r),(function(o){let s=o.filter(c=>c instanceof Fh).length,a=o.filter(c=>c instanceof mp).length;if(s>1||s>0&&a>0)throw new Q(j.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(t);for(let i of t)n=i._apply(n);return n}var mp=class n extends xh{constructor(e,r,t){super(),this._field=e,this._op=r,this._value=t,this.type="where"}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=this._parse(e);return A3(e._query,r),new Yi(e.firestore,e.converter,mb(e._query,r))}_parse(e){let r=Gy(e.firestore);return(function(o,s,a,c,l,u,d){let f;if(l.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new Q(j.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){TH(d,u);let p=[];for(let _ of d)p.push(_H(c,o,_));f={arrayValue:{values:p}}}else f=_H(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||TH(d,u),f=h3(a,s,d,u==="in"||u==="not-in");return $e.create(l,u,f)})(e._query,"where",r,e.firestore._databaseId,this._field,this._op,this._value)}};function _3(n,e,r){let t=e,i=$y("where",n);return mp._create(i,t,r)}var Fh=class n extends gp{constructor(e,r){super(),this.type=e,this._queryConstraints=r}static _create(e,r){return new n(e,r)}_parse(e){let r=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return r.length===1?r[0]:nt.create(r,this._getOperator())}_apply(e){let r=this._parse(e);return r.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)A3(s,c),s=mb(s,c)})(e._query,r),new Yi(e.firestore,e.converter,mb(e._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function T3(...n){return n.forEach(e=>D3("or",e)),Fh._create("or",n)}function I3(...n){return n.forEach(e=>D3("and",e)),Fh._create("and",n)}var VL=class n extends xh{constructor(e,r){super(),this._field=e,this._direction=r,this.type="orderBy"}static _create(e,r){return new n(e,r)}_apply(e){let r=(function(i,o,s){if(i.startAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Hl(o,s)})(e._query,this._field,this._direction);return new Yi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new Ho(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,r))}};function v3(n,e="asc"){let r=e,t=$y("orderBy",n);return VL._create(t,r)}var BL=class n extends xh{constructor(e,r,t){super(),this.type=e,this._limit=r,this._limitType=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){return new Yi(e.firestore,e.converter,zv(e._query,this._limit,this._limitType))}};function y3(n){return tie("limit",n),BL._create("limit",n,"F")}var GL=class n extends xh{constructor(e,r,t){super(),this.type=e,this._docOrFields=r,this._inclusive=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=nse(e,this.type,this._docOrFields,this._inclusive);return new Yi(e.firestore,e.converter,(function(i,o){return new Ho(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,r))}};function S3(...n){return GL._create("startAfter",n,!1)}function nse(n,e,r,t){if(r[0]=Ge(r[0]),r[0]instanceof Zl)return(function(o,s,a,c,l){if(!c)throw new Q(j.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);let u=[];for(let d of uh(o))if(d.field.isKeyField())u.push(jl(s,c.key));else{let f=c.data.field(d.field);if(Ly(f))throw new Q(j.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+d.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(f===null){let g=d.field.canonicalString();throw new Q(j.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${g}' (used as the orderBy) does not exist.`)}u.push(f)}return new jo(u,l)})(n._query,n.firestore._databaseId,e,r[0]._document,t);{let i=Gy(n.firestore);return(function(s,a,c,l,u,d){let f=s.explicitOrderBy;if(u.length>f.length)throw new Q(j.INVALID_ARGUMENT,`Too many arguments provided to ${l}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);let g=[];for(let p=0;p<u.length;p++){let _=u[p];if(f[p].field.isKeyField()){if(typeof _!="string")throw new Q(j.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${l}(), but got a ${typeof _}`);if(!sM(s)&&_.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${l}() must be a plain document ID, but '${_}' contains a slash.`);let T=s.path.child(We.fromString(_));if(!ie.isDocumentKey(T))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${l}() must result in a valid document path, but '${T}' is not because it contains an odd number of segments.`);let S=new ie(T);g.push(jl(a,S))}else{let T=h3(c,l,_);g.push(T)}}return new jo(g,d)})(n._query,n.firestore._databaseId,i,e,r,t)}}function _H(n,e,r){if(typeof(r=Ge(r))=="string"){if(r==="")throw new Q(j.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!sM(e)&&r.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let t=e.path.child(We.fromString(r));if(!ie.isDocumentKey(t))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${t}' is not because it has an odd number of segments (${t.length}).`);return jl(n,new ie(t))}if(r instanceof vn)return jl(n,r._key);throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ny(r)}.`)}function TH(n,e){if(!Array.isArray(n)||n.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function A3(n,e){let r=(function(i,o){for(let s of i)for(let a of s.getFlattenedFilters())if(o.indexOf(a.op)>=0)return a.op;return null})(n.filters,(function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(r!==null)throw r===e.op?new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`)}function D3(n,e){if(!(e instanceof mp||e instanceof Fh))throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var Cy=class{convertValue(e,r="none"){switch($a(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Mt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,r);case 5:return e.stringValue;case 6:return this.convertBytes(bs(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,r);case 11:return this.convertObject(e.mapValue,r);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,r){return this.convertObjectMap(e.fields,r)}convertObjectMap(e,r="none"){let t={};return Xa(e,(i,o)=>{t[i]=this.convertValue(o,r)}),t}convertVectorValue(e){var r,t,i;let o=(i=(t=(r=e.fields)===null||r===void 0?void 0:r[yh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>Mt(s.doubleValue));return new Va(o)}convertGeoPoint(e){return new Ua(Mt(e.latitude),Mt(e.longitude))}convertArray(e,r){return(e.values||[]).map(t=>this.convertValue(t,r))}convertServerTimestamp(e,r){switch(r){case"previous":let t=My(e);return t==null?null:this.convertValue(t,r);case"estimate":return this.convertTimestamp(Ym(e));default:return null}}convertTimestamp(e){let r=ws(e);return new Pt(r.seconds,r.nanos)}convertDocumentKey(e,r){let t=We.fromString(e);he(DW(t),9688,{name:e});let i=new vh(t.get(1),t.get(3)),o=new ie(t.popFirst(5));return i.isEqual(r)||Xt(`Document ${o} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${r.projectId}/${r.database}) instead.`),o}};function R3(n,e,r){let t;return t=n?r&&(r.merge||r.mergeFields)?n.toFirestore(e,r):n.toFirestore(e):e,t}var $L=class extends Cy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ns(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function rse(){return new LL("count")}var Fa=class{constructor(e,r){this.hasPendingWrites=e,this.fromCache=r}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ba=class n extends Zl{constructor(e,r,t,i,o,s){super(e,r,t,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=o}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let r=new hh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,r={}){if(this._document){let t=this._document.data.field($y("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,r={};return r.type=n._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}};Ba._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ba._jsonSchema={type:ln("string",Ba._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};var hh=class extends Ba{data(e={}){return super.data(e)}},$l=class n{constructor(e,r,t,i){this._firestore=e,this._userDataWriter=r,this._snapshot=i,this.metadata=new Fa(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(r=>e.push(r)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,r){this._snapshot.docs.forEach(t=>{e.call(r,new hh(this._firestore,this._userDataWriter,t.key,t,new Fa(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let r=!!e.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new Q(j.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new hh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Fa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:s++}})}{let s=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>o||a.type!==3).map(a=>{let c=new hh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Fa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter),l=-1,u=-1;return a.type!==0&&(l=s.indexOf(a.doc.key),s=s.delete(a.doc.key)),a.type!==1&&(s=s.add(a.doc),u=s.indexOf(a.doc.key)),{type:ise(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=n._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$m.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let r=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(r.push(o._document),t.push(this._userDataWriter.convertObjectMap(o._document.data.value.mapValue.fields,"previous")),i.push(o.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function ise(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:n})}}function C3(n){n=Or(n,vn);let e=Or(n.firestore,Qi);return Koe($h(e),n._key).then(r=>M3(e,n,r))}$l._jsonSchemaVersion="firestore/querySnapshot/1.0",$l._jsonSchema={type:ln("string",$l._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};var eu=class extends Cy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ns(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function N3(n){n=Or(n,Yi);let e=Or(n.firestore,Qi),r=$h(e),t=new eu(e);return p3(n._query),Yoe(r,n._query).then(i=>new $l(e,t,n,i))}function O3(n,e,r){n=Or(n,vn);let t=Or(n.firestore,Qi),i=R3(n.converter,e,r);return L3(t,[d3(Gy(t),"setDoc",n._key,i,n.converter!==null,r).toMutation(n._key,Gn.none())])}function w3(n){return L3(Or(n.firestore,Qi),[new Kl(n._key,Gn.none())])}function b3(n,...e){var r,t,i;n=Ge(n);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||EH(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(EH(e[s])){let d=e[s];e[s]=(r=d.next)===null||r===void 0?void 0:r.bind(d),e[s+1]=(t=d.error)===null||t===void 0?void 0:t.bind(d),e[s+2]=(i=d.complete)===null||i===void 0?void 0:i.bind(d)}let c,l,u;if(n instanceof vn)l=Or(n.firestore,Qi),u=Ip(n._key.path),c={next:d=>{e[s]&&e[s](M3(l,n,d))},error:e[s+1],complete:e[s+2]};else{let d=Or(n,Yi);l=Or(d.firestore,Qi),u=d._query;let f=new eu(l);c={next:g=>{e[s]&&e[s](new $l(l,f,d,g))},error:e[s+1],complete:e[s+2]},p3(n._query)}return(function(f,g,p,_){let T=new hp(_),S=new dp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return EM(yield vy(f),S)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return _M(yield vy(f),S)}))}})($h(l),u,a,c)}function L3(n,e){return(function(t,i){let o=new Nr;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return Loe(yield qoe(t),i,o)})),o.promise})($h(n),e)}function M3(n,e,r){let t=r.docs.get(e._key),i=new eu(n);return new Ba(n,i,e._key,t,new Fa(r.hasPendingWrites,r.fromCache),e.converter)}function P3(n){return x3(n,{count:rse()})}function x3(n,e){let r=Or(n.firestore,Qi),t=$h(r),i=Nie(e,(o,s)=>new Tb(s,o.aggregateType,o._internalFieldPath));return Qoe(t,n._query,i).then(o=>(function(a,c,l){let u=new eu(a);return new ML(c,u,l)})(r,n,o))}var jL=class{constructor(e){let r;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),r=e.tabManager):(r=ose(void 0),r._initialize(e)),this._onlineComponentProvider=r._onlineComponentProvider,this._offlineComponentProvider=r._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function wM(n){return new jL(n)}var HL=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=RM.provider,this._offlineComponentProvider={build:r=>new Iy(r,e?.cacheSizeBytes,this.forceOwnership)}}},WL=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=RM.provider,this._offlineComponentProvider={build:r=>new NL(r,e?.cacheSizeBytes)}}};function ose(n){return new HL(n?.forceOwnership)}function bM(){return new WL}var sse={maxAttempts:5};function Mm(n,e){if((n=Ge(n)).firestore!==e)throw new Q(j.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}var zL=class{constructor(e,r){this._firestore=e,this._transaction=r,this._dataReader=Gy(e)}get(e){let r=Mm(e,this._firestore),t=new $L(this._firestore);return this._transaction.lookup([r._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new Zl(this._firestore,t,o.key,o,r.converter);if(o.isNoDocument())return new Zl(this._firestore,t,r._key,null,r.converter);throw ae(18433,{doc:o})})}set(e,r,t){let i=Mm(e,this._firestore),o=R3(i.converter,r,t),s=d3(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,r,t,...i){let o=Mm(e,this._firestore),s;return s=typeof(r=Ge(r))=="string"||r instanceof Ph?ese(this._dataReader,"Transaction.update",o._key,r,t,i):Zoe(this._dataReader,"Transaction.update",o._key,r),this._transaction.update(o._key,s),this}delete(e){let r=Mm(e,this._firestore);return this._transaction.delete(r._key),this}};var qL=class extends zL{constructor(e,r){super(e,r),this._firestore=e}get(e){let r=Mm(e,this._firestore),t=new eu(this._firestore);return super.get(e).then(i=>new Ba(this._firestore,t,r._key,i._document,new Fa(!1,!1),r.converter))}};function F3(n,e,r){n=Or(n,Qi);let t=Object.assign(Object.assign({},sse),r);return(function(o){if(o.maxAttempts<1)throw new Q(j.INVALID_ARGUMENT,"Max attempts must be at least 1")})(t),(function(o,s,a){let c=new Nr;return o.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){let l=yield r3(o);new wL(o.asyncQueue,l,a,s,c).zu()})),c.promise})($h(n),i=>e(new qL(n,i)),t)}(function(e,r=!0){(function(i){kh=i})(ma),lr(new _n("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new Qi(new jw(t.getProvider("auth-internal")),new zw(s,t.getProvider("app-check-internal")),(function(l,u){if(!Object.prototype.hasOwnProperty.apply(l.options,["projectId"]))throw new Q(j.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new vh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:r},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Qe(ij,oj,e),Qe(ij,oj,"esm2017")})();var LM=pe(I3,!0,2);var Ap=pe(a3,!0,2),MM=pe(c3,!0,2);var jy=pe(w3,!0,2);var jh=pe(l3,!0,2);var k3=pe(P3,!0),U3=pe(C3,!0);var V3=pe(N3,!0);var wxe=pe(y3,!0,2);var PM=pe(b3,!0);var bxe=pe(T3,!0,2),Lxe=pe(v3,!0,2),xM=pe(E3,!0,2);var FM=pe(F3,!0),kM=pe(O3,!0,2);var Mxe=pe(S3,!0,2);var Xi=pe(_3,!0,2);var Hy=(()=>{let e=class e{constructor(t,i,o){this.authService=t,this.configService=i,this.loggingService=o,this.db$=new Y(null);try{this.authService.getFirebaseConfig$().subscribe(s=>{if(s){let a=this.configService.getProxyConfig(),c=s.firebaseOptions.databaseURL;a?.v1DbHost&&c&&(c=NV(c,a.v1DbHost),a?.forceLongPolling&&dw());let l=uv(void 0,c);a?.v1DbHost&&c&&this.lockDatabaseHost(l),this.db$.next(l)}},s=>{this.loggingService.catch("Error in DatabaseService constructor: ",s)})}catch(s){this.loggingService.catch("Error in DatabaseService constructor:",s)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}lockDatabaseHost(t){try{let o=t?._repo?.repoInfo_;if(o){let s=o.host;Object.defineProperty(o,"host",{get:()=>s,set:()=>{},configurable:!0}),o.internalHost=s}}catch(i){this.loggingService.catch("Error in DatabaseService lockDatabaseHost: ",i)}}};e.\u0275fac=function(i){return new(i||e)(w(Rr),w(Dr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Wo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new Y(null),this.commentAnnotationById$=new Y({}),this.fieldsToRemove=[],this.additionalFields=[],this.getCommentAnnotationById=s=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove),s.config?.additionalFields&&(this.additionalFields=s.config.additionalFields||[]))})}catch(s){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.commentAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",t)}}resolveCommentAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:t}}),f(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.commentAnnotationIds||[])],T=le(P({},t),{commentAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0):g?.get?.(T)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(x=>c?{}:(u(),x&&x.statusCode!==200?(this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),this.loggingService.catch(x?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):x?.data)).catch(x=>{throw u(),x});try{p=(yield B)||{},this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:_});let x={};Object.entries(p).forEach(([U,$])=>{let A=this.commentAnnotationById$.value?.[U];A?A&&JSON.stringify(A)!==JSON.stringify($)&&(x[U]=$):x[U]=$}),Object.keys(x).length>0&&this.commentAnnotationById$.next(P(P({},this.commentAnnotationById$.getValue()),x)),this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),d(x)}catch(x){let U=i||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:x,request:T}}),c||f(x),d(p)}}else u(),d({})}catch(b){u();let B=i||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveCommentAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let o=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=P(P({},a),t.commentAnnotation);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1)}return o?.save?.({commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveCommentAnnotation",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(t.commentAnnotation),eventType:t.eventType,commentId:t.commentId}),this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let s=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?P({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:t.toString(),metadata:u}});let f=P({},a);delete f?.[t],this.commentAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1)}return s?.delete?.({commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteCommentAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:t.toString()}),this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:s,commentAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}setCommentAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting comment annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new Y(null),this.reactionAnnotationById$=new Y({}),this.getReactionAnnotationById=s=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.reactionAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",t)}}resolveReactionAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:t}}),f(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.reactionAnnotationIds||[])],T=le(P({},t),{reactionAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0):g?.get?.(T)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(x=>c?{}:(u(),x&&x.statusCode!==200?(this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),this.loggingService.catch(x?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):x?.data)).catch(x=>{throw u(),x});try{p=(yield B)||{},this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:_});let x={};Object.entries(p).forEach(([U,$])=>{let A=this.reactionAnnotationById$.value?.[U];A?A&&JSON.stringify(A)!==JSON.stringify($)&&(x[U]=$):x[U]=$}),Object.keys(x).length>0&&this.reactionAnnotationById$.next(P(P({},this.reactionAnnotationById$.getValue()),x)),this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),d(x)}catch(x){let U=i||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:x,request:T}}),c||f(x),d(p)}}else u(),d({})}catch(b){u();let B=i||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveReactionAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let o=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=P(P({},a),t);let c={reactionAnnotation:t,event:Qt.REACTION_ADD,metadata:Object.values(t??{})?.[0]?.metadata},l=yield kt(()=>o?.config?.saveConfig?.url?Ht(o.config.saveConfig.url,o.config.saveConfig.headers,c,!1):o?.save?.(c)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(t),eventType:c.event}),this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let s=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),c=i??a?.[t]?.metadata,l=c?Cn(c):void 0,u=l?P({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:t.toString(),metadata:u}});let f=P({},a);delete f?.[t],this.reactionAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1)}return s?.delete?.({reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE})||Promise.resolve(void 0)},"deleteReactionAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:t.toString()}),this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:s,reactionAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting reaction annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Hh=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.providers=new Map,this.retrySaveConfigs=new Map,this.retryDeleteConfigs=new Map,this.defaultRetryConfig={retryCount:0,retryDelay:0,revertOnFailure:!1};try{this.loggingService.log("AttachmentResolverService initialized")}catch(s){this.loggingService.catch("Error in AttachmentResolverService constructor:",s)}}getProvider(t){try{let i=t||"default";return this.providers.get(i)||void 0}catch(i){this.loggingService.catch("Error in AttachmentResolverService getProvider:",i);return}}getRetrySaveConfig(t){let i=t||"default";return this.retrySaveConfigs.get(i)||this.defaultRetryConfig}getRetryDeleteConfig(t){let i=t||"default";return this.retryDeleteConfigs.get(i)||this.defaultRetryConfig}makeAttachmentConfigBasedRequest(t,i,o,s){return I(this,null,function*(){try{let a=new FormData;a.append("file",o);let c={attachment:{attachmentId:s.attachment.attachmentId,name:s.attachment.name,mimeType:s.attachment.mimeType},metadata:s.metadata,event:s.event};a.append("request",JSON.stringify(c));let l={};i&&Object.entries(i).forEach(([f,g])=>{f.toLowerCase()!=="content-type"&&(l[f]=g)});let u=yield fetch(t,{method:"POST",headers:l,body:a});return u.ok?{data:(yield u.json())?.data??{},success:!0,statusCode:200}:(H.catch(`Error in makeAttachmentConfigBasedRequest: ${u.status} ${u.statusText}`),{data:{},success:!1,statusCode:u.status})}catch(a){return H.catch("Error in makeAttachmentConfigBasedRequest:",a),{data:{},success:!1,statusCode:500}}})}saveAttachment(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let s=this.getProvider(o);if(!this.attachmentDataProviderAvailable(o))throw new Error("Attachment save data provider not available");let a=this.getRetrySaveConfig(o),c=i||J();this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:Co.SAVE_ATTACHMENT,source:"internal",payload:{request:t}});let l=yield kt(()=>I(this,null,function*(){if(s?.config?.saveConfig?.url){let u=t.attachment,{file:d}=u,f=uS(u,["file"]);return this.makeAttachmentConfigBasedRequest(s.config.saveConfig.url,s.config.saveConfig.headers,d,{attachment:f,event:t.eventType,metadata:t.attachment.metadata})}return s?.save?.({attachment:t.attachment,event:t.eventType,metadata:t.attachment.metadata})||Promise.resolve(void 0)}),"saveAttachment",a);if(l?.statusCode!==200){this.loggingService.catch(l?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Co.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:t}});return}return this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:t.attachment.attachmentId,eventType:t.eventType}),this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:c,methodName:Co.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||J();this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Co.SAVE_ATTACHMENT,source:"internal",payload:{error:s,request:t}});return}})}deleteAttachment(a,c,l){return I(this,arguments,function*({attachmentId:t,metadata:i},o,s){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let u=this.getProvider(s);if(!this.attachmentDataProviderAvailable(s))throw new Error("Attachment delete data provider not available");let d=i?P({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0,f=this.getRetryDeleteConfig(s),g=o||J();this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:Co.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield kt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE};return Ht(u.config.deleteConfig.url,u.config.deleteConfig.headers,_,!1)}return u?.delete?.({attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE})||Promise.resolve(void 0)},"deleteAttachment",f);return p?.statusCode!==200?(this.loggingService.catch(p?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:g,methodName:Co.DELETE_ATTACHMENT,source:"internal",payload:{error:p,attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:t}),this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:g,methodName:Co.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:f.revertOnFailure,isSuccess:!0},attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!0})}catch(u){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",u);let d=this.getRetryDeleteConfig(s),f=o||J(),g=i?P({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0;return this.coreActionsService.triggerAction(G.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Co.DELETE_ATTACHMENT,source:"internal",payload:{error:u,attachmentId:t,metadata:g}}),{revertOnFailure:d.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(t,i="default"){try{if(t){this.loggingService.log(`Setting attachment data provider for scope: ${i}`);let o=t.config,s=[{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(s.forEach(({method:c,configKey:l})=>{let u=o?.[l]?.url,d=c in t&&typeof t[c]=="function";!u&&!d&&a.push(c)}),a.length>0){let c=`DataProviders.attachment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(c);return}else this.providers.set(i,t),t.config?.saveRetryConfig&&this.retrySaveConfigs.set(i,t.config.saveRetryConfig),t.config?.deleteRetryConfig&&this.retryDeleteConfigs.set(i,t.config.deleteRetryConfig)}}catch(o){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",o)}}attachmentDataProviderAvailable(t){try{let i=t||"default";return this.providers.has(i)}catch(i){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",i),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Za=(()=>{let e=class e{constructor(t,i,o,s){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.attachmentResolverService=s,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.recorderAnnotationDataProvider$=new Y(null),this.recorderAnnotationById$=new Y({}),this.additionalFields=[],this.uploadChunks=!1,this.getRecorderAnnotationById=a=>{try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.value?.[a]:void 0}catch(c){this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationById:",c);return}};try{this.loggingService.log("RecorderAnnotationsResolverService initialized"),this.recorderAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.additionalFields&&(this.additionalFields=a.config.additionalFields||[]),this.uploadChunks=a.uploadChunks??!1)})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService constructor:",a)}}getProvider(){try{let t=this.recorderAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.recorderAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService ngOnDestroy:",t)}}resolveRecorderAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: resolveRecorderAnnotations","color: green;"),!this.recorderAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Recorder annotation resolution timeout"),request:t}}),f(new Error("Recorder annotation resolution timeout"))}},this.recorderAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.recorderAnnotationIds||[])],T=le(P({},t),{recorderAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0):g?.get?.(T)||Promise.resolve(void 0),"getRecorderAnnotations",this.retryGetConfig).then(x=>c?{}:(u(),x&&x.statusCode!==200?(this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),this.loggingService.catch(x?.message??"Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:"),{}):x?.data)).catch(x=>{throw u(),x});try{p=(yield B)||{},this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_GET,{sourceMethod:"resolveRecorderAnnotations",source:"sdk",recorderAnnotationIds:_});let x={};Object.entries(p).forEach(([U,$])=>{let A=this.recorderAnnotationById$.value?.[U];A?A&&JSON.stringify(A)!==JSON.stringify($)&&(x[U]=$):x[U]=$}),Object.keys(x).length>0&&this.recorderAnnotationById$.next(P(P({},this.recorderAnnotationById$.getValue()),x)),this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:x,request:T}}),d(x)}catch(x){let U=i||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:x,request:T}}),c||f(x),d(p)}}else u(),d({})}catch(b){u();let B=i||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveRecorderAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: saveRecorderAnnotation","color: green;");let o=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.recorderAnnotationById$.getValue()));this.recorderAnnotationById$._value=P(P({},a),t.recorderAnnotation);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1)}return o?.save?.({recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveRecorderAnnotation",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in RecorderAnnotationsResolverService saveRecorderAnnotation:"),this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_SAVE,{sourceMethod:"saveRecorderAnnotation",source:"sdk",recorderAnnotationIds:Object.keys(t.recorderAnnotation),eventType:t.eventType}),this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in RecorderAnnotationsResolverService saveRecorderAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteRecorderAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: deleteRecorderAnnotation","color: green;");let s=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation delete data provider not available");let a=this.recorderAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?P({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{recorderAnnotationId:t.toString(),metadata:u}});let f=P({},a);delete f?.[t],this.recorderAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1)}return s?.delete?.({recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteRecorderAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:"),this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:g,recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_DELETE,{sourceMethod:"deleteRecorderAnnotation",source:"sdk",recorderAnnotationId:t.toString()}),this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:s,recorderAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getRecorderAnnotationsById$(){try{return this.recorderAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: getRecorderAnnotationsById$","color: green;"),this.recorderAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService getAnnotationById:",i);return}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}shouldUploadChunks(){return this.uploadChunks}shouldUploadFullRecording(){return this.recorderAnnotationDataProviderAvailable()&&!this.uploadChunks}setRecorderAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting recorder annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.recorder is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else t.storage&&this.attachmentResolverService.setAttachmentDataProvider(t.storage,"recorder"),this.attachmentResolverService.attachmentDataProviderAvailable("recorder")||this.loggingService.catch("Recording resolver is configured without storage resolver. Recording files (chunks, thumbnails) will be stored on Velt's infrastructure. Configure storage resolver for full self-hosting.",void 0,void 0,!0),this.recorderAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService setRecorderAnnotationDataProvider:",i)}}recorderAnnotationDataProviderAvailable(){try{return!!this.recorderAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService recorderAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt),w(Hh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zy=class{};var Wh=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p){this.analyticsService=t,this.authService=i,this.databaseService=o,this.domService=s,this.configService=a,this.loggingService=c,this.commentResolverService=l,this.reactionResolverService=u,this.recorderResolverService=d,this.coreActionsService=f,this.functions=g,this.serviceBook=p,this.documentPaths$=new Y(null),this.docContext$=new Y(null),this.documentIds$=new Y([]),this.organizationConfig$=new Y(null),this.firestorePaths$=new Y(null),this.location$=new Y(null),this.excludedLocationIds$=new Y([]),this.organizationMetadata$=new Y(null),this.documentMetadata$=new Y(null),this.locationMetadata$=new Y(null),this.customerMetadata$=new Y(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new Y({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new Y({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Ot,this.DEBOUNCE_TIME=5e3,this.currentDebounceTime=this.DEBOUNCE_TIME,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.pendingDocumentIds=[],this.pendingOptions={},this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.serviceBook.observe(md).subscribe(_=>{this.commentService=_??void 0}),V1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(yS(()=>Ri(this.currentDebounceTime))).subscribe({next:_=>I(this,null,function*(){try{yield this.setDocumentIdImpl(_.documentId,_.clientOrganizationId,_.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:_=>{this.loggingService.catch("Error in setDocumentId subscription:",_),this.queueSize--}}),this.databaseService.getDb().pipe(Ct(_=>!!_),Nt(1)).subscribe(_=>{_&&(this.db=_)}),this.configService.getApiKey$().subscribe(_=>{if(this.apiKey=_,this.apiKey){if(!this.isCustomDocId){let T=jT(window.location.href);this.currentUrl=T}this.analyticsService.updateDefaultProperties({apiKey:_})}}),this.authService.getUser$().subscribe(_=>I(this,null,function*(){if(_&&(this.analyticsService.updateDefaultProperties({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&_?.organizationId&&this.documentPaths$.value?.organizationId!==_?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(T=>({id:T.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),_?.organizationId&&_?.clientOrganizationId)){let T={organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId};this.getOrganizationConfig()||this.setOrganizationConfig({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),yield this.updateOrganizationMetadata(T)}})),this.documentPaths$.subscribe(_=>{let T={documentId:_?.documentId,clientDocumentId:_?.clientDocumentId,folderId:_?.folderId,allDocuments:_?.allDocuments,veltFolderId:_?.veltFolderId};_?.organizationId&&(T.organizationId=_.organizationId,T.clientOrganizationId=_.clientOrganizationId),this.analyticsService.updateDefaultProperties(T),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(_=>{this.analyticsService.updateDefaultProperties({clientLocation:_?.location,locationId:_?.locationId})}),this.organizationMetadata$.subscribe(_=>{this.authService.setUserOrganization(_?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Ct(_=>!!_),Nt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(_){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}},_=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(_){this.loggingService.catch("Error in DocService constructor:",_)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{organizationId:this.documentPaths$.value?.clientOrganizationId,folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,optimisticPermissions:this.documentPaths$.value?.optimisticPermissions}:null}catch(t){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",t),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.setOrganizationConfig(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftDocuments=this.documentIds$.value.map(t=>({id:t.clientDocumentId})),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(t=>t.location)].filter(t=>t!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(t){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",t)}}setUsersService(t){try{this.usersService=t}catch(i){this.loggingService.catch("Error in setUsersService:",i)}}setCommonDbService(t){try{this.commonDbService=t}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setUserPermissionService(t){try{this.userPermissionService=t}catch(i){this.loggingService.catch("Error in setUserPermissionService:",i)}}setCommentService(t){try{this.commentService=t}catch(i){this.loggingService.catch("Error in setCommentService:",i)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let t=jT(location.href);this.currentUrl!==t&&(this.currentUrl=t,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowPopstate: ",t)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let t=jT(location.href);this.currentUrl!==t&&(this.currentUrl=t,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowClick: ",t)}}setDocument(a){return I(this,arguments,function*({documentId:t,documentMetadata:i,options:o,source:s="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),s==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,documentMetadata:i,methodName:"setDocument",source:s}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:s,payload:{documentId:t,documentMetadata:i,options:o}}),yield this.setDocumentsImpl({documents:[{id:t,metadata:i}],options:P({organizationId:i?.organizationId},o??{}),source:s})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}shouldSetDocumentsAgain(t,i={}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;"),this.pendingDocumentIds.length>0&&t.length===this.pendingDocumentIds.length&&t.every(d=>this.pendingDocumentIds.includes(d.id))&&Fi(i,this.pendingOptions))return!1;let o=this.documentPaths$.value?.clientDocumentId,s=i?.rootDocumentId??t[0]?.id,a=this.documentIds$.value.map(u=>u.clientDocumentId),c=$T(this.getOptionsFromDocumentPaths()??{})??{};return!t.every(u=>a.includes(u.id))||!Fi(c,i)||o!==s}catch(o){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",o),!0}}getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:i=!1}){try{let o=[];return t.forEach(s=>{let a=s.id,c=`${_r(a)}`;i&&s?.metadata&&typeof s.metadata=="object"&&(this.clientDocumentMetadataMap[a]=s.metadata),o.push({documentId:c,clientDocumentId:a})}),o}catch(o){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",o),[]}}setDocuments(a){return I(this,arguments,function*({documents:t,options:i,source:o="internal",skipPermissionValidation:s=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:t,options:i,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:o,payload:{documents:t,options:i}}),yield this.setDocumentsImpl({documents:t,options:i??{},source:o,skipPermissionValidation:s})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}setRootDocument(o){return I(this,arguments,function*({document:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:kn.SET_ROOT_DOCUMENT,source:i,payload:{document:t}});let s=this.getOptionsFromDocumentPaths()??{},a=this.documentIds$.value.map(c=>c.clientDocumentId);if(!a.includes(t.id)){let c=[...a.map(u=>({id:u})),{id:t.id}],l=this.getDocumentIdsFromDocuments({documents:c,setClientDocumentMetadataMap:!0});this.documentIds$.next(l)}yield this.setDocumentIdImpl(t.id,this.documentPaths$.value?.clientOrganizationId,s)}catch(s){this.loggingService.catch("Error in DocService setRootDocument:",s)}})}setDocContext(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let i=JSON.parse(JSON.stringify(t??null));this.docContext$.next(i)}catch(i){this.loggingService.catch("Error in setDocContext: ",i)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(it(Ft))}getProcessedDocContext(){return BV(this.getDocContext())}filterRelevantDocuments(s){return I(this,arguments,function*({options:t,documentIds:i,skipPermissionValidation:o=!1}){try{let a=this.authService.getUser();return!a||!this.commonDbService?.shouldUseFirestore()||(i=yield this.fetchDocumentsFromFolder(t,i,a),yield this.handlePermissionProvider(t,i,a),i=yield this.filterDocumentsByPermissions(t,i,a,o),i=i.slice(0,50)),i}catch(a){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",a),i}})}fetchDocumentsFromFolder(t,i,o){return I(this,null,function*(){if(!t?.folderId||!t?.allDocuments)return i;try{let s=Ar(this.functions,Tr({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Sd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:t?.organizationId??o?.clientOrganizationId,folderId:t?.folderId}},getSdkProxy:s,userId:o?.userId??""}))?.data?.forEach(c=>{i.find(l=>l.clientDocumentId===c.id)||i.push({documentId:ua(c.id),clientDocumentId:c.id})})}catch(s){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",s)}return i})}buildPermissionRequests(t,i,o){try{let s=[];return t.organizationId&&t.organizationId!==o.clientOrganizationId&&s.push({userId:o.userId,resource:{id:t.organizationId,type:ui.ORGANIZATION,source:Un.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:ui.FOLDER,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context}}),i&&i.forEach(a=>{s.push({userId:o.userId,resource:P({id:a.clientDocumentId,type:ui.DOCUMENT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&GV({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:ui.CONTEXT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:c}})}),s}catch(s){return this.loggingService.catch("Error in buildPermissionRequests:",s),[]}}processAccessibleContexts(t,i){try{if(!t?.success||!t?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let o=t.data.filter(s=>s.type===ui.CONTEXT&&s.hasAccess).map(s=>s.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(o??"nil"))),o?.length){let s=i.filter(c=>o.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),a=$V({input:s});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(a??"nil"))),a?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(a??"nil"))),this.setDocContext(a))}}catch(o){this.loggingService.catch("Error in processAccessibleContexts:",o)}}handlePermissionProvider(t,i,o){return I(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let s=this.buildPermissionRequests(t,i,o),a=J();this.coreActionsService.triggerAction(G.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_DOCUMENTS,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:s}}),this.userPermissionService?.cancelPendingRevokes(s);let c=yield this.userPermissionService?.onResourceAccessRequired({requests:s,uniqueId:a,methodName:Un.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(c??"nil")),"requests:",JSON.parse(JSON.stringify(s??"nil"))),this.processAccessibleContexts(c,s)}catch(s){this.loggingService.catch("Error in handlePermissionProvider:",s)}})}filterDocumentsByPermissions(t,i,o,s=!1){return I(this,null,function*(){if(s)return i;if(this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil"))),!(t?.optimisticPermissions!==!1))return yield this.validateAndFilterPermissions(t,i,o);let c=this.currentValidationToken,l=[...i];return c&&this.validatePermissionsInBackground(t,i,o,c),l})}validateAndFilterPermissions(t,i,o){return I(this,null,function*(){try{let s=t?.organizationId??o?.clientOrganizationId,a=yield this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:i.map(u=>u.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]});if(!a)return i;this.userPermissionService?.setCurrentUserPermissions(a),s&&a?.[o.userId]?.organization?.[s]?.errorCode===No.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),t?.folderId&&a?.[o.userId]?.folders?.[t?.folderId]?.errorCode===No.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0);let c=new Set;Object.entries(a?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===No.PERMISSION_DENIED&&c.add(u)}),c.size>0&&(this.loggingService.catch(`User does not have access to documents: ${[...c].join(", ")}`,void 0,void 0,!0),this.coreActionsService.triggerAction(G.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"validateAndFilterPermissions",message:"Access denied to documents in strict validation mode",documentIds:[...c],userId:o.userId,timestamp:new Date().getTime()}));let l=i.filter(u=>!c.has(u.clientDocumentId));return l.length===0&&i.length>0&&this.loggingService.catch("Error in validateAndFilterPermissions: All documents provided are denied"),l}catch(s){return this.loggingService.catch("Error in validateAndFilterPermissions:",s),i}})}validatePermissionsInBackground(t,i,o,s){let a=t?.organizationId??o?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:a,documentIds:i.map(c=>c.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]}).then(c=>{if(this.currentValidationToken===s&&c){this.userPermissionService?.setCurrentUserPermissions(c);let l=[];Object.entries(c?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===No.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===No.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${a}`,void 0,void 0,!0),t?.folderId&&c?.[o.userId]?.folders?.[t?.folderId]?.errorCode===No.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0),l.length>0&&(this.loggingService.catch(`User does not have access to documents: ${l.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(l,o,s))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(t,i,o){try{if(this.currentValidationToken!==o)return;let s=this.documentPaths$.value;this.coreActionsService.triggerAction(G.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:t,userId:i.userId,timestamp:new Date().getTime()});let a=this.documentIds$.value||[],c=a.filter(l=>!t.includes(l.clientDocumentId));c.length!==a.length&&(c.length>0?this.setDocuments({documents:c.map(l=>({id:l.clientDocumentId})),options:{organizationId:s?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(G.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:t,userId:i.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(s){this.loggingService.catch("Error in handleDeniedDocumentAccess:",s)}}addUserInfoToOrganization(a){return I(this,arguments,function*({organizationId:t,user:i,notificationsConfig:o,currentUserId:s}){try{let c=Ar(this.functions,Tr({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Sd({data:P({type:"addUserInfoToOrganization",metadata:{organizationId:t},user:this.usersService?.externalUserDataProviderAvailable()?{userId:i?.userId}:i},o&&{notificationsConfig:o}),getSdkProxy:c,userId:s??i?.userId??""})}catch(c){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",c)}})}setDocumentsImpl(a){return I(this,arguments,function*({documents:t,options:i,source:o,skipPermissionValidation:s=!1}){try{if(this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(t??"nil")),"options:",JSON.parse(JSON.stringify(i??"nil"))),!this.shouldSetDocumentsAgain(t,$T(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=J();this.currentValidationToken=c;let l=this.getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:!0});if(l?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let u=this.authService.getUser();if(!u){this.draftDocuments=t,this.draftOptions=i;return}this.pendingDocumentIds=t.map(f=>f.id),this.pendingOptions=$T(i)??{},this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.clientOrganizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let d=i?.organizationId??u?.clientOrganizationId;if(d&&this.addUserInfoToOrganization({organizationId:d,user:u}),l=yield this.filterRelevantDocuments({options:i,documentIds:l,skipPermissionValidation:s}),this.documentIds$.next(l),l?.length){let f=l[0]?.clientDocumentId;i?.rootDocumentId&&l.find(g=>g.clientDocumentId===i?.rootDocumentId)&&(f=i?.rootDocumentId),yield this.debounceSetDocuments({documentId:f,clientOrganizationId:i?.organizationId,options:i})}this.pendingDocumentIds=[],this.pendingOptions={};return}catch(c){this.pendingDocumentIds=[],this.pendingOptions={},this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}setDocumentId(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,clientOrganizationId:i,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENT_ID,source:o,payload:{documentId:t,clientOrganizationId:i}}),yield this.setDocumentsImpl({documents:[{id:t}],options:{organizationId:i},source:o})}catch(a){this.loggingService.catch("Error in setDocumentId:",a);return}})}debounceSetDocuments(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,options:o}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let a=o?.debounceTime??this.DEBOUNCE_TIME;this.currentDebounceTime=a;let c=Date.now(),l=c-this.lastSetDocumentIdCallTime,u=c-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=c,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||l>a&&u>a){yield this.setDocumentIdImpl(t,i,o),this.lastSetDocumentIdExecutionTime=c;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:t,clientOrganizationId:i,options:o??void 0});return}catch(a){this.loggingService.catch("Error in debounceSetDocuments:",a)}})}setDocumentIdImpl(t,i,o){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let s=this.authService.getUser();if(!s)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let a=this.currentDocumentId;if(this.apiKey){let c=`${_r(t)}`,l=o?.folderId,u=o?.folderId?Oo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?xi(i):s?.organizationId:void 0,_=J(),T=_d.SET_DOCUMENTS;this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:Et.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let S=J(),b=Td.SET_DOCUMENTS;this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:S,moduleName:b,methodName:_t.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let B=J(),x=Id.GET_RECORDER_ANNOTATIONS;if(this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:B,moduleName:x,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:S,moduleName:b}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:B,moduleName:x})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==p){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let U=new PT,$=new zy;U.clientDocumentId=t,$.clientDocumentId=t,U.folderId=l,$.folderId=l,U.locationId=d,$.locationId=d,U.allDocuments=f,U.optimisticPermissions=g,$.allDocuments=f,$.optimisticPermissions=g,U.veltFolderId=u,$.veltFolderId=u,U.documentId=c,$.documentId=c,p&&(U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId,$.organizationId=p,$.clientOrganizationId=i??s?.clientOrganizationId);let A=`${this.apiKey}`,D=`apiKey/${this.apiKey}`;p&&(A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`,D=`${D}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`),$.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,$.document=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,U.presence=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,U.cursor=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,U.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,$.comment=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,U.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,$.multiThread=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,U.tag=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,U.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,$.area=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,U.arrow=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,U.selection=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,U.audioHuddle=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,U.huddle=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,U.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,$.recorder=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,U.flock=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,U.syncVideoPlayer=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,U.liveState=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,U.liveStateSingleEditorMode=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,U.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,$.reaction=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,U.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,$.crdt=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,U.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,U.views=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,$.notificationViews=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,$.documentViews=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,$.locationViews=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,U.notifications=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,U.metadata=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,U.users=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.documentIam=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.groupContacts=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,U.globalContacts=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,U.logins=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,U.userFeedback=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,U.userReportBugs=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,U.userContactUs=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(U.organizationMetadata=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,U.organizationIam=`${A}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.organizationGroups=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,U.organizationNotifications=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(U.organizationNotificationsWithDocumentId=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,U.heartbeatByDocument=`${A}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),U.organizationNotificationsLastNotificationTimestamp=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,U.organizationNotificationsUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.heartbeat=`${A}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),$.organizationUsers=`${D}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,$.users=`${D}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,$.documentUsers=`${D}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,$.notificationDocs=`${D}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,$.notificationUsers=`${D}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(U),this.firestorePaths$.next($),U?.clientOrganizationId&&U?.organizationId&&!(U?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&U?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:U?.organizationId,clientOrganizationId:U?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),a&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:t}}),this.analyticsService.trackEvent(L.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:t},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(s){this.loggingService.catch("Error in setDocumentIdImpl: ",s)}})}unsetDocumentId({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:t}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:kn.UNSET_DOCUMENT_ID,source:t}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocumentId: ",o)}}unsetDocumentImpl({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{let o=JSON.parse(JSON.stringify(this.documentIds$.value??[])),s=JSON.parse(JSON.stringify(this.documentPaths$.value?.folderId??"")),a=this.getDocContext();this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),i&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.locations$.next({}),this.documentIds$.next([]),this.setDocContext(null),this.userPermissionService?.revokeAccessOnDocumentUnset({documentIds:o,folderId:s,context:a}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:t}),this.analyticsService.trackEvent(L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:t==="external"?"User unset document id":"System unset document id",source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetDocumentImpl: ",o)}}unsetDocuments({source:t,unsetDocumentPaths:i=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:t}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:t,methodName:kn.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocuments: ",o)}}addPreDocumentIdChangeFunction(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(t,i)}catch(o){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",o)}}callPreDocumentIdChangeFunctions(t){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,o]of this.preDocumentIdChangeFunctions)try{yield o(t)}catch(s){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",s)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig()),this.db&&t?.organizationId){let i=t?.organizationId,o=t?.clientOrganizationId,s=this.authService.getUser()?.userId??"",a=yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o});if(s&&a?.[s]?.organization?.[o]?.errorCode===No.PERMISSION_DENIED)return;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:i,field:"metadata"}}).then(c=>{c&&!c?.errorCode&&this.organizationMetadata$.next(le(P({},this.organizationMetadata$.value),{[i]:c}))}).catch(c=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",c)})}}catch(i){this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)}})}fetchDocumentMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,o=this.documentMetadata$.value;if(t=t.filter(s=>!o?.[s.documentId]),t?.some(s=>!s?.documentId||!s?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let s=i?.folderId,a=[],c={organizationId:i?.clientOrganizationId,folderId:s},l=[],u=20;for(let f=0;f<t.length;f+=u)l.push(t.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchDocuments(g))});let d={};a.length>0&&(yield Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=p.metadata)})}),this.setAllDocumentMetadata(P(P({},this.documentMetadata$.value),d))}).catch(f=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",f)}))}else o?.[i?.documentId??t?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??t?.[0]?.documentId,skipObjectValues:!0}}).then(s=>{s?.documentId&&this.setDocumentMetadata(s.documentId,s)}).catch(s=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",s)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}})}fetchLocationMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,i=this.documentIds$.value,o=t?.folderId,s=t?.allDocuments,a=[],c={organizationId:t?.clientOrganizationId,folderId:o,allDocuments:s},l=[],u=20;for(let f=0;f<i.length;f+=u)l.push(i.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchLocations(g))});let d=this.locationMetadata$.value??{};a.length>0&&Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=le(P({},d?.[p.metadata.documentId]??{}),{[p.location.id]:p}))})}),Object.keys(d||{}).length>0&&this.locationMetadata$.next(d)}).catch(f=>{this.loggingService.catch("Error in fetchLocationMetadata: ",f)})}}catch(t){this.loggingService.catch("Error in fetchLocationMetadata: ",t)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(es(i=>ue(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(t){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",t)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(fe(t=>t?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(t){try{return`${_r(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${xi(t)}`}catch(i){return this.loggingService.catch("Error in generateOrganizationId: ",i),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:void 0,methodName:"setLocation",source:i}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:kn.SET_LOCATION,payload:{locations:[t],options:void 0}}),this.setLocationsImpl({locations:[t]})}catch(s){this.loggingService.catch("Error in setLocation: ",s)}})}setLocations(s){return I(this,arguments,function*({locations:t,options:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:t,options:i,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.SET_LOCATIONS,source:o,payload:{locations:t,options:i}}),this.setLocationsImpl({locations:t,options:i})}catch(a){this.loggingService.catch("Error in setLocations: ",a)}})}getValidLocations(t){try{let i=[];return t&&Array.isArray(t)&&t.forEach(o=>{if(o&&typeof o=="object"){let s=!0;o?.version&&(!o?.version?.id||!o?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${o?.id}, If you're setting version then add id and name fields to version object.`),s=!1),s&&i.push(o)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return t}setRootLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:t,methodName:"setRootLocation",source:i}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:kn.SET_ROOT_LOCATION,source:i,payload:{location:t}});let s=Object.values(this.locations$.value).map(a=>a.location).filter(a=>String(a.id)!==String(t.id));this.setLocationsImpl({locations:[t,...s],options:{rootLocationId:t.id}})}catch(s){this.loggingService.catch("Error in DocService setRootLocation:",s)}})}setLocationsImpl({locations:t,options:i}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),t.length===0)return;if(!this.authService.getUser()){!i?.appendLocation&&t.length>0&&(this.draftLocationMap.options=le(P(P({},this.draftLocationMap.options??{}),i??{}),{rootLocationId:t[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...t],this.draftLocationMap.options=P(P({},this.draftLocationMap.options),i);return}let s=this.getValidLocations(t),a=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(d=>d.location.id)].filter(d=>d!==void 0);let l;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(l=s.find(d=>d.id===i?.rootLocationId),!l)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(i?.appendLocation){if(l){let d=yd(l),f=_r(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}}else{l||(l=s[0]);let d=yd(l),f=_r(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}let u=[];return s.slice(i?.appendLocation?0:1).forEach(d=>{if(d.id!==this.location$.value?.location.id){let f=P({},d),g=this.locations$.value;d?.id&&Object.keys(g).forEach(S=>{let b=g[S];b.location?.id===d.id&&(f=P(P({},b.location),d),delete g?.[S])});let p=this.genarateLocationId(f),_={locationId:p,location:f};f.id&&a.push({locationId:p,location:f}),u.push(_);let T=le(P({},g),{[p]:_});this.locations$.next(T)}}),this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:kn.SET_LOCATIONS,payload:{locations:s,options:i}}),this.analyticsService.trackEvent(L.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:s,options:i},!0,this.getUserIdForAnalytics()),u}catch(o){this.loggingService.catch("Error in setLocationImpl: ",o);return}}addLocation({location:t,source:i="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:{appendLocation:!0},methodName:"addLocation",source:i}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.ADD_LOCATION,source:i,payload:{locations:[t],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[t],options:{appendLocation:!0}})}catch(o){this.loggingService.catch("Error in DocService addLocation:",o);return}}removeLocation({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[t],methodName:"removeLocation",source:i}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:kn.REMOVE_LOCATION,payload:{locations:[t]}}),t&&this.removeLocationsImpl([t],i)}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}removeLocations({locations:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t,methodName:"removeLocations",source:i}}),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:kn.REMOVE_LOCATIONS,source:i,payload:{locations:t}}),this.removeLocationsImpl(t,i)}catch(o){this.loggingService.catch("Error in removeLocations: ",o)}}removeLocationsImpl(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),t?t.forEach(o=>{let s=this.genarateLocationId(o);this.getLocation()?.locationId===s&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==o.id))),this.removeCustomLocation(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}unsetLocationIds(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:kn.UNSET_LOCATION_IDS,source:i,payload:{locationIds:t}}),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:t},methodName:"unsetLocationIds",message:"System unset location ids",source:i},!0,this.getUserIdForAnalytics()),t?.length?t.forEach(o=>{this.getLocation()?.location.id===o&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==o))),this.removeCustomLocationId(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction(G.INIT_UPDATE,{event:L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:kn.REMOVE_LOCATIONS_SUCCESS,source:i,payload:{locationIds:t}}),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetLocationIds: ",o)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(t){try{this.excludedLocationIds$.next([...t])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(t){return this.loggingService.catch("Error in getExcludedLocationIds$: ",t),ue([])}}updateOrganizationMetadata(t){return I(this,null,function*(){try{!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig());let i=t?.organizationId,o=t?.clientOrganizationId,s=this.documentPaths$.value;if(this.db&&i&&s?.documentId){if(this.organizationMetadata$.value?.[i])return;let c=new FT;c.apiKey=this.configService?.getApiKey()??"",c.organizationId=i,c.clientOrganizationId=o;let l=this.authService.getUser()?.userId??"",u=o?yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o}):null;!!(l&&o&&u?.[l]?.organization?.[o]?.errorCode===No.PERMISSION_DENIED)?this.loggingService.log(`%c[WB] updateOrganizationMetadata skipped \u2014 user does not have access to organization: ${o}`,"color: orange;"):this.userPermissionService?.hasEditAccess({organizationId:i})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(c)),properties:{organizationId:i,documentId:s?.documentId??""}})),yield this.fetchOrganizationMetadata(t)}}catch(i){this.loggingService.catch("Error in updateOrganizationMetadata: ",i)}})}updateFolderMetadata(){return I(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let t=this.documentPaths$.value;if(!t?.veltFolderId||!t?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:t?.organizationId??"",folderId:t?.veltFolderId??""}}))?.metadata){let o={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:t?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let s=Ar(this.functions,Tr({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Sd({methodName:"createFolder",data:{type:"createFolder",metadata:o},getSdkProxy:s,userId:this.authService.getUser()?.userId??""})}}}}catch(t){this.loggingService.catch("Error in updateFolderMetadata: ",t)}})}updateDocumentMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let i=this.getDocumentIds();i.find(s=>s.documentId===t.documentId)||i.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});let o=i.map(s=>I(this,null,function*(){let a=new MT;this.clientDocumentMetadataMap?.[s.clientDocumentId]&&(a=P(P({},this.clientDocumentMetadataMap[s.clientDocumentId]),a)),a.apiKey=this.configService?.getApiKey()??"",a.documentId=s.documentId,a.clientDocumentId=s.clientDocumentId,a.organizationId=t.organizationId,a.clientOrganizationId=t.clientOrganizationId,a.pageInfo=Rg(s.clientDocumentId);let c=t?.folderId,l=t?.veltFolderId;a?.pageInfo?.deviceInfo&&delete a?.pageInfo?.deviceInfo;let u=!0,d=this.documentMetadata$.value?.[s.documentId];if(c&&l){let f=this.getDocumentMetadata(s?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}}));f?.clientDocumentId&&!f?.errorCode?f?.folderId&&(f?.folderId!==c||f?.veltFolderId!==l)?(this.loggingService.catch(`Folder id mismatch for document ${s?.clientDocumentId??""}`),u=!1):f?.folderId===c?(c&&(a.folderId=c),l&&(a.veltFolderId=l)):(this.loggingService.catch(`Document ${s?.clientDocumentId??""} is not in the folder ${c??""}`),u=!1):(c&&(a.folderId=c),l&&(a.veltFolderId=l))}if(d){let f={};Object.entries(a).forEach(([g,p])=>{f[g]=p}),Fi(f,d)&&(u=!1)}u&&this.userPermissionService?.hasEditAccess({documentId:s?.documentId??"",folderId:t?.allDocuments&&t?.veltFolderId?t?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:t?.organizationId??"",documentId:s?.documentId??""}}))}));yield Promise.allSettled(o),yield this.fetchDocumentMetadata(i)}}}catch(t){this.loggingService.catch("Error in updateDocumentMetadata: ",t)}})}updateDocumentLocationMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let o=this.getDocumentIds();o.find(s=>s.documentId===i.documentId)||o.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let s of o){let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}});a?.errorCode&&(a={});let c=[];for(let l of t){let u=new xT;u.locationId=l?.locationId,u.veltLocationId=RC(l?.location?.id??""),u.location=l?.location,u.pageInfo=Rg(s?.clientDocumentId),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let d=le(P({},a),{[v.FIREBASE_PARTIAL_PATH_LOCATIONS]:le(P({},a[v.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[l?.locationId]:u})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??""}}));let f=this.locationMetadata$.value;if(f||(f={}),l?.location?.id){let g=f?.[s.documentId],p=g?.[l?.location?.id??""];f&&(g||(f[s.documentId]={}),p||(f[s.documentId][l?.location?.id??""]={}),f[s.documentId][l?.location?.id??""]=le(P({},p),{location:l?.location})),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}}yield Promise.allSettled(c)}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(t){try{return t&&typeof t=="object"?_r(JSON.stringify(yd(t))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(t,i="internal"){try{let o=this.genarateLocationId(t),s=this.locations$.value;s[o]&&(delete s[o],this.locations$.next(P({},s)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==t.id)))}catch(o){this.loggingService.catch("Error in DocService removeLocation:",o)}}removeCustomLocationId(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let o=this.locations$.value;Object.entries(o).forEach(([s,a])=>{a.location.id===t&&(delete o[s],this.locations$.next(P({},o)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.id!==t)))})}catch(o){this.loggingService.catch("Error in DocService removeCustomLocationId:",o)}}getLocationByClientLocationId(t){try{let i=this.getLocation()?.location;if(i?.id===t)return i;{let o=this.getLocations();Object.keys(o).forEach(s=>{let a=o[s];a.location?.id===t&&(i=a.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let t=this.locations$.value,i=document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}]`),o=[];i.forEach(s=>{let a=s.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(a){let c=JSON.parse(a),l=this.genarateLocationId(c);o.push(l)}}),Object.keys(t).forEach(s=>{let a=t[s];o.includes(a.locationId)||delete t[s]}),this.locations$.next(P({},t))}catch(t){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",t)}}getLocations$(){try{return this.locations$.asObservable()}catch(t){return this.loggingService.catch("Error in DocService getLocations$:",t),ue({})}}getLocations(){try{return this.locations$.value}catch(t){return this.loggingService.catch("Error in DocService getLocations:",t),{}}}getLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(t?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)?i=t:i=t.closest(`[${v.ATTRIBUTES.VELT_LOCATION}]`),i){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o){let s=JSON.parse(o);return{locationId:this.genarateLocationId(s),location:s}}}return null}catch(i){return this.loggingService.catch("Error in DocService getLocationFromElement:",i),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let t={};return document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(o=>{if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let s=this.getLocationFromElement(o);s?.locationId&&(t[s.locationId]={element:o,location:s})}else if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let s=o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(s){let a=this.getLocationByClientLocationId(s);a?.locationId&&(t[a.locationId]={element:o,location:a});let c={id:s},l=this.genarateLocationId(c);t[s]={element:o,location:{locationId:l,location:c}}}}}),t}catch(t){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",t),{}}}getAdditionLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=t?.closest(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o)return JSON.parse(o)}else if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(o)return{id:o}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(t){try{return t?.closest(`[${v.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(v.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(t){try{return t?this.documentMetadata$.value?.[t]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata$(t){return this.getAllDocumentMetadataMap$().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let t=this.documentMetadata$.value||{},i={},o=this.documentPaths$.value?.veltFolderId,s=this.documentPaths$.value?.allDocuments;if(o&&s)Object.values(t).forEach(a=>{a?.documentId&&a?.veltFolderId===o&&(i[a.documentId]=a)});else{let a=this.documentIds$.value;if(a?.length)a.forEach(c=>{let l=t?.[c.documentId];l&&(i[c.documentId]=l)});else if(this.documentPaths$.value?.documentId){let c=t?.[this.documentPaths$.value?.documentId];c&&(i[this.documentPaths$.value?.documentId]=c)}}return Object.values(i)}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",t),[]}}getDocumentMetadata$(t){return this.documentMetadata$.asObservable().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}setDocumentMetadata(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let o=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));o[t]=i,this.documentMetadata$.next(o)}catch(o){this.loggingService.catch("Error in DocService setDocumentMetadata:",o)}}setAllDocumentMetadata(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(t)}catch(i){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",i)}}getOrganizationMetadata(t){return this.organizationMetadata$.value?.[t]||null}getOrganizationMetadata$(t){return this.organizationMetadata$.asObservable().pipe(fe(i=>i?.[t]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(it(Ft))}getOrganizationConfig(){return this.organizationConfig$.value}setOrganizationConfig(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setOrganizationConfig","color: green;");let i=JSON.parse(JSON.stringify(t));this.organizationConfig$.next(i)}catch(i){return this.loggingService.catch("Error in DocService setOrganizationConfig:",i),!1}return!0}getMetadataFromType(t,i){try{switch(t){case"area":return;case"comment":return i?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(i.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return i?.commentAnnotationId?this.commentService?.getAnnotationById(i.commentAnnotationId)?.metadata:void 0;default:return}}catch(o){this.loggingService.catch("Error in DocService getMetadataFromType:",o);return}}getDefaultMetadata({clientDocumentId:t,documentId:i}){try{let o=this.documentPaths$.value;if(!o)return;let s=t||o.clientDocumentId,a=i||o.documentId,c=this.getDocumentMetadata(a);if(!c)return;let l=c?.folderId,u=c?.veltFolderId;return P(P({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:s,clientOrganizationId:o.clientOrganizationId,documentId:a,organizationId:o.organizationId},l?{folderId:l}:{}),u?{veltFolderId:u}:{})}catch(o){this.loggingService.catch("Error in DocService getDefaultMetadata:",o);return}}getBaseMetadata(t,i){try{let o,s;i?.element?o=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(o=i.clientDocumentId),o&&(s=this.generateDocumentId(o));let a=this.getMetadataFromType(t,i),c=this.getDefaultMetadata({clientDocumentId:o,documentId:s}),l=a||c||{};return l.sdkVersion=$r(),l}catch(o){return this.loggingService.catch("Error in DocService getBaseMetadata:",o),{}}}getServerId({documentId:t,organizationId:i}){try{return t&&(t=this.generateDocumentId(t)),i&&(i=this.generateOrganizationId(i)),{documentId:t,organizationId:i}}catch(o){return this.loggingService.catch("Error in DocService getServerId:",o),null}}fetchDocuments(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(t?.folderId){let a=Oo(t?.folderId);o.push(Xi("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Xi("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(t?.folderId){let a=Oo(t?.folderId);o.push(Xi("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Xi("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(t){return I(this,null,function*(){try{if(typeof t=="object"&&(t=JSON.parse(JSON.stringify(t??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,documents:s,folderId:a}=t;if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let c=_s(o);if(!s||s.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let l=[],u=this.documentMetadata$.value??{};for(let d of s)if(d?.documentId){d.organizationId=c,d.clientOrganizationId=o,d.clientDocumentId=d.documentId;let f=ua(d.documentId);d.documentId=f,d.apiKey=this.configService.getApiKey()??void 0,(a||this.documentPaths$.value?.folderId)&&(d.folderId=a||this.documentPaths$.value?.folderId,d.veltFolderId=Oo(a||this.documentPaths$.value?.folderId||""));let g=()=>{if(a&&this.documentPaths$.value?.folderId&&a!==this.documentPaths$.value?.folderId)return;let _=u?.[f];_?u[f]=P(P({},_),d):u[f]=d},p=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:f,organizationId:c,field:"metadata"}});if(p?.errorCode&&(p={}),p&&p.apiKey&&p.folderId&&a&&p.folderId!=d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists with different folderId: ${p.folderId}`);continue}if(p&&p.apiKey&&!p.folderId&&d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists, move this document to folder with REST API`);continue}g(),d&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:d?.documentId??""})&&l.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{organizationId:c,documentId:f}}))}yield Promise.all(l),this.setAllDocumentMetadata(u)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,locations:s,documentIds:a}=t;if((!a||a.length===0)&&(a=this.documentIds$.value.map(d=>d.clientDocumentId)??[],a.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!s||s.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=a.map(d=>ua(d)),l=[],u=this.locationMetadata$.value;u||(u={}),c.forEach(d=>{s.forEach(f=>{let g=this.location$.value;if(f?.id===g?.location?.id&&this.location$.next({locationId:g?.locationId,location:f}),f?.id){delete f?.metadata;let p=RC(f.id),_=u?.[d],T=_?.[f.id];u&&(_||(u[d]={}),T||(u[d][f.id]={}),u[d][f.id]=le(P({},T),{location:f})),f&&this.commonDbService&&l.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:f})),properties:{organizationId:_s(o),documentId:d,id:p}}))}})}),yield Promise.all(l),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let s=[],a=this.generateOrganizationId(t?.organizationId);if(t?.folderId){let c=Oo(t?.folderId);o=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}}),o&&(o=[o]),s=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[Xi("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}})}else o=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}});return{data:o,parentFolders:s}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(mt(t=>t?this.documentPaths$.pipe(mt(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(fe(o=>o?.data?.docIamConfig??o?.data),it((o,s)=>JSON.stringify(o??{})===JSON.stringify(s??{}))):ue(null))):ue(null)))}getDocumentAccessType(t){try{return t&&t.features&&t.features.all?t.features.all.restricted?wt.RESTRICTED:wt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:wt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),wt.PUBLIC}}changeDocumentAccessType(t){return I(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let o=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});if(o?.errorCode)return;switch(delete o.documentAccessType,o.features||(o.features={}),o.features.all||(o.features.all={}),t){case wt.PUBLIC:o.features.all.restricted=!1;break;case wt.RESTRICTED:o.features.all.restricted=!0,o.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(o)),properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}}catch(i){this.loggingService.catch("Error in DocService changeDocumentAccessType:",i)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(t){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",t),""}}setUIState(t){try{this.uiState.next(P(P({},this.uiState.value),t))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Rr),w(Hy),w(pv),w(Dr),w(_e),w(Wo),w(zo),w(Za),w(It),w(ur),w(ci))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zt=(()=>{let e=class e{constructor(t,i,o,s,a){this.analyticsService=t,this.authService=i,this.coreActionsService=o,this.docService=s,this.loggingService=a,this.resolveOrganizationUsers=new Y(!0),this.resolveFolderUsers=new Y(!0),this.resolveDocumentUsers=new Y(!0),this.unresolvedUsers=new Y([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new gt,this.userDataProvider$=new Y(null),this.anonymousUserDataProvider$=new Y(null),this.userIdByEmailCache={},this.userById$=new Y({}),this.customContactUserById$=new Y({}),this.userByIdCalled$=new Y({}),this.pendingResolutions=new Set,this.getUserById=c=>{try{let l=this.userById$.value?.[c],u=this.customContactUserById$.value?.[c];return u?l?P(P({},l),u):u:l}catch(l){this.loggingService.catch("Error in UsersService getUserById:",l);return}};try{this.docService.setUsersService(this),this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Ct(c=>!!c),mt(()=>this.getUnresolvedUsers$().pipe(Ct(c=>c.length>0),Su(300),Nt(20),mt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[LM(Xi("user.userId","in",c.slice(0,20)))]}}).pipe(fe(u=>u?.data),qs(u=>{if(u&&typeof u=="object"){delete u.undefined,delete u.null;let d=Object.values(u??{});this.setUserByIds(d.map(g=>g.user));let f=c.filter(g=>!d.some(p=>p.user.userId===g));f.length!==c.length&&this.setUnresolvedUsers(f)}})):ue([])})))).subscribe()}catch(c){this.loggingService.catch("Error in UsersService constructor:",c)}}setCommonDbService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=t}catch(i){this.loggingService.catch("Error in UsersService setCommonDbService:",i)}}setContactService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactService","color: green;"),this.contactService=t}catch(i){this.loggingService.catch("Error in UsersService setContactService:",i)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(t){this.loggingService.catch("Error in UsersService ngOnDestroy:",t)}}isResolverForFeatureDisabled(t){let i=this.userDataProvider$.getValue();try{switch(t){case"allOrganizationUsers":return i?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return i?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return i?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(o){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",o),!1}}resolveUsers(u){return I(this,arguments,function*({userIds:t,forceResolve:i,feature:o,organizationId:s,skipUserCheck:a=!1,uniqueId:c,moduleName:l}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let d=!1;if(o&&(d=this.isResolverForFeatureDisabled(o)),d)return{};{let f={},g=[],p={};if(t?.forEach(_=>{let T=this.getUserById(_);T?f[_]=T:this.userByIdCalled$.getValue()[_]?i&&g.push(_):(g.push(_),this.userByIdCalled$.next(le(P({},this.userByIdCalled$.getValue()),{[_]:!0})))}),g.length>0){let _=c||J();this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:xn.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={};try{let S,b=new Promise((B,x)=>{S=setTimeout(()=>{x(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});T=yield Promise.race([this.getUsersFromDB({userIds:g,organizationId:s,skipUserCheck:a}).finally(()=>{clearTimeout(S)}),b]),this.analyticsService.trackEvent(L.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:g}),this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(S){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",S,{userIds:g}),this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:S,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{g?.forEach(S=>{if(!T[S]){let b=new Set([...this.getUnresolvedUsers(),S]);this.unresolvedUsers.next(Array.from(b)),T[S]={userId:S,name:`User ${S}`}}})}Object.entries(T).forEach(([S,b])=>{b&&(f[S]=T?.[S],p[S]=T?.[S])})}return Object.keys(p).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(p)),this.mergeUsersIntoStore(Object.values(p)),Object.keys(p).forEach(_=>{let T=this.getUserById(_);T&&(f[_]=T)})),f}}catch(d){this.loggingService.catch("Error in UsersService resolveUsers:",d);let f=c||J();return this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:d,userIds:t,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(t){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",t),[]}}setUnresolvedUsers(t){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(t)){let i=JSON.parse(JSON.stringify(t));this.unresolvedUsers.next(i)}}catch(i){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",i)}}getUsersFromDB(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let a=this.userDataProvider$.getValue();if(a){if(a.config?.getConfig?.url){if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return this.loggingService.catch("Error in getUsersFromDB: organizationId is required when using getConfig"),{};let d={organizationId:i,userIds:t},f=yield Ht(a.config.getConfig.url,a.config.getConfig.headers,d,!0);return f.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${f.statusCode}. Message: ${f.message||"Unknown error"}`),{}):f.data??{}}let u=yield a.get(t);if(u&&typeof u=="object"&&"success"in u&&"statusCode"in u&&typeof u.success=="boolean"&&typeof u.statusCode=="number"){let d=u;return d.statusCode===200&&d.data?d.data:(this.loggingService.catch(`Error in getUsersFromDB: provider returned error response with statusCode ${d.statusCode}`),{})}return u}if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:t,organizationId:i,skipUserCheck:o}))??[];this.contactService?.setResolvedUsers(c.flat());let l={};return c.forEach(u=>{u.forEach(d=>{d?.user?.userId&&(l[d.user.userId]=d.user)})}),l}catch(a){return this.loggingService.catch("Error in UsersService getUsersFromDB:",a),{}}})}getUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){try{if(!t?.length)return[];let a=[];for(let u=0;u<t.length;u+=30)a.push(t.slice(u,u+30));let c=a.map((u,d)=>I(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[Xi("user.userId","in",u)],skipUserCheck:o}}))||[]}catch(f){return this.loggingService.catch(`Error in batch ${d+1}:`,f),[]}}));return yield Promise.all(c)}catch(a){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",a),[]}})}getTemporaryUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,resourceIds:o}){try{if(!t?.length||!o?.length)return[];let a=[];for(let _=0;_<t.length;_+=30)a.push(t.slice(_,_+30));let c=[];for(let _=0;_<o.length;_+=30)c.push(o.slice(_,_+30));let l=[],u=0,d=(_,T)=>I(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[LM(Xi("userId","in",_),Xi("veltResourceId","in",T))]}}))??[])||[]}catch(S){return this.loggingService.catch(`Error in batch ${u+1}:`,S),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,S)=>T===S.findIndex(b=>b.userId===_.userId&&b.resourceId===_.resourceId))}catch(a){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",a),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),Jr([this.userById$,this.customContactUserById$]).pipe(fe(([t,i])=>this.applyContactOverlay(t,i)),it(Ft))}catch(t){return this.loggingService.catch("Error in UsersService getUserById$:",t),ue({})}}applyContactOverlay(t,i){let o=P({},t??{});return Object.entries(i??{}).forEach(([s,a])=>{o[s]=P(P({},o[s]??{}),a)}),o}setUserByIds(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;"),this.mergeUsersIntoStore(t)}catch(i){this.loggingService.catch("Error in UsersService setUserByIds:",i)}}setContactListUsers(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactListUsers","color: green;");let i={};(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=JSON.parse(JSON.stringify(o)))}),this.customContactUserById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService setContactListUsers:",i)}}getContactListUser(t){try{return this.customContactUserById$.value?.[t]}catch(i){this.loggingService.catch("Error in UsersService getContactListUser:",i);return}}mergeUsersIntoStore(t){try{let i=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=P(P({},i?.[s]??{}),o))}),this.userById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService mergeUsersIntoStore:",i)}}setUserDataProvider(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;");let i=t.config?.getConfig?.url,o="get"in t&&typeof t.get=="function";if(!i&&!o){this.loggingService.catch("DataProviders.user is invalid. The get method is missing or is not a function (and no getConfig provided).");return}this.userDataProvider$.next(t),t.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),t.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),t.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}setAnonymousUserDataProvider(t){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setAnonymousUserDataProvider","color: green;"),!("resolveUserIdsByEmail"in t)||typeof t.resolveUserIdsByEmail!="function"){this.loggingService.catch("setAnonymousUserDataProvider is invalid. The resolveUserIdsByEmail method is missing or is not a function.");return}this.anonymousUserDataProvider$.next(t)}catch(i){this.loggingService.catch("Error in UsersService setAnonymousUserDataProvider:",i)}}resolveUserIdsByEmail(o){return I(this,arguments,function*({emails:t,uniqueId:i}){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUserIdsByEmail","color: green;"),!t?.length)return{};let s=this.anonymousUserDataProvider$.getValue();if(!s||typeof s.resolveUserIdsByEmail!="function")return{};let a=[...new Set(t.filter(x=>!!x))];if(a.length===0)return{};let c={},l=[];if(a.forEach(x=>{let U=this.userIdByEmailCache[x];U?c[x]=U:l.push(x)}),l.length===0)return c;let u=this.docService.getOrganizationConfig()?.clientOrganizationId||"",d=this.docService.getDocumentPaths()?.clientDocumentId||"",f=this.docService.getDocumentPaths()?.folderId||"",g={organizationId:u,documentId:d,folderId:f,emails:l},p=i||J();this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,S=new Promise((x,U)=>{T=setTimeout(()=>{U(new Error("resolveUserIdsByEmail timeout"))},_)}),b=s.config?.getRetryConfig||{retryCount:0,retryDelay:0},B=I(this,null,function*(){try{let x=yield kt(()=>s.resolveUserIdsByEmail(g),"resolveUserIdsByEmail",b);return x?.statusCode===200&&x?.data?x.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${x?.statusCode}. Message: ${x?.message||"Unknown error"}`),{})}finally{clearTimeout(T)}});try{let x=yield Promise.race([B,S]);return Object.entries(x).forEach(([U,$])=>{$&&(this.userIdByEmailCache[U]=$,c[U]=$,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:$,name:U,email:U},currentUserId:this.authService.getUser()?.userId??""}).catch(A=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",A)}))}),this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:x,emails:l}}),c}catch(x){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",x),this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:x,emails:l}}),c}}catch(s){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail:",s),{}}})}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",t),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(t){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Rr),w(It),w(Wh),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var ec=class{static getFirestoreProdDbName(e,r){return r?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||r?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":r?.storeDbId??(this.isTestingDb(r?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(r){return H.error("Error in isTestingDb:",r),!1}}};var qy=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.commentAnnotationsResolverService=c,this.attachmentResolverService=l,this.coreActionsService=u,this.notificationActionTypeMap={[Be.NEWLY_ADDED]:Qt.COMMENT_ANNOTATION_ADD,[Be.ADDED]:Qt.COMMENT_ADD,[Be.UPDATED]:Qt.COMMENT_UPDATE,[Be.DELETED]:Qt.COMMENT_DELETE}}setNotificationService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}setUserPermissionService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",i)}}getUserIdsToResolveFromComments(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let o of t){if(o?.from?.userId&&i.add(o?.from?.userId),o?.comments)for(let s of o?.comments){if(s?.from?.userId&&i.add(s?.from?.userId),s?.to)for(let a of s?.to)a?.userId&&i.add(a?.userId);if(s?.taggedUserContacts)for(let a of s?.taggedUserContacts)a?.userId&&i.add(a?.userId)}if(o?.assignedTo?.userId&&i.add(o?.assignedTo?.userId),o?.resolvedByUserId&&i.add(o?.resolvedByUserId),o?.suggestion?.resolvedBy?.userId&&i.add(o?.suggestion?.resolvedBy?.userId),o?.subscribedUsers)for(let s of Object.values(o?.subscribedUsers))s.user.userId&&i.add(s.user.userId);if(o?.unsubscribedUsers)for(let s of Object.values(o?.unsubscribedUsers))s.user.userId&&i.add(s.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.suggestion?.resolvedBy?.userId){let i=this.usersService.getUserById(t?.suggestion?.resolvedBy?.userId);i&&(t.suggestion.resolvedBy=i)}if(t?.comments)for(let i of t?.comments){if(i?.from?.userId){let s=this.usersService.getUserById(i?.from?.userId);s&&(i.from=s)}i?.to&&(i.to=i?.to?.map(s=>{if(s?.userId){let a=this.usersService.getUserById(s?.userId);if(a)return P(P({},s),a)}return s})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(s=>{if(s?.contact){let a=this.usersService.getUserById(s?.contact?.userId);a&&(s.contact=a,(a?.name||a?.email)&&(s.text=`@${a?.name||a?.email}`))}return s}));let o=i?.taggedUserContacts?.filter((s,a,c)=>c.findIndex(l=>l.text===s.text)===a)||[];o.sort((s,a)=>(a.text?.length||0)-(s.text?.length||0)),o.forEach(s=>{if(s?.text){let a=new RegExp(nl(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(nl(`@User ${s.userId}`),"g")),i.commentText=i.commentText?.replaceAll(a,s.text),i.commentHtml=i.commentHtml?.replaceAll(a,s.text)}})}if(t?.assignedTo?.userId){let i=this.usersService.getUserById(t?.assignedTo?.userId);i&&(t.assignedTo=i)}if(t?.resolvedByUserId){let i=this.usersService.getUserById(t?.resolvedByUserId);i&&(t.resolvedByUser=i)}if(t?.subscribedUsers)for(let i of Object.values(t?.subscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.subscribedUsers?.id?.user&&(t.subscribedUsers.id.user=o)}if(t?.unsubscribedUsers)for(let i of Object.values(t?.unsubscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.unsubscribedUsers?.id?.user&&(t.unsubscribedUsers.id.user=o)}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),t}}formatCommentData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),t?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),t?.viewedBy&&delete t.viewedBy,t?.unread!==void 0&&delete t.unread,t?.resolvedByUser!==void 0&&delete t.resolvedByUser,t?.comments&&t.comments.forEach(i=>{i?.reactionAnnotations&&delete i.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.assignedTo?.userId&&(t.assignedTo={userId:t.assignedTo.userId}),t?.subscribedUsers)for(let i of Object.keys(t?.subscribedUsers))t.subscribedUsers[i].user={userId:t?.subscribedUsers[i].user.userId};if(t?.unsubscribedUsers)for(let i of Object.keys(t?.unsubscribedUsers))t.unsubscribedUsers[i].user={userId:t?.unsubscribedUsers[i].user.userId};t?.suggestion?.resolvedBy?.userId&&(t.suggestion.resolvedBy={userId:t.suggestion.resolvedBy.userId})}return t?.comments&&(t.comments=t?.comments?.map(i=>this.formatCommentThreadData(i))),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),t}}mergeStrippedDataWithCommentAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t?.annotationId),o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove();return i&&(t?.comments?.forEach(a=>{let c=i?.comments?.[a?.commentId];if(c){a.commentHtml=c?.commentHtml,a.commentText=c?.commentText;let l=c?.attachments;o&&l&&a.attachments?.forEach(u=>{let d=u?.attachmentId;l?.[d]&&(u.name=l?.[d]?.name,u.url=l?.[d]?.url)})}}),i?.targetTextRange?.text&&t?.targetTextRange&&(t.targetTextRange.text=i?.targetTextRange?.text),s?.length>0&&s.forEach(a=>{i?.[a]&&(t[a]=i[a])})),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),t}}mergeLocationWithCommentAnnotations(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let o=t?.location?.id,s=t?.metadata?.documentId;if(!o||!s)return t;let a=i?.[s]?.[o];return a&&(t.location=a?.location),t}catch(o){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",o),t}}isCommentsDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let o=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return o?!Fi(t,o):!0}catch(o){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",o),!0}}stripCommentsFromAnnotationData({comment:t}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let i=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!i)return t;let o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=new bT;if(Object.assign(s,t),s.isCommentResolverUsed=i,o){let a=s.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));s.attachments=a}return delete s?.commentHtml,delete s?.commentText,s}catch(i){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",i),t}}resolveTaggedUserEmails(t){return I(this,null,function*(){try{let i=new Set;if(t.comments?.forEach(o=>{o.taggedUserContacts?.forEach(s=>{s?.contact?.email&&!s?.userId&&i.add(s.contact.email)}),o.to?.forEach(s=>{s?.email&&!s?.userId&&i.add(s.email)})}),i.size>0){let o=J();this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:Array.from(i)}});let s=yield this.usersService.resolveUserIdsByEmail({emails:Array.from(i),uniqueId:o});Object.keys(s).length>0&&t.comments?.forEach(a=>{a.taggedUserContacts?.forEach(c=>{if(c?.contact?.email&&!c?.userId){let l=s[c.contact.email];if(l){let u=c.text;if(u){let d=nl(u),f=new RegExp(d,"g");a.commentText&&(a.commentText=a.commentText.replace(f,`{{${l}}}`)),a.commentHtml&&(a.commentHtml=a.commentHtml.replace(f,`{{${l}}}`))}c.userId=l,c.contact.userId=l,delete c.contact?.email,delete c.contact?.visibility,c.text=""}}}),a.to=a.to?.map(c=>{if(c?.email&&!c?.userId){let l=s[c.email];if(l)return delete c?.email,delete c?.visibility,le(P({},c),{userId:l})}return c})})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService resolveTaggedUserEmails:",i),t}})}stripCommentAnnotationData(s){return I(this,arguments,function*({data:t,actionType:i,commentId:o}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),t=yield this.resolveTaggedUserEmails(t),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),c=this.commentAnnotationsResolverService.getFieldsToRemove(),l=this.commentAnnotationsResolverService.getAdditionalFields(),u;i&&(u=this.notificationActionTypeMap?.[i]);let d={},f=null,g=!1;if(t&&t.annotationId){let _=t.annotationId;if(d[_]=P(P(P(P({annotationId:_,metadata:Cn(t.metadata??{}),comments:{}},t?.from&&{from:t?.from}),t?.assignedTo&&{assignedTo:t?.assignedTo}),t?.resolvedByUserId&&{resolvedByUserId:t?.resolvedByUserId}),t?.targetTextRange?.text&&{targetTextRange:{text:t?.targetTextRange?.text}}),delete t?.targetTextRange?.text,c?.length>0&&c.forEach(S=>{t?.[S]&&(d[_][S]=t[S],delete t[S])}),l?.length)for(let S of l)t?.[S]!==void 0&&(d[_][S]=JSON.parse(JSON.stringify(t[S])));t.comments?.forEach(S=>{if(S.commentId){let b;a&&(b={},S.attachments?.forEach(B=>{b[B.attachmentId]={attachmentId:B.attachmentId,name:B.name,url:B.url}})),d[_].comments[S.commentId]=P(P(P(P(P(P({commentId:S.commentId},S?.commentHtml&&{commentHtml:S?.commentHtml}),S?.commentText&&{commentText:S?.commentText}),b&&{attachments:b}),S?.from&&{from:S?.from}),S?.to&&{to:S?.to}),S?.taggedUserContacts&&{taggedUserContacts:S?.taggedUserContacts})}}),g=this.isCommentsDataChanged(d[_],_);let T=new wT;Object.assign(T,t),c?.length>0&&c.forEach(S=>{S in t||delete T[S]}),T.comments=t.comments?.map(S=>this.stripCommentsFromAnnotationData({comment:S}))||[],f=T}let p=f?.comments?.find(_=>_.commentId===o);return p?.isDraft&&(u=f?.comments?.length&&f?.comments?.length>0?Qt.COMMENT_ADD:Qt.COMMENT_ANNOTATION_ADD),{strippedData:g&&(i&&this.notificationActionTypeMap?.[i]||p?.isDraft)?d:null,originalData:f,eventType:u}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{strippedData:null,originalData:null}}})}formatCommentThreadData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to&&(t.to=t?.to?.map(o=>o?.userId?{userId:o.userId}:o)),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(o=>o?.contact?.userId?le(P({},o),{contact:{userId:o.contact.userId}}):o));let i=t?.taggedUserContacts?.filter((o,s,a)=>a.findIndex(c=>c.text===o.text)===s)||[];i.sort((o,s)=>(s.text?.length||0)-(o.text?.length||0)),i.forEach(o=>{if(o?.text&&o?.contact?.userId){let s=new RegExp(nl(o.text),"g");t.commentText=t.commentText?.replaceAll(s,a=>`{{${o.userId}}}`),t.commentHtml=t.commentHtml?.replaceAll(s,a=>`{{${o.userId}}}`)}}),i.forEach(o=>{o?.text&&o?.contact?.userId&&(o.text="")})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),t}}getDeniedForYouUsers(i){return I(this,arguments,function*({extraData:t}){try{let o=Object.values(t?.annotationData?.subscribedUsers||{}).map(a=>a.user.userId)??[],s=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&o.length){let a=t?.metadata?.clientDocumentId,c=t?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()?t?.annotationData?.context?.access:null,l=[];o.forEach(f=>{if(l.push({userId:f,resource:{id:a,type:ui.DOCUMENT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:c?{access:c}:void 0}}),c){let g=JSON.stringify(c);l.push({userId:f,resource:{id:g,type:ui.CONTEXT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let u=J();this.coreActionsService.triggerAction(G.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_NOTIFICATIONS,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let d=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:u,methodName:Un.SET_NOTIFICATIONS});d?.success&&d?.data?.length&&d.data.forEach(f=>{f.hasAccess||s.push(f.userId)})}return s}catch(o){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",o),[]}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let l=GT(this.authService.getFirebaseConfig()?.firebaseOptions),u=Ar(this.functions,Tr({url:st.cloudFunction?.[l]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=t;let _=o?.targetAnnotationData?.commentId;if(_){let T=t?.comments?.find(S=>S?.commentId===_);T&&(o.targetAnnotationData=T)}try{let T=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??Be.NEWLY_ADDED});T?.originalData&&(o.annotationData=this.formatCommentData(T.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(T){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",T)}}let d=ec.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),f=yield this.getDeniedForYouUsers({extraData:o}),g={path:i??"",data:t??{},dbId:d??"",notificationData:o||void 0,notificationURL:st.firebaseNotificationsDatabaseURL,feature:"comment",eventType:s??"PATCH",sdkVersion:$r(),deniedForYouUsers:f,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},p=yield rl(g,this.authService.getUser()?.userId??"");yield u({veltData:p})}catch(l){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",l)}})}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Rr),w(ur),w(Dr),w(Wo),w(Hh),w(It))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Ky=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.activityDataProvider$=new Y(null),this.activityById$=new Y({}),this.fieldsToRemove=[],this.getActivityById=s=>{try{return this.activityDataProviderAvailable()?this.activityById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ActivityResolverService getActivityById:",a);return}};try{this.loggingService.log("ActivityResolverService initialized"),this.activityDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove))})}catch(s){this.loggingService.catch("Error in ActivityResolverService constructor:",s)}}getProvider(){try{let t=this.activityDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ActivityResolverService getProvider:",t);return}}ngOnDestroy(){try{this.activityById$.next({})}catch(t){this.loggingService.catch("Error in ActivityResolverService ngOnDestroy:",t)}}resolveActivities(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: resolveActivities","color: green;"),!this.activityDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:new Error("Activity resolution timeout"),request:t}}),f(new Error("Activity resolution timeout"))}},this.activityDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.activityIds||[])],T=le(P({},t),{activityIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{request:T}});let B=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0):g?.get?.(T)||Promise.resolve(void 0),"resolveActivities",this.retryGetConfig).then(x=>c?{}:(u(),x&&x.statusCode!==200?(this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:x,request:T}}),this.loggingService.catch(x?.message??"Error in ActivityResolverService resolveActivities:"),{}):x?.data)).catch(x=>{throw u(),x});try{p=(yield B)||{},this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_GET,{sourceMethod:"resolveActivities",source:"sdk",activityIds:_});let x={};Object.entries(p).forEach(([U,$])=>{let A=this.activityById$.value?.[U];A?A&&JSON.stringify(A)!==JSON.stringify($)&&(x[U]=$):x[U]=$}),Object.keys(x).length>0&&this.activityById$.next(P(P({},this.activityById$.getValue()),x)),this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:x,request:T}}),d(x)}catch(x){let U=i||J();this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:x,request:T}}),c||f(x),d(p)}}else u(),d({})}catch(b){u();let B=i||J();this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ActivityResolverService resolveActivities:",a);let c=i||J();return this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveActivity(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: saveActivity","color: green;");let o=this.getProvider();if(!this.activityDataProviderAvailable())throw new Error("Activity save data provider not available");let s=i||J();this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:cr.SAVE_ACTIVITY,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.activityById$.getValue()));this.activityById$._value=P(P({},a),t.activity);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1)}return o?.save?.({activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveActivity",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.activityById$._value=a),this.loggingService.catch(c?.message??"Error in ActivityResolverService saveActivity:"),this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:cr.SAVE_ACTIVITY,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_SAVE,{sourceMethod:"saveActivity",source:"sdk",activityIds:Object.keys(t.activity),event:t.event}),this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:cr.SAVE_ACTIVITY,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ActivityResolverService saveActivity:",o);let s=i||J();return this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:cr.SAVE_ACTIVITY,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}}})}getActivitiesById$(){try{return this.activityDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: getActivitiesById$","color: green;"),this.activityById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ActivityResolverService getActivitiesById$:",t),ue(void 0)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ActivityResolverService getFieldsToRemove:",t),this.fieldsToRemove}}setActivityDataProvider(t){try{if(t){this.loggingService.log("Setting activity data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.activity is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.activityDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ActivityResolverService setActivityDataProvider:",i)}}activityDataProviderAvailable(){try{return!!this.activityDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ActivityResolverService activityDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Yy=(()=>{let e=class e{constructor(t,i,o,s,a,c){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o?.from?.userId),o?.reactions?.length)for(let s of o?.reactions)s?.from?.userId&&i.add(s?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{let a=GT(this.authService.getFirebaseConfig()?.firebaseOptions),c=Ar(this.functions,Tr({url:st.cloudFunction?.[a]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=ec.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",d={path:i??"",data:t??{},dbId:l??"",feature:"reaction",eventType:o??"PATCH",sdkVersion:$r()},f=yield rl(d,u);yield c({veltData:f})}catch(a){this.loggingService.catch("Error in handleReactionEncryption:",a)}})}mergeReactionWithUser(t){try{if(this.usersService.userDataProviderAvailable()){if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.reactions?.length){for(let i of t?.reactions)if(i?.from?.userId){let o=this.usersService.getUserById(i?.from?.userId);o&&(i.from=o)}}}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),t}}formatReactionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t.reactions=t?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),t}}isReactionDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let o=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return o?!Fi(t,o):!0}catch(o){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",o),!0}}stripReactionAnnotationData(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let i={};if(t&&t.annotationId){let o=t.annotationId;if(i[o]=P({annotationId:o,metadata:Cn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),!this.isReactionDataChanged(i[o],o))return{strippedData:null,originalData:t};delete t?.icon,t.isReactionResolverUsed=!0}return{strippedData:i,originalData:t}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return t;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(t?.annotationId);return i&&i.icon&&(t.icon=i.icon),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Rr),w(ur),w(Dr),w(zo))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Qy=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d){this.loggingService=t,this.usersService=i,this.commentUtilsService=o,this.reactionUtilsService=s,this.commentAnnotationsResolverService=a,this.reactionAnnotationsResolverService=c,this.recorderAnnotationsResolverService=l,this.activityResolverService=u,this.serviceBook=d}getActivityDisplayMessage(t){try{switch(t.featureType){case"comment":return this.getCommentDisplayMessage(t);case"recorder":return this.getRecorderDisplayMessage(t);case"reaction":return this.getReactionDisplayMessage(t);case"crdt":return this.getCrdtDisplayMessage(t);case"custom":return t.displayMessageTemplate&&t.displayMessageTemplateData?this.resolveTemplate(t.displayMessageTemplate,t.displayMessageTemplateData):"";default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getActivityDisplayMessage:",i),""}}resolveTemplate(t,i){try{return t.replace(/\{\{([\w.]+)\}\}/g,(o,s)=>{let a=s.split(".").reduce((c,l)=>{if(c!=null&&typeof c=="object")return c[l]},i);return a!=null?String(a):""})}catch(o){return this.loggingService.catch("Error in ActivityUtilsService resolveTemplate:",o),t}}buildActivityDataFromExtraData(t){try{let{feature:i,extraData:o}=t;if(!o?.actionType)return null;switch(i){case"comment":return this.buildCommentActivityData({commentAnnotation:o.annotationData,targetComment:o.targetAnnotationData,actionType:o.actionType,otherFields:o});case"recorder":return this.buildRecorderActivityData(o);case"reaction":return this.buildReactionActivityData(o);default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildActivityDataFromExtraData:",i),null}}stripActivityPII(t){return I(this,null,function*(){try{let i=JSON.parse(JSON.stringify(t));if(delete i.displayMessage,!this.usersService.userDataProviderAvailable())return{strippedActivity:i};i.actionUser?.userId&&(i.actionUser={userId:i.actionUser.userId}),i.changes&&this.stripUsersFromChanges(i.changes),i.displayMessageTemplateData&&this.stripUsersFromTemplateData(i.displayMessageTemplateData);let o=this.extractCommentChangesForResolver(i),s=this.extractFeatureEntityDataForResolver(i);yield this.stripFeatureSpecificPII(i);let a=this.extractActivityResolverData(i);return o&&(a?a.changes=P(P({},a.changes),o.changes):a=o),s&&(a?(s.entityData!==void 0&&(a.entityData=s.entityData),s.entityTargetData!==void 0&&(a.entityTargetData=s.entityTargetData)):a=s),a&&(i.isActivityResolverUsed=!0),{strippedActivity:i,activityResolverData:a}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripActivityPII:",i),{strippedActivity:t}}})}mergeActivityWithUser(t){try{if(!this.usersService.userDataProviderAvailable())return t;if(t=JSON.parse(JSON.stringify(t)),t.actionUser?.userId){let i=this.usersService.getUserById(t.actionUser.userId);i&&(t.actionUser=i)}return t.changes&&this.rehydrateUsersInChanges(t.changes),t.displayMessageTemplateData&&this.rehydrateUsersInTemplateData(t.displayMessageTemplateData),this.rehydrateFeatureSpecificUserData(t),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithUser:",i),t}}mergeActivityWithFeatureData(t){try{switch(t.featureType){case"comment":return this.mergeActivityWithCommentAnnotationData(t);case"reaction":return this.mergeActivityWithReactionData(t);case"recorder":return this.mergeActivityWithRecorderData(t);default:return t}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithFeatureData:",i),t}}getUserIdsToResolveFromActivities(t){try{let i=new Set;for(let o of t){if(o.actionUser?.userId&&i.add(o.actionUser.userId),o.changes)for(let s of Object.values(o.changes))s&&(this.extractUserIdFromValue(s.from,i),this.extractUserIdFromValue(s.to,i));if(o.displayMessageTemplateData)for(let s of Object.values(o.displayMessageTemplateData))this.extractUserIdFromValue(s,i);this.extractFeatureSpecificUserIds(o,i)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getUserIdsToResolveFromActivities:",i),[]}}getEntityIdsToResolveFromActivities(t,i){try{let o=new Set;for(let s of t)if(!(i&&s.featureType!==i))switch(s.featureType){case"comment":case"reaction":case"recorder":s.targetEntityId&&o.add(s.targetEntityId);break}return Array.from(o)}catch(o){return this.loggingService.catch("Error in ActivityUtilsService getEntityIdsToResolveFromActivities:",o),[]}}stripFeatureSpecificPII(t){return I(this,null,function*(){try{switch(t.featureType){case"comment":yield this.stripCommentPII(t);break;case"reaction":this.stripReactionPII(t);break;case"recorder":this.stripRecorderPII(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripFeatureSpecificPII:",i)}})}extractActivityResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return;let i={id:t.id},o=!1;if(t.featureType==="custom"){let s=this.activityResolverService.getFieldsToRemove();for(let a of s)a in t&&t[a]!==void 0&&(i[a]=t[a],delete t[a],o=!0)}return t.metadata&&(i.metadata=Cn(t.metadata)),o?i:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractActivityResolverData:",i);return}}extractCommentChangesForResolver(t){try{return!this.activityResolverService.activityDataProviderAvailable()||t.featureType!=="comment"||!t.changes?.commentText?void 0:{id:t.id,changes:{commentText:t.changes.commentText},metadata:t.metadata?Cn(t.metadata):void 0}}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractCommentChangesForResolver:",i);return}}extractFeatureEntityDataForResolver(t){try{if(!this.activityResolverService.activityDataProviderAvailable()||!t.entityData)return;let i=t.featureType==="recorder"&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable(),o=t.featureType==="reaction"&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable();if(!i&&!o)return;let s={id:t.id,metadata:t.metadata?Cn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ai)?.stripRecorderAnnotationData({data:a});if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}if(o){let c=this.reactionUtilsService.stripReactionAnnotationData(a);if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}return s.entityData?s:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractFeatureEntityDataForResolver:",i);return}}mergeActivityWithResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return t;let i=this.activityResolverService.getActivityById(t.id);if(!i)return t;i.changes&&(t.changes||(t.changes={}),Object.assign(t.changes,i.changes)),i.entityData!==void 0&&(t.entityData=i.entityData),i.entityTargetData!==void 0&&(t.entityTargetData=i.entityTargetData),i.displayMessageTemplateData&&(t.displayMessageTemplateData||(t.displayMessageTemplateData={}),Object.assign(t.displayMessageTemplateData,i.displayMessageTemplateData));let o=new Set(["id","metadata","changes","entityData","entityTargetData","displayMessageTemplateData"]);for(let[s,a]of Object.entries(i))!o.has(s)&&a!==void 0&&(t[s]=a);return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithResolverData:",i),t}}rehydrateFeatureSpecificUserData(t){try{switch(t.featureType){case"comment":this.rehydrateCommentUserData(t);break;case"reaction":this.rehydrateReactionUserData(t);break;case"recorder":this.rehydrateRecorderUserData(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateFeatureSpecificUserData:",i)}}getCommentDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case Pe.ANNOTATION_ADD:return`${i} added a comment`;case Pe.COMMENT_ADD:return`${i} replied to a comment`;case Pe.COMMENT_UPDATE:return`${i} edited a comment`;case Pe.COMMENT_DELETE:return`${i} deleted a comment`;case Pe.ANNOTATION_DELETE:return`${i} deleted a comment thread`;case Pe.STATUS_CHANGE:{let o=t.changes?.status,s=o?.from?.name,a=o?.to?.name;return s&&a?`${i} changed status from ${s} to ${a}`:`${i} changed the status`}case Pe.PRIORITY_CHANGE:{let o=t.changes?.priority,s=o?.to;if(!s)return`${i} removed the priority`;let a=typeof s=="object"?s?.name:String(s),c=o?.from,l=c&&typeof c=="object"?c?.name:c?String(c):null;return l&&a?`${i} changed priority from ${l} to ${a}`:`${i} changed priority to ${a}`}case Pe.ASSIGN:{let s=t.changes?.assignedTo?.to;return s&&typeof s=="object"&&s.name?`${i} assigned to ${s.name}`:`${i} assigned the comment`}case Pe.ACCESS_MODE_CHANGE:{let s=t.changes?.accessMode?.to;return s?`${i} changed access to ${s}`:`${i} changed the access mode`}case Pe.CUSTOM_LIST_CHANGE:return`${i} changed the custom list`;case Pe.APPROVE:return`${i} approved the comment`;case Pe.ACCEPT:case Pe.SUGGESTION_ACCEPT:return`${i} accepted a suggestion`;case Pe.REJECT:case Pe.SUGGESTION_REJECT:return`${i} rejected a suggestion`;case Pe.REACTION_ADD:return`${i} reacted to a comment`;case Pe.REACTION_DELETE:return`${i} removed a reaction`;case Pe.SUBSCRIBE:return`${i} subscribed to the thread`;case Pe.UNSUBSCRIBE:return`${i} unsubscribed from the thread`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCommentDisplayMessage:",i),""}}getRecorderDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case Ig.RECORDING_ADD:return`${i} added a recording`;case Ig.RECORDING_DELETE:return`${i} deleted a recording`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getRecorderDisplayMessage:",i),""}}getReactionDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case vg.REACTION_ADD:return`${i} added a reaction`;case vg.REACTION_DELETE:return`${i} removed a reaction`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getReactionDisplayMessage:",i),""}}getCrdtDisplayMessage(t){try{let i=t.actionUser?.name??"Someone",s=t.entityData?.editCount??0,a=t.targetEntityId??"unknown";return`${i} made ${s} edit${s!==1?"s":""} to editor ${a}`}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCrdtDisplayMessage:",i),""}}stripCommentPII(t){return I(this,null,function*(){try{let i=yield this.commentUtilsService.stripCommentAnnotationData({data:t.entityData,actionType:t.eventType??Be.NEWLY_ADDED});i?.originalData&&(t.entityData=this.commentUtilsService.formatCommentData(i.originalData)),t.entityTargetData&&(t.entityTargetData=this.commentUtilsService.formatCommentThreadData(this.commentUtilsService.stripCommentsFromAnnotationData({comment:t.entityTargetData}))),this.activityResolverService.activityDataProviderAvailable()&&t.changes?.commentText&&delete t.changes.commentText}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripCommentPII:",i)}})}rehydrateCommentUserData(t){try{t.entityData&&this.commentUtilsService.mergeCommentWithUser(t.entityData),t.entityTargetData&&(this.rehydrateUserInObject(t.entityTargetData,"from"),this.rehydrateUsersInArray(t.entityTargetData,"to"),this.rehydrateUsersInArray(t.entityTargetData,"taggedUserContacts"))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateCommentUserData:",i)}}stripReactionPII(t){try{if(!t.entityData)return;this.activityResolverService.activityDataProviderAvailable()&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionUtilsService.stripReactionAnnotationData(t.entityData),t.entityData=this.reactionUtilsService.formatReactionData(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripReactionPII:",i)}}rehydrateReactionUserData(t){try{if(!t.entityData)return;this.reactionUtilsService.mergeReactionWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateReactionUserData:",i)}}stripRecorderPII(t){try{if(!t.entityData)return;if(this.activityResolverService.activityDataProviderAvailable()&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){this.serviceBook.get(ai)?.stripRecorderAnnotationData({data:t.entityData});return}let i=t.entityData;if(this.usersService.userDataProviderAvailable()){i.from&&typeof i.from=="object"&&"userId"in i.from&&(i.from={userId:i.from.userId});let o=i.transcription;o?.from&&typeof o.from=="object"&&"userId"in o.from&&(o.from={userId:o.from.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripRecorderPII:",i)}}rehydrateRecorderUserData(t){try{if(!t.entityData)return;this.serviceBook.get(ai)?.mergeRecorderWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateRecorderUserData:",i)}}mergeActivityWithCommentAnnotationData(t){try{if(!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t.targetEntityId);if(!i)return t;let o=t.entityData?.comments;if(Array.isArray(o))for(let s of o){let a=s?.commentId;if(a==null)continue;let c=i.comments?.[String(a)];c&&(c.commentText&&(s.commentText=c.commentText),c.commentHtml&&(s.commentHtml=c.commentHtml))}if(t.targetSubEntityId&&t.entityTargetData){let s=i.comments?.[t.targetSubEntityId];if(s){let a=t.entityTargetData;s.commentText&&(a.commentText=s.commentText),s.commentHtml&&(a.commentHtml=s.commentHtml)}}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithCommentAnnotationData:",i),t}}mergeActivityWithReactionData(t){try{return!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithReactionData:",i),t}}mergeActivityWithRecorderData(t){try{return!this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.serviceBook.get(ai)?.mergeStrippedDataWithRecorderAnnotation(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithRecorderData:",i),t}}buildCommentActivityData(t){try{let{commentAnnotation:i,targetComment:o,actionType:s,otherFields:a}=t,c=i,l=o,u=s===Be.DELETED&&a?.isAnnotationDelete?Pe.ANNOTATION_DELETE:this.mapCommentStatusToActionType(s);if(!u)return null;let d=c?.annotationId;if(!d)return null;let f=l?.commentId,g=this.buildCommentChanges(s,l,a);return{featureType:"comment",actionType:u,targetEntityId:d,eventType:s,targetSubEntityId:f??null,changes:Object.keys(g).length>0?g:void 0,entityData:i,entityTargetData:o??void 0}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildCommentActivityData:",i),null}}mapCommentStatusToActionType(t){try{switch(t){case Be.NEWLY_ADDED:return Pe.ANNOTATION_ADD;case Be.ADDED:return Pe.COMMENT_ADD;case Be.UPDATED:return Pe.COMMENT_UPDATE;case Be.DELETED:return Pe.COMMENT_DELETE;case Be.STATUS_CHANGED:return Pe.STATUS_CHANGE;case Be.PRIORITY_CHANGED:return Pe.PRIORITY_CHANGE;case Be.ASSIGNED:return Pe.ASSIGN;case Be.ACCESS_MODE_CHANGED:return Pe.ACCESS_MODE_CHANGE;case Be.CUSTOM_LIST_CHANGED:return Pe.CUSTOM_LIST_CHANGE;case Be.APPROVED:return Pe.APPROVE;case Be.ACCEPTED:return Pe.ACCEPT;case Be.REJECTED:return Pe.REJECT;case Be.SUGGESTION_ACCEPTED:return Pe.SUGGESTION_ACCEPT;case Be.SUGGESTION_REJECTED:return Pe.SUGGESTION_REJECT;case Be.REACTION_ADDED:return Pe.REACTION_ADD;case Be.REACTION_DELETED:return Pe.REACTION_DELETE;case Be.SUBSCRIBED:return Pe.SUBSCRIBE;case Be.UNSUBSCRIBED:return Pe.UNSUBSCRIBE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapCommentStatusToActionType:",i),null}}buildRecorderActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapRecorderStatusToActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"recorder",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildRecorderActivityData:",i),null}}mapRecorderStatusToActionType(t){try{switch(t){case ET.ADDED:return Ig.RECORDING_ADD;case ET.DELETED:return Ig.RECORDING_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapRecorderStatusToActionType:",i),null}}buildReactionActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapReactionActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"reaction",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildReactionActivityData:",i),null}}mapReactionActionType(t){try{switch(t){case"add":return vg.REACTION_ADD;case"delete":return vg.REACTION_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapReactionActionType:",i),null}}buildCommentChanges(t,i,o){try{let s={};switch(t){case Be.NEWLY_ADDED:case Be.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case Be.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case Be.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case Be.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case Be.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case Be.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case Be.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case Be.CUSTOM_LIST_CHANGED:s.customList={from:o?.oldCustomList??null,to:o?.newCustomList??null};break}return s}catch(s){return this.loggingService.catch("Error in ActivityUtilsService buildCommentChanges:",s),{}}}extractFeatureSpecificUserIds(t,i){try{switch(t.featureType){case"comment":this.extractCommentActivityUserIds(t,i);break;case"reaction":this.extractReactionActivityUserIds(t,i);break;case"recorder":this.extractRecorderActivityUserIds(t,i);break}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractFeatureSpecificUserIds:",o)}}extractCommentActivityUserIds(t,i){try{if(t.entityData){let o=this.commentUtilsService.getUserIdsToResolveFromComments([t.entityData]);for(let s of o)i.add(s)}if(t.entityTargetData){let o=t.entityTargetData;if(this.extractUserIdFromValue(o.from,i),Array.isArray(o.to))for(let s of o.to)this.extractUserIdFromValue(s,i);if(Array.isArray(o.taggedUserContacts))for(let s of o.taggedUserContacts)this.extractUserIdFromValue(s,i)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractCommentActivityUserIds:",o)}}extractReactionActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.reactionUtilsService.getUserIdsToResolveFromReactions([t.entityData]);for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractReactionActivityUserIds:",o)}}extractRecorderActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.serviceBook.get(ai)?.getUserIdsToResolveFromRecorders([t.entityData])??[];for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractRecorderActivityUserIds:",o)}}stripUsersFromChanges(t){try{for(let i of Object.keys(t)){let o=t[i];o&&(o.from=this.stripUserIfPresent(o.from),o.to=this.stripUserIfPresent(o.to))}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromChanges:",i)}}stripUserIfPresent(t){try{return t&&typeof t=="object"&&"userId"in t?{userId:t.userId}:t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripUserIfPresent:",i),t}}stripUsersFromTemplateData(t){try{for(let i of Object.keys(t)){let o=t[i];o&&typeof o=="object"&&"userId"in o&&(t[i]={userId:o.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromTemplateData:",i)}}rehydrateUsersInChanges(t){try{for(let i of Object.values(t))i&&(i.from=this.rehydrateIfUser(i.from),i.to=this.rehydrateIfUser(i.to))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInChanges:",i)}}rehydrateIfUser(t){try{if(t&&typeof t=="object"&&"userId"in t){let i=t.userId;return this.usersService.getUserById(i)??t}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService rehydrateIfUser:",i),t}}rehydrateUsersInTemplateData(t){try{for(let i of Object.keys(t))t[i]=this.rehydrateIfUser(t[i])}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInTemplateData:",i)}}rehydrateUserInObject(t,i){try{let o=t[i];if(o&&typeof o=="object"&&"userId"in o){let s=o.userId,a=this.usersService.getUserById(s);a&&(t[i]=a)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUserInObject:",o)}}rehydrateUsersInArray(t,i){try{let o=t[i];Array.isArray(o)&&(t[i]=o.map(s=>this.rehydrateIfUser(s)))}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInArray:",o)}}extractUserIdFromValue(t,i){try{if(t&&typeof t=="object"&&"userId"in t){let o=t.userId;typeof o=="string"&&i.add(o)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractUserIdFromValue:",o)}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(qy),w(Yy),w(Wo),w(zo),w(Za),w(Ky),w(ci))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Xy=class{constructor({apiKey:e,documentId:r,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=ua(s)),a&&(this.organizationId=_s(a)),i&&(this.folderId=i,this.veltFolderId=Oo(i)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`${this.apiKey}`;this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${e}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var W3=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.usersService=o}getUserIdsToResolveFromLiveStateCustom(t){try{let i=new Set;return t?.updatedBy&&i.add(t?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(t){try{if(t?.updatedBy?.userId){let i=this.usersService.getUserById(t?.updatedBy?.userId);i&&(t.updatedBy=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),t}}formatLiveStateCustomData(t){try{return this.usersService.userDataProviderAvailable()&&t?.updatedBy&&(t.updatedBy={userId:t.updatedBy.userId}),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),t}}getUserIdsToResolveFromLiveStateCustoms(t){try{let i=new Set;for(let o of t)o?.updatedBy?.userId&&i.add(o?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(t){try{let i=new Set;return t?.default?.singleEditorMode?.editor?.userId&&i.add(t?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(t){try{let i=new Set;return t?.editor?.userId&&i.add(t?.editor?.userId),t?.requestEditorAccess?.user?.userId&&i.add(t?.requestEditorAccess?.user?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",i),[]}}mergeLiveStateWithUser(t){try{if(t?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.editor?.userId);i&&(t.default.singleEditorMode.editor=i)}if(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(t.default.singleEditorMode.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),t}}mergeSingleEditorLiveStateDataWithUser(t){try{if(t?.editor?.userId){let i=this.usersService.getUserById(t?.editor?.userId);i&&(t.editor=i)}if(t?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.requestEditorAccess?.user?.userId);i&&(t.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",i),t}}resolveAndMergeSingleEditorLiveStateDataWithUser(t){return I(this,null,function*(){try{let i=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:t}});if(i.length){let o=J(),s=el.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,moduleName:s,source:"internal",payload:{userIds:i}}),yield this.usersService.resolveUsers({userIds:i,uniqueId:o,moduleName:s}),this.mergeSingleEditorLiveStateDataWithUser(t)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",i),t}})}formatLiveStateSingleEditorModeData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.editor?.userId&&(t.editor={userId:t.editor.userId}),t?.requestEditorAccess?.user?.userId&&(t.requestEditorAccess.user={userId:t.requestEditorAccess.user.userId})),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),t}}mergeLiveStateCustomsWithUsers(t){try{for(let i of t)if(i?.updatedBy?.userId){let o=this.usersService.getUserById(i?.updatedBy?.userId);o&&(i.updatedBy=o)}return t}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Jy=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.notificationDataProvider$=new Y(null),this.notificationById$=new Y({}),this.inFlightRequests=new Map,this.getNotificationById=s=>{try{return this.notificationDataProviderAvailable()?this.notificationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in NotificationResolverService getNotificationById:",a);return}};try{this.loggingService.log("NotificationResolverService initialized"),this.notificationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in NotificationResolverService constructor:",s)}}getProvider(){try{let t=this.notificationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in NotificationResolverService getProvider:",t);return}}ngOnDestroy(){try{this.notificationById$.next({})}catch(t){this.loggingService.catch("Error in NotificationResolverService ngOnDestroy:",t)}}resolveNotifications(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: resolveNotifications","color: green;"),!this.notificationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let $=i||J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:$,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:new Error("Notification resolution timeout"),request:t}}),f(new Error("Notification resolution timeout"))}},this.notificationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=this.notificationById$.getValue()||{},T=[...new Set(t.notificationIds||[])],S=[],b=[],B=[];for(let $ of T)_[$]||(this.inFlightRequests.has($)?(S.push(this.inFlightRequests.get($)),b.push($)):B.push($));let x=le(P({},t),{notificationIds:B});I(this,null,function*(){try{if(S.length>0&&(yield Promise.allSettled(S)),B.length>0){let $=i||J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:$,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:x}});let A,D=new Promise(O=>{A=O});for(let O of B)this.inFlightRequests.set(O,D.then(M=>M?.[O]));let C=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,x,!0):g?.get?.(x)||Promise.resolve(void 0),"getNotifications",this.retryGetConfig).then(O=>c?{}:(u(),O&&O.statusCode!==200?(this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:$,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:x}}),this.loggingService.catch(O?.message??"Error in NotificationResolverService resolveNotifications:"),{}):O?.data)).catch(O=>{throw u(),O});try{p=(yield C)||{},A(p);for(let M of B)this.inFlightRequests.delete(M);this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_GET,{sourceMethod:"resolveNotifications",source:"sdk",notificationIds:B});let O={};Object.entries(p).forEach(([M,F])=>{let N=this.notificationById$.value?.[M];N?N&&JSON.stringify(N)!==JSON.stringify(F)&&(O[M]=F):O[M]=F}),Object.keys(O).length>0&&this.notificationById$.next(P(P({},this.notificationById$.getValue()),O)),this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:$,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:x}}),d(O)}catch(O){A({});for(let F of B)this.inFlightRequests.delete(F);let M=i||J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:M,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:O,request:x}}),c||f(O),d(p)}}else u(),d({})}catch($){u();let A=i||J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:A,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:$,request:x}}),f($)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||J();return this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}deleteNotification(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: deleteNotification","color: green;");let s=this.getProvider();if(!this.notificationDataProviderAvailable())throw new Error("Notification delete data provider not available");let a=o||J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{notificationId:t,organizationId:i}});let c=this.notificationById$.getValue(),l=P({},c);delete l?.[t],this.notificationById$._value=l;let u={notificationId:t,organizationId:i},d=yield kt(()=>s?.config?.deleteConfig?.url?Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1):s?.delete?.(u)||Promise.resolve(void 0),"deleteNotification",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.notificationById$._value=c),this.loggingService.catch(d?.message??"Error in NotificationResolverService deleteNotification:"),this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:d,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_DELETE,{sourceMethod:"deleteNotification",source:"sdk",notificationId:t}),this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in NotificationResolverService deleteNotification:",s);let a=o||J();return this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:s,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getNotificationsById$(){try{return this.notificationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: getNotificationsById$","color: green;"),this.notificationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in NotificationResolverService getNotificationsById$:",t),ue(void 0)}}setNotificationDataProvider(t){try{if(t){this.loggingService.log("Setting notification data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.notification is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.notificationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in NotificationResolverService setNotificationDataProvider:",i)}}notificationDataProviderAvailable(){try{return!!this.notificationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in NotificationResolverService notificationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Cp=class{constructor({apiKey:e,documentId:r,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=ua(i)),o&&(this.organizationId=_s(o)),s&&(this.folderId=s,this.veltFolderId=Oo(s)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`apiKey/${this.apiKey}`;this.paths.activities=`${e}/${v.FIREBASE_PARTIAL_PATH_ACTIVITIES}`,this.paths.userNotificationIndex=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX}`,this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=e,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.lastActivityTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP}`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${v.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get userNotificationIndex(){return this.paths.userNotificationIndex}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get activities(){return this.paths.activities?this.paths.activities:this.throwError("Activities path is not available.")}get lastActivityTimestamp(){return this.paths.lastActivityTimestamp?this.paths.lastActivityTimestamp:this.throwError("LastActivityTimestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var q3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(t){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(t){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),t}}formatAreaData(t){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var K3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromUserIamData(t){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(t?.length)for(let o of t)o?.user?.userId&&i.add(o?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(t){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);if(i){let o=i;t?.user&&typeof t.user=="object"&&(o=P(P({},o),t.user));let s=this.usersService.getContactListUser(t.user.userId);s&&(o=P(P({},o),s)),t=le(P({},t),{user:o})}}return t}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Y3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromMultiThreads(t){try{let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),t}}formatMultiThreadData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.commentAnnotationsMap&&(t.commentAnnotationsMap=null)),t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Q3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromSelections(t){try{let i=new Set;for(let o of t)o?.user?.userId&&i.add(o.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(t){try{if(t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);i&&(t.user=i)}return t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),t}}formatSelectionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.user?.userId&&(t.user={userId:t.user.userId}),t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var X3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromTags(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o.from.userId),o?.to?.length)for(let s of o.to)s?.userId&&i.add(s.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t?.to?.length&&(t.to=t.to.map(i=>{if(i?.userId){let o=this.usersService.getUserById(i?.userId);o&&(i=o)}return i})),t}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),t}}formatTagData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to?.length&&(t.to=t.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),t}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var J3=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,S,b,B,x,U,$){this.activityUtilsService=t,this.areaUtilsService=i,this.commentUtilsService=o,this.contactUtilsService=s,this.coreActionsService=a,this.liveStateUtilsService=c,this.loggingService=l,this.multiThreadUtilsService=u,this.reactionUtilsService=d,this.selectionUtilsService=f,this.tagUtilsService=g,this.usersService=p,this.docService=_,this.commentAnnotationsResolverService=T,this.reactionAnnotationsResolverService=S,this.recorderAnnotationsResolverService=b,this.notificationResolverService=B,this.activityResolverService=x,this.serviceBook=U,this.attachmentResolverService=$}getErrorForGetRequests({feature:t,error:i}){try{switch(t){case"apiKeyMetadata":case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(i?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",o),null}}getFirestorePath({feature:t,properties:i,documentPaths:o,apiKey:s}){try{if(!s)return;if(t==="userNotificationIndex"){if(!i?.id)return;let d=new Cp({apiKey:s});return d?.userNotificationIndex?`${d.userNotificationIndex}/${i.id}`:void 0}let{documentId:a,organizationId:c,folderId:l}=i;if(!c&&(c=o?.organizationId,!c))return;let u=new Cp({apiKey:s,documentId:a?`${a}`:"",organizationId:c?`${c}`:"",veltFolderId:l?`${l}`:void 0});switch(t){case"userConfig":return i?.userId&&u?.userConfig?`${u?.userConfig}/${i?.userId}${i?.documentId?`/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:""}`:void 0;case"allPermissionsUsers":return u?.permissionsUsers?`${u?.permissionsUsers}`:void 0;case"comment":return i?.documentId&&i?.id&&u?.comment?`${u?.comment}/${i?.id}`:void 0;case"allComments":return i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"multiThread":return i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}/${i?.id}`:void 0;case"allMultiThreads":return i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}`:void 0;case"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${i?.id}`:void 0;case"activity":return i?.id&&u?.activities?`${u?.activities}/${i?.id}`:void 0;case"allActivities":return u?.activities?`${u?.activities}`:void 0;case"allLastActivityTimestamp":return u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}`:void 0;case"lastActivityTimestamp":return i?.id&&u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}/${i?.id}`:void 0;case"area":return i?.documentId&&i?.id&&u?.area?`${u?.area}/${i?.id}`:void 0;case"allAreas":return i?.documentId&&u?.area?`${u?.area}`:void 0;case"allDocuments":return u?.document?`${u?.document}`:void 0;case"allLocations":return u?.location?`${u?.location}`:void 0;case"allFolders":return u?.folder?`${u?.folder}`:void 0;case"folder":return u?.folder&&i.folderId?`${u?.folder}/${i.folderId}`:void 0;case"documentUserAccess":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"reaction":return i?.documentId&&i?.id&&u?.reaction?`${u?.reaction}/${i?.id}`:void 0;case"allReactions":return i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}`:void 0;case"allRecorders":return i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"recorderTrackEvent":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"apiKeyMetadata":return s?`apiKey/${s}`:void 0;case"organizationMetadata":return u?.organization?`${u?.organization}`:void 0;case"documentIam":case"documentMetadata":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"folderMetadata":return i?.folderId&&u?.folder?`${u?.folder}/${i?.folderId}`:void 0;case"locationMetadata":return i?.documentId&&u?.location&&i?.id?`${u?.location}/${i?.id}`:void 0;case"documentUser":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"allDocumentUsers":return u?.users?`${u?.users}`:void 0;case"allFolderUsers":return u?.users?`${u?.users}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.users?`${u?.users}`:void 0;case"notificationViewsTimestamp":return i?.documentId&&i?.id&&u?.notificationViews?`${u?.notificationViews}/${i?.id}`:void 0;case"allDocumentViews":return i?.documentId&&u?.documentViews?`${u?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return i?.documentId&&i?.id&&u?.documentViews?`${u?.documentViews}/${i?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return i?.documentId&&i?.id&&u?.locationViews?`${u?.locationViews}/${i?.id}`:void 0;case"allLocationViews":return i?.documentId&&u?.locationViews?`${u?.locationViews}`:void 0;case"allDocNotifications":return i?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.docNotification?`${u?.docNotification}/${i?.id}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allUserNotifications":return i?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${t}`)}}catch(a){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",a);return}}getFirestoreCollectionGroupPath(t){try{switch(t){case"allComments":return v.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return v.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return v.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return v.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return v.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return v.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return v.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return v.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${t}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:t,properties:i,defaultDocumentPaths:o,apiKey:s,useFirestore:a}){try{if(!s)return;let{documentId:c,organizationId:l}=i;l||(l=o?.organizationId);let u=new Xy({apiKey:s,documentId:c?`${c}`:"",organizationId:l?`${l}`:""});switch(t){case"userConfig":return i?.userId&&i?.documentId&&u?.userConfig?`${u?.userConfig}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"allComments":return!a&&i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"allGlobalContacts":return i?.documentId&&u?.globalContacts?`${u?.globalContacts}`:void 0;case"globalContacts":return i?.documentId&&i?.userId&&u?.globalContacts?`${u?.globalContacts}${i?.userId}`:void 0;case"groupContacts":return i?.documentId&&i?.groupId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}`:void 0;case"groupContactsUser":return i?.documentId&&i?.groupId&&i?.userId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}/${i?.userId}`:void 0;case"allLoginContacts":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}/contacts`:void 0;case"allLogins":return i?.documentId&&u?.logins?`${u?.logins}`:void 0;case"logins":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}`:void 0;case"customerMetadata":return u?.customerMetadata?`${u?.customerMetadata}`:void 0;case"allArrows":return i?.documentId&&u?.arrow?`${u?.arrow}`:void 0;case"arrow":return i?.documentId&&u?.arrow&&i.id?`${u?.arrow}${i.id}`:void 0;case"allCursors":return i?.documentId&&u?.cursor?`${u?.cursor}`:void 0;case"cursor":return i?.documentId&&u?.cursor&&i.id?`${u?.cursor}${i.id}`:void 0;case"flockUser":return i?.documentId&&u?.flock&&i.id?`${u?.flock}users/${i.id}`:void 0;case"flockSession":return i?.documentId&&u?.flock&&i.id?`${u?.flock}sessions/${i.id}`:void 0;case"allHuddleAttendees":return i?.documentId&&u?.huddle?`${u?.huddle}attendees`:void 0;case"huddleAttendee":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}`:void 0;case"huddleAttendeeState":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}/state`:void 0;case"allHuddleInvitees":return i?.documentId&&u?.huddle?`${u?.huddle}invitees`:void 0;case"huddleConnection":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}connections/${i.id}`:void 0;case"huddleIceCandidate":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}iceCandidates/${i.id}`:void 0;case"allHuddleIceCandidates":return i?.documentId&&u?.huddle?`${u?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return i?.documentId&&u?.huddle?`${u?.huddle}messages`:void 0;case"huddleMessage":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}messages/${i.id}`:void 0;case"allLiveStates":return i?.documentId&&u?.liveState?`${u?.liveState}`:void 0;case"allLiveStateCustoms":return i?.documentId&&u?.liveState?`${u?.liveState}custom`:void 0;case"liveStateCustom":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}custom/${i.id}`:void 0;case"liveStateSingleEditorMode":return i?.documentId&&u?.liveStateSingleEditorMode?`${u?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}default/autoSyncState/history/${i.id}`:void 0;case"presence":return i?.documentId&&u?.presence&&i?.userId?`${u?.presence}${i?.userId}`:void 0;case"allPresence":return i?.documentId&&u?.presence?`${u?.presence}`:void 0;case"workspaceIam":return u?.workspaceIam?`${u?.workspaceIam}`:void 0;case"selection":return i?.documentId&&u?.selection&&i?.userId?`${u?.selection}${i?.userId}`:void 0;case"allSelections":return i?.documentId&&u?.selection?`${u?.selection}`:void 0;case"syncVideoPlayer":return i?.documentId&&u?.syncVideoPlayer?`${u?.syncVideoPlayer}`:void 0;case"allTags":return i?.documentId&&u?.tag?`${u?.tag}`:void 0;case"tag":return i?.documentId&&u?.tag&&i?.id?`${u?.tag}${i?.id}`:void 0;case"userContactUs":return i?.documentId&&u?.userContactUs?`${u?.userContactUs}`:void 0;case"userFeedback":return i?.documentId&&u?.userFeedback?`${u?.userFeedback}`:void 0;case"userReportBug":return i?.documentId&&u?.userReportBugs?`${u?.userReportBugs}`:void 0;case"comment":return!a&&i?.documentId&&i?.id&&u?.comment?`${u?.comment}${i?.id}`:void 0;case"allMultiThreads":return!a&&i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return!a&&i?.documentId&&u?.crdt?`${u?.crdt}`:void 0;case"crdtData":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/data`:void 0;case"crdtSyncState":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/state`:void 0;case"crdtSyncPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence/${i.userId}`:void 0;case"allCrdtSyncPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence`:void 0;case"crdtPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence/${i.userId}`:void 0;case"allCrdtPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence`:void 0;case"crdtVersion":return i?.documentId&&u?.crdt&&i?.id&&i?.versionId?`${u?.crdt}/${i?.id}/versions/${i?.versionId}`:void 0;case"crdtVersions":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/versions`:void 0;case"crdtMessages":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/messages`:void 0;case"crdtMessage":return i?.documentId&&u?.crdt&&i?.id&&i?.messageId?`${u?.crdt}/${i?.id}/messages/${i?.messageId}`:void 0;case"crdtSnapshot":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/snapshot`:void 0;case"multiThread":return!a&&i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!a&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!a&&i?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"allDocuments":return!a&&u?.docs&&i?.documentId?`${u?.docs}/${i?.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!a&&i?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!a&&i?.id&&u?.area?`${u?.area}${i?.id}`:void 0;case"folder":return!a&&i?.folderId&&u?.folder?`${u?.folder}${i?.folderId}`:void 0;case"documentUserAccess":return!a&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!a&&i?.documentId&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!a&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!a&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!a&&i?.id&&u?.reaction?`${u?.reaction}${i?.id}`:void 0;case"allReactions":return!a&&i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!a&&i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}${i?.id}`:void 0;case"allRecorders":return!a&&i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!a&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"heartbeat":return i?.id&&u?.heartbeat?`${u?.heartbeat}${i?.id}`:void 0;case"allHeartbeats":return u?.heartbeat?`${u?.heartbeat}`:void 0;case"heartbeatByDocument":return i?.id&&u?.heartbeatByDocument?`${u?.heartbeatByDocument}${i?.id}`:void 0;case"allHeartbeatsByDocument":return u?.heartbeatByDocument?`${u?.heartbeatByDocument}`:void 0;case"documentAccessType":return!a&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!a&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocumentViews":return!a&&i?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!a&&i?.documentId&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}`:void 0;case"allLocationViews":return!a&&i?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!a&&i?.id&&i?.user&&u?.views?`${u?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/location`:void 0;case"location":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}locationViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return i?.userId&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}/${i?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${t}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(o){return I(this,arguments,function*({data:t,feature:i}){try{if(t&&t?.length>0)switch(i){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let s=J(),a=_d.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:a,source:"internal",payload:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let s=J(),a=Td.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:a,source:"internal",payload:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allRecorders":{if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let s=J(),a=Id.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:a,source:"internal",payload:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}default:break}}catch(s){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,s)}})}formatResponse(g){return I(this,arguments,function*({feature:t,data:i,organizationId:o,shouldAwait:s=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:c=!1,shouldNotificationResolverAwait:l=!1,shouldActivityResolverAwait:u=!1,shouldReactionResolverAwait:d=!1,shouldRecorderResolverAwait:f=!1}){try{let p=o??this.docService.getDocumentPaths()?.clientOrganizationId??"";if(this.usersService.userDataProviderAvailable()){let _=[];switch(t){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(TT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(IT)?.getUserIdsToResolveFromCursorUsers(Object.values(i))??[]);break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(Pi)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(Pi)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(vT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ai)?.getUserIdsToResolveFromRecorders(Object.values(i))??[]);break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(yT)?.getUserIdsToResolveFromHuddleAttendees(Object.values(i))??[]);break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"liveStateSingleEditorMode":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}case"allActivities":{i&&typeof i=="object"&&(_=this.activityUtilsService.getUserIdsToResolveFromActivities(Array.isArray(i)?i:Object.values(i)));break}default:_=[]}if(_?.length){let T=J(),S=el.GET_USERS;this.coreActionsService.triggerAction(G.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:xn.FORMAT_RESPONSE,source:"internal",moduleName:S,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:S}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:S})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(Pi)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(S=>!this.notificationResolverService.getNotificationById(S)));break}default:_=[]}if(_?.length){let T=J(),S=vC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Fn.FORMAT_RESPONSE,moduleName:S,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:S}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:S})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let S=this.serviceBook.get(Pi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...S],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let S=this.serviceBook.get(Pi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...S],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),S=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...S],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}default:_=[]}if(_?.length){let T=J(),S=_d.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.FORMAT_RESPONSE,moduleName:S,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:S}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:S})}}if(t==="allActivities"&&i&&typeof i=="object"){let _=Array.isArray(i)?i:Object.values(i),T=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(this.activityResolverService.activityDataProviderAvailable()){let S=[];for(let b of _)b?.id&&!this.activityResolverService.getActivityById(b.id)&&S.push(b.id);if(S.length){let b=J(),B=yC.GET_ACTIVITIES;this.coreActionsService.triggerAction(G.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:cr.FORMAT_RESPONSE,moduleName:B,source:"internal",payload:{activityIds:S,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:S,organizationId:T},uniqueId:b,moduleName:B}):this.activityResolverService.resolveActivities({request:{activityIds:S,organizationId:T},uniqueId:b,moduleName:B})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let S=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(S=S.filter(b=>!this.reactionAnnotationsResolverService.getAnnotationById(b)),S.length){let b=J(),B=Td.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:B,source:"internal",payload:{reactionAnnotationIds:S,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:S,organizationId:T},uniqueId:b,moduleName:B}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:S,organizationId:T},uniqueId:b,moduleName:B})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let S=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(S=S.filter(b=>!this.recorderAnnotationsResolverService.getAnnotationById(b)),S.length){let b=J(),B=Id.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:B,source:"internal",payload:{recorderAnnotationIds:S,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:S,organizationId:T},uniqueId:b,moduleName:B}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:S,organizationId:T},uniqueId:b,moduleName:B})}}}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(a),o),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(Pi);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithNotification(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",o),t}}mergeActivityResolverWithData({data:t,feature:i}){try{return this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeActivityResolverWithData","color: green;"),this.activityResolverService.activityDataProviderAvailable()&&i==="allActivities"&&Array.isArray(t)?t.map(o=>this.activityUtilsService.mergeActivityWithResolverData(o)):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeActivityResolverWithData:",o),t}}mergeNotificationsWithResolvedData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeNotificationsWithResolvedData","color: green;"),this.notificationResolverService.notificationDataProviderAvailable())switch(i){case"allDocNotifications":case"allUserNotifications":{let o=this.serviceBook.get(Pi);return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeResolvedNotificationData(c):c,s),{}):Array.isArray(t)?t.map(s=>o?o.mergeResolvedNotificationData(s):s):t}default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeNotificationsWithResolvedData:",o),t}}mergeNotificationsWithResolvedData$({data:t,feature:i}){try{return this.notificationResolverService.getNotificationsById$().pipe(fe(()=>{let o=this.mergeNotificationsWithResolvedData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeNotificationsWithResolvedData$:",o),ue(t)}}mergeReactionAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(a),o),{}):t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",o),t}}mergeRecorderAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeRecorderAnnotationsWithData","color: green;"),this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable())switch(i){case"allRecorders":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(ai);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithRecorderAnnotation(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeRecorderAnnotationsWithData:",o),t}}mergeActivitiesWithFeatureData(t){return Array.isArray(t)?t.map(i=>this.activityUtilsService.mergeActivityWithFeatureData(i)):t}mergeLocationMetadataWithData({data:t,feature:i,locationMetadata:o}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),o&&typeof o=="object"&&!Array.isArray(o))switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,o),s),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let s=this.serviceBook.get(Pi);return Object.entries(t).reduce((a,[c,l])=>(a[c]=s?s.mergeLocationWithNotification(l,o):l,a),{})}else return t;default:return t}return t}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",s),t}}mergeUsersWithData({feature:t,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(t){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.areaUtilsService.mergeAreaWithUser(a),o),{}):i;case"allArrows":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(TT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeArrowWithUser(c):c,s),{})}else return i;case"allCursors":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(IT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeCursorUserWithUser(c):c,s),{})}else return i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeCommentWithUser(a),o),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.multiThreadUtilsService.mergeMultiThreadWithUser(a),o),{}):i;case"allDocNotifications":if(i&&typeof i=="object"){let o=this.serviceBook.get(Pi);return i?.map(s=>o?o.mergeNotificationWithUser(s):s)}else return i;case"allUserNotifications":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(Pi);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeNotificationWithUser(c):c,s),{})}else return i;case"allPresence":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(vT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergePresenceUserWithUser(c):c,s),{})}else return i;case"allRecorders":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(ai);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeRecorderWithUser(c):c,s),{})}else return i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeReactionWithUser(a),o),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.tagUtilsService.mergeTagWithUser(a),o),{}):i;case"allHuddleAttendees":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(yT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?.mergeHuddleAttendeeWithUser(c)??c,s),{})}else return i;case"liveStateCustom":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(i):i;case"allLiveStateCustoms":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(a),o),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"liveStateSingleEditorMode":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.selectionUtilsService.mergeSelectionWithUser(a),o),{}):i;case"allActivities":return Array.isArray(i)?i.map(o=>this.activityUtilsService.mergeActivityWithUser(o)):i;default:return i}return i}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",o),i}}mergeCommentAnnotationsWithData$({data:t,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(fe(()=>{let o=this.mergeCommentAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),ue(t)}}mergeReactionAnnotationsWithData$({data:t,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(fe(()=>{let o=this.mergeReactionAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),ue(t)}}mergeRecorderAnnotationsWithData$({data:t,feature:i}){try{return this.recorderAnnotationsResolverService.getRecorderAnnotationsById$().pipe(fe(()=>{let o=this.mergeRecorderAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeRecorderAnnotationsWithData:",o),ue(t)}}mergeUsersWithData$({feature:t,data:i}){try{return this.usersService.getUserById$().pipe(fe(()=>{let o=this.mergeUsersWithData({feature:t,data:i?.data??{}});return typeof o=="object"?{data:JSON.parse(JSON.stringify(o)),operation:i?.operation??null}:{data:o,operation:i?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${t}:`,o),ue(i)}}mergeLocationMetadataWithData$({data:t,feature:i}){try{return this.docService.getLocationMetadata$().pipe(fe(o=>{let s=this.mergeLocationMetadataWithData({data:t?.data??{},feature:i,locationMetadata:o});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,o),ue(t)}}handleDataStripping(a){return I(this,arguments,function*({feature:t,data:i,actionType:o,commentId:s}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),t){case"comment":{let c=yield this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:o,commentId:s});return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()})}case"reaction":{let c=this.reactionUtilsService.stripReactionAnnotationData(i);return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()})}case"recorder":{let c=this.serviceBook.get(ai)?.stripRecorderAnnotationData({data:i,actionType:o})??{originalData:i,strippedData:null};return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()})}default:return{originalData:i,strippedData:null}}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",c),{originalData:i,strippedData:null}}})}filterOriginalDataForVeltDb({feature:t,result:i,providerAvailable:o}){try{return!o||!i||i.originalData===null||i.originalData===void 0?i:le(P({},i),{originalData:this.applyVeltDbFieldFilter(t,i.originalData)})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService filterOriginalDataForVeltDb:",s),i}}applyVeltDbFieldFilter(t,i){switch(t){case"comment":return HV(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return WV(i);case"recorder":return zV(i);default:return i}}formatData({feature:t,data:i,properties:o,offset:s,isRealtimeDb:a}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof i=="object"&&(i=JSON.parse(JSON.stringify(i)));let c=new Date().getTime()+s;switch(t){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return a?i:{metadata:i};case"documentCommentMetadata":return i;case"cursor":{let l=this.serviceBook.get(IT);return l?l.formatCursorUserData(i):i}case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":{let l=this.serviceBook.get(TT);return l?l.formatArrowData(i):i}case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(i);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(i);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(i);case"reaction":return this.reactionUtilsService.formatReactionData(i);case"recorder":return this.serviceBook.get(ai)?.formatRecorderData(i,c)??i;case"notificationViewsTimestamp":return{views:{[o.user??""]:i}};case"documentUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"documentDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"documentMetadataViews":return a?i:{metadata:i};case"huddleMessage":return this.serviceBook.get(yT)?.formatHuddleMessageData(i)??i;case"locationMetadataViews":return a?i:{metadata:i};case"locationUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"locationDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"locationViews":return a?i:{location:i};case"docNotificationViews":return a?i:{views:i.views};case"userNotificationViews":return a?i:{views:i.views};case"presence":{let l=this.serviceBook.get(vT);return l?l.formatPresenceUserData(i):i}case"selection":return this.selectionUtilsService.formatSelectionData(i);case"tag":return this.tagUtilsService.formatTagData(i);default:return i}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),i}}modifyAndSetData(a){return I(this,arguments,function*({feature:t,data:i,subscriber:o,operation:s=null}){try{let c=yield this.modifyData({feature:t,data:i});o.next({data:c,operation:s})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:t,change:i,cache:o}){try{if(t==="allReactions"||t==="allComments"){if(i.type==="removed")return!Object.keys(o??{}).includes(i.doc.id);if(o?.[i.doc.id]){let s=i.doc.data(),a=o?.[i.doc.id];return s?.lastUpdated===a?.lastUpdated}}return!1}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",s),!1}}modifyData(o){return I(this,arguments,function*({feature:t,data:i}){try{return yield this.formatResponse({feature:t,data:i})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",s),i}})}addMetadata(t,i){try{return t&&typeof t=="object"&&!Array.isArray(t)?le(P({},t),{metadata:t?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",o),t}}setDataInLocal(l){return I(this,arguments,function*({feature:t,data:i,observablesCache:o,eventType:s,id:a,operation:c=null}){try{let d={comment:"allComments",reaction:"allReactions"}[t];if(!d)return null;let f=i?.metadata?.documentId,g=i?.metadata?.veltFolderId;return Object.keys(o).filter(p=>p.includes(d)&&(!f||p.includes(f)||g&&p.includes(g))).forEach(p=>{let _=o[p]?.subject?.getValue()??{};s==="DELETE"?a&&_?.data?.[a]&&(delete _?.data?.[a],o[p]?.subject&&o[p].subject.next({data:_?.data,operation:c})):o[p]?.subject?.next({data:le(P({},_?.data),{[i?.annotationId]:i}),operation:c})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a})}catch(l){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",l),t}})}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:t,firestorePath:i,eventType:o})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",a),t}})}rtdbDefaultTransactionCallback(t,i){try{let o=P({},t||{});return Object.entries(i).forEach(([s,a])=>{a==null?delete o[s]:o[s]=a}),o}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",o),t}}};e.\u0275fac=function(i){return new(i||e)(w(Qy),w(q3),w(qy),w(K3),w(It),w(W3),w(_e),w(Y3),w(Yy),w(Q3),w(X3),w(zt),w(Wh),w(Wo),w(zo),w(Za),w(Jy),w(Ky),w(ci),w(Hh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Z3=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{Jr([this.authService.getFirebaseConfig$(),this.configService.getApiKey$(),this.configService.getFirestorePersistentCacheEnabled$()]).pipe(Ct(([s,a])=>!!s&&!!a),Nt(1)).subscribe(([s,a,c])=>{if(s&&a&&s?.firebaseOptions?.storeDbId){try{let d=sessionStorage?.getItem("veltFirestoreLogLevel")||st?.firebaseLogLevel||"silent";KL(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=ec.getFirestoreProdDbName(a,s.firebaseOptions),u=this.configService.getProxyConfig();if(u?.v2DbHost){let d={host:u.v2DbHost,ssl:!0};u.forceLongPolling?d.experimentalForceLongPolling=!0:d.experimentalAutoDetectLongPolling=!0,c&&(d.localCache=wM({tabManager:bM()}));try{this.firestore$.next(By(yr(),d,l))}catch(f){this.loggingService.catch("Firestore proxy: initializeFirestore failed, falling back to existing instance. Proxy settings may not be applied: ",f),this.firestore$.next(Gh(l))}}else if(c)try{let d=yr(),f=By(d,{localCache:wM({tabManager:bM()})},l);this.firestore$.next(f)}catch{this.firestore$.next(Gh(l))}else this.firestore$.next(Gh(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||Gh("DocumentIdDb");if(t){let i=Ap(t,"generateDocumentId");return jh(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(w(Dr),w(Rr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Gke=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,S){this.activityUtilsService=t,this.authService=i,this.commonDbUtilsService=o,this.coreActionsService=s,this.loggingService=a,this.firestoreService=c,this.databaseService=l,this.configService=u,this.docService=d,this.usersService=f,this.commentAnnotationsResolverService=g,this.reactionAnnotationsResolverService=p,this.recorderAnnotationsResolverService=_,this.notificationResolverService=T,this.serviceBook=S,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(RT).subscribe(b=>{this.activityService=b??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(b=>{if(b){this.db=b;let B=Oa(b,".info/serverTimeOffset");this.offsetListener=fv(B,x=>{let U=x.val();this.offset=U})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(b=>{b&&(this.firestore=b)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([t,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(t){this.loggingService.catch("Error in unsubscribeFromObservables:",t)}}ngOnDestroy(){this.subscriptions.forEach(t=>t.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(t,i){return I(this,null,function*(){try{if(this.db){let o=Oa(this.db,t);return L2(o).update(i)}return Promise.resolve()}catch(o){return this.loggingService.catch("Error in setupOnDisconnect:",o),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){Jr([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ct(([i,o])=>!!i),Nt(1),qs(([i,o])=>{t({db:i,firestore:o})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(t,i,o,s,a,c){return I(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${t}`,"color: red;");return}return this.subscribeToServices(d=>I(this,[d],function*({db:l,firestore:u}){let f;i?.skipFirestore||(f=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let g=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!l){this.loggingService.warn(`%c[WB] No database or firestore found for ${t}`,"color: red;");return}try{let p,_;try{g&&(p=Oa(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=jh(u,`${f}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield o({dbRef:p,firestoreRef:_,data:s,firestorePath:f}),c&&c({firestoreAvailable:!!u})}catch(p){this.loggingService.catch(`Error in ${t} operation: `,p),a&&a(p)}}))}catch(l){this.loggingService.catch("Error in performDatabaseOperation:",l)}})}setData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Tw(u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield Iw(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??o?.targetCommentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield FM(this.firestore,S=>I(this,null,function*(){S.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield kM(u.firestoreRef,d)}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in setData for ${t}`,u)}})}updateData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef&&!o?.skipRtdb){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Tw(u.dbRef,f=>{let g;return o?.rtdbTransactionCallback?g=o.rtdbTransactionCallback(f,d):g=this.commonDbUtilsService.rtdbDefaultTransactionCallback(f,d),JSON.parse(JSON.stringify(g))}):yield x2(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield FM(this.firestore,S=>I(this,null,function*(){S.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield kM(u.firestoreRef,d,{merge:!0})}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in updateData for ${t}`,u)}})}createActivityFromExtraData(t,i){try{if(!i?.actionType||!this.activityService)return;let o=this.activityUtilsService.buildActivityDataFromExtraData({feature:t,extraData:i});o&&this.activityService.createActivity(o)}catch(o){this.loggingService.catch("Error in CommonDbService createActivityFromExtraData:",o)}}deleteData(c){return I(this,arguments,function*({feature:t,properties:i,callback:o,errorCallback:s,extraData:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${t}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:t,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.createActivityFromExtraData(t,a),this.performDatabaseOperation(t,i,l=>I(this,null,function*(){l.dbRef&&(yield P2(l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=J();this.coreActionsService.triggerAction(G.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_DATA,source:"internal",payload:{commentAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE",metadata:i?.metadata}))}else if(t==="reaction"){let u=null,d=J();this.coreActionsService.triggerAction(G.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE"}))}else if(t==="recorder"){let u=null,d=J();this.coreActionsService.triggerAction(G.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_DATA,source:"internal",payload:{recorderAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.recorderAnnotationsResolverService.deleteRecorderAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield jy(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=J();this.coreActionsService.triggerAction(G.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Fn.DELETE_DATA,source:"internal",payload:{notificationId:i?.id??"",organizationId:i?.organizationId??""}}),u=yield this.notificationResolverService.deleteNotification(String(i?.id??""),this.docService.getDocumentPaths()?.clientOrganizationId??"",d),(u?.isSuccess||u===null)&&(yield jy(l.firestoreRef))}else yield jy(l.firestoreRef)}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${t}`,u)}}),void 0,s,o)}catch(l){this.loggingService.catch(`Error in deleteData for ${t}`,l)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(t){return this.loggingService.catch("Error in shouldUseFirestore:",t),!1}}generateDocumentId(){try{let t=this.firestoreService.generateFirestoreDocumentId();return t||(t=J()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),J()||"noDocumentId"}}queryData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();return!t||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):s?yield this.handleFirestoreQuery(t,i):yield this.handleRtdbQuery(t,i)}catch(s){return this.loggingService.catch(`Error in queryData for ${t}`,s),[]}})}handleFirestoreQuery(t,i){return I(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let o=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),[];try{let s=Ap(this.firestore,o);i?.useCollectionGroup&&(s=MM(this.firestore,o));let a=i?.firestoreQuery??[],c=xM(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield k3(c).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,u),null));return l?l.data().count:0}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,l),0}else try{let l=yield V3(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,d),null));if(!l)return[];let u=l.docs.map(d=>d.data());try{return yield this.commonDbUtilsService.modifyData({feature:t,data:u})}catch(d){return this.loggingService.catch(`Error in modifyData for ${t}`,d),u}}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,l),[]}}catch(s){return this.loggingService.catch(`Error in Firestore query for ${t}:`,s),[]}}catch(o){return this.loggingService.catch(`Error in Firestore query for ${t}:`,o),[]}})}handleRtdbQuery(t,i){return I(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let o=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No database path found for ${t}`),[];try{let s=Oa(this.db,o),a=i?.rtdbQuery??[],c=_w(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield pw(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),null));if(!l)return[];let u=l.val();return u?i?.skipObjectValues?u:Object.values(u??{}):[]}catch(s){return this.loggingService.catch(`Error in RTDB query for ${t}:`,s),[]}})}getData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();if(i?.skipFirestore&&(s=!1),!t||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(s&&this.firestore){let a=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield U3(jh(this.firestore,a)).catch(u=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let l=c.data();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${t}:`,c),{}}}if(this.db){let a=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${t}`),{};try{if(!this.authService.getUser())return{};let c=yield pw(Oa(this.db,a)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let l=c.val();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${t}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(s){return this.loggingService.catch("Unexpected error in getData:",s),{}}})}dbListener({feature:t,properties:i}){let o=this.shouldUseFirestore();i?.skipFirestore&&(o=!1);let s=`${t}-${JSON.stringify(i)}`;return Jr([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Ct(a=>!!a))]).pipe(Ct(([a,c])=>a?o&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${t}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${t}`),!1)),mt(([a,c])=>{try{if(o&&c){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleFirestoreListener(t,i,c).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.firestoreSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.firestoreSubscriptions[s]?.unsubscribe(),delete this.firestoreSubscriptions[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache[s]))}})}else if(a){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleRealtimeDbListener(t,i,a).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.rtdbSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.rtdbSubscriptions[s]?.unsubscribe(),delete this.rtdbSubscriptions?.[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache?.[s]))}})}return ue({})}catch(l){return this.loggingService.catch(`Error setting up listener for ${t}:`,l),ue({})}}),yc(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${t} and key ${s}`)}))}handleFirestoreListener(t,i,o){let s=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),a=`${t}-${JSON.stringify(i)}`;return s?new ge(c=>{let l=i.isCollection?this.setupCollectionListener(o,s,t,c,i):this.setupDocumentListener(o,s,t,c,i);return()=>{c.complete(),c.unsubscribe(),l(),this.observablesCache[a]?.subject?.complete(),this.observablesCache[a]?.subject?.unsubscribe(),delete this.observablesCache[a]}}).pipe(mt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),mt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):ue(c)),it(Ft)):(this.loggingService.warn(`[WB] No firestore path found for ${t} and key ${a}`),ue({}))}setupCollectionListener(t,i,o,s,a){let c=`${o}-${JSON.stringify(a)}`,l=Ap(t,i);if(a?.useCollectionGroup&&(l=MM(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=xM(l,...f)}let u=!0,d=[];return o==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",i,"feature:",o,"properties:",JSON.stringify(a??"nil")),PM(l,f=>{try{let g=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),p=null,_=!1;f?.docChanges()?.length?f.docChanges().forEach(T=>{["allComments","allReactions","allRecorders"].includes(o)&&!u&&T.type!=="removed"&&d.push(T.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:o,change:T,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(_=!0,Object.assign(g,this.handleCollectionChange(T,g)),T.type==="removed"&&(p||(p={type:T.type,ids:[]}),p.ids.push(T.doc.id)))}):_=!0,_&&(["allComments","allReactions","allRecorders"].includes(o)&&d?.length&&(this.commonDbUtilsService.resolveAnnotations({data:d,feature:o}),d=[]),this.commonDbUtilsService.modifyAndSetData({feature:o,data:g,subscriber:s,operation:p})),u=!1}catch(g){this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,g),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(g,o,s)}},f=>{this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,f),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(f,o,s)})}handleCollectionChange(t,i){switch(t.type){case"added":case"modified":i[t.doc.id]=t.doc.data();break;case"removed":delete i?.[t.doc.id];break}return i}setupDocumentListener(t,i,o,s,a){let c=jh(t,i);return PM(c,l=>{try{let u=l.data()||{};a?.field&&(u=u?.[a?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:o,data:u,subscriber:s,operation:null})}catch(u){this.handleListenerError(u,o,s)}},l=>this.handleListenerError(l,o,s))}handleListenerError(t,i,o){this.loggingService.catch(`Firestore listener error for ${i}:`,t)}handleRealtimeDbListener(t,i,o){let s=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${t}`),ue({});let a=Oa(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=_w(a,...c)}return this.objectValFromChildEvents(a,t).pipe(es(c=>(this.loggingService.catch(`RTDB listener error for ${t}:`,c),ue({}))),fe(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((u,[d,f])=>(u[d]=this.commonDbUtilsService.addMetadata(f,i),u),{}):this.commonDbUtilsService.addMetadata(c,i))),mt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),mt(c=>this.usersService.getUserById$().pipe(fe(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:t,data:c}),operation:null})))))}pushData(s){return I(this,arguments,function*({feature:t,properties:i,data:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: pushData for ${t}`,"color: green;"),this.performDatabaseOperation(t,i,a=>I(this,null,function*(){if(a.dbRef){let c=M2(a.dbRef);yield Iw(c,JSON.parse(JSON.stringify(a.data)))}}),o)}catch(a){this.loggingService.catch(`Error in pushData for ${t}`,a)}})}streamChildAdded({feature:t,properties:i,afterTs:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: streamChildAdded for ${t}`,"color: green;"),new ge(s=>{let a=null,c=!1,l=({db:u})=>{if(!u||c||!this.authService.getUser())return;let d=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:!1});if(!d)return;let g=Oa(u,d),p=!1,_=b=>{try{let B=b.val();if(p){if(o!=null&&B?.timestamp!=null&&B.timestamp<=o)return;s.next(B)}}catch(B){this.loggingService.catch(`streamChildAdded onChildAdded callback error for ${t}:`,B)}},T=b=>{try{this.loggingService.catch(`streamChildAdded error for ${t}:`,b),s.error(b)}catch(B){this.loggingService.catch(`streamChildAdded onError handler error for ${t}:`,B)}};Ew(g,_,T);let S=fv(g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{S&&typeof S=="function"&&S(),Sm(g,"child_added",_)}catch(b){this.loggingService.catch(`streamChildAdded cleanup error for ${t}:`,b)}}};return this.subscribeToServices(l),()=>{c=!0,a&&a()}})}catch(s){return this.loggingService.catch(`Error in streamChildAdded for ${t}`,s),ue(null)}}objectValFromChildEvents(t,i){return new ge(o=>{let s={},a=!1,c=null,l=T=>{try{this.loggingService.catch(`Realtime DB listener error for ${i}:`,T),o.error(T)}catch{}},u=T=>{try{if(!Fi(T,c)){let S=JSON.parse(JSON.stringify(T));c=S,o.next(S)}}catch{}},d=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(P({},s)))}catch{}},f=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(P({},s)))}catch{}},g=T=>{try{T.key&&(delete s[T.key],a&&u(P({},s)))}catch{}},p=T=>{try{if(!a){let S=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=S,o.next(S),a=!0}}catch{}};Ew(t,d,l),w2(t,f,l),b2(t,g,l);let _=fv(t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),Sm(t,"child_added",d),Sm(t,"child_changed",f),Sm(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(w(Qy),w(Rr),w(J3),w(It),w(_e),w(Z3),w(Hy),w(Dr),w(Wh),w(zt),w(Wo),w(zo),w(Za),w(Jy),w(ci))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();export{P as a,le as b,uS as c,mse as d,pse as e,Ese as f,I as g,gt as h,ge as i,DS as j,Ot as k,Y as l,Sc as m,c6 as n,l6 as o,Tc as p,Pr as q,ue as r,u6 as s,d6 as t,Yz as u,fe as v,Jr as w,BS as x,h6 as y,uo as z,T6 as A,Ri as B,jz as C,Mu as D,Ct as E,Mz as F,es as G,vS as H,Su as I,Nt as J,AS as K,it as L,Au as M,uE as N,CS as O,Hz as P,NS as Q,Wz as R,Du as S,mt as T,zs as U,zz as V,qs as W,qz as X,Xz as Y,oe as Z,LE as _,K as $,rs as aa,Z as ba,w as ca,ne as da,mr as ea,Kn as fa,ho as ga,O0 as ha,w0 as ia,G0 as ja,$0 as ka,St as la,Dn as ma,ar as na,xr as oa,_o as pa,$c as qa,Zr as ra,X6 as sa,pn as ta,UD as ua,p4 as va,oa as wa,f_ as xa,O_ as ya,A4 as za,rq as Aa,iq as Ba,oq as Ca,sq as Da,aq as Ea,Aq as Fa,as as Ga,be as Ha,Lq as Ia,v8 as Ja,y8 as Ka,vo as La,Kf as Ma,us as Na,$_ as Oa,ut as Pa,L8 as Qa,Ao as Ra,qc as Sa,_k as Ta,T5 as Ua,sa as Va,Do as Wa,Qf as Xa,Ak as Ya,O5 as Za,Ck as _a,Nk as $a,W_ as ab,aa as bb,Pk as cb,xk as db,F5 as eb,U5 as fb,V5 as gb,B5 as hb,G5 as ib,$5 as jb,j5 as kb,Fk as lb,SR as mb,AR as nb,kk as ob,DR as pb,RR as qb,Uk as rb,CR as sb,NR as tb,Bk as ub,Y5 as vb,Gk as wb,jk as xb,Hk as yb,e9 as zb,n9 as Ab,r9 as Bb,o9 as Cb,s9 as Db,a9 as Eb,c9 as Fb,l9 as Gb,u9 as Hb,d9 as Ib,Qk as Jb,Xk as Kb,A9 as Lb,R9 as Mb,F9 as Nb,sU as Ob,OR as Pb,aU as Qb,cU as Rb,lU as Sb,B9 as Tb,uU as Ub,hU as Vb,G9 as Wb,$9 as Xb,j9 as Yb,H9 as Zb,Y9 as _b,Q9 as $b,X9 as ac,J9 as bc,Z9 as cc,eK as dc,tK as ec,nK as fc,rK as gc,iK as hc,oK as ic,sK as jc,cK as kc,uK as lc,dK as mc,hK as nc,fK as oc,gK as pc,EK as qc,ng as rc,rg as sc,PR as tc,zve as uc,qve as vc,Kve as wc,qK as xc,zR as yc,Yve as zc,Qve as Ac,Xve as Bc,Ro as Cc,jU as Dc,hY as Ec,s1 as Fc,fY as Gc,ZR as Hc,gY as Ic,mY as Jc,pY as Kc,EY as Lc,TY as Mc,vY as Nc,SY as Oc,eC as Pc,lC as Qc,BY as Rc,jY as Sc,N1 as Tc,f7 as Uc,g7 as Vc,mC as Wc,B1 as Xc,TC as Yc,Cd as Zc,jr as _c,da as $c,qT as ad,ol as bd,Ir as cd,Ge as dd,_n as ed,lr as fd,Mo as gd,vr as hd,ma as id,yr as jd,Qe as kd,TX as ld,gbe as md,mbe as nd,pbe as od,Vi as pd,pa as qd,Is as rd,Bi as sd,pe as td,Gi as ud,vs as vd,Pbe as wd,xbe as xd,Fbe as yd,_a as zd,$J as Ad,HJ as Bd,rZ as Cd,dl as Dd,hl as Ed,_Me as Fd,wd as Gd,pI as Hd,TMe as Id,f2 as Jd,uv as Kd,VPe as Ld,BPe as Md,GPe as Nd,$Pe as Od,jPe as Pd,HPe as Qd,WPe as Rd,L2 as Sd,fv as Td,zPe as Ud,M2 as Vd,Oa as Wd,P2 as Xd,Tw as Yd,Iw as Zd,qPe as _d,x2 as $d,ur as ae,kMe as be,UMe as ce,VMe as de,Ar as ee,j1 as fe,k7 as ge,yg as he,st as ie,L as je,Be as ke,Qt as le,mAe as me,pAe as ne,EAe as oe,_Ae as pe,G as qe,TAe as re,IAe as se,vAe as te,yAe as ue,E7 as ve,_7 as we,T7 as xe,I7 as ye,ET as ze,v7 as Ae,y7 as Be,S7 as Ce,pC as De,A7 as Ee,Gr as Fe,_T as Ge,D7 as He,gd as Ie,wt as Je,R7 as Ke,_g as Le,C7 as Me,N7 as Ne,O7 as Oe,w7 as Pe,b7 as Qe,L7 as Re,M7 as Se,v as Te,k1 as Ue,eDe as Ve,Ed as We,H as Xe,iDe as Ye,oDe as Ze,li as _e,bt as $e,H1 as af,W1 as bf,PDe as cf,xDe as df,wT as ef,IC as ff,bT as gf,xn as hf,el as if,Co as jf,K1 as kf,Y1 as lf,Q1 as mf,Es as nf,U7 as of,Un as pf,ui as qf,X1 as rf,J1 as sf,Z1 as tf,eV as uf,tV as vf,nV as wf,rV as xf,iV as yf,oV as zf,sV as Af,aV as Bf,V7 as Cf,B7 as Df,cV as Ef,SC as Ff,lV as Gf,uV as Hf,hV as If,G7 as Jf,No as Kf,$7 as Lf,j7 as Mf,IOe as Nf,NV as Of,_r as Pf,xi as Qf,ua as Rf,_s as Sf,Oo as Tf,bOe as Uf,LOe as Vf,MOe as Wf,POe as Xf,xOe as Yf,FOe as Zf,wV as _f,J as $f,kOe as ag,bV as bg,yd as cg,yV as dg,SV as eg,W7 as fg,z7 as gg,rl as hg,CC as ig,UOe as jg,wo as kg,VOe as lg,Dg as mg,Fi as ng,BOe as og,NC as pg,nl as qg,Y7 as rg,UT as sg,GOe as tg,$Oe as ug,MV as vg,Rg as wg,Q7 as xg,X7 as yg,J7 as zg,Z7 as Ag,eQ as Bg,$r as Cg,jOe as Dg,DC as Eg,HOe as Fg,nQ as Gg,WOe as Hg,zOe as Ig,xV as Jg,qOe as Kg,KOe as Lg,YOe as Mg,QOe as Ng,XOe as Og,JOe as Pg,ZOe as Qg,kT as Rg,ewe as Sg,twe as Tg,nwe as Ug,rwe as Vg,iwe as Wg,owe as Xg,swe as Yg,awe as Zg,cwe as _g,lwe as $g,uwe as ah,dwe as bh,hwe as ch,fwe as dh,gwe as eh,mwe as fh,pwe as gh,Ewe as hh,_we as ih,Twe as jh,Iwe as kh,vwe as lh,ywe as mh,Swe as nh,Awe as oh,sQ as ph,Dwe as qh,Rwe as rh,Cwe as sh,DV as th,Nwe as uh,Owe as vh,Ft as wh,Cn as xh,wwe as yh,kt as zh,Ht as Ah,bwe as Bh,GV as Ch,Sd as Dh,wC as Eh,Tr as Fh,Lwe as Gh,RV as Hh,TT as Ih,CAe as Jh,NAe as Kh,Pi as Lh,OAe as Mh,IT as Nh,wAe as Oh,bAe as Ph,vT as Qh,LAe as Rh,yT as Sh,MAe as Th,ST as Uh,PAe as Vh,ai as Wh,xAe as Xh,md as Yh,FAe as Zh,kAe as _h,UAe as $h,VAe as ai,BAe as bi,GAe as ci,$Ae as di,AT as ei,jAe as fi,HAe as gi,DT as hi,RT as ii,M1 as ji,P1 as ki,x1 as li,ci as mi,Lt as ni,_e as oi,Dr as pi,k2 as qi,It as ri,mv as si,pv as ti,Rr as ui,LM as vi,wxe as wi,bxe as xi,Lxe as yi,Mxe as zi,Xi as Ai,Hy as Bi,Wo as Ci,zo as Di,Hh as Ei,Za as Fi,Wh as Gi,zt as Hi,qy as Ii,Ky as Ji,Qy as Ki,Xy as Li,W3 as Mi,Jy as Ni,J3 as Oi,Gke as Pi};