@veltdev/sdk-staging 6.0.11 → 6.0.13

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 (75) hide show
  1. package/app/models/data/config.data.model.d.ts +18 -0
  2. package/app/models/data/user.data.model.d.ts +13 -0
  3. package/{chunk-F4PYCUAT.js → chunk-2LJHR77K.js} +1 -1
  4. package/chunk-4BAHMWIE.js +2 -0
  5. package/{chunk-IU25BW6T.js → chunk-4VEJIKFU.js} +1 -1
  6. package/{chunk-F36WWKDQ.js → chunk-4YEJYNMX.js} +1 -1
  7. package/chunk-5XJDGVGO.js +1 -0
  8. package/chunk-6YGRELTV.js +2 -0
  9. package/{chunk-BJRSXB3P.js → chunk-7TNGPXR5.js} +1 -1
  10. package/{chunk-JHMDMOHO.js → chunk-A4HLP4VU.js} +1 -1
  11. package/{chunk-QTF4Y24I.js → chunk-A6I23DJF.js} +1 -1
  12. package/chunk-DAUJEOMM.js +193 -0
  13. package/{chunk-FUYX2CTL.js → chunk-DZYVUUMS.js} +1 -1
  14. package/{chunk-VMW7PJFD.js → chunk-EMCGVIKG.js} +2 -2
  15. package/chunk-GHWFNVK2.js +1 -0
  16. package/chunk-IEOSSENF.js +1 -0
  17. package/chunk-IKXUU4LK.js +1 -0
  18. package/chunk-IQIWMWKJ.js +1 -0
  19. package/chunk-KJN6PDWN.js +93 -0
  20. package/chunk-KKKGHIG4.js +1 -0
  21. package/{chunk-EQBACTBQ.js → chunk-LOLURD74.js} +1 -1
  22. package/chunk-MUMFBRNH.js +2 -0
  23. package/{chunk-XISY42XO.js → chunk-NFQ33NZA.js} +1 -1
  24. package/{chunk-7RRXZUH7.js → chunk-NYRQTKJA.js} +1 -1
  25. package/{chunk-SYSCTHS4.js → chunk-Q2XHYKCH.js} +1 -1
  26. package/chunk-RSCWN2VG.js +1 -0
  27. package/chunk-STNBRDN3.js +1 -0
  28. package/chunk-SYWOQU23.js +174 -0
  29. package/{chunk-3ORHWUHZ.js → chunk-SZUD6M7J.js} +2 -2
  30. package/chunk-TE4S24VF.js +2 -0
  31. package/chunk-TG2UOHTU.js +1 -0
  32. package/chunk-UY5BYX47.js +1 -0
  33. package/chunk-V32SISMC.js +1 -0
  34. package/{chunk-UKJTOZK4.js → chunk-XXU7YXMF.js} +1 -1
  35. package/{chunk-SY46UNW5.js → chunk-YTVKKNRL.js} +1 -1
  36. package/{chunk-TW7O56QU.js → chunk-ZUQTUSHK.js} +1 -1
  37. package/package.json +1 -1
  38. package/velt-activity-log.js +1 -1
  39. package/velt-area.js +1 -1
  40. package/velt-arrow.js +1 -1
  41. package/velt-comment.js +7 -7
  42. package/velt-crdt.js +1 -1
  43. package/velt-cursor.js +1 -1
  44. package/velt-huddle.js +1 -1
  45. package/velt-live-state-sync.js +1 -1
  46. package/velt-notification.js +1 -1
  47. package/velt-portable.js +1 -0
  48. package/velt-presence.js +1 -1
  49. package/velt-reaction.js +1 -1
  50. package/velt-recorder.js +1 -1
  51. package/velt-rewriter.js +1 -1
  52. package/velt-selection.js +1 -1
  53. package/velt-tag.js +1 -1
  54. package/velt-user-invite.js +1 -1
  55. package/velt-user-request.js +1 -1
  56. package/velt-video-player.js +1 -1
  57. package/velt-views.js +3 -3
  58. package/velt.js +2 -2
  59. package/chunk-5R5ZQKPN.js +0 -1
  60. package/chunk-6RWQRJ7Z.js +0 -1
  61. package/chunk-AOHWVH4J.js +0 -193
  62. package/chunk-CI2SH5RY.js +0 -1
  63. package/chunk-CQX575C2.js +0 -1
  64. package/chunk-F44SU3DK.js +0 -2
  65. package/chunk-F6CKB7IS.js +0 -2
  66. package/chunk-F7SQEW6P.js +0 -93
  67. package/chunk-FVDWCK7Z.js +0 -1
  68. package/chunk-IBGPKEZW.js +0 -2
  69. package/chunk-ID3E7CBZ.js +0 -1
  70. package/chunk-M6DAI5DP.js +0 -1
  71. package/chunk-RLD74EXO.js +0 -1
  72. package/chunk-VKGZ33MA.js +0 -167
  73. package/chunk-VMY3F7K3.js +0 -2
  74. package/chunk-WFO2GRDO.js +0 -1
  75. package/chunk-ZJH32HDL.js +0 -1
package/chunk-VKGZ33MA.js DELETED
@@ -1,167 +0,0 @@
1
- var jz=Object.create;var nE=Object.defineProperty,Hz=Object.defineProperties,Wz=Object.getOwnPropertyDescriptor,zz=Object.getOwnPropertyDescriptors,qz=Object.getOwnPropertyNames,tE=Object.getOwnPropertySymbols,TP=Object.getPrototypeOf,CS=Object.prototype.hasOwnProperty,IP=Object.prototype.propertyIsEnumerable,Kz=Reflect.get;var _P=(r,e,n)=>e in r?nE(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,M=(r,e)=>{for(var n in e||={})CS.call(e,n)&&_P(r,n,e[n]);if(tE)for(var n of tE(e))IP.call(e,n)&&_P(r,n,e[n]);return r},le=(r,e)=>Hz(r,zz(e));var NS=(r,e)=>{var n={};for(var t in r)CS.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&tE)for(var t of tE(r))e.indexOf(t)<0&&IP.call(r,t)&&(n[t]=r[t]);return n};var cae=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},lae=(r,e)=>{for(var n in e)nE(r,n,{get:e[n],enumerable:!0})},Yz=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qz(e))!CS.call(r,i)&&i!==n&&nE(r,i,{get:()=>e[i],enumerable:!(t=Wz(e,i))||t.enumerable});return r};var uae=(r,e,n)=>(n=r!=null?jz(TP(r)):{},Yz(e||!r||!r.__esModule?nE(n,"default",{value:r,enumerable:!0}):n,r));var Rc=(r,e,n)=>Kz(TP(r),n,e);var I=(r,e,n)=>new Promise((t,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(r,e)).next())});function Se(r){return typeof r=="function"}function OS(r){return Se(r?.lift)}function ve(r){return e=>{if(OS(e))return e.lift(function(n){try{return r(n,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ys(r){let n=r(t=>{Error.call(t),t.stack=new Error().stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var rE=Ys(r=>function(n){r(this),this.message=n?`${n.length} errors occurred during unsubscription:
2
- ${n.map((t,i)=>`${i+1}) ${t.toString()}`).join(`
3
- `)}`:"",this.name="UnsubscriptionError",this.errors=n});function Dc(r,e){if(r){let n=r.indexOf(e);0<=n&&r.splice(n,1)}}var mt=class r{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:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(let o of n)o.remove(this);else n.remove(this);let{initialTeardown:t}=this;if(Se(t))try{t()}catch(o){e=o instanceof rE?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{vP(o)}catch(s){e=e??[],s instanceof rE?e=[...e,...s.errors]:e.push(s)}}if(e)throw new rE(e)}}add(e){var n;if(e&&e!==this)if(this.closed)vP(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}}_hasParent(e){let{_parentage:n}=this;return n===e||Array.isArray(n)&&n.includes(e)}_addParent(e){let{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e}_removeParent(e){let{_parentage:n}=this;n===e?this._parentage=null:Array.isArray(n)&&Dc(n,e)}remove(e){let{_finalizers:n}=this;n&&Dc(n,e),e instanceof r&&e._removeParent(this)}};mt.EMPTY=(()=>{let r=new mt;return r.closed=!0,r})();var bS=mt.EMPTY;function iE(r){return r instanceof mt||r&&"closed"in r&&Se(r.remove)&&Se(r.add)&&Se(r.unsubscribe)}function vP(r){Se(r)?r():r.unsubscribe()}var Ri={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Cu={setTimeout(r,e,...n){let{delegate:t}=Cu;return t?.setTimeout?t.setTimeout(r,e,...n):setTimeout(r,e,...n)},clearTimeout(r){let{delegate:e}=Cu;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function oE(r){Cu.setTimeout(()=>{let{onUnhandledError:e}=Ri;if(e)e(r);else throw r})}function Di(){}var yP=wS("C",void 0,void 0);function SP(r){return wS("E",void 0,r)}function AP(r){return wS("N",r,void 0)}function wS(r,e,n){return{kind:r,value:e,error:n}}var Cc=null;function Nu(r){if(Ri.useDeprecatedSynchronousErrorHandling){let e=!Cc;if(e&&(Cc={errorThrown:!1,error:null}),r(),e){let{errorThrown:n,error:t}=Cc;if(Cc=null,n)throw t}}else r()}function RP(r){Ri.useDeprecatedSynchronousErrorHandling&&Cc&&(Cc.errorThrown=!0,Cc.error=r)}var Nc=class extends mt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,iE(e)&&e.add(this)):this.destination=Jz}static create(e,n,t){return new Ci(e,n,t)}next(e){this.isStopped?MS(AP(e),this):this._next(e)}error(e){this.isStopped?MS(SP(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?MS(yP,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()}}},Qz=Function.prototype.bind;function LS(r,e){return Qz.call(r,e)}var PS=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:n}=this;if(n.next)try{n.next(e)}catch(t){sE(t)}}error(e){let{partialObserver:n}=this;if(n.error)try{n.error(e)}catch(t){sE(t)}else sE(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(n){sE(n)}}},Ci=class extends Nc{constructor(e,n,t){super();let i;if(Se(e)||!e)i={next:e??void 0,error:n??void 0,complete:t??void 0};else{let o;this&&Ri.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&LS(e.next,o),error:e.error&&LS(e.error,o),complete:e.complete&&LS(e.complete,o)}):i=e}this.destination=new PS(i)}};function sE(r){Ri.useDeprecatedSynchronousErrorHandling?RP(r):oE(r)}function Xz(r){throw r}function MS(r,e){let{onStoppedNotification:n}=Ri;n&&Cu.setTimeout(()=>n(r,e))}var Jz={closed:!0,next:Di,error:Xz,complete:Di};function Te(r,e,n,t,i){return new xS(r,e,n,t,i)}var xS=class extends Nc{constructor(e,n,t,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=n?function(a){try{n(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:n}=this;super.unsubscribe(),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function Rt(r,e){return ve((n,t)=>{let i=0;n.subscribe(Te(t,o=>r.call(e,o,i++)&&t.next(o)))})}var Ou=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ni(r){return r}function DP(r){return r.length===0?Ni:r.length===1?r[0]:function(n){return r.reduce((t,i)=>i(t),n)}}var pe=(()=>{class r{constructor(n){n&&(this._subscribe=n)}lift(n){let t=new r;return t.source=this,t.operator=n,t}subscribe(n,t,i){let o=e6(n)?n:new Ci(n,t,i);return Nu(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(n){try{return this._subscribe(n)}catch(t){n.error(t)}}forEach(n,t){return t=CP(t),new t((i,o)=>{let s=new Ci({next:a=>{try{n(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(n){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(n)}[Ou](){return this}pipe(...n){return DP(n)(this)}toPromise(n){return n=CP(n),new n((t,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>t(o))})}}return r.create=e=>new r(e),r})();function CP(r){var e;return(e=r??Ri.Promise)!==null&&e!==void 0?e:Promise}function Zz(r){return r&&Se(r.next)&&Se(r.error)&&Se(r.complete)}function e6(r){return r&&r instanceof Nc||Zz(r)&&iE(r)}var Oc=new pe(r=>r.complete());function Dt(r){return r<=0?()=>Oc:ve((e,n)=>{let t=0;e.subscribe(Te(n,i=>{++t<=r&&(n.next(i),r<=t&&n.complete())}))})}function FS(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(r,t[i])&&(n[t[i]]=r[t[i]]);return n}function OP(r,e,n,t){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=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(r,e||[])).next())})}function NP(r){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&r[e],t=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&t>=r.length&&(r=void 0),{value:r&&r[t++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bc(r){return this instanceof bc?(this.v=r,this):new bc(r)}function bP(r,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n.apply(r,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,D){o.push([g,_,T,D])>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 bc?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 wP(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],n;return e?e.call(r):(r=typeof NP=="function"?NP(r):r[Symbol.iterator](),n={},t("next"),t("throw"),t("return"),n[Symbol.asyncIterator]=function(){return this},n);function t(o){n[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[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 bu=r=>r&&typeof r.length=="number"&&typeof r!="function";function aE(r){return Se(r?.then)}function cE(r){return Se(r[Ou])}function lE(r){return Symbol.asyncIterator&&Se(r?.[Symbol.asyncIterator])}function uE(r){return new TypeError(`You provided ${r!==null&&typeof r=="object"?"an invalid object":`'${r}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function t6(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var dE=t6();function hE(r){return Se(r?.[dE])}function fE(r){return bP(this,arguments,function*(){let n=r.getReader();try{for(;;){let{value:t,done:i}=yield bc(n.read());if(i)return yield bc(void 0);yield yield bc(t)}}finally{n.releaseLock()}})}function gE(r){return Se(r?.getReader)}function Le(r){if(r instanceof pe)return r;if(r!=null){if(cE(r))return n6(r);if(bu(r))return r6(r);if(aE(r))return i6(r);if(lE(r))return LP(r);if(hE(r))return o6(r);if(gE(r))return s6(r)}throw uE(r)}function n6(r){return new pe(e=>{let n=r[Ou]();if(Se(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function r6(r){return new pe(e=>{for(let n=0;n<r.length&&!e.closed;n++)e.next(r[n]);e.complete()})}function i6(r){return new pe(e=>{r.then(n=>{e.closed||(e.next(n),e.complete())},n=>e.error(n)).then(null,oE)})}function o6(r){return new pe(e=>{for(let n of r)if(e.next(n),e.closed)return;e.complete()})}function LP(r){return new pe(e=>{a6(r,e).catch(n=>e.error(n))})}function s6(r){return LP(fE(r))}function a6(r,e){var n,t,i,o;return OP(this,void 0,void 0,function*(){try{for(n=wP(r);t=yield n.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=n.return)&&(yield o.call(n))}finally{if(i)throw i.error}}e.complete()})}function MP(r){return ve((e,n)=>{let t=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let l=i;i=null,n.next(l)}s&&n.complete()},c=()=>{o=null,s&&n.complete()};e.subscribe(Te(n,l=>{t=!0,i=l,o||Le(r(l)).subscribe(o=Te(n,a,c))},()=>{s=!0,(!t||!o||o.closed)&&n.complete()}))})}var mE=class extends mt{constructor(e,n){super()}schedule(e,n=0){return this}};var Rf={setInterval(r,e,...n){let{delegate:t}=Rf;return t?.setInterval?t.setInterval(r,e,...n):setInterval(r,e,...n)},clearInterval(r){let{delegate:e}=Rf;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var ao=class extends mE{constructor(e,n){super(e,n),this.scheduler=e,this.work=n,this.pending=!1}schedule(e,n=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,n)),this.pending=!0,this.delay=n,this.id=(t=this.id)!==null&&t!==void 0?t:this.requestAsyncId(o,this.id,n),this}requestAsyncId(e,n,t=0){return Rf.setInterval(e.flush.bind(e,this),t)}recycleAsyncId(e,n,t=0){if(t!=null&&this.delay===t&&this.pending===!1)return n;n!=null&&Rf.clearInterval(n)}execute(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let t=this._execute(e,n);if(t)return t;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,n){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:n}=this,{actions:t}=n;this.work=this.state=this.scheduler=null,this.pending=!1,Dc(t,this),e!=null&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,super.unsubscribe()}}};var wc={now(){return(wc.delegate||Date).now()},delegate:void 0};var wu=class r{constructor(e,n=r.now){this.schedulerActionCtor=e,this.now=n}schedule(e,n=0,t){return new this.schedulerActionCtor(this,e).schedule(t,n)}};wu.now=wc.now;var co=class extends wu{constructor(e,n=wu.now){super(e,n),this.actions=[],this._active=!1}flush(e){let{actions:n}=this;if(this._active){n.push(e);return}let t;this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,t){for(;e=n.shift();)e.unsubscribe();throw t}}};var $n=new co(ao),kS=$n;function pE(r){return r&&Se(r.schedule)}function EE(r){return r instanceof Date&&!isNaN(r)}function Oi(r=0,e,n=kS){let t=-1;return e!=null&&(pE(e)?n=e:t=e),new pe(i=>{let o=EE(r)?+r-n.now():r;o<0&&(o=0);let s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=t?this.schedule(void 0,t):i.complete())},o)})}function c6(r,e=$n){return MP(()=>Oi(r,e))}function US(r){return r[r.length-1]}function _E(r){return Se(US(r))?r.pop():void 0}function lo(r){return pE(US(r))?r.pop():void 0}function PP(r,e){return typeof US(r)=="number"?r.pop():e}function jn(r,e,n,t=0,i=!1){let o=e.schedule(function(){n(),i?r.add(this.schedule(null,t)):this.unsubscribe()},t);if(r.add(o),!i)return o}function as(r){return ve((e,n)=>{let t=null,i=!1,o;t=e.subscribe(Te(n,void 0,void 0,s=>{o=Le(r(s,as(r)(e))),t?(t.unsubscribe(),t=null,o.subscribe(n)):i=!0})),i&&(t.unsubscribe(),t=null,o.subscribe(n))})}var{isArray:l6}=Array,{getPrototypeOf:u6,prototype:d6,keys:h6}=Object;function TE(r){if(r.length===1){let e=r[0];if(l6(e))return{args:e,keys:null};if(f6(e)){let n=h6(e);return{args:n.map(t=>e[t]),keys:n}}}return{args:r,keys:null}}function f6(r){return r&&typeof r=="object"&&u6(r)===d6}function Qs(r,e=0){return ve((n,t)=>{n.subscribe(Te(t,i=>jn(t,r,()=>t.next(i),e),()=>jn(t,r,()=>t.complete(),e),i=>jn(t,r,()=>t.error(i),e)))})}function Xs(r,e=0){return ve((n,t)=>{t.add(r.schedule(()=>n.subscribe(t),e))})}function xP(r,e){return Le(r).pipe(Xs(e),Qs(e))}function FP(r,e){return Le(r).pipe(Xs(e),Qs(e))}function kP(r,e){return new pe(n=>{let t=0;return e.schedule(function(){t===r.length?n.complete():(n.next(r[t++]),n.closed||this.schedule())})})}function UP(r,e){return new pe(n=>{let t;return jn(n,e,()=>{t=r[dE](),jn(n,e,()=>{let i,o;try{({value:i,done:o}=t.next())}catch(s){n.error(s);return}o?n.complete():n.next(i)},0,!0)}),()=>Se(t?.return)&&t.return()})}function IE(r,e){if(!r)throw new Error("Iterable cannot be null");return new pe(n=>{jn(n,e,()=>{let t=r[Symbol.asyncIterator]();jn(n,e,()=>{t.next().then(i=>{i.done?n.complete():n.next(i.value)})},0,!0)})})}function VP(r,e){return IE(fE(r),e)}function BP(r,e){if(r!=null){if(cE(r))return xP(r,e);if(bu(r))return kP(r,e);if(aE(r))return FP(r,e);if(lE(r))return IE(r,e);if(hE(r))return UP(r,e);if(gE(r))return VP(r,e)}throw uE(r)}function Mr(r,e){return e?BP(r,e):Le(r)}function ge(r,e){return ve((n,t)=>{let i=0;n.subscribe(Te(t,o=>{t.next(r.call(e,o,i++))}))})}var{isArray:g6}=Array;function m6(r,e){return g6(e)?r(...e):r(e)}function Lu(r){return ge(e=>m6(r,e))}function vE(r,e){return r.reduce((n,t,i)=>(n[t]=e[i],n),{})}function ti(...r){let e=lo(r),n=_E(r),{args:t,keys:i}=TE(r);if(t.length===0)return Mr([],e);let o=new pe(p6(t,e,i?s=>vE(i,s):Ni));return n?o.pipe(Lu(n)):o}function p6(r,e,n=Ni){return t=>{GP(e,()=>{let{length:i}=r,o=new Array(i),s=i,a=i;for(let c=0;c<i;c++)GP(e,()=>{let l=Mr(r[c],e),u=!1;l.subscribe(Te(t,d=>{o[c]=d,u||(u=!0,a--),a||t.next(n(o.slice()))},()=>{--s||t.complete()}))},t)},t)}}function GP(r,e,n){r?jn(n,r,e):e()}function $P(r,e,n,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(n(_,u++)).subscribe(Te(e,D=>{i?.(D),o?g(D):e.next(D)},()=>{T=!0},void 0,()=>{if(T)try{for(l--;c.length&&l<t;){let D=c.shift();s?jn(e,s,()=>p(D)):p(D)}f()}catch(D){e.error(D)}}))};return r.subscribe(Te(e,g,()=>{d=!0,f()})),()=>{a?.()}}function uo(r,e,n=1/0){return Se(e)?uo((t,i)=>ge((o,s)=>e(t,o,i,s))(Le(r(t,i))),n):(typeof e=="number"&&(n=e),ve((t,i)=>$P(t,i,r,n)))}function jP(r,e,n,t,i){return(o,s)=>{let a=n,c=e,l=0;o.subscribe(Te(s,u=>{let d=l++;c=a?r(c,u,d):(a=!0,u),t&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}function yE(r=1/0){return uo(Ni,r)}function HP(){return yE(1)}function VS(r,e){return Se(e)?uo(r,e,1):uo(r,1)}var WP=Ys(r=>function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ct=(()=>{class r extends pe{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(n){let t=new SE(this,this);return t.operator=n,t}_throwIfClosed(){if(this.closed)throw new WP}next(n){Nu(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let t of this.currentObservers)t.next(n)}})}error(n){Nu(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=n;let{observers:t}=this;for(;t.length;)t.shift().error(n)}})}complete(){Nu(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:n}=this;for(;n.length;)n.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0}_trySubscribe(n){return this._throwIfClosed(),super._trySubscribe(n)}_subscribe(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)}_innerSubscribe(n){let{hasError:t,isStopped:i,observers:o}=this;return t||i?bS:(this.currentObservers=null,o.push(n),new mt(()=>{this.currentObservers=null,Dc(o,n)}))}_checkFinalizedStatuses(n){let{hasError:t,thrownError:i,isStopped:o}=this;t?n.error(i):o&&n.complete()}asObservable(){let n=new pe;return n.source=this,n}}return r.create=(e,n)=>new SE(e,n),r})(),SE=class extends Ct{constructor(e,n){super(),this.destination=e,this.source=n}next(e){var n,t;(t=(n=this.destination)===null||n===void 0?void 0:n.next)===null||t===void 0||t.call(n,e)}error(e){var n,t;(t=(n=this.destination)===null||n===void 0?void 0:n.error)===null||t===void 0||t.call(n,e)}complete(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)}_subscribe(e){var n,t;return(t=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&t!==void 0?t:bS}};function BS(r){return ve((e,n)=>{let t=!1,i=null,o=null,s=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let a=i;i=null,n.next(a)}};e.subscribe(Te(n,a=>{o?.unsubscribe(),t=!0,i=a,o=Te(n,s,Di),Le(r(a)).subscribe(o)},()=>{s(),n.complete()},void 0,()=>{i=o=null}))})}function Mu(r,e=$n){return ve((n,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+r,u=e.now();if(u<l){i=this.schedule(void 0,l-u),t.add(i);return}a()}n.subscribe(Te(t,l=>{o=l,s=e.now(),i||(i=e.schedule(c,r),t.add(i))},()=>{a(),t.complete()},void 0,()=>{o=i=null}))})}function Js(...r){return HP()(Mr(r,lo(r)))}function zP(){return ve((r,e)=>{r.subscribe(Te(e,Di))})}function qP(r){return ge(()=>r)}function GS(r,e){return e?n=>Js(e.pipe(Dt(1),zP()),n.pipe(GS(r))):uo((n,t)=>Le(r(n,t)).pipe(Dt(1),qP(n)))}function $S(r,e=$n){let n=Oi(r,e);return GS(()=>n)}function de(...r){let e=lo(r);return Mr(r,e)}function rt(r,e=Ni){return r=r??E6,ve((n,t)=>{let i,o=!0;n.subscribe(Te(t,s=>{let a=e(s);(o||!r(i,a))&&(o=!1,i=a,t.next(s))}))})}function E6(r,e){return r===e}var KP=Ys(r=>function(){r(this),this.name="EmptyError",this.message="no elements in sequence"});function Lc(r){return ve((e,n)=>{try{e.subscribe(n)}finally{n.add(r)}})}function YP(){return ve((r,e)=>{let n=null;r._refCount++;let t=Te(e,void 0,void 0,void 0,()=>{if(!r||r._refCount<=0||0<--r._refCount){n=null;return}let i=r._connection,o=n;n=null,i&&(!o||i===o)&&i.unsubscribe(),e.unsubscribe()});r.subscribe(t),t.closed||(n=r.connect())})}var jS=class extends pe{constructor(e,n){super(),this.source=e,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,OS(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 mt;let n=this.getSubject();e.add(this.source.subscribe(Te(n,void 0,()=>{this._teardown(),n.complete()},t=>{this._teardown(),n.error(t)},()=>this._teardown()))),e.closed&&(this._connection=null,e=mt.EMPTY)}return e}refCount(){return YP()(this)}};function Pu(){return ve((r,e)=>{let n,t=!1;r.subscribe(Te(e,i=>{let o=n;n=i,t&&e.next([o,i]),t=!0}))})}var Y=class extends Ct{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let n=super._subscribe(e);return!n.closed&&e.next(this._value),n}getValue(){let{hasError:e,thrownError:n,_value:t}=this;if(e)throw n;return this._throwIfClosed(),t}next(e){super.next(this._value=e)}};var Mc=class extends Ct{constructor(e=1/0,n=1/0,t=wc){super(),this._bufferSize=e,this._windowTime=n,this._timestampProvider=t,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=n===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,n)}next(e){let{isStopped:n,_buffer:t,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;n||(t.push(e),!i&&t.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let n=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),n}_trimBuffer(){let{_bufferSize:e,_timestampProvider:n,_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=n.now(),a=0;for(let c=1;c<t.length&&t[c]<=s;c+=2)a=c;a&&t.splice(0,a+1)}}};function _6(r=0,e=$n){return r<0&&(r=0),Oi(r,r,e)}function AE(r,e){return ve(jP(r,e,arguments.length>=2,!0))}function WS(r={}){let{connector:e=()=>new Ct,resetOnError:n=!0,resetOnComplete:t=!0,resetOnRefCountZero:i=!0}=r;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 D=c=c??e();T.add(()=>{l--,l===0&&!d&&!u&&(a=HS(p,i))}),D.subscribe(T),!s&&l>0&&(s=new Ci({next:L=>D.next(L),error:L=>{d=!0,f(),a=HS(g,n,L),D.error(L)},complete:()=>{u=!0,f(),a=HS(g,t),D.complete()}}),Le(_).subscribe(s))})(o)}}function HS(r,e,...n){if(e===!0){r();return}if(e===!1)return;let t=new Ci({next:()=>{t.unsubscribe(),r()}});return Le(e(...n)).subscribe(t)}function T6(r,e,n){let t,i=!1;return r&&typeof r=="object"?{bufferSize:t=1/0,windowTime:e=1/0,refCount:i=!1,scheduler:n}=r:t=r??1/0,WS({connector:()=>new Mc(t,e,n),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function zS(r){return Rt((e,n)=>r<=n)}function I6(r){return ve((e,n)=>{let t=!1,i=Te(n,()=>{i?.unsubscribe(),t=!0},Di);Le(r).subscribe(i),e.subscribe(Te(n,o=>t&&n.next(o)))})}function xu(...r){let e=lo(r);return ve((n,t)=>{(e?Js(r,n,e):Js(r,n)).subscribe(t)})}function pt(r,e){return ve((n,t)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&t.complete();n.subscribe(Te(t,c=>{i?.unsubscribe();let l=0,u=o++;Le(r(c,u)).subscribe(i=Te(t,d=>t.next(e?e(c,d,u,l++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function Zs(r){return ve((e,n)=>{Le(r).subscribe(Te(n,()=>n.complete(),Di)),!n.closed&&e.subscribe(n)})}function v6(r,e=!1){return ve((n,t)=>{let i=0;n.subscribe(Te(t,o=>{let s=r(o,i++);(s||e)&&t.next(o),!s&&t.complete()}))})}function ea(r,e,n){let t=Se(r)||e||n?{next:r,error:e,complete:n}:r;return t?ve((i,o)=>{var s;(s=t.subscribe)===null||s===void 0||s.call(t);let a=!0;i.subscribe(Te(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)}))}):Ni}function QP(r,e){return ve((n,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(r(p)).subscribe(Te(t,u,d)),g=()=>{if(s){s=!1;let p=a;a=null,t.next(p),!l&&f(p)}};n.subscribe(Te(t,p=>{s=!0,a=p,!(c&&!c.closed)&&(i?g():f(p))},()=>{l=!0,!(o&&s&&c&&!c.closed)&&t.complete()}))})}function y6(r,e=$n,n){let t=Oi(r,e);return QP(()=>t,n)}var S6=Ys(r=>function(n=null){r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n});function A6(r,e){let{first:n,each:t,with:i=R6,scheduler:o=e??$n,meta:s=null}=EE(r)?{first:r}:typeof r=="number"?{each:r}:r;if(n==null&&t==null)throw new TypeError("No timeout provided.");return ve((a,c)=>{let l,u,d=null,f=0,g=p=>{u=jn(c,o,()=>{try{l.unsubscribe(),Le(i({meta:s,lastValue:d,seen:f})).subscribe(c)}catch(_){c.error(_)}},p)};l=a.subscribe(Te(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(n!=null?typeof n=="number"?n:+n-o.now():t)})}function R6(r){throw new S6(r)}function D6(r=wc){return ge(e=>({value:e,timestamp:r.now()}))}var qS;function RE(){return qS}function ho(r){let e=qS;return qS=r,e}var XP=Symbol("NotFound");function Fu(r){return r===XP||r?.name==="\u0275NotFound"}var Hn=null,DE=!1,KS=1,C6=null,Tn=Symbol("SIGNAL");function Ae(r){let e=Hn;return Hn=r,e}function bE(){return Hn}var Pc={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 ku(r){if(DE)throw new Error("");if(Hn===null)return;Hn.consumerOnSignalRead(r);let e=Hn.producersTail;if(e!==void 0&&e.producer===r)return;let n,t=Hn.recomputing;if(t&&(n=e!==void 0?e.nextProducer:Hn.producers,n!==void 0&&n.producer===r)){Hn.producersTail=n,n.lastReadVersion=r.version;return}let i=r.consumersTail;if(i!==void 0&&i.consumer===Hn&&(!t||O6(i,Hn)))return;let o=Bu(Hn),s={producer:r,consumer:Hn,nextProducer:n,prevConsumer:i,lastReadVersion:r.version,nextConsumer:void 0};Hn.producersTail=s,e!==void 0?e.nextProducer=s:Hn.producers=s,o&&t0(r,s)}function JP(){KS++}function wE(r){if(!(Bu(r)&&!r.dirty)&&!(!r.dirty&&r.lastCleanEpoch===KS)){if(!r.producerMustRecompute(r)&&!Vu(r)){OE(r);return}r.producerRecomputeValue(r),OE(r)}}function YS(r){if(r.consumers===void 0)return;let e=DE;DE=!0;try{for(let n=r.consumers;n!==void 0;n=n.nextConsumer){let t=n.consumer;t.dirty||N6(t)}}finally{DE=e}}function QS(){return Hn?.consumerAllowSignalWrites!==!1}function N6(r){r.dirty=!0,YS(r),r.consumerMarkedDirty?.(r)}function OE(r){r.dirty=!1,r.lastCleanEpoch=KS}function xc(r){return r&&ZP(r),Ae(r)}function ZP(r){r.producersTail=void 0,r.recomputing=!0}function Uu(r,e){Ae(e),r&&e0(r)}function e0(r){r.recomputing=!1;let e=r.producersTail,n=e!==void 0?e.nextProducer:r.producers;if(n!==void 0){if(Bu(r))do n=XS(n);while(n!==void 0);e!==void 0?e.nextProducer=void 0:r.producers=void 0}}function Vu(r){for(let e=r.producers;e!==void 0;e=e.nextProducer){let n=e.producer,t=e.lastReadVersion;if(t!==n.version||(wE(n),t!==n.version))return!0}return!1}function Fc(r){if(Bu(r)){let e=r.producers;for(;e!==void 0;)e=XS(e)}r.producers=void 0,r.producersTail=void 0,r.consumers=void 0,r.consumersTail=void 0}function t0(r,e){let n=r.consumersTail,t=Bu(r);if(n!==void 0?(e.nextConsumer=n.nextConsumer,n.nextConsumer=e):(e.nextConsumer=void 0,r.consumers=e),e.prevConsumer=n,r.consumersTail=e,!t)for(let i=r.producers;i!==void 0;i=i.nextProducer)t0(i.producer,i)}function XS(r){let e=r.producer,n=r.nextProducer,t=r.nextConsumer,i=r.prevConsumer;if(r.nextConsumer=void 0,r.prevConsumer=void 0,t!==void 0?t.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=t;else if(e.consumers=t,!Bu(e)){let o=e.producers;for(;o!==void 0;)o=XS(o)}return n}function Bu(r){return r.consumerIsAlwaysLive||r.consumers!==void 0}function LE(r){C6?.(r)}function O6(r,e){let n=e.producersTail;if(n!==void 0){let t=e.producers;do{if(t===r)return!0;if(t===n)break;t=t.nextProducer}while(t!==void 0)}return!1}function ME(r,e){return Object.is(r,e)}function Cf(r,e){let n=Object.create(b6);n.computation=r,e!==void 0&&(n.equal=e);let t=()=>{if(wE(n),ku(n),n.value===Df)throw n.error;return n.value};return t[Tn]=n,LE(n),t}var CE=Symbol("UNSET"),NE=Symbol("COMPUTING"),Df=Symbol("ERRORED"),b6=le(M({},Pc),{value:CE,dirty:!0,error:null,equal:ME,kind:"computed",producerMustRecompute(r){return r.value===CE||r.value===NE},producerRecomputeValue(r){if(r.value===NE)throw new Error("");let e=r.value;r.value=NE;let n=xc(r),t,i=!1;try{t=r.computation(),Ae(null),i=e!==CE&&e!==Df&&t!==Df&&r.equal(e,t)}catch(o){t=Df,r.error=o}finally{Uu(r,n)}if(i){r.value=e;return}r.value=t,r.version++}});function w6(){throw new Error}var n0=w6;function r0(r){n0(r)}function JS(r){n0=r}var L6=null;function ZS(r,e){let n=Object.create(PE);n.value=r,e!==void 0&&(n.equal=e);let t=()=>i0(n);return t[Tn]=n,LE(n),[t,s=>Gu(n,s),s=>eA(n,s)]}function i0(r){return ku(r),r.value}function Gu(r,e){QS()||r0(r),r.equal(r.value,e)||(r.value=e,M6(r))}function eA(r,e){QS()||r0(r),Gu(r,e(r.value))}var PE=le(M({},Pc),{equal:ME,value:void 0,kind:"signal"});function M6(r){r.version++,JP(),YS(r),L6?.(r)}var $u={schedule(r){let e=requestAnimationFrame,n=cancelAnimationFrame,{delegate:t}=$u;t&&(e=t.requestAnimationFrame,n=t.cancelAnimationFrame);let i=e(o=>{n=void 0,r(o)});return new mt(()=>n?.(i))},requestAnimationFrame(...r){let{delegate:e}=$u;return(e?.requestAnimationFrame||requestAnimationFrame)(...r)},cancelAnimationFrame(...r){let{delegate:e}=$u;return(e?.cancelAnimationFrame||cancelAnimationFrame)(...r)},delegate:void 0};var P6=1,tA,nA={};function o0(r){return r in nA?(delete nA[r],!0):!1}var s0={setImmediate(r){let e=P6++;return nA[e]=!0,tA||(tA=Promise.resolve()),tA.then(()=>o0(e)&&r()),e},clearImmediate(r){o0(r)}};var{setImmediate:x6,clearImmediate:F6}=s0,Nf={setImmediate(...r){let{delegate:e}=Nf;return(e?.setImmediate||x6)(...r)},clearImmediate(r){let{delegate:e}=Nf;return(e?.clearImmediate||F6)(r)},delegate:void 0};var xE=class extends ao{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}requestAsyncId(e,n,t=0){return t!==null&&t>0?super.requestAsyncId(e,n,t):(e.actions.push(this),e._scheduled||(e._scheduled=Nf.setImmediate(e.flush.bind(e,void 0))))}recycleAsyncId(e,n,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,n,t);let{actions:o}=e;n!=null&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==n&&(Nf.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))}};var FE=class extends co{flush(e){this._active=!0;let n=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===n&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===n&&t.shift();)e.unsubscribe();throw i}}};var k6=new FE(xE);var kE=class extends ao{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}schedule(e,n=0){return n>0?super.schedule(e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)}execute(e,n){return n>0||this.closed?super.execute(e,n):this._execute(e,n)}requestAsyncId(e,n,t=0){return t!=null&&t>0||t==null&&this.delay>0?super.requestAsyncId(e,n,t):(e.flush(this),0)}};var UE=class extends co{};var rA=new UE(kE);var VE=class extends ao{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}requestAsyncId(e,n,t=0){return t!==null&&t>0?super.requestAsyncId(e,n,t):(e.actions.push(this),e._scheduled||(e._scheduled=$u.requestAnimationFrame(()=>e.flush(void 0))))}recycleAsyncId(e,n,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,n,t);let{actions:o}=e;n!=null&&n===e._scheduled&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==n&&($u.cancelAnimationFrame(n),e._scheduled=void 0)}};var BE=class extends co{flush(e){this._active=!0;let n;e?n=e.id:(n=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===n&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===n&&t.shift();)e.unsubscribe();throw i}}};var U6=new BE(VE);function V6(r){return!!r&&(r instanceof pe||Se(r.lift)&&Se(r.subscribe))}function B6(r,e){let n=typeof e=="object";return new Promise((t,i)=>{let o=new Ci({next:s=>{t(s),o.unsubscribe()},error:i,complete:()=>{n?t(e.defaultValue):i(new KP)}});r.subscribe(o)})}function iA(r){return new pe(e=>{Le(r()).subscribe(e)})}function G6(...r){let e=_E(r),{args:n,keys:t}=TE(r),i=new pe(o=>{let{length:s}=n;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(n[u]).subscribe(Te(o,f=>{d||(d=!0,l--),a[u]=f},()=>c--,void 0,()=>{(!c||!d)&&(l||o.next(t?vE(t,a):a),o.complete())}))}});return e?i.pipe(Lu(e)):i}var $6=["addListener","removeListener"],j6=["addEventListener","removeEventListener"],H6=["on","off"];function fo(r,e,n,t){if(Se(n)&&(t=n,n=void 0),t)return fo(r,e,n).pipe(Lu(t));let[i,o]=q6(r)?j6.map(s=>a=>r[s](e,a,n)):W6(r)?$6.map(a0(r,e)):z6(r)?H6.map(a0(r,e)):[];if(!i&&bu(r))return uo(s=>fo(s,e,n))(Le(r));if(!i)throw new TypeError("Invalid event target");return new pe(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function a0(r,e){return n=>t=>r[n](e,t)}function W6(r){return Se(r.addListener)&&Se(r.removeListener)}function z6(r){return Se(r.on)&&Se(r.off)}function q6(r){return Se(r.addEventListener)&&Se(r.removeEventListener)}function K6(r,e,n){return iA(()=>r()?e:n)}function ju(...r){let e=lo(r),n=PP(r,1/0),t=r;return t.length?t.length===1?Le(t[0]):yE(n)(Mr(t,e)):Oc}function c0(r){let e=Ae(null);try{return r()}finally{Ae(e)}}var l0=le(M({},Pc),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function u0(r){if(r.dirty=!1,r.version>0&&!Vu(r))return;r.version++;let e=xc(r);try{r.cleanup(),r.fn()}finally{Uu(r,e)}}var Uc=class{full;major;minor;patch;constructor(e){this.full=e;let n=e.split(".");this.major=n[0],this.minor=n[1],this.patch=n.slice(2).join(".")}},pA=new Uc("20.3.27");var HE="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",oe=class extends Error{code;constructor(e,n){super(ra(e,n)),this.code=e}};function Y6(r){return`NG0${Math.abs(r)}`}function ra(r,e){return`${Y6(r)}${e?": "+e:""}`}var Kt=globalThis;function Qe(r){for(let e in r)if(r[e]===Qe)return e;throw Error("")}function f0(r,e){for(let n in e)e.hasOwnProperty(n)&&!r.hasOwnProperty(n)&&(r[n]=e[n])}function ls(r){if(typeof r=="string")return r;if(Array.isArray(r))return`[${r.map(ls).join(", ")}]`;if(r==null)return""+r;let e=r.overriddenName||r.name;if(e)return`${e}`;let n=r.toString();if(n==null)return""+n;let t=n.indexOf(`
4
- `);return t>=0?n.slice(0,t):n}function WE(r,e){return r?e?`${r} ${e}`:r:e||""}var Q6=Qe({__forward_ref__:Qe});function zE(r){return r.__forward_ref__=zE,r.toString=function(){return ls(this())},r}function sn(r){return EA(r)?r():r}function EA(r){return typeof r=="function"&&r.hasOwnProperty(Q6)&&r.__forward_ref__===zE}function K(r){return{token:r.token,providedIn:r.providedIn||null,factory:r.factory,value:void 0}}function us(r){return{providers:r.providers||[],imports:r.imports||[]}}function qE(r){return X6(r,KE)}function X6(r,e){return r.hasOwnProperty(e)&&r[e]||null}function J6(r){let e=r?.[KE]??null;return e||null}function sA(r){return r&&r.hasOwnProperty($E)?r[$E]:null}var KE=Qe({\u0275prov:Qe}),$E=Qe({\u0275inj:Qe}),ee=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,n){this._desc=e,this.\u0275prov=void 0,typeof n=="number"?this.__NG_ELEMENT_ID__=n:n!==void 0&&(this.\u0275prov=K({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function _A(r){return r&&!!r.\u0275providers}var TA=Qe({\u0275cmp:Qe}),IA=Qe({\u0275dir:Qe}),vA=Qe({\u0275pipe:Qe}),yA=Qe({\u0275mod:Qe}),bf=Qe({\u0275fac:Qe}),$c=Qe({__NG_ELEMENT_ID__:Qe}),d0=Qe({__NG_ENV_ID__:Qe});function xr(r){return typeof r=="string"?r:r==null?"":String(r)}function g0(r){return typeof r=="function"?r.name||r.toString():typeof r=="object"&&r!=null&&typeof r.type=="function"?r.type.name||r.type.toString():xr(r)}var m0=Qe({ngErrorCode:Qe}),Z6=Qe({ngErrorMessage:Qe}),e4=Qe({ngTokenPath:Qe});function SA(r,e){return p0("",-200,e)}function YE(r,e){throw new oe(-201,!1)}function p0(r,e,n){let t=new oe(e,r);return t[m0]=e,t[Z6]=r,n&&(t[e4]=n),t}function t4(r){return r[m0]}var aA;function E0(){return aA}function rr(r){let e=aA;return aA=r,e}function AA(r,e,n){let t=qE(r);if(t&&t.providedIn=="root")return t.value===void 0?t.value=t.factory():t.value;if(n&8)return null;if(e!==void 0)return e;YE(r,"Injector")}var n4={},kc=n4,cA="__NG_DI_FLAG__",lA=class{injector;constructor(e){this.injector=e}retrieve(e,n){let t=Vc(n)||0;try{return this.injector.get(e,t&8?null:kc,t)}catch(i){if(Fu(i))return i;throw i}}};function r4(r,e=0){let n=RE();if(n===void 0)throw new oe(-203,!1);if(n===null)return AA(r,void 0,e);{let t=i4(e),i=n.retrieve(r,t);if(Fu(i)){if(t.optional)return null;throw i}return i}}function C(r,e=0){return(E0()||r4)(sn(r),e)}function J(r,e){return C(r,Vc(e))}function Vc(r){return typeof r>"u"||typeof r=="number"?r:0|(r.optional&&8)|(r.host&&1)|(r.self&&2)|(r.skipSelf&&4)}function i4(r){return{optional:!!(r&8),host:!!(r&1),self:!!(r&2),skipSelf:!!(r&4)}}function uA(r){let e=[];for(let n=0;n<r.length;n++){let t=sn(r[n]);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=o4(a);typeof c=="number"?c===-1?i=a.token:o|=c:i=a}e.push(C(i,o))}else e.push(C(t))}return e}function RA(r,e){return r[cA]=e,r.prototype[cA]=e,r}function o4(r){return r[cA]}function ta(r,e){let n=r.hasOwnProperty(bf);return n?r[bf]:null}function _0(r,e,n){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let i=r[t],o=e[t];if(n&&(i=n(i),o=n(o)),o!==i)return!1}return!0}function T0(r){return r.flat(Number.POSITIVE_INFINITY)}function QE(r,e){r.forEach(n=>Array.isArray(n)?QE(n,e):e(n))}function DA(r,e,n){e>=r.length?r.push(n):r.splice(e,0,n)}function Mf(r,e){return e>=r.length-1?r.pop():r.splice(e,1)[0]}function I0(r,e){let n=[];for(let t=0;t<r;t++)n.push(e);return n}function v0(r,e,n,t){let i=r.length;if(i==e)r.push(n,t);else if(i===1)r.push(t,r[0]),r[0]=n;else{for(i--,r.push(r[i-1],r[i]);i>e;){let o=i-2;r[i]=r[o],i--}r[e]=n,r[e+1]=t}}function Pf(r,e,n){let t=Wu(r,e);return t>=0?r[t|1]=n:(t=~t,v0(r,t,e,n)),t}function XE(r,e){let n=Wu(r,e);if(n>=0)return r[n|1]}function Wu(r,e){return s4(r,e,1)}function s4(r,e,n){let t=0,i=r.length>>n;for(;i!==t;){let o=t+(i-t>>1),s=r[o<<n];if(e===s)return o<<n;s>e?i=o:t=o+1}return~(i<<n)}var bi={},Wn=[],ia=new ee(""),CA=new ee("",-1),NA=new ee(""),wf=class{get(e,n=kc){if(n===kc){let i=p0("",-201);throw i.name="\u0275NotFound",i}return n}};function y0(r){return r[yA]||null}function oa(r){return r[TA]||null}function JE(r){return r[IA]||null}function OA(r){return r[vA]||null}function pr(r){return{\u0275providers:r}}function S0(...r){return{\u0275providers:bA(!0,r),\u0275fromNgModule:!0}}function bA(r,...e){let n=[],t=new Set,i,o=s=>{n.push(s)};return QE(e,s=>{let a=s;jE(a,o,[],t)&&(i||=[],i.push(a))}),i!==void 0&&A0(i,o),n}function A0(r,e){for(let n=0;n<r.length;n++){let{ngModule:t,providers:i}=r[n];wA(i,o=>{e(o,t)})}}function jE(r,e,n,t){if(r=sn(r),!r)return!1;let i=null,o=sA(r),s=!o&&oa(r);if(!o&&!s){let c=r.ngModule;if(o=sA(c),o)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=r}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)jE(l,e,n,t)}}else if(o){if(o.imports!=null&&!a){t.add(i);let l;QE(o.imports,u=>{jE(u,e,n,t)&&(l||=[],l.push(u))}),l!==void 0&&A0(l,e)}if(!a){let l=ta(i)||(()=>new i);e({provide:i,useFactory:l,deps:Wn},i),e({provide:NA,useValue:i,multi:!0},i),e({provide:ia,useValue:()=>C(i),multi:!0},i)}let c=o.providers;if(c!=null&&!a){let l=r;wA(c,u=>{e(u,l)})}}else return!1;return i!==r&&r.providers!==void 0}function wA(r,e){for(let n of r)_A(n)&&(n=n.\u0275providers),Array.isArray(n)?wA(n,e):e(n)}var a4=Qe({provide:String,useValue:Qe});function R0(r){return r!==null&&typeof r=="object"&&a4 in r}function c4(r){return!!(r&&r.useExisting)}function l4(r){return!!(r&&r.useFactory)}function Bc(r){return typeof r=="function"}function D0(r){return!!r.useClass}var xf=new ee(""),GE={},h0={},oA;function zu(){return oA===void 0&&(oA=new wf),oA}var zn=class{},Gc=class extends zn{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,n,t,i){super(),this.parent=n,this.source=t,this.scopes=i,hA(e,s=>this.processProvider(s)),this.records.set(CA,Hu(void 0,this)),i.has("environment")&&this.records.set(zn,Hu(void 0,this));let o=this.records.get(xf);o!=null&&typeof o.value=="string"&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(NA,Wn,{self:!0}))}retrieve(e,n){let t=Vc(n)||0;try{return this.get(e,kc,t)}catch(i){if(Fu(i))return i;throw i}}destroy(){Of(this),this._destroyed=!0;let e=Ae(null);try{for(let t of this._ngOnDestroyHooks)t.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let t of n)t()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Ae(e)}}onDestroy(e){return Of(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){Of(this);let n=ho(this),t=rr(void 0),i;try{return e()}finally{ho(n),rr(t)}}get(e,n=kc,t){if(Of(this),e.hasOwnProperty(d0))return e[d0](this);let i=Vc(t),o,s=ho(this),a=rr(void 0);try{if(!(i&4)){let l=this.records.get(e);if(l===void 0){let u=g4(e)&&qE(e);u&&this.injectableDefInScope(u)?l=Hu(dA(e),GE):l=null,this.records.set(e,l)}if(l!=null)return this.hydrate(e,l,i)}let c=i&2?zu():this.parent;return n=i&8&&n===kc?null:n,c.get(e,n)}catch(c){let l=t4(c);throw l===-200||l===-201?new oe(l,null):c}finally{rr(a),ho(s)}}resolveInjectorInitializers(){let e=Ae(null),n=ho(this),t=rr(void 0),i;try{let o=this.get(ia,Wn,{self:!0});for(let s of o)s()}finally{ho(n),rr(t),Ae(e)}}toString(){let e=[],n=this.records;for(let t of n.keys())e.push(ls(t));return`R3Injector[${e.join(", ")}]`}processProvider(e){e=sn(e);let n=Bc(e)?e:sn(e&&e.provide),t=d4(e);if(!Bc(e)&&e.multi===!0){let i=this.records.get(n);i||(i=Hu(void 0,GE,!0),i.factory=()=>uA(i.multi),this.records.set(n,i)),n=e,i.multi.push(e)}this.records.set(n,t)}hydrate(e,n,t){let i=Ae(null);try{if(n.value===h0)throw SA(ls(e));return n.value===GE&&(n.value=h0,n.value=n.factory(void 0,t)),typeof n.value=="object"&&n.value&&f4(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{Ae(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let n=sn(e.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(e){let n=this._onDestroyHooks.indexOf(e);n!==-1&&this._onDestroyHooks.splice(n,1)}};function dA(r){let e=qE(r),n=e!==null?e.factory:ta(r);if(n!==null)return n;if(r instanceof ee)throw new oe(204,!1);if(r instanceof Function)return u4(r);throw new oe(204,!1)}function u4(r){if(r.length>0)throw new oe(204,!1);let n=J6(r);return n!==null?()=>n.factory(r):()=>new r}function d4(r){if(R0(r))return Hu(void 0,r.useValue);{let e=LA(r);return Hu(e,GE)}}function LA(r,e,n){let t;if(Bc(r)){let i=sn(r);return ta(i)||dA(i)}else if(R0(r))t=()=>sn(r.useValue);else if(l4(r))t=()=>r.useFactory(...uA(r.deps||[]));else if(c4(r))t=(i,o)=>C(sn(r.useExisting),o!==void 0&&o&8?8:void 0);else{let i=sn(r&&(r.useClass||r.provide));if(h4(r))t=()=>new i(...uA(r.deps));else return ta(i)||dA(i)}return t}function Of(r){if(r.destroyed)throw new oe(205,!1)}function Hu(r,e,n=!1){return{factory:r,value:e,multi:n?[]:void 0}}function h4(r){return!!r.deps}function f4(r){return r!==null&&typeof r=="object"&&typeof r.ngOnDestroy=="function"}function g4(r){return typeof r=="function"||typeof r=="object"&&r.ngMetadataName==="InjectionToken"}function hA(r,e){for(let n of r)Array.isArray(n)?hA(n,e):n&&_A(n)?hA(n.\u0275providers,e):e(n)}function go(r,e){let n;r instanceof Gc?(Of(r),n=r):n=new lA(r);let t,i=ho(n),o=rr(void 0);try{return e()}finally{ho(i),rr(o)}}function MA(){return E0()!==void 0||RE()!=null}var wi=0,Ie=1,Re=2,an=3,ri=4,ir=5,jc=6,qu=7,Bt=8,ds=9,mo=10,Xe=11,Ku=12,PA=13,Hc=14,qn=15,sa=16,Wc=17,po=18,Ff=19,xA=20,cs=21,ZE=22,hs=23,Fr=24,zc=25,qc=26,Je=27,C0=1,FA=6,aa=7,kf=8,Kc=9,Gt=10;function Eo(r){return Array.isArray(r)&&typeof r[C0]=="object"}function Li(r){return Array.isArray(r)&&r[C0]===!0}function kA(r){return(r.flags&4)!==0}function fs(r){return r.componentOffset>-1}function Yu(r){return(r.flags&1)===1}function Mi(r){return!!r.template}function Qu(r){return(r[Re]&512)!==0}function Yc(r){return(r[Re]&256)===256}var UA="svg",N0="math";function ii(r){for(;Array.isArray(r);)r=r[wi];return r}function VA(r,e){return ii(e[r])}function oi(r,e){return ii(e[r.index])}function Uf(r,e){return r.data[e]}function Qc(r,e){return r[e]}function Vf(r,e,n,t){n>=r.data.length&&(r.data[n]=null,r.blueprint[n]=null),e[n]=t}function si(r,e){let n=e[r];return Eo(n)?n:n[wi]}function O0(r){return(r[Re]&4)===4}function e_(r){return(r[Re]&128)===128}function b0(r){return Li(r[an])}function kr(r,e){return e==null?null:r[e]}function BA(r){r[Wc]=0}function t_(r){r[Re]&1024||(r[Re]|=1024,e_(r)&&ca(r))}function w0(r,e){for(;r>0;)e=e[Hc],r--;return e}function Xu(r){return!!(r[Re]&9216||r[Fr]?.dirty)}function n_(r){r[mo].changeDetectionScheduler?.notify(8),r[Re]&64&&(r[Re]|=1024),Xu(r)&&ca(r)}function ca(r){r[mo].changeDetectionScheduler?.notify(0);let e=na(r);for(;e!==null&&!(e[Re]&8192||(e[Re]|=8192,!e_(e)));)e=na(e)}function GA(r,e){if(Yc(r))throw new oe(911,!1);r[cs]===null&&(r[cs]=[]),r[cs].push(e)}function L0(r,e){if(r[cs]===null)return;let n=r[cs].indexOf(e);n!==-1&&r[cs].splice(n,1)}function na(r){let e=r[an];return Li(e)?e[an]:e}function $A(r){return r[qu]??=[]}function jA(r){return r.cleanup??=[]}function M0(r,e,n,t){let i=$A(e);i.push(n),r.firstCreatePass&&jA(r).push(t,i.length-1)}var Oe={lFrame:W0(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var fA=!1;function P0(){return Oe.lFrame.elementDepthCount}function x0(){Oe.lFrame.elementDepthCount++}function HA(){Oe.lFrame.elementDepthCount--}function r_(){return Oe.bindingsEnabled}function WA(){return Oe.skipHydrationRootTNode!==null}function zA(r){return Oe.skipHydrationRootTNode===r}function qA(){Oe.skipHydrationRootTNode=null}function ce(){return Oe.lFrame.lView}function Ze(){return Oe.lFrame.tView}function F0(r){return Oe.lFrame.contextLView=r,r[Bt]}function k0(r){return Oe.lFrame.contextLView=null,r}function cn(){let r=KA();for(;r!==null&&r.type===64;)r=r.parent;return r}function KA(){return Oe.lFrame.currentTNode}function U0(){let r=Oe.lFrame,e=r.currentTNode;return r.isParent?e:e.parent}function Xc(r,e){let n=Oe.lFrame;n.currentTNode=r,n.isParent=e}function YA(){return Oe.lFrame.isParent}function QA(){Oe.lFrame.isParent=!1}function XA(){return Oe.lFrame.contextLView}function JA(){return fA}function Ju(r){let e=fA;return fA=r,e}function or(){let r=Oe.lFrame,e=r.bindingRootIndex;return e===-1&&(e=r.bindingRootIndex=r.tView.bindingStartIndex),e}function ZA(){return Oe.lFrame.bindingIndex}function V0(r){return Oe.lFrame.bindingIndex=r}function _o(){return Oe.lFrame.bindingIndex++}function Bf(r){let e=Oe.lFrame,n=e.bindingIndex;return e.bindingIndex=e.bindingIndex+r,n}function B0(){return Oe.lFrame.inI18n}function G0(r,e){let n=Oe.lFrame;n.bindingIndex=n.bindingRootIndex=r,i_(e)}function $0(){return Oe.lFrame.currentDirectiveIndex}function i_(r){Oe.lFrame.currentDirectiveIndex=r}function j0(r){let e=Oe.lFrame.currentDirectiveIndex;return e===-1?null:r[e]}function o_(){return Oe.lFrame.currentQueryIndex}function Gf(r){Oe.lFrame.currentQueryIndex=r}function m4(r){let e=r[Ie];return e.type===2?e.declTNode:e.type===1?r[ir]:null}function eR(r,e,n){if(n&4){let i=e,o=r;for(;i=i.parent,i===null&&!(n&1);)if(i=m4(o),i===null||(o=o[Hc],i.type&10))break;if(i===null)return!1;e=i,r=o}let t=Oe.lFrame=H0();return t.currentTNode=e,t.lView=r,!0}function s_(r){let e=H0(),n=r[Ie];Oe.lFrame=e,e.currentTNode=n.firstChild,e.lView=r,e.tView=n,e.contextLView=r,e.bindingIndex=n.bindingStartIndex,e.inI18n=!1}function H0(){let r=Oe.lFrame,e=r===null?null:r.child;return e===null?W0(r):e}function W0(r){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:r,child:null,inI18n:!1};return r!==null&&(r.child=e),e}function z0(){let r=Oe.lFrame;return Oe.lFrame=r.parent,r.currentTNode=null,r.lView=null,r}var tR=z0;function a_(){let r=z0();r.isParent=!0,r.tView=null,r.selectedIndex=-1,r.contextLView=null,r.elementDepthCount=0,r.currentDirectiveIndex=-1,r.currentNamespace=null,r.bindingRootIndex=-1,r.bindingIndex=-1,r.currentQueryIndex=0}function q0(r){return(Oe.lFrame.contextLView=w0(r,Oe.lFrame.contextLView))[Bt]}function ai(){return Oe.lFrame.selectedIndex}function la(r){Oe.lFrame.selectedIndex=r}function Zu(){let r=Oe.lFrame;return Uf(r.tView,r.selectedIndex)}function K0(){Oe.lFrame.currentNamespace=UA}function Y0(){p4()}function p4(){Oe.lFrame.currentNamespace=null}function nR(){return Oe.lFrame.currentNamespace}var Q0=!0;function c_(){return Q0}function $f(r){Q0=r}function gA(r,e=null,n=null,t){let i=rR(r,e,n,t);return i.resolveInjectorInitializers(),i}function rR(r,e=null,n=null,t,i=new Set){let o=[n||Wn,S0(r)];return t=t||(typeof r=="object"?void 0:ls(r)),new Gc(o,e||zu(),t||null,i)}var lt=class r{static THROW_IF_NOT_FOUND=kc;static NULL=new wf;static create(e,n){if(Array.isArray(e))return gA({name:""},n,e,"");{let t=e.name??"";return gA({name:t},e.parent,e.providers,t)}}static \u0275prov=K({token:r,providedIn:"any",factory:()=>C(CA)});static __NG_ELEMENT_ID__=-1},In=new ee(""),sr=(()=>{class r{static __NG_ELEMENT_ID__=E4;static __NG_ENV_ID__=n=>n}return r})(),Lf=class extends sr{_lView;constructor(e){super(),this._lView=e}get destroyed(){return Yc(this._lView)}onDestroy(e){let n=this._lView;return GA(n,e),()=>L0(n,e)}};function E4(){return new Lf(ce())}var Pr=class{_console=console;handleError(e){this._console.error("ERROR",e)}},To=new ee("",{providedIn:"root",factory:()=>{let r=J(zn),e;return n=>{r.destroyed&&!e?setTimeout(()=>{throw n}):(e??=r.get(Pr),e.handleError(n))}}}),X0={provide:ia,useValue:()=>{J(Pr)},multi:!0};function Io(r){return typeof r=="function"&&r[Tn]!==void 0}function Jc(r,e){let[n,t,i]=ZS(r,e?.equal),o=n,s=o[Tn];return o.set=t,o.update=i,o.asReadonly=iR.bind(o),o}function iR(){let r=this[Tn];if(r.readonlyFn===void 0){let e=()=>this();e[Tn]=r,r.readonlyFn=e}return r.readonlyFn}function oR(r){return Io(r)&&typeof r.set=="function"}var ed=(()=>{class r{view;node;constructor(n,t){this.view=n,this.node=t}static __NG_ELEMENT_ID__=_4}return r})();function _4(){return new ed(ce(),cn())}var ni=class{},td=new ee("",{providedIn:"root",factory:()=>!1});var sR=new ee(""),l_=new ee(""),ua=(()=>{class r{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 pe(n=>{n.next(!1),n.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),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:r,providedIn:"root",factory:()=>new r})}return r})(),vo=(()=>{class r{internalPendingTasks=J(ua);scheduler=J(ni);errorHandler=J(To);add(){let n=this.internalPendingTasks.add();return()=>{this.internalPendingTasks.has(n)&&(this.scheduler.notify(11),this.internalPendingTasks.remove(n))}}run(n){let t=this.add();n().catch(this.errorHandler).finally(t)}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})();function Zc(...r){}var jf=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:()=>new mA})}return r})(),mA=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let n=e.zone,t=this.queues.get(n);t.has(e)&&(t.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let n=e.zone;this.queues.has(n)||this.queues.set(n,new Set);let t=this.queues.get(n);t.has(e)||t.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[n,t]of this.queues)n===null?e||=this.flushQueue(t):e||=n.run(()=>this.flushQueue(t));e||(this.dirtyEffectCount=0)}}flushQueue(e){let n=!1;for(let t of e)t.dirty&&(this.dirtyEffectCount--,n=!0,t.run());return n}};function md(r){return{toString:r}.toString()}var u_="__parameters__";function R4(r){return function(...n){if(r){let t=r(...n);for(let i in t)this[i]=t[i]}}}function Px(r,e,n){return md(()=>{let t=R4(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(u_)?c[u_]:Object.defineProperty(c,u_,{value:[]})[u_];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),c}}return i.prototype.ngMetadataName=r,i.annotationCls=i,i})}var D4=RA(Px("Inject",r=>({token:r})),-1),un=RA(Px("Optional"),8);function xx(r){let e=Kt.ng;if(e&&e.\u0275compilerFacade)return e.\u0275compilerFacade;throw new Error("JIT compiler unavailable")}function C4(r){return typeof r=="function"}var y_=class{previousValue;currentValue;firstChange;constructor(e,n,t){this.previousValue=e,this.currentValue=n,this.firstChange=t}isFirstChange(){return this.firstChange}};function Fx(r,e,n,t){e!==null?e.applyValueToInputSignal(e,t):r[n]=t}var rD=(()=>{let r=()=>kx;return r.ngInherit=!0,r})();function kx(r){return r.type.prototype.ngOnChanges&&(r.setInput=O4),N4}function N4(){let r=Vx(this),e=r?.current;if(e){let n=r.previous;if(n===bi)r.previous=e;else for(let t in e)n[t]=e[t];r.current=null,this.ngOnChanges(e)}}function O4(r,e,n,t,i){let o=this.declaredInputs[t],s=Vx(r)||b4(r,{previous:bi,current:null}),a=s.current||(s.current={}),c=s.previous,l=c[o];a[o]=new y_(l&&l.currentValue,n,c===bi),Fx(r,e,i,n)}var Ux="__ngSimpleChanges__";function Vx(r){return r[Ux]||null}function b4(r,e){return r[Ux]=e}var J0=[];var ut=function(r,e=null,n){for(let t=0;t<J0.length;t++){let i=J0[t];i(r,e,n)}};function w4(r,e,n){let{ngOnChanges:t,ngOnInit:i,ngDoCheck:o}=e.type.prototype;if(t){let s=kx(e);(n.preOrderHooks??=[]).push(r,s),(n.preOrderCheckHooks??=[]).push(r,s)}i&&(n.preOrderHooks??=[]).push(0-r,i),o&&((n.preOrderHooks??=[]).push(r,o),(n.preOrderCheckHooks??=[]).push(r,o))}function Bx(r,e){for(let n=e.directiveStart,t=e.directiveEnd;n<t;n++){let o=r.data[n].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:l,ngOnDestroy:u}=o;s&&(r.contentHooks??=[]).push(-n,s),a&&((r.contentHooks??=[]).push(n,a),(r.contentCheckHooks??=[]).push(n,a)),c&&(r.viewHooks??=[]).push(-n,c),l&&((r.viewHooks??=[]).push(n,l),(r.viewCheckHooks??=[]).push(n,l)),u!=null&&(r.destroyHooks??=[]).push(n,u)}}function E_(r,e,n){Gx(r,e,3,n)}function __(r,e,n,t){(r[Re]&3)===n&&Gx(r,e,n,t)}function aR(r,e){let n=r[Re];(n&3)===e&&(n&=16383,n+=1,r[Re]=n)}function Gx(r,e,n,t){let i=t!==void 0?r[Wc]&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&&(r[Wc]+=65536),(a<o||o==-1)&&(L4(r,n,e,c),r[Wc]=(r[Wc]&4294901760)+c+2),c++}function Z0(r,e){ut(4,r,e);let n=Ae(null);try{e.call(r)}finally{Ae(n),ut(5,r,e)}}function L4(r,e,n,t){let i=n[t]<0,o=n[t+1],s=i?-n[t]:n[t],a=r[s];i?r[Re]>>14<r[Wc]>>16&&(r[Re]&3)===e&&(r[Re]+=16384,Z0(a,o)):Z0(a,o)}var rd=-1,tl=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,n,t,i){this.factory=e,this.name=i,this.canSeeViewProviders=n,this.injectImpl=t}};function M4(r){return(r.flags&8)!==0}function P4(r){return(r.flags&16)!==0}function x4(r,e,n){let t=0;for(;t<n.length;){let i=n[t];if(typeof i=="number"){if(i!==0)break;t++;let o=n[t++],s=n[t++],a=n[t++];r.setAttribute(e,s,a,o)}else{let o=i,s=n[++t];k4(o)?r.setProperty(e,o,s):r.setAttribute(e,o,s),t++}}return t}function F4(r){return r===3||r===4||r===6}function k4(r){return r.charCodeAt(0)===64}function id(r,e){if(!(e===null||e.length===0))if(r===null||r.length===0)r=e.slice();else{let n=-1;for(let t=0;t<e.length;t++){let i=e[t];typeof i=="number"?n=i:n===0||(n===-1||n===2?ex(r,n,i,null,e[++t]):ex(r,n,i,null,null))}}return r}function ex(r,e,n,t,i){let o=0,s=r.length;if(e===-1)s=-1;else for(;o<r.length;){let a=r[o++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=o-1;break}}}for(;o<r.length;){let a=r[o];if(typeof a=="number")break;if(a===n){i!==null&&(r[o+1]=i);return}o++,i!==null&&o++}s!==-1&&(r.splice(s,0,e),o=s+1),r.splice(o++,0,n),i!==null&&r.splice(o++,0,i)}function $x(r){return r!==rd}function S_(r){return r&32767}function U4(r){return r>>16}function A_(r,e){let n=U4(r),t=e;for(;n>0;)t=t[Hc],n--;return t}var _R=!0;function R_(r){let e=_R;return _R=r,e}var V4=256,jx=V4-1,Hx=5,B4=0,yo={};function G4(r,e,n){let t;typeof n=="string"?t=n.charCodeAt(0)||0:n.hasOwnProperty($c)&&(t=n[$c]),t==null&&(t=n[$c]=B4++);let i=t&jx,o=1<<i;e.data[r+(i>>Hx)]|=o}function D_(r,e){let n=Wx(r,e);if(n!==-1)return n;let t=e[Ie];t.firstCreatePass&&(r.injectorIndex=e.length,cR(t.data,r),cR(e,null),cR(t.blueprint,null));let i=iD(r,e),o=r.injectorIndex;if($x(i)){let s=S_(i),a=A_(i,e),c=a[Ie].data;for(let l=0;l<8;l++)e[o+l]=a[s+l]|c[s+l]}return e[o+8]=i,o}function cR(r,e){r.push(0,0,0,0,0,0,0,0,e)}function Wx(r,e){return r.injectorIndex===-1||r.parent&&r.parent.injectorIndex===r.injectorIndex||e[r.injectorIndex+8]===null?-1:r.injectorIndex}function iD(r,e){if(r.parent&&r.parent.injectorIndex!==-1)return r.parent.injectorIndex;let n=0,t=null,i=e;for(;i!==null;){if(t=Qx(i),t===null)return rd;if(n++,i=i[Hc],t.injectorIndex!==-1)return t.injectorIndex|n<<16}return rd}function TR(r,e,n){G4(r,e,n)}function zx(r,e,n){if(n&8||r!==void 0)return r;YE(e,"NodeInjector")}function qx(r,e,n,t){if(n&8&&t===void 0&&(t=null),(n&3)===0){let i=r[ds],o=rr(void 0);try{return i?i.get(e,t,n&8):AA(e,t,n&8)}finally{rr(o)}}return zx(t,e,n)}function Kx(r,e,n,t=0,i){if(r!==null){if(e[Re]&2048&&!(t&2)){let s=z4(r,e,n,t,yo);if(s!==yo)return s}let o=Yx(r,e,n,t,yo);if(o!==yo)return o}return qx(e,n,t,i)}function Yx(r,e,n,t,i){let o=j4(n);if(typeof o=="function"){if(!eR(e,r,t))return t&1?zx(i,n,t):qx(e,n,t,i);try{let s;if(s=o(t),s==null&&!(t&8))YE(n);else return s}finally{tR()}}else if(typeof o=="number"){let s=null,a=Wx(r,e),c=rd,l=t&1?e[qn][ir]:null;for((a===-1||t&4)&&(c=a===-1?iD(r,e):e[a+8],c===rd||!nx(t,!1)?a=-1:(s=e[Ie],a=S_(c),e=A_(c,e)));a!==-1;){let u=e[Ie];if(tx(o,a,u.data)){let d=$4(a,e,n,s,t,l);if(d!==yo)return d}c=e[a+8],c!==rd&&nx(t,e[Ie].data[a+8]===l)&&tx(o,a,e)?(s=u,a=S_(c),e=A_(c,e)):a=-1}}return i}function $4(r,e,n,t,i,o){let s=e[Ie],a=s.data[r+8],c=t==null?fs(a)&&_R:t!=s&&(a.type&3)!==0,l=i&1&&o===a,u=T_(a,s,n,c,l);return u!==null?zf(e,s,u,a,i):yo}function T_(r,e,n,t,i){let o=r.providerIndexes,s=e.data,a=o&1048575,c=r.directiveStart,l=r.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&&n===p||g>=c&&p.type===n)return g}if(i){let g=s[c];if(g&&Mi(g)&&g.type===n)return c}return null}function zf(r,e,n,t,i){let o=r[n],s=e.data;if(o instanceof tl){let a=o;if(a.resolving){let g=g0(s[n]);throw SA(g)}let c=R_(a.canSeeViewProviders);a.resolving=!0;let l=s[n].type||s[n],u,d=a.injectImpl?rr(a.injectImpl):null,f=eR(r,t,0);try{o=r[n]=a.factory(void 0,i,s,r,t),e.firstCreatePass&&n>=t.directiveStart&&w4(n,s[n],e)}finally{d!==null&&rr(d),R_(c),a.resolving=!1,tR()}}return o}function j4(r){if(typeof r=="string")return r.charCodeAt(0)||0;let e=r.hasOwnProperty($c)?r[$c]:void 0;return typeof e=="number"?e>=0?e&jx:H4:e}function tx(r,e,n){let t=1<<r;return!!(n[e+(r>>Hx)]&t)}function nx(r,e){return!(r&2)&&!(r&1&&e)}var el=class{_tNode;_lView;constructor(e,n){this._tNode=e,this._lView=n}get(e,n,t){return Kx(this._tNode,this._lView,e,Vc(t),n)}};function H4(){return new el(cn(),ce())}function W4(r){return md(()=>{let e=r.prototype.constructor,n=e[bf]||IR(e),t=Object.prototype,i=Object.getPrototypeOf(r.prototype).constructor;for(;i&&i!==t;){let o=i[bf]||IR(i);if(o&&o!==n)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function IR(r){return EA(r)?()=>{let e=IR(sn(r));return e&&e()}:ta(r)}function z4(r,e,n,t,i){let o=r,s=e;for(;o!==null&&s!==null&&s[Re]&2048&&!Qu(s);){let a=Yx(o,s,n,t|2,yo);if(a!==yo)return a;let c=o.parent;if(!c){let l=s[xA];if(l){let u=l.get(n,yo,t);if(u!==yo)return u}c=Qx(s),s=s[Hc]}o=c}return i}function Qx(r){let e=r[Ie],n=e.type;return n===2?e.declTNode:n===1?r[ir]:null}function q4(){return pd(cn(),ce())}function pd(r,e){return new ha(oi(r,e))}var ha=(()=>{class r{nativeElement;constructor(n){this.nativeElement=n}static __NG_ELEMENT_ID__=q4}return r})();function Xx(r){return r instanceof ha?r.nativeElement:r}function K4(){return this._results[Symbol.iterator]()}var C_=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 Ct}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,n){return this._results.reduce(e,n)}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,n){this.dirty=!1;let t=T0(e);(this._changesDetected=!_0(this._results,t,n))&&(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]=K4};function Jx(r){return(r.flags&128)===128}var oD=(function(r){return r[r.OnPush=0]="OnPush",r[r.Default=1]="Default",r})(oD||{}),Zx=new Map,Y4=0;function Q4(){return Y4++}function X4(r){Zx.set(r[Ff],r)}function vR(r){Zx.delete(r[Ff])}var rx="__ngContext__";function od(r,e){Eo(e)?(r[rx]=e[Ff],X4(e)):r[rx]=e}function eF(r){return nF(r[Ku])}function tF(r){return nF(r[ri])}function nF(r){for(;r!==null&&!Li(r);)r=r[ri];return r}var yR;function sD(r){yR=r}function aD(){if(yR!==void 0)return yR;if(typeof document<"u")return document;throw new oe(210,!1)}var j_=new ee("",{providedIn:"root",factory:()=>J4}),J4="ng",H_=new ee(""),_s=new ee("",{providedIn:"platform",factory:()=>"unknown"});var Z4=new ee(""),Ed=new ee("",{providedIn:"root",factory:()=>aD().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var eq="h",tq="b";var rF="r";var iF="di";var oF=!1,sF=new ee("",{providedIn:"root",factory:()=>oF});var nq=(r,e,n,t)=>{};function rq(r,e,n,t){nq(r,e,n,t)}function W_(r){return(r.flags&32)===32}var iq=()=>null;function aF(r,e,n=!1){return iq(r,e,n)}function cF(r,e){let n=r.contentQueries;if(n!==null){let t=Ae(null);try{for(let i=0;i<n.length;i+=2){let o=n[i],s=n[i+1];if(s!==-1){let a=r.data[s];Gf(o),a.contentQueries(2,e[s],s)}}}finally{Ae(t)}}}function SR(r,e,n){Gf(0);let t=Ae(null);try{e(r,n)}finally{Ae(t)}}function cD(r,e,n){if(kA(e)){let t=Ae(null);try{let i=e.directiveStart,o=e.directiveEnd;for(let s=i;s<o;s++){let a=r.data[s];if(a.contentQueries){let c=n[s];a.contentQueries(1,c,s)}}}finally{Ae(t)}}}var ms=(function(r){return r[r.Emulated=0]="Emulated",r[r.None=2]="None",r[r.ShadowDom=3]="ShadowDom",r})(ms||{});var d_;function oq(){if(d_===void 0&&(d_=null,Kt.trustedTypes))try{d_=Kt.trustedTypes.createPolicy("angular",{createHTML:r=>r,createScript:r=>r,createScriptURL:r=>r})}catch{}return d_}function z_(r){return oq()?.createHTML(r)||r}var h_;function sq(){if(h_===void 0&&(h_=null,Kt.trustedTypes))try{h_=Kt.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:r=>r,createScript:r=>r,createScriptURL:r=>r})}catch{}return h_}function ix(r){return sq()?.createHTML(r)||r}var ps=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${HE})`}},AR=class extends ps{getTypeName(){return"HTML"}},RR=class extends ps{getTypeName(){return"Style"}},DR=class extends ps{getTypeName(){return"Script"}},CR=class extends ps{getTypeName(){return"URL"}},NR=class extends ps{getTypeName(){return"ResourceURL"}};function Ur(r){return r instanceof ps?r.changingThisBreaksApplicationSecurity:r}function Ao(r,e){let n=lF(r);if(n!=null&&n!==e){if(n==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${n} (see ${HE})`)}return n===e}function lF(r){return r instanceof ps&&r.getTypeName()||null}function lD(r){return new AR(r)}function uD(r){return new RR(r)}function dD(r){return new DR(r)}function hD(r){return new CR(r)}function fD(r){return new NR(r)}function aq(r){let e=new bR(r);return cq()?new OR(e):e}var OR=class{inertDocumentHelper;constructor(e){this.inertDocumentHelper=e}getInertBodyElement(e){e="<body><remove></remove>"+e;try{let n=new window.DOMParser().parseFromString(z_(e),"text/html").body;return n===null?this.inertDocumentHelper.getInertBodyElement(e):(n.firstChild?.remove(),n)}catch{return null}}},bR=class{defaultDoc;inertDocument;constructor(e){this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let n=this.inertDocument.createElement("template");return n.innerHTML=z_(e),n}};function cq(){try{return!!new window.DOMParser().parseFromString(z_(""),"text/html")}catch{return!1}}var lq=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function Qf(r){return r=String(r),r.match(lq)?r:"unsafe:"+r}function Ts(r){let e={};for(let n of r.split(","))e[n]=!0;return e}function Xf(...r){let e={};for(let n of r)for(let t in n)n.hasOwnProperty(t)&&(e[t]=!0);return e}var uF=Ts("area,br,col,hr,img,wbr"),dF=Ts("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),hF=Ts("rp,rt"),uq=Xf(hF,dF),dq=Xf(dF,Ts("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")),hq=Xf(hF,Ts("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")),ox=Xf(uF,dq,hq,uq),fF=Ts("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),fq=Ts("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"),gq=Ts("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"),mq=Xf(fF,fq,gq),pq=Ts("script,style,template"),wR=class{sanitizedSomething=!1;buf=[];sanitizeChildren(e){let n=e.firstChild,t=!0,i=[];for(;n;){if(n.nodeType===Node.ELEMENT_NODE?t=this.startElement(n):n.nodeType===Node.TEXT_NODE?this.chars(n.nodeValue):this.sanitizedSomething=!0,t&&n.firstChild){i.push(n),n=Tq(n);continue}for(;n;){n.nodeType===Node.ELEMENT_NODE&&this.endElement(n);let o=_q(n);if(o){n=o;break}n=i.pop()}}return this.buf.join("")}startElement(e){let n=sx(e).toLowerCase();if(!ox.hasOwnProperty(n))return this.sanitizedSomething=!0,!pq.hasOwnProperty(n);this.buf.push("<"),this.buf.push(n);let t=e.attributes;for(let i=0;i<t.length;i++){let o=t.item(i),s=o.name,a=s.toLowerCase();if(!mq.hasOwnProperty(a)){this.sanitizedSomething=!0;continue}let c=o.value;fF[a]&&(c=Qf(c)),this.buf.push(" ",s,'="',ax(c),'"')}return this.buf.push(">"),!0}endElement(e){let n=sx(e).toLowerCase();ox.hasOwnProperty(n)&&!uF.hasOwnProperty(n)&&(this.buf.push("</"),this.buf.push(n),this.buf.push(">"))}chars(e){this.buf.push(ax(e))}};function Eq(r,e){return(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function _q(r){let e=r.nextSibling;if(e&&r!==e.previousSibling)throw gF(e);return e}function Tq(r){let e=r.firstChild;if(e&&Eq(r,e))throw gF(e);return e}function sx(r){let e=r.nodeName;return typeof e=="string"?e:"FORM"}function gF(r){return new Error(`Failed to sanitize html because the element is clobbered: ${r.outerHTML}`)}var Iq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,vq=/([^\#-~ |!])/g;function ax(r){return r.replace(/&/g,"&amp;").replace(Iq,function(e){let n=e.charCodeAt(0),t=e.charCodeAt(1);return"&#"+((n-55296)*1024+(t-56320)+65536)+";"}).replace(vq,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}var f_;function q_(r,e){let n=null;try{f_=f_||aq(r);let t=e?String(e):"";n=f_.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=n.innerHTML,n=f_.getInertBodyElement(t)}while(t!==o);let a=new wR().sanitizeChildren(cx(n)||n);return z_(a)}finally{if(n){let t=cx(n)||n;for(;t.firstChild;)t.firstChild.remove()}}}function cx(r){return"content"in r&&yq(r)?r.content:null}function yq(r){return r.nodeType===Node.ELEMENT_NODE&&r.nodeName==="TEMPLATE"}var Sq=/^>|^->|<!--|-->|--!>|<!-$/g,Aq=/(<|>)/g,Rq="\u200B$1\u200B";function Dq(r){return r.replace(Sq,e=>e.replace(Aq,Rq))}function Cq(r,e){return r.createText(e)}function Nq(r,e,n){r.setValue(e,n)}function Oq(r,e){return r.createComment(Dq(e))}function mF(r,e,n){return r.createElement(e,n)}function N_(r,e,n,t,i){r.insertBefore(e,n,t,i)}function pF(r,e,n){r.appendChild(e,n)}function lx(r,e,n,t,i){t!==null?N_(r,e,n,t,i):pF(r,e,n)}function EF(r,e,n,t){r.removeChild(null,e,n,t)}function bq(r,e,n){r.setAttribute(e,"style",n)}function wq(r,e,n){n===""?r.removeAttribute(e,"class"):r.setAttribute(e,"class",n)}function _F(r,e,n){let{mergedAttrs:t,classes:i,styles:o}=n;t!==null&&x4(r,e,t),i!==null&&wq(r,e,i),o!==null&&bq(r,e,o)}var ci=(function(r){return r[r.NONE=0]="NONE",r[r.HTML=1]="HTML",r[r.STYLE=2]="STYLE",r[r.SCRIPT=3]="SCRIPT",r[r.URL=4]="URL",r[r.RESOURCE_URL=5]="RESOURCE_URL",r[r.ATTRIBUTE_NO_BINDING=6]="ATTRIBUTE_NO_BINDING",r})(ci||{});function Lq(r){let e=gD();return e?ix(e.sanitize(ci.HTML,r)||""):Ao(r,"HTML")?ix(Ur(r)):q_(aD(),xr(r))}function Mq(r){let e=gD();return e?e.sanitize(ci.STYLE,r)||"":Ao(r,"Style")?Ur(r):xr(r)}function Pq(r){let e=gD();return e?e.sanitize(ci.URL,r)||"":Ao(r,"URL")?Ur(r):Qf(xr(r))}function gD(){let r=ce();return r&&r[mo].sanitizer}function xq(r){return r.ownerDocument.defaultView}function Fq(r){return r.ownerDocument}function kq(r){return r instanceof Function?r():r}function Uq(r,e,n){let t=r.length;for(;;){let i=r.indexOf(e,n);if(i===-1)return i;if(i===0||r.charCodeAt(i-1)<=32){let o=e.length;if(i+o===t||r.charCodeAt(i+o)<=32)return i}n=i+1}}var TF="ng-template";function Vq(r,e,n,t){let i=0;if(t){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&Uq(e[i+1].toLowerCase(),n,0)!==-1)return!0}else if(mD(r))return!1;if(i=e.indexOf(1,i),i>-1){let o;for(;++i<e.length&&typeof(o=e[i])=="string";)if(o.toLowerCase()===n)return!0}return!1}function mD(r){return r.type===4&&r.value!==TF}function Bq(r,e,n){let t=r.type===4&&!n?TF:r.value;return e===t}function Gq(r,e,n){let t=4,i=r.attrs,o=i!==null?Hq(i):0,s=!1;for(let a=0;a<e.length;a++){let c=e[a];if(typeof c=="number"){if(!s&&!Pi(t)&&!Pi(c))return!1;if(s&&Pi(c))continue;s=!1,t=c|t&1;continue}if(!s)if(t&4){if(t=2|t&1,c!==""&&!Bq(r,c,n)||c===""&&e.length===1){if(Pi(t))return!1;s=!0}}else if(t&8){if(i===null||!Vq(r,i,c,n)){if(Pi(t))return!1;s=!0}}else{let l=e[++a],u=$q(c,i,mD(r),n);if(u===-1){if(Pi(t))return!1;s=!0;continue}if(l!==""){let d;if(u>o?d="":d=i[u+1].toLowerCase(),t&2&&l!==d){if(Pi(t))return!1;s=!0}}}}return Pi(t)||s}function Pi(r){return(r&1)===0}function $q(r,e,n,t){if(e===null)return-1;let i=0;if(t||!n){let o=!1;for(;i<e.length;){let s=e[i];if(s===r)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 Wq(e,r)}function IF(r,e,n=!1){for(let t=0;t<e.length;t++)if(Gq(r,e[t],n))return!0;return!1}function jq(r){let e=r.attrs;if(e!=null){let n=e.indexOf(5);if((n&1)===0)return e[n+1]}return null}function Hq(r){for(let e=0;e<r.length;e++){let n=r[e];if(F4(n))return e}return r.length}function Wq(r,e){let n=r.indexOf(4);if(n>-1)for(n++;n<r.length;){let t=r[n];if(typeof t=="number")return-1;if(t===e)return n;n++}return-1}function zq(r,e){e:for(let n=0;n<e.length;n++){let t=e[n];if(r.length===t.length){for(let i=0;i<r.length;i++)if(r[i]!==t[i])continue e;return!0}}return!1}function ux(r,e){return r?":not("+e.trim()+")":e}function qq(r){let e=r[0],n=1,t=2,i="",o=!1;for(;n<r.length;){let s=r[n];if(typeof s=="string")if(t&2){let a=r[++n];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else t&8?i+="."+s:t&4&&(i+=" "+s);else i!==""&&!Pi(s)&&(e+=ux(o,i),i=""),t=s,o=o||!Pi(t);n++}return i!==""&&(e+=ux(o,i)),e}function Kq(r){return r.map(qq).join(",")}function Yq(r){let e=[],n=[],t=1,i=2;for(;t<r.length;){let o=r[t];if(typeof o=="string")i===2?o!==""&&e.push(o,r[++t]):i===8&&n.push(o);else{if(!Pi(i))break;i=o}t++}return n.length&&e.push(1,...n),e}var vn={};function pD(r,e,n,t,i,o,s,a,c,l,u){let d=Je+t,f=d+i,g=Qq(d,f),p=typeof l=="function"?l():l;return g[Ie]={type:r,blueprint:g,template:n,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 Qq(r,e){let n=[];for(let t=0;t<e;t++)n.push(t<r?null:vn);return n}function Xq(r){let e=r.tView;return e===null||e.incompleteFirstPass?r.tView=pD(1,null,r.template,r.decls,r.vars,r.directiveDefs,r.pipeDefs,r.viewQuery,r.schemas,r.consts,r.id):e}function ED(r,e,n,t,i,o,s,a,c,l,u){let d=e.blueprint.slice();return d[wi]=i,d[Re]=t|4|128|8|64|1024,(l!==null||r&&r[Re]&2048)&&(d[Re]|=2048),BA(d),d[an]=d[Hc]=r,d[Bt]=n,d[mo]=s||r&&r[mo],d[Xe]=a||r&&r[Xe],d[ds]=c||r&&r[ds]||null,d[ir]=o,d[Ff]=Q4(),d[jc]=u,d[xA]=l,d[qn]=e.type==2?r[qn]:d,d}function Jq(r,e,n){let t=oi(e,r),i=Xq(n),o=r[mo].rendererFactory,s=_D(r,ED(r,i,null,vF(n),t,e,null,o.createRenderer(t,n),null,null,null));return r[e.index]=s}function vF(r){let e=16;return r.signals?e=4096:r.onPush&&(e=64),e}function yF(r,e,n,t){if(n===0)return-1;let i=e.length;for(let o=0;o<n;o++)e.push(t),r.blueprint.push(t),r.data.push(null);return i}function _D(r,e){return r[Ku]?r[PA][ri]=e:r[Ku]=e,r[PA]=e,e}function Zq(r=1){SF(Ze(),ce(),ai()+r,!1)}function SF(r,e,n,t){if(!t)if((e[Re]&3)===3){let o=r.preOrderCheckHooks;o!==null&&E_(e,o,n)}else{let o=r.preOrderHooks;o!==null&&__(e,o,0,n)}la(n)}var K_=(function(r){return r[r.None=0]="None",r[r.SignalBased=1]="SignalBased",r[r.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",r})(K_||{});function LR(r,e,n,t){let i=Ae(null);try{let[o,s,a]=r.inputs[n],c=null;(s&K_.SignalBased)!==0&&(c=e[o][Tn]),c!==null&&c.transformFn!==void 0?t=c.transformFn(t):a!==null&&(t=a.call(e,t)),r.setInput!==null?r.setInput(e,c,t,n,o):Fx(e,c,o,t)}finally{Ae(i)}}var xi=(function(r){return r[r.Important=1]="Important",r[r.DashCase=2]="DashCase",r})(xi||{}),e8;function TD(r,e){return e8(r,e)}var nl=new Set,Y_=(function(r){return r[r.CHANGE_DETECTION=0]="CHANGE_DETECTION",r[r.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",r})(Y_||{}),ol=new ee(""),dx=new Set;function Is(r){dx.has(r)||(dx.add(r),performance?.mark?.("mark_feature_usage",{detail:{feature:r}}))}var AF=!1,MR=class extends Ct{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,MA()&&(this.destroyRef=J(sr,{optional:!0})??void 0,this.pendingTasks=J(ua,{optional:!0})??void 0)}emit(e){let n=Ae(null);try{super.next(e)}finally{Ae(n)}}subscribe(e,n,t){let i=e,o=n||(()=>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 mt&&e.add(a),a}wrapInTimeout(e){return n=>{let t=this.pendingTasks?.add();setTimeout(()=>{try{e(n)}finally{t!==void 0&&this.pendingTasks?.remove(t)}})}}},gs=MR;function RF(r){let e,n;function t(){r=Zc;try{n!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(n),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{r(),t()}),typeof requestAnimationFrame=="function"&&(n=requestAnimationFrame(()=>{r(),t()})),()=>t()}function hx(r){return queueMicrotask(()=>r()),()=>{r=Zc}}var ID="isAngularZone",O_=ID+"_ID",t8=0,we=class r{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new gs(!1);onMicrotaskEmpty=new gs(!1);onStable=new gs(!1);onError=new gs(!1);constructor(e){let{enableLongStackTrace:n=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:o=AF}=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)),n&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&t,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=o,i8(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(ID)===!0}static assertInAngularZone(){if(!r.isInAngularZone())throw new oe(909,!1)}static assertNotInAngularZone(){if(r.isInAngularZone())throw new oe(909,!1)}run(e,n,t){return this._inner.run(e,n,t)}runTask(e,n,t,i){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,e,n8,Zc,Zc);try{return o.runTask(s,n,t)}finally{o.cancelTask(s)}}runGuarded(e,n,t){return this._inner.runGuarded(e,n,t)}runOutsideAngular(e){return this._outer.run(e)}},n8={};function vD(r){if(r._nesting==0&&!r.hasPendingMicrotasks&&!r.isStable)try{r._nesting++,r.onMicrotaskEmpty.emit(null)}finally{if(r._nesting--,!r.hasPendingMicrotasks)try{r.runOutsideAngular(()=>r.onStable.emit(null))}finally{r.isStable=!0}}}function r8(r){if(r.isCheckStableRunning||r.callbackScheduled)return;r.callbackScheduled=!0;function e(){RF(()=>{r.callbackScheduled=!1,PR(r),r.isCheckStableRunning=!0,vD(r),r.isCheckStableRunning=!1})}r.scheduleInRootZone?Zone.root.run(()=>{e()}):r._outer.run(()=>{e()}),PR(r)}function i8(r){let e=()=>{r8(r)},n=t8++;r._inner=r._inner.fork({name:"angular",properties:{[ID]:!0,[O_]:n,[O_+n]:!0},onInvokeTask:(t,i,o,s,a,c)=>{if(o8(c))return t.invokeTask(o,s,a,c);try{return fx(r),t.invokeTask(o,s,a,c)}finally{(r.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||r.shouldCoalesceRunChangeDetection)&&e(),gx(r)}},onInvoke:(t,i,o,s,a,c,l)=>{try{return fx(r),t.invoke(o,s,a,c,l)}finally{r.shouldCoalesceRunChangeDetection&&!r.callbackScheduled&&!s8(c)&&e(),gx(r)}},onHasTask:(t,i,o,s)=>{t.hasTask(o,s),i===o&&(s.change=="microTask"?(r._hasPendingMicrotasks=s.microTask,PR(r),vD(r)):s.change=="macroTask"&&(r.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,i,o,s)=>(t.handleError(o,s),r.runOutsideAngular(()=>r.onError.emit(s)),!1)})}function PR(r){r._hasPendingMicrotasks||(r.shouldCoalesceEventChangeDetection||r.shouldCoalesceRunChangeDetection)&&r.callbackScheduled===!0?r.hasPendingMicrotasks=!0:r.hasPendingMicrotasks=!1}function fx(r){r._nesting++,r.isStable&&(r.isStable=!1,r.onUnstable.emit(null))}function gx(r){r._nesting--,vD(r)}var sd=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new gs;onMicrotaskEmpty=new gs;onStable=new gs;onError=new gs;run(e,n,t){return e.apply(n,t)}runGuarded(e,n,t){return e.apply(n,t)}runOutsideAngular(e){return e()}runTask(e,n,t,i){return e.apply(n,t)}};function o8(r){return DF(r,"__ignore_ng_zone__")}function s8(r){return DF(r,"__scheduler_tick__")}function DF(r,e){return!Array.isArray(r)||r.length!==1?!1:r[0]?.data?.[e]===!0}function CF(r="zone.js",e){return r==="noop"?new sd:r==="zone.js"?new we(e):r}var yD=(()=>{class r{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})(),NF=[0,1,2,3],OF=(()=>{class r{ngZone=J(we);scheduler=J(ni);errorHandler=J(Pr,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){J(ol,{optional:!0})}execute(){let n=this.sequences.size>0;n&&ut(16),this.executing=!0;for(let t of NF)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(),n&&ut(17)}register(n){let{view:t}=n;t!==void 0?((t[zc]??=[]).push(n),ca(t),t[Re]|=8192):this.executing?this.deferredRegistrations.add(n):this.addSequence(n)}addSequence(n){this.sequences.add(n),this.scheduler.notify(7)}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,t){return t?t.run(Y_.AFTER_NEXT_RENDER,n):n()}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})(),b_=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,n,t,i,o,s=null){this.impl=e,this.hooks=n,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?.[zc];e&&(this.view[zc]=e.filter(n=>n!==this))}};function a8(r,e){let n=e?.injector??J(lt);return Is("NgAfterNextRender"),l8(r,n,e,!0)}function c8(r){return r instanceof Function?[void 0,void 0,r,void 0]:[r.earlyRead,r.write,r.mixedReadWrite,r.read]}function l8(r,e,n,t){let i=e.get(yD);i.impl??=e.get(OF);let o=e.get(ol,null,{optional:!0}),s=n?.manualCleanup!==!0?e.get(sr):null,a=e.get(ed,null,{optional:!0}),c=new b_(i.impl,c8(r),a?.view,t,s,o?.snapshot(null));return i.impl.register(c),c}var bF=new ee("",{providedIn:"root",factory:()=>({queue:new Set,isScheduled:!1,scheduler:null})});function wF(r,e,n){let t=r.get(bF);if(Array.isArray(e))for(let i of e)t.queue.add(i),n?.detachedLeaveAnimationFns?.push(i);else t.queue.add(e),n?.detachedLeaveAnimationFns?.push(e);t.scheduler&&t.scheduler(r)}function u8(r,e){let n=r.get(bF);if(e.detachedLeaveAnimationFns){for(let t of e.detachedLeaveAnimationFns)n.queue.delete(t);e.detachedLeaveAnimationFns=void 0}}function d8(r,e){for(let[n,t]of e)wF(r,t.animateFns)}function mx(r,e,n,t){let i=r?.[qc]?.enter;e!==null&&i&&i.has(n.index)&&d8(t,i)}function nd(r,e,n,t,i,o,s,a){if(i!=null){let c,l=!1;Li(i)?c=i:Eo(i)&&(l=!0,i=i[wi]);let u=ii(i);r===0&&t!==null?(mx(a,t,o,n),s==null?pF(e,t,u):N_(e,t,u,s||null,!0)):r===1&&t!==null?(mx(a,t,o,n),N_(e,t,u,s||null,!0)):r===2?px(a,o,n,d=>{EF(e,u,l,d)}):r===3&&px(a,o,n,()=>{e.destroyNode(u)}),c!=null&&y8(e,r,n,c,o,t,s)}}function h8(r,e){LF(r,e),e[wi]=null,e[ir]=null}function f8(r,e,n,t,i,o){t[wi]=i,t[ir]=e,X_(r,t,n,1,i,o)}function LF(r,e){e[mo].changeDetectionScheduler?.notify(9),X_(r,e,e[Xe],2,null,null)}function g8(r){let e=r[Ku];if(!e)return lR(r[Ie],r);for(;e;){let n=null;if(Eo(e))n=e[Ku];else{let t=e[Gt];t&&(n=t)}if(!n){for(;e&&!e[ri]&&e!==r;)Eo(e)&&lR(e[Ie],e),e=e[an];e===null&&(e=r),Eo(e)&&lR(e[Ie],e),n=e&&e[ri]}e=n}}function SD(r,e){let n=r[Kc],t=n.indexOf(e);n.splice(t,1)}function Q_(r,e){if(Yc(e))return;let n=e[Xe];n.destroyNode&&X_(r,e,n,3,null,null),g8(e)}function lR(r,e){if(Yc(e))return;let n=Ae(null);try{e[Re]&=-129,e[Re]|=256,e[Fr]&&Fc(e[Fr]),E8(r,e),p8(r,e),e[Ie].type===1&&e[Xe].destroy();let t=e[sa];if(t!==null&&Li(e[an])){t!==e[an]&&SD(t,e);let i=e[po];i!==null&&i.detachView(r)}vR(e)}finally{Ae(n)}}function px(r,e,n,t){let i=r?.[qc];if(i==null||i.leave==null||!i.leave.has(e.index))return t(!1);r&&nl.add(r),wF(n,()=>{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),m8(r,t)}else r&&nl.delete(r),t(!1)},i)}function m8(r,e){let n=r[qc]?.running;if(n){n.then(()=>{r[qc].running=void 0,nl.delete(r),e(!0)});return}e(!1)}function p8(r,e){let n=r.cleanup,t=e[qu];if(n!==null)for(let s=0;s<n.length-1;s+=2)if(typeof n[s]=="string"){let a=n[s+3];a>=0?t[a]():t[-a].unsubscribe(),s+=2}else{let a=t[n[s+1]];n[s].call(a)}t!==null&&(e[qu]=null);let i=e[cs];if(i!==null){e[cs]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let o=e[hs];if(o!==null){e[hs]=null;for(let s of o)s.destroy()}}function E8(r,e){let n;if(r!=null&&(n=r.destroyHooks)!=null)for(let t=0;t<n.length;t+=2){let i=e[n[t]];if(!(i instanceof tl)){let o=n[t+1];if(Array.isArray(o))for(let s=0;s<o.length;s+=2){let a=i[o[s]],c=o[s+1];ut(4,a,c);try{c.call(a)}finally{ut(5,a,c)}}else{ut(4,i,o);try{o.call(i)}finally{ut(5,i,o)}}}}}function MF(r,e,n){return _8(r,e.parent,n)}function _8(r,e,n){let t=e;for(;t!==null&&t.type&168;)e=t,t=e.parent;if(t===null)return n[wi];if(fs(t)){let{encapsulation:i}=r.data[t.directiveStart+t.componentOffset];if(i===ms.None||i===ms.Emulated)return null}return oi(t,n)}function PF(r,e,n){return I8(r,e,n)}function T8(r,e,n){return r.type&40?oi(r,n):null}var I8=T8,Ex;function AD(r,e,n,t){let i=MF(r,t,e),o=e[Xe],s=t.parent||e[ir],a=PF(s,t,e);if(i!=null)if(Array.isArray(n))for(let c=0;c<n.length;c++)lx(o,i,n[c],a,!1);else lx(o,i,n,a,!1);Ex!==void 0&&Ex(o,t,e,n,i)}function Hf(r,e){if(e!==null){let n=e.type;if(n&3)return oi(e,r);if(n&4)return xR(-1,r[e.index]);if(n&8){let t=e.child;if(t!==null)return Hf(r,t);{let i=r[e.index];return Li(i)?xR(-1,i):ii(i)}}else{if(n&128)return Hf(r,e.next);if(n&32)return TD(e,r)()||ii(r[e.index]);{let t=xF(r,e);if(t!==null){if(Array.isArray(t))return t[0];let i=na(r[qn]);return Hf(i,t)}else return Hf(r,e.next)}}}return null}function xF(r,e){if(e!==null){let t=r[qn][ir],i=e.projection;return t.projection[i]}return null}function xR(r,e){let n=Gt+r+1;if(n<e.length){let t=e[n],i=t[Ie].firstChild;if(i!==null)return Hf(t,i)}return e[aa]}function RD(r,e,n,t,i,o,s){for(;n!=null;){let a=t[ds];if(n.type===128){n=n.next;continue}let c=t[n.index],l=n.type;if(s&&e===0&&(c&&od(ii(c),t),n.flags|=2),!W_(n))if(l&8)RD(r,e,n.child,t,i,o,!1),nd(e,r,a,i,c,n,o,t);else if(l&32){let u=TD(n,t),d;for(;d=u();)nd(e,r,a,i,d,n,o,t);nd(e,r,a,i,c,n,o,t)}else l&16?FF(r,e,t,n,i,o):nd(e,r,a,i,c,n,o,t);n=s?n.projectionNext:n.next}}function X_(r,e,n,t,i,o){RD(n,t,r.firstChild,e,i,o,!1)}function v8(r,e,n){let t=e[Xe],i=MF(r,n,e),o=n.parent||e[ir],s=PF(o,n,e);FF(t,0,e,n,i,s)}function FF(r,e,n,t,i,o){let s=n[qn],c=s[ir].projection[t.projection];if(Array.isArray(c))for(let l=0;l<c.length;l++){let u=c[l];nd(e,r,n[ds],i,u,t,o,n)}else{let l=c,u=s[an];Jx(t)&&(l.flags|=128),RD(r,e,l,u,i,o,!0)}}function y8(r,e,n,t,i,o,s){let a=t[aa],c=ii(t);a!==c&&nd(e,r,n,o,a,i,s);for(let l=Gt;l<t.length;l++){let u=t[l];X_(u[Ie],u,r,e,o,a)}}function S8(r,e,n,t,i){if(e)i?r.addClass(n,t):r.removeClass(n,t);else{let o=t.indexOf("-")===-1?void 0:xi.DashCase;i==null?r.removeStyle(n,t,o):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=xi.Important),r.setStyle(n,t,i,o))}}function kF(r,e,n,t,i){let o=ai(),s=t&2;try{la(-1),s&&e.length>Je&&SF(r,e,Je,!1),ut(s?2:0,i,n),n(t,i)}finally{la(o),ut(s?3:1,i,n)}}function J_(r,e,n){N8(r,e,n),(n.flags&64)===64&&O8(r,e,n)}function Jf(r,e,n=oi){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?n(e,r):r[s];r[i++]=a}}}function A8(r,e,n,t){let o=t.get(sF,oF)||n===ms.ShadowDom,s=r.selectRootElement(e,o);return R8(s),s}function R8(r){D8(r)}var D8=()=>null;function C8(r){return r==="class"?"className":r==="for"?"htmlFor":r==="formaction"?"formAction":r==="innerHtml"?"innerHTML":r==="readonly"?"readOnly":r==="tabindex"?"tabIndex":r}function UF(r,e,n,t,i,o){let s=e[Ie];if(Z_(r,s,e,n,t)){fs(r)&&BF(e,r.index);return}r.type&3&&(n=C8(n)),VF(r,e,n,t,i,o)}function VF(r,e,n,t,i,o){if(r.type&3){let s=oi(r,e);t=o!=null?o(t,r.value||"",n):t,i.setProperty(s,n,t)}else r.type&12}function BF(r,e){let n=si(e,r);n[Re]&16||(n[Re]|=64)}function N8(r,e,n){let t=n.directiveStart,i=n.directiveEnd;fs(n)&&Jq(e,n,r.data[t+n.componentOffset]),r.firstCreatePass||D_(n,e);let o=n.initialInputs;for(let s=t;s<i;s++){let a=r.data[s],c=zf(e,r,s,n);if(od(c,e),o!==null&&L8(e,s-t,c,a,n,o),Mi(a)){let l=si(n.index,e);l[Bt]=zf(e,r,s,n)}}}function O8(r,e,n){let t=n.directiveStart,i=n.directiveEnd,o=n.index,s=$0();try{la(o);for(let a=t;a<i;a++){let c=r.data[a],l=e[a];i_(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&b8(c,l)}}finally{la(-1),i_(s)}}function b8(r,e){r.hostBindings!==null&&r.hostBindings(1,e)}function DD(r,e){let n=r.directiveRegistry,t=null;if(n)for(let i=0;i<n.length;i++){let o=n[i];IF(e,o.selectors,!1)&&(t??=[],Mi(o)?t.unshift(o):t.push(o))}return t}function w8(r,e,n,t,i,o){let s=oi(r,e);GF(e[Xe],s,o,r.value,n,t,i)}function GF(r,e,n,t,i,o,s){if(o==null)r.removeAttribute(e,i,n);else{let a=s==null?xr(o):s(o,t||"",i);r.setAttribute(e,i,a,n)}}function L8(r,e,n,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];LR(t,n,c,l)}}function CD(r,e,n,t,i){let o=Je+n,s=e[Ie],a=i(s,e,r,t,n);e[o]=a,Xc(r,!0);let c=r.type===2;return c?(_F(e[Xe],a,r),(P0()===0||Yu(r))&&od(a,e),x0()):od(a,e),c_()&&(!c||!W_(r))&&AD(s,e,a,r),r}function ND(r){let e=r;return YA()?QA():(e=e.parent,Xc(e,!1)),e}function M8(r,e){let n=r[ds];if(!n)return;let t;try{t=n.get(To,null)}catch{t=null}t?.(e)}function Z_(r,e,n,t,i){let o=r.inputs?.[t],s=r.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];LR(d,n[l],u,i),a=!0}if(o)for(let c of o){let l=n[c],u=e.data[c];LR(u,l,t,i),a=!0}return a}function P8(r,e){let n=si(e,r),t=n[Ie];x8(t,n);let i=n[wi];i!==null&&n[jc]===null&&(n[jc]=aF(i,n[ds])),ut(18),OD(t,n,n[Bt]),ut(19,n[Bt])}function x8(r,e){for(let n=e.length;n<r.blueprint.length;n++)e.push(r.blueprint[n])}function OD(r,e,n){s_(e);try{let t=r.viewQuery;t!==null&&SR(1,t,n);let i=r.template;i!==null&&kF(r,e,i,1,n),r.firstCreatePass&&(r.firstCreatePass=!1),e[po]?.finishViewCreation(r),r.staticContentQueries&&cF(r,e),r.staticViewQueries&&SR(2,r.viewQuery,n);let o=r.components;o!==null&&F8(e,o)}catch(t){throw r.firstCreatePass&&(r.incompleteFirstPass=!0,r.firstCreatePass=!1),t}finally{e[Re]&=-5,a_()}}function F8(r,e){for(let n=0;n<e.length;n++)P8(r,e[n])}function Zf(r,e,n,t){let i=Ae(null);try{let o=e.tView,a=r[Re]&4096?4096:16,c=ED(r,o,n,a,null,e,null,null,t?.injector??null,t?.embeddedViewInjector??null,t?.dehydratedView??null),l=r[e.index];c[sa]=l;let u=r[po];return u!==null&&(c[po]=u.createEmbeddedView(o)),OD(o,c,n),c}finally{Ae(i)}}function ad(r,e){return!e||e.firstChild===null||Jx(r)}function qf(r,e,n,t,i=!1){for(;n!==null;){if(n.type===128){n=i?n.projectionNext:n.next;continue}let o=e[n.index];o!==null&&t.push(ii(o)),Li(o)&&$F(o,t);let s=n.type;if(s&8)qf(r,e,n.child,t);else if(s&32){let a=TD(n,e),c;for(;c=a();)t.push(c)}else if(s&16){let a=xF(e,n);if(Array.isArray(a))t.push(...a);else{let c=na(e[qn]);qf(c[Ie],c,a,t,!0)}}n=i?n.projectionNext:n.next}return t}function $F(r,e){for(let n=Gt;n<r.length;n++){let t=r[n],i=t[Ie].firstChild;i!==null&&qf(t[Ie],t,i,e)}r[aa]!==r[wi]&&e.push(r[aa])}function jF(r){if(r[zc]!==null){for(let e of r[zc])e.impl.addSequence(e);r[zc].length=0}}var HF=[];function k8(r){return r[Fr]??U8(r)}function U8(r){let e=HF.pop()??Object.create(B8);return e.lView=r,e}function V8(r){r.lView[Fr]!==r&&(r.lView=null,HF.push(r))}var B8=le(M({},Pc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:r=>{ca(r.lView)},consumerOnSignalRead(){this.lView[Fr]=this}});function G8(r){let e=r[Fr]??Object.create($8);return e.lView=r,e}var $8=le(M({},Pc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:r=>{let e=na(r.lView);for(;e&&!WF(e[Ie]);)e=na(e);e&&t_(e)},consumerOnSignalRead(){this.lView[Fr]=this}});function WF(r){return r.type!==2}function zF(r){if(r[hs]===null)return;let e=!0;for(;e;){let n=!1;for(let t of r[hs])t.dirty&&(n=!0,t.zone===null||Zone.current===t.zone?t.run():t.zone.run(()=>t.run()));e=n&&!!(r[Re]&8192)}}var j8=100;function qF(r,e=0){let t=r[mo].rendererFactory,i=!1;i||t.begin?.();try{H8(r,e)}finally{i||t.end?.()}}function H8(r,e){let n=JA();try{Ju(!0),FR(r,e);let t=0;for(;Xu(r);){if(t===j8)throw new oe(103,!1);t++,FR(r,1)}}finally{Ju(n)}}function W8(r,e,n,t){if(Yc(e))return;let i=e[Re],o=!1,s=!1;s_(e);let a=!0,c=null,l=null;o||(WF(r)?(l=k8(e),c=xc(l)):bE()===null?(a=!1,l=G8(e),c=xc(l)):e[Fr]&&(Fc(e[Fr]),e[Fr]=null));try{BA(e),V0(r.bindingStartIndex),n!==null&&kF(r,e,n,2,t);let u=(i&3)===3;if(!o)if(u){let g=r.preOrderCheckHooks;g!==null&&E_(e,g,null)}else{let g=r.preOrderHooks;g!==null&&__(e,g,0,null),aR(e,0)}if(s||z8(e),zF(e),KF(e,0),r.contentQueries!==null&&cF(r,e),!o)if(u){let g=r.contentCheckHooks;g!==null&&E_(e,g)}else{let g=r.contentHooks;g!==null&&__(e,g,1),aR(e,1)}K8(r,e);let d=r.components;d!==null&&QF(e,d,0);let f=r.viewQuery;if(f!==null&&SR(2,f,t),!o)if(u){let g=r.viewCheckHooks;g!==null&&E_(e,g)}else{let g=r.viewHooks;g!==null&&__(e,g,2),aR(e,2)}if(r.firstUpdatePass===!0&&(r.firstUpdatePass=!1),e[ZE]){for(let g of e[ZE])g();e[ZE]=null}o||(jF(e),e[Re]&=-73)}catch(u){throw o||ca(e),u}finally{l!==null&&(Uu(l,c),a&&V8(l)),a_()}}function KF(r,e){for(let n=eF(r);n!==null;n=tF(n))for(let t=Gt;t<n.length;t++){let i=n[t];YF(i,e)}}function z8(r){for(let e=eF(r);e!==null;e=tF(e)){if(!(e[Re]&2))continue;let n=e[Kc];for(let t=0;t<n.length;t++){let i=n[t];t_(i)}}}function q8(r,e,n){ut(18);let t=si(e,r);YF(t,n),ut(19,t[Bt])}function YF(r,e){e_(r)&&FR(r,e)}function FR(r,e){let t=r[Ie],i=r[Re],o=r[Fr],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(o?.dirty&&Vu(o)),s||=!1,o&&(o.dirty=!1),r[Re]&=-9217,s)W8(t,r,t.template,r[Bt]);else if(i&8192){let a=Ae(null);try{zF(r),KF(r,1);let c=t.components;c!==null&&QF(r,c,1),jF(r)}finally{Ae(a)}}}function QF(r,e,n){for(let t=0;t<e.length;t++)q8(r,e[t],n)}function K8(r,e){let n=r.hostBindingOpCodes;if(n!==null)try{for(let t=0;t<n.length;t++){let i=n[t];if(i<0)la(~i);else{let o=i,s=n[++t],a=n[++t];G0(s,o);let c=e[o];ut(24,c),a(2,c),ut(25,c)}}}finally{la(-1)}}function bD(r,e){let n=JA()?64:1088;for(r[mo].changeDetectionScheduler?.notify(e);r;){r[Re]|=n;let t=na(r);if(Qu(r)&&!t)return r;r=t}return null}function XF(r,e,n,t){return[r,!0,0,e,null,t,null,n,null,null]}function JF(r,e){let n=Gt+e;if(n<r.length)return r[n]}function eg(r,e,n,t=!0){let i=e[Ie];if(Y8(i,e,r,n),t){let s=xR(n,r),a=e[Xe],c=a.parentNode(r[aa]);c!==null&&f8(i,r[ir],a,e,c,s)}let o=e[jc];o!==null&&o.firstChild!==null&&(o.firstChild=null)}function ZF(r,e){let n=Kf(r,e);return n!==void 0&&Q_(n[Ie],n),n}function Kf(r,e){if(r.length<=Gt)return;let n=Gt+e,t=r[n];if(t){let i=t[sa];i!==null&&i!==r&&SD(i,t),e>0&&(r[n-1][ri]=t[ri]);let o=Mf(r,Gt+e);h8(t[Ie],t);let s=o[po];s!==null&&s.detachView(o[Ie]),t[an]=null,t[ri]=null,t[Re]&=-129}return t}function Y8(r,e,n,t){let i=Gt+t,o=n.length;t>0&&(n[i-1][ri]=e),t<o-Gt?(e[ri]=n[i],DA(n,Gt+t,e)):(n.push(e),e[ri]=null),e[an]=n;let s=e[sa];s!==null&&n!==s&&ek(s,e);let a=e[po];a!==null&&a.insertView(r),n_(e),e[Re]|=128}function ek(r,e){let n=r[Kc],t=e[an];if(Eo(t))r[Re]|=2;else{let i=t[an][qn];e[qn]!==i&&(r[Re]|=2)}n===null?r[Kc]=[e]:n.push(e)}var da=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,n=e[Ie];return qf(n,e,n.firstChild,[])}constructor(e,n){this._lView=e,this._cdRefInjectingView=n}get context(){return this._lView[Bt]}set context(e){this._lView[Bt]=e}get destroyed(){return Yc(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[an];if(Li(e)){let n=e[kf],t=n?n.indexOf(this):-1;t>-1&&(Kf(e,t),Mf(n,t))}this._attachedToViewContainer=!1}Q_(this._lView[Ie],this._lView)}onDestroy(e){GA(this._lView,e)}markForCheck(){bD(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[Re]&=-129}reattach(){n_(this._lView),this._lView[Re]|=128}detectChanges(){this._lView[Re]|=1024,qF(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new oe(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=Qu(this._lView),n=this._lView[sa];n!==null&&!e&&SD(n,this._lView),LF(this._lView[Ie],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new oe(902,!1);this._appRef=e;let n=Qu(this._lView),t=this._lView[sa];t!==null&&!n&&ek(t,this._lView),n_(this._lView)}};function Q8(r){return Xu(r._lView)||!!(r._lView[Re]&64)}function X8(r){t_(r._lView)}var So=(()=>{class r{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=J8;constructor(n,t,i){this._declarationLView=n,this._declarationTContainer=t,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(n,t){return this.createEmbeddedViewImpl(n,t)}createEmbeddedViewImpl(n,t,i){let o=Zf(this._declarationLView,this._declarationTContainer,n,{embeddedViewInjector:t,dehydratedView:i});return new da(o)}}return r})();function J8(){return eT(cn(),ce())}function eT(r,e){return r.type&4?new So(e,r,pd(r,e)):null}function sl(r,e,n,t,i){let o=r.data[e];if(o===null)o=Z8(r,e,n,t,i),B0()&&(o.flags|=32);else if(o.type&64){o.type=n,o.value=t,o.attrs=i;let s=U0();o.injectorIndex=s===null?-1:s.injectorIndex}return Xc(o,!0),o}function Z8(r,e,n,t,i){let o=KA(),s=YA(),a=s?o:o&&o.parent,c=r.data[e]=t5(r,a,n,e,t,i);return e5(r,c,o,s),c}function e5(r,e,n,t){r.firstChild===null&&(r.firstChild=e),n!==null&&(t?n.child==null&&e.parent!==null&&(n.child=e):n.next===null&&(n.next=e,e.prev=n))}function t5(r,e,n,t,i,o){let s=e?e.injectorIndex:-1,a=0;return WA()&&(a|=128),{type:n,index:t,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,namespace:nR(),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 _Ee=new RegExp(`^(\\d+)*(${tq}|${eq})*(.*)`);function n5(r){let e=r[FA]??[],t=r[an][Xe],i=[];for(let o of e)o.data[iF]!==void 0?i.push(o):r5(o,t);r[FA]=i}function r5(r,e){let n=0,t=r.firstChild;if(t){let i=r.data[rF];for(;n<i;){let o=t.nextSibling;EF(e,t,!1),t=o,n++}}}var i5=()=>null,o5=()=>null;function w_(r,e){return i5(r,e)}function tk(r,e,n){return o5(r,e,n)}var nk=class{},tT=class{},kR=class{resolveComponentFactory(e){throw new oe(917,!1)}},tg=class{static NULL=new kR},Es=class{},nT=(()=>{class r{destroyNode=null;static __NG_ELEMENT_ID__=()=>s5()}return r})();function s5(){let r=ce(),e=cn(),n=si(e.index,r);return(Eo(n)?n:r)[Xe]}var rk=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:()=>null})}return r})();var I_={},UR=class{injector;parentInjector;constructor(e,n){this.injector=e,this.parentInjector=n}get(e,n,t){let i=this.injector.get(e,I_,t);return i!==I_||n===I_?i:this.parentInjector.get(e,n,t)}};function L_(r,e,n){let t=n?r.styles:null,i=n?r.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=WE(i,a);else if(o==2){let c=a,l=e[++s];t=WE(t,c+": "+l+";")}}n?r.styles=t:r.stylesWithoutHost=t,n?r.classes=i:r.classesWithoutHost=i}function dt(r,e=0){let n=ce();if(n===null)return C(r,e);let t=cn();return Kx(t,n,sn(r),e)}function a5(){let r="invalid";throw new Error(r)}function ik(r,e,n,t,i){let o=t===null?null:{"":-1},s=i(r,n);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}u5(r,e,n,a,o,c,l)}o!==null&&t!==null&&c5(n,t,o)}function c5(r,e,n){let t=r.localNames=[];for(let i=0;i<e.length;i+=2){let o=n[e[i+1]];if(o==null)throw new oe(-301,!1);t.push(e[i],o)}}function l5(r,e,n){e.componentOffset=n,(r.components??=[]).push(e.index)}function u5(r,e,n,t,i,o,s){let a=t.length,c=!1;for(let f=0;f<a;f++){let g=t[f];!c&&Mi(g)&&(c=!0,l5(r,n,f)),TR(D_(n,e),r,g.type)}p5(n,r.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=yF(r,e,a,null);a>0&&(n.directiveToIndex=new Map);for(let f=0;f<a;f++){let g=t[f];if(n.mergedAttrs=id(n.mergedAttrs,g.hostAttrs),h5(r,n,e,d,g),m5(d,g,i),s!==null&&s.has(g)){let[_,T]=s.get(g);n.directiveToIndex.set(g.type,[d,_+n.directiveStart,T+n.directiveStart])}else(o===null||!o.has(g))&&n.directiveToIndex.set(g.type,d);g.contentQueries!==null&&(n.flags|=4),(g.hostBindings!==null||g.hostAttrs!==null||g.hostVars!==0)&&(n.flags|=64);let p=g.type.prototype;!l&&(p.ngOnChanges||p.ngOnInit||p.ngDoCheck)&&((r.preOrderHooks??=[]).push(n.index),l=!0),!u&&(p.ngOnChanges||p.ngDoCheck)&&((r.preOrderCheckHooks??=[]).push(n.index),u=!0),d++}d5(r,n,o)}function d5(r,e,n){for(let t=e.directiveStart;t<e.directiveEnd;t++){let i=r.data[t];if(n===null||!n.has(i))_x(0,e,i,t),_x(1,e,i,t),Ix(e,t,!1);else{let o=n.get(i);Tx(0,e,o,t),Tx(1,e,o,t),Ix(e,t,!0)}}}function _x(r,e,n,t){let i=r===0?n.inputs:n.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s;r===0?s=e.inputs??={}:s=e.outputs??={},s[o]??=[],s[o].push(t),ok(e,o)}}function Tx(r,e,n,t){let i=r===0?n.inputs:n.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o],a;r===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(t,o),ok(e,s)}}function ok(r,e){e==="class"?r.flags|=8:e==="style"&&(r.flags|=16)}function Ix(r,e,n){let{attrs:t,inputs:i,hostDirectiveInputs:o}=r;if(t===null||!n&&i===null||n&&o===null||mD(r)){r.initialInputs??=[],r.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(!n&&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(n&&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}r.initialInputs??=[],r.initialInputs.push(s)}function h5(r,e,n,t,i){r.data[t]=i;let o=i.factory||(i.factory=ta(i.type,!0)),s=new tl(o,Mi(i),dt,null);r.blueprint[t]=s,n[t]=s,f5(r,e,t,yF(r,n,i.hostVars,vn),i)}function f5(r,e,n,t,i){let o=i.hostBindings;if(o){let s=r.hostBindingOpCodes;s===null&&(s=r.hostBindingOpCodes=[]);let a=~e.index;g5(s)!=a&&s.push(a),s.push(n,t,o)}}function g5(r){let e=r.length;for(;e>0;){let n=r[--e];if(typeof n=="number"&&n<0)return n}return 0}function m5(r,e,n){if(n){if(e.exportAs)for(let t=0;t<e.exportAs.length;t++)n[e.exportAs[t]]=r;Mi(e)&&(n[""]=r)}}function p5(r,e,n){r.flags|=1,r.directiveStart=e,r.directiveEnd=e+n,r.providerIndexes=e}function wD(r,e,n,t,i,o,s,a){let c=e[Ie],l=c.consts,u=kr(l,s),d=sl(c,r,n,t,u);return o&&ik(c,e,d,kr(l,a),i),d.mergedAttrs=id(d.mergedAttrs,d.attrs),d.attrs!==null&&L_(d,d.attrs,!1),d.mergedAttrs!==null&&L_(d,d.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,d),d}function LD(r,e){Bx(r,e),kA(e)&&r.queries.elementEnd(e)}function E5(r,e,n,t,i,o){let s=e.consts,a=kr(s,i),c=sl(e,r,n,t,a);if(c.mergedAttrs=id(c.mergedAttrs,c.attrs),o!=null){let l=kr(s,o);c.localNames=[];for(let u=0;u<l.length;u+=2)c.localNames.push(l[u],-1)}return c.attrs!==null&&L_(c,c.attrs,!1),c.mergedAttrs!==null&&L_(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}function MD(r){return rT(r)?Array.isArray(r)||!(r instanceof Map)&&Symbol.iterator in r:!1}function sk(r,e){if(Array.isArray(r))for(let n=0;n<r.length;n++)e(r[n]);else{let n=r[Symbol.iterator](),t;for(;!(t=n.next()).done;)e(t.value)}}function rT(r){return r!==null&&(typeof r=="function"||typeof r=="object")}function Ro(r,e,n){return r[e]=n}function ng(r,e){return r[e]}function wn(r,e,n){if(n===vn)return!1;let t=r[e];return Object.is(t,n)?!1:(r[e]=n,!0)}function cd(r,e,n,t){let i=wn(r,e,n);return wn(r,e+1,t)||i}function PD(r,e,n,t,i){let o=cd(r,e,n,t);return wn(r,e+2,i)||o}function ld(r,e,n,t,i,o){let s=cd(r,e,n,t);return cd(r,e+2,i,o)||s}function v_(r,e,n){return function t(i){let o=fs(r)?si(r.index,e):e;bD(o,5);let s=e[Bt],a=vx(e,s,n,i),c=t.__ngNextListenerFn__;for(;c;)a=vx(e,s,c,i)&&a,c=c.__ngNextListenerFn__;return a}}function vx(r,e,n,t){let i=Ae(null);try{return ut(6,e,n),n(t)!==!1}catch(o){return M8(r,o),!1}finally{ut(7,e,n),Ae(i)}}function ak(r,e,n,t,i,o,s,a){let c=Yu(r),l=!1,u=null;if(!t&&c&&(u=T5(e,n,o,r.index)),u!==null){let d=u.__ngLastListenerFn__||u;d.__ngNextListenerFn__=s,u.__ngLastListenerFn__=s,l=!0}else{let d=oi(r,n),f=t?t(d):d;rq(n,f,o,a);let g=i.listen(f,o,a);if(!_5(o)){let p=t?_=>t(ii(_[r.index])):r.index;ck(p,e,n,o,a,g,!1)}}return l}function _5(r){return r.startsWith("animation")||r.startsWith("transition")}function T5(r,e,n,t){let i=r.cleanup;if(i!=null)for(let o=0;o<i.length-1;o+=2){let s=i[o];if(s===n&&i[o+1]===t){let a=e[qu],c=i[o+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(o+=2)}return null}function ck(r,e,n,t,i,o,s){let a=e.firstCreatePass?jA(e):null,c=$A(n),l=c.length;c.push(i,o),a&&a.push(t,r,l,(l+1)*(s?-1:1))}function yx(r,e,n,t,i,o){let s=e[n],a=e[Ie],l=a.data[n].outputs[t],d=s[l].subscribe(o);ck(r.index,a,e,i,o,d,!0)}var VR=Symbol("BINDING");var M_=class extends tg{ngModule;constructor(e){super(),this.ngModule=e}resolveComponentFactory(e){let n=oa(e);return new ud(n,this.ngModule)}};function I5(r){return Object.keys(r).map(e=>{let[n,t,i]=r[e],o={propName:n,templateName:e,isSignal:(t&K_.SignalBased)!==0};return i&&(o.transform=i),o})}function v5(r){return Object.keys(r).map(e=>({propName:r[e],templateName:e}))}function y5(r,e,n){let t=e instanceof zn?e:e?.injector;return t&&r.getStandaloneInjector!==null&&(t=r.getStandaloneInjector(t)||t),t?new UR(n,t):n}function S5(r){let e=r.get(Es,null);if(e===null)throw new oe(407,!1);let n=r.get(rk,null),t=r.get(ni,null);return{rendererFactory:e,sanitizer:n,changeDetectionScheduler:t,ngReflect:!1}}function A5(r,e){let n=lk(r);return mF(e,n,n==="svg"?UA:n==="math"?N0:null)}function R5(r){if(r?.toLowerCase()==="script")throw new oe(905,!1)}function lk(r){return(r.selectors[0][0]||"div").toLowerCase()}var ud=class extends tT{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=I5(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=v5(this.componentDef.outputs),this.cachedOutputs}constructor(e,n){super(),this.componentDef=e,this.ngModule=n,this.componentType=e.type,this.selector=Kq(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!n}create(e,n,t,i,o,s){ut(22);let a=Ae(null);try{let c=this.componentDef,l=D5(t,c,s,o),u=y5(c,i||this.ngModule,e),d=S5(u),f=d.rendererFactory.createRenderer(null,c),g=t?A8(f,t,c.encapsulation,u):A5(c,f);R5(g?.tagName);let p=s?.some(Sx)||o?.some(D=>typeof D!="function"&&D.bindings.some(Sx)),_=ED(null,l,null,512|vF(c),null,null,d,f,u,null,aF(g,u,!0));_[Je]=g,s_(_);let T=null;try{let D=wD(Je,_,2,"#host",()=>l.directiveRegistry,!0,0);_F(f,g,D),od(g,_),J_(l,_,D),cD(l,D,_),LD(l,D),n!==void 0&&N5(D,this.ngContentSelectors,n),T=si(D.index,_),_[Bt]=T[Bt],OD(l,_,null)}catch(D){throw T!==null&&vR(T),vR(_),D}finally{ut(23),a_()}return new P_(this.componentType,_,!!p)}finally{Ae(a)}}};function D5(r,e,n,t){let i=r?["ng-version","20.3.27"]:Yq(e.selectors[0]),o=null,s=null,a=0;if(n)for(let u of n)a+=u[VR].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[VR].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=JE(d);c.push(f)}return pD(0,null,C5(o,s),1,a,c,null,null,null,[i],null)}function C5(r,e){return!r&&!e?null:n=>{if(n&1&&r)for(let t of r)t.create();if(n&2&&e)for(let t of e)t.update()}}function Sx(r){let e=r[VR].kind;return e==="input"||e==="twoWay"}var P_=class extends nk{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,n,t){super(),this._rootLView=n,this._hasInputBindings=t,this._tNode=Uf(n[Ie],Je),this.location=pd(this._tNode,n),this.instance=si(this._tNode.index,n)[Bt],this.hostView=this.changeDetectorRef=new da(n,void 0),this.componentType=e}setInput(e,n){this._hasInputBindings;let t=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),n))return;let i=this._rootLView,o=Z_(t,i[Ie],i,e,n);this.previousInputValues.set(e,n);let s=si(t.index,i);bD(s,1)}get injector(){return new el(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function N5(r,e,n){let t=r.projection=[];for(let i=0;i<e.length;i++){let o=n[i];t.push(o!=null&&o.length?Array.from(o):null)}}var Do=(()=>{class r{static __NG_ELEMENT_ID__=O5}return r})();function O5(){let r=cn();return dk(r,ce())}var b5=Do,uk=class extends b5{_lContainer;_hostTNode;_hostLView;constructor(e,n,t){super(),this._lContainer=e,this._hostTNode=n,this._hostLView=t}get element(){return pd(this._hostTNode,this._hostLView)}get injector(){return new el(this._hostTNode,this._hostLView)}get parentInjector(){let e=iD(this._hostTNode,this._hostLView);if($x(e)){let n=A_(e,this._hostLView),t=S_(e),i=n[Ie].data[t+8];return new el(i,n)}else return new el(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let n=Ax(this._lContainer);return n!==null&&n[e]||null}get length(){return this._lContainer.length-Gt}createEmbeddedView(e,n,t){let i,o;typeof t=="number"?i=t:t!=null&&(i=t.index,o=t.injector);let s=w_(this._lContainer,e.ssrId),a=e.createEmbeddedViewImpl(n||{},o,s);return this.insertImpl(a,i,ad(this._hostTNode,s)),a}createComponent(e,n,t,i,o,s,a){let c=e&&!C4(e),l;if(c)l=n;else{let T=n||{};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 ud(oa(e)),d=t||this.parentInjector;if(!o&&u.ngModule==null){let D=(c?d:this.parentInjector).get(zn,null);D&&(o=D)}let f=oa(u.componentType??{}),g=w_(this._lContainer,f?.id??null),p=g?.firstChild??null,_=u.create(d,i,p,o,s,a);return this.insertImpl(_.hostView,l,ad(this._hostTNode,g)),_}insert(e,n){return this.insertImpl(e,n,!0)}insertImpl(e,n,t){let i=e._lView;if(b0(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[an],l=new uk(c,c[ir],c[an]);l.detach(l.indexOf(e))}}let o=this._adjustIndex(n),s=this._lContainer;return eg(s,i,o,t),e.attachToViewContainerRef(),DA(uR(s),o,e),e}move(e,n){return this.insert(e,n)}indexOf(e){let n=Ax(this._lContainer);return n!==null?n.indexOf(e):-1}remove(e){let n=this._adjustIndex(e,-1),t=Kf(this._lContainer,n);t&&(Mf(uR(this._lContainer),n),Q_(t[Ie],t))}detach(e){let n=this._adjustIndex(e,-1),t=Kf(this._lContainer,n);return t&&Mf(uR(this._lContainer),n)!=null?new da(t):null}_adjustIndex(e,n=0){return e??this.length+n}};function Ax(r){return r[kf]}function uR(r){return r[kf]||(r[kf]=[])}function dk(r,e){let n,t=e[r.index];return Li(t)?n=t:(n=XF(t,e,null,r),e[r.index]=n,_D(e,n)),L5(n,e,r,t),new uk(n,r,e)}function w5(r,e){let n=r[Xe],t=n.createComment(""),i=oi(e,r),o=n.parentNode(i);return N_(n,o,t,n.nextSibling(i),!1),t}var L5=x5,M5=()=>!1;function P5(r,e,n){return M5(r,e,n)}function x5(r,e,n,t){if(r[aa])return;let i;n.type&8?i=ii(t):i=w5(e,n),r[aa]=i}var BR=class r{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new r(this.queryList)}setDirty(){this.queryList.setDirty()}},GR=class r{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let n=e.queries;if(n!==null){let t=e.contentQueries!==null?e.contentQueries[0]:n.length,i=[];for(let o=0;o<t;o++){let s=n.getByIndex(o),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new r(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let n=0;n<this.queries.length;n++)FD(e,n).matches!==null&&this.queries[n].setDirty()}},x_=class{flags;read;predicate;constructor(e,n,t=null){this.flags=n,this.read=t,typeof e=="string"?this.predicate=G5(e):this.predicate=e}},$R=class r{queries;constructor(e=[]){this.queries=e}elementStart(e,n){for(let t=0;t<this.queries.length;t++)this.queries[t].elementStart(e,n)}elementEnd(e){for(let n=0;n<this.queries.length;n++)this.queries[n].elementEnd(e)}embeddedTView(e){let n=null;for(let t=0;t<this.length;t++){let i=n!==null?n.length:0,o=this.getByIndex(t).embeddedTView(e,i);o&&(o.indexInDeclarationView=t,n!==null?n.push(o):n=[o])}return n!==null?new r(n):null}template(e,n){for(let t=0;t<this.queries.length;t++)this.queries[t].template(e,n)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},jR=class r{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,n=-1){this.metadata=e,this._declarationNodeIndex=n}elementStart(e,n){this.isApplyingToNode(n)&&this.matchTNode(e,n)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,n){this.elementStart(e,n)}embeddedTView(e,n){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,n),new r(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let n=this._declarationNodeIndex,t=e.parent;for(;t!==null&&t.type&8&&t.index!==n;)t=t.parent;return n===(t!==null?t.index:-1)}return this._appliesToNextNode}matchTNode(e,n){let t=this.metadata.predicate;if(Array.isArray(t))for(let i=0;i<t.length;i++){let o=t[i];this.matchTNodeWithReadOption(e,n,F5(n,o)),this.matchTNodeWithReadOption(e,n,T_(n,e,o,!1,!1))}else t===So?n.type&4&&this.matchTNodeWithReadOption(e,n,-1):this.matchTNodeWithReadOption(e,n,T_(n,e,t,!1,!1))}matchTNodeWithReadOption(e,n,t){if(t!==null){let i=this.metadata.read;if(i!==null)if(i===ha||i===Do||i===So&&n.type&4)this.addMatch(n.index,-2);else{let o=T_(n,e,i,!1,!1);o!==null&&this.addMatch(n.index,o)}else this.addMatch(n.index,t)}}addMatch(e,n){this.matches===null?this.matches=[e,n]:this.matches.push(e,n)}};function F5(r,e){let n=r.localNames;if(n!==null){for(let t=0;t<n.length;t+=2)if(n[t]===e)return n[t+1]}return null}function k5(r,e){return r.type&11?pd(r,e):r.type&4?eT(r,e):null}function U5(r,e,n,t){return n===-1?k5(e,r):n===-2?V5(r,e,t):zf(r,r[Ie],n,e)}function V5(r,e,n){if(n===ha)return pd(e,r);if(n===So)return eT(e,r);if(n===Do)return dk(e,r)}function hk(r,e,n,t){let i=e[po].queries[t];if(i.matches===null){let o=r.data,s=n.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(U5(e,u,s[c+1],n.metadata.read))}}i.matches=a}return i.matches}function HR(r,e,n,t){let i=r.queries.getByIndex(n),o=i.matches;if(o!==null){let s=hk(r,e,i,n);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=Gt;d<u.length;d++){let f=u[d];f[sa]===f[an]&&HR(f[Ie],f,l,t)}if(u[Kc]!==null){let d=u[Kc];for(let f=0;f<d.length;f++){let g=d[f];HR(g[Ie],g,l,t)}}}}}return t}function xD(r,e){return r[po].queries[e].queryList}function fk(r,e,n){let t=new C_((n&4)===4);return M0(r,e,t,t.destroy),(e[po]??=new GR).queries.push(new BR(t))-1}function gk(r,e,n){let t=Ze();return t.firstCreatePass&&(mk(t,new x_(r,e,n),-1),(e&2)===2&&(t.staticViewQueries=!0)),fk(t,ce(),e)}function B5(r,e,n,t){let i=Ze();if(i.firstCreatePass){let o=cn();mk(i,new x_(e,n,t),o.index),$5(i,r),(n&2)===2&&(i.staticContentQueries=!0)}return fk(i,ce(),n)}function G5(r){return r.split(",").map(e=>e.trim())}function mk(r,e,n){r.queries===null&&(r.queries=new $R),r.queries.track(new jR(e,n))}function $5(r,e){let n=r.contentQueries||(r.contentQueries=[]),t=n.length?n[n.length-1]:-1;e!==t&&n.push(r.queries.length-1,e)}function FD(r,e){return r.queries.getByIndex(e)}function pk(r,e){let n=r[Ie],t=FD(n,e);return t.crossesNgTemplate?HR(n,r,e,[]):hk(n,r,t,e)}function Ek(r,e,n){let t,i=Cf(()=>{t._dirtyCounter();let o=H5(t,r);if(e&&o===void 0)throw new oe(-951,!1);return o});return t=i[Tn],t._dirtyCounter=Jc(0),t._flatValue=void 0,i}function _k(r){return Ek(!0,!1,r)}function Tk(r){return Ek(!0,!0,r)}function j5(r,e){let n=r[Tn];n._lView=ce(),n._queryIndex=e,n._queryList=xD(n._lView,e),n._queryList.onDirty(()=>n._dirtyCounter.update(t=>t+1))}function H5(r,e){let n=r._lView,t=r._queryIndex;if(n===void 0||t===void 0||n[Re]&4)return e?void 0:Wn;let i=xD(n,t),o=pk(n,t);return i.reset(o,Xx),e?i.first:i._changesDetected||r._flatValue===void 0?r._flatValue=i.toArray():r._flatValue}function Ik(r){let e=[],n=new Map;function t(i){let o=n.get(i);if(!o){let s=r(i);n.set(i,o=s.then(a=>z5(i,a)))}return o}return F_.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(()=>q5(o));e.push(c)}),vk(),Promise.all(e).then(()=>{})}var F_=new Map,W5=new Set;function vk(){let r=F_;return F_=new Map,r}function yk(){return F_.size===0}function z5(r,e){return typeof e=="string"?e:e.status!==void 0&&e.status!==200?Promise.reject(new oe(918,!1)):e.text()}function q5(r){W5.delete(r)}var rl=class{},Sk=class{};function Ak(r,e){return new dd(r,e??null,[])}var dd=class extends rl{ngModuleType;_parent;_bootstrapComponents=[];_r3Injector;instance;destroyCbs=[];componentFactoryResolver=new M_(this);constructor(e,n,t,i=!0){super(),this.ngModuleType=e,this._parent=n;let o=y0(e);this._bootstrapComponents=kq(o.bootstrap),this._r3Injector=rR(e,n,[{provide:rl,useValue:this},{provide:tg,useValue:this.componentFactoryResolver},...t],ls(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(n=>n()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}},k_=class extends Sk{moduleType;constructor(e){super(),this.moduleType=e}create(e){return new dd(this.moduleType,e,[])}};function Rk(r,e,n){return new dd(r,e,n,!1)}var U_=class extends rl{injector;componentFactoryResolver=new M_(this);instance=null;constructor(e){super();let n=new Gc([...e.providers,{provide:rl,useValue:this},{provide:tg,useValue:this.componentFactoryResolver}],e.parent||zu(),e.debugName,new Set(["environment"]));this.injector=n,e.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function Dk(r,e,n=null){return new U_({providers:r,parent:e,debugName:n,runEnvironmentInitializers:!0}).injector}var K5=(()=>{class r{_injector;cachedInjectors=new Map;constructor(n){this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let t=bA(!1,n.type),i=t.length>0?Dk([t],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:r,providedIn:"environment",factory:()=>new r(C(zn))})}return r})();function Y5(r){return md(()=>{let e=Nk(r),n=le(M({},e),{decls:r.decls,vars:r.vars,template:r.template,consts:r.consts||null,ngContentSelectors:r.ngContentSelectors,onPush:r.changeDetection===oD.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&r.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(K5).getOrCreateStandaloneInjector(n):null,getExternalStyles:null,signals:r.signals??!1,data:r.data||{},encapsulation:r.encapsulation||ms.Emulated,styles:r.styles||Wn,_:null,schemas:r.schemas||null,tView:null,id:""});e.standalone&&Is("NgStandalone"),Ok(n);let t=r.dependencies;return n.directiveDefs=V_(t,Ck),n.pipeDefs=V_(t,OA),n.id=J5(n),n})}function Ck(r){return oa(r)||JE(r)}function fa(r){return md(()=>({type:r.type,bootstrap:r.bootstrap||Wn,declarations:r.declarations||Wn,imports:r.imports||Wn,exports:r.exports||Wn,transitiveCompileScopes:null,schemas:r.schemas||null,id:r.id||null}))}function Q5(r,e){if(r==null)return bi;let n={};for(let t in r)if(r.hasOwnProperty(t)){let i=r[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=K_.None,c=null),n[o]=[t,a,c],e[o]=s}return n}function X5(r){if(r==null)return bi;let e={};for(let n in r)r.hasOwnProperty(n)&&(e[r[n]]=n);return e}function Co(r){return md(()=>{let e=Nk(r);return Ok(e),e})}function rg(r){return{type:r.type,name:r.name,factory:null,pure:r.pure!==!1,standalone:r.standalone??!0,onDestroy:r.type.prototype.ngOnDestroy||null}}function Nk(r){let e={};return{type:r.type,providersResolver:null,factory:null,hostBindings:r.hostBindings||null,hostVars:r.hostVars||0,hostAttrs:r.hostAttrs||null,contentQueries:r.contentQueries||null,declaredInputs:e,inputConfig:r.inputs||bi,exportAs:r.exportAs||null,standalone:r.standalone??!0,signals:r.signals===!0,selectors:r.selectors||Wn,viewQuery:r.viewQuery||null,features:r.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,inputs:Q5(r.inputs,e),outputs:X5(r.outputs),debugInfo:null}}function Ok(r){r.features?.forEach(e=>e(r))}function V_(r,e){return r?()=>{let n=typeof r=="function"?r():r,t=[];for(let i of n){let o=e(i);o!==null&&t.push(o)}return t}:null}function J5(r){let e=0,n=typeof r.consts=="function"?"":r.consts,t=[r.selectors,r.ngContentSelectors,r.hostVars,r.hostAttrs,n,r.vars,r.decls,r.encapsulation,r.standalone,r.signals,r.exportAs,JSON.stringify(r.inputs),JSON.stringify(r.outputs),Object.getOwnPropertyNames(r.type.prototype),!!r.contentQueries,!!r.viewQuery];for(let o of t.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function Z5(r){return Object.getPrototypeOf(r.prototype).constructor}function bk(r){let e=Z5(r.type),n=!0,t=[r];for(;e;){let i;if(Mi(r))i=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new oe(903,!1);i=e.\u0275dir}if(i){if(n){t.push(i);let s=r;s.inputs=dR(r.inputs),s.declaredInputs=dR(r.declaredInputs),s.outputs=dR(r.outputs);let a=i.hostBindings;a&&i9(r,a);let c=i.viewQuery,l=i.contentQueries;if(c&&n9(r,c),l&&r9(r,l),e9(r,i),f0(r.outputs,i.outputs),Mi(i)&&i.data.animation){let u=r.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(r),a===bk&&(n=!1)}}e=Object.getPrototypeOf(e)}t9(t)}function e9(r,e){for(let n in e.inputs){if(!e.inputs.hasOwnProperty(n)||r.inputs.hasOwnProperty(n))continue;let t=e.inputs[n];t!==void 0&&(r.inputs[n]=t,r.declaredInputs[n]=e.declaredInputs[n])}}function t9(r){let e=0,n=null;for(let t=r.length-1;t>=0;t--){let i=r[t];i.hostVars=e+=i.hostVars,i.hostAttrs=id(i.hostAttrs,n=id(n,i.hostAttrs))}}function dR(r){return r===bi?{}:r===Wn?[]:r}function n9(r,e){let n=r.viewQuery;n?r.viewQuery=(t,i)=>{e(t,i),n(t,i)}:r.viewQuery=e}function r9(r,e){let n=r.contentQueries;n?r.contentQueries=(t,i,o)=>{e(t,i,o),n(t,i,o)}:r.contentQueries=e}function i9(r,e){let n=r.hostBindings;n?r.hostBindings=(t,i)=>{e(t,i),n(t,i)}:r.hostBindings=e}function o9(r){let e=n=>{let t=Array.isArray(r);n.hostDirectives===null?(n.resolveHostDirectives=s9,n.hostDirectives=t?r.map(WR):[r]):t?n.hostDirectives.unshift(...r.map(WR)):n.hostDirectives.unshift(r)};return e.ngInherit=!0,e}function s9(r){let e=[],n=!1,t=null,i=null;for(let o=0;o<r.length;o++){let s=r[o];if(s.hostDirectives!==null){let a=e.length;t??=new Map,i??=new Map,wk(s,e,t),i.set(s,[a,e.length-1])}o===0&&Mi(s)&&(n=!0,e.push(s))}for(let o=n?1:0;o<r.length;o++)e.push(r[o]);return[e,t,i]}function wk(r,e,n){if(r.hostDirectives!==null)for(let t of r.hostDirectives)if(typeof t=="function"){let i=t();for(let o of i)Rx(WR(o),e,n)}else Rx(t,e,n)}function Rx(r,e,n){let t=JE(r.directive);a9(t.declaredInputs,r.inputs),wk(t,e,n),n.set(t,r),e.push(t)}function WR(r){return typeof r=="function"?{directive:sn(r),inputs:bi,outputs:bi}:{directive:sn(r.directive),inputs:Dx(r.inputs),outputs:Dx(r.outputs)}}function Dx(r){if(r===void 0||r.length===0)return bi;let e={};for(let n=0;n<r.length;n+=2)e[r[n]]=r[n+1];return e}function a9(r,e){for(let n in e)if(e.hasOwnProperty(n)){let t=e[n],i=r[n];r[t]=i}}function Lk(r,e,n,t,i,o,s,a){if(n.firstCreatePass){r.mergedAttrs=id(r.mergedAttrs,r.attrs);let u=r.tView=pD(2,r,i,o,s,n.directiveRegistry,n.pipeRegistry,null,n.schemas,n.consts,null);n.queries!==null&&(n.queries.template(n,r),u.queries=n.queries.embeddedTView(r))}a&&(r.flags|=a),Xc(r,!1);let c=l9(n,e,r,t);c_()&&AD(n,e,c,r),od(c,e);let l=XF(c,e,c,r);e[t+Je]=l,_D(e,l),P5(l,r,e)}function c9(r,e,n,t,i,o,s,a,c,l,u){let d=n+Je,f;return e.firstCreatePass?(f=sl(e,d,4,s||null,a||null),r_()&&ik(e,r,f,kr(e.consts,l),DD),Bx(e,f)):f=e.data[d],Lk(f,r,e,n,t,i,o,c),Yu(f)&&J_(e,r,f),l!=null&&Jf(r,f,u),f}function hd(r,e,n,t,i,o,s,a,c,l,u){let d=n+Je,f;if(e.firstCreatePass){if(f=sl(e,d,4,s||null,a||null),l!=null){let g=kr(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 Lk(f,r,e,n,t,i,o,c),l!=null&&Jf(r,f,u),f}function Mk(r,e,n,t,i,o,s,a){let c=ce(),l=Ze(),u=kr(l.consts,o);return c9(c,l,r,e,n,t,i,u,void 0,s,a),Mk}function Pk(r,e,n,t,i,o,s,a){let c=ce(),l=Ze(),u=kr(l.consts,o);return hd(c,l,r,e,n,t,i,u,void 0,s,a),Pk}var l9=u9;function u9(r,e,n,t){return $f(!0),e[Xe].createComment("")}var iT=new ee(""),_d=new ee(""),ig=(()=>{class r{_ngZone;registry;_isZoneStable=!0;_callbacks=[];_taskTrackingZone=null;_destroyRef;constructor(n,t,i){this._ngZone=n,this.registry=t,MA()&&(this._destroyRef=J(sr,{optional:!0})??void 0),kD||(xk(i),i.addToWindow(t)),this._watchAngularEvents(),n.run(()=>{this._taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){let n=this._ngZone.onUnstable.subscribe({next:()=>{this._isZoneStable=!1}}),t=this._ngZone.runOutsideAngular(()=>this._ngZone.onStable.subscribe({next:()=>{we.assertNotInAngularZone(),queueMicrotask(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}}));this._destroyRef?.onDestroy(()=>{n.unsubscribe(),t.unsubscribe()})}isStable(){return this._isZoneStable&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())queueMicrotask(()=>{for(;this._callbacks.length!==0;){let n=this._callbacks.pop();clearTimeout(n.timeoutId),n.doneCb()}});else{let n=this.getPendingTasks();this._callbacks=this._callbacks.filter(t=>t.updateCb&&t.updateCb(n)?(clearTimeout(t.timeoutId),!1):!0)}}getPendingTasks(){return this._taskTrackingZone?this._taskTrackingZone.macroTasks.map(n=>({source:n.source,creationLocation:n.creationLocation,data:n.data})):[]}addCallback(n,t,i){let o=-1;t&&t>0&&(o=setTimeout(()=>{this._callbacks=this._callbacks.filter(s=>s.timeoutId!==o),n()},t)),this._callbacks.push({doneCb:n,timeoutId:o,updateCb:i})}whenStable(n,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(n,t,i),this._runCallbacksIfReady()}registerApplication(n){this.registry.registerApplication(n,this)}unregisterApplication(n){this.registry.unregisterApplication(n)}findProviders(n,t,i){return[]}static \u0275fac=function(t){return new(t||r)(C(we),C(og),C(_d))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),og=(()=>{class r{_applications=new Map;registerApplication(n,t){this._applications.set(n,t)}unregisterApplication(n){this._applications.delete(n)}unregisterAllApplications(){this._applications.clear()}getTestability(n){return this._applications.get(n)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(n,t=!0){return kD?.findTestabilityInTree(this,n,t)??null}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"platform"})}return r})();function xk(r){kD=r}var kD;function oT(r){return!!r&&typeof r.then=="function"}function UD(r){return!!r&&typeof r.subscribe=="function"}var Fk=new ee("");var VD=(()=>{class r{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((n,t)=>{this.resolve=n,this.reject=t});appInits=J(Fk,{optional:!0})??[];injector=J(lt);constructor(){}runInitializers(){if(this.initialized)return;let n=[];for(let i of this.appInits){let o=go(this.injector,i);if(oT(o))n.push(o);else if(UD(o)){let s=new Promise((a,c)=>{o.subscribe({complete:a,error:c})});n.push(s)}}let t=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{t()}).catch(i=>{this.reject(i)}),n.length===0&&t(),this.initialized=!0}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),kk=new ee("");function Uk(){JS(()=>{let r="";throw new oe(600,r)})}function Vk(r){return r.isBoundToModule}var d9=10;function BD(r,e){return Array.isArray(e)?e.reduce(BD,r):M(M({},r),e)}var ga=(()=>{class r{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=J(To);afterRenderManager=J(yD);zonelessEnabled=J(td);rootEffectScheduler=J(jf);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new Ct;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=J(ua);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(ge(n=>!n))}constructor(){J(ol,{optional:!0})}whenStable(){let n;return new Promise(t=>{n=this.isStable.subscribe({next:i=>{i&&t()}})}).finally(()=>{n.unsubscribe()})}_injector=J(zn);_rendererFactory=null;get injector(){return this._injector}bootstrap(n,t){return this.bootstrapImpl(n,t)}bootstrapImpl(n,t,i=lt.NULL){return this._injector.get(we).run(()=>{ut(10);let s=n instanceof tT;if(!this._injector.get(VD).done){let p="";throw new oe(405,p)}let c;s?c=n:c=this._injector.get(tg).resolveComponentFactory(n),this.componentTypes.push(c.componentType);let l=Vk(c)?void 0:this._injector.get(rl),u=t||c.selector,d=c.create(i,[],u,l),f=d.location.nativeElement,g=d.injector.get(iT,null);return g?.registerApplication(f),d.onDestroy(()=>{this.detachView(d.hostView),Wf(this.components,d),g?.unregisterApplication(f)}),this._loadComponent(d),ut(11,d),d})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){ut(12),this.tracingSnapshot!==null?this.tracingSnapshot.run(Y_.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw new oe(101,!1);let n=Ae(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,Ae(n),this.afterTick.next(),ut(13)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(Es,null,{optional:!0}));let n=0;for(;this.dirtyFlags!==0&&n++<d9;)ut(14),this.synchronizeOnce(),ut(15)}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let n=!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&&!Xu(i))continue;let o=t&&!this.zonelessEnabled?0:1;qF(i,o),n=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}n||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:n})=>Xu(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let t=n;this._views.push(t),t.attachToAppRef(this)}detachView(n){let t=n;Wf(this._views,t),t.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(n),this._injector.get(kk,[]).forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Wf(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new oe(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function Wf(r,e){let n=r.indexOf(e);n>-1&&r.splice(n,1)}function Bk(r,e){let n=ce(),t=_o();if(wn(n,t,e)){let i=Ze(),o=Zu();if(Z_(o,i,n,r,e))fs(o)&&BF(n,o.index);else{let a=oi(o,n);GF(n[Xe],a,null,o.value,r,e,null)}}return Bk}function Gk(r,e,n,t){let i=ce(),o=_o();if(wn(i,o,e)){let s=Ze(),a=Zu();w8(a,i,r,e,n,t)}return Gk}var REe=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";function h9(){return ce()[qn][Bt]}var zR=class{destroy(e){}updateValue(e,n){}swap(e,n){let t=Math.min(e,n),i=Math.max(e,n),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,n){this.attach(n,this.detach(e))}};function hR(r,e,n,t,i){return r===n&&Object.is(e,t)?1:Object.is(i(r,e),i(n,t))?-1:0}function f9(r,e,n){let t,i,o=0,s=r.length-1,a=void 0;if(Array.isArray(e)){let c=e.length-1;for(;o<=s&&o<=c;){let l=r.at(o),u=e[o],d=hR(o,l,o,u,n);if(d!==0){d<0&&r.updateValue(o,u),o++;continue}let f=r.at(s),g=e[c],p=hR(s,f,c,g,n);if(p!==0){p<0&&r.updateValue(s,g),s--,c--;continue}let _=n(o,l),T=n(s,f),D=n(o,u);if(Object.is(D,T)){let L=n(c,g);Object.is(L,_)?(r.swap(o,s),r.updateValue(s,g),c--,s--):r.move(s,o),r.updateValue(o,u),o++;continue}if(t??=new B_,i??=Nx(r,o,s,n),qR(r,t,o,D))r.updateValue(o,u),o++,s++;else if(i.has(D))t.set(_,r.detach(o)),s--;else{let L=r.create(o,e[o]);r.attach(o,L),o++,s++}}for(;o<=c;)Cx(r,t,n,o,e[o]),o++}else if(e!=null){let c=e[Symbol.iterator](),l=c.next();for(;!l.done&&o<=s;){let u=r.at(o),d=l.value,f=hR(o,u,o,d,n);if(f!==0)f<0&&r.updateValue(o,d),o++,l=c.next();else{t??=new B_,i??=Nx(r,o,s,n);let g=n(o,d);if(qR(r,t,o,g))r.updateValue(o,d),o++,s++,l=c.next();else if(!i.has(g))r.attach(o,r.create(o,d)),o++,s++,l=c.next();else{let p=n(o,u);t.set(p,r.detach(o)),s--}}}for(;!l.done;)Cx(r,t,n,r.length,l.value),l=c.next()}for(;o<=s;)r.destroy(r.detach(s--));t?.forEach(c=>{r.destroy(c)})}function qR(r,e,n,t){return e!==void 0&&e.has(t)?(r.attach(n,e.get(t)),e.delete(t),!0):!1}function Cx(r,e,n,t,i){if(qR(r,e,t,n(t,i)))r.updateValue(t,i);else{let o=r.create(t,i);r.attach(t,o)}}function Nx(r,e,n,t){let i=new Set;for(let o=e;o<=n;o++)i.add(t(o,r.at(o)));return i}var B_=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let n=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(n)?(this.kvMap.set(e,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,n){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,n)}else this.kvMap.set(e,n)}forEach(e){for(let[n,t]of this.kvMap)if(e(t,n),this._vMap!==void 0){let i=this._vMap;for(;i.has(t);)t=i.get(t),e(t,n)}}};function g9(r,e,n,t,i,o,s,a){Is("NgControlFlow");let c=ce(),l=Ze(),u=kr(l.consts,o);return hd(c,l,r,e,n,t,i,u,256,s,a),GD}function GD(r,e,n,t,i,o,s,a){Is("NgControlFlow");let c=ce(),l=Ze(),u=kr(l.consts,o);return hd(c,l,r,e,n,t,i,u,512,s,a),GD}function m9(r,e){Is("NgControlFlow");let n=ce(),t=_o(),i=n[t]!==vn?n[t]:-1,o=i!==-1?G_(n,Je+i):void 0,s=0;if(wn(n,t,r)){let a=Ae(null);try{if(o!==void 0&&ZF(o,s),r!==-1){let c=Je+r,l=G_(n,c),u=XR(n[Ie],c),d=tk(l,u,n),f=Zf(n,u,e,{dehydratedView:d});eg(l,f,s,ad(u,d))}}finally{Ae(a)}}else if(o!==void 0){let a=JF(o,s);a!==void 0&&(a[Bt]=e)}}var KR=class{lContainer;$implicit;$index;constructor(e,n,t){this.lContainer=e,this.$implicit=n,this.$index=t}get $count(){return this.lContainer.length-Gt}};function p9(r){return r}function E9(r,e){return e}var YR=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,n,t){this.hasEmptyBlock=e,this.trackByFn=n,this.liveCollection=t}};function _9(r,e,n,t,i,o,s,a,c,l,u,d,f){Is("NgControlFlow");let g=ce(),p=Ze(),_=c!==void 0,T=ce(),D=a?s.bind(T[qn][Bt]):s,L=new YR(_,D);T[Je+r]=L,hd(g,p,r+1,e,n,t,i,kr(p.consts,o),256),_&&hd(g,p,r+2,c,l,u,d,kr(p.consts,f),512)}var QR=class extends zR{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,n,t){super(),this.lContainer=e,this.hostLView=n,this.templateTNode=t}get length(){return this.lContainer.length-Gt}at(e){return this.getLView(e)[Bt].$implicit}attach(e,n){let t=n[jc];this.needsIndexUpdate||=e!==this.length,eg(this.lContainer,n,e,ad(this.templateTNode,t)),I9(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,v9(this.lContainer,e),y9(this.lContainer,e)}create(e,n){let t=w_(this.lContainer,this.templateTNode.tView.ssrId),i=Zf(this.hostLView,this.templateTNode,new KR(this.lContainer,n,e),{dehydratedView:t});return this.operationsCounter?.recordCreate(),i}destroy(e){Q_(e[Ie],e),this.operationsCounter?.recordDestroy()}updateValue(e,n){this.getLView(e)[Bt].$implicit=n}reset(){this.needsIndexUpdate=!1,this.operationsCounter?.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let e=0;e<this.length;e++)this.getLView(e)[Bt].$index=e}getLView(e){return S9(this.lContainer,e)}};function T9(r){let e=Ae(null),n=ai();try{let t=ce(),i=t[Ie],o=t[n],s=n+1,a=G_(t,s);if(o.liveCollection===void 0){let l=XR(i,s);o.liveCollection=new QR(a,t,l)}else o.liveCollection.reset();let c=o.liveCollection;if(f9(c,r,o.trackByFn),c.updateIndexes(),o.hasEmptyBlock){let l=_o(),u=c.length===0;if(wn(t,l,u)){let d=n+2,f=G_(t,d);if(u){let g=XR(i,d),p=tk(f,g,t),_=Zf(t,g,void 0,{dehydratedView:p});eg(f,_,0,ad(g,p))}else i.firstUpdatePass&&n5(f),ZF(f,0)}}}finally{Ae(e)}}function G_(r,e){return r[e]}function I9(r,e){if(r.length<=Gt)return;let n=Gt+e,t=r[n],i=t?t[qc]:void 0;if(t&&i&&i.detachedLeaveAnimationFns&&i.detachedLeaveAnimationFns.length>0){let o=t[ds];u8(o,i),nl.delete(t),i.detachedLeaveAnimationFns=void 0}}function v9(r,e){if(r.length<=Gt)return;let n=Gt+e,t=r[n],i=t?t[qc]:void 0;i&&i.leave&&i.leave.size>0&&(i.detachedLeaveAnimationFns=[])}function y9(r,e){return Kf(r,e)}function S9(r,e){return JF(r,e)}function XR(r,e){return Uf(r,e)}function $k(r,e,n){let t=ce(),i=_o();if(wn(t,i,e)){let o=Ze(),s=Zu();UF(s,t,r,e,t[Xe],n)}return $k}function JR(r,e,n,t,i){Z_(e,r,n,i?"class":"style",t)}function $D(r,e,n,t){let i=ce(),o=i[Ie],s=r+Je,a=o.firstCreatePass?wD(s,i,2,e,DD,r_(),n,t):o.data[s];if(CD(a,i,r,e,Wk),Yu(a)){let c=i[Ie];J_(c,i,a),cD(c,a,i)}return t!=null&&Jf(i,a),$D}function jD(){let r=Ze(),e=cn(),n=ND(e);return r.firstCreatePass&&LD(r,n),zA(n)&&qA(),HA(),n.classesWithoutHost!=null&&M4(n)&&JR(r,n,ce(),n.classesWithoutHost,!0),n.stylesWithoutHost!=null&&P4(n)&&JR(r,n,ce(),n.stylesWithoutHost,!1),jD}function jk(r,e,n,t){return $D(r,e,n,t),jD(),jk}function HD(r,e,n,t){let i=ce(),o=i[Ie],s=r+Je,a=o.firstCreatePass?E5(s,o,2,e,n,t):o.data[s];return CD(a,i,r,e,Wk),t!=null&&Jf(i,a),HD}function WD(){let r=cn(),e=ND(r);return zA(e)&&qA(),HA(),WD}function Hk(r,e,n,t){return HD(r,e,n,t),WD(),Hk}var Wk=(r,e,n,t,i)=>($f(!0),mF(e[Xe],t,nR()));function zD(r,e,n){let t=ce(),i=t[Ie],o=r+Je,s=i.firstCreatePass?wD(o,t,8,"ng-container",DD,r_(),e,n):i.data[o];if(CD(s,t,r,"ng-container",A9),Yu(s)){let a=t[Ie];J_(a,t,s),cD(a,s,t)}return n!=null&&Jf(t,s),zD}function qD(){let r=Ze(),e=cn(),n=ND(e);return r.firstCreatePass&&LD(r,n),qD}function zk(r,e,n){return zD(r,e,n),qD(),zk}var A9=(r,e,n,t,i)=>($f(!0),Oq(e[Xe],""));function R9(){return ce()}function qk(r,e,n){let t=ce(),i=_o();if(wn(t,i,e)){let o=Ze(),s=Zu();VF(s,t,r,e,t[Xe],n)}return qk}var g_=void 0;function D9(r){let e=Math.floor(Math.abs(r)),n=r.toString().replace(/^[^.]*\.?/,"").length;return e===1&&n===0?1:5}var C9=["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"]],g_,[["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"]],g_,[["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}",g_,"{1} 'at' {0}",g_],[".",",",";","%","+","-","E","\xD7","\u2030","\u221E","NaN",":"],["#,##0.###","#,##0%","\xA4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",D9],fR={};function Vr(r){let e=N9(r),n=Ox(e);if(n)return n;let t=e.split("-")[0];if(n=Ox(t),n)return n;if(t==="en")return C9;throw new oe(701,!1)}function Ox(r){if(!(r in fR)){let e=Kt.ng&&Kt.ng.common&&Kt.ng.common.locales&&Kt.ng.common.locales[r];return e!==void 0&&(fR[r]=e),e}return fR[r]}var Ht=(function(r){return r[r.LocaleId=0]="LocaleId",r[r.DayPeriodsFormat=1]="DayPeriodsFormat",r[r.DayPeriodsStandalone=2]="DayPeriodsStandalone",r[r.DaysFormat=3]="DaysFormat",r[r.DaysStandalone=4]="DaysStandalone",r[r.MonthsFormat=5]="MonthsFormat",r[r.MonthsStandalone=6]="MonthsStandalone",r[r.Eras=7]="Eras",r[r.FirstDayOfWeek=8]="FirstDayOfWeek",r[r.WeekendRange=9]="WeekendRange",r[r.DateFormat=10]="DateFormat",r[r.TimeFormat=11]="TimeFormat",r[r.DateTimeFormat=12]="DateTimeFormat",r[r.NumberSymbols=13]="NumberSymbols",r[r.NumberFormats=14]="NumberFormats",r[r.CurrencyCode=15]="CurrencyCode",r[r.CurrencySymbol=16]="CurrencySymbol",r[r.CurrencyName=17]="CurrencyName",r[r.Currencies=18]="Currencies",r[r.Directionality=19]="Directionality",r[r.PluralCase=20]="PluralCase",r[r.ExtraData=21]="ExtraData",r})(Ht||{});function N9(r){return r.toLowerCase().replace(/_/g,"-")}var sg="en-US";var O9=sg;function Kk(r){typeof r=="string"&&(O9=r.toLowerCase().replace(/_/g,"-"))}function Yk(r,e,n){let t=ce(),i=Ze(),o=cn();return Xk(i,t,t[Xe],o,r,e,n),Yk}function Qk(r,e,n){let t=ce(),i=Ze(),o=cn();return(o.type&3||n)&&ak(o,i,t,n,t[Xe],r,e,v_(o,t,e)),Qk}function Xk(r,e,n,t,i,o,s){let a=!0,c=null;if((t.type&3||s)&&(c??=v_(t,e,o),ak(t,r,e,s,n,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??=v_(t,e,o),yx(t,e,f,g,i,c)}if(l&&l.length)for(let d of l)c??=v_(t,e,o),yx(t,e,d,i,i,c)}}function b9(r=1){return q0(r)}function w9(r,e){let n=null,t=jq(r);for(let i=0;i<e.length;i++){let o=e[i];if(o==="*"){n=i;continue}if(t===null?IF(r,o,!0):zq(t,o))return i}return n}function L9(r){let e=ce()[qn][ir];if(!e.projection){let n=r?r.length:1,t=e.projection=I0(n,null),i=t.slice(),o=e.child;for(;o!==null;){if(o.type!==128){let s=r?w9(o,r):0;s!==null&&(i[s]?i[s].projectionNext=o:t[s]=o,i[s]=o)}o=o.next}}}function M9(r,e=0,n,t,i,o){let s=ce(),a=Ze(),c=t?r+1:null;c!==null&&hd(s,a,c,t,i,o,null,n);let l=sl(a,Je+r,16,null,n||null);l.projection===null&&(l.projection=e),QA();let d=!s[jc]||WA();s[qn][ir].projection[l.projection]===null&&c!==null?P9(s,a,c):d&&!W_(l)&&v8(a,s,l)}function P9(r,e,n){let t=Je+n,i=e.data[t],o=r[t],s=w_(o,i.tView.ssrId),a=Zf(r,i,void 0,{dehydratedView:s});eg(o,a,0,ad(i,s))}function x9(r,e,n,t){B5(r,e,n,t)}function F9(r,e,n){gk(r,e,n)}function k9(r){let e=ce(),n=Ze(),t=o_();Gf(t+1);let i=FD(n,t);if(r.dirty&&O0(e)===((i.metadata.flags&2)===2)){if(i.matches===null)r.reset([]);else{let o=pk(e,t);r.reset(o,Xx),r.notifyOnChanges()}return!0}return!1}function U9(){return xD(ce(),o_())}function V9(r,e,n,t){j5(r,gk(e,n,t))}function B9(r=1){Gf(o_()+r)}function G9(r){let e=XA();return Qc(e,Je+r)}function m_(r,e){return r<<17|e<<2}function il(r){return r>>17&32767}function $9(r){return(r&2)==2}function j9(r,e){return r&131071|e<<17}function ZR(r){return r|2}function fd(r){return(r&131068)>>2}function gR(r,e){return r&-131069|e<<2}function H9(r){return(r&1)===1}function eD(r){return r|1}function W9(r,e,n,t,i,o){let s=o?e.classBindings:e.styleBindings,a=il(s),c=fd(s);r[t]=n;let l=!1,u;if(Array.isArray(n)){let d=n;u=d[1],(u===null||Wu(d,u)>0)&&(l=!0)}else u=n;if(i)if(c!==0){let f=il(r[a+1]);r[t+1]=m_(f,a),f!==0&&(r[f+1]=gR(r[f+1],t)),r[a+1]=j9(r[a+1],t)}else r[t+1]=m_(a,0),a!==0&&(r[a+1]=gR(r[a+1],t)),a=t;else r[t+1]=m_(c,0),a===0?a=t:r[c+1]=gR(r[c+1],t),c=t;l&&(r[t+1]=ZR(r[t+1])),bx(r,u,t,!0),bx(r,u,t,!1),z9(e,u,r,t,o),s=m_(a,c),o?e.classBindings=s:e.styleBindings=s}function z9(r,e,n,t,i){let o=i?r.residualClasses:r.residualStyles;o!=null&&typeof e=="string"&&Wu(o,e)>=0&&(n[t+1]=eD(n[t+1]))}function bx(r,e,n,t){let i=r[n+1],o=e===null,s=t?il(i):fd(i),a=!1;for(;s!==0&&(a===!1||o);){let c=r[s],l=r[s+1];q9(c,e)&&(a=!0,r[s+1]=t?eD(l):ZR(l)),s=t?il(l):fd(l)}a&&(r[n+1]=t?ZR(i):eD(i))}function q9(r,e){return r===null||e==null||(Array.isArray(r)?r[1]:r)===e?!0:Array.isArray(r)&&typeof e=="string"?Wu(r,e)>=0:!1}var ln={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function Jk(r){return r.substring(ln.key,ln.keyEnd)}function K9(r){return r.substring(ln.value,ln.valueEnd)}function Y9(r){return tU(r),Zk(r,gd(r,0,ln.textEnd))}function Zk(r,e){let n=ln.textEnd;return n===e?-1:(e=ln.keyEnd=X9(r,ln.key=e,n),gd(r,e,n))}function Q9(r){return tU(r),eU(r,gd(r,0,ln.textEnd))}function eU(r,e){let n=ln.textEnd,t=ln.key=gd(r,e,n);return n===t?-1:(t=ln.keyEnd=J9(r,t,n),t=wx(r,t,n,58),t=ln.value=gd(r,t,n),t=ln.valueEnd=Z9(r,t,n),wx(r,t,n,59))}function tU(r){ln.key=0,ln.keyEnd=0,ln.value=0,ln.valueEnd=0,ln.textEnd=r.length}function gd(r,e,n){for(;e<n&&r.charCodeAt(e)<=32;)e++;return e}function X9(r,e,n){for(;e<n&&r.charCodeAt(e)>32;)e++;return e}function J9(r,e,n){let t;for(;e<n&&((t=r.charCodeAt(e))===45||t===95||(t&-33)>=65&&(t&-33)<=90||t>=48&&t<=57);)e++;return e}function wx(r,e,n,t){return e=gd(r,e,n),e<n&&e++,e}function Z9(r,e,n){let t=-1,i=-1,o=-1,s=e,a=s;for(;s<n;){let c=r.charCodeAt(s++);if(c===59)return a;c===34||c===39?a=s=Lx(r,c,s,n):e===s-4&&o===85&&i===82&&t===76&&c===40?a=s=Lx(r,41,s,n):c>32&&(a=s),o=i,i=t,t=c&-33}return a}function Lx(r,e,n,t){let i=-1,o=n;for(;o<t;){let s=r.charCodeAt(o++);if(s==e&&i!==92)return o;s==92&&i===92?i=0:i=s}throw new Error}function nU(r,e,n){return iU(r,e,n,!1),nU}function rU(r,e){return iU(r,e,null,!0),rU}function eK(r){oU(cU,tK,r,!1)}function tK(r,e){for(let n=Q9(e);n>=0;n=eU(e,n))cU(r,Jk(e),K9(e))}function nK(r){oU(lK,rK,r,!0)}function rK(r,e){for(let n=Y9(e);n>=0;n=Zk(e,n))Pf(r,Jk(e),!0)}function iU(r,e,n,t){let i=ce(),o=Ze(),s=Bf(2);if(o.firstUpdatePass&&aU(o,r,s,t),e!==vn&&wn(i,s,e)){let a=o.data[ai()];lU(o,a,i,i[Xe],r,i[s+1]=dK(e,n),t,s)}}function oU(r,e,n,t){let i=Ze(),o=Bf(2);i.firstUpdatePass&&aU(i,null,o,t);let s=ce();if(n!==vn&&wn(s,o,n)){let a=i.data[ai()];if(uU(a,t)&&!sU(i,o)){let c=t?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(n=WE(c,n||"")),JR(i,a,s,n,t)}else uK(i,a,s,s[Xe],s[o+1],s[o+1]=cK(r,e,n),t,o)}}function sU(r,e){return e>=r.expandoStartIndex}function aU(r,e,n,t){let i=r.data;if(i[n+1]===null){let o=i[ai()],s=sU(r,n);uU(o,t)&&e===null&&!s&&(e=!1),e=iK(i,o,e,t),W9(i,o,e,n,s,t)}}function iK(r,e,n,t){let i=j0(r),o=t?e.residualClasses:e.residualStyles;if(i===null)(t?e.classBindings:e.styleBindings)===0&&(n=mR(null,r,e,n,t),n=Yf(n,e.attrs,t),o=null);else{let s=e.directiveStylingLast;if(s===-1||r[s]!==i)if(n=mR(i,r,e,n,t),o===null){let c=oK(r,e,t);c!==void 0&&Array.isArray(c)&&(c=mR(null,r,e,c[1],t),c=Yf(c,e.attrs,t),sK(r,e,t,c))}else o=aK(r,e,t)}return o!==void 0&&(t?e.residualClasses=o:e.residualStyles=o),n}function oK(r,e,n){let t=n?e.classBindings:e.styleBindings;if(fd(t)!==0)return r[il(t)]}function sK(r,e,n,t){let i=n?e.classBindings:e.styleBindings;r[il(i)]=t}function aK(r,e,n){let t,i=e.directiveEnd;for(let o=1+e.directiveStylingLast;o<i;o++){let s=r[o].hostAttrs;t=Yf(t,s,n)}return Yf(t,e.attrs,n)}function mR(r,e,n,t,i){let o=null,s=n.directiveEnd,a=n.directiveStylingLast;for(a===-1?a=n.directiveStart:a++;a<s&&(o=e[a],t=Yf(t,o.hostAttrs,i),o!==r);)a++;return r!==null&&(n.directiveStylingLast=a),t}function Yf(r,e,n){let t=n?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(r)||(r=r===void 0?[]:["",r]),Pf(r,s,n?!0:e[++o]))}return r===void 0?null:r}function cK(r,e,n){if(n==null||n==="")return Wn;let t=[],i=Ur(n);if(Array.isArray(i))for(let o=0;o<i.length;o++)r(t,i[o],!0);else if(typeof i=="object")for(let o in i)i.hasOwnProperty(o)&&r(t,o,i[o]);else typeof i=="string"&&e(t,i);return t}function cU(r,e,n){Pf(r,e,Ur(n))}function lK(r,e,n){let t=String(e);t!==""&&!t.includes(" ")&&Pf(r,t,n)}function uK(r,e,n,t,i,o,s,a){i===vn&&(i=Wn);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&&lU(r,e,n,t,p,_,s,a),u=c<i.length?i[c]:null,d=l<o.length?o[l]:null}}function lU(r,e,n,t,i,o,s,a){if(!(e.type&3))return;let c=r.data,l=c[a+1],u=H9(l)?Mx(c,e,n,i,fd(l),s):void 0;if(!$_(u)){$_(o)||$9(l)&&(o=Mx(c,null,n,i,a,s));let d=VA(ai(),n);S8(t,s,d,i,o)}}function Mx(r,e,n,t,i,o){let s=e===null,a;for(;i>0;){let c=r[i],l=Array.isArray(c),u=l?c[1]:c,d=u===null,f=n[i+1];f===vn&&(f=d?Wn:void 0);let g=d?XE(f,t):u===t?f:void 0;if(l&&!$_(g)&&(g=XE(c,t)),$_(g)&&(a=g,s))return a;let p=r[i+1];i=s?il(p):fd(p)}if(e!==null){let c=o?e.residualClasses:e.residualStyles;c!=null&&(a=XE(c,t))}return a}function $_(r){return r!==void 0}function dK(r,e){return r==null||r===""||(typeof e=="string"?r=r+e:typeof r=="object"&&(r=ls(Ur(r)))),r}function uU(r,e){return(r.flags&(e?8:16))!==0}function hK(r,e=""){let n=ce(),t=Ze(),i=r+Je,o=t.firstCreatePass?sl(t,i,1,e,null):t.data[i],s=fK(t,n,o,e,r);n[i]=s,c_()&&AD(t,n,s,o),Xc(o,!1)}var fK=(r,e,n,t,i)=>($f(!0),Cq(e[Xe],t));function dU(r,e,n,t=""){return wn(r,_o(),n)?e+xr(n)+t:vn}function gK(r,e,n,t,i,o=""){let s=ZA(),a=cd(r,s,n,i);return Bf(2),a?e+xr(n)+t+xr(i)+o:vn}function mK(r,e,n,t,i,o,s,a=""){let c=ZA(),l=PD(r,c,n,i,s);return Bf(3),l?e+xr(n)+t+xr(i)+o+xr(s)+a:vn}function hU(r){return KD("",r),hU}function KD(r,e,n){let t=ce(),i=dU(t,r,e,n);return i!==vn&&YD(t,ai(),i),KD}function fU(r,e,n,t,i){let o=ce(),s=gK(o,r,e,n,t,i);return s!==vn&&YD(o,ai(),s),fU}function gU(r,e,n,t,i,o,s){let a=ce(),c=mK(a,r,e,n,t,i,o,s);return c!==vn&&YD(a,ai(),c),gU}function YD(r,e,n){let t=VA(e,r);Nq(r[Xe],t,n)}function mU(r,e,n){oR(e)&&(e=e());let t=ce(),i=_o();if(wn(t,i,e)){let o=Ze(),s=Zu();UF(s,t,r,e,t[Xe],n)}return mU}function pK(r,e){let n=oR(r);return n&&r.set(e),n}function pU(r,e){let n=ce(),t=Ze(),i=cn();return Xk(t,n,n[Xe],i,r,e),pU}var EU={};function _U(r){let e=Ze(),n=ce(),t=r+Je,i=sl(e,t,128,null,null);return Xc(i,!1),Vf(e,n,t,EU),_U}function EK(r){Is("NgLet");let e=Ze(),n=ce(),t=ai();return Vf(e,n,t,r),r}function _K(r){let e=XA(),n=Qc(e,Je+r);if(n===EU)throw new oe(314,!1);return n}function TK(r){return wn(ce(),_o(),r)?xr(r):vn}function IK(r,e,n=""){return dU(ce(),r,e,n)}function vK(r,e,n){let t=Ze();if(t.firstCreatePass){let i=Mi(r);tD(n,t.data,t.blueprint,i,!0),tD(e,t.data,t.blueprint,i,!1)}}function tD(r,e,n,t,i){if(r=sn(r),Array.isArray(r))for(let o=0;o<r.length;o++)tD(r[o],e,n,t,i);else{let o=Ze(),s=ce(),a=cn(),c=Bc(r)?r:sn(r.provide),l=LA(r),u=a.providerIndexes&1048575,d=a.directiveStart,f=a.providerIndexes>>20;if(Bc(r)||!r.multi){let g=new tl(l,i,dt,null),p=ER(c,e,i?u:u+f,d);p===-1?(TR(D_(a,s),o,c),pR(o,r,e.length),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(g),s.push(g)):(n[p]=g,s[p]=g)}else{let g=ER(c,e,u+f,d),p=ER(c,e,u,u+f),_=g>=0&&n[g],T=p>=0&&n[p];if(i&&!T||!i&&!_){TR(D_(a,s),o,c);let D=AK(i?SK:yK,n.length,i,t,l,r);!i&&T&&(n[p].providerFactory=D),pR(o,r,e.length,0),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(D),s.push(D)}else{let D=TU(n[i?p:g],l,!i&&t);pR(o,r,g>-1?g:p,D)}!i&&t&&T&&n[p].componentProviders++}}}function pR(r,e,n,t){let i=Bc(e),o=D0(e);if(i||o){let c=(o?sn(e.useClass):e).prototype.ngOnDestroy;if(c){let l=r.destroyHooks||(r.destroyHooks=[]);if(!i&&e.multi){let u=l.indexOf(n);u===-1?l.push(n,[t,c]):l[u+1].push(t,c)}else l.push(n,c)}}}function TU(r,e,n){return n&&r.componentProviders++,r.multi.push(e)-1}function ER(r,e,n,t){for(let i=n;i<t;i++)if(e[i]===r)return i;return-1}function yK(r,e,n,t,i){return nD(this.multi,[])}function SK(r,e,n,t,i){let o=this.multi,s;if(this.providerFactory){let a=this.providerFactory.componentProviders,c=zf(t,t[Ie],this.providerFactory.index,i);s=c.slice(0,a),nD(o,s);for(let l=a;l<c.length;l++)s.push(c[l])}else s=[],nD(o,s);return s}function nD(r,e){for(let n=0;n<r.length;n++){let t=r[n];e.push(t())}return e}function AK(r,e,n,t,i,o){let s=new tl(r,n,dt,null);return s.multi=[],s.index=e,s.componentProviders=0,TU(s,i,t&&!n),s}function RK(r,e=[]){return n=>{n.providersResolver=(t,i)=>vK(t,i?i(r):r,e)}}function DK(r,e,n){let t=r.\u0275cmp;t.directiveDefs=V_(e,Ck),t.pipeDefs=V_(n,OA)}function CK(r,e,n){let t=or()+r,i=ce();return i[t]===vn?Ro(i,t,n?e.call(n):e()):ng(i,t)}function NK(r,e,n,t){return IU(ce(),or(),r,e,n,t)}function OK(r,e,n,t,i){return vU(ce(),or(),r,e,n,t,i)}function bK(r,e,n,t,i,o){return yU(ce(),or(),r,e,n,t,i,o)}function wK(r,e,n,t,i,o,s){return kK(ce(),or(),r,e,n,t,i,o,s)}function LK(r,e,n,t,i,o,s,a){let c=or()+r,l=ce(),u=ld(l,c,n,t,i,o);return wn(l,c+4,s)||u?Ro(l,c+5,a?e.call(a,n,t,i,o,s):e(n,t,i,o,s)):ng(l,c+5)}function MK(r,e,n,t,i,o,s,a,c){let l=or()+r,u=ce(),d=ld(u,l,n,t,i,o);return cd(u,l+4,s,a)||d?Ro(u,l+6,c?e.call(c,n,t,i,o,s,a):e(n,t,i,o,s,a)):ng(u,l+6)}function PK(r,e,n,t,i,o,s,a,c,l){let u=or()+r,d=ce(),f=ld(d,u,n,t,i,o);return PD(d,u+4,s,a,c)||f?Ro(d,u+7,l?e.call(l,n,t,i,o,s,a,c):e(n,t,i,o,s,a,c)):ng(d,u+7)}function xK(r,e,n,t,i,o,s,a,c,l,u){let d=or()+r,f=ce(),g=ld(f,d,n,t,i,o);return ld(f,d+4,s,a,c,l)||g?Ro(f,d+8,u?e.call(u,n,t,i,o,s,a,c,l):e(n,t,i,o,s,a,c,l)):ng(f,d+8)}function FK(r,e,n,t){return SU(ce(),or(),r,e,n,t)}function ag(r,e){let n=r[e];return n===vn?void 0:n}function IU(r,e,n,t,i,o){let s=e+n;return wn(r,s,i)?Ro(r,s+1,o?t.call(o,i):t(i)):ag(r,s+1)}function vU(r,e,n,t,i,o,s){let a=e+n;return cd(r,a,i,o)?Ro(r,a+2,s?t.call(s,i,o):t(i,o)):ag(r,a+2)}function yU(r,e,n,t,i,o,s,a){let c=e+n;return PD(r,c,i,o,s)?Ro(r,c+3,a?t.call(a,i,o,s):t(i,o,s)):ag(r,c+3)}function kK(r,e,n,t,i,o,s,a,c){let l=e+n;return ld(r,l,i,o,s,a)?Ro(r,l+4,c?t.call(c,i,o,s,a):t(i,o,s,a)):ag(r,l+4)}function SU(r,e,n,t,i,o){let s=e+n,a=!1;for(let c=0;c<i.length;c++)wn(r,s++,i[c])&&(a=!0);return a?Ro(r,s,t.apply(o,i)):ag(r,s)}function UK(r,e){let n=Ze(),t,i=r+Je;n.firstCreatePass?(t=VK(e,n.pipeRegistry),n.data[i]=t,t.onDestroy&&(n.destroyHooks??=[]).push(i,t.onDestroy)):t=n.data[i];let o=t.factory||(t.factory=ta(t.type,!0)),s,a=rr(dt);try{let c=R_(!1),l=o();return R_(c),Vf(n,ce(),i,l),l}finally{rr(a)}}function VK(r,e){if(e)for(let n=e.length-1;n>=0;n--){let t=e[n];if(r===t.name)return t}}function BK(r,e,n){let t=r+Je,i=ce(),o=Qc(i,t);return sT(i,t)?IU(i,or(),e,o.transform,n,o):o.transform(n)}function GK(r,e,n,t){let i=r+Je,o=ce(),s=Qc(o,i);return sT(o,i)?vU(o,or(),e,s.transform,n,t,s):s.transform(n,t)}function $K(r,e,n,t,i){let o=r+Je,s=ce(),a=Qc(s,o);return sT(s,o)?yU(s,or(),e,a.transform,n,t,i,a):a.transform(n,t,i)}function jK(r,e,n){let t=r+Je,i=ce(),o=Qc(i,t);return sT(i,t)?SU(i,or(),e,o.transform,n,o):o.transform.apply(o,n)}function sT(r,e){return r[Ie].data[e].pure}function HK(r,e){return eT(r,e)}var p_=null;function AU(r){p_!==null&&(r.defaultEncapsulation!==p_.defaultEncapsulation||r.preserveWhitespaces!==p_.preserveWhitespaces)||(p_=r)}var RU=new ee("");var WK=(()=>{class r{zone=J(we);changeDetectionScheduler=J(ni);applicationRef=J(ga);applicationErrorHandler=J(To);_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(n){this.applicationErrorHandler(n)}})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function DU({ngZoneFactory:r,ignoreChangesOutsideZone:e,scheduleInRootZone:n}){return r??=()=>new we(le(M({},QD()),{scheduleInRootZone:n})),[{provide:we,useFactory:r},{provide:ia,multi:!0,useFactory:()=>{let t=J(WK,{optional:!0});return()=>t.initialize()}},{provide:ia,multi:!0,useFactory:()=>{let t=J(zK);return()=>{t.initialize()}}},e===!0?{provide:sR,useValue:!0}:[],{provide:l_,useValue:n??AF},{provide:To,useFactory:()=>{let t=J(we),i=J(zn),o;return s=>{t.runOutsideAngular(()=>{i.destroyed&&!o?setTimeout(()=>{throw s}):(o??=i.get(Pr),o.handleError(s))})}}}]}function QD(r){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:r?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:r?.runCoalescing??!1}}var zK=(()=>{class r{subscription=new mt;initialized=!1;zone=J(we);pendingTasks=J(ua);initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{we.assertNotInAngularZone(),queueMicrotask(()=>{n!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{we.assertInAngularZone(),n??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var XD=(()=>{class r{applicationErrorHandler=J(To);appRef=J(ga);taskService=J(ua);ngZone=J(we);zonelessEnabled=J(td);tracing=J(ol,{optional:!0});disableScheduling=J(sR,{optional:!0})??!1;zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new mt;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(O_):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(J(l_,{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 sd||!this.zoneIsDefined)}notify(n){if(!this.zonelessEnabled&&n===5)return;let t=!1;switch(n){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?hx:RF;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>i(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>i(()=>this.tick()))}shouldScheduleTick(n){return!(this.disableScheduling&&!n||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(O_+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 n=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(t){this.taskService.remove(n),this.applicationErrorHandler(t)}finally{this.cleanup()}this.useMicrotaskScheduler=!0,hx(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(n)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let n=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(n)}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function qK(){return Is("NgZoneless"),pr([{provide:ni,useExisting:XD},{provide:we,useClass:sd},{provide:td,useValue:!0},{provide:l_,useValue:!1},[]])}function KK(){return typeof $localize<"u"&&$localize.locale||sg}var cg=new ee("",{providedIn:"root",factory:()=>J(cg,{optional:!0,skipSelf:!0})||KK()});var aT=class{destroyed=!1;listeners=null;errorHandler=J(Pr,{optional:!0});destroyRef=J(sr);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 n=this.listeners?.indexOf(e);n!==void 0&&n!==-1&&this.listeners?.splice(n,1)}}}emit(e){if(this.destroyed){console.warn(ra(953,!1));return}if(this.listeners===null)return;let n=Ae(null);try{for(let t of this.listeners)try{t(e)}catch(i){this.errorHandler?.handleError(i)}}finally{Ae(n)}}};function lg(r){return c0(r)}function ug(r,e){return Cf(r,e?.equal)}var JD=class{[Tn];constructor(e){this[Tn]=e}destroy(){this[Tn].destroy()}};function ZD(r,e){let n=e?.injector??J(lt),t=e?.manualCleanup!==!0?n.get(sr):null,i,o=n.get(ed,null,{optional:!0}),s=n.get(ni);return o!==null?(i=XK(o.view,s,r),t instanceof Lf&&t._lView===o.view&&(t=null)):i=JK(r,n.get(jf),s),i.injector=n,t!==null&&(i.onDestroyFn=t.onDestroy(()=>i.destroy())),new JD(i)}var CU=le(M({},l0),{cleanupFns:void 0,zone:null,onDestroyFn:Zc,run(){let r=Ju(!1);try{u0(this)}finally{Ju(r)}},cleanup(){if(!this.cleanupFns?.length)return;let r=Ae(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],Ae(r)}}}),YK=le(M({},CU),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){Fc(this),this.onDestroyFn(),this.cleanup(),this.scheduler.remove(this)}}),QK=le(M({},CU),{consumerMarkedDirty(){this.view[Re]|=8192,ca(this.view),this.notifier.notify(13)},destroy(){Fc(this),this.onDestroyFn(),this.cleanup(),this.view[hs]?.delete(this)}});function XK(r,e,n){let t=Object.create(QK);return t.view=r,t.zone=typeof Zone<"u"?Zone.current:null,t.notifier=e,t.fn=NU(t,n),r[hs]??=new Set,r[hs].add(t),t.consumerMarkedDirty(t),t}function JK(r,e,n){let t=Object.create(YK);return t.fn=NU(t,r),t.scheduler=e,t.notifier=n,t.zone=typeof Zone<"u"?Zone.current:null,t.scheduler.add(t),t.notifier.notify(12),t}function NU(r,e){return()=>{e(n=>(r.cleanupFns??=[]).push(n))}}var FU=Symbol("InputSignalNode#UNSET"),uY=le(M({},PE),{transformFn:void 0,applyValueToInputSignal(r,e){Gu(r,e)}});function kU(r,e){let n=Object.create(uY);n.value=r,n.transformFn=e?.transform;function t(){if(ku(n),n.value===FU){let i=null;throw new oe(-950,i)}return n.value}return t[Tn]=n,t}var dY=new ee("");dY.__NG_ELEMENT_ID__=r=>{let e=cn();if(e===null)throw new oe(204,!1);if(e.type&2)return e.value;if(r&8)return null;throw new oe(204,!1)};function Vye(r){return new aT}function OU(r,e){return kU(r,e)}function hY(r){return kU(FU,r)}var Bye=(OU.required=hY,OU);function bU(r,e){return _k(e)}function fY(r,e){return Tk(e)}var Gye=(bU.required=fY,bU);function gY(r,e,n){let t=new k_(n);return Promise.resolve(t)}function wU(r){for(let e=r.length-1;e>=0;e--)if(r[e]!==void 0)return r[e]}var cT=new ee(""),mY=new ee("");function dg(r){return!r.moduleRef}function pY(r){let e=dg(r)?r.r3Injector:r.moduleRef.injector,n=e.get(we);return n.run(()=>{dg(r)?r.r3Injector.resolveInjectorInitializers():r.moduleRef.resolveInjectorInitializers();let t=e.get(To),i;if(n.runOutsideAngular(()=>{i=n.onError.subscribe({next:t})}),dg(r)){let o=()=>e.destroy(),s=r.platformInjector.get(cT);s.add(o),e.onDestroy(()=>{i.unsubscribe(),s.delete(o)})}else{let o=()=>r.moduleRef.destroy(),s=r.platformInjector.get(cT);s.add(o),r.moduleRef.onDestroy(()=>{Wf(r.allPlatformModules,r.moduleRef),i.unsubscribe(),s.delete(o)})}return _Y(t,n,()=>{let o=e.get(ua),s=o.add(),a=e.get(VD);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(cg,sg);if(Kk(c||sg),!e.get(mY,!0))return dg(r)?e.get(ga):(r.allPlatformModules.push(r.moduleRef),r.moduleRef);if(dg(r)){let u=e.get(ga);return r.rootComponent!==void 0&&u.bootstrap(r.rootComponent),u}else return UU?.(r.moduleRef,r.allPlatformModules),r.moduleRef}).finally(()=>{o.remove(s)})})})}var UU;function LU(){UU=EY}function EY(r,e){let n=r.injector.get(ga);if(r._bootstrapComponents.length>0)r._bootstrapComponents.forEach(t=>n.bootstrap(t));else if(r.instance.ngDoBootstrap)r.instance.ngDoBootstrap(n);else throw new oe(-403,!1);e.push(r)}function _Y(r,e,n){try{let t=n();return oT(t)?t.catch(i=>{throw e.runOutsideAngular(()=>r(i)),i}):t}catch(t){throw e.runOutsideAngular(()=>r(t)),t}}var VU=(()=>{class r{_injector;_modules=[];_destroyListeners=[];_destroyed=!1;constructor(n){this._injector=n}bootstrapModuleFactory(n,t){let i=t?.scheduleInRootZone,o=()=>CF(t?.ngZone,le(M({},QD({eventCoalescing:t?.ngZoneEventCoalescing,runCoalescing:t?.ngZoneRunCoalescing})),{scheduleInRootZone:i})),s=t?.ignoreChangesOutsideZone,a=[DU({ngZoneFactory:o,ignoreChangesOutsideZone:s}),{provide:ni,useExisting:XD},X0],c=Rk(n.moduleType,this.injector,a);return LU(),pY({moduleRef:c,allPlatformModules:this._modules,platformInjector:this.injector})}bootstrapModule(n,t=[]){let i=BD({},t);return LU(),gY(this.injector,i,n).then(o=>this.bootstrapModuleFactory(o,i))}onDestroy(n){this._destroyListeners.push(n)}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 n=this._injector.get(cT,null);n&&(n.forEach(t=>t()),n.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}static \u0275fac=function(t){return new(t||r)(C(lt))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"platform"})}return r})(),aC=null;function TY(r){if(lC())throw new oe(400,!1);Uk(),aC=r;let e=r.get(VU);return yY(r),e}function cC(r,e,n=[]){let t=`Platform: ${e}`,i=new ee(t);return(o=[])=>{let s=lC();if(!s){let a=[...n,...o,{provide:i,useValue:!0}];s=r?.(a)??TY(IY(a,t))}return vY(i)}}function IY(r=[],e){return lt.create({name:e,providers:[{provide:xf,useValue:"platform"},{provide:cT,useValue:new Set([()=>aC=null])},...r]})}function vY(r){let e=lC();if(!e)throw new oe(-401,!1);return e}function lC(){return aC?.get(VU)??null}function yY(r){let e=r.get(H_,null);go(r,()=>{e?.forEach(n=>n())})}function uC(){return!1}var SY=(()=>{class r{static __NG_ELEMENT_ID__=AY}return r})();function AY(r){return RY(cn(),ce(),(r&16)===16)}function RY(r,e,n){if(fs(r)&&!n){let t=si(r.index,e);return new da(t,t)}else if(r.type&175){let t=e[qn];return new da(t,e)}return null}var eC=class{constructor(){}supports(e){return MD(e)}create(e){return new tC(e)}},DY=(r,e)=>e,tC=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||DY}forEachItem(e){let n;for(n=this._itHead;n!==null;n=n._next)e(n)}forEachOperation(e){let n=this._itHead,t=this._removalsHead,i=0,o=null;for(;n||t;){let s=!t||n&&n.currentIndex<MU(t,i,o)?n:t,a=MU(s,i,o),c=s.currentIndex;if(s===t)i--,t=t._nextRemoved;else if(n=n._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 n;for(n=this._previousItHead;n!==null;n=n._nextPrevious)e(n)}forEachAddedItem(e){let n;for(n=this._additionsHead;n!==null;n=n._nextAdded)e(n)}forEachMovedItem(e){let n;for(n=this._movesHead;n!==null;n=n._nextMoved)e(n)}forEachRemovedItem(e){let n;for(n=this._removalsHead;n!==null;n=n._nextRemoved)e(n)}forEachIdentityChange(e){let n;for(n=this._identityChangesHead;n!==null;n=n._nextIdentityChange)e(n)}diff(e){if(e==null&&(e=[]),!MD(e))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let n=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),n===null||!Object.is(n.trackById,s)?(n=this._mismatch(n,o,s,a),t=!0):(t&&(n=this._verifyReinsertion(n,o,s,a)),Object.is(n.item,o)||this._addIdentityChange(n,o)),n=n._next}else i=0,sk(e,a=>{s=this._trackByFn(i,a),n===null||!Object.is(n.trackById,s)?(n=this._mismatch(n,a,s,i),t=!0):(t&&(n=this._verifyReinsertion(n,a,s,i)),Object.is(n.item,a)||this._addIdentityChange(n,a)),n=n._next,i++}),this.length=i;return this._truncate(n),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,n,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,n)||this._addIdentityChange(e,n),this._reinsertAfter(e,o,i)):(e=this._linkedRecords===null?null:this._linkedRecords.get(t,i),e!==null?(Object.is(e.item,n)||this._addIdentityChange(e,n),this._moveAfter(e,o,i)):e=this._addAfter(new nC(n,t),o,i)),e}_verifyReinsertion(e,n,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 n=e._next;this._addToRemovals(this._unlink(e)),e=n}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,n,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,n,t),this._addToMoves(e,t),e}_moveAfter(e,n,t){return this._unlink(e),this._insertAfter(e,n,t),this._addToMoves(e,t),e}_addAfter(e,n,t){return this._insertAfter(e,n,t),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,n,t){let i=n===null?this._itHead:n._next;return e._next=i,e._prev=n,i===null?this._itTail=e:i._prev=e,n===null?this._itHead=e:n._next=e,this._linkedRecords===null&&(this._linkedRecords=new lT),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 n=e._prev,t=e._next;return n===null?this._itHead=t:n._next=t,t===null?this._itTail=n:t._prev=n,e}_addToMoves(e,n){return e.previousIndex===n||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new lT),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,n){return e.item=n,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},nC=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,n){this.item=e,this.trackById=n}},rC=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,n){let t;for(t=this._head;t!==null;t=t._nextDup)if((n===null||n<=t.currentIndex)&&Object.is(t.trackById,e))return t;return null}remove(e){let n=e._prevDup,t=e._nextDup;return n===null?this._head=t:n._nextDup=t,t===null?this._tail=n:t._prevDup=n,this._head===null}},lT=class{map=new Map;put(e){let n=e.trackById,t=this.map.get(n);t||(t=new rC,this.map.set(n,t)),t.add(e)}get(e,n){let t=e,i=this.map.get(t);return i?i.get(e,n):null}remove(e){let n=e.trackById;return this.map.get(n).remove(e)&&this.map.delete(n),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function MU(r,e,n){let t=r.previousIndex;if(t===null)return t;let i=0;return n&&t<n.length&&(i=n[t]),t+e+i}var iC=class{constructor(){}supports(e){return e instanceof Map||rT(e)}create(){return new oC}},oC=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 n;for(n=this._mapHead;n!==null;n=n._next)e(n)}forEachPreviousItem(e){let n;for(n=this._previousMapHead;n!==null;n=n._nextPrevious)e(n)}forEachChangedItem(e){let n;for(n=this._changesHead;n!==null;n=n._nextChanged)e(n)}forEachAddedItem(e){let n;for(n=this._additionsHead;n!==null;n=n._nextAdded)e(n)}forEachRemovedItem(e){let n;for(n=this._removalsHead;n!==null;n=n._nextRemoved)e(n)}diff(e){if(!e)e=new Map;else if(!(e instanceof Map||rT(e)))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let n=this._mapHead;if(this._appendAfter=null,this._forEach(e,(t,i)=>{if(n&&n.key===i)this._maybeAddToChanges(n,t),this._appendAfter=n,n=n._next;else{let o=this._getOrCreateRecordForKey(i,t);n=this._insertBeforeOrAppend(n,o)}}),n){n._prev&&(n._prev._next=null),this._removalsHead=n;for(let t=n;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,n){if(e){let t=e._prev;return n._next=e,n._prev=t,e._prev=n,t&&(t._next=n),e===this._mapHead&&(this._mapHead=n),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=n,n._prev=this._appendAfter):this._mapHead=n,this._appendAfter=n,null}_getOrCreateRecordForKey(e,n){if(this._records.has(e)){let i=this._records.get(e);this._maybeAddToChanges(i,n);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 sC(e);return this._records.set(e,t),t.currentValue=n,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,n){Object.is(n,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=n,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,n){e instanceof Map?e.forEach(n):Object.keys(e).forEach(t=>n(e[t],t))}},sC=class{key;previousValue=null;currentValue=null;_nextPrevious=null;_next=null;_prev=null;_nextAdded=null;_nextRemoved=null;_nextChanged=null;constructor(e){this.key=e}};function PU(){return new dC([new eC])}var dC=(()=>{class r{factories;static \u0275prov=K({token:r,providedIn:"root",factory:PU});constructor(n){this.factories=n}static create(n,t){if(t!=null){let i=t.factories.slice();n=n.concat(i)}return new r(n)}static extend(n){return{provide:r,useFactory:()=>{let t=J(r,{optional:!0,skipSelf:!0});return r.create(n,t||PU())}}}find(n){let t=this.factories.find(i=>i.supports(n));if(t!=null)return t;throw new oe(901,!1)}}return r})();function xU(){return new uT([new iC])}var uT=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:xU});factories;constructor(n){this.factories=n}static create(n,t){if(t){let i=t.factories.slice();n=n.concat(i)}return new r(n)}static extend(n){return{provide:r,useFactory:()=>{let t=J(r,{optional:!0,skipSelf:!0});return r.create(n,t||xU())}}}find(n){let t=this.factories.find(i=>i.supports(n));if(t)return t;throw new oe(901,!1)}}return r})();var BU=cC(null,"core",[]),GU=(()=>{class r{constructor(n){}static \u0275fac=function(t){return new(t||r)(C(ga))};static \u0275mod=fa({type:r});static \u0275inj=us({})}return r})();function $ye(r){return typeof r=="boolean"?r:r!=null&&r!=="false"}function jye(r,e=NaN){return!isNaN(parseFloat(r))&&!isNaN(Number(r))?Number(r):e}function Hye(r,e){let n=oa(r),t=e.elementInjector||zu();return new ud(n).create(t,e.projectableNodes,e.hostElement,e.environmentInjector,e.directives,e.bindings)}var HU=null;function No(){return HU}function hC(r){HU??=r}var hg=class{},fC=(()=>{class r{historyGo(n){throw new Error("")}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>J(WU),providedIn:"platform"})}return r})();var WU=(()=>{class r extends fC{_location;_history;_doc=J(In);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return No().getBaseHref(this._doc)}onPopState(n){let t=No().getGlobalEventTarget(this._doc,"window");return t.addEventListener("popstate",n,!1),()=>t.removeEventListener("popstate",n)}onHashChange(n){let t=No().getGlobalEventTarget(this._doc,"window");return t.addEventListener("hashchange",n,!1),()=>t.removeEventListener("hashchange",n)}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(n){this._location.pathname=n}pushState(n,t,i){this._history.pushState(n,t,i)}replaceState(n,t,i){this._history.replaceState(n,t,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(n=0){this._history.go(n)}getState(){return this._history.state}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>new r,providedIn:"platform"})}return r})();function zU(r,e){return r?e?r.endsWith("/")?e.startsWith("/")?r+e.slice(1):r+e:e.startsWith("/")?r+e:`${r}/${e}`:r:e}function $U(r){let e=r.search(/#|\?|$/);return r[e-1]==="/"?r.slice(0,e-1)+r.slice(e):r}function ma(r){return r&&r[0]!=="?"?`?${r}`:r}var dT=(()=>{class r{historyGo(n){throw new Error("")}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>J(KU),providedIn:"root"})}return r})(),qU=new ee(""),KU=(()=>{class r extends dT{_platformLocation;_baseHref;_removeListenerFns=[];constructor(n,t){super(),this._platformLocation=n,this._baseHref=t??this._platformLocation.getBaseHrefFromDOM()??J(In).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}prepareExternalUrl(n){return zU(this._baseHref,n)}path(n=!1){let t=this._platformLocation.pathname+ma(this._platformLocation.search),i=this._platformLocation.hash;return i&&n?`${t}${i}`:t}pushState(n,t,i,o){let s=this.prepareExternalUrl(i+ma(o));this._platformLocation.pushState(n,t,s)}replaceState(n,t,i,o){let s=this.prepareExternalUrl(i+ma(o));this._platformLocation.replaceState(n,t,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static \u0275fac=function(t){return new(t||r)(C(fC),C(qU,8))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),YU=(()=>{class r{_subject=new Ct;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(n){this._locationStrategy=n;let t=this._locationStrategy.getBaseHref();this._basePath=OY($U(jU(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(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,t=""){return this.path()==this.normalize(n+ma(t))}normalize(n){return r.stripTrailingSlash(NY(this._basePath,jU(n)))}prepareExternalUrl(n){return n&&n[0]!=="/"&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,t="",i=null){this._locationStrategy.pushState(i,"",n,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+ma(t)),i)}replaceState(n,t="",i=null){this._locationStrategy.replaceState(i,"",n,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+ma(t)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){this._locationStrategy.historyGo?.(n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??=this.subscribe(t=>{this._notifyUrlChangeListeners(t.url,t.state)}),()=>{let t=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(t,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",t){this._urlChangeListeners.forEach(i=>i(n,t))}subscribe(n,t,i){return this._subject.subscribe({next:n,error:t??void 0,complete:i??void 0})}static normalizeQueryParams=ma;static joinWithSlash=zU;static stripTrailingSlash=$U;static \u0275fac=function(t){return new(t||r)(C(dT))};static \u0275prov=K({token:r,factory:()=>CY(),providedIn:"root"})}return r})();function CY(){return new YU(C(dT))}function NY(r,e){if(!r||!e.startsWith(r))return e;let n=e.substring(r.length);return n===""||["/",";","?","#"].includes(n[0])?n:e}function jU(r){return r.replace(/\/index.html$/,"")}function OY(r){if(new RegExp("^(https?:)?//").test(r)){let[,n]=r.split(/\/\/[^\/]+/);return n}return r}var Kn=(function(r){return r[r.Format=0]="Format",r[r.Standalone=1]="Standalone",r})(Kn||{}),it=(function(r){return r[r.Narrow=0]="Narrow",r[r.Abbreviated=1]="Abbreviated",r[r.Wide=2]="Wide",r[r.Short=3]="Short",r})(it||{}),Er=(function(r){return r[r.Short=0]="Short",r[r.Medium=1]="Medium",r[r.Long=2]="Long",r[r.Full=3]="Full",r})(Er||{}),ys={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 t1(r){return Vr(r)[Ht.LocaleId]}function n1(r,e,n){let t=Vr(r),i=[t[Ht.DayPeriodsFormat],t[Ht.DayPeriodsStandalone]],o=li(i,e);return li(o,n)}function r1(r,e,n){let t=Vr(r),i=[t[Ht.DaysFormat],t[Ht.DaysStandalone]],o=li(i,e);return li(o,n)}function i1(r,e,n){let t=Vr(r),i=[t[Ht.MonthsFormat],t[Ht.MonthsStandalone]],o=li(i,e);return li(o,n)}function o1(r,e){let t=Vr(r)[Ht.Eras];return li(t,e)}function fg(r,e){let n=Vr(r);return li(n[Ht.DateFormat],e)}function gg(r,e){let n=Vr(r);return li(n[Ht.TimeFormat],e)}function mg(r,e){let t=Vr(r)[Ht.DateTimeFormat];return li(t,e)}function pg(r,e){let n=Vr(r),t=n[Ht.NumberSymbols][e];if(typeof t>"u"){if(e===ys.CurrencyDecimal)return n[Ht.NumberSymbols][ys.Decimal];if(e===ys.CurrencyGroup)return n[Ht.NumberSymbols][ys.Group]}return t}function s1(r){if(!r[Ht.ExtraData])throw new oe(2303,!1)}function a1(r){let e=Vr(r);return s1(e),(e[Ht.ExtraData][2]||[]).map(t=>typeof t=="string"?gC(t):[gC(t[0]),gC(t[1])])}function c1(r,e,n){let t=Vr(r);s1(t);let i=[t[Ht.ExtraData][0],t[Ht.ExtraData][1]],o=li(i,e)||[];return li(o,n)||[]}function li(r,e){for(let n=e;n>-1;n--)if(typeof r[n]<"u")return r[n];throw new oe(2304,!1)}function gC(r){let[e,n]=r.split(":");return{hours:+e,minutes:+n}}var bY=/^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/,hT={},wY=/((?:[^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]*)/,LY=256;function l1(r,e,n,t){let i=$Y(r);MY(e),e=vs(n,e)||e;let s=[],a;for(;e;)if(a=wY.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=d1(t,c),i=GY(i,t));let l="";return s.forEach(u=>{let d=VY(u);l+=d?d(i,n,c):u==="''"?"'":u.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}function MY(r){if(r.length>LY)throw new oe(2300,!1)}function ET(r,e,n){let t=new Date(0);return t.setFullYear(r,e,n),t.setHours(0,0,0),t}function vs(r,e){let n=t1(r);if(hT[n]??={},hT[n][e])return hT[n][e];let t="";switch(e){case"shortDate":t=fg(r,Er.Short);break;case"mediumDate":t=fg(r,Er.Medium);break;case"longDate":t=fg(r,Er.Long);break;case"fullDate":t=fg(r,Er.Full);break;case"shortTime":t=gg(r,Er.Short);break;case"mediumTime":t=gg(r,Er.Medium);break;case"longTime":t=gg(r,Er.Long);break;case"fullTime":t=gg(r,Er.Full);break;case"short":let i=vs(r,"shortTime"),o=vs(r,"shortDate");t=fT(mg(r,Er.Short),[i,o]);break;case"medium":let s=vs(r,"mediumTime"),a=vs(r,"mediumDate");t=fT(mg(r,Er.Medium),[s,a]);break;case"long":let c=vs(r,"longTime"),l=vs(r,"longDate");t=fT(mg(r,Er.Long),[c,l]);break;case"full":let u=vs(r,"fullTime"),d=vs(r,"fullDate");t=fT(mg(r,Er.Full),[u,d]);break}return t&&(hT[n][e]=t),t}function fT(r,e){return e&&(r=r.replace(/\{([^}]+)}/g,function(n,t){return e!=null&&t in e?e[t]:n})),r}function Fi(r,e,n="-",t,i){let o="";(r<0||i&&r<=0)&&(i?r=-r+1:(r=-r,o=n));let s=String(r);for(;s.length<e;)s="0"+s;return t&&(s=s.slice(s.length-e)),o+s}function PY(r,e){return Fi(r,3).substring(0,e)}function Yt(r,e,n=0,t=!1,i=!1){return function(o,s){let a=xY(r,o);if((n>0||a>-n)&&(a+=n),r===3)a===0&&n===-12&&(a=12);else if(r===6)return PY(a,e);let c=pg(s,ys.MinusSign);return Fi(a,e,c,t,i)}}function xY(r,e){switch(r){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 Et(r,e,n=Kn.Format,t=!1){return function(i,o){return FY(i,o,r,e,n,t)}}function FY(r,e,n,t,i,o){switch(n){case 2:return i1(e,i,t)[r.getMonth()];case 1:return r1(e,i,t)[r.getDay()];case 0:let s=r.getHours(),a=r.getMinutes();if(o){let l=a1(e),u=c1(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 n1(e,i,t)[s<12?0:1];case 3:return o1(e,t)[r.getFullYear()<=0?0:1];default:let c=n;throw new oe(2302,!1)}}function gT(r){return function(e,n,t){let i=-1*t,o=pg(n,ys.MinusSign),s=i>0?Math.floor(i/60):Math.ceil(i/60);switch(r){case 0:return(i>=0?"+":"")+Fi(s,2,o)+Fi(Math.abs(i%60),2,o);case 1:return"GMT"+(i>=0?"+":"")+Fi(s,1,o);case 2:return"GMT"+(i>=0?"+":"")+Fi(s,2,o)+":"+Fi(Math.abs(i%60),2,o);case 3:return t===0?"Z":(i>=0?"+":"")+Fi(s,2,o)+":"+Fi(Math.abs(i%60),2,o);default:throw new oe(2310,!1)}}}var kY=0,pT=4;function UY(r){let e=ET(r,kY,1).getDay();return ET(r,0,1+(e<=pT?pT:pT+7)-e)}function u1(r){let e=r.getDay(),n=e===0?-3:pT-e;return ET(r.getFullYear(),r.getMonth(),r.getDate()+n)}function mC(r,e=!1){return function(n,t){let i;if(e){let o=new Date(n.getFullYear(),n.getMonth(),1).getDay()-1,s=n.getDate();i=1+Math.floor((s+o)/7)}else{let o=u1(n),s=UY(o.getFullYear()),a=o.getTime()-s.getTime();i=1+Math.round(a/6048e5)}return Fi(i,r,pg(t,ys.MinusSign))}}function mT(r,e=!1){return function(n,t){let o=u1(n).getFullYear();return Fi(o,r,pg(t,ys.MinusSign),e)}}var pC={};function VY(r){if(pC[r])return pC[r];let e;switch(r){case"G":case"GG":case"GGG":e=Et(3,it.Abbreviated);break;case"GGGG":e=Et(3,it.Wide);break;case"GGGGG":e=Et(3,it.Narrow);break;case"y":e=Yt(0,1,0,!1,!0);break;case"yy":e=Yt(0,2,0,!0,!0);break;case"yyy":e=Yt(0,3,0,!1,!0);break;case"yyyy":e=Yt(0,4,0,!1,!0);break;case"Y":e=mT(1);break;case"YY":e=mT(2,!0);break;case"YYY":e=mT(3);break;case"YYYY":e=mT(4);break;case"M":case"L":e=Yt(1,1,1);break;case"MM":case"LL":e=Yt(1,2,1);break;case"MMM":e=Et(2,it.Abbreviated);break;case"MMMM":e=Et(2,it.Wide);break;case"MMMMM":e=Et(2,it.Narrow);break;case"LLL":e=Et(2,it.Abbreviated,Kn.Standalone);break;case"LLLL":e=Et(2,it.Wide,Kn.Standalone);break;case"LLLLL":e=Et(2,it.Narrow,Kn.Standalone);break;case"w":e=mC(1);break;case"ww":e=mC(2);break;case"W":e=mC(1,!0);break;case"d":e=Yt(2,1);break;case"dd":e=Yt(2,2);break;case"c":case"cc":e=Yt(7,1);break;case"ccc":e=Et(1,it.Abbreviated,Kn.Standalone);break;case"cccc":e=Et(1,it.Wide,Kn.Standalone);break;case"ccccc":e=Et(1,it.Narrow,Kn.Standalone);break;case"cccccc":e=Et(1,it.Short,Kn.Standalone);break;case"E":case"EE":case"EEE":e=Et(1,it.Abbreviated);break;case"EEEE":e=Et(1,it.Wide);break;case"EEEEE":e=Et(1,it.Narrow);break;case"EEEEEE":e=Et(1,it.Short);break;case"a":case"aa":case"aaa":e=Et(0,it.Abbreviated);break;case"aaaa":e=Et(0,it.Wide);break;case"aaaaa":e=Et(0,it.Narrow);break;case"b":case"bb":case"bbb":e=Et(0,it.Abbreviated,Kn.Standalone,!0);break;case"bbbb":e=Et(0,it.Wide,Kn.Standalone,!0);break;case"bbbbb":e=Et(0,it.Narrow,Kn.Standalone,!0);break;case"B":case"BB":case"BBB":e=Et(0,it.Abbreviated,Kn.Format,!0);break;case"BBBB":e=Et(0,it.Wide,Kn.Format,!0);break;case"BBBBB":e=Et(0,it.Narrow,Kn.Format,!0);break;case"h":e=Yt(3,1,-12);break;case"hh":e=Yt(3,2,-12);break;case"H":e=Yt(3,1);break;case"HH":e=Yt(3,2);break;case"m":e=Yt(4,1);break;case"mm":e=Yt(4,2);break;case"s":e=Yt(5,1);break;case"ss":e=Yt(5,2);break;case"S":e=Yt(6,1);break;case"SS":e=Yt(6,2);break;case"SSS":e=Yt(6,3);break;case"Z":case"ZZ":case"ZZZ":e=gT(0);break;case"ZZZZZ":e=gT(3);break;case"O":case"OO":case"OOO":case"z":case"zz":case"zzz":e=gT(1);break;case"OOOO":case"ZZZZ":case"zzzz":e=gT(2);break;default:return null}return pC[r]=e,e}function d1(r,e){r=r.replace(/:/g,"");let n=Date.parse("Jan 01, 1970 00:00:00 "+r)/6e4;return isNaN(n)?e:n}function BY(r,e){return r=new Date(r.getTime()),r.setMinutes(r.getMinutes()+e),r}function GY(r,e,n){let i=r.getTimezoneOffset(),o=d1(e,i);return BY(r,-1*(o-i))}function $Y(r){if(QU(r))return r;if(typeof r=="number"&&!isNaN(r))return new Date(r);if(typeof r=="string"){if(r=r.trim(),/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(r)){let[i,o=1,s=1]=r.split("-").map(a=>+a);return ET(i,o-1,s)}let n=parseFloat(r);if(!isNaN(r-n))return new Date(n);let t;if(t=r.match(bY))return jY(t)}let e=new Date(r);if(!QU(e))throw new oe(2311,!1);return e}function jY(r){let e=new Date(0),n=0,t=0,i=r[8]?e.setUTCFullYear:e.setFullYear,o=r[8]?e.setUTCHours:e.setHours;r[9]&&(n=Number(r[9]+r[10]),t=Number(r[9]+r[11])),i.call(e,Number(r[1]),Number(r[2])-1,Number(r[3]));let s=Number(r[4]||0)-n,a=Number(r[5]||0)-t,c=Number(r[6]||0),l=Math.floor(parseFloat("0."+(r[7]||0))*1e3);return o.call(e,s,a,c,l),e}function QU(r){return r instanceof Date&&!isNaN(r.valueOf())}var EC=/\s+/,XU=[],HY=(()=>{class r{_ngEl;_renderer;initialClasses=XU;rawClass;stateMap=new Map;constructor(n,t){this._ngEl=n,this._renderer=t}set klass(n){this.initialClasses=n!=null?n.trim().split(EC):XU}set ngClass(n){this.rawClass=typeof n=="string"?n.trim().split(EC):n}ngDoCheck(){for(let t of this.initialClasses)this._updateState(t,!0);let n=this.rawClass;if(Array.isArray(n)||n instanceof Set)for(let t of n)this._updateState(t,!0);else if(n!=null)for(let t of Object.keys(n))this._updateState(t,!!n[t]);this._applyStateDiff()}_updateState(n,t){let i=this.stateMap.get(n);i!==void 0?(i.enabled!==t&&(i.changed=!0,i.enabled=t),i.touched=!0):this.stateMap.set(n,{enabled:t,changed:!0,touched:!0})}_applyStateDiff(){for(let n of this.stateMap){let t=n[0],i=n[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(n,t){n=n.trim(),n.length>0&&n.split(EC).forEach(i=>{t?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(t){return new(t||r)(dt(ha),dt(nT))};static \u0275dir=Co({type:r,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return r})();var _T=class{$implicit;ngForOf;index;count;constructor(e,n,t,i){this.$implicit=e,this.ngForOf=n,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}},h1=(()=>{class r{_viewContainer;_template;_differs;set ngForOf(n){this._ngForOf=n,this._ngForOfDirty=!0}set ngForTrackBy(n){this._trackByFn=n}get ngForTrackBy(){return this._trackByFn}_ngForOf=null;_ngForOfDirty=!0;_differ=null;_trackByFn;constructor(n,t,i){this._viewContainer=n,this._template=t,this._differs=i}set ngForTemplate(n){n&&(this._template=n)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let n=this._ngForOf;!this._differ&&n&&(this._differ=this._differs.find(n).create(this.ngForTrackBy))}if(this._differ){let n=this._differ.diff(this._ngForOf);n&&this._applyChanges(n)}}_applyChanges(n){let t=this._viewContainer;n.forEachOperation((i,o,s)=>{if(i.previousIndex==null)t.createEmbeddedView(this._template,new _T(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),JU(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}n.forEachIdentityChange(i=>{let o=t.get(i.currentIndex);JU(o,i)})}static ngTemplateContextGuard(n,t){return!0}static \u0275fac=function(t){return new(t||r)(dt(Do),dt(So),dt(dC))};static \u0275dir=Co({type:r,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}})}return r})();function JU(r,e){r.context.$implicit=e.item}var WY=(()=>{class r{_viewContainer;_context=new TT;_thenTemplateRef=null;_elseTemplateRef=null;_thenViewRef=null;_elseViewRef=null;constructor(n,t){this._viewContainer=n,this._thenTemplateRef=t}set ngIf(n){this._context.$implicit=this._context.ngIf=n,this._updateView()}set ngIfThen(n){ZU(n,!1),this._thenTemplateRef=n,this._thenViewRef=null,this._updateView()}set ngIfElse(n){ZU(n,!1),this._elseTemplateRef=n,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(n,t){return!0}static \u0275fac=function(t){return new(t||r)(dt(Do),dt(So))};static \u0275dir=Co({type:r,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}})}return r})(),TT=class{$implicit=null;ngIf=null};function ZU(r,e){if(r&&!r.createEmbeddedView)throw new oe(2020,!1)}var IT=class{_viewContainerRef;_templateRef;_created=!1;constructor(e,n){this._viewContainerRef=e,this._templateRef=n}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()}},_C=(()=>{class r{_defaultViews=[];_defaultUsed=!1;_caseCount=0;_lastCaseCheckIndex=0;_lastCasesMatched=!1;_ngSwitch;set ngSwitch(n){this._ngSwitch=n,this._caseCount===0&&this._updateDefaultCases(!0)}_addCase(){return this._caseCount++}_addDefault(n){this._defaultViews.push(n)}_matchCase(n){let t=n===this._ngSwitch;return this._lastCasesMatched||=t,this._lastCaseCheckIndex++,this._lastCaseCheckIndex===this._caseCount&&(this._updateDefaultCases(!this._lastCasesMatched),this._lastCaseCheckIndex=0,this._lastCasesMatched=!1),t}_updateDefaultCases(n){if(this._defaultViews.length>0&&n!==this._defaultUsed){this._defaultUsed=n;for(let t of this._defaultViews)t.enforceState(n)}}static \u0275fac=function(t){return new(t||r)};static \u0275dir=Co({type:r,selectors:[["","ngSwitch",""]],inputs:{ngSwitch:"ngSwitch"}})}return r})(),zY=(()=>{class r{ngSwitch;_view;ngSwitchCase;constructor(n,t,i){this.ngSwitch=i,i._addCase(),this._view=new IT(n,t)}ngDoCheck(){this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase))}static \u0275fac=function(t){return new(t||r)(dt(Do),dt(So),dt(_C,9))};static \u0275dir=Co({type:r,selectors:[["","ngSwitchCase",""]],inputs:{ngSwitchCase:"ngSwitchCase"}})}return r})(),qY=(()=>{class r{constructor(n,t,i){i._addDefault(new IT(n,t))}static \u0275fac=function(t){return new(t||r)(dt(Do),dt(So),dt(_C,9))};static \u0275dir=Co({type:r,selectors:[["","ngSwitchDefault",""]]})}return r})();var KY=(()=>{class r{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(n,t,i){this._ngEl=n,this._differs=t,this._renderer=i}set ngStyle(n){this._ngStyle=n,!this._differ&&n&&(this._differ=this._differs.find(n).create())}ngDoCheck(){if(this._differ){let n=this._differ.diff(this._ngStyle);n&&this._applyChanges(n)}}_setStyle(n,t){let[i,o]=n.split("."),s=i.indexOf("-")===-1?void 0:xi.DashCase;t!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,o?`${t}${o}`:t,s):this._renderer.removeStyle(this._ngEl.nativeElement,i,s)}_applyChanges(n){n.forEachRemovedItem(t=>this._setStyle(t.key,null)),n.forEachAddedItem(t=>this._setStyle(t.key,t.currentValue)),n.forEachChangedItem(t=>this._setStyle(t.key,t.currentValue))}static \u0275fac=function(t){return new(t||r)(dt(ha),dt(uT),dt(nT))};static \u0275dir=Co({type:r,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return r})(),YY=(()=>{class r{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(n){this._viewContainerRef=n}ngOnChanges(n){if(this._shouldRecreateView(n)){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(n){return!!n.ngTemplateOutlet||!!n.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(n,t,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,t,i):!1,get:(n,t,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,t,i)}})}static \u0275fac=function(t){return new(t||r)(dt(Do))};static \u0275dir=Co({type:r,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[rD]})}return r})();function f1(r,e){return new oe(2100,!1)}var QY=/(?:[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,XY=(()=>{class r{transform(n){if(n==null)return null;if(typeof n!="string")throw f1(r,n);return n.replace(QY,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}static \u0275fac=function(t){return new(t||r)};static \u0275pipe=rg({name:"titlecase",type:r,pure:!0})}return r})();var JY="mediumDate",g1=new ee(""),m1=new ee(""),ZY=(()=>{class r{locale;defaultTimezone;defaultOptions;constructor(n,t,i){this.locale=n,this.defaultTimezone=t,this.defaultOptions=i}transform(n,t,i,o){if(n==null||n===""||n!==n)return null;try{let s=t??this.defaultOptions?.dateFormat??JY,a=i??this.defaultOptions?.timezone??this.defaultTimezone??void 0;return l1(n,s,o||this.locale,a)}catch(s){throw f1(r,s.message)}}static \u0275fac=function(t){return new(t||r)(dt(cg,16),dt(g1,24),dt(m1,24))};static \u0275pipe=rg({name:"date",type:r,pure:!0})}return r})();function e7(r,e){return{key:r,value:e}}var t7=(()=>{class r{differs;constructor(n){this.differs=n}differ;keyValues=[];compareFn=e1;transform(n,t=e1){if(!n||!(n instanceof Map)&&typeof n!="object")return null;this.differ??=this.differs.find(n).create();let i=this.differ.diff(n),o=t!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(s=>{this.keyValues.push(e7(s.key,s.currentValue))})),(i||o)&&(t&&this.keyValues.sort(t),this.compareFn=t),this.keyValues}static \u0275fac=function(t){return new(t||r)(dt(uT,16))};static \u0275pipe=rg({name:"keyvalue",type:r,pure:!1})}return r})();function e1(r,e){let n=r.key,t=e.key;if(n===t)return 0;if(n==null)return 1;if(t==null)return-1;if(typeof n=="string"&&typeof t=="string")return n<t?-1:1;if(typeof n=="number"&&typeof t=="number")return n-t;if(typeof n=="boolean"&&typeof t=="boolean")return n<t?-1:1;let i=String(n),o=String(t);return i==o?0:i<o?-1:1}var TC=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275mod=fa({type:r});static \u0275inj=us({})}return r})();function Eg(r,e){e=encodeURIComponent(e);for(let n of r.split(";")){let t=n.indexOf("="),[i,o]=t==-1?[n,""]:[n.slice(0,t),n.slice(t+1)];if(i.trim()===e)return decodeURIComponent(o)}return null}var al=class{};var IC="browser";function p1(r){return r===IC}var _g=class{_doc;constructor(e){this._doc=e}manager},Tg=(()=>{class r extends _g{constructor(n){super(n)}supports(n){return!0}addEventListener(n,t,i,o){return n.addEventListener(t,i,o),()=>this.removeEventListener(n,t,i,o)}removeEventListener(n,t,i,o){return n.removeEventListener(t,i,o)}static \u0275fac=function(t){return new(t||r)(C(In))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),yT=new ee(""),ST=(()=>{class r{_zone;_plugins;_eventNameToPlugin=new Map;constructor(n,t){this._zone=t,n.forEach(s=>{s.manager=this});let i=n.filter(s=>!(s instanceof Tg));this._plugins=i.slice().reverse();let o=n.find(s=>s instanceof Tg);o&&this._plugins.push(o)}addEventListener(n,t,i,o){return this._findPluginFor(t).addEventListener(n,t,i,o)}getZone(){return this._zone}_findPluginFor(n){let t=this._eventNameToPlugin.get(n);if(t)return t;if(t=this._plugins.find(o=>o.supports(n)),!t)throw new oe(5101,!1);return this._eventNameToPlugin.set(n,t),t}static \u0275fac=function(t){return new(t||r)(C(yT),C(we))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),vC="ng-app-id";function E1(r){for(let e of r)e.remove()}function _1(r,e){let n=e.createElement("style");return n.textContent=r,n}function n7(r,e,n,t){let i=r.head?.querySelectorAll(`style[${vC}="${e}"],link[${vC}="${e}"]`);if(i)for(let o of i)o.removeAttribute(vC),o instanceof HTMLLinkElement?t.set(o.href.slice(o.href.lastIndexOf("/")+1),{usage:0,elements:[o]}):o.textContent&&n.set(o.textContent,{usage:0,elements:[o]})}function SC(r,e){let n=e.createElement("link");return n.setAttribute("rel","stylesheet"),n.setAttribute("href",r),n}var AT=(()=>{class r{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(n,t,i,o={}){this.doc=n,this.appId=t,this.nonce=i,n7(n,t,this.inline,this.external),this.hosts.add(n.head)}addStyles(n,t){for(let i of n)this.addUsage(i,this.inline,_1);t?.forEach(i=>this.addUsage(i,this.external,SC))}removeStyles(n,t){for(let i of n)this.removeUsage(i,this.inline);t?.forEach(i=>this.removeUsage(i,this.external))}addUsage(n,t,i){let o=t.get(n);o?o.usage++:t.set(n,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(n,this.doc)))})}removeUsage(n,t){let i=t.get(n);i&&(i.usage--,i.usage<=0&&(E1(i.elements),t.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])E1(n);this.hosts.clear()}addHost(n){this.hosts.add(n);for(let[t,{elements:i}]of this.inline)i.push(this.addElement(n,_1(t,this.doc)));for(let[t,{elements:i}]of this.external)i.push(this.addElement(n,SC(t,this.doc)))}removeHost(n){this.hosts.delete(n)}addElement(n,t){return this.nonce&&t.setAttribute("nonce",this.nonce),n.appendChild(t)}static \u0275fac=function(t){return new(t||r)(C(In),C(j_),C(Ed,8),C(_s))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),yC={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"},RC=/%COMP%/g;var I1="%COMP%",r7=`_nghost-${I1}`,i7=`_ngcontent-${I1}`,o7=!0,v1=new ee("",{providedIn:"root",factory:()=>o7});function s7(r){return i7.replace(RC,r)}function a7(r){return r7.replace(RC,r)}function y1(r,e){return e.map(n=>n.replace(RC,r))}var RT=(()=>{class r{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;platformIsServer;constructor(n,t,i,o,s,a,c=null,l=null){this.eventManager=n,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 Ig(n,s,a,this.platformIsServer,this.tracingService)}createRenderer(n,t){if(!n||!t)return this.defaultRenderer;let i=this.getOrCreateRenderer(n,t);return i instanceof vT?i.applyToHost(n):i instanceof vg&&i.applyStyles(),i}getOrCreateRenderer(n,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 ms.Emulated:o=new vT(c,l,t,this.appId,u,s,a,d,f);break;case ms.ShadowDom:return new AC(c,l,n,t,s,a,this.nonce,d,f);default:o=new vg(c,l,t,u,s,a,d,f);break}i.set(t.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(n){this.rendererByCompId.delete(n)}static \u0275fac=function(t){return new(t||r)(C(ST),C(AT),C(j_),C(v1),C(In),C(we),C(Ed),C(ol,8))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),Ig=class{eventManager;doc;ngZone;platformIsServer;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,n,t,i,o){this.eventManager=e,this.doc=n,this.ngZone=t,this.platformIsServer=i,this.tracingService=o}destroy(){}destroyNode=null;createElement(e,n){return n?this.doc.createElementNS(yC[n]||n,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,n){(T1(e)?e.content:e).appendChild(n)}insertBefore(e,n,t){e&&(T1(e)?e.content:e).insertBefore(n,t)}removeChild(e,n){n.remove()}selectRootElement(e,n){let t=typeof e=="string"?this.doc.querySelector(e):e;if(!t)throw new oe(-5104,!1);return n||(t.textContent=""),t}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,n,t,i){if(i){n=i+":"+n;let o=yC[i];o?e.setAttributeNS(o,n,t):e.setAttribute(n,t)}else e.setAttribute(n,t)}removeAttribute(e,n,t){if(t){let i=yC[t];i?e.removeAttributeNS(i,n):e.removeAttribute(`${t}:${n}`)}else e.removeAttribute(n)}addClass(e,n){e.classList.add(n)}removeClass(e,n){e.classList.remove(n)}setStyle(e,n,t,i){i&(xi.DashCase|xi.Important)?e.style.setProperty(n,t,i&xi.Important?"important":""):e.style[n]=t}removeStyle(e,n,t){t&xi.DashCase?e.style.removeProperty(n):e.style[n]=""}setProperty(e,n,t){e!=null&&(e[n]=t)}setValue(e,n){e.nodeValue=n}listen(e,n,t,i){if(typeof e=="string"&&(e=No().getGlobalEventTarget(this.doc,e),!e))throw new oe(5102,!1);let o=this.decoratePreventDefault(t);return this.tracingService?.wrapEventListener&&(o=this.tracingService.wrapEventListener(e,n,o)),this.eventManager.addEventListener(e,n,o,i)}decoratePreventDefault(e){return n=>{if(n==="__ngUnwrap__")return e;e(n)===!1&&n.preventDefault()}}};function T1(r){return r.tagName==="TEMPLATE"&&r.content!==void 0}var AC=class extends Ig{sharedStylesHost;hostEl;shadowRoot;constructor(e,n,t,i,o,s,a,c,l){super(e,o,s,c,l),this.sharedStylesHost=n,this.hostEl=t,this.shadowRoot=t.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let u=i.styles;u=y1(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=SC(f,o);a&&g.setAttribute("nonce",a),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,n){return super.appendChild(this.nodeOrShadowRoot(e),n)}insertBefore(e,n,t){return super.insertBefore(this.nodeOrShadowRoot(e),n,t)}removeChild(e,n){return super.removeChild(null,n)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},vg=class extends Ig{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,n,t,i,o,s,a,c,l){super(e,o,s,a,c),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i;let u=t.styles;this.styles=l?y1(l,u):u,this.styleUrls=t.getExternalStyles?.(l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&nl.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},vT=class extends vg{contentAttr;hostAttr;constructor(e,n,t,i,o,s,a,c,l){let u=i+"-"+t.id;super(e,n,t,o,s,a,c,l,u),this.contentAttr=s7(u),this.hostAttr=a7(u)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,n){let t=super.createElement(e,n);return super.setAttribute(t,this.contentAttr,""),t}};var DT=class r extends hg{supportsDOMEvents=!0;static makeCurrent(){hC(new r)}onAndCancel(e,n,t,i){return e.addEventListener(n,t,i),()=>{e.removeEventListener(n,t,i)}}dispatchEvent(e,n){e.dispatchEvent(n)}remove(e){e.remove()}createElement(e,n){return n=n||this.getDefaultDocument(),n.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,n){return n==="window"?window:n==="document"?e:n==="body"?e.body:null}getBaseHref(e){let n=c7();return n==null?null:l7(n)}resetBaseElement(){yg=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return Eg(document.cookie,e)}},yg=null;function c7(){return yg=yg||document.head.querySelector("base"),yg?yg.getAttribute("href"):null}function l7(r){return new URL(r,document.baseURI).pathname}var CT=class{addToWindow(e){Kt.getAngularTestability=(t,i=!0)=>{let o=e.findTestabilityInTree(t,i);if(o==null)throw new oe(5103,!1);return o},Kt.getAllAngularTestabilities=()=>e.getAllTestabilities(),Kt.getAllAngularRootElements=()=>e.getAllRootElements();let n=t=>{let i=Kt.getAllAngularTestabilities(),o=i.length,s=function(){o--,o==0&&t()};i.forEach(a=>{a.whenStable(s)})};Kt.frameworkStabilizers||(Kt.frameworkStabilizers=[]),Kt.frameworkStabilizers.push(n)}findTestabilityInTree(e,n,t){if(n==null)return null;let i=e.getTestability(n);return i??(t?No().isShadowRoot(n)?this.findTestabilityInTree(e,n.host,!0):this.findTestabilityInTree(e,n.parentElement,!0):null)}},u7=(()=>{class r{build(){return new XMLHttpRequest}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),S1=["alt","control","meta","shift"],d7={"\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"},h7={alt:r=>r.altKey,control:r=>r.ctrlKey,meta:r=>r.metaKey,shift:r=>r.shiftKey},A1=(()=>{class r extends _g{constructor(n){super(n)}supports(n){return r.parseEventName(n)!=null}addEventListener(n,t,i,o){let s=r.parseEventName(t),a=r.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>No().onAndCancel(n,s.domEventName,a,o))}static parseEventName(n){let t=n.toLowerCase().split("."),i=t.shift();if(t.length===0||!(i==="keydown"||i==="keyup"))return null;let o=r._normalizeKey(t.pop()),s="",a=t.indexOf("code");if(a>-1&&(t.splice(a,1),s="code."),S1.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(n,t){let i=d7[n.key]||n.key,o="";return t.indexOf("code.")>-1&&(i=n.code,o="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),S1.forEach(s=>{if(s!==i){let a=h7[s];a(n)&&(o+=s+".")}}),o+=i,o===t)}static eventCallback(n,t,i){return o=>{r.matchEventFullKeyCode(o,n)&&i.runGuarded(()=>t(o))}}static _normalizeKey(n){return n==="esc"?"escape":n}static \u0275fac=function(t){return new(t||r)(C(In))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();function f7(){DT.makeCurrent()}function g7(){return new Pr}function m7(){return sD(document),document}var p7=[{provide:_s,useValue:IC},{provide:H_,useValue:f7,multi:!0},{provide:In,useFactory:m7}],E7=cC(BU,"browser",p7);var _7=[{provide:_d,useClass:CT},{provide:iT,useClass:ig,deps:[we,og,_d]},{provide:ig,useClass:ig,deps:[we,og,_d]}],T7=[{provide:xf,useValue:"root"},{provide:Pr,useFactory:g7},{provide:yT,useClass:Tg,multi:!0,deps:[In]},{provide:yT,useClass:A1,multi:!0,deps:[In]},RT,AT,ST,{provide:Es,useExisting:RT},{provide:al,useClass:u7},[]],I7=(()=>{class r{constructor(){}static \u0275fac=function(t){return new(t||r)};static \u0275mod=fa({type:r});static \u0275inj=us({providers:[...T7,..._7],imports:[TC,GU]})}return r})();var vd=class{},Sg=class{},pa=class r{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(e){e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(`
5
- `).forEach(n=>{let t=n.indexOf(":");if(t>0){let i=n.slice(0,t),o=n.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((n,t)=>{this.addHeaderEntry(t,n)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([n,t])=>{this.setHeaderEntries(n,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let n=this.headers.get(e.toLowerCase());return n&&n.length>0?n[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,n){return this.clone({name:e,value:n,op:"a"})}set(e,n){return this.clone({name:e,value:n,op:"s"})}delete(e,n){return this.clone({name:e,value:n,op:"d"})}maybeSetNormalizedName(e,n){this.normalizedNames.has(n)||this.normalizedNames.set(n,e)}init(){this.lazyInit&&(this.lazyInit instanceof r?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(n=>{this.headers.set(n,e.headers.get(n)),this.normalizedNames.set(n,e.normalizedNames.get(n))})}clone(e){let n=new r;return n.lazyInit=this.lazyInit&&this.lazyInit instanceof r?this.lazyInit:this,n.lazyUpdate=(this.lazyUpdate||[]).concat([e]),n}applyUpdate(e){let n=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,n);let i=(e.op==="a"?this.headers.get(n):void 0)||[];i.push(...t),this.headers.set(n,i);break;case"d":let o=e.value;if(!o)this.headers.delete(n),this.normalizedNames.delete(n);else{let s=this.headers.get(n);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(n),this.normalizedNames.delete(n)):this.headers.set(n,s)}break}}addHeaderEntry(e,n){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(n):this.headers.set(t,[n])}setHeaderEntries(e,n){let t=(Array.isArray(n)?n:[n]).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(n=>e(this.normalizedNames.get(n),this.headers.get(n)))}};var OT=class{encodeKey(e){return R1(e)}encodeValue(e){return R1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function v7(r,e){let n=new Map;return r.length>0&&r.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=n.get(s)||[];c.push(a),n.set(s,c)}),n}var y7=/%(\d[a-f0-9])/gi,S7={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function R1(r){return encodeURIComponent(r).replace(y7,(e,n)=>S7[n]??e)}function NT(r){return`${r}`}var Ss=class r{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new OT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=v7(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(n=>{let t=e.fromObject[n],i=Array.isArray(t)?t.map(NT):[NT(t)];this.map.set(n,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let n=this.map.get(e);return n?n[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,n){return this.clone({param:e,value:n,op:"a"})}appendAll(e){let n=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{n.push({param:t,value:o,op:"a"})}):n.push({param:t,value:i,op:"a"})}),this.clone(n)}set(e,n){return this.clone({param:e,value:n,op:"s"})}delete(e,n){return this.clone({param:e,value:n,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let n=this.encoder.encodeKey(e);return this.map.get(e).map(t=>n+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let n=new r({encoder:this.encoder});return n.cloneFrom=this.cloneFrom||this,n.updates=(this.updates||[]).concat(e),n}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 n=(e.op==="a"?this.map.get(e.param):void 0)||[];n.push(NT(e.value)),this.map.set(e.param,n);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(NT(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 bT=class{map=new Map;set(e,n){return this.map.set(e,n),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 A7(r){switch(r){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function D1(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer}function C1(r){return typeof Blob<"u"&&r instanceof Blob}function N1(r){return typeof FormData<"u"&&r instanceof FormData}function R7(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}var O1="Content-Type",b1="Accept",L1="X-Request-URL",M1="text/plain",P1="application/json",D7=`${P1}, ${M1}, */*`,Td=class r{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,n,t,i){this.url=n,this.method=e.toUpperCase();let o;if(A7(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!==void 0&&(this.referrer=o.referrer),this.transferCache=o.transferCache}if(this.headers??=new pa,this.context??=new bT,!this.params)this.params=new Ss,this.urlWithParams=n;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=n;else{let a=n.indexOf("?"),c=a===-1?"?":a<n.length-1?"&":"";this.urlWithParams=n+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||D1(this.body)||C1(this.body)||N1(this.body)||R7(this.body)?this.body:this.body instanceof Ss?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||N1(this.body)?null:C1(this.body)?this.body.type||null:D1(this.body)?null:typeof this.body=="string"?M1:this.body instanceof Ss?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?P1:null}clone(e={}){let n=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,D=e.reportProgress??this.reportProgress,L=e.headers||this.headers,B=e.params||this.params,w=e.context??this.context;return e.setHeaders!==void 0&&(L=Object.keys(e.setHeaders).reduce((F,U)=>F.set(U,e.setHeaders[U]),L)),e.setParams&&(B=Object.keys(e.setParams).reduce((F,U)=>F.set(U,e.setParams[U]),B)),new r(n,t,_,{params:B,headers:L,context:w,reportProgress:D,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},cl=(function(r){return r[r.Sent=0]="Sent",r[r.UploadProgress=1]="UploadProgress",r[r.ResponseHeader=2]="ResponseHeader",r[r.DownloadProgress=3]="DownloadProgress",r[r.Response=4]="Response",r[r.User=5]="User",r})(cl||{}),yd=class{headers;status;statusText;url;ok;type;redirected;constructor(e,n=200,t="OK"){this.headers=e.headers||new pa,this.status=e.status!==void 0?e.status:n,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},wT=class r extends yd{constructor(e={}){super(e)}type=cl.ResponseHeader;clone(e={}){return new r({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})}},Ag=class r extends yd{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=cl.Response;clone(e={}){return new r({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})}},Id=class extends yd{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}},C7=200,N7=204;function DC(r,e){return{body:e,headers:r.headers,context:r.context,observe:r.observe,params:r.params,reportProgress:r.reportProgress,responseType:r.responseType,withCredentials:r.withCredentials,credentials:r.credentials,transferCache:r.transferCache,timeout:r.timeout,keepalive:r.keepalive,priority:r.priority,cache:r.cache,mode:r.mode,redirect:r.redirect,integrity:r.integrity,referrer:r.referrer}}var x1=(()=>{class r{handler;constructor(n){this.handler=n}request(n,t,i={}){let o;if(n instanceof Td)o=n;else{let c;i.headers instanceof pa?c=i.headers:c=new pa(i.headers);let l;i.params&&(i.params instanceof Ss?l=i.params:l=new Ss({fromObject:i.params})),o=new Td(n,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=de(o).pipe(VS(c=>this.handler.handle(c)));if(n instanceof Td||i.observe==="events")return s;let a=s.pipe(Rt(c=>c instanceof Ag));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(ge(c=>{if(c.body!==null&&!(c.body instanceof ArrayBuffer))throw new oe(2806,!1);return c.body}));case"blob":return a.pipe(ge(c=>{if(c.body!==null&&!(c.body instanceof Blob))throw new oe(2807,!1);return c.body}));case"text":return a.pipe(ge(c=>{if(c.body!==null&&typeof c.body!="string")throw new oe(2808,!1);return c.body}));default:return a.pipe(ge(c=>c.body))}case"response":return a;default:throw new oe(2809,!1)}}delete(n,t={}){return this.request("DELETE",n,t)}get(n,t={}){return this.request("GET",n,t)}head(n,t={}){return this.request("HEAD",n,t)}jsonp(n,t){return this.request("JSONP",n,{params:new Ss().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(n,t={}){return this.request("OPTIONS",n,t)}patch(n,t,i={}){return this.request("PATCH",n,DC(i,t))}post(n,t,i={}){return this.request("POST",n,DC(i,t))}put(n,t,i={}){return this.request("PUT",n,DC(i,t))}static \u0275fac=function(t){return new(t||r)(C(vd))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var O7=new ee("");function F1(r,e){return e(r)}function b7(r,e){return(n,t)=>e.intercept(n,{handle:i=>r(i,t)})}function w7(r,e,n){return(t,i)=>go(n,()=>e(t,o=>r(o,i)))}var k1=new ee(""),NC=new ee(""),U1=new ee(""),OC=new ee("",{providedIn:"root",factory:()=>!0});function L7(){let r=null;return(e,n)=>{r===null&&(r=(J(k1,{optional:!0})??[]).reduceRight(b7,F1));let t=J(vo);if(J(OC)){let o=t.add();return r(e,n).pipe(Lc(o))}else return r(e,n)}}var LT=(()=>{class r extends vd{backend;injector;chain=null;pendingTasks=J(vo);contributeToStability=J(OC);constructor(n,t){super(),this.backend=n,this.injector=t}handle(n){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(NC),...this.injector.get(U1,[])]));this.chain=t.reduceRight((i,o)=>w7(i,o,this.injector),F1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(n,i=>this.backend.handle(i)).pipe(Lc(t))}else return this.chain(n,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||r)(C(Sg),C(zn))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var M7=/^\)\]\}',?\n/,P7=RegExp(`^${L1}:`,"m");function x7(r){return"responseURL"in r&&r.responseURL?r.responseURL:P7.test(r.getAllResponseHeaders())?r.getResponseHeader(L1):null}var CC=(()=>{class r{xhrFactory;constructor(n){this.xhrFactory=n}handle(n){if(n.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return de(null).pipe(pt(()=>new pe(o=>{let s=t.build();if(s.open(n.method,n.urlWithParams),n.withCredentials&&(s.withCredentials=!0),n.headers.forEach((T,D)=>s.setRequestHeader(T,D.join(","))),n.headers.has(b1)||s.setRequestHeader(b1,D7),!n.headers.has(O1)){let T=n.detectContentTypeHeader();T!==null&&s.setRequestHeader(O1,T)}if(n.timeout&&(s.timeout=n.timeout),n.responseType){let T=n.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=n.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",D=new pa(s.getAllResponseHeaders()),L=x7(s)||n.url;return c=new wT({headers:D,status:s.status,statusText:T,url:L}),c},u=()=>{let{headers:T,status:D,statusText:L,url:B}=l(),w=null;D!==N7&&(w=typeof s.response>"u"?s.responseText:s.response),D===0&&(D=w?C7:0);let F=D>=200&&D<300;if(n.responseType==="json"&&typeof w=="string"){let U=w;w=w.replace(M7,"");try{w=w!==""?JSON.parse(w):null}catch(A){w=U,F&&(F=!1,w={error:A,text:w})}}F?(o.next(new Ag({body:w,headers:T,status:D,statusText:L,url:B||void 0})),o.complete()):o.error(new Id({error:w,headers:T,status:D,statusText:L,url:B||void 0}))},d=T=>{let{url:D}=l(),L=new Id({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:D||void 0});o.error(L)},f=d;n.timeout&&(f=T=>{let{url:D}=l(),L=new Id({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:D||void 0});o.error(L)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let D={type:cl.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),n.responseType==="text"&&s.responseText&&(D.partialText=s.responseText),o.next(D)},_=T=>{let D={type:cl.UploadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),o.next(D)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),n.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:cl.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),n.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||r)(C(al))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),V1=new ee(""),F7="XSRF-TOKEN",k7=new ee("",{providedIn:"root",factory:()=>F7}),U7="X-XSRF-TOKEN",V7=new ee("",{providedIn:"root",factory:()=>U7}),Rg=class{},B7=(()=>{class r{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(n,t){this.doc=n,this.cookieName=t}getToken(){let n=this.doc.cookie||"";return n!==this.lastCookieString&&(this.parseCount++,this.lastToken=Eg(n,this.cookieName),this.lastCookieString=n),this.lastToken}static \u0275fac=function(t){return new(t||r)(C(In),C(k7))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),G7=/^(?:https?:)?\/\//i;function $7(r,e){if(!J(V1)||r.method==="GET"||r.method==="HEAD"||G7.test(r.url))return e(r);let n=J(Rg).getToken(),t=J(V7);return n!=null&&!r.headers.has(t)&&(r=r.clone({headers:r.headers.set(t,n)})),e(r)}var bC=(function(r){return r[r.Interceptors=0]="Interceptors",r[r.LegacyInterceptors=1]="LegacyInterceptors",r[r.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",r[r.NoXsrfProtection=3]="NoXsrfProtection",r[r.JsonpSupport=4]="JsonpSupport",r[r.RequestsMadeViaParent=5]="RequestsMadeViaParent",r[r.Fetch=6]="Fetch",r})(bC||{});function j7(r,e){return{\u0275kind:r,\u0275providers:e}}function H7(...r){let e=[x1,CC,LT,{provide:vd,useExisting:LT},{provide:Sg,useFactory:()=>J(O7,{optional:!0})??J(CC)},{provide:NC,useValue:$7,multi:!0},{provide:V1,useValue:!0},{provide:Rg,useClass:B7}];for(let n of r)e.push(...n.\u0275providers);return pr(e)}var w1=new ee("");function W7(){return j7(bC.LegacyInterceptors,[{provide:w1,useFactory:L7},{provide:NC,useExisting:w1,multi:!0}])}var wC=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:function(t){let i=null;return t?i=new(t||r):i=C(z7),i},providedIn:"root"})}return r})(),z7=(()=>{class r extends wC{_doc;constructor(n){super(),this._doc=n}sanitize(n,t){if(t==null)return null;switch(n){case ci.NONE:return t;case ci.HTML:return Ao(t,"HTML")?Ur(t):q_(this._doc,String(t)).toString();case ci.STYLE:return Ao(t,"Style")?Ur(t):t;case ci.SCRIPT:if(Ao(t,"Script"))return Ur(t);throw new oe(5200,!1);case ci.URL:return Ao(t,"URL")?Ur(t):Qf(String(t));case ci.RESOURCE_URL:if(Ao(t,"ResourceURL"))return Ur(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(n){return lD(n)}bypassSecurityTrustStyle(n){return uD(n)}bypassSecurityTrustScript(n){return dD(n)}bypassSecurityTrustUrl(n){return hD(n)}bypassSecurityTrustResourceUrl(n){return fD(n)}static \u0275fac=function(t){return new(t||r)(C(In))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var dn={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 ye={NEWLY_ADDED:"newlyAdded",ADDED:"added",UPDATED:"updated",DELETED:"deleted",APPROVED:"approved",ASSIGNED:"assigned",STATUS_CHANGED:"statusChanged",PRIORITY_CHANGED:"priorityChanged",ACCESS_MODE_CHANGED:"accessModeChanged",CUSTOM_LIST_CHANGED:"customListChanged",ACCEPTED:"accepted",REJECTED:"rejected",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},Qt={COMMENT_ANNOTATION_ADD:"comment_annotation.add",COMMENT_ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_DELETE:"comment.delete",COMMENT_UPDATE:"comment.update",REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete",ATTACHMENT_ADD:"attachment.add",ATTACHMENT_DELETE:"attachment.delete",RECORDER_ANNOTATION_ADD:"recorder_annotation.add",RECORDER_ANNOTATION_UPDATE:"recorder_annotation.update",RECORDER_ANNOTATION_DELETE:"recorder_annotation.delete",ACTIVITY_SAVE:"activity.save"},ar={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"},lRe={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",SIDEBAR_OPEN:"sidebarOpen",SIDEBAR_CLOSE:"sidebarClose",FULLSCREEN_CLICK:"fullscreenClick",COMMENT_CLICK:"commentClick",COMMENT_NAVIGATION_BUTTON_CLICK:"commentNavigationButtonClick",ATTACHMENT_DOWNLOAD_CLICKED:"attachmentDownloadClicked",COMMENT_SAVED:"commentSaved",COMMENT_SAVE_TRIGGERED:"commentSaveTriggered",VISIBILITY_OPTION_CLICKED:"visibilityOptionClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected",COMMENT_ACTION_CLICKED:"commentActionClicked"},uRe={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"},dRe={TEXT_SELECTED:"textSelected"},hRe={SUGGESTION_CREATED:"suggestionCreated",SUGGESTION_APPROVED:"suggestionApproved",SUGGESTION_REJECTED:"suggestionRejected",SUGGESTION_STALE:"suggestionStale",TARGET_EDIT_START:"targetEditStart",TARGET_EDIT_COMMIT:"targetEditCommit"},H={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"},fRe={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"},gRe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},mRe={SETTINGS_UPDATED:"settingsUpdated"},pRe={UPDATE_DATA:"updateData"},K7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(K7||{}),Y7=(function(r){return r.INVITE="invite",r.REMOVE="remove",r})(Y7||{}),Q7=(function(r){return r.CREATED="created",r.JOINED="joined",r})(Q7||{}),X7=(function(r){return r.UPDATE_DATA="updateData",r})(X7||{}),MT=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(MT||{}),J7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r})(J7||{}),ERe={ADDED:"added",UPDATED:"updated",DELETED:"deleted"},Z7=(function(r){return r.FIRST_VIEWED="firstViewed",r})(Z7||{}),LC=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.ACTIVITY="activity",r.VIEWS="views",r.USER_INVITE="userInvite",r.USER_REQUEST="userRequest",r.VIDEO_PLAYER="videoPlayer",r.CRDT="crdt",r})(LC||{}),eQ=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.AREA_COMMENT="areaComment",r.INLINE_COMMENT="inlineComment",r.COMMENT_SIDEBAR="commentSidebar",r})(eQ||{}),Br=(function(r){return r.DESKTOP="Desktop",r.MOBILE="Mobile",r.TABLET="Tablet",r.MONITOR="Monitor",r.UNKNOWN="Unknown",r})(Br||{}),Sd=(function(r){return r.PORTRAIT="portrait",r.LANDSCAPE="landscape",r.UNKNOWN="unknown",r})(Sd||{}),PT=(function(r){return r.Portrait="(orientation: portrait)",r.Landscape="(orientation: landscape)",r})(PT||{}),tQ=(function(r){return r.DIFFERENT_DEVICE="differentDevice",r.ELEMENT_DELETED="elementDeleted",r})(tQ||{}),Ad=(function(r){return r.ADMIN="Admin",r.COMMENTER="Commenter",r})(Ad||{}),Mt={PUBLIC:"public",RESTRICTED:"restricted",ORGANIZATION_PRIVATE:"organizationPrivate"},nQ=(function(r){return r.DEFAULT="default",r.DYNAMIC_ID="dynamicId",r})(nQ||{}),xT={PUBLIC:"public",PRIVATE:"private"},rQ=(function(r){return r.MINIMAL="minimal",r.VERBOSE="verbose",r})(rQ||{}),iQ=(function(r){return r.DEFAULT="default",r.EXPANDED="expanded",r})(iQ||{}),oQ=(function(r){return r.TOTAL="total",r.UNREAD="unread",r})(oQ||{}),_Re={ONLINE:"online",OFFLINE:"offline",PENDING_INIT:"pendingInit",PENDING_DATA:"pendingData"},TRe={ALL:"all",ORGANIZATION:"organization",ORGANIZATION_USER_GROUP:"organizationUserGroup",DOCUMENT:"document",FOLDER:"folder"},IRe={AND:"and",OR:"or"},sQ=(function(r){return r.RESTRICTED_SELF="restrictedSelf",r.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",r.ORGANIZATION_PRIVATE="organizationPrivate",r.PUBLIC="public",r})(sQ||{});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.FIRESTORE_MAX_DISJUNCTIONS=30,q.DEFAULT_VELT_CONTEXT="default:velt",q.VISIBILITY_SELF_PREFIX="__velt_private_self:",q.VISIBILITY_ORG_PREFIX="organizationPrivate:",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:Ad.COMMENTER?.toLowerCase(),name:Ad.COMMENTER,description:"Can comment on this project",permissions:[]},{id:Ad.ADMIN?.toLowerCase(),name:Ad.ADMIN,description:"Can comment on all projects and has access to the portal",permissions:[]}],q.DocumentAccessTypeMap={[Mt.PUBLIC]:{id:Mt.PUBLIC,name:Mt.PUBLIC,description:"Anyone with link can view"},[Mt.RESTRICTED]:{id:Mt.RESTRICTED,name:Mt.RESTRICTED,description:"Only people with access can view"}},q.DocumentAccessTypeMapSF={[Mt.PUBLIC]:{id:Mt.PUBLIC,name:Mt.PUBLIC,description:"Anyone with the link can comment after logging in."},[Mt.RESTRICTED]:{id:Mt.RESTRICTED,name:Mt.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 FT=new ee("arrow-utils"),RRe=new ee("notification-service"),DRe=new ee("notifications-actions"),ki=new ee("notification-utils"),CRe=new ee("cursor-service"),kT=new ee("cursor-utils"),NRe=new ee("presence-service"),ORe=new ee("presence-actions"),UT=new ee("presence-utils"),bRe=new ee("huddle-service"),VT=new ee("huddle-utils"),wRe=new ee("recorder-service"),BT=new ee("recorder-annotation-service"),LRe=new ee("recorder-actions"),ui=new ee("recorder-utils"),MRe=new ee("recorder-pin-portal"),Rd=new ee("comment-service"),PRe=new ee("comment-actions"),xRe=new ee("comment-dialog-core"),FRe=new ee("comment-dialog-action"),kRe=new ee("comment-text-service"),URe=new ee("comment-text-portal"),VRe=new ee("comment-pin-portal"),BRe=new ee("comment-views"),GT=new ee("reaction-service"),GRe=new ee("rewriter-service"),$Re=new ee("rewriter-actions"),$T=new ee("area-service"),jT=new ee("activity-service"),B1=new ee("views-service"),G1=new ee("crdt-service"),$1=new ee("live-state-service");var Yn=class Yn{static showLogs(){try{return dn.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(e){return Yn.catch("Error in showLogs: ",e),!1}}};Yn.log=Yn.showLogs()?console.log:()=>{},Yn.warn=Yn.showLogs()?console.warn:()=>{},Yn.error=Yn.showLogs()?console.error:()=>{},Yn.debug=Yn.showLogs()?console.debug:()=>{},Yn.info=Yn.showLogs()?console.info:()=>{},Yn.logsEnabled=!0,Yn.catch=(e,n)=>{try{Yn.logsEnabled&&(n!==void 0?console.warn("Velt: ",e,n):console.warn("Velt: ",e))}catch{}};var j=Yn;var di=(()=>{let e=class e{constructor(){this.subjects=new Map,j.log("%c[WB] Creating CLASS: ServiceBook","color: blue;")}set(t,i){try{j.log(`%c[WB] ServiceBook.set: ${t.toString()}`,"color: green;"),this.getOrCreateSubject(t).next(i)}catch(o){j.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 r=e;return r})();var P=(()=>{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",SET_UNSTYLED_MODE_TRIGGERED:"setUnstyledModeTriggered",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",ENABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"enableRestrictTextSearchToAnchorTriggered",DISABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"disableRestrictTextSearchToAnchorTriggered",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",ACCEPT_SUGGESTION_TRIGGERED:"acceptSuggestionTriggered",REJECT_SUGGESTION_TRIGGERED:"rejectSuggestionTriggered",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_DRAFT_CONFIRMATION_TRIGGERED:"enableDraftConfirmationTriggered",DISABLE_DRAFT_CONFIRMATION_TRIGGERED:"disableDraftConfirmationTriggered",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",ENABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"enableUserScopedNotificationsTriggered",DISABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"disableUserScopedNotificationsTriggered",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 r=e;return r})(),j1=[P.Events.Rewriter.REWRITER_ENABLED];var H1=class{constructor(){this.attachmentId=Math.floor(1e5+Math.random()*9e5)}};var Me={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"},Cg={RECORDING_ADD:"recording.add",RECORDING_DELETE:"recording.delete"},Ng={REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete"},JRe={EDITOR_EDIT:"crdt.editor_edit"};var Cd=class{};var MC,HT=new Map,W1,WT=r=>r!=null?String(r):void 0,aQ=r=>{if(r.url)try{let e=new URL(r.url);r.baseUrl===void 0&&(r.baseUrl=e.origin),r.path===void 0&&(r.path=e.pathname),r.queryParams===void 0&&(r.queryParams=e.search)}catch{}},z1=r=>{W1=r},nDe=(r,e)=>{try{if(!r||typeof r!="object")return;let n=JSON.parse(JSON.stringify(r));aQ(n);let t=WT(e);t?HT.set(t,n):MC=n}catch(n){j.catch("Error in setClientPageInfo: ",n)}},rDe=r=>{try{let e=WT(r);e?HT.delete(e):MC=void 0}catch(e){j.catch("Error in clearClientPageInfo: ",e)}},zT=r=>{try{let e=WT(r)??WT(W1?.());return e&&HT.has(e)?HT.get(e):MC}catch(e){j.catch("Error in getClientPageInfo: ",e);return}};var PC;try{PC=typeof Intl<"u"&&Intl.v8BreakIterator}catch{PC=!1}var q1=(()=>{class r{_platformId=J(_s);isBrowser=this._platformId?p1(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||PC)&&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||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function xC(r){return Array.isArray(r)?r:[r]}var K1=new Set,ll,Q1=(()=>{class r{_platform=J(q1);_nonce=J(Ed,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):lQ}matchMedia(n){return(this._platform.WEBKIT||this._platform.BLINK)&&cQ(n,this._nonce),this._matchMedia(n)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function cQ(r,e){if(!K1.has(r))try{ll||(ll=document.createElement("style"),e&&ll.setAttribute("nonce",e),ll.setAttribute("type","text/css"),document.head.appendChild(ll)),ll.sheet&&(ll.sheet.insertRule(`@media ${r} {body{ }}`,0),K1.add(r))}catch(n){console.error(n)}}function lQ(r){return{matches:r==="all"||r==="",media:r,addListener:()=>{},removeListener:()=>{}}}var uQ=(()=>{class r{_mediaMatcher=J(Q1);_zone=J(we);_queries=new Map;_destroySubject=new Ct;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(n){return Y1(xC(n)).some(i=>this._registerQuery(i).mql.matches)}observe(n){let i=Y1(xC(n)).map(s=>this._registerQuery(s).observable),o=ti(i);return o=Js(o.pipe(Dt(1)),o.pipe(zS(1),Mu(0))),o.pipe(ge(s=>{let a={matches:!1,breakpoints:{}};return s.forEach(({matches:c,query:l})=>{a.matches=a.matches||c,a.breakpoints[l]=c}),a}))}_registerQuery(n){if(this._queries.has(n))return this._queries.get(n);let t=this._mediaMatcher.matchMedia(n),o={observable:new pe(s=>{let a=c=>this._zone.run(()=>s.next(c));return t.addListener(a),()=>{t.removeListener(a)}}).pipe(xu(t),ge(({matches:s})=>({query:n,matches:s})),Zs(this._destroySubject)),mql:t};return this._queries.set(n,o),o}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function Y1(r){return r.map(e=>e.split(",")).reduce((e,n)=>e.concat(n)).map(e=>e.trim())}var Og={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 hi=(()=>{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[Og.Handset]?Br.MOBILE:e.Breakpoints[Og.Tablet]?Br.TABLET:e.Breakpoints[Og.XLarge]?Br.MONITOR:e.Breakpoints[Og.Web]?Br.DESKTOP:Br.UNKNOWN}catch{return Br.UNKNOWN}}getOrientation(){try{return e.Orientations[PT.Portrait]?Sd.PORTRAIT:e.Orientations[PT.Landscape]?Sd.LANDSCAPE:Sd.UNKNOWN}catch{return Sd.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 r=e;return r})();var Nt=class{constructor(e=!0){this.deviceInfo=new hi().getDeviceInfo();try{if(e){let n=zT();n&&Object.assign(this,n)}}catch{}}};var X1=class{constructor(){this.targetElements=[],this.type="area",this.props=new Cd,this.pageInfo=new Nt,this.targetAnnotations=[]}};var J1=class{constructor(){this.type="arrow",this.props=new Cd,this.pageInfo=new Nt}};var LDe={COPY_LINK:"copy-link",DELETE:"delete"},MDe={COPY_LINK:"Copy link",LINK_COPIED:"Link copied!",DELETE_THREAD:"Delete thread"};var qT=class{constructor(){this.comments=[],this.commentCategories=[],this.type="comment",this.status=v.CommentAnnotationStatusMap.OPEN,this.pageInfo=new Nt,this.iam=new FC,this.customList=[],this.subscribedUsers={},this.unsubscribedUsers={},this.subscribedGroups={}}};var FC=class{constructor(){this.accessMode=xT.PUBLIC}};var KT=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 YT=class{constructor(){this.urlAllowList=[],this.featureAllowList=[],this.userPlanAllowList=[],this.userIdAllowList=[],this.userGroupIdAllowList=[],this.debugMode=!1,this.usePrefersColorScheme=!1,this.advancedQueriesDisabled=!1,this.globalStyles=!0}},Z1=["core","rest-api","recorder-media","ai","agents","huddle-webrtc","integrations-workflow","superflow","billing-stripe","migrations","legacy-v1","velt-internal"];var Ln=(function(r){return r.RESOLVE_USERS="resolveUsers",r.FORMAT_RESPONSE="formatResponse",r.MERGE_USER_WITH_PROVIDED_USER_DATA="mergeUserWithProvidedUserData",r.GET_TEMPORARY_USERS="getTemporaryUsers",r.SET_SINGLE_EDITOR_MODE_LIVE_STATE_DATA_FOR_DIFFERENT_USER_PRESENT_ON_TAB="setSingleEditorModeLiveStateDataForDifferentUserPresentOnTab",r.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER="resolveAndMergeSingleEditorLiveStateDataWithUser",r.GET_SINGLE_EDITOR_MODE_DATA="getSingleEditorModeData",r.RESOLVE_USERS_FROM_HUDDLE_MESSAGES="resolveUsersFromHuddleMessages",r.RESOLVE_USER_IDS_BY_EMAIL="resolveUserIdsByEmail",r})(Ln||{}),Ea=(function(r){return r.IDENTIFY="identify/authProvider",r.GET_TEMPORARY_USERS="getTemporaryUsers",r.GET_USERS="getUsers",r.GET_HUDDLE_USERS="getHuddleUsers",r.GET_SINGLE_EDITOR_USERS="getSingleEditorUsers",r})(Ea||{}),_t=(function(r){return r.RESOLVE_COMMENT_ANNOTATIONS="resolveCommentAnnotations",r.SAVE_COMMENT_ANNOTATION="saveCommentAnnotation",r.DELETE_COMMENT_ANNOTATION="deleteCommentAnnotation",r.FORMAT_RESPONSE="formatResponse",r.INIT_DOCUMENTS="initDocuments",r.SET_DATA="setData",r.UPDATE_DATA="updateData",r.DELETE_DATA="deleteData",r})(_t||{}),Oo=(function(r){return r.SAVE_ATTACHMENT="saveAttachment",r.DELETE_ATTACHMENT="deleteAttachment",r.UPLOAD_TO_RESOLVER="uploadToResolver",r})(Oo||{}),Tt=(function(r){return r.RESOLVE_REACTION_ANNOTATIONS="resolveReactionAnnotations",r.SAVE_REACTION_ANNOTATION="saveReactionAnnotation",r.DELETE_REACTION_ANNOTATION="deleteReactionAnnotation",r.FORMAT_RESPONSE="formatResponse",r.INIT_DOCUMENTS="initDocuments",r.SET_DATA="setData",r.UPDATE_DATA="updateData",r.DELETE_DATA="deleteData",r})(Tt||{}),eV;eV||(eV={});var Nd=(function(r){return r.SET_DOCUMENTS="setDocuments",r.GET_COMMENT_ANNOTATIONS="getCommentAnnotations",r.GET_NOTIFICATIONS="getNotifications",r})(Nd||{}),tV;tV||(tV={});var Od=(function(r){return r.SET_DOCUMENTS="setDocuments",r.GET_REACTION_ANNOTATIONS="getReactionAnnotations",r})(Od||{}),It=(function(r){return r.RESOLVE_RECORDER_ANNOTATIONS="resolveRecorderAnnotations",r.SAVE_RECORDER_ANNOTATION="saveRecorderAnnotation",r.DELETE_RECORDER_ANNOTATION="deleteRecorderAnnotation",r.FORMAT_RESPONSE="formatResponse",r.INIT_DOCUMENTS="initDocuments",r.SET_DATA="setData",r.UPDATE_DATA="updateData",r.DELETE_DATA="deleteData",r})(It||{}),bd=(function(r){return r.GET_RECORDER_ANNOTATIONS="getRecorderAnnotations",r})(bd||{}),Mn=(function(r){return r.RESOLVE_NOTIFICATIONS="resolveNotifications",r.DELETE_NOTIFICATION="deleteNotification",r.DELETE_DATA="deleteData",r.FORMAT_RESPONSE="formatResponse",r})(Mn||{}),kC=(function(r){return r.GET_NOTIFICATIONS="getNotifications",r})(kC||{}),cr=(function(r){return r.RESOLVE_ACTIVITIES="resolveActivities",r.SAVE_ACTIVITY="saveActivity",r.FORMAT_RESPONSE="formatResponse",r})(cr||{}),UC=(function(r){return r.GET_ACTIVITIES="getActivities",r})(UC||{}),Pn=(function(r){return r.SET_DOCUMENTS="setDocuments",r.SET_ROOT_DOCUMENT="setRootDocument",r.SET_DOCUMENT_ID="setDocumentId",r.UNSET_DOCUMENT_ID="unsetDocumentId",r.UNSET_DOCUMENTS="unsetDocuments",r.SET_LOCATION="setLocation",r.SET_LOCATIONS="setLocations",r.SET_ROOT_LOCATION="setRootLocation",r.ADD_LOCATION="addLocation",r.REMOVE_LOCATION="removeLocation",r.REMOVE_LOCATIONS="removeLocations",r.UNSET_LOCATION_IDS="unsetLocationIds",r.REMOVE_LOCATIONS_SUCCESS="removeLocationsSuccess",r})(Pn||{});var nV=class{constructor(){this.pageInfo=new Nt}};var rV=class{constructor(){this.documentAccessType=Mt.PUBLIC,this.accessType=Mt.PUBLIC,this.disabled=!1,this.features={},this.users={}}};var QT=class{};var XT=class{};var iV=class{};var As=class{constructor(){this.contacts=[]}};var iCe={DOCUMENT_UNSET:"document_unset",USER_LOGOUT:"user_logout"},Qn={SET_DOCUMENTS:"setDocuments",IDENTIFY:"identify",GET_NOTIFICATIONS:"getNotifications",SET_NOTIFICATIONS:"setNotifications",REVOKE_ACCESS_ON_USER_LOGOUT:"revokeAccessOnUserLogout",REVOKE_ACCESS_ON_DOCUMENT_UNSET:"revokeAccessOnDocumentUnset"},Ui={FOLDER:"folder",DOCUMENT:"document",ORGANIZATION:"organization",CONTEXT:"context"};var oV=class{constructor(){this.id=Math.floor(1e5+Math.random()*9e5)}};var sV=class{constructor(){this.singleTabEditor=!0}};var aV=class{constructor(){this.state="idle"}};var ul=class{};var JT=class{};var cV=class{constructor(){this.type="multiThread"}};var lV=class{constructor(){this.pageInfo=new Nt}};var uV=class{constructor(){this.type="audio"}},dV=class{constructor(){this.type="audio"}},hV=class{constructor(){this.getThumbnailTag=e=>`
120
- <a href="${this.videoPlayerUrl}" target="_blank">
121
- <img src="${e||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
122
- </a>
123
- `}};var fV=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new Nt}};var gV=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new Nt}};var bg=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var mV=class{constructor(){this.pageInfo=new Nt}},BCe={Start:"start",End:"end"},GCe={Avatar:"avatar",Label:"label"};var pV=class{constructor(){this.sources=[],this.playerState=new VC}},VC=class{constructor(){this.volume=1}};var EV=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new Nt}};var _V=class{constructor(){this.visibility="private"}};var IV=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new Nt,this.isReactionResolverUsed=!1}};var ZT=class{};var INe={EDITOR:"editor",VIEWER:"viewer"},Rs={DOES_NOT_EXIST:"does_not_exist",PERMISSION_DENIED:"permission_denied",SOMETHING_WENT_WRONG:"something_went_wrong"};var dQ=(function(r){return r.INTERNAL="internal",r.EXTERNAL="external",r})(dQ||{}),hQ=(function(r){return r.UPDATE_DATA="updateData",r})(hQ||{});var xn=class r{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,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static _hex(e){let n=r.hexChars,t=r.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]=n.charAt(i&15),i>>>=4,t[o+0+s]=n.charAt(i&15),i>>>=4;return t.join("")}static _md5cycle(e,n){let t=e[0],i=e[1],o=e[2],s=e[3];t+=(i&o|~i&s)+n[0]-680876936|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+n[4]-176418897|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+n[8]+1770035416|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,t+=(i&o|~i&s)+n[12]+1804603682|0,t=(t<<7|t>>>25)+i|0,s+=(t&i|~t&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+t|0,o+=(s&t|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&t)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,t+=(i&s|o&~s)+n[1]-165796510|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+n[5]-701558691|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+n[9]+568446438|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,t+=(i&s|o&~s)+n[13]-1444681467|0,t=(t<<5|t>>>27)+i|0,s+=(t&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+t|0,o+=(s&i|t&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&t|s&~t)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,t+=(i^o^s)+n[5]-378558|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+n[1]-1530992060|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+n[13]+681279174|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,t+=(i^o^s)+n[9]-640364487|0,t=(t<<4|t>>>28)+i|0,s+=(t^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+t|0,o+=(s^t^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^t)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,t+=(o^(i|~s))+n[0]-198630844|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+n[12]+1700485571|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+n[8]+1873313359|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,t+=(o^(i|~s))+n[4]-145523070|0,t=(t<<6|t>>>26)+i|0,s+=(i^(t|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+t|0,o+=(t^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~t))+n[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(r.stateIdentity),this}appendStr(e){let n=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)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[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");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,r._md5cycle(this._state,t),i-=64,t[0]=t[16])}return this._bufferLength=i,this}appendAsciiStr(e){let n=this._buffer8,t=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,r._md5cycle(this._state,t),i=0}return this._bufferLength=i,this}appendByteArray(e){let n=this._buffer8,t=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,r._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 n=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<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){let n=this._bufferLength,t=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;let s=this._dataLength*8;if(t[n]=128,t[n+1]=t[n+2]=t[n+3]=0,i.set(r.buffer32Identity.subarray(o),o),n>55&&(r._md5cycle(this._state,i),i.set(r.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 r._md5cycle(this._state,i),e?this._state:r._hex(this._state)}};xn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);xn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);xn.hexChars="0123456789abcdef";xn.hexOut=[];xn.onePassHasher=new xn;if(xn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var vV=["annotationId","annotationNumber","visibilityConfig","actions","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 yV=["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","actions","progress"];var SV=["annotationId","context","commentAnnotationId","reactions","lastUpdated","targetElement","targetElementId","position","locationId","location","type","annotationIndex","pageInfo","from","isReactionResolverUsed","iconUrl","iconEmoji","metadata","involvedUserIds"];var AV=["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 Abe=["id","featureType","actionType","eventType","actionUser","timestamp","metadata","targetEntityId","targetSubEntityId","changes","entityData","entityTargetData","displayMessageTemplate","displayMessageTemplateData","displayMessage","actionIcon","immutable","isActivityResolverUsed"];var RV=["userId"];var DV=["commonAncestorContainer","commonAncestorContainerFXpath","commonAncestorContainerCFXpath","commonAncestorContainerAnchor","occurrence"],CV=["attachmentId","isAttachmentResolverUsed","name","bucketPath","size","type","url","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages"],NV=["attachmentId","isAttachmentResolverUsed","bucketPath","size","type","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages"];var OV=["id","tag","type","thumbnailUrl","thumbnailWithPlayIconUrl","videoUrl","audioUrl","videoPlayerUrl","chunkUrls"];var Lg="velt://self-hosted-disabled/",FV=r=>typeof r=="string"&&r.startsWith(Lg),kV=(r,e)=>{try{if(FV(r))return r;let n=new URL(r),t=n.hostname.split("."),i=t.length>=3?t[0]:"",o=r.replace(n.host,e);if(i){let s=o.includes("?")?"&":"?";o+=`${s}ns=${i}`}return o}catch(n){return j.catch("Error in getProxiedDatabaseUrl: ",n),r}},xbe=r=>{try{let e=localStorage.getItem(v.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);if(!e)return;let n=atob(e),t=r?.config;n&&t&&(t.apiHost=n,t.tokenApiHost=n)}catch(e){j.catch("Error in applyCachedAuthProxyHost: ",e)}},Tr=(r,e=0)=>{try{let n=3735928559^e,t=1103547991^e;for(let i=0,o;i<r.length;i++)o=r.charCodeAt(i),n=Math.imul(n^o,2654435761),t=Math.imul(t^o,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&t)+(n>>>0)}catch(n){return j.catch("Error in cyrb53: ",n),0}},fQ=()=>{try{return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+r/4).toString(16))}catch(r){return j.catch("Error in uuidv4: ",r),""}},fi=r=>{try{return xn.hashStr(r)}catch(e){return j.catch("Error in hashStr: ",e),r}},UV=r=>{try{return!r||r.trim().length===0?void 0:xn.hashStr(r)}catch(e){j.catch("Error in hashForAnchor: ",e);return}},_a=r=>Tr(r).toString(),$C=r=>fi(r),Ds=r=>fi(r).toString(),bo=r=>fi(r).toString(),Fbe=(r,e)=>{try{let n=r.userIds?.length?[...r.userIds]:[];return n.includes(e)||n.push(e),le(M({},r),{userIds:n})}catch(n){return j.catch("Error in ensureUserIdInVisibility: ",n),r}},kbe=r=>{try{if(!r)return!1;if(r.iam?.accessMode===xT.PRIVATE)return!0;let e=r.visibilityConfig?.type;return e==="restricted"||e==="organizationPrivate"}catch(e){return j.catch("Error in isAnnotationPrivate: ",e),!1}},Ube=(r,e)=>{let n=[];switch(r.type){case"public":return n.push(v.DEFAULT_VELT_CONTEXT),n;case"organizationPrivate":{let t=[...r.organizationId?[r.organizationId]:[],...r.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=Ds(i);n.push(`${v.VISIBILITY_ORG_PREFIX}${o}`)});break}case"restricted":{if(!r.userIds?.length)throw new Error("userIds is required for restricted visibility type");r.userIds.filter((i,o,s)=>!!i&&s.indexOf(i)===o).forEach(i=>{let o=fi(i).toString();n.push(`${v.VISIBILITY_SELF_PREFIX}${o}`)});break}default:throw new Error(`Invalid visibility type: ${r.type}`)}if(e){let t=`${v.VISIBILITY_SELF_PREFIX}${fi(e).toString()}`;n.includes(t)||n.push(t)}return n},Vbe=(r,e)=>{let n={type:r.type};try{if(r.type==="public")return n;r.organizationId&&(n.organizationId=r.organizationId),r.organizationIds?.length&&(n.organizationIds=r.organizationIds);let t=[...r.userIds??[],...e?[e]:[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);t.length&&(n.userIds=t)}catch(t){j.catch("Error in buildStoredVisibilityConfig: ",t)}return n},Bbe=r=>{let e=[v.DEFAULT_VELT_CONTEXT];try{r?.userId&&e.push(`${v.VISIBILITY_SELF_PREFIX}${fi(r.userId).toString()}`),r?.clientOrganizationId?e.push(`${v.VISIBILITY_ORG_PREFIX}${Ds(r.clientOrganizationId)}`):r?.fallbackServerOrganizationId&&e.push(`${v.VISIBILITY_ORG_PREFIX}${r.fallbackServerOrganizationId}`)}catch(n){j.catch("Error in buildViewerVisibilityTokens: ",n)}return e},Gbe=(r,e)=>{try{if(!r?.length)return r??[];let n=new Set(e?.tokens??[]);return r.filter(t=>{try{let i=t?.context?.accessFields,o=BV(i),s=t?.visibilityConfig?.type,a=s==="organizationPrivate"||s==="restricted",c=o.length>0&&!i?.includes(v.DEFAULT_VELT_CONTEXT);return!!(!a&&!c||!i?.length||e?.userId&&t?.from?.userId===e.userId||o.some(l=>n.has(l))||e?.userId&&t?.visibilityConfig?.userIds?.includes(e.userId))}catch(i){return j.catch("Error filtering annotation visibility: ",i),!0}})}catch(n){return j.catch("Error in filterAnnotationsVisibleToUser: ",n),r}},VV=r=>{try{return typeof r=="string"&&(r.startsWith(v.VISIBILITY_SELF_PREFIX)||r.startsWith(v.VISIBILITY_ORG_PREFIX))}catch(e){return j.catch("Error in isVisibilityAccessToken: ",e),!1}},BV=r=>{try{return(r||[]).filter(e=>VV(e))}catch(e){return j.catch("Error in extractVisibilityAccessTokens: ",e),[]}},$be=r=>{try{return!!r&&typeof r=="object"&&Object.keys(r).some(e=>!(e==="default"&&r[e]==="velt"))}catch(e){return j.catch("Error in isCustomerContextAccess: ",e),!1}},jbe=(r,e)=>{try{let n=Array.isArray(e)?e:[],t=n.length>0&&!n.includes(v.DEFAULT_VELT_CONTEXT),i=r;if(t&&r?.access&&typeof r.access=="object"&&r.access.default==="velt"){let s=M({},r.access);delete s.default,i=le(M({},r),{access:s})}let o=bQ(i);return t&&(o=o.filter(s=>s!==v.DEFAULT_VELT_CONTEXT)),t?[...new Set([...n,...o])]:o}catch(n){return j.catch("Error in mergeAccessFieldTokenFamilies: ",n),Array.isArray(e)?e:[]}},jC=r=>{try{if(!r)return null;let e=r?.context?.accessFields??[];if(!e?.length)return null;let n=BV(e),t=r?.visibilityConfig?.type,i=t==="restricted"||t==="organizationPrivate",o=n.length>0&&!e.includes(v.DEFAULT_VELT_CONTEXT);if(!i&&!o)return null;let s=n.some(d=>d.startsWith(v.VISIBILITY_ORG_PREFIX)),c={type:i?t:s?"organizationPrivate":"restricted",accessTokens:n},l=r?.visibilityConfig?.userIds;l?.length&&(c.userIds=[...l]);let u=[...r?.visibilityConfig?.organizationId?[r.visibilityConfig.organizationId]:[],...r?.visibilityConfig?.organizationIds??[]].filter((d,f,g)=>!!d&&g.indexOf(d)===f);return u.length&&(c.organizationIds=u),c}catch(e){j.catch("Error in buildNotificationVisibilityStamp: ",e);try{let n=r?.visibilityConfig?.type;if(n==="restricted"||n==="organizationPrivate")return{type:n,accessTokens:[]}}catch{}return null}},GV=(r,e)=>{try{if(!e?.length)return[];let n=jC(r);if(!n||n.type!=="restricted")return[];let t=new Set([...n.userIds??[],...r?.from?.userId?[r.from.userId]:[]]),i=new Set(n.accessTokens??[]);return e.filter(o=>!o||t.has(o)?!1:!i.has(`${v.VISIBILITY_SELF_PREFIX}${fi(o).toString()}`))}catch(n){return j.catch("Error in getVisibilityDeniedUserIds: ",n),[]}},Hbe=(r,e)=>{try{if(!r?.length)return r??[];let n=new Set([v.DEFAULT_VELT_CONTEXT,...e||[]]);return r.filter(t=>{try{let i=t?.context?.accessFields;if(!i?.length)return!0;let o=i.filter(s=>!VV(s));return o.length?o.some(s=>n.has(s)):!0}catch(i){return j.catch("Error filtering annotation doc-context match: ",i),!0}})}catch(n){return j.catch("Error in filterAnnotationsMatchingDocContext: ",n),r}},Wbe=r=>{try{if(r)return typeof r=="string"?xn.hashStr(r):Array.isArray(r)?xn.hashStr(r.join("-")):"";{let e=fQ();return xn.hashStr(e)}}catch(e){return j.catch("Error in getMultiThreadAnnotationId: ",e),""}},$V=(r,e,n)=>{try{if(r&&e){if(r.featureAllowList&&r.featureAllowList.length&&!r.featureAllowList.includes(n)||r.userIdAllowList&&r.userIdAllowList.length&&!r.userIdAllowList.includes(e.userId)||r.userGroupIdAllowList&&r.userGroupIdAllowList.length&&!r.userGroupIdAllowList.includes(e.groupId||"")||r.userPlanAllowList&&r.userPlanAllowList.length&&!r.userPlanAllowList.includes(e.plan||""))return!1;if(r.urlAllowList){let t=window.location.href;if(r.urlAllowList.length&&!r.urlAllowList.filter(i=>t.includes(i)).length)return!1}return!0}return!1}catch(t){return j.catch("Error in isFeatureAllowed: ",t),!1}},Z=()=>{try{let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let n=0;n<20;n++)e+=r.charAt(Math.floor(Math.random()*r.length));return e}catch(r){return j.catch("Error in utils generateId: ",r),""}},zbe=r=>{try{let e=0;if(r){let n=new Date().getTime();e=Math.abs(n-r)}return e}catch(e){return j.catch("Error in utils getFirebaseTimeDiffInMins: ",e),0}};var jV=()=>{try{return dn.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(r){return j.catch("Error in showLogs: ",r),!1}},HV=()=>{try{return!!sessionStorage.getItem("debugContextMode")}catch(r){return j.catch("Error in showContextLogs: ",r),!1}},Ld=r=>{try{return typeof r!="object"?Object.assign({},...Object.keys(r).sort().map(e=>({[e]:r[e]&&typeof r[e]=="object"?Ld(r[e]):r[e]}))):r}catch(e){return j.catch("Error in sortObjectByKeys: ",e),r}},BC=r=>{try{return r!==null&&typeof r=="object"&&!Array.isArray(r)}catch{return!1}},bV=r=>{try{return BC(r)?Object.fromEntries(Object.entries(r).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,BC(n)?bV(n):Array.isArray(n)?n.map(t=>BC(t)?bV(t):t):n])):r}catch{return r}},wV=(r,e)=>{try{return typeof e!="object"||e===null?r===e:typeof r!="object"||r===null?!1:Array.isArray(e)?Array.isArray(r)?e.every(n=>r.some(t=>wV(t,n))):!1:Object.keys(e).every(n=>Object.prototype.hasOwnProperty.call(r,n)?wV(r[n],e[n]):!1)}catch{return!1}},gQ=(r,e,n)=>I(null,null,function*(){try{let t=yield EQ(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new TextEncoder().encode(r),s=yield window.crypto.subtle.encrypt({name:"AES-CBC",iv:i},t,o);return btoa(String.fromCharCode(...new Uint8Array(s)))}catch(t){return j.catch("Error in encrypt: ",t),r}}),mQ=(r,e,n)=>I(null,null,function*(){try{let t=yield pQ(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new Uint8Array(atob(r).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 j.catch("Error in decrypt: ",t),r}}),pQ=r=>I(null,null,function*(){try{let e=new TextEncoder().encode(r),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["decrypt"])}catch(e){throw j.catch("Error in importDecryptKey:",e),e}}),hl=(r,e)=>I(null,null,function*(){try{let n="Velt"+e;return yield gQ(JSON.stringify(r),n,fi(n))}catch(n){return j.catch("Error in encryptData: ",n),r}}),HC=(r,e)=>I(null,null,function*(){try{let n="Velt"+e,t=yield mQ(r,n,fi(n));return JSON.parse(t)}catch(n){return j.catch("Error in decryptData: ",n),null}}),iI=r=>{try{switch(r?.region){case"asiaSouthEast1":return"asiaSouthEast1";case"asiaNorthEast1":return"asiaNorthEast1";case"europeWest1":return"europeWest1";case"australiaSouthEast1":return"australiaSouthEast1";default:return"usCentral1"}}catch(e){return j.catch("Error in getRegion: ",e),"usCentral1"}},EQ=r=>I(null,null,function*(){try{let e=new TextEncoder().encode(r),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["encrypt"])}catch(e){throw j.catch("Error in importKey:",e),e}}),qbe=r=>{try{if(r&&typeof r=="object"){let e=Ld(r);return Tr(JSON.stringify(e))}else return null}catch(e){return j.catch("Error in utils generateLocationId: ",e),null}},wo=(r,e=[])=>(r?.tagName?.toLowerCase().indexOf("velt-")>=0&&![v.TAGS.VELT_VIDEO_PLAYER.toLowerCase()].includes(r?.tagName?.toLowerCase())||r?.tagName?.toLowerCase().indexOf("snippyly-")>=0||r?.className?.split&&(r?.className?.split(" ")?.indexOf("snippyly-overlay-panel")>=0||r?.className?.split(" ")?.indexOf("cdk-overlay-container")>=0))&&!e?.includes(r?.tagName?.toLowerCase())?!0:r?.parentNode&&wo(r?.parentNode,e),Kbe=(r,e=[])=>{try{let n=typeof r.composedPath=="function"?r.composedPath():[],t=n.length>0?n:[r?.target];for(let i of t){let o=i;if(!(!o||typeof o.tagName!="string")&&wo(o,e))return!0}}catch(n){j.catch("Error in utils isSnippylyEventTarget: ",n)}return!1},Mg=r=>{try{return!!document?.body?.contains(r)}catch(e){return j.catch("Error in utils isElementInsideBody: ",e),!1}};var gi=(r,e)=>{try{return Object.prototype.toString.call(r)===Object.prototype.toString.call(e)?Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]"?Object.keys(r).length!==Object.keys(e).length?!1:Object.keys(r).every(n=>gi(r[n],e[n])):r===e:!1}catch(n){return j.catch("Error in utils deepCompare: ",n),!1}},Ybe=(r,e,n=1)=>{try{if(e){let t=LV(e.textContent,r,n);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=LV(g,r,n);if(p<0)return[];c=p}let l=[],u=r.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-_+r.length});break}let T=u;l.forEach(D=>{T-=D.textNode.textContent?.length-(D.startOffset||0)}),l.push({textNode:p,endOffset:T});break}}return l}}return[]}catch(t){return j.catch("Error in utils calculateNodes: ",t),[]}},LV=(r,e,n=1)=>{try{if(r?.includes(e)){let t=r.split(e,n);return t.length===n?t.join(e).length:-1}else return-1}catch(t){return j.catch("Error in utils getTextPosition: ",t),-1}},WC=(r,e,n,t,i)=>{try{let o=new Range;o.setStart(r,e),o.setEnd(n,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(r.nodeType===Node.TEXT_NODE){let d=r,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(dl(i),"g");u=(f.match(g)||[]).length}}if(l){let d=new RegExp(dl(i),"g");return(l.match(d)||[]).length+u}else return u}catch(o){return j.catch("Error in utils getSelectedTextOccurrenceInRange: ",o),0}},dl=r=>{try{return r&&typeof r=="string"?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):r}catch(e){return j.catch("Error in utils escapeRegExp: ",e),r}},_Q=r=>{try{return r==null?null:r.scrollHeight>r.clientHeight?r:_Q(r?.parentNode)}catch(e){return j.catch("Error in utils getScrollableParent: ",e),null}},tI=r=>{try{return r==null?[]:r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth?[r,...tI(r?.parentNode)]:tI(r?.parentNode)}catch(e){return j.catch("Error in utils getScrollableParents: ",e),[]}};function Qbe(r){try{if(!r)return[];let e=tI(r),n=r;for(;n;){let t=n.getRootNode();if(t instanceof ShadowRoot)e.push(...tI(t.host)),n=t.host;else break}return e}catch(e){return j.catch("Error in utils getScrollableParentsCrossingShadowBoundary: ",e),[]}}var Xbe=(r,e)=>{try{if(r&&e){let n=r.getBoundingClientRect(),t=e.getBoundingClientRect(),i=n.top-t.top+(e.tagName?.toLowerCase()==="html"?0:e.scrollTop),o=n.left-t.left;return{top:i,left:o}}else return null}catch(n){return j.catch("Error in utils getRelativeTopLeftPosition: ",n),null}},WV=(r,e)=>`${Tr(r+"_"+e)}`,Pg=r=>{try{let e=zT(r),n=new Nt(!1);return e&&Object.assign(n,e),n.url=e?.url??window.location.href,n.path=e?.path??window.location.pathname,n.queryParams=e?.queryParams??window.location.search,n.baseUrl=e?.baseUrl??window.location.origin,n.title=e?.title??document.title,n}catch(e){j.catch("Error in utils getPageInfo: ",e);return}},TQ=r=>{try{return r?r?.hasAttribute&&r?.hasAttribute(v.ATTRIBUTES.VELT_COMMENT_DISABLED)?!0:TQ(r?.parentElement):!1}catch(e){return j.catch("Error in utils isCommentDisabledOnElement: ",e),!1}},IQ=r=>{try{return r?r?.hasAttribute&&r?.hasAttribute(v.ATTRIBUTES.VELT_TAG_DISABLED)?!0:IQ(r?.parentElement):!1}catch(e){return j.catch("Error in utils isTagDisabledOnElement: ",e),!1}},vQ=r=>{try{return r?r?.hasAttribute&&r?.hasAttribute(v.ATTRIBUTES.VELT_ARROW_DISABLED)?!0:vQ(r?.parentElement):!1}catch(e){return j.catch("Error in utils isArrowDisabledOnElement: ",e),!1}},yQ=r=>{try{return r?r?.hasAttribute&&r?.hasAttribute(v.ATTRIBUTES.VELT_AREA_DISABLED)?!0:yQ(r?.parentElement):!1}catch(e){return j.catch("Error in utils isAreaDisabledOnElement: ",e),!1}},SQ=r=>{try{return r?r?.hasAttribute&&r?.hasAttribute(v.ATTRIBUTES.VELT_RECORDER_DISABLED)?!0:SQ(r?.parentElement):!1}catch(e){return j.catch("Error in utils isRecorderDisabledOnElement: ",e),!1}};var Gr=()=>{try{return window?.Snippyly?.version}catch(r){return j.catch("Error in utils getSdkVersion: ",r),null}},oI=r=>{try{return Object.fromEntries(Object.entries(r).filter(([e,n])=>n!==void 0))}catch(e){return j.catch("Error in utils removeUndefinedKeys: ",e),r}},sI=r=>{try{let e=new URL(r);return Object.values(v.URL_PARAMS).forEach(n=>{e.searchParams.delete(n)}),e.href}catch(e){return j.catch("Error in utils excludeSnippylyParamsFromUrl: ",e),r}},Jbe=r=>{try{navigator.clipboard.writeText(r)}catch(e){j.catch("Error in copyToClipboard: ",e)}},GC=r=>{try{let e=zV(r);return e&&typeof e=="string"&&e.includes("/svg")&&(e=e.split("/svg")[0]+"/*[name()='svg']"),e}catch(e){j.catch("Error in utils getXPath:",e)}},zV=r=>{try{if(r){if(typeof r=="string")return document.evaluate(r,document,null,0,null);if(!r||r.nodeType!=1)return"";if(r.id&&r?.tagName?.toLowerCase()!=="svg"&&document.querySelectorAll(`[id='${r.id}']`)?.length===1)return"//*[@id='"+r.id+"']";let e=[].filter.call(r.parentNode?.children?r.parentNode?.children:[],function(n){return n.tagName==r.tagName});return zV(r.parentNode)+"/"+r.tagName.toLowerCase()+(e.length>1?"["+([].indexOf.call(e,r)+1)+"]":"")}}catch(e){j.catch("Error in utils calculateXPath:",e)}},Zbe=r=>{try{let e=[];return r.forEach(n=>{let t={};t.commonAncestorContainer=AQ(n.commonAncestorContainer),t.text=n.toString(),t.occurrence=WC(n.commonAncestorContainer,0,n.startContainer,n.startOffset,n.toString())+1,e.push(t)}),e}catch{return[]}},AQ=r=>{try{if(r.nodeType===Node.TEXT_NODE){let e=1,n=r.previousSibling;for(;n;)n.nodeType===Node.TEXT_NODE&&e++,n=n.previousSibling;return GC(r.parentElement)}else return GC(r)}catch(e){return j.catch("Error in utils getXPathForText: ",e),GC(r)}},RQ=(r,e)=>{try{return r?r?.hasAttribute&&(e&&r.hasAttribute("contenteditable")||r?.getAttribute(v.ATTRIBUTES.VELT_LIVE_SELECTION_ENABLED)==="true")?r:RQ(r?.parentElement,e):null}catch(n){return j.catch("Error in utils getSelectionEnabledElement: ",n),null}},ewe=r=>{try{let e,n=[],t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null);for(;e=t.nextNode();)n.push(e);return n}catch(e){return j.catch("Error in utils getTextNodesInsideElement: ",e),[]}},twe=r=>{try{return r<576||r>=576&&r<767?"Mobile":r>=768&&r<992?"Tablet":r>=992&&r<1520?"Desktop":"Monitor"}catch(e){return j.catch("Error in utils getDeviceTypeFromDeviceWidth: ",e),""}},qV=r=>new Promise(e=>setTimeout(e,r)),nwe=(r,e=0)=>new Promise((n,t)=>{let i=document.createElement("video"),o=navigator.userAgent.includes("Firefox");o&&(i.preload="auto"),i.setAttribute("src",URL.createObjectURL(r)),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(),n(l)},"image/jpeg",.75)})};if(o&&i.duration>0&&i.duration<10&&r.size>1e6){setTimeout(()=>{i.duration<e&&(e=Math.max(.1,i.duration/2)),s()},1e3);return}s()})}),rwe=r=>{try{return new Promise((e,n)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.readAsDataURL(r)})}catch(e){return j.catch("Error in utils blobToBase64: ",e),Promise.resolve("")}},iwe=(r,e="image/jpeg")=>{try{let n=atob(r.split(",")[1]),t=new ArrayBuffer(n.length),i=new Uint8Array(t);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return new Blob([t],{type:e})}catch(n){return j.catch("Error in utils base64ToBlob: ",n),null}},owe=(r,e,n=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,D=l/2;if(f.setAttribute("cx",T.toString()),f.setAttribute("cy",D.toString()),f.setAttribute("r",_.toString()),f.setAttribute("fill","lightgrey"),g.setAttribute("points",`${T-p/2},${D-p} ${T-p/2},${D+p} ${T+p},${D}`),g.setAttribute("fill","#ffffff"),d.appendChild(f),d.appendChild(g),e){let A=e.length*16-10,R=16*1.5,N=(c-A)/2,b=l-R-10,x=document.createElementNS(u,"rect");x.setAttribute("x",N.toString()),x.setAttribute("y",b.toString()),x.setAttribute("width",A.toString()),x.setAttribute("height",R.toString()),x.setAttribute("fill","#353945b3"),x.setAttribute("rx","12"),d.appendChild(x);let k=document.createElementNS(u,"text");k.textContent=e,k.setAttribute("x",(c/2).toString()),k.setAttribute("y",(b+16).toString()),k.setAttribute("font-size","16"),k.setAttribute("text-anchor","middle"),k.setAttribute("fill","white"),d.appendChild(k)}let L=new XMLSerializer().serializeToString(d),B=new Image,w=new Blob([L],{type:"image/svg+xml;charset=utf-8"}),F=URL.createObjectURL(w);B.onload=()=>{let U=document.createElement("canvas");U.width=c,U.height=l;let A=U.getContext("2d");A.beginPath(),A.moveTo(n,0),A.lineTo(c-n,0),A.quadraticCurveTo(c,0,c,n),A.lineTo(c,l-n),A.quadraticCurveTo(c,l,c-n,l),A.lineTo(n,l),A.quadraticCurveTo(0,l,0,l-n),A.lineTo(0,n),A.quadraticCurveTo(0,0,n,0),A.closePath(),A.clip(),A.drawImage(o,0,0,c,l),A.drawImage(B,0,0,c,l);let R=U.toDataURL("image/png");t(R)},B.onerror=i,B.src=F},o.onerror=i,o.src=r});var swe=r=>{try{return r?.replace(/[\n\t\u200D]/g,"")?.split(/\s+/)?.filter(t=>t?.trim()?.length)||[]}catch(e){return j.catch("Error in utils getWords: ",e),[]}},awe=(r,e=[])=>{try{let n=e.map(t=>`[${t}="${r}"]`).join(",");return document.querySelector(n)}catch(n){return j.catch("Error in utils getElementByAttributes: ",n),null}},cwe=(r,e=[])=>{try{let n=e.map(t=>`[${t}="${r}"]`).join(",");return document.querySelectorAll(n)}catch(n){return j.catch("Error in utils getElementsByAttributes: ",n),[]}},eI=r=>{try{let e=Math.floor(r/3600),n=Math.floor((r-e*3600)/60),t=Math.floor(r-e*3600-n*60);return e&&e<10&&(e="0"+e),n<10&&(n="0"+n),t<10&&(t="0"+t),(e?e+":":"")+n+":"+t}catch{return""}},DQ=10,lwe=r=>{try{if(typeof r!="number"||!isFinite(r))return 0;let e=1e3/DQ;return Math.round(r*e)/e}catch{return r}},uwe=r=>{try{if(!r||typeof r!="object")return;let e={videoPlayerId:r.videoPlayerId,currentMediaPosition:r.currentMediaPosition,locationName:r.locationName};return r.version?.id&&r.version?.name&&(e.version={id:r.version.id,name:r.version.name}),e}catch{return}},dwe=(r,e=10)=>{try{if(!r||!r.currentTime)throw new Error("Invalid video element reference provided");let n=r.currentTime,t=Math.floor(n/e)*e,i=t+e;return{startSlot:eI(t),endSlot:eI(i),timeSlot:eI(t)+" - "+eI(i)}}catch{return null}},hwe=(r,e=["@"])=>{try{let n="",t,i=r.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?n=CQ(c,a,e):n=""}return n}catch(n){return j.catch("Error in utils getWordAtCursor: ",n),""}};var CQ=(r,e,n=["@"])=>{try{let t=-1,i=!1;for(let o of n){let s=r.lastIndexOf(o,e),a=s>0?r.lastIndexOf(o,s-1):-1;if(s>t){let c=nI(r,s,e),l=rI(r,s,e);if(c||l){if(a!==-1){let u=nI(r,a,s),d=rI(r,a,s);!u&&!d&&(t=a,i=!0)}}else t=s,i=!0}}return t!==-1&&i?r.substring(t,e):""}catch(t){return j.catch("Error in utils getStringFromLastAtSymbol: ",t),""}},nI=(r,e,n)=>{try{if(e===0)return!1;let t=r.charAt(e-1);return!(t===" "||t==="\xA0"||t===`
124
- `||t===" "||[",",":",";"].includes(t))}catch(t){return j.catch("Error in utils isHotkeyDisabledForAutocomplete: ",t),!1}},rI=(r,e,n)=>{try{return!!r.substring(e+1,n).startsWith(" ")}catch(t){return j.catch("Error in utils isHotkeyFollowedBySpace: ",t),!1}},fwe=(r,e,n=["@"])=>{try{let t=NQ(r),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 n){let u=a.lastIndexOf(l,s),d=u>0?a.lastIndexOf(l,u-1):-1;if(u>c){let f=nI(a,u,s),g=rI(a,u,s);if(f||g){if(d!==-1){let p=nI(a,d,u),_=rI(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),D=document.createTextNode(u);_.replaceChild(D,p),_.insertBefore(d,D),_.insertBefore(T,d);try{let L=document.createRange();L.setStartAfter(d),L.collapse(!0),i?.removeAllRanges(),i?.addRange(L)}catch(L){j.catch("Error positioning cursor after span:",L);try{let B=document.createRange();B.selectNodeContents(r),B.collapse(!1),i?.removeAllRanges(),i?.addRange(B)}catch(B){j.catch("Error with fallback cursor positioning:",B)}}}}}}}}catch(t){j.catch("Error in utils replaceWordAtCursor: ",t)}},gwe=()=>{try{let e=window.getSelection()?.getRangeAt(0),n=e?.commonAncestorContainer,t=e?.startContainer,i=e?.endContainer,o=[];o.push(n),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(r){return j.catch("Error in utils isTextSelectionIncludesSnippylyElement: ",r),!1}},KV=(r,e,n)=>{try{let t=document.querySelector(`[id=${r}]`);if(t)t.name=e,t.content=n;else{let i=document.createElement("meta");i.id=r,i.name=e,i.content=n,document.getElementsByTagName("head")[0].appendChild(i)}}catch{}},YV=r=>{try{if(r){let e=document.querySelector(`[id=${r}]`);e&&e.remove()}}catch{}},QV=()=>{try{let e=new Date().getTimezoneOffset(),n=Math.floor(Math.abs(e)/60),t=Math.abs(e)%60;return`UTC${e>0?"-":"+"}${n?.toString()?.padStart(2,"0")}:${t?.toString()?.padStart(2,"0")}`}catch(r){return j.catch("Error in utils getTimezone: ",r),""}},mwe=()=>{try{let r=[];return document.querySelectorAll("*").forEach(n=>{(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth||["auto","scroll"].includes(getComputedStyle(n).overflow))&&r.push(n)}),r}catch(r){return j.catch("Error in utils getScrollableElements: ",r),[]}},XV=(r,e)=>Math.sqrt((r.x-e.x)**2+(r.y-e.y)**2),pwe=(r,e={x:window.innerWidth/2,y:window.innerHeight/2})=>{try{let n=r;for(;n.children.length>0;){let t=null,i=Number.MAX_SAFE_INTEGER;for(let o=0;o<n.children.length;o++){let s=n.children[o],a=s.getBoundingClientRect(),c={x:a.left+a.width/2,y:a.top+a.height/2},l=XV(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;n=t}return n}catch(n){return j.catch("Error in utils getInnermostElement: ",n),null}},Ewe=r=>{try{let{offsetWidth:e,offsetHeight:n,scrollTop:t}=r,i=r,o={x:e/2,y:t+n/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=XV(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 j.catch("Error in utils getNestedInnermostElement: ",e),null}},_we=()=>{try{let r=window.innerWidth/2,e=window.innerHeight/2,n=document.elementFromPoint(r,e);for(;n&&n.tagName==="BODY";)e+=2,n=document.elementFromPoint(r,e);return n}catch(r){return j.catch("Error in utils getCenteredBackgroundElement: ",r),null}},Twe=(r,e,n=!1)=>{try{let t=r.getBoundingClientRect(),i=e.getBoundingClientRect(),o=e.offsetTop;n&&(o=o-t.height/2+i.height/2),r.scrollTo({top:o,behavior:"smooth"})}catch(t){j.catch("Error in utils nestedScrollIntoView: ",t)}},Iwe=(r,e=!0)=>{try{let n=document.body.getBoundingClientRect(),t=r.getBoundingClientRect(),i=t.top-n.top,o=window.innerHeight,s=i;e&&(s=s-o/2+t.height/2),window.scrollTo({top:s,behavior:"smooth"})}catch(n){j.catch("Error in utils scrollIntoView: ",n)}},vwe=(r=!1)=>{try{let e=!0;return r&&(e=/\sChrome\/[\d.]+ Mobile\s/.test(navigator.userAgent)),"ontouchstart"in window||navigator.maxTouchPoints>0||e}catch(e){return j.catch("Error in utils isTouchDevice: ",e),!1}},ywe=(r,e,n)=>{try{return(1-n)*r+n*e}catch(t){j.catch("Error in utils lerp: ",t)}return 0},Swe=(r,e)=>{try{if(r===void 0)return r;if(r=r.replace("#",""),r.length===6){let n=parseInt(r,16),t=(n>>16)+e;t>255&&(t=255),t<0&&(t=0);let i=(n&255)+e;i>255&&(i=255),i<0&&(i=0);let o=(n>>8&255)+e;return o>255&&(o=255),o<0&&(o=0),`#${(i|o<<8|t<<16).toString(16)}`}else return r}catch(n){j.catch("Error in utils multiplyColor: ",n)}return r},Awe=r=>{try{return r in v.TEXT_COLOR_MAP?v.TEXT_COLOR_MAP[r]:"#141416"}catch(e){return j.catch("Error in generateUserColor:",e),"#141416"}},Rwe=()=>{try{let r=localStorage.getItem(v.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS);if(r)return JSON.parse(r)}catch(r){return j.catch("Error in getDefaultMediaStreamOptions:",r),{}}},Dwe=(r,e)=>{try{let n=e*(Math.PI/180),t=Math.cos(n);return t?r/t:r}catch(n){return j.catch("Error in calculateHypotenuse:",n),0}},Cwe=(r,e,n=!0)=>{try{let t=[],i=n?r:r.parentNode;for(;i;)t.push(i),i=i.parentNode;let o=n?e:e.parentNode;for(;o;){if(t.indexOf(o)!==-1)return o;o=o.parentNode}return null}catch(t){return j.catch("Error in utils findCommonParent: ",t),null}},Nwe=(r,e,n,t,i=!1)=>{try{let o,s;if(i){let a=n,c=t;if(a===c)o=r,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+r,s=u+e}}else{let a=n.getBoundingClientRect(),c=t.getBoundingClientRect(),l=a.left+r,u=a.top+e;o=l-c.left,s=u-c.top}return{x:o,y:s}}catch(o){return j.catch("Error in utils calculateParentCoordinates: ",o),{x:r,y:e}}},Owe=r=>{try{let e={height:0,width:0};if(typeof r?.getBBox=="function"){let n=r?.getBBox(),t=r?.getBoundingClientRect();e.height=parseFloat(t?.height||n.height||0),e.width=parseFloat(t?.width||n.width||0)}else{let n=window.getComputedStyle(r);if(e.height=r?.clientHeight||parseFloat(n.getPropertyValue("height"))||0,e.width=r?.clientWidth||parseFloat(n.getPropertyValue("width"))||0,r?.getBoundingClientRect&&typeof r?.getBoundingClientRect=="function"){let t=r?.getBoundingClientRect();e?.height||(e.height=t?.height||r?.clientHeight||r?.offsetHeight||0),e?.width||(e.width=t?.width||r?.clientWidth||r?.offsetWidth||0)}}return e}catch(e){return j.catch("Error in utils getElementDimensions: ",e),{height:0,width:0}}},bwe=r=>{try{let e=r;for(;e;){if(window?.getComputedStyle(e)?.getPropertyValue("background-clip")=="text")return!0;e=e?.parentElement}return!1}catch(e){return j.catch("Error in utils hasParentWithBackgroundClip: ",e),!1}},NQ=r=>{try{let e=r;for(;e;){if(e.toString()==="[object ShadowRoot]")return e;e=e.parentNode}}catch(e){j.catch("Error in utils findShadowRoot: ",e)}return null},wwe=r=>{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"],n=JSON.parse(JSON.stringify(r)),t={};return Object.keys(n).forEach(i=>{e.includes(i)||(t[i]=n[i])}),JSON.parse(JSON.stringify(t))}catch(e){return j.catch("Error in utils getRecorderAnnotationForClient: ",e),null}},Lwe=r=>r===null||typeof r>"u",Mwe=(r,e)=>{try{return!!r?.closest(`[${e}]`)}catch(n){return j.catch("Error in utils hasParentWithAttribute: ",n),!1}},OQ=(r,e=!0)=>{try{let n=[];if(!r||!(r instanceof HTMLElement))return[];e&&n.push(r);for(let t=0;t<r.children.length;t++){let i=r.children[t];n=n.concat(OQ(i))}return n}catch(n){return j.catch("Error in utils getAllNestedChildren: ",n),[]}},Pwe=()=>{try{return document.visibilityState==="hidden"?!1:document.hasFocus()}catch(r){return j.catch("Error in utils isTabActive: ",r),!1}},xwe=r=>{try{let e="",n=r?.getAttribute("src");if(n)e=`${Tr(n)}`;else{let t=r?.querySelectorAll("source");if(t&&t.length>0){let o=t[0]?.getAttribute("src");o&&(e=`${Tr(o)}`)}}return e}catch{return""}},Fwe=r=>{try{return!(r&&(r?.children?.length>0||r?.textContent?.trim()?.length>0))}catch(e){return j.catch("Error in utils isTemplateEmpty: ",e),!0}},MV=(r,e)=>{try{if(!r||!e)return;let n=[],t="",i=0;for(let c=0;c<e.length;c++){let l=e[c];l==="["?(i++,i===1&&t&&(n.push(t),t=""),t+=l):l==="]"?(i--,t+=l,i===0&&(n.push(t),t="")):l==="."&&i===0?t&&(n.push(t),t=""):t+=l}t&&n.push(t);let o,s=M({},r),a=n.reduce((c,l)=>{if(c==null)return;Io(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=MV(s,f);Io(g)&&(g=g());let p=g?.toString()||"";return c[p]}if(s[f]!==void 0){let g=s[f];return Io(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]},r);return o?ug(()=>{try{let c=M({},r);return n.reduce((l,u)=>{if(l==null)return;Io(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=MV(c,g);Io(p)&&(p=p());let _=p?.toString()||"";return l[_]}if(c[g]!==void 0){let p=c[g];return Io(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]},r)}catch{return""}}):a}catch{return""}},kwe=(r,e)=>{try{return!!(r?.locationId&&(r.locationId===e?.locationId||e?.location?.id===String(r.locationId))||r?.location?.id&&(r.location.id===e?.location?.id||r.location.id===String(e?.locationId)))}catch(n){return j.catch("Error in utils isLocationSame: ",n),!1}},Uwe=()=>{try{let r=document.activeElement,e=new Set,n=10,t=0;for(;r&&r.shadowRoot&&!(e.has(r)||(e.add(r),r=r.shadowRoot.activeElement,t++,t>n)););return r}catch(r){return j.catch("Error in utils getActiveElement: ",r),null}},Pt=(r,e)=>{try{return typeof r=="object"&&typeof e=="object"?JSON.stringify(r)===JSON.stringify(e):r===e}catch{return!1}},yn=(r,e=0)=>{try{let n=JSON.parse(JSON.stringify(r));return r?.clientDocumentId&&(n.documentId=r.clientDocumentId),r?.clientOrganizationId&&(n.organizationId=r.clientOrganizationId),r?.documentMetadata&&e<5&&(n.documentMetadata=yn(r.documentMetadata,e+1)),delete n?.clientDocumentId,delete n?.clientOrganizationId,delete n?.veltFolderId,delete n?.parentVeltFolderId,delete n?.pageInfo,n}catch{return r}},Vwe=r=>{try{if(!r.some(s=>s?.value?.data))return{};let e=null,n=r.reduce((s,a)=>Math.max(s,a.timestamp),0),t=r.find(s=>s.timestamp===n);if(!t)return{};t?.value?.operation?.type==="removed"&&(e=t?.value?.operation);let o=r.map(s=>s.value).reduce((s,a)=>({data:M(M({},s?.data??{}),a?.data??{})}),{});return o.operation=e,o}catch{return{}}},xt=(r,e,n)=>I(null,null,function*(){try{let t=0;for(;t<=(n.retryCount||0);)try{let i=yield r();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>(n.retryCount||0))return{success:!1,statusCode:i.statusCode,message:`${e} failed after ${t} attempts with status code ${i.statusCode}`};n.retryDelay&&(yield new Promise(o=>setTimeout(o,n.retryDelay)));continue}return i}catch(i){if(t++,t>(n.retryCount||0))return{success:!1,statusCode:500,message:`${e} failed with error: ${i instanceof Error?i.message:"Unknown error"}`};n.retryDelay&&(yield new Promise(o=>setTimeout(o,n.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"}`}}}),$t=(r,e,n,t,i)=>I(null,null,function*(){try{let o=typeof e=="function"?yield e():e||{},a=M(M({},{"Content-Type":"application/json"}),o),c=yield fetch(r,M({method:"POST",headers:a,body:JSON.stringify(n)},i?{credentials:i}:{}));if(!c.ok)return j.catch(`Error in makeConfigBasedRequest: ${c.status} ${c.statusText}`),t?{data:{},success:!1,statusCode:c.status}:{success:!1,statusCode:c.status};let l=yield c.json();return t?{data:l?.data??{},success:!0,statusCode:200}:{success:!0,statusCode:200}}catch(o){return j.catch("Error in makeConfigBasedRequest:",o),t?{data:{},success:!1,statusCode:500}:{success:!1,statusCode:500}}}),JV=r=>{try{return!r||!r?.access?[]:Object.keys(r.access).sort().map(i=>r.access?.[i]?.map(o=>`${i}:${o}`)??[]).reduce((i,o)=>i.flatMap(s=>o.map(a=>[...s,a])),[[]]).map(i=>i.join("_"))}catch(e){return j.catch("Error in utils generateProcessedContext: ",e),[]}},bQ=r=>{try{if(!r||!r?.access)return[];let e=Object.keys(r.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=r.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 j.catch("Error in utils generateAllContextCombos: ",e),[]}},ZV=({input:r})=>{try{if(!r||!r?.access)return[];let e=r?.access,n=Object.keys(e).sort(),t=[];for(let o of n){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 j.catch("Error in utils expandContextArraysToSingleValues: ",e),[]}},eB=({input:r})=>{try{if(!r||r.length===0)return{access:{}};let e=new Set;r.forEach(t=>{t?.access&&Object.keys(t.access).forEach(i=>e.add(i))});let n={};for(let t of Array.from(e).sort()){let i=new Set;r.forEach(o=>{if(o?.access){let s=o.access[t];s!=null&&i.add(s)}}),n[t]=i.size>0?Array.from(i).sort():null}return{access:n}}catch(e){return j.catch("Error in utils combineContextsToArrays: ",e),{access:{}}}},Md=i=>I(null,[i],function*({data:r,getSdkProxy:e,userId:n,methodName:t}){try{let o="sdkproxyencryptionanddecryptiononsdk"+(n??""),s=yield wQ({data:r,key:o}),a=(yield e({veltData:s}))?.data?.data?.veltData||{};return yield HC(a,o)}catch(o){return j.catch("Error in utils sdkProxyEncryptDecrypt: "+(t??""),o),r}}),wQ=n=>I(null,[n],function*({data:r,key:e}){try{return yield hl(r,e)}catch{return r}}),zC=(r,e)=>I(null,null,function*(){try{let n=0;for(;n<=(e.retryCount||0);)try{let t=yield r();if(!t)throw new Error("No response received");return t}catch{if(n++,n>=(e.retryCount||0))return null;e.retryDelay&&(yield new Promise(i=>setTimeout(i,e.retryDelay)))}return null}catch{return null}}),qC=r=>{try{if(r&&typeof r=="object"){let e=JSON.parse(JSON.stringify(r));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 j.catch("Error in utils getUserForClient: ",e),null}},Ir=({url:r,apiProxyDomain:e})=>{try{if(FV(r))return r;if(e){let n=new URL(r);n.origin&&(r=r.replace(n.origin,e))}return r}catch(n){return j.catch("Error in utils getResolvedApiUrl: ",n),r}},Bwe=(r,e)=>{try{if(!r||!(r instanceof Element))return!1;let n,t;if(e&&typeof e.x=="number"&&typeof e.y=="number")n=e.x,t=e.y;else{let o=r.getBoundingClientRect();n=o.left+o.width/2,t=o.top+o.height/2}let i=document.elementFromPoint(n,t);return!(!i||i===r||r.contains(i))}catch{return!1}};function PV(r,e){if(r==null||typeof r!="object"||Array.isArray(r))return r;let n={};for(let t of e)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t]);return n}function xV(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}function wd(r,e){switch(e.kind){case"type":return PV(r,e.safeKeys);case"array":return Array.isArray(r)?r.map(n=>wd(n,e.item)):r;case"record":{if(!xV(r))return r;let n={};for(let t of Object.keys(r))n[t]=wd(r[t],e.value);return n}case"object":{if(!xV(r))return r;let n=e.selfKeys?PV(r,e.selfKeys):M({},r);for(let t of Object.keys(e.fields))Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=wd(n[t],e.fields[t]));return n}default:return r}}var _r={kind:"type",safeKeys:RV},LQ={kind:"type",safeKeys:DV},MQ={kind:"type",safeKeys:OV},PQ={kind:"type",safeKeys:NV},wg={kind:"type",safeKeys:CV};function xQ(r){return{kind:"object",selfKeys:yV,fields:{from:_r,to:{kind:"array",item:_r},attachments:{kind:"array",item:r},recorders:{kind:"array",item:MQ},taggedUserContacts:{kind:"array",item:{kind:"object",fields:{contact:_r}}}}}}function tB(r){return{kind:"object",selfKeys:vV,fields:{from:_r,assignedTo:_r,resolvedByUser:_r,viewedBy:{kind:"array",item:_r},subscribedUsers:{kind:"record",value:{kind:"object",fields:{user:_r}}},unsubscribedUsers:{kind:"record",value:{kind:"object",fields:{user:_r}}},suggestion:{kind:"object",fields:{resolvedBy:_r}},targetTextRange:LQ,comments:{kind:"array",item:xQ(r)}}}}var FQ=tB(PQ),kQ=tB(wg),UQ={kind:"object",selfKeys:SV,fields:{from:_r,reactions:{kind:"array",item:{kind:"object",fields:{from:_r}}}}},VQ={kind:"object",selfKeys:AV,fields:{from:_r,attachment:wg,attachments:{kind:"array",item:wg},recordingEditVersions:{kind:"record",value:{kind:"object",fields:{from:_r,attachment:wg,attachments:{kind:"array",item:wg}}}}}};function nB(r,e){let n=e?.stripAttachmentFiles?FQ:kQ;return wd(r,n)}function rB(r){return wd(r,UQ)}function iB(r){return wd(r,VQ)}var oB=()=>{};var YC={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};var te=function(r,e){if(!r)throw fl(e)},fl=function(r){return new Error("Firebase Database ("+YC.SDK_VERSION+") INTERNAL ASSERT FAILED: "+r)};var cB=function(r){let e=[],n=0;for(let t=0;t<r.length;t++){let i=r.charCodeAt(t);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&t+1<r.length&&(r.charCodeAt(t+1)&64512)===56320?(i=65536+((i&1023)<<10)+(r.charCodeAt(++t)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},BQ=function(r){let e=[],n=0,t=0;for(;n<r.length;){let i=r[n++];if(i<128)e[t++]=String.fromCharCode(i);else if(i>191&&i<224){let o=r[n++];e[t++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=r[n++],s=r[n++],a=r[n++],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=r[n++],s=r[n++];e[t++]=String.fromCharCode((i&15)<<12|(o&63)<<6|s&63)}}return e.join("")},Fd={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(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,t=[];for(let i=0;i<r.length;i+=3){let o=r[i],s=i+1<r.length,a=s?r[i+1]:0,c=i+2<r.length,l=c?r[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(n[u],n[d],n[f],n[g])}return t.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(cB(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):BQ(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,t=[];for(let i=0;i<r.length;){let o=n[r.charAt(i++)],a=i<r.length?n[r.charAt(i)]:0;++i;let l=i<r.length?n[r.charAt(i)]:64;++i;let d=i<r.length?n[r.charAt(i)]:64;if(++i,o==null||a==null||l==null||d==null)throw new QC;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 r=0;r<this.ENCODED_VALS.length;r++)this.byteToCharMap_[r]=this.ENCODED_VALS.charAt(r),this.charToByteMap_[this.byteToCharMap_[r]]=r,this.byteToCharMapWebSafe_[r]=this.ENCODED_VALS_WEBSAFE.charAt(r),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]]=r,r>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},QC=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},JC=function(r){let e=cB(r);return Fd.encodeByteArray(e,!0)},Fg=function(r){return JC(r).replace(/\./g,"")},Pd=function(r){try{return Fd.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function lB(r){return uB(void 0,r)}function uB(r,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:let n=e;return new Date(n.getTime());case Object:r===void 0&&(r={});break;case Array:r=[];break;default:return e}for(let n in e)!e.hasOwnProperty(n)||!GQ(n)||(r[n]=uB(r[n],e[n]));return r}function GQ(r){return r!=="__proto__"}function cI(){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=()=>cI().__FIREBASE_DEFAULTS__,jQ=()=>{if(typeof process>"u"||typeof process.env>"u")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},HQ=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&Pd(r[1]);return e&&JSON.parse(e)},lI=()=>{try{return oB()||$Q()||jQ()||HQ()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},dB=r=>{var e,n;return(n=(e=lI())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[r]},kd=r=>{let e=dB(r);if(!e)return;let n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let t=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),t]:[e.substring(0,n),t]},ZC=()=>{var r;return(r=lI())===null||r===void 0?void 0:r.config},hB=r=>{var e;return(e=lI())===null||e===void 0?void 0:e[`_${r}`]};var Sn=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,t)=>{n?this.reject(n):this.resolve(t),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,t))}}};function $r(r){try{return(r.startsWith("http://")||r.startsWith("https://")?new URL(r).hostname:r).endsWith(".cloudworkstations.dev")}catch{return!1}}function Ta(r){return I(this,null,function*(){return(yield fetch(r,{credentials:"include"})).ok})}function uI(r,e){if(r.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n={alg:"none",type:"JWT"},t=e||"demo-project",i=r.iat||0,o=r.sub||r.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:{}}},r);return[Fg(JSON.stringify(n)),Fg(JSON.stringify(s)),""].join(".")}var xg={};function WQ(){let r={prod:[],emulator:[]};for(let e of Object.keys(xg))xg[e]?r.emulator.push(e):r.prod.push(e);return r}function zQ(r){let e=document.getElementById(r),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",r),n=!0),{created:n,element:e}}var sB=!1;function gl(r,e){if(typeof window>"u"||typeof document>"u"||!$r(window.location.host)||xg[r]===e||xg[r]||sB)return;xg[r]=e;function n(f){return`__firebase__banner__${f}`}let t="__firebase__banner",o=WQ().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=()=>{sB=!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=zQ(t),g=n("text"),p=document.getElementById(g)||document.createElement("span"),_=n("learnmore"),T=document.getElementById(_)||document.createElement("a"),D=n("preprendIcon"),L=document.getElementById(D)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(f.created){let B=f.element;a(B),u(T,_);let w=l();c(L,D),B.append(L,p,T,w),document.body.appendChild(B)}o?(p.innerText="Preview backend disconnected.",L.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>`):(L.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 hn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function kg(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(hn())}function fB(){var r;let e=(r=lI())===null||r===void 0?void 0:r.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 gB(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function mB(){let r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function dI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function pB(){let r=hn();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function Lo(){return YC.NODE_CLIENT===!0||YC.NODE_ADMIN===!0}function eN(){return!fB()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function tN(){return!fB()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function Ud(){try{return typeof indexedDB=="object"}catch{return!1}}function EB(){return new Promise((r,e)=>{try{let n=!0,t="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(t);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(t),r(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var o;e(((o=i.error)===null||o===void 0?void 0:o.message)||"")}}catch(n){e(n)}})}var qQ="FirebaseError",vr=class r extends Error{constructor(e,n,t){super(n),this.code=e,this.customData=t,this.name=qQ,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Vi.prototype.create)}},Vi=class{constructor(e,n,t){this.service=e,this.serviceName=n,this.errors=t}create(e,...n){let t=n[0]||{},i=`${this.service}/${e}`,o=this.errors[e],s=o?KQ(o,t):"Error",a=`${this.serviceName}: ${s} (${i}).`;return new vr(i,a,t)}};function KQ(r,e){return r.replace(YQ,(n,t)=>{let i=e[t];return i!=null?String(i):`<${t}?>`})}var YQ=/\{\$([^}]+)}/g;function xd(r){return JSON.parse(r)}function Xt(r){return JSON.stringify(r)}var _B=function(r){let e={},n={},t={},i="";try{let o=r.split(".");e=xd(Pd(o[0])||""),n=xd(Pd(o[1])||""),i=o[2],t=n.d||{},delete n.d}catch{}return{header:e,claims:n,data:t,signature:i}};var TB=function(r){let e=_B(r),n=e.claims;return!!n&&typeof n=="object"&&n.hasOwnProperty("iat")},IB=function(r){let e=_B(r).claims;return typeof e=="object"&&e.admin===!0};function mi(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Ia(r,e){if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}function Ug(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Vg(r,e,n){let t={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=e.call(n,r[i],i,r));return t}function Bi(r,e){if(r===e)return!0;let n=Object.keys(r),t=Object.keys(e);for(let i of n){if(!t.includes(i))return!1;let o=r[i],s=e[i];if(aB(o)&&aB(s)){if(!Bi(o,s))return!1}else if(o!==s)return!1}for(let i of t)if(!n.includes(i))return!1;return!0}function aB(r){return r!==null&&typeof r=="object"}function Bg(r){let e=[];for(let[n,t]of Object.entries(r))Array.isArray(t)?t.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(t));return e.length?"&"+e.join("&"):""}var aI=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,n){n||(n=0);let t=this.W_;if(typeof e=="string")for(let d=0;d<16;d++)t[d]=e.charCodeAt(n)<<24|e.charCodeAt(n+1)<<16|e.charCodeAt(n+2)<<8|e.charCodeAt(n+3),n+=4;else for(let d=0;d<16;d++)t[d]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],n+=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,n){if(e==null)return;n===void 0&&(n=e.length);let t=n-this.blockSize,i=0,o=this.buf_,s=this.inbuf_;for(;i<n;){if(s===0)for(;i<=t;)this.compress_(e,i),i+=this.blockSize;if(typeof e=="string"){for(;i<n;)if(o[s]=e.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}else for(;i<n;)if(o[s]=e[i],++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}this.inbuf_=s,this.total_+=n}digest(){let e=[],n=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]=n&255,n/=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 vB(r,e){let n=new XC(r,e);return n.subscribe.bind(n)}var XC=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(t=>{this.error(t)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,t){let i;if(e===void 0&&n===void 0&&t===void 0)throw new Error("Missing Observer.");QQ(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:t},i.next===void 0&&(i.next=KC),i.error===void 0&&(i.error=KC),i.complete===void 0&&(i.complete=KC);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 n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(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 QQ(r,e){if(typeof r!="object"||r===null)return!1;for(let n of e)if(n in r&&typeof r[n]=="function")return!0;return!1}function KC(){}function va(r,e){return`${r} failed: ${e} argument `}var yB=function(r){let e=[],n=0;for(let t=0;t<r.length;t++){let i=r.charCodeAt(t);if(i>=55296&&i<=56319){let o=i-55296;t++,te(t<r.length,"Surrogate pair missing trail surrogate.");let s=r.charCodeAt(t)-56320;i=65536+(o<<10)+s}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Gg=function(r){let e=0;for(let n=0;n<r.length;n++){let t=r.charCodeAt(n);t<128?e++:t<2048?e+=2:t>=55296&&t<=56319?(e+=4,n++):e+=3}return e};var Wwe=14400*1e3;function Be(r){return r&&r._delegate?r._delegate:r}var fn=class{constructor(e,n,t){this.name=e,this.instanceFactory=n,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 ml="[DEFAULT]";var hI=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let t=new Sn;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&t.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let t=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!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(JQ(e))try{this.getOrInitializeService({instanceIdentifier:ml})}catch{}for(let[n,t]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let o=this.getOrInitializeService({instanceIdentifier:i});t.resolve(o)}catch{}}}}clearInstance(e=ml){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(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])})}isComponentSet(){return this.component!=null}isInitialized(e=ml){return this.instances.has(e)}getOptions(e=ml){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=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:n});for(let[o,s]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(o);t===a&&s.resolve(i)}return i}onInit(e,n){var t;let i=this.normalizeInstanceIdentifier(n),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,n){let t=this.onInitCallbacks.get(n);if(t)for(let i of t)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:XQ(e),options:n}),this.instances.set(e,t),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch{}return t||null}normalizeInstanceIdentifier(e=ml){return this.component?this.component.multipleInstances?e:ml:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function XQ(r){return r===ml?void 0:r}function JQ(r){return r.instantiationMode==="EAGER"}var $g=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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 n=new hI(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var SB=[],Pe=(function(r){return r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT",r})(Pe||{}),ZQ={debug:Pe.DEBUG,verbose:Pe.VERBOSE,info:Pe.INFO,warn:Pe.WARN,error:Pe.ERROR,silent:Pe.SILENT},eX=Pe.INFO,tX={[Pe.DEBUG]:"log",[Pe.VERBOSE]:"log",[Pe.INFO]:"info",[Pe.WARN]:"warn",[Pe.ERROR]:"error"},nX=(r,e,...n)=>{if(e<r.logLevel)return;let t=new Date().toISOString(),i=tX[e];if(i)console[i](`[${t}] ${r.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},pi=class{constructor(e){this.name=e,this._logLevel=eX,this._logHandler=nX,this._userLogHandler=null,SB.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Pe))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?ZQ[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,Pe.DEBUG,...e),this._logHandler(this,Pe.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Pe.VERBOSE,...e),this._logHandler(this,Pe.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Pe.INFO,...e),this._logHandler(this,Pe.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Pe.WARN,...e),this._logHandler(this,Pe.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Pe.ERROR,...e),this._logHandler(this,Pe.ERROR,...e)}};function AB(r){SB.forEach(e=>{e.setLogLevel(r)})}var rX=(r,e)=>e.some(n=>r instanceof n),RB,DB;function iX(){return RB||(RB=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oX(){return DB||(DB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var CB=new WeakMap,rN=new WeakMap,NB=new WeakMap,nN=new WeakMap,oN=new WeakMap;function sX(r){let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("success",o),r.removeEventListener("error",s)},o=()=>{n(Mo(r.result)),i()},s=()=>{t(r.error),i()};r.addEventListener("success",o),r.addEventListener("error",s)});return e.then(n=>{n instanceof IDBCursor&&CB.set(n,r)}).catch(()=>{}),oN.set(e,r),e}function aX(r){if(rN.has(r))return;let e=new Promise((n,t)=>{let i=()=>{r.removeEventListener("complete",o),r.removeEventListener("error",s),r.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{t(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",o),r.addEventListener("error",s),r.addEventListener("abort",s)});rN.set(r,e)}var iN={get(r,e,n){if(r instanceof IDBTransaction){if(e==="done")return rN.get(r);if(e==="objectStoreNames")return r.objectStoreNames||NB.get(r);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Mo(r[e])},set(r,e,n){return r[e]=n,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function OB(r){iN=r(iN)}function cX(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let t=r.call(fI(this),e,...n);return NB.set(t,e.sort?e.sort():[e]),Mo(t)}:oX().includes(r)?function(...e){return r.apply(fI(this),e),Mo(CB.get(this))}:function(...e){return Mo(r.apply(fI(this),e))}}function lX(r){return typeof r=="function"?cX(r):(r instanceof IDBTransaction&&aX(r),rX(r,iX())?new Proxy(r,iN):r)}function Mo(r){if(r instanceof IDBRequest)return sX(r);if(nN.has(r))return nN.get(r);let e=lX(r);return e!==r&&(nN.set(r,e),oN.set(e,r)),e}var fI=r=>oN.get(r);function wB(r,e,{blocked:n,upgrade:t,blocking:i,terminated:o}={}){let s=indexedDB.open(r,e),a=Mo(s);return t&&s.addEventListener("upgradeneeded",c=>{t(Mo(s.result),c.oldVersion,c.newVersion,Mo(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(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 uX=["get","getKey","getAll","getAllKeys","count"],dX=["put","add","delete","clear"],sN=new Map;function bB(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(sN.get(e))return sN.get(e);let n=e.replace(/FromIndex$/,""),t=e!==n,i=dX.includes(n);if(!(n in(t?IDBIndex:IDBObjectStore).prototype)||!(i||uX.includes(n)))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[n](...a),i&&c.done]))[0]})};return sN.set(e,o),o}OB(r=>le(M({},r),{get:(e,n,t)=>bB(e,n)||r.get(e,n,t),has:(e,n)=>!!bB(e,n)||r.has(e,n)}));var cN=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(hX(n)){let t=n.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(n=>n).join(" ")}};function hX(r){let e=r.getComponent();return e?.type==="VERSION"}var lN="@firebase/app",LB="0.13.2";var Cs=new pi("@firebase/app"),fX="@firebase/app-compat",gX="@firebase/analytics-compat",mX="@firebase/analytics",pX="@firebase/app-check-compat",EX="@firebase/app-check",_X="@firebase/auth",TX="@firebase/auth-compat",IX="@firebase/database",vX="@firebase/data-connect",yX="@firebase/database-compat",SX="@firebase/functions",AX="@firebase/functions-compat",RX="@firebase/installations",DX="@firebase/installations-compat",CX="@firebase/messaging",NX="@firebase/messaging-compat",OX="@firebase/performance",bX="@firebase/performance-compat",wX="@firebase/remote-config",LX="@firebase/remote-config-compat",MX="@firebase/storage",PX="@firebase/storage-compat",xX="@firebase/firestore",FX="@firebase/ai",kX="@firebase/firestore-compat",UX="firebase",VX="11.10.0";var uN="[DEFAULT]",BX={[lN]:"fire-core",[fX]:"fire-core-compat",[mX]:"fire-analytics",[gX]:"fire-analytics-compat",[EX]:"fire-app-check",[pX]:"fire-app-check-compat",[_X]:"fire-auth",[TX]:"fire-auth-compat",[IX]:"fire-rtdb",[vX]:"fire-data-connect",[yX]:"fire-rtdb-compat",[SX]:"fire-fn",[AX]:"fire-fn-compat",[RX]:"fire-iid",[DX]:"fire-iid-compat",[CX]:"fire-fcm",[NX]:"fire-fcm-compat",[OX]:"fire-perf",[bX]:"fire-perf-compat",[wX]:"fire-rc",[LX]:"fire-rc-compat",[MX]:"fire-gcs",[PX]:"fire-gcs-compat",[xX]:"fire-fst",[kX]:"fire-fst-compat",[FX]:"fire-vertex","fire-js":"fire-js",[UX]:"fire-js-all"};var jg=new Map,GX=new Map,dN=new Map;function MB(r,e){try{r.container.addComponent(e)}catch(n){Cs.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,n)}}function lr(r){let e=r.name;if(dN.has(e))return Cs.debug(`There were multiple attempts to register component ${e}.`),!1;dN.set(e,r);for(let n of jg.values())MB(n,r);for(let n of GX.values())MB(n,r);return!0}function Po(r,e){let n=r.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),r.container.getProvider(e)}function yr(r){return r==null?!1:r.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."},ya=new Vi("app","Firebase",$X);var hN=class{constructor(e,n,t){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=t,this.container.addComponent(new fn("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 ya.create("app-deleted",{appName:this._name})}};var Sa=VX;function mN(r,e={}){let n=r;typeof e!="object"&&(e={name:e});let t=Object.assign({name:uN,automaticDataCollectionEnabled:!0},e),i=t.name;if(typeof i!="string"||!i)throw ya.create("bad-app-name",{appName:String(i)});if(n||(n=ZC()),!n)throw ya.create("no-options");let o=jg.get(i);if(o){if(Bi(n,o.options)&&Bi(t,o.config))return o;throw ya.create("duplicate-app",{appName:i})}let s=new $g(i);for(let c of dN.values())s.addComponent(c);let a=new hN(n,t,s);return jg.set(i,a),a}function Sr(r=uN){let e=jg.get(r);if(!e&&r===uN&&ZC())return mN();if(!e)throw ya.create("no-app",{appName:r});return e}function gI(){return Array.from(jg.values())}function Ke(r,e,n){var t;let i=(t=BX[r])!==null&&t!==void 0?t:r;n&&(i+=`-${n}`);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 "/")`),Cs.warn(a.join(" "));return}lr(new fn(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function jX(r){AB(r)}var HX="firebase-heartbeat-database",WX=1,Hg="firebase-heartbeat-store",aN=null;function kB(){return aN||(aN=wB(HX,WX,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(Hg)}catch(n){console.warn(n)}}}}).catch(r=>{throw ya.create("idb-open",{originalErrorMessage:r.message})})),aN}function zX(r){return I(this,null,function*(){try{let n=(yield kB()).transaction(Hg),t=yield n.objectStore(Hg).get(UB(r));return yield n.done,t}catch(e){if(e instanceof vr)Cs.warn(e.message);else{let n=ya.create("idb-get",{originalErrorMessage:e?.message});Cs.warn(n.message)}}})}function PB(r,e){return I(this,null,function*(){try{let t=(yield kB()).transaction(Hg,"readwrite");yield t.objectStore(Hg).put(e,UB(r)),yield t.done}catch(n){if(n instanceof vr)Cs.warn(n.message);else{let t=ya.create("idb-set",{originalErrorMessage:n?.message});Cs.warn(t.message)}}})}function UB(r){return`${r.name}!${r.options.appId}`}var qX=1024,KX=30,fN=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new gN(n),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}triggerHeartbeat(){return I(this,null,function*(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=xB();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.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>KX){let s=QX(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){Cs.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 n=xB(),{heartbeatsToSend:t,unsentEntries:i}=YX(this._heartbeatsCache.heartbeats),o=Fg(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Cs.warn(n),""}})}};function xB(){return new Date().toISOString().substring(0,10)}function YX(r,e=qX){let n=[],t=r.slice();for(let i of r){let o=n.find(s=>s.agent===i.agent);if(o){if(o.dates.push(i.date),FB(n)>e){o.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),FB(n)>e){n.pop();break}t=t.slice(1)}return{heartbeatsToSend:n,unsentEntries:t}}var gN=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return I(this,null,function*(){return Ud()?EB().then(()=>!0).catch(()=>!1):!1})}read(){return I(this,null,function*(){if(yield this._canUseIndexedDBPromise){let n=yield zX(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(e){return I(this,null,function*(){var n;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return PB(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return})}add(e){return I(this,null,function*(){var n;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return PB(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return})}};function FB(r){return Fg(JSON.stringify({version:2,heartbeats:r})).length}function QX(r){if(r.length===0)return-1;let e=0,n=r[0].date;for(let t=1;t<r.length;t++)r[t].date<n&&(n=r[t].date,e=t);return e}function XX(r){lr(new fn("platform-logger",e=>new cN(e),"PRIVATE")),lr(new fn("heartbeat",e=>new fN(e),"PRIVATE")),Ke(lN,LB,r),Ke(lN,LB,"esm2017"),Ke("fire-js","")}XX("");var JX="firebase",ZX="11.10.0";Ke(JX,ZX,"app");function yLe(r){r||(r=J(sr));let e=new pe(n=>{if(r.destroyed){n.next();return}return r.onDestroy(n.next.bind(n))});return n=>n.pipe(Zs(e))}function SLe(r,e){let n=e?.injector??J(lt),t=new Mc(1),i=ZD(()=>{let o;try{o=r()}catch(s){lg(()=>t.error(s));return}lg(()=>t.next(o))},{injector:n,manualCleanup:!0});return n.get(sr).onDestroy(()=>{i.destroy(),t.complete()}),t.asObservable()}function ALe(r,e){let t=!e?.manualCleanup?e?.injector?.get(sr)??J(sr):null,i=eJ(e?.equal),o;e?.requireSync?o=Jc({kind:0},{equal:i}):o=Jc({kind:1,value:e?.initialValue},{equal:i});let s,a=r.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)),ug(()=>{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 eJ(r=Object.is){return(e,n)=>e.kind===1&&n.kind===1&&r(e.value,n.value)}function VB(r){r===void 0&&(r=J(lt));let e=r.get(vo);return n=>new pe(t=>{let i=e.add(),o=!1;function s(){o||(i(),o=!0)}let a=n.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 Gi=new Uc("ANGULARFIRE2_VERSION");function Aa(r,e,n){if(e){if(e.length===1)return e[0];let o=e.filter(s=>s.app===n);if(o.length===1)return o[0]}return n.container.getProvider(r).getImmediate({optional:!0})}var Ns=(r,e)=>{let n=e?[e]:gI(),t=[];return n.forEach(i=>{i.container.getProvider(r).instances.forEach(s=>{t.includes(s)||t.push(s)})}),t},Vd=(function(r){return r[r.SILENT=0]="SILENT",r[r.WARN=1]="WARN",r[r.VERBOSE=2]="VERBOSE",r})(Vd||{}),BB=uC()&&typeof Zone<"u"?Vd.WARN:Vd.SILENT;var mI=class{zone;delegate;constructor(e,n=rA){this.zone=e,this.delegate=n}now(){return this.delegate.now()}schedule(e,n,t){let i=this.zone,o=function(s){i?i.runGuarded(()=>{e.apply(this,[s])}):e.apply(this,[s])};return this.delegate.schedule(o,n,t)}},$i=(()=>{class r{outsideAngular;insideAngular;constructor(){let n=J(we);this.outsideAngular=n.runOutsideAngular(()=>new mI(typeof Zone>"u"?void 0:Zone.current)),this.insideAngular=n.run(()=>new mI(typeof Zone>"u"?void 0:Zone.current,$n))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),GB=!1;function tJ(r,e){!GB&&(BB>Vd.SILENT||uC())&&(GB=!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")),BB>=e&&console.warn(`Firebase API called outside injection context: ${r.name}`)}function nJ(r){let e=J(we,{optional:!0});return e?e.runOutsideAngular(()=>r()):r()}function pl(r){let e=J(we,{optional:!0});return e?e.run(()=>r()):r()}var rJ=(r,e,n)=>(...t)=>(e&&setTimeout(e,0),go(n,()=>pl(()=>r.apply(void 0,t)))),_e=(r,e,n)=>(n||=e?Vd.WARN:Vd.VERBOSE,function(){let t,i=arguments,o,s,a;try{o=J($i),s=J(vo),a=J(zn)}catch{return tJ(r,n),r.apply(this,i)}for(let l=0;l<arguments.length;l++)typeof i[l]=="function"&&(e&&(t||=pl(()=>s.add())),i[l]=rJ(i[l],t,a));let c=nJ(()=>r.apply(this,i));return e?c instanceof pe?c.pipe(Xs(o.outsideAngular),Qs(o.insideAngular),VB(a)):c instanceof Promise?pl(()=>{let l=s.add();return new Promise((u,d)=>{c.then(f=>go(a,()=>pl(()=>u(f))),f=>go(a,()=>pl(()=>d(f)))).finally(l)})}):typeof c=="function"&&t?function(){return setTimeout(t,0),c.apply(this,arguments)}:pl(()=>c):c instanceof pe?c.pipe(Xs(o.outsideAngular),Qs(o.insideAngular)):pl(()=>c)});var ji=class{constructor(e){return e}},Os=class{constructor(){return gI()}};function iJ(r){return r&&r.length===1?r[0]:new ji(Sr())}var pN=new ee("angularfire2._apps"),oJ={provide:ji,useFactory:iJ,deps:[[new un,pN]]},sJ={provide:Os,deps:[[new un,pN]]};function aJ(r){return(e,n)=>{let t=n.get(_s);Ke("angularfire",Gi.full,"core"),Ke("angularfire",Gi.full,"app"),Ke("angular",pA.full,t.toString());let i=e.runOutsideAngular(()=>r(n));return new ji(i)}}function $Le(r,...e){return pr([oJ,sJ,{provide:pN,useFactory:aJ(r),multi:!0,deps:[we,lt,$i,...e]}])}var jLe=_e(Sr,!0);var HLe=_e(mN,!0);var cJ=new Map,lJ={activated:!1,tokenObservers:[]},uJ={initialized:!1,enabled:!1};function Hi(r){return cJ.get(r)||Object.assign({},lJ)}function WB(){return uJ}var dJ="https://content-firebaseappcheck.googleapis.com/v1";var hJ="exchangeDebugToken",$B={OFFSET_DURATION:300*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:960*1e3},ZLe=1440*60*1e3;var TN=class{constructor(e,n,t,i,o){if(this.operation=e,this.retryPolicy=n,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 Sn,this.pending.promise.catch(n=>{}),yield fJ(this.getNextRun(e)),this.pending.resolve(),yield this.pending.promise,this.pending=new Sn,this.pending.promise.catch(n=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(n){this.retryPolicy(n)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let n=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),n}}};function fJ(r){return new Promise(e=>{setTimeout(e,r)})}var gJ={"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}"},Ra=new Vi("appCheck","AppCheck",gJ);function zB(r){if(!Hi(r).activated)throw Ra.create("use-before-activation",{appName:r.name})}function qB(t,i){return I(this,arguments,function*({url:r,body:e},n){let o={"Content-Type":"application/json"},s=n.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(r,a)}catch(g){throw Ra.create("fetch-network-error",{originalErrorMessage:g?.message})}if(c.status!==200)throw Ra.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(g){throw Ra.create("fetch-parse-error",{originalErrorMessage:g?.message})}let u=l.ttl.match(/^([\d.]+)(s)$/);if(!u||!u[2]||isNaN(Number(u[1])))throw Ra.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 KB(r,e){let{projectId:n,appId:t,apiKey:i}=r.options;return{url:`${dJ}/projects/${n}/apps/${t}:${hJ}?key=${i}`,body:{debug_token:e}}}var mJ="firebase-app-check-database",pJ=1,IN="firebase-app-check-store";var pI=null;function EJ(){return pI||(pI=new Promise((r,e)=>{try{let n=indexedDB.open(mJ,pJ);n.onsuccess=t=>{r(t.target.result)},n.onerror=t=>{var i;e(Ra.create("storage-open",{originalErrorMessage:(i=t.target.error)===null||i===void 0?void 0:i.message}))},n.onupgradeneeded=t=>{let i=t.target.result;t.oldVersion===0&&i.createObjectStore(IN,{keyPath:"compositeKey"})}}catch(n){e(Ra.create("storage-open",{originalErrorMessage:n?.message}))}}),pI)}function _J(r,e){return TJ(IJ(r),e)}function TJ(r,e){return I(this,null,function*(){let t=(yield EJ()).transaction(IN,"readwrite"),o=t.objectStore(IN).put({compositeKey:r,value:e});return new Promise((s,a)=>{o.onsuccess=c=>{s()},t.onerror=c=>{var l;a(Ra.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function IJ(r){return`${r.options.appId}-${r.name}`}var Wg=new pi("@firebase/app-check");function EN(r,e){return Ud()?_J(r,e).catch(n=>{Wg.warn(`Failed to write token to IndexedDB. Error: ${n}`)}):Promise.resolve()}function YB(){return WB().enabled}function QB(){return I(this,null,function*(){let r=WB();if(r.enabled&&r.token)return r.token.promise;throw Error(`
139
- Can't get debug token in production mode.
140
- `)})}var vJ={error:"UNKNOWN_ERROR"};function yJ(r){return Fd.encodeString(JSON.stringify(r),!1)}function vN(r,e=!1,n=!1){return I(this,null,function*(){let t=r.app;zB(t);let i=Hi(t),o=i.token,s;if(o&&!zg(o)&&(i.token=void 0,o=void 0),!o){let l=yield i.cachedTokenPromise;l&&(zg(l)?o=l:yield EN(t,void 0))}if(!e&&o&&zg(o))return{token:o.token};let a=!1;if(YB())try{i.exchangeTokenPromise||(i.exchangeTokenPromise=qB(KB(t,yield QB()),r.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"?Wg.warn(l.message):n&&Wg.error(l),_N(l)}try{i.exchangeTokenPromise||(i.exchangeTokenPromise=i.provider.getToken().finally(()=>{i.exchangeTokenPromise=void 0}),a=!0),o=yield Hi(t).exchangeTokenPromise}catch(l){l.code==="appCheck/throttled"||l.code==="appCheck/initial-throttle"?Wg.warn(l.message):n&&Wg.error(l),s=l}let c;return o?s?zg(o)?c={token:o.token,internalError:s}:c=_N(s):(c={token:o.token},i.token=o,yield EN(t,o)):c=_N(s),a&&DJ(t,c),c})}function SJ(r){return I(this,null,function*(){let e=r.app;zB(e);let{provider:n}=Hi(e);if(YB()){let t=yield QB(),{token:i}=yield qB(KB(e,t),r.heartbeatServiceProvider);return{token:i}}else{let{token:t}=yield n.getToken();return{token:t}}})}function AJ(r,e,n,t){let{app:i}=r,o=Hi(i),s={next:n,error:t,type:e};if(o.tokenObservers=[...o.tokenObservers,s],o.token&&zg(o.token)){let a=o.token;Promise.resolve().then(()=>{n({token:a.token}),jB(r)}).catch(()=>{})}o.cachedTokenPromise.then(()=>jB(r))}function XB(r,e){let n=Hi(r),t=n.tokenObservers.filter(i=>i.next!==e);t.length===0&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=t}function jB(r){let{app:e}=r,n=Hi(e),t=n.tokenRefresher;t||(t=RJ(r),n.tokenRefresher=t),!t.isRunning()&&n.isTokenAutoRefreshEnabled&&t.start()}function RJ(r){let{app:e}=r;return new TN(()=>I(null,null,function*(){let n=Hi(e),t;if(n.token?t=yield vN(r,!0):t=yield vN(r),t.error)throw t.error;if(t.internalError)throw t.internalError}),()=>!0,()=>{let n=Hi(e);if(n.token){let t=n.token.issuedAtTimeMillis+(n.token.expireTimeMillis-n.token.issuedAtTimeMillis)*.5+3e5,i=n.token.expireTimeMillis-300*1e3;return t=Math.min(t,i),Math.max(0,t-Date.now())}else return 0},$B.RETRIAL_MIN_WAIT,$B.RETRIAL_MAX_WAIT)}function DJ(r,e){let n=Hi(r).tokenObservers;for(let t of n)try{t.type==="EXTERNAL"&&e.error!=null?t.error(e.error):t.next(e)}catch{}}function zg(r){return r.expireTimeMillis-Date.now()>0}function _N(r){return{token:yJ(vJ),error:r}}var yN=class{constructor(e,n){this.app=e,this.heartbeatServiceProvider=n}_delete(){let{tokenObservers:e}=Hi(this.app);for(let n of e)XB(this.app,n.next);return Promise.resolve()}};function CJ(r,e){return new yN(r,e)}function NJ(r){return{getToken:e=>vN(r,e),getLimitedUseToken:()=>SJ(r),addTokenListener:e=>AJ(r,"INTERNAL",e),removeTokenListener:e=>XB(r.app,e)}}var OJ="@firebase/app-check",bJ="0.10.1";var wJ="app-check",HB="app-check-internal";function LJ(){lr(new fn(wJ,r=>{let e=r.getProvider("app").getImmediate(),n=r.getProvider("heartbeat");return CJ(e,n)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,e,n)=>{r.getProvider(HB).initialize()})),lr(new fn(HB,r=>{let e=r.getProvider("app-check").getImmediate();return NJ(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),Ke(OJ,bJ)}LJ();var MJ="app-check";var Da=class{constructor(){return Ns(MJ)}};var PJ=["localhost","0.0.0.0","127.0.0.1"],hMe=typeof window<"u"&&PJ.includes(window.location.hostname);function cG(){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 lG=cG,uG=new Vi("auth","Firebase",cG());var TI=new pi("@firebase/auth");function xJ(r,...e){TI.logLevel<=Pe.WARN&&TI.warn(`Auth (${Sa}): ${r}`,...e)}function _I(r,...e){TI.logLevel<=Pe.ERROR&&TI.error(`Auth (${Sa}): ${r}`,...e)}function II(r,...e){throw kN(r,...e)}function FN(r,...e){return kN(r,...e)}function dG(r,e,n){let t=Object.assign(Object.assign({},lG()),{[e]:n});return new Vi("auth","Firebase",t).create(e,{appName:r.name})}function qg(r){return dG(r,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function kN(r,...e){if(typeof r!="string"){let n=e[0],t=[...e.slice(1)];return t[0]&&(t[0].appName=r.name),r._errorFactory.create(n,...t)}return uG.create(r,...e)}function Ye(r,e,...n){if(!r)throw kN(e,...n)}function Kg(r){let e="INTERNAL ASSERTION FAILED: "+r;throw _I(e),new Error(e)}function vI(r,e){r||Kg(e)}function FJ(){return JB()==="http:"||JB()==="https:"}function JB(){var r;return typeof self<"u"&&((r=self.location)===null||r===void 0?void 0:r.protocol)||null}function kJ(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(FJ()||mB()||"connection"in navigator)?navigator.onLine:!0}function UJ(){if(typeof navigator>"u")return null;let r=navigator;return r.languages&&r.languages[0]||r.language||null}var _l=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,vI(n>e,"Short delay should be less than long delay!"),this.isMobile=kg()||dI()}get(){return kJ()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function VJ(r,e){vI(r.emulator,"Emulator should always be set here");let{url:n}=r.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var yI=class{static initialize(e,n,t){this.fetchImpl=e,n&&(this.headersImpl=n),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;Kg("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;Kg("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;Kg("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var BJ={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 GJ=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$J=new _l(3e4,6e4);function UN(r,e){return r.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:r.tenantId}):e}function Jg(o,s,a,c){return I(this,arguments,function*(r,e,n,t,i={}){return hG(r,i,()=>I(null,null,function*(){let l={},u={};t&&(e==="GET"?u=t:l={body:JSON.stringify(t)});let d=Bg(Object.assign({key:r.config.apiKey},u)).slice(1),f=yield r._getAdditionalHeaders();f["Content-Type"]="application/json",r.languageCode&&(f["X-Firebase-Locale"]=r.languageCode);let g=Object.assign({method:e,headers:f},l);return gB()||(g.referrerPolicy="no-referrer"),r.emulatorConfig&&$r(r.emulatorConfig.host)&&(g.credentials="include"),yI.fetch()(yield fG(r,r.config.apiHost,n,d),g)}))})}function hG(r,e,n){return I(this,null,function*(){r._canInitEmulator=!1;let t=Object.assign(Object.assign({},BJ),e);try{let i=new RN(r),o=yield Promise.race([n(),i.promise]);i.clearNetworkTimeout();let s=yield o.json();if("needConfirmation"in s)throw EI(r,"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(r,"credential-already-in-use",s);if(c==="EMAIL_EXISTS")throw EI(r,"email-already-in-use",s);if(c==="USER_DISABLED")throw EI(r,"user-disabled",s);let u=t[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw dG(r,u,l);II(r,u)}}catch(i){if(i instanceof vr)throw i;II(r,"network-request-failed",{message:String(i)})}})}function jJ(o,s,a,c){return I(this,arguments,function*(r,e,n,t,i={}){let l=yield Jg(r,e,n,t,i);return"mfaPendingCredential"in l&&II(r,"multi-factor-auth-required",{_serverResponse:l}),l})}function fG(r,e,n,t){return I(this,null,function*(){let i=`${e}${n}?${t}`,o=r,s=o.config.emulator?VJ(r.config,i):`${r.config.apiScheme}://${i}`;return GJ.includes(n)&&(yield o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(s).toString():s})}var RN=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,t)=>{this.timer=setTimeout(()=>t(FN(this.auth,"network-request-failed")),$J.get())})}};function EI(r,e,n){let t={appName:r.name};n.email&&(t.email=n.email),n.phoneNumber&&(t.phoneNumber=n.phoneNumber);let i=FN(r,e,t);return i.customData._tokenResponse=n,i}function HJ(r,e){return I(this,null,function*(){return Jg(r,"POST","/v1/accounts:delete",e)})}function SI(r,e){return I(this,null,function*(){return Jg(r,"POST","/v1/accounts:lookup",e)})}function Yg(r){if(r)try{let e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function bI(r,e=!1){return I(this,null,function*(){let n=Be(r),t=yield n.getIdToken(e),i=gG(t);Ye(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let o=typeof i.firebase=="object"?i.firebase:void 0,s=o?.sign_in_provider;return{claims:i,token:t,authTime:Yg(SN(i.auth_time)),issuedAtTime:Yg(SN(i.iat)),expirationTime:Yg(SN(i.exp)),signInProvider:s||null,signInSecondFactor:o?.sign_in_second_factor||null}})}function SN(r){return Number(r)*1e3}function gG(r){let[e,n,t]=r.split(".");if(e===void 0||n===void 0||t===void 0)return _I("JWT malformed, contained fewer than 3 sections"),null;try{let i=Pd(n);return i?JSON.parse(i):(_I("Failed to decode base64 JWT payload"),null)}catch(i){return _I("Caught error parsing JWT payload as JSON",i?.toString()),null}}function ZB(r){let e=gG(r);return Ye(e,"internal-error"),Ye(typeof e.exp<"u","internal-error"),Ye(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}function DN(r,e,n=!1){return I(this,null,function*(){if(n)return e;try{return yield e}catch(t){throw t instanceof vr&&WJ(t)&&r.auth.currentUser===r&&(yield r.auth.signOut()),t}})}function WJ({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}var CN=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 n;if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(()=>I(this,null,function*(){yield this.iteration()}),n)}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 Xg=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Yg(this.lastLoginAt),this.creationTime=Yg(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};function AI(r){return I(this,null,function*(){var e;let n=r.auth,t=yield r.getIdToken(),i=yield DN(r,SI(n,{idToken:t}));Ye(i?.users.length,n,"internal-error");let o=i.users[0];r._notifyReloadListener(o);let s=!((e=o.providerUserInfo)===null||e===void 0)&&e.length?mG(o.providerUserInfo):[],a=zJ(r.providerData,s),c=r.isAnonymous,l=!(r.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 Xg(o.createdAt,o.lastLoginAt),isAnonymous:u};Object.assign(r,d)})}function VN(r){return I(this,null,function*(){let e=Be(r);yield AI(e),yield e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)})}function zJ(r,e){return[...r.filter(t=>!e.some(i=>i.providerId===t.providerId)),...e]}function mG(r){return r.map(e=>{var{providerId:n}=e,t=FS(e,["providerId"]);return{providerId:n,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}})}function qJ(r,e){return I(this,null,function*(){let n=yield hG(r,{},()=>I(null,null,function*(){let t=Bg({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:o}=r.config,s=yield fG(r,i,"/v1/token",`key=${o}`),a=yield r._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let c={method:"POST",headers:a,body:t};return r.emulatorConfig&&$r(r.emulatorConfig.host)&&(c.credentials="include"),yI.fetch()(s,c)}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}})}function KJ(r,e){return I(this,null,function*(){return Jg(r,"POST","/v2/accounts:revokeToken",UN(r,e))})}var Qg=class r{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ye(e.idToken,"internal-error"),Ye(typeof e.idToken<"u","internal-error"),Ye(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ZB(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Ye(e.length!==0,"internal-error");let n=ZB(e);this.updateTokensAndExpiration(e,null,n)}getToken(e,n=!1){return I(this,null,function*(){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ye(this.refreshToken,e,"user-token-expired"),this.refreshToken?(yield this.refresh(e,this.refreshToken),this.accessToken):null)})}clearRefreshToken(){this.refreshToken=null}refresh(e,n){return I(this,null,function*(){let{accessToken:t,refreshToken:i,expiresIn:o}=yield qJ(e,n);this.updateTokensAndExpiration(t,i,Number(o))})}updateTokensAndExpiration(e,n,t){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+t*1e3}static fromJSON(e,n){let{refreshToken:t,accessToken:i,expirationTime:o}=n,s=new r;return t&&(Ye(typeof t=="string","internal-error",{appName:e}),s.refreshToken=t),i&&(Ye(typeof i=="string","internal-error",{appName:e}),s.accessToken=i),o&&(Ye(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 r,this.toJSON())}_performRefresh(){return Kg("not implemented")}};function Ca(r,e){Ye(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}var Na=class r{constructor(e){var{uid:n,auth:t,stsTokenManager:i}=e,o=FS(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new CN(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,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 Xg(o.createdAt||void 0,o.lastLoginAt||void 0)}getIdToken(e){return I(this,null,function*(){let n=yield DN(this,this.stsTokenManager.getToken(this.auth,e));return Ye(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,yield this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n})}getIdTokenResult(e){return bI(this,e)}reload(){return VN(this)}_assign(e){this!==e&&(Ye(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(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new r(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){Ye(!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,n=!1){return I(this,null,function*(){let t=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),t=!0),n&&(yield AI(this)),yield this.auth._persistUserIfCurrent(this),t&&this.auth._notifyListenersIfCurrent(this)})}delete(){return I(this,null,function*(){if(yr(this.auth.app))return Promise.reject(qg(this.auth));let e=yield this.getIdToken();return yield DN(this,HJ(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,n){var t,i,o,s,a,c,l,u;let d=(t=n.displayName)!==null&&t!==void 0?t:void 0,f=(i=n.email)!==null&&i!==void 0?i:void 0,g=(o=n.phoneNumber)!==null&&o!==void 0?o:void 0,p=(s=n.photoURL)!==null&&s!==void 0?s:void 0,_=(a=n.tenantId)!==null&&a!==void 0?a:void 0,T=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,D=(l=n.createdAt)!==null&&l!==void 0?l:void 0,L=(u=n.lastLoginAt)!==null&&u!==void 0?u:void 0,{uid:B,emailVerified:w,isAnonymous:F,providerData:U,stsTokenManager:A}=n;Ye(B&&A,e,"internal-error");let R=Qg.fromJSON(this.name,A);Ye(typeof B=="string",e,"internal-error"),Ca(d,e.name),Ca(f,e.name),Ye(typeof w=="boolean",e,"internal-error"),Ye(typeof F=="boolean",e,"internal-error"),Ca(g,e.name),Ca(p,e.name),Ca(_,e.name),Ca(T,e.name),Ca(D,e.name),Ca(L,e.name);let N=new r({uid:B,auth:e,email:f,emailVerified:w,displayName:d,isAnonymous:F,photoURL:p,phoneNumber:g,tenantId:_,stsTokenManager:R,createdAt:D,lastLoginAt:L});return U&&Array.isArray(U)&&(N.providerData=U.map(b=>Object.assign({},b))),T&&(N._redirectEventId=T),N}static _fromIdTokenResponse(e,n,t=!1){return I(this,null,function*(){let i=new Qg;i.updateFromServerResponse(n);let o=new r({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:t});return yield AI(o),o})}static _fromGetAccountInfoResponse(e,n,t){return I(this,null,function*(){let i=n.users[0];Ye(i.localId!==void 0,"internal-error");let o=i.providerUserInfo!==void 0?mG(i.providerUserInfo):[],s=!(i.email&&i.passwordHash)&&!o?.length,a=new Qg;a.updateFromIdToken(t);let c=new r({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 Xg(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!o?.length};return Object.assign(c,l),c})}};var eG=new Map;function El(r){vI(r instanceof Function,"Expected a class definition");let e=eG.get(r);return e?(vI(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,eG.set(r,e),e)}var YJ=(()=>{class r{constructor(){this.type="NONE",this.storage={}}_isAvailable(){return I(this,null,function*(){return!0})}_set(n,t){return I(this,null,function*(){this.storage[n]=t})}_get(n){return I(this,null,function*(){let t=this.storage[n];return t===void 0?null:t})}_remove(n){return I(this,null,function*(){delete this.storage[n]})}_addListener(n,t){}_removeListener(n,t){}}return r.type="NONE",r})(),NN=YJ;function AN(r,e,n){return`firebase:${r}:${e}:${n}`}var RI=class r{constructor(e,n,t){this.persistence=e,this.auth=n,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=n._onStorageEvent.bind(n),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 n=yield SI(this.auth,{idToken:e}).catch(()=>{});return n?Na._fromGetAccountInfoResponse(this.auth,n,e):null}return Na._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 n=yield this.getCurrentUser();if(yield this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)})}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static create(e,n,t="authUser"){return I(this,null,function*(){if(!n.length)return new r(El(NN),e,t);let i=(yield Promise.all(n.map(l=>I(null,null,function*(){if(yield l._isAvailable())return l})))).filter(l=>l),o=i[0]||El(NN),s=AN(t,e.config.apiKey,e.name),a=null;for(let l of n)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 Na._fromGetAccountInfoResponse(e,f,u)}else d=Na._fromJSON(e,u);l!==o&&(a=d),o=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!o._shouldAllowMigration||!c.length?new r(o,e,t):(o=c[0],a&&(yield o._set(s,a.toJSON())),yield Promise.all(n.map(l=>I(null,null,function*(){if(l!==o)try{yield l._remove(s)}catch{}}))),new r(o,e,t))})}};function tG(r){let e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(pG(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(QJ(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(_G(e))return"Blackberry";if(TG(e))return"Webos";if(XJ(e))return"Safari";if((e.includes("chrome/")||JJ(e))&&!e.includes("edge/"))return"Chrome";if(EG(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,t=r.match(n);if(t?.length===2)return t[1]}return"Other"}function QJ(r=hn()){return/firefox\//i.test(r)}function XJ(r=hn()){let e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function JJ(r=hn()){return/crios\//i.test(r)}function pG(r=hn()){return/iemobile/i.test(r)}function EG(r=hn()){return/android/i.test(r)}function _G(r=hn()){return/blackberry/i.test(r)}function TG(r=hn()){return/webos/i.test(r)}function ZJ(r=hn()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function eZ(){return pB()&&document.documentMode===10}function tZ(r=hn()){return ZJ(r)||EG(r)||TG(r)||_G(r)||/windows phone/i.test(r)||pG(r)}function IG(r,e=[]){let n;switch(r){case"Browser":n=tG(hn());break;case"Worker":n=`${tG(hn())}-${r}`;break;default:n=r}let t=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Sa}/${t}`}var ON=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let t=o=>new Promise((s,a)=>{try{let c=e(o);s(c)}catch(c){a(c)}});t.onAbort=n,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 n=[];try{for(let t of this.queue)yield t(e),t.onAbort&&n.push(t.onAbort)}catch(t){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}})}};function nZ(n){return I(this,arguments,function*(r,e={}){return Jg(r,"GET","/v2/passwordPolicy",UN(r,e))})}var rZ=6,bN=class{constructor(e){var n,t,i,o;let s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=s.minPasswordLength)!==null&&n!==void 0?n:rZ,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 n,t,i,o,s,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!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,n){let t=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;t&&(n.meetsMinPasswordLength=e.length>=t),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let t;for(let i=0;i<e.length;i++)t=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,t>="a"&&t<="z",t>="A"&&t<="Z",t>="0"&&t<="9",this.allowedNonAlphanumericCharacters.includes(t))}updatePasswordCharacterOptionsStatuses(e,n,t,i,o){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),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 wN=class{constructor(e,n,t,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new DI(this),this.idTokenSubscription=new DI(this),this.beforeStateQueue=new ON(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=uG,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,n){return n&&(this._popupRedirectResolver=El(n)),this._initializationPromise=this.queue(()=>I(this,null,function*(){var t,i,o;if(!this._deleted&&(this.persistenceManager=yield RI.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(n),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 n=yield SI(this,{idToken:e}),t=yield Na._fromGetAccountInfoResponse(this,n,e);yield this.directlySetCurrentUser(t)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),yield this.directlySetCurrentUser(null)}})}initializeCurrentUser(e){return I(this,null,function*(){var n;if(yr(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=(n=this.redirectUser)===null||n===void 0?void 0:n._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 Ye(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 n=null;try{n=yield this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{yield this._setRedirectUser(null)}return n})}reloadAndSetCurrentUserOrClear(e){return I(this,null,function*(){try{yield AI(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)})}useDeviceLanguage(){this.languageCode=UJ()}_delete(){return I(this,null,function*(){this._deleted=!0})}updateCurrentUser(e){return I(this,null,function*(){if(yr(this.app))return Promise.reject(qg(this));let n=e?Be(e):null;return n&&Ye(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))})}_updateCurrentUser(e,n=!1){return I(this,null,function*(){if(!this._deleted)return e&&Ye(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||(yield this.beforeStateQueue.runMiddleware(e)),this.queue(()=>I(this,null,function*(){yield this.directlySetCurrentUser(e),this.notifyAuthListeners()}))})}signOut(){return I(this,null,function*(){return yr(this.app)?Promise.reject(qg(this)):(yield this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&(yield this._setRedirectUser(null)),this._updateCurrentUser(null,!0))})}setPersistence(e){return yr(this.app)?Promise.reject(qg(this)):this.queue(()=>I(this,null,function*(){yield this.assertedPersistence.setPersistence(El(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 n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)})}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}_updatePasswordPolicy(){return I(this,null,function*(){let e=yield nZ(this),n=new bN(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n})}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Vi("auth","Firebase",e())}onAuthStateChanged(e,n,t){return this.registerStateListener(this.authStateSubscription,e,n,t)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,t){return this.registerStateListener(this.idTokenSubscription,e,n,t)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let t=this.onAuthStateChanged(()=>{t(),e()},n)}})}revokeAccessToken(e){return I(this,null,function*(){if(this.currentUser){let n=yield this.currentUser.getIdToken(),t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(t.tenantId=this.tenantId),yield KJ(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,n){return I(this,null,function*(){let t=yield this.getOrInitRedirectPersistenceManager(n);return e===null?t.removeCurrentUser():t.setCurrentUser(e)})}getOrInitRedirectPersistenceManager(e){return I(this,null,function*(){if(!this.redirectPersistenceManager){let n=e&&El(e)||this._popupRedirectResolver;Ye(n,this,"argument-error"),this.redirectPersistenceManager=yield RI.create(this,[El(n._redirectPersistence)],"redirectUser"),this.redirectUser=yield this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager})}_redirectUserForId(e){return I(this,null,function*(){var n,t;return this._isInitialized&&(yield this.queue(()=>I(this,null,function*(){}))),((n=this._currentUser)===null||n===void 0?void 0:n._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,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let t=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,t,i){if(this._deleted)return()=>{};let o=typeof n=="function"?n:n.next.bind(n),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ye(a,this,"internal-error"),a.then(()=>{s||o(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,t,i);return()=>{s=!0,c()}}else{let c=e.addObserver(n);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 Ye(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=IG(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getAdditionalHeaders(){return I(this,null,function*(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["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&&(n["X-Firebase-Client"]=t);let i=yield this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n})}_getAppCheckToken(){return I(this,null,function*(){var e;if(yr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let n=yield(e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken();return n?.error&&xJ(`Error while retrieving App Check token: ${n.error}`),n?.token})}};function vG(r){return Be(r)}var DI=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=vB(n=>this.observer=n)}get next(){return Ye(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var iZ={loadJS(){return I(this,null,function*(){throw new Error("Unable to load external scripts")})},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function oZ(r){iZ=r}function sZ(r){return`__${r}${Math.floor(Math.random()*1e6)}`}function BN(r,e){let n=Po(r,"auth");if(n.isInitialized()){let i=n.getImmediate(),o=n.getOptions();if(Bi(o,e??{}))return i;II(i,"already-initialized")}return n.initialize({options:e})}function aZ(r,e){let n=e?.persistence||[],t=(Array.isArray(n)?n:[n]).map(El);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(t,e?.popupRedirectResolver)}var LN=class r{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static _fromIdTokenResponse(e,n,t,i=!1){return I(this,null,function*(){let o=yield Na._fromIdTokenResponse(e,t,i),s=nG(t);return new r({user:o,providerId:s,_tokenResponse:t,operationType:n})})}static _forOperation(e,n,t){return I(this,null,function*(){yield e._updateTokensIfNecessary(t,!0);let i=nG(t);return new r({user:e,providerId:i,_tokenResponse:t,operationType:n})})}};function nG(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}function cZ(r,e){return I(this,null,function*(){return jJ(r,"POST","/v1/accounts:signInWithCustomToken",UN(r,e))})}function GN(r,e){return I(this,null,function*(){if(yr(r.app))return Promise.reject(qg(r));let n=vG(r),t=yield cZ(n,{token:e,returnSecureToken:!0}),i=yield LN._fromIdTokenResponse(n,"signIn",t);return yield n._updateCurrentUser(i.user),i})}function wI(r,e,n,t){return Be(r).onAuthStateChanged(e,n,t)}function $N(r){return Be(r).signOut()}var CI="__sak";var NI=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(CI,"1"),this.storage.removeItem(CI),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var lZ=1e3,uZ=10,dZ=(()=>{class r extends NI{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(n,t)=>this.onStorageEvent(n,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=tZ(),this._shouldAllowMigration=!0}forAllChangedKeys(n){for(let t of Object.keys(this.listeners)){let i=this.storage.getItem(t),o=this.localCache[t];i!==o&&n(t,o,i)}}onStorageEvent(n,t=!1){if(!n.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}let i=n.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);eZ()&&s!==n.newValue&&n.newValue!==n.oldValue?setTimeout(o,uZ):o()}notifyListeners(n,t){this.localCache[n]=t;let i=this.listeners[n];if(i)for(let o of Array.from(i))o(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((n,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:n,oldValue:t,newValue:i}),!0)})},lZ)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(n,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[n]||(this.listeners[n]=new Set,this.localCache[n]=this.storage.getItem(n)),this.listeners[n].add(t)}_removeListener(n,t){this.listeners[n]&&(this.listeners[n].delete(t),this.listeners[n].size===0&&delete this.listeners[n]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}_set(n,t){return I(this,null,function*(){yield Rc(r.prototype,this,"_set").call(this,n,t),this.localCache[n]=JSON.stringify(t)})}_get(n){return I(this,null,function*(){let t=yield Rc(r.prototype,this,"_get").call(this,n);return this.localCache[n]=JSON.stringify(t),t})}_remove(n){return I(this,null,function*(){yield Rc(r.prototype,this,"_remove").call(this,n),delete this.localCache[n]})}}return r.type="LOCAL",r})(),hZ=dZ;var fZ=(()=>{class r extends NI{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(n,t){}_removeListener(n,t){}}return r.type="SESSION",r})(),gZ=fZ;function mZ(r){return Promise.all(r.map(e=>I(null,null,function*(){try{return{fulfilled:!0,value:yield e}}catch(n){return{fulfilled:!1,reason:n}}})))}var pZ=(()=>{class r{constructor(n){this.eventTarget=n,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(n){let t=this.receivers.find(o=>o.isListeningto(n));if(t)return t;let i=new r(n);return this.receivers.push(i),i}isListeningto(n){return this.eventTarget===n}handleEvent(n){return I(this,null,function*(){let t=n,{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 mZ(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:o,response:l})})}_subscribe(n,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[n]||(this.handlersMap[n]=new Set),this.handlersMap[n].add(t)}_unsubscribe(n,t){this.handlersMap[n]&&t&&this.handlersMap[n].delete(t),(!t||this.handlersMap[n].size===0)&&delete this.handlersMap[n],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}r.receivers=[];return r})();function EZ(r="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(Math.random()*10);return r+n}var MN=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,n,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=EZ("",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:n},[i.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})})}};function rG(){return window}function yG(){return typeof rG().WorkerGlobalScope<"u"&&typeof rG().importScripts=="function"}function _Z(){return I(this,null,function*(){if(!navigator?.serviceWorker)return null;try{return(yield navigator.serviceWorker.ready).active}catch{return null}})}function TZ(){var r;return((r=navigator?.serviceWorker)===null||r===void 0?void 0:r.controller)||null}function IZ(){return yG()?self:null}var SG="firebaseLocalStorageDb",vZ=1,OI="firebaseLocalStorage",AG="fbase_key",Tl=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function LI(r,e){return r.transaction([OI],e?"readwrite":"readonly").objectStore(OI)}function yZ(){let r=indexedDB.deleteDatabase(SG);return new Tl(r).toPromise()}function PN(){let r=indexedDB.open(SG,vZ);return new Promise((e,n)=>{r.addEventListener("error",()=>{n(r.error)}),r.addEventListener("upgradeneeded",()=>{let t=r.result;try{t.createObjectStore(OI,{keyPath:AG})}catch(i){n(i)}}),r.addEventListener("success",()=>I(null,null,function*(){let t=r.result;t.objectStoreNames.contains(OI)?e(t):(t.close(),yield yZ(),e(yield PN()))}))})}function iG(r,e,n){return I(this,null,function*(){let t=LI(r,!0).put({[AG]:e,value:n});return new Tl(t).toPromise()})}function SZ(r,e){return I(this,null,function*(){let n=LI(r,!1).get(e),t=yield new Tl(n).toPromise();return t===void 0?null:t.value})}function oG(r,e){let n=LI(r,!0).delete(e);return new Tl(n).toPromise()}var AZ=800,RZ=3,DZ=(()=>{class r{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 PN(),this.db)})}_withRetries(n){return I(this,null,function*(){let t=0;for(;;)try{let i=yield this._openDb();return yield n(i)}catch(i){if(t++>RZ)throw i;this.db&&(this.db.close(),this.db=void 0)}})}initializeServiceWorkerMessaging(){return I(this,null,function*(){return yG()?this.initializeReceiver():this.initializeSender()})}initializeReceiver(){return I(this,null,function*(){this.receiver=pZ._getInstance(IZ()),this.receiver._subscribe("keyChanged",(n,t)=>I(this,null,function*(){return{keyProcessed:(yield this._poll()).includes(t.key)}})),this.receiver._subscribe("ping",(n,t)=>I(this,null,function*(){return["keyChanged"]}))})}initializeSender(){return I(this,null,function*(){var n,t;if(this.activeServiceWorker=yield _Z(),!this.activeServiceWorker)return;this.sender=new MN(this.activeServiceWorker);let i=yield this.sender._send("ping",{},800);i&&!((n=i[0])===null||n===void 0)&&n.fulfilled&&!((t=i[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)})}notifyServiceWorker(n){return I(this,null,function*(){if(!(!this.sender||!this.activeServiceWorker||TZ()!==this.activeServiceWorker))try{yield this.sender._send("keyChanged",{key:n},this.serviceWorkerReceiverAvailable?800:50)}catch{}})}_isAvailable(){return I(this,null,function*(){try{if(!indexedDB)return!1;let n=yield PN();return yield iG(n,CI,"1"),yield oG(n,CI),!0}catch{}return!1})}_withPendingWrite(n){return I(this,null,function*(){this.pendingWrites++;try{yield n()}finally{this.pendingWrites--}})}_set(n,t){return I(this,null,function*(){return this._withPendingWrite(()=>I(this,null,function*(){return yield this._withRetries(i=>iG(i,n,t)),this.localCache[n]=t,this.notifyServiceWorker(n)}))})}_get(n){return I(this,null,function*(){let t=yield this._withRetries(i=>SZ(i,n));return this.localCache[n]=t,t})}_remove(n){return I(this,null,function*(){return this._withPendingWrite(()=>I(this,null,function*(){return yield this._withRetries(t=>oG(t,n)),delete this.localCache[n],this.notifyServiceWorker(n)}))})}_poll(){return I(this,null,function*(){let n=yield this._withRetries(o=>{let s=LI(o,!1).getAll();return new Tl(s).toPromise()});if(!n)return[];if(this.pendingWrites!==0)return[];let t=[],i=new Set;if(n.length!==0)for(let{fbase_key:o,value:s}of n)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(n,t){this.localCache[n]=t;let i=this.listeners[n];if(i)for(let o of Array.from(i))o(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>I(this,null,function*(){return this._poll()}),AZ)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(n,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[n]||(this.listeners[n]=new Set,this._get(n)),this.listeners[n].add(t)}_removeListener(n,t){this.listeners[n]&&(this.listeners[n].delete(t),this.listeners[n].size===0&&delete this.listeners[n]),Object.keys(this.listeners).length===0&&this.stopPolling()}}return r.type="LOCAL",r})(),CZ=DZ;var yMe=sZ("rcb"),SMe=new _l(3e4,6e4);var AMe=new _l(2e3,1e4);var RMe=600*1e3;var DMe=new _l(3e4,6e4);var CMe=new _l(5e3,15e3);var NMe=encodeURIComponent("fac");var sG="@firebase/auth",aG="1.10.8";var xN=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 n=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Ye(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function NZ(r){switch(r){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(r){lr(new fn("auth",(e,{options:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=t.options;Ye(s&&!s.includes(":"),"invalid-api-key",{appName:t.name});let c={apiKey:s,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:IG(r)},l=new wN(t,i,o,c);return aZ(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,t)=>{e.getProvider("auth-internal").initialize()})),lr(new fn("auth-internal",e=>{let n=vG(e.getProvider("auth").getImmediate());return(t=>new xN(t))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ke(sG,aG,NZ(r)),Ke(sG,aG,"esm2017")}var bZ=300,OMe=hB("authIdTokenMaxAge")||bZ;function wZ(){var r,e;return(e=(r=document.getElementsByTagName("head"))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:document}oZ({loadJS(r){return new Promise((e,n)=>{let t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=i=>{let o=FN("internal-error");o.customData=i,n(o)},t.type="text/javascript",t.charset="UTF-8",wZ().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 CG(r){return new pe(function(e){var n=wI(r,e.next.bind(e),e.error.bind(e),e.complete.bind(e));return{unsubscribe:n}})}var NG="auth",Il=class{constructor(e){return e}},vl=class{constructor(){return Ns(NG)}};var jN=new ee("angularfire2.auth-instances");function See(r,e){let n=Aa(NG,r,e);return n&&new Il(n)}function Aee(r){return(e,n)=>{let t=e.runOutsideAngular(()=>r(n));return new Il(t)}}var Ree={provide:vl,deps:[[new un,jN]]},Dee={provide:Il,useFactory:See,deps:[[new un,jN],ji]};function DPe(r,...e){return Ke("angularfire",Gi.full,"auth"),pr([Dee,Ree,{provide:jN,useFactory:Aee(r),multi:!0,deps:[we,lt,$i,Os,[new un,Da],...e]}])}var yl=_e(CG,!0);var Zg=_e(bI,!0);var CPe=_e(BN,!0);var OG=_e(GN,!0,2);var bG=_e($N,!0,2);var Nee="type.googleapis.com/google.protobuf.Int64Value",Oee="type.googleapis.com/google.protobuf.UInt64Value";function PG(r,e){let n={};for(let t in r)r.hasOwnProperty(t)&&(n[t]=e(r[t]));return n}function MI(r){if(r==null)return null;if(r instanceof Number&&(r=r.valueOf()),typeof r=="number"&&isFinite(r)||r===!0||r===!1||Object.prototype.toString.call(r)==="[object String]")return r;if(r instanceof Date)return r.toISOString();if(Array.isArray(r))return r.map(e=>MI(e));if(typeof r=="function"||typeof r=="object")return PG(r,e=>MI(e));throw new Error("Data cannot be encoded in JSON: "+r)}function Bd(r){if(r==null)return r;if(r["@type"])switch(r["@type"]){case Nee:case Oee:{let e=Number(r.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+r);return e}default:throw new Error("Data cannot be decoded from JSON: "+r)}return Array.isArray(r)?r.map(e=>Bd(e)):typeof r=="function"||typeof r=="object"?PG(r,e=>Bd(e)):r}var qN="functions";var wG={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"},Ar=class r extends vr{constructor(e,n,t){super(`${qN}/${e}`,n||""),this.details=t,Object.setPrototypeOf(this,r.prototype)}};function bee(r){if(r>=200&&r<300)return"ok";switch(r){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 PI(r,e){let n=bee(r),t=n,i;try{let o=e&&e.error;if(o){let s=o.status;if(typeof s=="string"){if(!wG[s])return new Ar("internal","internal");n=wG[s],t=s}let a=o.message;typeof a=="string"&&(t=a),i=o.details,i!==void 0&&(i=Bd(i))}}catch{}return n==="ok"?null:new Ar(n,t,i)}var HN=class{constructor(e,n,t,i){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,yr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=n.getImmediate({optional:!0}),this.messaging=t.getImmediate({optional:!0}),this.auth||n.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 n=e?yield this.appCheck.getLimitedUseToken():yield this.appCheck.getToken();return n.error?null:n.token}return null})}getContext(e){return I(this,null,function*(){let n=yield this.getAuthToken(),t=yield this.getMessagingToken(),i=yield this.getAppCheckToken(e);return{authToken:n,messagingToken:t,appCheckToken:i}})}};var WN="us-central1",wee=/^data: (.*?)(?:\n|$)/;function Lee(r){let e=null;return{promise:new Promise((n,t)=>{e=setTimeout(()=>{t(new Ar("deadline-exceeded","deadline-exceeded"))},r)}),cancel:()=>{e&&clearTimeout(e)}}}var zN=class{constructor(e,n,t,i,o=WN,s=(...a)=>fetch(...a)){this.app=e,this.fetchImpl=s,this.emulatorOrigin=null,this.contextProvider=new HN(e,n,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=WN}catch{this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(e){let n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}};function Mee(r,e,n){let t=$r(e);r.emulatorOrigin=`http${t?"s":""}://${e}:${n}`,t&&(Ta(r.emulatorOrigin),gl("Functions",!0))}function Pee(r,e,n){let t=i=>Fee(r,e,i,n||{});return t.stream=(i,o)=>kee(r,e,i,o||{}),t}function xee(r,e,n,t){return I(this,null,function*(){n["Content-Type"]="application/json";let i;try{i=yield t(r,{method:"POST",body:JSON.stringify(e),headers:n})}catch{return{status:0,json:null}}let o=null;try{o=yield i.json()}catch{}return{status:i.status,json:o}})}function xG(r,e){return I(this,null,function*(){let n={},t=yield r.contextProvider.getContext(e.limitedUseAppCheckTokens);return t.authToken&&(n.Authorization="Bearer "+t.authToken),t.messagingToken&&(n["Firebase-Instance-ID-Token"]=t.messagingToken),t.appCheckToken!==null&&(n["X-Firebase-AppCheck"]=t.appCheckToken),n})}function Fee(r,e,n,t){return I(this,null,function*(){n=MI(n);let i={data:n},o=yield xG(r,t),s=t.timeout||7e4,a=Lee(s),c=yield Promise.race([xee(e,i,o,r.fetchImpl),a.promise,r.cancelAllRequests]);if(a.cancel(),!c)throw new Ar("cancelled","Firebase Functions instance was deleted.");let l=PI(c.status,c.json);if(l)throw l;if(!c.json)throw new Ar("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 Ar("internal","Response is missing data field.");return{data:Bd(u)}})}function kee(r,e,n,t){return I(this,null,function*(){var i;n=MI(n);let o={data:n},s=yield xG(r,t);s["Content-Type"]="application/json",s.Accept="text/event-stream";let a;try{a=yield r.fetchImpl(e,{method:"POST",body:JSON.stringify(o),headers:s,signal:t?.signal})}catch(g){if(g instanceof Error&&g.name==="AbortError"){let _=new Ar("cancelled","Request was cancelled.");return{data:Promise.reject(_),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(_)}}}}}}let p=PI(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 Ar("cancelled","Request was cancelled.");l(g)});let d=a.body.getReader(),f=Uee(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 Uee(r,e,n,t){let i=(s,a)=>{let c=s.match(wee);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=PI(0,u);a.error(d),n(d);return}}catch(u){if(u instanceof Ar){a.error(u),n(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 Ar("cancelled","Request was cancelled");return s.error(l),n(l),Promise.resolve()}try{let{value:l,done:u}=yield r.read();if(u){a.trim()&&i(a.trim(),s),s.close();return}if(t?.aborted){let f=new Ar("cancelled","Request was cancelled");s.error(f),n(f),yield r.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 Ar?l:PI(0,null);s.error(u),n(u)}})}},cancel(){return r.cancel()}})}var LG="@firebase/functions",MG="0.12.9";var Vee="auth-internal",Bee="app-check-internal",Gee="messaging-internal";function $ee(r){let e=(n,{instanceIdentifier:t})=>{let i=n.getProvider("app").getImmediate(),o=n.getProvider(Vee),s=n.getProvider(Gee),a=n.getProvider(Bee);return new zN(i,o,s,a,t)};lr(new fn(qN,e,"PUBLIC").setMultipleInstances(!0)),Ke(LG,MG,r),Ke(LG,MG,"esm2017")}function FG(r=Sr(),e=WN){let t=Po(Be(r),qN).getImmediate({identifier:e}),i=kd("functions");return i&&KN(t,...i),t}function KN(r,e,n){Mee(Be(r),e,n)}function kG(r,e,n){return Pee(Be(r),e,n)}$ee();var ur=class{constructor(e){return e}},UG="functions",YN=class{constructor(){return Ns(UG)}};var QN=new ee("angularfire2.functions-instances");function jee(r,e){let n=Aa(UG,r,e);return n&&new ur(n)}function Hee(r){return(e,n)=>{let t=e.runOutsideAngular(()=>r(n));return new ur(t)}}var Wee={provide:YN,deps:[[new un,QN]]},zee={provide:ur,useFactory:jee,deps:[[new un,QN],ji]};function WPe(r,...e){return Ke("angularfire",Gi.full,"fn"),pr([zee,Wee,{provide:QN,useFactory:Hee(r),multi:!0,deps:[we,lt,$i,Os,[new un,vl],[new un,Da],...e]}])}var zPe=_e(KN,!0),qPe=_e(FG,!0);var VG=_e(kG,!0);var BG={httpsCallableFromURL:VG};function Rr(r,e,n){return n?BG.httpsCallableFromURL(r,e,n):BG.httpsCallableFromURL(r,e)}var Xn=(()=>{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(),j.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(LC)),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(rt(Pt))}catch(t){return this.loggingService.catch("Error in ConfigService getSF$: ",t),de(!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),de("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()}getSelfHostedConfig(){try{return this.config$.value?.selfHosted}catch(t){this.loggingService.catch("Error in ConfigService getSelfHostedConfig: ",t);return}}getEnablePortableBackend(){try{return this.config$.value?.selfHosted?.enablePortableBackend===!0}catch(t){return this.loggingService.catch("Error in ConfigService getEnablePortableBackend: ",t),!1}}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),de(!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),de(!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),de(null)}}};e.\u0275fac=function(i){return new(i||e)(C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var bs={validateClient:{endpointClass:"core",module:"core"},sdkProxy:{endpointClass:"core",module:"core"},getNotificationsForDocuments:{endpointClass:"core",module:"core"},getPlanDetails:{endpointClass:"advisory",module:"core"},sa:{endpointClass:"telemetry",module:"core"},getIceServers:{endpointClass:"optional",module:"huddle-webrtc"},chatgptCompletion:{endpointClass:"optional",module:"ai"},rewriterAskAi:{endpointClass:"optional",module:"ai"},whisperTranscription:{endpointClass:"optional",module:"recorder-media"},getAllowedDocuments:{endpointClass:"optional",module:"core"},videoBackend:{endpointClass:"optional",module:"recorder-media"},convertRecording:{endpointClass:"optional",module:"recorder-media"},processRecording:{endpointClass:"optional",module:"recorder-media"},screenshot:{endpointClass:"optional",module:"recorder-media"},setEncryptedData:{endpointClass:"core",module:"core"},firebaseNotificationsDatabaseURL:{endpointClass:"core",module:"core"},firebaseConfig:{endpointClass:"core",module:"core"}},qee=Object.keys(bs).filter(r=>r!=="setEncryptedData"&&r!=="firebaseNotificationsDatabaseURL"&&r!=="firebaseConfig"&&bs[r].endpointClass==="core"),Kee=["notifications","analytics-telemetry","console"],GG=new Set;function Yee(r){try{let e=r.filter(o=>!Z1.includes(o));if(!e.length)return;let n=[...e].sort().join(",");if(GG.has(n))return;GG.add(n);let t=e.filter(o=>Kee.includes(o)),i=`Velt [selfHosted.deploymentProfile]: unknown module id(s) ignored: ${e.join(", ")}. Unknown ids enable nothing (fail-closed).`;t.length&&(i+=` Note: ${t.join(", ")} `+(t.length>1?"were":"was")+" absorbed into 'core' by the 2026-07-10 manifest restructure \u2014 the endpoints they used to gate (notifications hub, getNotificationsForDocuments, sa telemetry, console CFs) now follow 'core' and are ENABLED whenever core is. If you relied on omitting one of these ids to disable those endpoints, that opt-out no longer applies \u2014 regenerate your velt-deployment-profile.json."),console.warn(i)}catch{}}function Al(r,e){let n=r?.deploymentProfile;return!Array.isArray(n)||n.length===0?!0:(Yee(n),n.includes(e))}var $G={usCentral1:"us-central1",europeWest1:"europe-west1",asiaSouthEast1:"asia-southeast1",australiaSouthEast1:"australia-southeast1",asiaNorthEast1:"asia-northeast1"};function Qee(r,e){let n=r?.dataRegions;if(!Array.isArray(n)||e==="usCentral1")return e;let t=$G[e];return t&&n.includes(t)?e:"usCentral1"}function Xee(r){let e=r.cloudFunction;if(e?.setEncryptedData)return!0;let n=r.dataRegions;if(!Array.isArray(n))return Object.values(e?.regions??{}).some(i=>!!i?.setEncryptedData);let t=i=>!!e?.regions?.[i]?.setEncryptedData;return t("usCentral1")?Object.entries($G).filter(([i,o])=>i!=="usCentral1"&&n.includes(o)).every(([i])=>t(i)):!1}var Jee="__VELT_PRE_BOOTSTRAP_SELF_HOSTED__";function Zee(r){let e=r?.firebaseConfig;return e?M(M({},dn.firebaseConfig),e):dn.firebaseConfig}function a0e(){try{if(typeof window>"u")return;let r=window[Jee];return r&&typeof r=="object"?r:void 0}catch{return}}var xo=(()=>{let e=class e{constructor(t){this.injector=t,this.strictCoreValidationReported=!1}get configService(){return this._configService??=this.injector.get(Xn)}get loggingService(){return this._loggingService??=this.injector.get(me)}getSelfHosted(){try{return this.configService.getSelfHostedConfig()}catch(t){this.loggingService.catch("Error in EndpointsService getSelfHosted: ",t);return}}resolveStrictMiss(t,i){return this.reportStrictCoreMisconfigurationOnce(t),`${Lg}${i}`}resolveProfileDisabled(t,i){return`${Lg}module.${t}/${i}`}reportStrictCoreMisconfigurationOnce(t){if(!this.strictCoreValidationReported){this.strictCoreValidationReported=!0;try{let i=this.getMissingStrictCoreEndpoints(t);i.length&&console.error(`Velt [selfHosted.strict]: missing CORE endpoint config: ${i.join(", ")}. The SDK cannot function without these in strict self-hosted mode \u2014 there is no fallback to Velt infrastructure. Provide them via config.selfHosted, or unset \`strict\` for hybrid mode.`)}catch(i){this.loggingService.catch("Error in EndpointsService reportStrictCoreMisconfigurationOnce: ",i,void 0,!0)}}}getMissingStrictCoreEndpoints(t){let i=[];for(let o of qee)Al(t,bs[o].module)&&(t.cloudFunction?.[o]||i.push(`cloudFunction.${o}`));return Al(t,bs.setEncryptedData.module)&&!Xee(t)&&i.push("cloudFunction.setEncryptedData"),Al(t,bs.firebaseNotificationsDatabaseURL.module)&&!t.firebaseNotificationsDatabaseURL&&i.push("firebaseNotificationsDatabaseURL"),Al(t,bs.firebaseConfig.module)&&!t.firebaseConfig&&i.push("firebaseConfig"),i}getCloudFunctionUrl(t){let i=this.getSelfHosted(),o=bs[t].module;if(!Al(i,o))return this.resolveProfileDisabled(o,`cloudFunction.${t}`);let s=i?.cloudFunction?.[t];return s||(i?.strict?this.resolveStrictMiss(i,`cloudFunction.${t}`):dn.cloudFunction?.[t])}getFirebaseConfig(){let t=this.getSelfHosted();return!t?.firebaseConfig&&t?.strict&&this.reportStrictCoreMisconfigurationOnce(t),Zee(t)}getNotificationsDbUrl(){let t=this.getSelfHosted(),i=bs.firebaseNotificationsDatabaseURL.module;if(!Al(t,i))return this.resolveProfileDisabled(i,"firebaseNotificationsDatabaseURL");let o=t?.firebaseNotificationsDatabaseURL;return o||(t?.strict?this.resolveStrictMiss(t,"firebaseNotificationsDatabaseURL"):dn.firebaseNotificationsDatabaseURL)}getSetEncryptedDataUrl(t){let i=this.getSelfHosted(),o=bs.setEncryptedData.module;if(!Al(i,o))return this.resolveProfileDisabled(o,`cloudFunction.setEncryptedData (region: ${t})`);t=Qee(i,t);let s=i?.cloudFunction;if(s?.setEncryptedData)return s.setEncryptedData;let a=s?.regions?.[t]?.setEncryptedData;return a||(i?.strict?this.resolveStrictMiss(i,`cloudFunction.setEncryptedData (region: ${t})`):dn.cloudFunction?.[t]?.setEncryptedData)}};e.\u0275fac=function(i){return new(i||e)(C(lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Ot=(()=>{let e=class e{constructor(t,i){this.functions=t,this.serviceBook=i,this.endpointsService=J(xo),this.sf=!1,this.defaultProperties={},this.draftEvents=[],this.liveStateSyncEvents=Object.values(P.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:Gr()}),window?.location?.href&&(this.defaultProperties.pageUrl=window.location.href),this.serviceBook.observe(Rd).subscribe(o=>{this.commentService=o??void 0}),this.serviceBook.observe(GT).subscribe(o=>{this.reactionService=o??void 0}),this.serviceBook.observe($T).subscribe(o=>{this.areaService=o??void 0}),this.serviceBook.observe($1).subscribe(o=>{this.liveStateService=o??null})}catch(o){j.catch("Error in AnalyticsService constructor: ",o)}}updateDefaultProperties(t={}){this.defaultProperties=M(M({},this.defaultProperties),t)}setInstalledFeature(t){try{this.defaultProperties?.installedFeatures||(this.defaultProperties.installedFeatures=[]),this.defaultProperties.installedFeatures.includes(t)||this.defaultProperties.installedFeatures.push(t)}catch(i){j.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]=M(M({},this.defaultProperties.featureConfigs[t]),i)}catch(o){j.catch("Error in AnalyticsService setFeatureConfig: ",o)}}setSF(t){try{this.sf=t}catch(i){j.catch("Error in AnalyticsService setSF: ",i)}}setAuthService(t){try{this.authService=t}catch(i){j.catch("Error in AnalyticsService setAuthService: ",i)}}setCommentService(t){try{this.commentService=t}catch(i){j.catch("Error in AnalyticsService setCommentService: ",i)}}setConfigService(t){try{this.configService=t}catch(i){j.catch("Error in AnalyticsService setConfigService: ",i)}}setDomService(t){try{this.domService=t}catch(i){j.catch("Error in AnalyticsService setDomService: ",i)}}setUserService(t){try{this.userService=t}catch(i){j.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(dn.production||dn.staging){let c=Date.now(),l={userId:t,clientUserId:this.user?.userId,traits:le(M({},s),{apiKey:a,forceReset:o?.forceReset,eventTimestamp:c}),properties:le(M({},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){j.catch("Error in AnalyticsService identifyUser: ",s)}}trackPage(t,i="",o={}){try{if((dn.production||dn.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){j.catch("Error in AnalyticsService trackPage: ",s)}}trackEvent(c){return I(this,arguments,function*(t,i={},o=!0,s,a){try{if(this.sf&&j1.includes(t))return Promise.resolve();if(dn.production||dn.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=M({eventName:t},i||{});this.triggerTrackEvent(P.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 j.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=M(M({},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(BT)?.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=M(M({},i),l)),i&&typeof i=="object"&&(i=le(M({},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 j.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 j.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){j.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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("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){j.warn("Error resolving analytics promise: ",a)}})}catch(s){j.warn("Error in AnalyticsService batch flush: ",s),t.forEach(a=>{try{a.reject&&a.reject(s)}catch(c){j.warn("Error rejecting analytics promise: ",c)}})}}catch(i){j.catch("Error in AnalyticsService flushAnalyticsQueue: ",i),t.forEach(o=>{try{o.reject&&o.reject(i)}catch(s){j.warn("Error rejecting analytics promise: ",s)}})}}catch(t){j.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(Rt(s=>!!s),Dt(1))?.subscribe(()=>{this.trackEvent(t,i,o)})))}catch(s){j.catch("Error in AnalyticsService trackAuthenticatedEvent: ",s)}}getContext(){try{let t={},i=Pg();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=QV(),t.userAgent=i?.deviceInfo?.userAgent,t}catch(t){j.catch("Error in AnalyticsService getContext: ",t)}}};e.\u0275fac=function(i){return new(i||e)(C(ur),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var me=(()=>{let e=class e{get debugMode(){return jV()}get debugContextMode(){return HV()}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(P.Events.Core.SDK_ERROR,M({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)(C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var jG="@firebase/database",HG="1.0.20";var nb="";function ete(r){nb=r}var iO=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),Xt(n))}get(e){let n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:xd(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var oO=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return mi(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var y$=function(r){try{if(typeof window<"u"&&typeof window[r]<"u"){let e=window[r];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new iO(e)}}catch{}return new oO},Dl=y$("localStorage"),sO=y$("sessionStorage");var Hd=new pi("@firebase/database"),S$=(function(){let r=1;return function(){return r++}})(),A$=function(r){let e=yB(r),n=new aI;n.update(e);let t=n.digest();return Fd.encodeByteArray(t)},ym=function(...r){let e="";for(let n=0;n<r.length;n++){let t=r[n];Array.isArray(t)||t&&typeof t=="object"&&typeof t.length=="number"?e+=ym.apply(null,t):typeof t=="object"?e+=Xt(t):e+=t,e+=" "}return e},Cl=null,WG=!0,tte=function(r,e){te(!e||r===!0||r===!1,"Can't turn on custom loggers persistently."),r===!0?(Hd.logLevel=Pe.VERBOSE,Cl=Hd.log.bind(Hd),e&&sO.set("logging_enabled",!0)):typeof r=="function"?Cl=r:(Cl=null,sO.remove("logging_enabled"))},An=function(...r){if(WG===!0&&(WG=!1,Cl===null&&sO.get("logging_enabled")===!0&&tte(!0)),Cl){let e=ym.apply(null,r);Cl(e)}},Sm=function(r){return function(...e){An(r,...e)}},aO=function(...r){let e="FIREBASE INTERNAL ERROR: "+ym(...r);Hd.error(e)},ws=function(...r){let e=`FIREBASE FATAL ERROR: ${ym(...r)}`;throw Hd.error(e),new Error(e)},Jn=function(...r){let e="FIREBASE WARNING: "+ym(...r);Hd.warn(e)},nte=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().")},av=function(r){return typeof r=="number"&&(r!==r||r===Number.POSITIVE_INFINITY||r===Number.NEGATIVE_INFINITY)},rte=function(r){if(Lo()||document.readyState==="complete")r();else{let e=!1,n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}e||(e=!0,r())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},Ol="[MIN_NAME]",Ma="[MAX_NAME]",xl=function(r,e){if(r===e)return 0;if(r===Ol||e===Ma)return-1;if(e===Ol||r===Ma)return 1;{let n=zG(r),t=zG(e);return n!==null?t!==null?n-t===0?r.length-e.length:n-t:-1:t!==null?1:r<e?-1:1}},ite=function(r,e){return r===e?0:r<e?-1:1},tm=function(r,e){if(e&&r in e)return e[r];throw new Error("Missing required key ("+r+") in object: "+Xt(e))},rb=function(r){if(typeof r!="object"||r===null)return Xt(r);let e=[];for(let t in r)e.push(t);e.sort();let n="{";for(let t=0;t<e.length;t++)t!==0&&(n+=","),n+=Xt(e[t]),n+=":",n+=rb(r[e[t]]);return n+="}",n},R$=function(r,e){let n=r.length;if(n<=e)return[r];let t=[];for(let i=0;i<n;i+=e)i+e>n?t.push(r.substring(i,n)):t.push(r.substring(i,i+e));return t};function Rn(r,e){for(let n in r)r.hasOwnProperty(n)&&e(n,r[n])}var D$=function(r){te(!av(r),"Invalid JSON number");let e=11,n=52,t=(1<<e-1)-1,i,o,s,a,c;r===0?(o=0,s=0,i=1/r===-1/0?1:0):(i=r<0,r=Math.abs(r),r>=Math.pow(2,1-t)?(a=Math.min(Math.floor(Math.log(r)/Math.LN2),t),o=a+t,s=Math.round(r*Math.pow(2,n-a)-Math.pow(2,n))):(o=0,s=Math.round(r/Math.pow(2,1-t-n))));let l=[];for(c=n;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()},ote=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},ste=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function ate(r,e){let n="Unknown Error";r==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":r==="permission_denied"?n="Client doesn't have permission to access the desired data.":r==="unavailable"&&(n="The service is unavailable");let t=new Error(r+" at "+e._path.toString()+": "+n);return t.code=r.toUpperCase(),t}var cte=new RegExp("^-?(0*)\\d{1,10}$"),lte=-2147483648,ute=2147483647,zG=function(r){if(cte.test(r)){let e=Number(r);if(e>=lte&&e<=ute)return e}return null},Zd=function(r){try{r()}catch(e){setTimeout(()=>{let n=e.stack||"";throw Jn("Exception was thrown by user callback.",n),e},Math.floor(0))}},dte=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},om=function(r,e){let n=setTimeout(r,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};var cO=class{constructor(e,n){this.appCheckProvider=n,this.appName=e.name,yr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=n?.getImmediate({optional:!0}),this.appCheck||n?.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((n,t)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,t):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.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 lO=class{constructor(e,n,t){this.appName_=e,this.firebaseOptions_=n,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(n=>n&&n.code==="auth/token-not-initialized"?(An("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(n)):new Promise((n,t)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,t):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.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)}},sm=(()=>{class r{constructor(n){this.accessToken=n}getToken(n){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(n){n(this.accessToken)}removeTokenChangeListener(n){}notifyForInvalidToken(){}}r.OWNER="owner";return r})(),FI="5",C$="v",N$="s",O$="r",b$="f",w$=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,L$="ls",M$="p",uO="ac",P$="websocket",x$="long_polling";var kI=class{constructor(e,n,t,i,o=!1,s="",a=!1,c=!1,l=null){this.secure=n,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=Dl.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()&&Dl.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://",n=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${n}`}};function hte(r){return r.host!==r.internalHost||r.isCustomHost()||r.includeNamespaceInQueryParams}function F$(r,e,n){te(typeof e=="string","typeof type must == string"),te(typeof n=="object","typeof params must == object");let t;if(e===P$)t=(r.secure?"wss://":"ws://")+r.internalHost+"/.ws?";else if(e===x$)t=(r.secure?"https://":"http://")+r.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);hte(r)&&(n.ns=r.namespace);let i=[];return Rn(n,(o,s)=>{i.push(o+"="+s)}),t+i.join("&")}var dO=class{constructor(){this.counters_={}}incrementCounter(e,n=1){mi(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return lB(this.counters_)}};var XN={},JN={};function ib(r){let e=r.toString();return XN[e]||(XN[e]=new dO),XN[e]}function fte(r,e){let n=r.toString();return JN[n]||(JN[n]=e()),JN[n]}var hO=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,n){for(this.pendingResponses[e]=n;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]&&Zd(()=>{this.onMessage_(t[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var qG="start",gte="close",mte="pLPCommand",pte="pRTLPCB",k$="id",U$="pw",V$="ser",Ete="cb",_te="seg",Tte="ts",Ite="d",vte="dframe",B$=1870,G$=30,yte=B$-G$,Ste=25e3,Ate=3e4,UI=class r{constructor(e,n,t,i,o,s,a){this.connId=e,this.repoInfo=n,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_=Sm(e),this.stats_=ib(n),this.urlFn=c=>(this.appCheckToken&&(c[uO]=this.appCheckToken),F$(n,x$,c))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new hO(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(Ate)),rte(()=>{if(this.isClosed_)return;this.scriptTagHolder=new fO((...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===qG)this.id=a,this.password=c;else if(s===gte)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[qG]="t",t[V$]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(t[Ete]=this.scriptTagHolder.uniqueCallbackIdentifier),t[C$]=FI,this.transportSessionId&&(t[N$]=this.transportSessionId),this.lastSessionId&&(t[L$]=this.lastSessionId),this.applicationId&&(t[M$]=this.applicationId),this.appCheckToken&&(t[uO]=this.appCheckToken),typeof location<"u"&&location.hostname&&w$.test(location.hostname)&&(t[O$]=b$);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(){r.forceAllow_=!0}static forceDisallow(){r.forceDisallow_=!0}static isAvailable(){return Lo()?!1:r.forceAllow_?!0:!r.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!ote()&&!ste()}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 n=Xt(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);let t=JC(n),i=R$(t,yte);for(let o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++}addDisconnectPingFrame(e,n){if(Lo())return;this.myDisconnFrame=document.createElement("iframe");let t={};t[vte]="t",t[k$]=e,t[U$]=n,this.myDisconnFrame.src=this.urlFn(t),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let n=Xt(e).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}},fO=class r{constructor(e,n,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,Lo())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=S$(),window[mte+this.uniqueCallbackIdentifier]=e,window[pte+this.uniqueCallbackIdentifier]=n,this.myIFrame=r.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){An("frame writing exception"),a.stack&&An(a.stack),An(a)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||An("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,n){for(this.myID=e,this.myPW=n,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[k$]=this.myID,e[U$]=this.myPW,e[V$]=this.currentSerial;let n=this.urlFn(e),t="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+G$+t.length<=B$;){let s=this.pendingSegs.shift();t=t+"&"+_te+i+"="+s.seg+"&"+Tte+i+"="+s.ts+"&"+Ite+i+"="+s.d,i++}return n=n+t,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,t){this.pendingSegs.push({seg:e,ts:n,d:t}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);let t=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(t,Math.floor(Ste)),o=()=>{clearTimeout(i),t()};this.addTag(e,o)}addTag(e,n){Lo()?this.doNodeLongPoll(e,n):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),n())},t.onerror=()=>{An("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(t)}catch{}},Math.floor(1))}};var Rte=16384,Dte=45e3,VI=null;typeof MozWebSocket<"u"?VI=MozWebSocket:typeof WebSocket<"u"&&(VI=WebSocket);var $d=(()=>{class r{constructor(n,t,i,o,s,a,c){this.connId=n,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_=Sm(this.connId),this.stats_=ib(t),this.connURL=r.connectionURL_(t,a,c,o,i),this.nodeAdmin=t.nodeAdmin}static connectionURL_(n,t,i,o,s){let a={};return a[C$]=FI,!Lo()&&typeof location<"u"&&location.hostname&&w$.test(location.hostname)&&(a[O$]=b$),t&&(a[N$]=t),i&&(a[L$]=i),o&&(a[uO]=o),s&&(a[M$]=s),F$(n,P$,a)}open(n,t){this.onDisconnect=t,this.onMessage=n,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Dl.set("previous_websocket_failure",!0);try{let i;if(Lo()){let o=this.nodeAdmin?"AdminNode":"Node";i={headers:{"User-Agent":`Firebase/${FI}/${nb}/${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 VI(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(){r.forceDisallow_=!0}static isAvailable(){let n=!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&&(n=!0)}return!n&&VI!==null&&!r.forceDisallow_}static previouslyFailed(){return Dl.isInMemoryStorage||Dl.get("previous_websocket_failure")===!0}markConnectionHealthy(){Dl.remove("previous_websocket_failure")}appendFrame_(n){if(this.frames.push(n),this.frames.length===this.totalFrames){let t=this.frames.join("");this.frames=null;let i=xd(t);this.onMessage(i)}}handleNewFrameCount_(n){this.totalFrames=n,this.frames=[]}extractFrameCount_(n){if(te(this.frames===null,"We already have a frame buffer"),n.length<=6){let t=Number(n);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),n}handleIncomingFrame(n){if(this.mySock===null)return;let t=n.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(n){this.resetKeepAlive();let t=Xt(n);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let i=R$(t,Rte);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(Dte))}sendString_(n){try{this.mySock.send(n)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}r.responsesRequiredToBeHealthy=2,r.healthyTimeout=3e4;return r})(),$$=(()=>{class r{static get ALL_TRANSPORTS(){return[UI,$d]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(n){this.initTransports_(n)}initTransports_(n){let t=$d&&$d.isAvailable(),i=t&&!$d.previouslyFailed();if(n.webSocketOnly&&(t||Jn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[$d];else{let o=this.transports_=[];for(let s of r.ALL_TRANSPORTS)s&&s.isAvailable()&&o.push(s);r.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}}r.globalTransportInitialized_=!1;return r})(),Cte=6e4,Nte=5e3,Ote=10*1024,bte=100*1024,ZN="t",KG="d",wte="s",YG="r",Lte="e",QG="o",XG="a",JG="n",ZG="p",Mte="h",gO=class{constructor(e,n,t,i,o,s,a,c,l,u){this.id=e,this.repoInfo_=n,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_=Sm("c:"+this.id+":"),this.transportManager_=new $$(n),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 n=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(n,t)},Math.floor(0));let i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=om(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>bte?(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>Ote?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 n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){let n={t:"d",d:e};this.sendData_(n)}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(ZN in e){let n=e[ZN];n===XG?this.upgradeIfSecondaryHealthy_():n===YG?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===QG&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let n=tm("t",e),t=tm("d",e);if(n==="c")this.onSecondaryControl_(t);else if(n==="d")this.pendingDataMessages.push(t);else throw new Error("Unknown protocol layer: "+n)}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:ZG,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:JG,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let n=tm("t",e),t=tm("d",e);n==="c"?this.onControl_(t):n==="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 n=tm(ZN,e);if(KG in e){let t=e[KG];if(n===Mte){let i=Object.assign({},t);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(n===JG){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 n===wte?this.onConnectionShutdown_(t):n===YG?this.onReset_(t):n===Lte?aO("Server Error: "+t):n===QG?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):aO("Unknown control packet command: "+n)}}onHandshake_(e){let n=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_,n),FI!==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 n=this.connReceiver_(this.secondaryConn_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,t),om(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Cte))}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,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):om(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Nte))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:ZG,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()&&(Dl.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 BI=class{put(e,n,t,i){}merge(e,n,t,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,t){}onDisconnectMerge(e,n,t){}onDisconnectCancel(e,n){}reportStats(e){}};var GI=class{constructor(e){this.allowedEvents_=e,this.listeners_={},te(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){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,n)}}on(e,n,t){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:t});let i=this.getInitialEvent(e);i&&n.apply(t,i)}off(e,n,t){this.validateEventType_(e);let i=this.listeners_[e]||[];for(let o=0;o<i.length;o++)if(i[o].callback===n&&(!t||t===i[o].context)){i.splice(o,1);return}}validateEventType_(e){te(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}};var $I=class r extends GI{static getInstance(){return new r}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!kg()&&(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 te(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var e$=32,t$=768,qe=class{constructor(e,n){if(n===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_=n}toString(){let e="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)this.pieces_[n]!==""&&(e+="/"+this.pieces_[n]);return e||"/"}};function ze(){return new qe("")}function xe(r){return r.pieceNum_>=r.pieces_.length?null:r.pieces_[r.pieceNum_]}function Pa(r){return r.pieces_.length-r.pieceNum_}function ht(r){let e=r.pieceNum_;return e<r.pieces_.length&&e++,new qe(r.pieces_,e)}function ob(r){return r.pieceNum_<r.pieces_.length?r.pieces_[r.pieces_.length-1]:null}function Pte(r){let e="";for(let n=r.pieceNum_;n<r.pieces_.length;n++)r.pieces_[n]!==""&&(e+="/"+encodeURIComponent(String(r.pieces_[n])));return e||"/"}function um(r,e=0){return r.pieces_.slice(r.pieceNum_+e)}function j$(r){if(r.pieceNum_>=r.pieces_.length)return null;let e=[];for(let n=r.pieceNum_;n<r.pieces_.length-1;n++)e.push(r.pieces_[n]);return new qe(e,0)}function kt(r,e){let n=[];for(let t=r.pieceNum_;t<r.pieces_.length;t++)n.push(r.pieces_[t]);if(e instanceof qe)for(let t=e.pieceNum_;t<e.pieces_.length;t++)n.push(e.pieces_[t]);else{let t=e.split("/");for(let i=0;i<t.length;i++)t[i].length>0&&n.push(t[i])}return new qe(n,0)}function Fe(r){return r.pieceNum_>=r.pieces_.length}function dr(r,e){let n=xe(r),t=xe(e);if(n===null)return e;if(n===t)return dr(ht(r),ht(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+r+")")}function xte(r,e){let n=um(r,0),t=um(e,0);for(let i=0;i<n.length&&i<t.length;i++){let o=xl(n[i],t[i]);if(o!==0)return o}return n.length===t.length?0:n.length<t.length?-1:1}function sb(r,e){if(Pa(r)!==Pa(e))return!1;for(let n=r.pieceNum_,t=e.pieceNum_;n<=r.pieces_.length;n++,t++)if(r.pieces_[n]!==e.pieces_[t])return!1;return!0}function _i(r,e){let n=r.pieceNum_,t=e.pieceNum_;if(Pa(r)>Pa(e))return!1;for(;n<r.pieces_.length;){if(r.pieces_[n]!==e.pieces_[t])return!1;++n,++t}return!0}var mO=class{constructor(e,n){this.errorPrefix_=n,this.parts_=um(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let t=0;t<this.parts_.length;t++)this.byteLength_+=Gg(this.parts_[t]);H$(this)}};function Fte(r,e){r.parts_.length>0&&(r.byteLength_+=1),r.parts_.push(e),r.byteLength_+=Gg(e),H$(r)}function kte(r){let e=r.parts_.pop();r.byteLength_-=Gg(e),r.parts_.length>0&&(r.byteLength_-=1)}function H$(r){if(r.byteLength_>t$)throw new Error(r.errorPrefix_+"has a key path longer than "+t$+" bytes ("+r.byteLength_+").");if(r.parts_.length>e$)throw new Error(r.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+e$+") or object contains a cycle "+Rl(r))}function Rl(r){return r.parts_.length===0?"":"in property '"+r.parts_.join(".")+"'"}var pO=class r extends GI{static getInstance(){return new r}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}getInitialEvent(e){return te(e==="visible","Unknown event type: "+e),[this.visible_]}};var nm=1e3,Ute=300*1e3,n$=30*1e3,Vte=1.3,Bte=3e4,Gte="server_kill",r$=3,ab=(()=>{class r extends BI{constructor(n,t,i,o,s,a,c,l){if(super(),this.repoInfo_=n,this.applicationId_=t,this.onDataUpdate_=i,this.onConnectStatus_=o,this.onServerInfoUpdate_=s,this.authTokenProvider_=a,this.appCheckTokenProvider_=c,this.authOverride_=l,this.id=r.nextPersistentConnectionId_++,this.log_=Sm("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_=nm,this.maxReconnectDelay_=Ute,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&&!Lo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");pO.getInstance().on("visible",this.onVisible_,this),n.host.indexOf("fblocal")===-1&&$I.getInstance().on("online",this.onOnline_,this)}sendRequest(n,t,i){let o=++this.requestNumber_,s={r:o,a:n,b:t};this.log_(Xt(s)),te(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),i&&(this.requestCBHash_[o]=i)}get(n){this.initConnection_();let t=new Sn,o={action:"g",request:{p:n._path.toString(),q:n._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(n,t,i,o){this.initConnection_();let s=n._queryIdentifier,a=n._path.toString();this.log_("Listen called for "+a+" "+s),this.listens.has(a)||this.listens.set(a,new Map),te(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"listen() called for non-default but complete query"),te(!this.listens.get(a).has(s),"listen() called twice for same path/queryId.");let c={onComplete:o,hashFn:t,query:n,tag:i};this.listens.get(a).set(s,c),this.connected_&&this.sendListen_(c)}sendGet_(n){let t=this.outstandingGets_[n];this.sendRequest("g",t.request,i=>{delete this.outstandingGets_[n],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(i)})}sendListen_(n){let t=n.query,i=t._path.toString(),o=t._queryIdentifier;this.log_("Listen on "+i+" for "+o);let s={p:i},a="q";n.tag&&(s.q=t._queryObject,s.t=n.tag),s.h=n.hashFn(),this.sendRequest(a,s,c=>{let l=c.d,u=c.s;r.warnOnListenWarnings_(l,t),(this.listens.get(i)&&this.listens.get(i).get(o))===n&&(this.log_("listen response",c),u!=="ok"&&this.removeListen_(i,o),n.onComplete&&n.onComplete(u,l))})}static warnOnListenWarnings_(n,t){if(n&&typeof n=="object"&&mi(n,"w")){let i=Ia(n,"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(n){this.authToken_=n,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(n)}reduceReconnectDelayIfAdminCredential_(n){(n&&n.length===40||IB(n))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=n$)}refreshAppCheckToken(n){this.appCheckToken_=n,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let n=this.authToken_,t=TB(n)?"auth":"gauth",i={cred:n};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_===n&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},n=>{let t=n.s,i=n.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,i)})}unlisten(n,t){let i=n._path.toString(),o=n._queryIdentifier;this.log_("Unlisten called for "+i+" "+o),te(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,o)&&this.connected_&&this.sendUnlisten_(i,o,n._queryObject,t)}sendUnlisten_(n,t,i,o){this.log_("Unlisten on "+n+" for "+t);let s={p:n},a="n";o&&(s.q=i,s.t=o),this.sendRequest(a,s)}onDisconnectPut(n,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",n,t,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"o",data:t,onComplete:i})}onDisconnectMerge(n,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",n,t,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"om",data:t,onComplete:i})}onDisconnectCancel(n,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",n,null,t):this.onDisconnectRequestQueue_.push({pathString:n,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(n,t,i,o){let s={p:t,d:i};this.log_("onDisconnect "+n,s),this.sendRequest(n,s,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(n,t,i,o){this.putInternal("p",n,t,i,o)}merge(n,t,i,o){this.putInternal("m",n,t,i,o)}putInternal(n,t,i,o,s){this.initConnection_();let a={p:t,d:i};s!==void 0&&(a.h=s),this.outstandingPuts_.push({action:n,request:a,onComplete:o}),this.outstandingPutCount_++;let c=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(c):this.log_("Buffering put: "+t)}sendPut_(n){let t=this.outstandingPuts_[n].action,i=this.outstandingPuts_[n].request,o=this.outstandingPuts_[n].onComplete;this.outstandingPuts_[n].queued=this.connected_,this.sendRequest(t,i,s=>{this.log_(t+" response",s),delete this.outstandingPuts_[n],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(s.s,s.d)})}reportStats(n){if(this.connected_){let t={c:n};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_(n){if("r"in n){this.log_("from server: "+Xt(n));let t=n.r,i=this.requestCBHash_[t];i&&(delete this.requestCBHash_[t],i(n.b))}else{if("error"in n)throw"A server-side error has occurred: "+n.error;"a"in n&&this.onDataPush_(n.a,n.b)}}onDataPush_(n,t){this.log_("handleServerMessage",n,t),n==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):n==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):n==="c"?this.onListenRevoked_(t.p,t.q):n==="ac"?this.onAuthRevoked_(t.s,t.d):n==="apc"?this.onAppCheckRevoked_(t.s,t.d):n==="sd"?this.onSecurityDebugPacket_(t):aO("Unrecognized action received from server: "+Xt(n)+`
142
- Are you using the latest client?`)}onReady_(n,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(n),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(n){te(!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(n))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(n){n&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=nm,this.realtime_||this.scheduleConnect_(0)),this.visible_=n}onOnline_(n){n?(this.log_("Browser went online."),this.reconnectDelay_=nm,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_>Bte&&(this.reconnectDelay_=nm),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let n=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),t=Math.max(0,this.reconnectDelay_-n);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*Vte)}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 n=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+r.nextConnectionId_++,s=this.lastSessionId,a=!1,c=null,l=function(){c?c.close():(a=!0,i())},u=function(f){te(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?An("getToken() completed but was canceled"):(An("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=g&&g.token,c=new gO(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,n,t,i,p=>{Jn(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(Gte)},s))}catch(f){this.log_("Failed to get token: "+f),a||(this.repoInfo_.nodeAdmin&&Jn(f),l())}}})}interrupt(n){An("Interrupting connection for reason: "+n),this.interruptReasons_[n]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(n){An("Resuming connection for reason: "+n),delete this.interruptReasons_[n],Ug(this.interruptReasons_)&&(this.reconnectDelay_=nm,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(n){let t=n-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let n=0;n<this.outstandingPuts_.length;n++){let t=this.outstandingPuts_[n];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[n],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(n,t){let i;t?i=t.map(s=>rb(s)).join("$"):i="default";let o=this.removeListen_(n,i);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(n,t){let i=new qe(n).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_(n,t){An("Auth token revoked: "+n+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(n==="invalid_token"||n==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=r$&&(this.reconnectDelay_=n$,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(n,t){An("App check token revoked: "+n+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(n==="invalid_token"||n==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=r$&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(n){this.securityDebugCallback_?this.securityDebugCallback_(n):"msg"in n&&console.log("FIREBASE: "+n.msg.replace(`
143
- `,`
144
- FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(let n of this.listens.values())for(let t of n.values())this.sendListen_(t);for(let n=0;n<this.outstandingPuts_.length;n++)this.outstandingPuts_[n]&&this.sendPut_(n);for(;this.onDisconnectRequestQueue_.length;){let n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}for(let n=0;n<this.outstandingGets_.length;n++)this.outstandingGets_[n]&&this.sendGet_(n)}sendConnectStats_(){let n={},t="js";Lo()&&(this.repoInfo_.nodeAdmin?t="admin_node":t="node"),n["sdk."+t+"."+nb.replace(/\./g,"-")]=1,kg()?n["framework.cordova"]=1:dI()&&(n["framework.reactnative"]=1),this.reportStats(n)}shouldReconnect_(){let n=$I.getInstance().currentlyOnline();return Ug(this.interruptReasons_)&&n}}r.nextPersistentConnectionId_=0,r.nextConnectionId_=0;return r})(),Ue=class r{constructor(e,n){this.name=e,this.node=n}static Wrap(e,n){return new r(e,n)}};var Wd=class{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,n){let t=new Ue(Ol,e),i=new Ue(Ol,n);return this.compare(t,i)!==0}minPost(){return Ue.MIN}};var xI,jI=class extends Wd{static get __EMPTY_NODE(){return xI}static set __EMPTY_NODE(e){xI=e}compare(e,n){return xl(e.name,n.name)}isDefinedOn(e){throw fl("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,n){return!1}minPost(){return Ue.MIN}maxPost(){return new Ue(Ma,xI)}makePost(e,n){return te(typeof e=="string","KeyIndex indexValue must always be a string."),new Ue(e,xI)}toString(){return".key"}},Nl=new jI;var jd=class{constructor(e,n,t,i,o=null){this.isReverse_=i,this.resultGenerator_=o,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(e=e,s=n?t(e.key,n):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(),n;if(this.resultGenerator_?n=this.resultGenerator_(e.key,e.value):n={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 n}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}}},Wi=(()=>{class r{constructor(n,t,i,o,s){this.key=n,this.value=t,this.color=i??r.RED,this.left=o??Ti.EMPTY_NODE,this.right=s??Ti.EMPTY_NODE}copy(n,t,i,o,s){return new r(n??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(n){return this.left.inorderTraversal(n)||!!n(this.key,this.value)||this.right.inorderTraversal(n)}reverseTraversal(n){return this.right.reverseTraversal(n)||n(this.key,this.value)||this.left.reverseTraversal(n)}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(n,t,i){let o=this,s=i(n,o.key);return s<0?o=o.copy(null,null,null,o.left.insert(n,t,i),null):s===0?o=o.copy(null,t,null,null,null):o=o.copy(null,null,null,null,o.right.insert(n,t,i)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return Ti.EMPTY_NODE;let n=this;return!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.removeMin_(),null),n.fixUp_()}remove(n,t){let i,o;if(i=this,t(n,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(n,t),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),t(n,i.key)===0){if(i.right.isEmpty())return Ti.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(n,t))}return i.fixUp_()}isRed_(){return this.color}fixUp_(){let n=this;return n.right.isRed_()&&!n.left.isRed_()&&(n=n.rotateLeft_()),n.left.isRed_()&&n.left.left.isRed_()&&(n=n.rotateRight_()),n.left.isRed_()&&n.right.isRed_()&&(n=n.colorFlip_()),n}moveRedLeft_(){let n=this.colorFlip_();return n.right.left.isRed_()&&(n=n.copy(null,null,null,null,n.right.rotateRight_()),n=n.rotateLeft_(),n=n.colorFlip_()),n}moveRedRight_(){let n=this.colorFlip_();return n.left.left.isRed_()&&(n=n.rotateRight_(),n=n.colorFlip_()),n}rotateLeft_(){let n=this.copy(null,null,r.RED,null,this.right.left);return this.right.copy(null,null,this.color,n,null)}rotateRight_(){let n=this.copy(null,null,r.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,n)}colorFlip_(){let n=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,n,t)}checkMaxDepth_(){let n=this.check_();return Math.pow(2,n)<=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 n=this.left.check_();if(n!==this.right.check_())throw new Error("Black depths differ");return n+(this.isRed_()?0:1)}}return r.RED=!0,r.BLACK=!1,r})(),EO=class{copy(e,n,t,i,o){return this}insert(e,n,t){return new Wi(e,n,null)}remove(e,n){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}},Ti=class r{constructor(e,n=r.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new r(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,Wi.BLACK,null,null))}remove(e){return new r(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,Wi.BLACK,null,null))}get(e){let n,t=this.root_;for(;!t.isEmpty();){if(n=this.comparator_(e,t.key),n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}getPredecessorKey(e){let n,t=this.root_,i=null;for(;!t.isEmpty();)if(n=this.comparator_(e,t.key),n===0){if(t.left.isEmpty())return i?i.key:null;for(t=t.left;!t.right.isEmpty();)t=t.right;return t.key}else n<0?t=t.left:n>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 jd(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new jd(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new jd(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new jd(this.root_,null,this.comparator_,!0,e)}};Ti.EMPTY_NODE=new EO;function $te(r,e){return xl(r.name,e.name)}function cb(r,e){return xl(r,e)}var _O;function jte(r){_O=r}var W$=function(r){return typeof r=="number"?"number:"+D$(r):"string:"+r},z$=function(r){if(r.isLeafNode()){let e=r.val();te(typeof e=="string"||typeof e=="number"||typeof e=="object"&&mi(e,".sv"),"Priority must be a string or number.")}else te(r===_O||r.isEmpty(),"priority of unexpected type.");te(r===_O||r.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};var i$,zd=(()=>{class r{static set __childrenNodeConstructor(n){i$=n}static get __childrenNodeConstructor(){return i$}constructor(n,t=r.__childrenNodeConstructor.EMPTY_NODE){this.value_=n,this.priorityNode_=t,this.lazyHash_=null,te(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),z$(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(n){return new r(this.value_,n)}getImmediateChild(n){return n===".priority"?this.priorityNode_:r.__childrenNodeConstructor.EMPTY_NODE}getChild(n){return Fe(n)?this:xe(n)===".priority"?this.priorityNode_:r.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(n,t){return null}updateImmediateChild(n,t){return n===".priority"?this.updatePriority(t):t.isEmpty()&&n!==".priority"?this:r.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(n,t).updatePriority(this.priorityNode_)}updateChild(n,t){let i=xe(n);return i===null?t:t.isEmpty()&&i!==".priority"?this:(te(i!==".priority"||Pa(n)===1,".priority must be the last token in a path"),this.updateImmediateChild(i,r.__childrenNodeConstructor.EMPTY_NODE.updateChild(ht(n),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(n,t){return!1}val(n){return n&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let n="";this.priorityNode_.isEmpty()||(n+="priority:"+W$(this.priorityNode_.val())+":");let t=typeof this.value_;n+=t+":",t==="number"?n+=D$(this.value_):n+=this.value_,this.lazyHash_=A$(n)}return this.lazyHash_}getValue(){return this.value_}compareTo(n){return n===r.__childrenNodeConstructor.EMPTY_NODE?1:n instanceof r.__childrenNodeConstructor?-1:(te(n.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(n))}compareToLeafNode_(n){let t=typeof n.value_,i=typeof this.value_,o=r.VALUE_TYPE_ORDER.indexOf(t),s=r.VALUE_TYPE_ORDER.indexOf(i);return te(o>=0,"Unknown leaf type: "+t),te(s>=0,"Unknown leaf type: "+i),o===s?i==="object"?0:this.value_<n.value_?-1:this.value_===n.value_?0:1:s-o}withIndex(){return this}isIndexed(){return!0}equals(n){if(n===this)return!0;if(n.isLeafNode()){let t=n;return this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_)}else return!1}}r.VALUE_TYPE_ORDER=["object","boolean","number","string"];return r})(),q$,K$;function Hte(r){q$=r}function Wte(r){K$=r}var TO=class extends Wd{compare(e,n){let t=e.node.getPriority(),i=n.node.getPriority(),o=t.compareTo(i);return o===0?xl(e.name,n.name):o}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,n){return!e.getPriority().equals(n.getPriority())}minPost(){return Ue.MIN}maxPost(){return new Ue(Ma,new zd("[PRIORITY-POST]",K$))}makePost(e,n){let t=q$(e);return new Ue(n,new zd("[PRIORITY-POST]",t))}toString(){return".priority"}},yt=new TO;var zte=Math.log(2),IO=class{constructor(e){let n=o=>parseInt(Math.log(o)/zte,10),t=o=>parseInt(Array(o+1).join("1"),2);this.count=n(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}},HI=function(r,e,n,t){r.sort(e);let i=function(c,l){let u=l-c,d,f;if(u===0)return null;if(u===1)return d=r[c],f=n?n(d):d,new Wi(f,d.node,Wi.BLACK,null,null);{let g=parseInt(u/2,10)+c,p=i(c,g),_=i(g+1,l);return d=r[g],f=n?n(d):d,new Wi(f,d.node,Wi.BLACK,p,_)}},o=function(c){let l=null,u=null,d=r.length,f=function(p,_){let T=d-p,D=d;d-=p;let L=i(T+1,D),B=r[T],w=n?n(B):B;g(new Wi(w,B.node,_,null,L))},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,Wi.BLACK):(f(T,Wi.BLACK),f(T,Wi.RED))}return u},s=new IO(r.length),a=o(s);return new Ti(t||e,a)};var eO,Gd={},qd=class r{static get Default(){return te(Gd&&yt,"ChildrenNode.ts has not been loaded"),eO=eO||new r({".priority":Gd},{".priority":yt}),eO}constructor(e,n){this.indexes_=e,this.indexSet_=n}get(e){let n=Ia(this.indexes_,e);if(!n)throw new Error("No index defined for "+e);return n instanceof Ti?n:null}hasIndex(e){return mi(this.indexSet_,e.toString())}addIndex(e,n){te(e!==Nl,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let t=[],i=!1,o=n.getIterator(Ue.Wrap),s=o.getNext();for(;s;)i=i||e.isDefinedOn(s.node),t.push(s),s=o.getNext();let a;i?a=HI(t,e.getCompare()):a=Gd;let c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;let u=Object.assign({},this.indexes_);return u[c]=a,new r(u,l)}addToIndexes(e,n){let t=Vg(this.indexes_,(i,o)=>{let s=Ia(this.indexSet_,o);if(te(s,"Missing index implementation for "+o),i===Gd)if(s.isDefinedOn(e.node)){let a=[],c=n.getIterator(Ue.Wrap),l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),HI(a,s.getCompare())}else return Gd;else{let a=n.get(e.name),c=i;return a&&(c=c.remove(new Ue(e.name,a))),c.insert(e,e.node)}});return new r(t,this.indexSet_)}removeFromIndexes(e,n){let t=Vg(this.indexes_,i=>{if(i===Gd)return i;{let o=n.get(e.name);return o?i.remove(new Ue(e.name,o)):i}});return new r(t,this.indexSet_)}};var rm,Ne=(()=>{class r{static get EMPTY_NODE(){return rm||(rm=new r(new Ti(cb),null,qd.Default))}constructor(n,t,i){this.children_=n,this.priorityNode_=t,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&z$(this.priorityNode_),this.children_.isEmpty()&&te(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||rm}updatePriority(n){return this.children_.isEmpty()?this:new r(this.children_,n,this.indexMap_)}getImmediateChild(n){if(n===".priority")return this.getPriority();{let t=this.children_.get(n);return t===null?rm:t}}getChild(n){let t=xe(n);return t===null?this:this.getImmediateChild(t).getChild(ht(n))}hasChild(n){return this.children_.get(n)!==null}updateImmediateChild(n,t){if(te(t,"We should always be passing snapshot nodes"),n===".priority")return this.updatePriority(t);{let i=new Ue(n,t),o,s;t.isEmpty()?(o=this.children_.remove(n),s=this.indexMap_.removeFromIndexes(i,this.children_)):(o=this.children_.insert(n,t),s=this.indexMap_.addToIndexes(i,this.children_));let a=o.isEmpty()?rm:this.priorityNode_;return new r(o,a,s)}}updateChild(n,t){let i=xe(n);if(i===null)return t;{te(xe(n)!==".priority"||Pa(n)===1,".priority must be the last token in a path");let o=this.getImmediateChild(i).updateChild(ht(n),t);return this.updateImmediateChild(i,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(n){if(this.isEmpty())return null;let t={},i=0,o=0,s=!0;if(this.forEachChild(yt,(a,c)=>{t[a]=c.val(n),i++,s&&r.INTEGER_REGEXP_.test(a)?o=Math.max(o,Number(a)):s=!1}),!n&&s&&o<2*i){let a=[];for(let c in t)a[c]=t[c];return a}else return n&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let n="";this.getPriority().isEmpty()||(n+="priority:"+W$(this.getPriority().val())+":"),this.forEachChild(yt,(t,i)=>{let o=i.hash();o!==""&&(n+=":"+t+":"+o)}),this.lazyHash_=n===""?"":A$(n)}return this.lazyHash_}getPredecessorChildName(n,t,i){let o=this.resolveIndex_(i);if(o){let s=o.getPredecessorKey(new Ue(n,t));return s?s.name:null}else return this.children_.getPredecessorKey(n)}getFirstChildName(n){let t=this.resolveIndex_(n);if(t){let i=t.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(n){let t=this.getFirstChildName(n);return t?new Ue(t,this.children_.get(t)):null}getLastChildName(n){let t=this.resolveIndex_(n);if(t){let i=t.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(n){let t=this.getLastChildName(n);return t?new Ue(t,this.children_.get(t)):null}forEachChild(n,t){let i=this.resolveIndex_(n);return i?i.inorderTraversal(o=>t(o.name,o.node)):this.children_.inorderTraversal(t)}getIterator(n){return this.getIteratorFrom(n.minPost(),n)}getIteratorFrom(n,t){let i=this.resolveIndex_(t);if(i)return i.getIteratorFrom(n,o=>o);{let o=this.children_.getIteratorFrom(n.name,Ue.Wrap),s=o.peek();for(;s!=null&&t.compare(s,n)<0;)o.getNext(),s=o.peek();return o}}getReverseIterator(n){return this.getReverseIteratorFrom(n.maxPost(),n)}getReverseIteratorFrom(n,t){let i=this.resolveIndex_(t);if(i)return i.getReverseIteratorFrom(n,o=>o);{let o=this.children_.getReverseIteratorFrom(n.name,Ue.Wrap),s=o.peek();for(;s!=null&&t.compare(s,n)>0;)o.getNext(),s=o.peek();return o}}compareTo(n){return this.isEmpty()?n.isEmpty()?0:-1:n.isLeafNode()||n.isEmpty()?1:n===Am?-1:0}withIndex(n){if(n===Nl||this.indexMap_.hasIndex(n))return this;{let t=this.indexMap_.addIndex(n,this.children_);return new r(this.children_,this.priorityNode_,t)}}isIndexed(n){return n===Nl||this.indexMap_.hasIndex(n)}equals(n){if(n===this)return!0;if(n.isLeafNode())return!1;{let t=n;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){let i=this.getIterator(yt),o=t.getIterator(yt),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_(n){return n===Nl?null:this.indexMap_.get(n.toString())}}return r.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,r})(),vO=class extends Ne{constructor(){super(new Ti(cb),Ne.EMPTY_NODE,qd.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}},Am=new vO;Object.defineProperties(Ue,{MIN:{value:new Ue(Ol,Ne.EMPTY_NODE)},MAX:{value:new Ue(Ma,Am)}});jI.__EMPTY_NODE=Ne.EMPTY_NODE;zd.__childrenNodeConstructor=Ne;jte(Am);Wte(Am);var qte=!0;function Ft(r,e=null){if(r===null)return Ne.EMPTY_NODE;if(typeof r=="object"&&".priority"in r&&(e=r[".priority"]),te(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof r=="object"&&".value"in r&&r[".value"]!==null&&(r=r[".value"]),typeof r!="object"||".sv"in r){let n=r;return new zd(n,Ft(e))}if(!(r instanceof Array)&&qte){let n=[],t=!1;if(Rn(r,(s,a)=>{if(s.substring(0,1)!=="."){let c=Ft(a);c.isEmpty()||(t=t||!c.getPriority().isEmpty(),n.push(new Ue(s,c)))}}),n.length===0)return Ne.EMPTY_NODE;let o=HI(n,$te,s=>s.name,cb);if(t){let s=HI(n,yt.getCompare());return new Ne(o,Ft(e),new qd({".priority":s},{".priority":yt}))}else return new Ne(o,Ft(e),qd.Default)}else{let n=Ne.EMPTY_NODE;return Rn(r,(t,i)=>{if(mi(r,t)&&t.substring(0,1)!=="."){let o=Ft(i);(o.isLeafNode()||!o.isEmpty())&&(n=n.updateImmediateChild(t,o))}}),n.updatePriority(Ft(e))}}Hte(Ft);var dm=class extends Wd{constructor(e){super(),this.indexPath_=e,te(!Fe(e)&&xe(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,n){let t=this.extractChild(e.node),i=this.extractChild(n.node),o=t.compareTo(i);return o===0?xl(e.name,n.name):o}makePost(e,n){let t=Ft(e),i=Ne.EMPTY_NODE.updateChild(this.indexPath_,t);return new Ue(n,i)}maxPost(){let e=Ne.EMPTY_NODE.updateChild(this.indexPath_,Am);return new Ue(Ma,e)}toString(){return um(this.indexPath_,0).join("/")}};var yO=class extends Wd{compare(e,n){let t=e.node.compareTo(n.node);return t===0?xl(e.name,n.name):t}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return Ue.MIN}maxPost(){return Ue.MAX}makePost(e,n){let t=Ft(e);return new Ue(n,t)}toString(){return".value"}},Y$=new yO;function Q$(r){return{type:"value",snapshotNode:r}}function Kd(r,e){return{type:"child_added",snapshotNode:e,childName:r}}function hm(r,e){return{type:"child_removed",snapshotNode:e,childName:r}}function fm(r,e,n){return{type:"child_changed",snapshotNode:e,childName:r,oldSnap:n}}function Kte(r,e){return{type:"child_moved",snapshotNode:e,childName:r}}var gm=class{constructor(e){this.index_=e}updateChild(e,n,t,i,o,s){te(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let a=e.getImmediateChild(n);return a.getChild(i).equals(t.getChild(i))&&a.isEmpty()===t.isEmpty()||(s!=null&&(t.isEmpty()?e.hasChild(n)?s.trackChildChange(hm(n,a)):te(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?s.trackChildChange(Kd(n,t)):s.trackChildChange(fm(n,t,a))),e.isLeafNode()&&t.isEmpty())?e:e.updateImmediateChild(n,t).withIndex(this.index_)}updateFullNode(e,n,t){return t!=null&&(e.isLeafNode()||e.forEachChild(yt,(i,o)=>{n.hasChild(i)||t.trackChildChange(hm(i,o))}),n.isLeafNode()||n.forEachChild(yt,(i,o)=>{if(e.hasChild(i)){let s=e.getImmediateChild(i);s.equals(o)||t.trackChildChange(fm(i,o,s))}else t.trackChildChange(Kd(i,o))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?Ne.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}};var WI=class r{constructor(e){this.indexedFilter_=new gm(e.getIndex()),this.index_=e.getIndex(),this.startPost_=r.getStartPost_(e),this.endPost_=r.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let n=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 n&&t}updateChild(e,n,t,i,o,s){return this.matches(new Ue(n,t))||(t=Ne.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,t,i,o,s)}updateFullNode(e,n,t){n.isLeafNode()&&(n=Ne.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(Ne.EMPTY_NODE);let o=this;return n.forEachChild(yt,(s,a)=>{o.matches(new Ue(s,a))||(i=i.updateImmediateChild(s,Ne.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,t)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){let n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){let n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}};var SO=class{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{let t=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?t<=0:t<0},this.withinEndPost=n=>{let t=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?t<=0:t<0},this.rangedFilter_=new WI(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,t,i,o,s){return this.rangedFilter_.matches(new Ue(n,t))||(t=Ne.EMPTY_NODE),e.getImmediateChild(n).equals(t)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,n,t,i,o,s):this.fullLimitUpdateChild_(e,n,t,o,s)}updateFullNode(e,n,t){let i;if(n.isLeafNode()||n.isEmpty())i=Ne.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<n.numChildren()&&n.isIndexed(this.index_)){i=Ne.EMPTY_NODE.withIndex(this.index_);let o;this.reverse_?o=n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):o=n.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=n.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,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,n,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;te(a.numChildren()===this.limit_,"");let c=new Ue(n,t),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(c);if(a.hasChild(n)){let d=a.getImmediateChild(n),f=i.getChildAfterChild(this.index_,l,this.reverse_);for(;f!=null&&(f.name===n||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(fm(n,t,d)),a.updateImmediateChild(n,t);{o?.trackChildChange(hm(n,d));let _=a.updateImmediateChild(n,Ne.EMPTY_NODE);return f!=null&&this.rangedFilter_.matches(f)?(o?.trackChildChange(Kd(f.name,f.node)),_.updateImmediateChild(f.name,f.node)):_}}else return t.isEmpty()?e:u&&s(l,c)>=0?(o!=null&&(o.trackChildChange(hm(l.name,l.node)),o.trackChildChange(Kd(n,t))),a.updateImmediateChild(n,t).updateImmediateChild(l.name,Ne.EMPTY_NODE)):e}};var AO=class r{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_=yt}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return te(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return te(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Ol}hasEnd(){return this.endSet_}getIndexEndValue(){return te(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return te(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Ma}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return te(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_===yt}copy(){let e=new r;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 Yte(r){return r.loadsAllData()?new gm(r.getIndex()):r.hasLimit()?new SO(r):new WI(r)}function Qte(r,e){let n=r.copy();return n.limitSet_=!0,n.limit_=e,n.viewFrom_="r",n}function Xte(r,e,n){let t=r.copy();return t.startSet_=!0,e===void 0&&(e=null),t.indexStartValue_=e,n!=null?(t.startNameSet_=!0,t.indexStartName_=n):(t.startNameSet_=!1,t.indexStartName_=""),t}function Jte(r,e,n){let t=r.copy();return t.endSet_=!0,e===void 0&&(e=null),t.indexEndValue_=e,n!==void 0?(t.endNameSet_=!0,t.indexEndName_=n):(t.endNameSet_=!1,t.indexEndName_=""),t}function Zte(r,e){let n=r.copy();return n.index_=e,n}function o$(r){let e={};if(r.isDefault())return e;let n;if(r.index_===yt?n="$priority":r.index_===Y$?n="$value":r.index_===Nl?n="$key":(te(r.index_ instanceof dm,"Unrecognized index type!"),n=r.index_.toString()),e.orderBy=Xt(n),r.startSet_){let t=r.startAfterSet_?"startAfter":"startAt";e[t]=Xt(r.indexStartValue_),r.startNameSet_&&(e[t]+=","+Xt(r.indexStartName_))}if(r.endSet_){let t=r.endBeforeSet_?"endBefore":"endAt";e[t]=Xt(r.indexEndValue_),r.endNameSet_&&(e[t]+=","+Xt(r.indexEndName_))}return r.limitSet_&&(r.isViewFromLeft()?e.limitToFirst=r.limit_:e.limitToLast=r.limit_),e}function s$(r){let e={};if(r.startSet_&&(e.sp=r.indexStartValue_,r.startNameSet_&&(e.sn=r.indexStartName_),e.sin=!r.startAfterSet_),r.endSet_&&(e.ep=r.indexEndValue_,r.endNameSet_&&(e.en=r.indexEndName_),e.ein=!r.endBeforeSet_),r.limitSet_){e.l=r.limit_;let n=r.viewFrom_;n===""&&(r.isViewFromLeft()?n="l":n="r"),e.vf=n}return r.index_!==yt&&(e.i=r.index_.toString()),e}var RO=class r extends BI{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(te(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,n,t,i){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=t,this.appCheckTokenProvider_=i,this.log_=Sm("p:rest:"),this.listens_={}}listen(e,n,t,i){let o=e._path.toString();this.log_("Listen called for "+o+" "+e._queryIdentifier);let s=r.getListenId_(e,t),a={};this.listens_[s]=a;let c=o$(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),Ia(this.listens_,s)===a){let f;l?l===401?f="permission_denied":f="rest_error:"+l:f="ok",i(f,null)}})}unlisten(e,n){let t=r.getListenId_(e,n);delete this.listens_[t]}get(e){let n=o$(e._queryParams),t=e._path.toString(),i=new Sn;return this.restRequest_(t+".json",n,(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,n={},t){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,o])=>{i&&i.accessToken&&(n.auth=i.accessToken),o&&o.token&&(n.ac=o.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+Bg(n);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=xd(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 DO=class{constructor(){this.rootNode_=Ne.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}};function zI(){return{value:null,children:new Map}}function eh(r,e,n){if(Fe(e))r.value=n,r.children.clear();else if(r.value!==null)r.value=r.value.updateChild(e,n);else{let t=xe(e);r.children.has(t)||r.children.set(t,zI());let i=r.children.get(t);e=ht(e),eh(i,e,n)}}function CO(r,e){if(Fe(e))return r.value=null,r.children.clear(),!0;if(r.value!==null){if(r.value.isLeafNode())return!1;{let n=r.value;return r.value=null,n.forEachChild(yt,(t,i)=>{eh(r,new qe(t),i)}),CO(r,e)}}else if(r.children.size>0){let n=xe(e);return e=ht(e),r.children.has(n)&&CO(r.children.get(n),e)&&r.children.delete(n),r.children.size===0}else return!0}function NO(r,e,n){r.value!==null?n(e,r.value):ene(r,(t,i)=>{let o=new qe(e.toString()+"/"+t);NO(i,o,n)})}function ene(r,e){r.children.forEach((n,t)=>{e(t,n)})}var OO=class{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),n=Object.assign({},e);return this.last_&&Rn(this.last_,(t,i)=>{n[t]=n[t]-i}),this.last_=e,n}};var a$=10*1e3,tne=30*1e3,nne=300*1e3,bO=class{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new OO(e);let t=a$+(tne-a$)*Math.random();om(this.reportStats_.bind(this),Math.floor(t))}reportStats_(){let e=this.statsListener_.get(),n={},t=!1;Rn(e,(i,o)=>{o>0&&mi(this.statsToReport_,i)&&(n[i]=o,t=!0)}),t&&this.server_.reportStats(n),om(this.reportStats_.bind(this),Math.floor(Math.random()*2*nne))}};var Fo=(function(r){return r[r.OVERWRITE=0]="OVERWRITE",r[r.MERGE=1]="MERGE",r[r.ACK_USER_WRITE=2]="ACK_USER_WRITE",r[r.LISTEN_COMPLETE=3]="LISTEN_COMPLETE",r})(Fo||{});function lb(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function ub(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function db(r){return{fromUser:!1,fromServer:!0,queryId:r,tagged:!0}}var wO=class r{constructor(e,n,t){this.path=e,this.affectedTree=n,this.revert=t,this.type=Fo.ACK_USER_WRITE,this.source=lb()}operationForChild(e){if(Fe(this.path)){if(this.affectedTree.value!=null)return te(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let n=this.affectedTree.subtree(new qe(e));return new r(ze(),n,this.revert)}}else return te(xe(this.path)===e,"operationForChild called for unrelated child."),new r(ht(this.path),this.affectedTree,this.revert)}};var qI=class r{constructor(e,n){this.source=e,this.path=n,this.type=Fo.LISTEN_COMPLETE}operationForChild(e){return Fe(this.path)?new r(this.source,ze()):new r(this.source,ht(this.path))}};var Yd=class r{constructor(e,n,t){this.source=e,this.path=n,this.snap=t,this.type=Fo.OVERWRITE}operationForChild(e){return Fe(this.path)?new r(this.source,ze(),this.snap.getImmediateChild(e)):new r(this.source,ht(this.path),this.snap)}};var mm=class r{constructor(e,n,t){this.source=e,this.path=n,this.children=t,this.type=Fo.MERGE}operationForChild(e){if(Fe(this.path)){let n=this.children.subtree(new qe(e));return n.isEmpty()?null:n.value?new Yd(this.source,ze(),n.value):new r(this.source,ze(),n)}else return te(xe(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new r(this.source,ht(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}};var ko=class{constructor(e,n,t){this.node_=e,this.fullyInitialized_=n,this.filtered_=t}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(Fe(e))return this.isFullyInitialized()&&!this.filtered_;let n=xe(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}};var LO=class{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}};function rne(r,e,n,t){let i=[],o=[];return e.forEach(s=>{s.type==="child_changed"&&r.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&o.push(Kte(s.childName,s.snapshotNode))}),im(r,i,"child_removed",e,t,n),im(r,i,"child_added",e,t,n),im(r,i,"child_moved",o,t,n),im(r,i,"child_changed",e,t,n),im(r,i,"value",e,t,n),i}function im(r,e,n,t,i,o){let s=t.filter(a=>a.type===n);s.sort((a,c)=>one(r,a,c)),s.forEach(a=>{let c=ine(r,a,o);i.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,r.query_))})})}function ine(r,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,r.index_)),e}function one(r,e,n){if(e.childName==null||n.childName==null)throw fl("Should only compare child_ events.");let t=new Ue(e.childName,e.snapshotNode),i=new Ue(n.childName,n.snapshotNode);return r.index_.compare(t,i)}function cv(r,e){return{eventCache:r,serverCache:e}}function am(r,e,n,t){return cv(new ko(e,n,t),r.serverCache)}function X$(r,e,n,t){return cv(r.eventCache,new ko(e,n,t))}function KI(r){return r.eventCache.isFullyInitialized()?r.eventCache.getNode():null}function bl(r){return r.serverCache.isFullyInitialized()?r.serverCache.getNode():null}var tO,sne=()=>(tO||(tO=new Ti(ite)),tO),hr=class r{static fromObject(e){let n=new r(null);return Rn(e,(t,i)=>{n=n.set(new qe(t),i)}),n}constructor(e,n=sne()){this.value=e,this.children=n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:ze(),value:this.value};if(Fe(e))return null;{let t=xe(e),i=this.children.get(t);if(i!==null){let o=i.findRootMostMatchingPathAndValue(ht(e),n);return o!=null?{path:kt(new qe(t),o.path),value:o.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(Fe(e))return this;{let n=xe(e),t=this.children.get(n);return t!==null?t.subtree(ht(e)):new r(null)}}set(e,n){if(Fe(e))return new r(n,this.children);{let t=xe(e),o=(this.children.get(t)||new r(null)).set(ht(e),n),s=this.children.insert(t,o);return new r(this.value,s)}}remove(e){if(Fe(e))return this.children.isEmpty()?new r(null):new r(null,this.children);{let n=xe(e),t=this.children.get(n);if(t){let i=t.remove(ht(e)),o;return i.isEmpty()?o=this.children.remove(n):o=this.children.insert(n,i),this.value===null&&o.isEmpty()?new r(null):new r(this.value,o)}else return this}}get(e){if(Fe(e))return this.value;{let n=xe(e),t=this.children.get(n);return t?t.get(ht(e)):null}}setTree(e,n){if(Fe(e))return n;{let t=xe(e),o=(this.children.get(t)||new r(null)).setTree(ht(e),n),s;return o.isEmpty()?s=this.children.remove(t):s=this.children.insert(t,o),new r(this.value,s)}}fold(e){return this.fold_(ze(),e)}fold_(e,n){let t={};return this.children.inorderTraversal((i,o)=>{t[i]=o.fold_(kt(e,i),n)}),n(e,this.value,t)}findOnPath(e,n){return this.findOnPath_(e,ze(),n)}findOnPath_(e,n,t){let i=this.value?t(n,this.value):!1;if(i)return i;if(Fe(e))return null;{let o=xe(e),s=this.children.get(o);return s?s.findOnPath_(ht(e),kt(n,o),t):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,ze(),n)}foreachOnPath_(e,n,t){if(Fe(e))return this;{this.value&&t(n,this.value);let i=xe(e),o=this.children.get(i);return o?o.foreachOnPath_(ht(e),kt(n,i),t):new r(null)}}foreach(e){this.foreach_(ze(),e)}foreach_(e,n){this.children.inorderTraversal((t,i)=>{i.foreach_(kt(e,t),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,t)=>{t.value&&e(n,t.value)})}};var zi=class r{constructor(e){this.writeTree_=e}static empty(){return new r(new hr(null))}};function cm(r,e,n){if(Fe(e))return new zi(new hr(n));{let t=r.writeTree_.findRootMostValueAndPath(e);if(t!=null){let i=t.path,o=t.value,s=dr(i,e);return o=o.updateChild(s,n),new zi(r.writeTree_.set(i,o))}else{let i=new hr(n),o=r.writeTree_.setTree(e,i);return new zi(o)}}}function MO(r,e,n){let t=r;return Rn(n,(i,o)=>{t=cm(t,kt(e,i),o)}),t}function c$(r,e){if(Fe(e))return zi.empty();{let n=r.writeTree_.setTree(e,new hr(null));return new zi(n)}}function PO(r,e){return Fl(r,e)!=null}function Fl(r,e){let n=r.writeTree_.findRootMostValueAndPath(e);return n!=null?r.writeTree_.get(n.path).getChild(dr(n.path,e)):null}function l$(r){let e=[],n=r.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(yt,(t,i)=>{e.push(new Ue(t,i))}):r.writeTree_.children.inorderTraversal((t,i)=>{i.value!=null&&e.push(new Ue(t,i.value))}),e}function wa(r,e){if(Fe(e))return r;{let n=Fl(r,e);return n!=null?new zi(new hr(n)):new zi(r.writeTree_.subtree(e))}}function xO(r){return r.writeTree_.isEmpty()}function Qd(r,e){return J$(ze(),r.writeTree_,e)}function J$(r,e,n){if(e.value!=null)return n.updateChild(r,e.value);{let t=null;return e.children.inorderTraversal((i,o)=>{i===".priority"?(te(o.value!==null,"Priority writes must always be leaf nodes"),t=o.value):n=J$(kt(r,i),o,n)}),!n.getChild(r).isEmpty()&&t!==null&&(n=n.updateChild(kt(r,".priority"),t)),n}}function lv(r,e){return n2(e,r)}function ane(r,e,n,t,i){te(t>r.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),r.allWrites.push({path:e,snap:n,writeId:t,visible:i}),i&&(r.visibleWrites=cm(r.visibleWrites,e,n)),r.lastWriteId=t}function cne(r,e,n,t){te(t>r.lastWriteId,"Stacking an older merge on top of newer ones"),r.allWrites.push({path:e,children:n,writeId:t,visible:!0}),r.visibleWrites=MO(r.visibleWrites,e,n),r.lastWriteId=t}function lne(r,e){for(let n=0;n<r.allWrites.length;n++){let t=r.allWrites[n];if(t.writeId===e)return t}return null}function une(r,e){let n=r.allWrites.findIndex(a=>a.writeId===e);te(n>=0,"removeWrite called with nonexistent writeId.");let t=r.allWrites[n];r.allWrites.splice(n,1);let i=t.visible,o=!1,s=r.allWrites.length-1;for(;i&&s>=0;){let a=r.allWrites[s];a.visible&&(s>=n&&dne(a,t.path)?i=!1:_i(t.path,a.path)&&(o=!0)),s--}if(i){if(o)return hne(r),!0;if(t.snap)r.visibleWrites=c$(r.visibleWrites,t.path);else{let a=t.children;Rn(a,c=>{r.visibleWrites=c$(r.visibleWrites,kt(t.path,c))})}return!0}else return!1}function dne(r,e){if(r.snap)return _i(r.path,e);for(let n in r.children)if(r.children.hasOwnProperty(n)&&_i(kt(r.path,n),e))return!0;return!1}function hne(r){r.visibleWrites=Z$(r.allWrites,fne,ze()),r.allWrites.length>0?r.lastWriteId=r.allWrites[r.allWrites.length-1].writeId:r.lastWriteId=-1}function fne(r){return r.visible}function Z$(r,e,n){let t=zi.empty();for(let i=0;i<r.length;++i){let o=r[i];if(e(o)){let s=o.path,a;if(o.snap)_i(n,s)?(a=dr(n,s),t=cm(t,a,o.snap)):_i(s,n)&&(a=dr(s,n),t=cm(t,ze(),o.snap.getChild(a)));else if(o.children){if(_i(n,s))a=dr(n,s),t=MO(t,a,o.children);else if(_i(s,n))if(a=dr(s,n),Fe(a))t=MO(t,ze(),o.children);else{let c=Ia(o.children,xe(a));if(c){let l=c.getChild(ht(a));t=cm(t,ze(),l)}}}else throw fl("WriteRecord should have .snap or .children")}}return t}function e2(r,e,n,t,i){if(!t&&!i){let o=Fl(r.visibleWrites,e);if(o!=null)return o;{let s=wa(r.visibleWrites,e);if(xO(s))return n;if(n==null&&!PO(s,ze()))return null;{let a=n||Ne.EMPTY_NODE;return Qd(s,a)}}}else{let o=wa(r.visibleWrites,e);if(!i&&xO(o))return n;if(!i&&n==null&&!PO(o,ze()))return null;{let s=function(l){return(l.visible||i)&&(!t||!~t.indexOf(l.writeId))&&(_i(l.path,e)||_i(e,l.path))},a=Z$(r.allWrites,s,e),c=n||Ne.EMPTY_NODE;return Qd(a,c)}}}function gne(r,e,n){let t=Ne.EMPTY_NODE,i=Fl(r.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(yt,(o,s)=>{t=t.updateImmediateChild(o,s)}),t;if(n){let o=wa(r.visibleWrites,e);return n.forEachChild(yt,(s,a)=>{let c=Qd(wa(o,new qe(s)),a);t=t.updateImmediateChild(s,c)}),l$(o).forEach(s=>{t=t.updateImmediateChild(s.name,s.node)}),t}else{let o=wa(r.visibleWrites,e);return l$(o).forEach(s=>{t=t.updateImmediateChild(s.name,s.node)}),t}}function mne(r,e,n,t,i){te(t||i,"Either existingEventSnap or existingServerSnap must exist");let o=kt(e,n);if(PO(r.visibleWrites,o))return null;{let s=wa(r.visibleWrites,o);return xO(s)?i.getChild(n):Qd(s,i.getChild(n))}}function pne(r,e,n,t){let i=kt(e,n),o=Fl(r.visibleWrites,i);if(o!=null)return o;if(t.isCompleteForChild(n)){let s=wa(r.visibleWrites,i);return Qd(s,t.getNode().getImmediateChild(n))}else return null}function Ene(r,e){return Fl(r.visibleWrites,e)}function _ne(r,e,n,t,i,o,s){let a,c=wa(r.visibleWrites,e),l=Fl(c,ze());if(l!=null)a=l;else if(n!=null)a=Qd(c,n);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 Tne(){return{visibleWrites:zi.empty(),allWrites:[],lastWriteId:-1}}function YI(r,e,n,t){return e2(r.writeTree,r.treePath,e,n,t)}function hb(r,e){return gne(r.writeTree,r.treePath,e)}function u$(r,e,n,t){return mne(r.writeTree,r.treePath,e,n,t)}function QI(r,e){return Ene(r.writeTree,kt(r.treePath,e))}function Ine(r,e,n,t,i,o){return _ne(r.writeTree,r.treePath,e,n,t,i,o)}function fb(r,e,n){return pne(r.writeTree,r.treePath,e,n)}function t2(r,e){return n2(kt(r.treePath,e),r.writeTree)}function n2(r,e){return{treePath:r,writeTree:e}}var FO=class{constructor(){this.changeMap=new Map}trackChildChange(e){let n=e.type,t=e.childName;te(n==="child_added"||n==="child_changed"||n==="child_removed","Only child changes supported for tracking"),te(t!==".priority","Only non-priority child changes can be tracked.");let i=this.changeMap.get(t);if(i){let o=i.type;if(n==="child_added"&&o==="child_removed")this.changeMap.set(t,fm(t,e.snapshotNode,i.snapshotNode));else if(n==="child_removed"&&o==="child_added")this.changeMap.delete(t);else if(n==="child_removed"&&o==="child_changed")this.changeMap.set(t,hm(t,i.oldSnap));else if(n==="child_changed"&&o==="child_added")this.changeMap.set(t,Kd(t,e.snapshotNode));else if(n==="child_changed"&&o==="child_changed")this.changeMap.set(t,fm(t,e.snapshotNode,i.oldSnap));else throw fl("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(t,e)}getChanges(){return Array.from(this.changeMap.values())}};var kO=class{getCompleteChild(e){return null}getChildAfterChild(e,n,t){return null}},r2=new kO,pm=class{constructor(e,n,t=null){this.writes_=e,this.viewCache_=n,this.optCompleteServerCache_=t}getCompleteChild(e){let n=this.viewCache_.eventCache;if(n.isCompleteForChild(e))return n.getNode().getImmediateChild(e);{let t=this.optCompleteServerCache_!=null?new ko(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return fb(this.writes_,e,t)}}getChildAfterChild(e,n,t){let i=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:bl(this.viewCache_),o=Ine(this.writes_,i,n,1,t,e);return o.length===0?null:o[0]}};function vne(r){return{filter:r}}function yne(r,e){te(e.eventCache.getNode().isIndexed(r.filter.getIndex()),"Event snap not indexed"),te(e.serverCache.getNode().isIndexed(r.filter.getIndex()),"Server snap not indexed")}function Sne(r,e,n,t,i){let o=new FO,s,a;if(n.type===Fo.OVERWRITE){let l=n;l.source.fromUser?s=UO(r,e,l.path,l.snap,t,i,o):(te(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!Fe(l.path),s=XI(r,e,l.path,l.snap,t,i,a,o))}else if(n.type===Fo.MERGE){let l=n;l.source.fromUser?s=Rne(r,e,l.path,l.children,t,i,o):(te(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),s=VO(r,e,l.path,l.children,t,i,a,o))}else if(n.type===Fo.ACK_USER_WRITE){let l=n;l.revert?s=Nne(r,e,l.path,t,i,o):s=Dne(r,e,l.path,l.affectedTree,t,i,o)}else if(n.type===Fo.LISTEN_COMPLETE)s=Cne(r,e,n.path,t,o);else throw fl("Unknown operation type: "+n.type);let c=o.getChanges();return Ane(e,s,c),{viewCache:s,changes:c}}function Ane(r,e,n){let t=e.eventCache;if(t.isFullyInitialized()){let i=t.getNode().isLeafNode()||t.getNode().isEmpty(),o=KI(r);(n.length>0||!r.eventCache.isFullyInitialized()||i&&!t.getNode().equals(o)||!t.getNode().getPriority().equals(o.getPriority()))&&n.push(Q$(KI(e)))}}function i2(r,e,n,t,i,o){let s=e.eventCache;if(QI(t,n)!=null)return e;{let a,c;if(Fe(n))if(te(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){let l=bl(e),u=l instanceof Ne?l:Ne.EMPTY_NODE,d=hb(t,u);a=r.filter.updateFullNode(e.eventCache.getNode(),d,o)}else{let l=YI(t,bl(e));a=r.filter.updateFullNode(e.eventCache.getNode(),l,o)}else{let l=xe(n);if(l===".priority"){te(Pa(n)===1,"Can't have a priority with additional path components");let u=s.getNode();c=e.serverCache.getNode();let d=u$(t,n,u,c);d!=null?a=r.filter.updatePriority(u,d):a=s.getNode()}else{let u=ht(n),d;if(s.isCompleteForChild(l)){c=e.serverCache.getNode();let f=u$(t,n,s.getNode(),c);f!=null?d=s.getNode().getImmediateChild(l).updateChild(u,f):d=s.getNode().getImmediateChild(l)}else d=fb(t,l,e.serverCache);d!=null?a=r.filter.updateChild(s.getNode(),l,d,u,i,o):a=s.getNode()}}return am(e,a,s.isFullyInitialized()||Fe(n),r.filter.filtersNodes())}}function XI(r,e,n,t,i,o,s,a){let c=e.serverCache,l,u=s?r.filter:r.filter.getIndexedFilter();if(Fe(n))l=u.updateFullNode(c.getNode(),t,null);else if(u.filtersNodes()&&!c.isFiltered()){let g=c.getNode().updateChild(n,t);l=u.updateFullNode(c.getNode(),g,null)}else{let g=xe(n);if(!c.isCompleteForPath(n)&&Pa(n)>1)return e;let p=ht(n),T=c.getNode().getImmediateChild(g).updateChild(p,t);g===".priority"?l=u.updatePriority(c.getNode(),T):l=u.updateChild(c.getNode(),g,T,p,r2,null)}let d=X$(e,l,c.isFullyInitialized()||Fe(n),u.filtersNodes()),f=new pm(i,d,o);return i2(r,d,n,i,f,a)}function UO(r,e,n,t,i,o,s){let a=e.eventCache,c,l,u=new pm(i,e,o);if(Fe(n))l=r.filter.updateFullNode(e.eventCache.getNode(),t,s),c=am(e,l,!0,r.filter.filtersNodes());else{let d=xe(n);if(d===".priority")l=r.filter.updatePriority(e.eventCache.getNode(),t),c=am(e,l,a.isFullyInitialized(),a.isFiltered());else{let f=ht(n),g=a.getNode().getImmediateChild(d),p;if(Fe(f))p=t;else{let _=u.getCompleteChild(d);_!=null?ob(f)===".priority"&&_.getChild(j$(f)).isEmpty()?p=_:p=_.updateChild(f,t):p=Ne.EMPTY_NODE}if(g.equals(p))c=e;else{let _=r.filter.updateChild(a.getNode(),d,p,f,u,s);c=am(e,_,a.isFullyInitialized(),r.filter.filtersNodes())}}}return c}function d$(r,e){return r.eventCache.isCompleteForChild(e)}function Rne(r,e,n,t,i,o,s){let a=e;return t.foreach((c,l)=>{let u=kt(n,c);d$(e,xe(u))&&(a=UO(r,a,u,l,i,o,s))}),t.foreach((c,l)=>{let u=kt(n,c);d$(e,xe(u))||(a=UO(r,a,u,l,i,o,s))}),a}function h$(r,e,n){return n.foreach((t,i)=>{e=e.updateChild(t,i)}),e}function VO(r,e,n,t,i,o,s,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;Fe(n)?l=t:l=new hr(null).setTree(n,t);let u=e.serverCache.getNode();return l.children.inorderTraversal((d,f)=>{if(u.hasChild(d)){let g=e.serverCache.getNode().getImmediateChild(d),p=h$(r,g,f);c=XI(r,c,new qe(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),_=h$(r,p,f);c=XI(r,c,new qe(d),_,i,o,s,a)}}),c}function Dne(r,e,n,t,i,o,s){if(QI(i,n)!=null)return e;let a=e.serverCache.isFiltered(),c=e.serverCache;if(t.value!=null){if(Fe(n)&&c.isFullyInitialized()||c.isCompleteForPath(n))return XI(r,e,n,c.getNode().getChild(n),i,o,a,s);if(Fe(n)){let l=new hr(null);return c.getNode().forEachChild(Nl,(u,d)=>{l=l.set(new qe(u),d)}),VO(r,e,n,l,i,o,a,s)}else return e}else{let l=new hr(null);return t.foreach((u,d)=>{let f=kt(n,u);c.isCompleteForPath(f)&&(l=l.set(u,c.getNode().getChild(f)))}),VO(r,e,n,l,i,o,a,s)}}function Cne(r,e,n,t,i){let o=e.serverCache,s=X$(e,o.getNode(),o.isFullyInitialized()||Fe(n),o.isFiltered());return i2(r,s,n,t,r2,i)}function Nne(r,e,n,t,i,o){let s;if(QI(t,n)!=null)return e;{let a=new pm(t,e,i),c=e.eventCache.getNode(),l;if(Fe(n)||xe(n)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=YI(t,bl(e));else{let d=e.serverCache.getNode();te(d instanceof Ne,"serverChildren would be complete if leaf node"),u=hb(t,d)}u=u,l=r.filter.updateFullNode(c,u,o)}else{let u=xe(n),d=fb(t,u,e.serverCache);d==null&&e.serverCache.isCompleteForChild(u)&&(d=c.getImmediateChild(u)),d!=null?l=r.filter.updateChild(c,u,d,ht(n),a,o):e.eventCache.getNode().hasChild(u)?l=r.filter.updateChild(c,u,Ne.EMPTY_NODE,ht(n),a,o):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(s=YI(t,bl(e)),s.isLeafNode()&&(l=r.filter.updateFullNode(l,s,o)))}return s=e.serverCache.isFullyInitialized()||QI(t,ze())!=null,am(e,l,s,r.filter.filtersNodes())}}var BO=class{constructor(e,n){this.query_=e,this.eventRegistrations_=[];let t=this.query_._queryParams,i=new gm(t.getIndex()),o=Yte(t);this.processor_=vne(o);let s=n.serverCache,a=n.eventCache,c=i.updateFullNode(Ne.EMPTY_NODE,s.getNode(),null),l=o.updateFullNode(Ne.EMPTY_NODE,a.getNode(),null),u=new ko(c,s.isFullyInitialized(),i.filtersNodes()),d=new ko(l,a.isFullyInitialized(),o.filtersNodes());this.viewCache_=cv(d,u),this.eventGenerator_=new LO(this.query_)}get query(){return this.query_}};function One(r){return r.viewCache_.serverCache.getNode()}function bne(r){return KI(r.viewCache_)}function wne(r,e){let n=bl(r.viewCache_);return n&&(r.query._queryParams.loadsAllData()||!Fe(e)&&!n.getImmediateChild(xe(e)).isEmpty())?n.getChild(e):null}function f$(r){return r.eventRegistrations_.length===0}function Lne(r,e){r.eventRegistrations_.push(e)}function g$(r,e,n){let t=[];if(n){te(e==null,"A cancel should cancel all event registrations.");let i=r.query._path;r.eventRegistrations_.forEach(o=>{let s=o.createCancelEvent(n,i);s&&t.push(s)})}if(e){let i=[];for(let o=0;o<r.eventRegistrations_.length;++o){let s=r.eventRegistrations_[o];if(!s.matches(e))i.push(s);else if(e.hasAnyCallback()){i=i.concat(r.eventRegistrations_.slice(o+1));break}}r.eventRegistrations_=i}else r.eventRegistrations_=[];return t}function m$(r,e,n,t){e.type===Fo.MERGE&&e.source.queryId!==null&&(te(bl(r.viewCache_),"We should always have a full cache before handling merges"),te(KI(r.viewCache_),"Missing event cache, even though we have a server cache"));let i=r.viewCache_,o=Sne(r.processor_,i,e,n,t);return yne(r.processor_,o.viewCache),te(o.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),r.viewCache_=o.viewCache,o2(r,o.changes,o.viewCache.eventCache.getNode(),null)}function Mne(r,e){let n=r.viewCache_.eventCache,t=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(yt,(o,s)=>{t.push(Kd(o,s))}),n.isFullyInitialized()&&t.push(Q$(n.getNode())),o2(r,t,n.getNode(),e)}function o2(r,e,n,t){let i=t?[t]:r.eventRegistrations_;return rne(r.eventGenerator_,e,n,i)}var JI,ZI=class{constructor(){this.views=new Map}};function Pne(r){te(!JI,"__referenceConstructor has already been defined"),JI=r}function xne(){return te(JI,"Reference.ts has not been loaded"),JI}function Fne(r){return r.views.size===0}function gb(r,e,n,t){let i=e.source.queryId;if(i!==null){let o=r.views.get(i);return te(o!=null,"SyncTree gave us an op for an invalid query."),m$(o,e,n,t)}else{let o=[];for(let s of r.views.values())o=o.concat(m$(s,e,n,t));return o}}function s2(r,e,n,t,i){let o=e._queryIdentifier,s=r.views.get(o);if(!s){let a=YI(n,i?t:null),c=!1;a?c=!0:t instanceof Ne?(a=hb(n,t),c=!1):(a=Ne.EMPTY_NODE,c=!1);let l=cv(new ko(a,c,!1),new ko(t,i,!1));return new BO(e,l)}return s}function kne(r,e,n,t,i,o){let s=s2(r,e,t,i,o);return r.views.has(e._queryIdentifier)||r.views.set(e._queryIdentifier,s),Lne(s,n),Mne(s,n)}function Une(r,e,n,t){let i=e._queryIdentifier,o=[],s=[],a=xa(r);if(i==="default")for(let[c,l]of r.views.entries())s=s.concat(g$(l,n,t)),f$(l)&&(r.views.delete(c),l.query._queryParams.loadsAllData()||o.push(l.query));else{let c=r.views.get(i);c&&(s=s.concat(g$(c,n,t)),f$(c)&&(r.views.delete(i),c.query._queryParams.loadsAllData()||o.push(c.query)))}return a&&!xa(r)&&o.push(new(xne())(e._repo,e._path)),{removed:o,events:s}}function a2(r){let e=[];for(let n of r.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function La(r,e){let n=null;for(let t of r.views.values())n=n||wne(t,e);return n}function c2(r,e){if(e._queryParams.loadsAllData())return uv(r);{let t=e._queryIdentifier;return r.views.get(t)}}function l2(r,e){return c2(r,e)!=null}function xa(r){return uv(r)!=null}function uv(r){for(let e of r.views.values())if(e.query._queryParams.loadsAllData())return e;return null}var ev;function Vne(r){te(!ev,"__referenceConstructor has already been defined"),ev=r}function Bne(){return te(ev,"Reference.ts has not been loaded"),ev}var Gne=1,tv=class{constructor(e){this.listenProvider_=e,this.syncPointTree_=new hr(null),this.pendingWriteTree_=Tne(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}};function mb(r,e,n,t,i){return ane(r.pendingWriteTree_,e,n,t,i),i?th(r,new Yd(lb(),e,n)):[]}function $ne(r,e,n,t){cne(r.pendingWriteTree_,e,n,t);let i=hr.fromObject(n);return th(r,new mm(lb(),e,i))}function Oa(r,e,n=!1){let t=lne(r.pendingWriteTree_,e);if(une(r.pendingWriteTree_,e)){let o=new hr(null);return t.snap!=null?o=o.set(ze(),!0):Rn(t.children,s=>{o=o.set(new qe(s),!0)}),th(r,new wO(t.path,o,n))}else return[]}function Rm(r,e,n){return th(r,new Yd(ub(),e,n))}function jne(r,e,n){let t=hr.fromObject(n);return th(r,new mm(ub(),e,t))}function Hne(r,e){return th(r,new qI(ub(),e))}function Wne(r,e,n){let t=pb(r,n);if(t){let i=Eb(t),o=i.path,s=i.queryId,a=dr(o,e),c=new qI(db(s),a);return _b(r,o,c)}else return[]}function nv(r,e,n,t,i=!1){let o=e._path,s=r.syncPointTree_.get(o),a=[];if(s&&(e._queryIdentifier==="default"||l2(s,e))){let c=Une(s,e,n,t);Fne(s)&&(r.syncPointTree_=r.syncPointTree_.remove(o));let l=c.removed;if(a=c.events,!i){let u=l.findIndex(f=>f._queryParams.loadsAllData())!==-1,d=r.syncPointTree_.findOnPath(o,(f,g)=>xa(g));if(u&&!d){let f=r.syncPointTree_.subtree(o);if(!f.isEmpty()){let g=Kne(f);for(let p=0;p<g.length;++p){let _=g[p],T=_.query,D=f2(r,_);r.listenProvider_.startListening(lm(T),Em(r,T),D.hashFn,D.onComplete)}}}!d&&l.length>0&&!t&&(u?r.listenProvider_.stopListening(lm(e),null):l.forEach(f=>{let g=r.queryToTagMap.get(hv(f));r.listenProvider_.stopListening(lm(f),g)}))}Yne(r,l)}return a}function u2(r,e,n,t){let i=pb(r,t);if(i!=null){let o=Eb(i),s=o.path,a=o.queryId,c=dr(s,e),l=new Yd(db(a),c,n);return _b(r,s,l)}else return[]}function zne(r,e,n,t){let i=pb(r,t);if(i){let o=Eb(i),s=o.path,a=o.queryId,c=dr(s,e),l=hr.fromObject(n),u=new mm(db(a),c,l);return _b(r,s,u)}else return[]}function GO(r,e,n,t=!1){let i=e._path,o=null,s=!1;r.syncPointTree_.foreachOnPath(i,(f,g)=>{let p=dr(f,i);o=o||La(g,p),s=s||xa(g)});let a=r.syncPointTree_.get(i);a?(s=s||xa(a),o=o||La(a,ze())):(a=new ZI,r.syncPointTree_=r.syncPointTree_.set(i,a));let c;o!=null?c=!0:(c=!1,o=Ne.EMPTY_NODE,r.syncPointTree_.subtree(i).foreachChild((g,p)=>{let _=La(p,ze());_&&(o=o.updateImmediateChild(g,_))}));let l=l2(a,e);if(!l&&!e._queryParams.loadsAllData()){let f=hv(e);te(!r.queryToTagMap.has(f),"View does not exist, but we have a tag");let g=Qne();r.queryToTagMap.set(f,g),r.tagToQueryMap.set(g,f)}let u=lv(r.pendingWriteTree_,i),d=kne(a,e,n,u,o,c);if(!l&&!s&&!t){let f=c2(a,e);d=d.concat(Xne(r,e,f))}return d}function dv(r,e,n){let i=r.pendingWriteTree_,o=r.syncPointTree_.findOnPath(e,(s,a)=>{let c=dr(s,e),l=La(a,c);if(l)return l});return e2(i,e,o,n,!0)}function qne(r,e){let n=e._path,t=null;r.syncPointTree_.foreachOnPath(n,(l,u)=>{let d=dr(l,n);t=t||La(u,d)});let i=r.syncPointTree_.get(n);i?t=t||La(i,ze()):(i=new ZI,r.syncPointTree_=r.syncPointTree_.set(n,i));let o=t!=null,s=o?new ko(t,!0,!1):null,a=lv(r.pendingWriteTree_,e._path),c=s2(i,e,a,o?s.getNode():Ne.EMPTY_NODE,o);return bne(c)}function th(r,e){return d2(e,r.syncPointTree_,null,lv(r.pendingWriteTree_,ze()))}function d2(r,e,n,t){if(Fe(r.path))return h2(r,e,n,t);{let i=e.get(ze());n==null&&i!=null&&(n=La(i,ze()));let o=[],s=xe(r.path),a=r.operationForChild(s),c=e.children.get(s);if(c&&a){let l=n?n.getImmediateChild(s):null,u=t2(t,s);o=o.concat(d2(a,c,l,u))}return i&&(o=o.concat(gb(i,r,t,n))),o}}function h2(r,e,n,t){let i=e.get(ze());n==null&&i!=null&&(n=La(i,ze()));let o=[];return e.children.inorderTraversal((s,a)=>{let c=n?n.getImmediateChild(s):null,l=t2(t,s),u=r.operationForChild(s);u&&(o=o.concat(h2(u,a,c,l)))}),i&&(o=o.concat(gb(i,r,t,n))),o}function f2(r,e){let n=e.query,t=Em(r,n);return{hashFn:()=>(One(e)||Ne.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return t?Wne(r,n._path,t):Hne(r,n._path);{let o=ate(i,n);return nv(r,n,null,o)}}}}function Em(r,e){let n=hv(e);return r.queryToTagMap.get(n)}function hv(r){return r._path.toString()+"$"+r._queryIdentifier}function pb(r,e){return r.tagToQueryMap.get(e)}function Eb(r){let e=r.indexOf("$");return te(e!==-1&&e<r.length-1,"Bad queryKey."),{queryId:r.substr(e+1),path:new qe(r.substr(0,e))}}function _b(r,e,n){let t=r.syncPointTree_.get(e);te(t,"Missing sync point for query tag that we're tracking");let i=lv(r.pendingWriteTree_,e);return gb(t,n,i,null)}function Kne(r){return r.fold((e,n,t)=>{if(n&&xa(n))return[uv(n)];{let i=[];return n&&(i=a2(n)),Rn(t,(o,s)=>{i=i.concat(s)}),i}})}function lm(r){return r._queryParams.loadsAllData()&&!r._queryParams.isDefault()?new(Bne())(r._repo,r._path):r}function Yne(r,e){for(let n=0;n<e.length;++n){let t=e[n];if(!t._queryParams.loadsAllData()){let i=hv(t),o=r.queryToTagMap.get(i);r.queryToTagMap.delete(i),r.tagToQueryMap.delete(o)}}}function Qne(){return Gne++}function Xne(r,e,n){let t=e._path,i=Em(r,e),o=f2(r,n),s=r.listenProvider_.startListening(lm(e),i,o.hashFn,o.onComplete),a=r.syncPointTree_.subtree(t);if(i)te(!xa(a.value),"If we're adding a query, it shouldn't be shadowed");else{let c=a.fold((l,u,d)=>{if(!Fe(l)&&u&&xa(u))return[uv(u).query];{let f=[];return u&&(f=f.concat(a2(u).map(g=>g.query))),Rn(d,(g,p)=>{f=f.concat(p)}),f}});for(let l=0;l<c.length;++l){let u=c[l];r.listenProvider_.stopListening(lm(u),Em(r,u))}}return s}var $O=class r{constructor(e){this.node_=e}getImmediateChild(e){let n=this.node_.getImmediateChild(e);return new r(n)}node(){return this.node_}},jO=class r{constructor(e,n){this.syncTree_=e,this.path_=n}getImmediateChild(e){let n=kt(this.path_,e);return new r(this.syncTree_,n)}node(){return dv(this.syncTree_,this.path_)}},Jne=function(r){return r=r||{},r.timestamp=r.timestamp||new Date().getTime(),r},p$=function(r,e,n){if(!r||typeof r!="object")return r;if(te(".sv"in r,"Unexpected leaf node or priority contents"),typeof r[".sv"]=="string")return Zne(r[".sv"],e,n);if(typeof r[".sv"]=="object")return ere(r[".sv"],e);te(!1,"Unexpected server value: "+JSON.stringify(r,null,2))},Zne=function(r,e,n){if(r==="timestamp")return n.timestamp;te(!1,"Unexpected server value: "+r)},ere=function(r,e,n){r.hasOwnProperty("increment")||te(!1,"Unexpected server value: "+JSON.stringify(r,null,2));let t=r.increment;typeof t!="number"&&te(!1,"Unexpected increment value: "+t);let i=e.node();if(te(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},g2=function(r,e,n,t){return Ib(e,new jO(n,r),t)},Tb=function(r,e,n){return Ib(r,new $O(e),n)};function Ib(r,e,n){let t=r.getPriority().val(),i=p$(t,e.getImmediateChild(".priority"),n),o;if(r.isLeafNode()){let s=r,a=p$(s.getValue(),e,n);return a!==s.getValue()||i!==s.getPriority().val()?new zd(a,Ft(i)):r}else{let s=r;return o=s,i!==s.getPriority().val()&&(o=o.updatePriority(new zd(i))),s.forEachChild(yt,(a,c)=>{let l=Ib(c,e.getImmediateChild(a),n);l!==c&&(o=o.updateImmediateChild(a,l))}),o}}var _m=class{constructor(e="",n=null,t={children:{},childCount:0}){this.name=e,this.parent=n,this.node=t}};function fv(r,e){let n=e instanceof qe?e:new qe(e),t=r,i=xe(n);for(;i!==null;){let o=Ia(t.node.children,i)||{children:{},childCount:0};t=new _m(i,t,o),n=ht(n),i=xe(n)}return t}function kl(r){return r.node.value}function vb(r,e){r.node.value=e,HO(r)}function m2(r){return r.node.childCount>0}function tre(r){return kl(r)===void 0&&!m2(r)}function gv(r,e){Rn(r.node.children,(n,t)=>{e(new _m(n,r,t))})}function p2(r,e,n,t){n&&!t&&e(r),gv(r,i=>{p2(i,e,!0,t)}),n&&t&&e(r)}function nre(r,e,n){let t=n?r:r.parent;for(;t!==null;){if(e(t))return!0;t=t.parent}return!1}function Dm(r){return new qe(r.parent===null?r.name:Dm(r.parent)+"/"+r.name)}function HO(r){r.parent!==null&&rre(r.parent,r.name,r)}function rre(r,e,n){let t=tre(n),i=mi(r.node.children,e);t&&i?(delete r.node.children[e],r.node.childCount--,HO(r)):!t&&!i&&(r.node.children[e]=n.node,r.node.childCount++,HO(r))}var ire=/[\[\].#$\/\u0000-\u001F\u007F]/,ore=/[\[\].#$\u0000-\u001F\u007F]/,nO=10*1024*1024,mv=function(r){return typeof r=="string"&&r.length!==0&&!ire.test(r)},E2=function(r){return typeof r=="string"&&r.length!==0&&!ore.test(r)},sre=function(r){return r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),E2(r)},Tm=function(r){return r===null||typeof r=="string"||typeof r=="number"&&!av(r)||r&&typeof r=="object"&&mi(r,".sv")},wl=function(r,e,n,t){t&&e===void 0||Cm(va(r,"value"),e,n)},Cm=function(r,e,n){let t=n instanceof qe?new mO(n,r):n;if(e===void 0)throw new Error(r+"contains undefined "+Rl(t));if(typeof e=="function")throw new Error(r+"contains a function "+Rl(t)+" with contents = "+e.toString());if(av(e))throw new Error(r+"contains "+e.toString()+" "+Rl(t));if(typeof e=="string"&&e.length>nO/3&&Gg(e)>nO)throw new Error(r+"contains a string greater than "+nO+" utf8 bytes "+Rl(t)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,o=!1;if(Rn(e,(s,a)=>{if(s===".value")i=!0;else if(s!==".priority"&&s!==".sv"&&(o=!0,!mv(s)))throw new Error(r+" contains an invalid key ("+s+") "+Rl(t)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);Fte(t,s),Cm(r,a,t),kte(t)}),i&&o)throw new Error(r+' contains ".value" child '+Rl(t)+" in addition to actual children.")}},are=function(r,e){let n,t;for(n=0;n<e.length;n++){t=e[n];let o=um(t);for(let s=0;s<o.length;s++)if(!(o[s]===".priority"&&s===o.length-1)){if(!mv(o[s]))throw new Error(r+"contains an invalid key ("+o[s]+") in path "+t.toString()+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`)}}e.sort(xte);let i=null;for(n=0;n<e.length;n++){if(t=e[n],i!==null&&_i(i,t))throw new Error(r+"contains a path "+i.toString()+" that is ancestor of another path "+t.toString());i=t}},_2=function(r,e,n,t){if(t&&e===void 0)return;let i=va(r,"values");if(!(e&&typeof e=="object")||Array.isArray(e))throw new Error(i+" must be an object containing the children to replace.");let o=[];Rn(e,(s,a)=>{let c=new qe(s);if(Cm(i,a,kt(n,c)),ob(c)===".priority"&&!Tm(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)}),are(i,o)},cre=function(r,e,n){if(!(n&&e===void 0)){if(av(e))throw new Error(va(r,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Tm(e))throw new Error(va(r,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},T2=function(r,e,n,t){if(!(t&&n===void 0)&&!mv(n))throw new Error(va(r,e)+'was an invalid key = "'+n+`". Firebase keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]").`)},yb=function(r,e,n,t){if(!(t&&n===void 0)&&!E2(n))throw new Error(va(r,e)+'was an invalid path = "'+n+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},lre=function(r,e,n,t){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),yb(r,e,n,t)},ba=function(r,e){if(xe(e)===".info")throw new Error(r+" failed = Can't modify data under /.info/")},ure=function(r,e){let n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!mv(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!sre(n))throw new Error(va(r,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};var WO=class{constructor(){this.eventLists_=[],this.recursionDepth_=0}};function pv(r,e){let n=null;for(let t=0;t<e.length;t++){let i=e[t],o=i.getPath();n!==null&&!sb(o,n.path)&&(r.eventLists_.push(n),n=null),n===null&&(n={events:[],path:o}),n.events.push(i)}n&&r.eventLists_.push(n)}function I2(r,e,n){pv(r,n),v2(r,t=>sb(t,e))}function jr(r,e,n){pv(r,n),v2(r,t=>_i(t,e)||_i(e,t))}function v2(r,e){r.recursionDepth_++;let n=!0;for(let t=0;t<r.eventLists_.length;t++){let i=r.eventLists_[t];if(i){let o=i.path;e(o)?(dre(r.eventLists_[t]),r.eventLists_[t]=null):n=!1}}n&&(r.eventLists_=[]),r.recursionDepth_--}function dre(r){for(let e=0;e<r.events.length;e++){let n=r.events[e];if(n!==null){r.events[e]=null;let t=n.getEventRunner();Cl&&An("event: "+n.toString()),Zd(t)}}}var hre="repo_interrupt",fre=25,zO=class{constructor(e,n,t,i){this.repoInfo_=e,this.forceRestClient_=n,this.authTokenProvider_=t,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new WO,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=zI(),this.transactionQueueTree_=new _m,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}};function gre(r,e,n){if(r.stats_=ib(r.repoInfo_),r.forceRestClient_||dte())r.server_=new RO(r.repoInfo_,(t,i,o,s)=>{E$(r,t,i,o,s)},r.authTokenProvider_,r.appCheckProvider_),setTimeout(()=>_$(r,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Xt(n)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}r.persistentConnection_=new ab(r.repoInfo_,e,(t,i,o,s)=>{E$(r,t,i,o,s)},t=>{_$(r,t)},t=>{mre(r,t)},r.authTokenProvider_,r.appCheckProvider_,n),r.server_=r.persistentConnection_}r.authTokenProvider_.addTokenChangeListener(t=>{r.server_.refreshAuthToken(t)}),r.appCheckProvider_.addTokenChangeListener(t=>{r.server_.refreshAppCheckToken(t.token)}),r.statsReporter_=fte(r.repoInfo_,()=>new bO(r.stats_,r.server_)),r.infoData_=new DO,r.infoSyncTree_=new tv({startListening:(t,i,o,s)=>{let a=[],c=r.infoData_.getNode(t._path);return c.isEmpty()||(a=Rm(r.infoSyncTree_,t._path,c),setTimeout(()=>{s("ok")},0)),a},stopListening:()=>{}}),Sb(r,"connected",!1),r.serverSyncTree_=new tv({startListening:(t,i,o,s)=>(r.server_.listen(t,o,i,(a,c)=>{let l=s(a,c);jr(r.eventQueue_,t._path,l)}),[]),stopListening:(t,i)=>{r.server_.unlisten(t,i)}})}function y2(r){let n=r.infoData_.getNode(new qe(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function Nm(r){return Jne({timestamp:y2(r)})}function E$(r,e,n,t,i){r.dataUpdateCount++;let o=new qe(e);n=r.interceptServerDataCallback_?r.interceptServerDataCallback_(e,n):n;let s=[];if(i)if(t){let c=Vg(n,l=>Ft(l));s=zne(r.serverSyncTree_,o,c,i)}else{let c=Ft(n);s=u2(r.serverSyncTree_,o,c,i)}else if(t){let c=Vg(n,l=>Ft(l));s=jne(r.serverSyncTree_,o,c)}else{let c=Ft(n);s=Rm(r.serverSyncTree_,o,c)}let a=o;s.length>0&&(a=Xd(r,o)),jr(r.eventQueue_,a,s)}function _$(r,e){Sb(r,"connected",e),e===!1&&Tre(r)}function mre(r,e){Rn(e,(n,t)=>{Sb(r,n,t)})}function Sb(r,e,n){let t=new qe("/.info/"+e),i=Ft(n);r.infoData_.updateSnapshot(t,i);let o=Rm(r.infoSyncTree_,t,i);jr(r.eventQueue_,t,o)}function Ev(r){return r.nextWriteId_++}function pre(r,e,n){let t=qne(r.serverSyncTree_,e);return t!=null?Promise.resolve(t):r.server_.get(e).then(i=>{let o=Ft(i).withIndex(e._queryParams.getIndex());GO(r.serverSyncTree_,e,n,!0);let s;if(e._queryParams.loadsAllData())s=Rm(r.serverSyncTree_,e._path,o);else{let a=Em(r.serverSyncTree_,e);s=u2(r.serverSyncTree_,e._path,o,a)}return jr(r.eventQueue_,e._path,s),nv(r.serverSyncTree_,e,n,null,!0),o},i=>(nh(r,"get for query "+Xt(e)+" failed: "+i),Promise.reject(new Error(i))))}function Ere(r,e,n,t,i){nh(r,"set",{path:e.toString(),value:n,priority:t});let o=Nm(r),s=Ft(n,t),a=dv(r.serverSyncTree_,e),c=Tb(s,a,o),l=Ev(r),u=mb(r.serverSyncTree_,e,c,l,!0);pv(r.eventQueue_,u),r.server_.put(e.toString(),s.val(!0),(f,g)=>{let p=f==="ok";p||Jn("set at "+e+" failed: "+f);let _=Oa(r.serverSyncTree_,l,!p);jr(r.eventQueue_,e,_),Fa(r,i,f,g)});let d=Rb(r,e);Xd(r,d),jr(r.eventQueue_,d,[])}function _re(r,e,n,t){nh(r,"update",{path:e.toString(),value:n});let i=!0,o=Nm(r),s={};if(Rn(n,(a,c)=>{i=!1,s[a]=g2(kt(e,a),Ft(c),r.serverSyncTree_,o)}),i)An("update() called with empty data. Don't do anything."),Fa(r,t,"ok",void 0);else{let a=Ev(r),c=$ne(r.serverSyncTree_,e,s,a);pv(r.eventQueue_,c),r.server_.merge(e.toString(),n,(l,u)=>{let d=l==="ok";d||Jn("update at "+e+" failed: "+l);let f=Oa(r.serverSyncTree_,a,!d),g=f.length>0?Xd(r,e):e;jr(r.eventQueue_,g,f),Fa(r,t,l,u)}),Rn(n,l=>{let u=Rb(r,kt(e,l));Xd(r,u)}),jr(r.eventQueue_,e,[])}}function Tre(r){nh(r,"onDisconnectEvents");let e=Nm(r),n=zI();NO(r.onDisconnect_,ze(),(i,o)=>{let s=g2(i,o,r.serverSyncTree_,e);eh(n,i,s)});let t=[];NO(n,ze(),(i,o)=>{t=t.concat(Rm(r.serverSyncTree_,i,o));let s=Rb(r,i);Xd(r,s)}),r.onDisconnect_=zI(),jr(r.eventQueue_,ze(),t)}function Ire(r,e,n){r.server_.onDisconnectCancel(e.toString(),(t,i)=>{t==="ok"&&CO(r.onDisconnect_,e),Fa(r,n,t,i)})}function T$(r,e,n,t){let i=Ft(n);r.server_.onDisconnectPut(e.toString(),i.val(!0),(o,s)=>{o==="ok"&&eh(r.onDisconnect_,e,i),Fa(r,t,o,s)})}function vre(r,e,n,t,i){let o=Ft(n,t);r.server_.onDisconnectPut(e.toString(),o.val(!0),(s,a)=>{s==="ok"&&eh(r.onDisconnect_,e,o),Fa(r,i,s,a)})}function yre(r,e,n,t){if(Ug(n)){An("onDisconnect().update() called with empty data. Don't do anything."),Fa(r,t,"ok",void 0);return}r.server_.onDisconnectMerge(e.toString(),n,(i,o)=>{i==="ok"&&Rn(n,(s,a)=>{let c=Ft(a);eh(r.onDisconnect_,kt(e,s),c)}),Fa(r,t,i,o)})}function Sre(r,e,n){let t;xe(e._path)===".info"?t=GO(r.infoSyncTree_,e,n):t=GO(r.serverSyncTree_,e,n),I2(r.eventQueue_,e._path,t)}function qO(r,e,n){let t;xe(e._path)===".info"?t=nv(r.infoSyncTree_,e,n):t=nv(r.serverSyncTree_,e,n),I2(r.eventQueue_,e._path,t)}function Are(r){r.persistentConnection_&&r.persistentConnection_.interrupt(hre)}function nh(r,...e){let n="";r.persistentConnection_&&(n=r.persistentConnection_.id+":"),An(n,...e)}function Fa(r,e,n,t){e&&Zd(()=>{if(n==="ok")e(null);else{let i=(n||"error").toUpperCase(),o=i;t&&(o+=": "+t);let s=new Error(o);s.code=i,e(s)}})}function Rre(r,e,n,t,i,o){nh(r,"transaction on "+e);let s={path:e,update:n,onComplete:t,status:null,order:S$(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=Ab(r,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{Cm("transaction failed: Data returned ",c,s.path),s.status=0;let l=fv(r.transactionQueueTree_,e),u=kl(l)||[];u.push(s),vb(l,u);let d;typeof c=="object"&&c!==null&&mi(c,".priority")?(d=Ia(c,".priority"),te(Tm(d),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):d=(dv(r.serverSyncTree_,e)||Ne.EMPTY_NODE).getPriority().val();let f=Nm(r),g=Ft(c,d),p=Tb(g,a,f);s.currentOutputSnapshotRaw=g,s.currentOutputSnapshotResolved=p,s.currentWriteId=Ev(r);let _=mb(r.serverSyncTree_,e,p,s.currentWriteId,s.applyLocally);jr(r.eventQueue_,e,_),_v(r,r.transactionQueueTree_)}}function Ab(r,e,n){return dv(r.serverSyncTree_,e,n)||Ne.EMPTY_NODE}function _v(r,e=r.transactionQueueTree_){if(e||Tv(r,e),kl(e)){let n=A2(r,e);te(n.length>0,"Sending zero length transaction queue"),n.every(i=>i.status===0)&&Dre(r,Dm(e),n)}else m2(e)&&gv(e,n=>{_v(r,n)})}function Dre(r,e,n){let t=n.map(l=>l.currentWriteId),i=Ab(r,e,t),o=i,s=i.hash();for(let l=0;l<n.length;l++){let u=n[l];te(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;r.server_.put(c.toString(),a,l=>{nh(r,"transaction put response",{path:c.toString(),status:l});let u=[];if(l==="ok"){let d=[];for(let f=0;f<n.length;f++)n[f].status=2,u=u.concat(Oa(r.serverSyncTree_,n[f].currentWriteId)),n[f].onComplete&&d.push(()=>n[f].onComplete(null,!0,n[f].currentOutputSnapshotResolved)),n[f].unwatcher();Tv(r,fv(r.transactionQueueTree_,e)),_v(r,r.transactionQueueTree_),jr(r.eventQueue_,e,u);for(let f=0;f<d.length;f++)Zd(d[f])}else{if(l==="datastale")for(let d=0;d<n.length;d++)n[d].status===3?n[d].status=4:n[d].status=0;else{Jn("transaction at "+c.toString()+" failed: "+l);for(let d=0;d<n.length;d++)n[d].status=4,n[d].abortReason=l}Xd(r,e)}},s)}function Xd(r,e){let n=S2(r,e),t=Dm(n),i=A2(r,n);return Cre(r,i,t),t}function Cre(r,e,n){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(n,c.path),u=!1,d;if(te(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)u=!0,d=c.abortReason,i=i.concat(Oa(r.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=fre)u=!0,d="maxretry",i=i.concat(Oa(r.serverSyncTree_,c.currentWriteId,!0));else{let f=Ab(r,c.path,s);c.currentInputSnapshot=f;let g=e[a].update(f.val());if(g!==void 0){Cm("transaction failed: Data returned ",g,c.path);let p=Ft(g);typeof g=="object"&&g!=null&&mi(g,".priority")||(p=p.updatePriority(f.getPriority()));let T=c.currentWriteId,D=Nm(r),L=Tb(p,f,D);c.currentOutputSnapshotRaw=p,c.currentOutputSnapshotResolved=L,c.currentWriteId=Ev(r),s.splice(s.indexOf(T),1),i=i.concat(mb(r.serverSyncTree_,c.path,L,c.currentWriteId,c.applyLocally)),i=i.concat(Oa(r.serverSyncTree_,T,!0))}else u=!0,d="nodata",i=i.concat(Oa(r.serverSyncTree_,c.currentWriteId,!0))}jr(r.eventQueue_,n,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))))}Tv(r,r.transactionQueueTree_);for(let a=0;a<t.length;a++)Zd(t[a]);_v(r,r.transactionQueueTree_)}function S2(r,e){let n,t=r.transactionQueueTree_;for(n=xe(e);n!==null&&kl(t)===void 0;)t=fv(t,n),e=ht(e),n=xe(e);return t}function A2(r,e){let n=[];return R2(r,e,n),n.sort((t,i)=>t.order-i.order),n}function R2(r,e,n){let t=kl(e);if(t)for(let i=0;i<t.length;i++)n.push(t[i]);gv(e,i=>{R2(r,i,n)})}function Tv(r,e){let n=kl(e);if(n){let t=0;for(let i=0;i<n.length;i++)n[i].status!==2&&(n[t]=n[i],t++);n.length=t,vb(e,n.length>0?n:void 0)}gv(e,t=>{Tv(r,t)})}function Rb(r,e){let n=Dm(S2(r,e)),t=fv(r.transactionQueueTree_,e);return nre(t,i=>{rO(r,i)}),rO(r,t),p2(t,i=>{rO(r,i)}),n}function rO(r,e){let n=kl(e);if(n){let t=[],i=[],o=-1;for(let s=0;s<n.length;s++)n[s].status===3||(n[s].status===1?(te(o===s-1,"All SENT items should be at beginning of queue."),o=s,n[s].status=3,n[s].abortReason="set"):(te(n[s].status===0,"Unexpected transaction status in abort"),n[s].unwatcher(),i=i.concat(Oa(r.serverSyncTree_,n[s].currentWriteId,!0)),n[s].onComplete&&t.push(n[s].onComplete.bind(null,new Error("set"),!1,null))));o===-1?vb(e,void 0):n.length=o+1,jr(r.eventQueue_,Dm(e),i);for(let s=0;s<t.length;s++)Zd(t[s])}}function Nre(r){let e="",n=r.split("/");for(let t=0;t<n.length;t++)if(n[t].length>0){let i=n[t];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function Ore(r){let e={};r.charAt(0)==="?"&&(r=r.substring(1));for(let n of r.split("&")){if(n.length===0)continue;let t=n.split("=");t.length===2?e[decodeURIComponent(t[0])]=decodeURIComponent(t[1]):Jn(`Invalid query segment '${n}' in query '${r}'`)}return e}var I$=function(r,e){let n=bre(r),t=n.namespace;n.domain==="firebase.com"&&ws(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!t||t==="undefined")&&n.domain!=="localhost"&&ws("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||nte();let i=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new kI(n.host,n.secure,t,i,e,"",t!==n.subdomain),path:new qe(n.pathString)}},bre=function(r){let e="",n="",t="",i="",o="",s=!0,a="https",c=443;if(typeof r=="string"){let l=r.indexOf("//");l>=0&&(a=r.substring(0,l-1),r=r.substring(l+2));let u=r.indexOf("/");u===-1&&(u=r.length);let d=r.indexOf("?");d===-1&&(d=r.length),e=r.substring(0,Math.min(u,d)),u<d&&(i=Nre(r.substring(u,d)));let f=Ore(r.substring(Math.min(r.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")n="localhost";else if(g.split(".").length<=2)n=g;else{let p=e.indexOf(".");t=e.substring(0,p).toLowerCase(),n=e.substring(p+1),o=t}"ns"in f&&(o=f.ns)}return{host:e,port:c,domain:n,subdomain:t,secure:s,scheme:a,pathString:i,namespace:o}};var v$="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",wre=(function(){let r=0,e=[];return function(n){let t=n===r;r=n;let i,o=new Array(8);for(i=7;i>=0;i--)o[i]=v$.charAt(n%64),n=Math.floor(n/64);te(n===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+=v$.charAt(e[i]);return te(s.length===20,"nextPushId: Length should be 20."),s}})();var rv=class{constructor(e,n,t,i){this.eventType=e,this.eventRegistration=n,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+":"+Xt(this.snapshot.exportVal())}},iv=class{constructor(e,n,t){this.eventRegistration=e,this.error=n,this.path=t}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}};var Im=class{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return te(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 KO=class{constructor(e,n){this._repo=e,this._path=n}cancel(){let e=new Sn;return Ire(this._repo,this._path,e.wrapCallback(()=>{})),e.promise}remove(){ba("OnDisconnect.remove",this._path);let e=new Sn;return T$(this._repo,this._path,null,e.wrapCallback(()=>{})),e.promise}set(e){ba("OnDisconnect.set",this._path),wl("OnDisconnect.set",e,this._path,!1);let n=new Sn;return T$(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}setWithPriority(e,n){ba("OnDisconnect.setWithPriority",this._path),wl("OnDisconnect.setWithPriority",e,this._path,!1),cre("OnDisconnect.setWithPriority",n,!1);let t=new Sn;return vre(this._repo,this._path,e,n,t.wrapCallback(()=>{})),t.promise}update(e){ba("OnDisconnect.update",this._path),_2("OnDisconnect.update",e,this._path,!1);let n=new Sn;return yre(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}};var Ll=class r{constructor(e,n,t,i){this._repo=e,this._path=n,this._queryParams=t,this._orderByCalled=i}get key(){return Fe(this._path)?null:ob(this._path)}get ref(){return new qi(this._repo,this._path)}get _queryIdentifier(){let e=s$(this._queryParams),n=rb(e);return n==="{}"?"default":n}get _queryObject(){return s$(this._queryParams)}isEqual(e){if(e=Be(e),!(e instanceof r))return!1;let n=this._repo===e._repo,t=sb(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return n&&t&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+Pte(this._path)}};function Lre(r,e){if(r._orderByCalled===!0)throw new Error(e+": You can't combine multiple orderBy calls.")}function Db(r){let e=null,n=null;if(r.hasStart()&&(e=r.getIndexStartValue()),r.hasEnd()&&(n=r.getIndexEndValue()),r.getIndex()===Nl){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(r.hasStart()){if(r.getIndexStartName()!==Ol)throw new Error(t);if(typeof e!="string")throw new Error(i)}if(r.hasEnd()){if(r.getIndexEndName()!==Ma)throw new Error(t);if(typeof n!="string")throw new Error(i)}}else if(r.getIndex()===yt){if(e!=null&&!Tm(e)||n!=null&&!Tm(n))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(te(r.getIndex()instanceof dm||r.getIndex()===Y$,"unknown index type."),e!=null&&typeof e=="object"||n!=null&&typeof n=="object")throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")}function D2(r){if(r.hasStart()&&r.hasEnd()&&r.hasLimit()&&!r.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")}var qi=class r extends Ll{constructor(e,n){super(e,n,new AO,!1)}get parent(){let e=j$(this._path);return e===null?null:new r(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}},Jd=class r{constructor(e,n,t){this._node=e,this.ref=n,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 n=new qe(e),t=Ml(this.ref,e);return new r(this._node.getChild(n),t,yt)}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 r(i,Ml(this.ref,t),yt)))}hasChild(e){let n=new qe(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}};function C2(r,e){return r=Be(r),r._checkNotDeleted("ref"),e!==void 0?Ml(r._root,e):r._root}function Ml(r,e){return r=Be(r),xe(r._path)===null?lre("child","path",e,!1):yb("child","path",e,!1),new qi(r._repo,kt(r._path,e))}function N2(r){return r=Be(r),new KO(r._repo,r._path)}function O2(r,e){r=Be(r),ba("push",r._path),wl("push",e,r._path,!0);let n=y2(r._repo),t=wre(n),i=Ml(r,t),o=Ml(r,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 b2(r){return ba("remove",r._path),Iv(r,null)}function Iv(r,e){r=Be(r),ba("set",r._path),wl("set",e,r._path,!1);let n=new Sn;return Ere(r._repo,r._path,e,null,n.wrapCallback(()=>{})),n.promise}function w2(r,e){_2("update",e,r._path,!1);let n=new Sn;return _re(r._repo,r._path,e,n.wrapCallback(()=>{})),n.promise}function vv(r){r=Be(r);let e=new Im(()=>{}),n=new vm(e);return pre(r._repo,r,n).then(t=>new Jd(t,new qi(r._repo,r._path),r._queryParams.getIndex()))}var vm=class r{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){let t=n._queryParams.getIndex();return new rv("value",this,new Jd(e.snapshotNode,new qi(n._repo,n._path),t))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new iv(this,e,n):null}matches(e){return e instanceof r?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}},ov=class r{constructor(e,n){this.eventType=e,this.callbackContext=n}respondsTo(e){let n=e==="children_added"?"child_added":e;return n=n==="children_removed"?"child_removed":n,this.eventType===n}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new iv(this,e,n):null}createEvent(e,n){te(e.childName!=null,"Child events should have a childName.");let t=Ml(new qi(n._repo,n._path),e.childName),i=n._queryParams.getIndex();return new rv(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 r?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}};function Om(r,e,n,t,i){let o;if(typeof t=="object"&&(o=void 0,i=t),typeof t=="function"&&(o=t),i&&i.onlyOnce){let c=n,l=(u,d)=>{qO(r._repo,r,a),c(u,d)};l.userCallback=n.userCallback,l.context=n.context,n=l}let s=new Im(n,o||void 0),a=e==="value"?new vm(s):new ov(e,s);return Sre(r._repo,r,a),()=>qO(r._repo,r,a)}function bm(r,e,n,t){return Om(r,"value",e,n,t)}function yv(r,e,n,t){return Om(r,"child_added",e,n,t)}function Sv(r,e,n,t){return Om(r,"child_changed",e,n,t)}function Cb(r,e,n,t){return Om(r,"child_moved",e,n,t)}function Av(r,e,n,t){return Om(r,"child_removed",e,n,t)}function Rv(r,e,n){let t=null,i=n?new Im(n):null;e==="value"?t=new vm(i):e&&(t=new ov(e,i)),qO(r._repo,r,t)}var Pl=class{},YO=class extends Pl{constructor(e,n){super(),this._value=e,this._key=n,this.type="endAt"}_apply(e){wl("endAt",this._value,e._path,!0);let n=Jte(e._queryParams,this._value,this._key);if(D2(n),Db(n),e._queryParams.hasEnd())throw new Error("endAt: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new Ll(e._repo,e._path,n,e._orderByCalled)}};var sv=class extends Pl{constructor(e,n){super(),this._value=e,this._key=n,this.type="startAt"}_apply(e){wl("startAt",this._value,e._path,!0);let n=Xte(e._queryParams,this._value,this._key);if(D2(n),Db(n),e._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new Ll(e._repo,e._path,n,e._orderByCalled)}};function L2(r=null,e){return T2("startAt","key",e,!0),new sv(r,e)}var QO=class extends Pl{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 Ll(e._repo,e._path,Qte(e._queryParams,this._limit),e._orderByCalled)}};function M2(r){if(typeof r!="number"||Math.floor(r)!==r||r<=0)throw new Error("limitToLast: First argument must be a positive integer.");return new QO(r)}var XO=class extends Pl{constructor(e){super(),this._path=e,this.type="orderByChild"}_apply(e){Lre(e,"orderByChild");let n=new qe(this._path);if(Fe(n))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");let t=new dm(n),i=Zte(e._queryParams,t);return Db(i),new Ll(e._repo,e._path,i,!0)}};function P2(r){if(r==="$key")throw new Error('orderByChild: "$key" is invalid. Use orderByKey() instead.');if(r==="$priority")throw new Error('orderByChild: "$priority" is invalid. Use orderByPriority() instead.');if(r==="$value")throw new Error('orderByChild: "$value" is invalid. Use orderByValue() instead.');return yb("orderByChild","path",r,!1),new XO(r)}var JO=class extends Pl{constructor(e,n){super(),this._value=e,this._key=n,this.type="equalTo"}_apply(e){if(wl("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 YO(this._value,this._key)._apply(new sv(this._value,this._key)._apply(e))}};function x2(r,e){return T2("equalTo","key",e,!0),new JO(r,e)}function F2(r,...e){let n=Be(r);for(let t of e)n=t._apply(n);return n}Pne(qi);Vne(qi);var Mre="FIREBASE_DATABASE_EMULATOR_HOST",ZO={},Pre=!1;function xre(r,e,n,t){let i=e.lastIndexOf(":"),o=e.substring(0,i),s=$r(o);r.repoInfo_=new kI(e,s,r.repoInfo_.namespace,r.repoInfo_.webSocketOnly,r.repoInfo_.nodeAdmin,r.repoInfo_.persistenceKey,r.repoInfo_.includeNamespaceInQueryParams,!0,n),t&&(r.authTokenProvider_=t)}function Fre(r,e,n,t,i){let o=t||r.options.databaseURL;o===void 0&&(r.options.projectId||ws("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),An("Using default host for project ",r.options.projectId),o=`${r.options.projectId}-default-rtdb.firebaseio.com`);let s=I$(o,i),a=s.repoInfo,c,l;typeof process<"u"&&process.env&&(l=process.env[Mre]),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 sm(sm.OWNER):new lO(r.name,r.options,e);ure("Invalid Firebase Database URL",s),Fe(s.path)||ws("Database URL must point to the root of a Firebase Database (not including a child path).");let d=Ure(a,r,u,new cO(r,n));return new eb(d,r)}function kre(r,e){let n=ZO[e];(!n||n[r.key]!==r)&&ws(`Database ${e}(${r.repoInfo_}) has already been deleted.`),Are(r),delete n[r.key]}function Ure(r,e,n,t){let i=ZO[e.name];i||(i={},ZO[e.name]=i);let o=i[r.toURLString()];return o&&ws("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),o=new zO(r,Pre,n,t),i[r.toURLString()]=o,o}var eb=class{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(gre(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new qi(this._repo,ze())),this._rootInternal}_delete(){return this._rootInternal!==null&&(kre(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&ws("Cannot call "+e+" on a deleted database.")}};function Vre(){$$.IS_TRANSPORT_INITIALIZED&&Jn("Transport has already been initialized. Please call this function before calling ref or setting up a listener")}function Nb(){Vre(),$d.forceDisallow(),UI.forceAllow()}function rh(r=Sr(),e){let n=Po(r,"database").getImmediate({identifier:e});if(!n._instanceStarted){let t=kd("database");t&&k2(n,...t)}return n}function k2(r,e,n,t={}){r=Be(r),r._checkNotDeleted("useEmulator");let i=`${e}:${n}`,o=r._repoInternal;if(r._instanceStarted){if(i===r._repoInternal.repoInfo_.host&&Bi(t,o.repoInfo_.emulatorOptions))return;ws("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(o.repoInfo_.nodeAdmin)t.mockUserToken&&ws('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 sm(sm.OWNER);else if(t.mockUserToken){let a=typeof t.mockUserToken=="string"?t.mockUserToken:uI(t.mockUserToken,r.app.options.projectId);s=new sm(a)}$r(e)&&(Ta(e),gl("Database",!0)),xre(o,i,t,s)}function Bre(r){ete(Sa),lr(new fn("database",(e,{instanceIdentifier:n})=>{let t=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),o=e.getProvider("app-check-internal");return Fre(t,i,o,n)},"PUBLIC").setMultipleInstances(!0)),Ke(jG,HG,r),Ke(jG,HG,"esm2017")}var tb=class{constructor(e,n){this.committed=e,this.snapshot=n}toJSON(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}}};function U2(r,e,n){var t;if(r=Be(r),ba("Reference.transaction",r._path),r.key===".length"||r.key===".keys")throw"Reference.transaction failed: "+r.key+" is a read-only object.";let i=(t=n?.applyLocally)!==null&&t!==void 0?t:!0,o=new Sn,s=(c,l,u)=>{let d=null;c?o.reject(c):(d=new Jd(u,new qi(r._repo,r._path),yt),o.resolve(new tb(l,d)))},a=bm(r,()=>{});return Rre(r._repo,r._path,e,s,a,i),o.promise}ab.prototype.simpleListen=function(r,e){this.sendRequest("q",{p:r},e)};ab.prototype.echo=function(r,e){this.sendRequest("echo",{d:r},e)};Bre();var Ul,Dn=(function(r){return r.added="child_added",r.removed="child_removed",r.changed="child_changed",r.moved="child_moved",r.value="value",r})(Dn||{}),Gre=Object.freeze((Ul={},Ul[Dn.added]=yv,Ul[Dn.removed]=Av,Ul[Dn.changed]=Sv,Ul[Dn.moved]=Cb,Ul[Dn.value]=bm,Ul));function Cv(r,e){return new pe(function(n){var t=Gre[e](r,function(i,o){n.next({snapshot:i,prevKey:o,event:e})},n.error.bind(n));return{unsubscribe:function(){Rv(r,e,t)}}}).pipe($S(0))}var Dv=function(){return Dv=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++){n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Dv.apply(this,arguments)};function Ob(r,e,n){if(n||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 r.concat(o||Array.prototype.slice.call(e))}function V2(r){return(r==null||r.length===0)&&(r=[Dn.added,Dn.removed,Dn.changed,Dn.moved]),r}function B2(r,e){return e===void 0&&(e={}),Cv(r,Dn.value).pipe(ge(function(n){return bb(n,e)}))}function bb(r,e){var n;e===void 0&&(e={});var t=r.snapshot.val();return!r.snapshot.exists()||typeof t!="object"?t:Dv(Dv({},t),e.keyField?(n={},n[e.keyField]=r.snapshot.key,n):null)}function G2(r,e){e===void 0&&(e={});var n=V2(e.events),t=n.map(function(i){return Cv(r,i)});return ju.apply(void 0,t)}function $re(r){return Mr(vv(r)).pipe(ge(function(e){var n=Dn.value;return{snapshot:e,prevKey:null,event:n}}))}function $2(r,e){e===void 0&&(e={});var n=V2(e.events);return $re(r).pipe(pt(function(t){var i=[de(t)];return n.forEach(function(o){i.push(Cv(r,o))}),ju.apply(void 0,i).pipe(AE(Hre,[]))}),rt())}function j2(r,e){return e===void 0&&(e={}),$2(r).pipe(ge(function(n){return n.map(function(t){return bb(t,e)})}))}function H2(r,e){for(var n=r.length,t=0;t<n;t++)if(r[t].snapshot.key===e)return t;return-1}function jre(r,e){if(e==null)return 0;var n=H2(r,e);return n===-1?r.length:n+1}function Hre(r,e){var n=e.snapshot,t=e.prevKey,i=e.event,o=n.key,s=H2(r,o),a=jre(r,t||void 0);switch(i){case Dn.value:if(e.snapshot&&e.snapshot.exists()){var c=null;e.snapshot.forEach(function(d){var f={snapshot:d,event:Dn.value,prevKey:c};return c=d.key,r=Ob(Ob([],r,!0),[f],!1),!1})}return r;case Dn.added:if(s>-1){var l=r[s-1];(l&&l.snapshot.key||null)!==t&&(r=r.filter(function(d){return d.snapshot.key!==n.key}),r.splice(a,0,e))}else{if(t==null)return Ob([e],r,!0);r=r.slice(),r.splice(a,0,e)}return r;case Dn.removed:return r.filter(function(d){return d.snapshot.key!==n.key});case Dn.changed:return r.map(function(d){return d.snapshot.key===o?e:d});case Dn.moved:if(s>-1){var u=r.splice(s,1)[0];return r=r.slice(),r.splice(a,0,u),r}return r;default:return r}}var wm=class{constructor(e){return e}},W2="database",wb=class{constructor(){return Ns(W2)}};var Lb=new ee("angularfire2.database-instances");function Wre(r,e){let n=Aa(W2,r,e);return n&&new wm(n)}function zre(r){return(e,n)=>{let t=e.runOutsideAngular(()=>r(n));return new wm(t)}}var qre={provide:wb,deps:[[new un,Lb]]},Kre={provide:wm,useFactory:Wre,deps:[[new un,Lb],ji]};function hxe(r,...e){return Ke("angularfire",Gi.full,"rtdb"),pr([Kre,qre,{provide:Lb,useFactory:zre(r),multi:!0,deps:[we,lt,$i,Os,[new un,vl],[new un,Da],...e]}])}var z2=_e(j2,!0);var q2=_e(B2,!0),K2=_e(G2,!0);var Yre=_e(x2,!0,2);var Lm=_e(vv,!0),fxe=_e(rh,!0);var Qre=_e(M2,!0,2),Y2=_e(Rv,!0),Q2=_e(yv,!0),X2=_e(Sv,!0);var J2=_e(Av,!0),Z2=_e(N2,!0),Mb=_e(bm,!0),Xre=_e(P2,!0,2);var ej=_e(O2,!0,2),tj=_e(F2,!0,2),ih=_e(C2,!0,2);var nj=_e(b2,!0,2),rj=_e(U2,!0),ij=_e(Iv,!0,2);var Jre=_e(L2,!0,2),oj=_e(w2,!0,2);var sj=(()=>{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 ul;return this.setLocalStorageData(i),i}}catch(t){return this.loggingService.catch("Error in getLocalStorageData:",t),new ul}}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 ul;return this.setSessionStorageData(i),i}}catch(t){return this.loggingService.catch("Error in getSessionStorageData:",t),new ul}}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)(C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var aj=(()=>{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 As,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 As}}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)(C(sj),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var vt=(()=>{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 Ct),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 Ct);let i=this.actionSubjects.get(t);return i?i.asObservable():de(null)}catch(i){return this.loggingService.catch("Error in CoreActionsService onAction: ",i),de(null)}}};e.\u0275fac=function(i){return new(i||e)(C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();function cj(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,t=Array(e);n<e;n++)t[n]=r[n];return t}function tie(r){if(Array.isArray(r))return r}function nie(r,e){var n=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(n!=null){var t,i,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(r)).next,e!==0)for(;!(c=(t=o.call(n)).done)&&(a.push(t.value),a.length!==e);c=!0);}catch(u){l=!0,i=u}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}function rie(){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 iie(r,e){return tie(r)||nie(r,e)||oie(r,e)||rie()}function oie(r,e){if(r){if(typeof r=="string")return cj(r,e);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cj(r,e):void 0}}var yj=Object.entries,lj=Object.setPrototypeOf,sie=Object.isFrozen,aie=Object.getPrototypeOf,cie=Object.getOwnPropertyDescriptor,kn=Object.freeze,Un=Object.seal,sh=Object.create,Sj=typeof Reflect<"u"&&Reflect,Vb=Sj.apply,Bb=Sj.construct;kn||(kn=function(e){return e});Un||(Un=function(e){return e});Vb||(Vb=function(e,n){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(n,i)});Bb||(Bb=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];return new e(...t)});var Mm=Jt(Array.prototype.forEach),lie=Jt(Array.prototype.lastIndexOf),uj=Jt(Array.prototype.pop),oh=Jt(Array.prototype.push),uie=Jt(Array.prototype.splice),Ua=Array.isArray,Fm=Jt(String.prototype.toLowerCase),Pb=Jt(String.prototype.toString),dj=Jt(String.prototype.match),Pm=Jt(String.prototype.replace),hj=Jt(String.prototype.indexOf),die=Jt(String.prototype.trim),hie=Jt(Number.prototype.toString),fie=Jt(Boolean.prototype.toString),fj=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),gj=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),Cn=Jt(Object.prototype.hasOwnProperty),xm=Jt(Object.prototype.toString),Fn=Jt(RegExp.prototype.test),Vl=gie(TypeError);function Jt(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,t=new Array(n>1?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];return Vb(r,e,t)}}function gie(r){return function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return Bb(r,n)}}function $e(r,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fm;if(lj&&lj(r,null),!Ua(e))return r;let t=e.length;for(;t--;){let i=e[t];if(typeof i=="string"){let o=n(i);o!==i&&(sie(e)||(e[t]=o),i=o)}r[i]=!0}return r}function mie(r){for(let e=0;e<r.length;e++)Cn(r,e)||(r[e]=null);return r}function fr(r){let e=sh(null);for(let t of yj(r)){var n=iie(t,2);let i=n[0],o=n[1];Cn(r,i)&&(Ua(o)?e[i]=mie(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=fr(o):e[i]=o)}return e}function pie(r){switch(typeof r){case"string":return r;case"number":return hie(r);case"boolean":return fie(r);case"bigint":return fj?fj(r):"0";case"symbol":return gj?gj(r):"Symbol()";case"undefined":return xm(r);case"function":case"object":{if(r===null)return xm(r);let e=r,n=Vo(e,"toString");if(typeof n=="function"){let t=n(e);return typeof t=="string"?t:xm(t)}return xm(r)}default:return xm(r)}}function Vo(r,e){for(;r!==null;){let t=cie(r,e);if(t){if(t.get)return Jt(t.get);if(typeof t.value=="function")return Jt(t.value)}r=aie(r)}function n(){return null}return n}function Eie(r){try{return Fn(r,""),!0}catch{return!1}}var mj=kn(["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"]),xb=kn(["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"]),Fb=kn(["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"]),_ie=kn(["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"]),kb=kn(["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"]),Tie=kn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pj=kn(["#text"]),Ej=kn(["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"]),Ub=kn(["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"]),_j=kn(["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"]),Nv=kn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Iie=Un(/{{[\w\W]*|^[\w\W]*}}/g),vie=Un(/<%[\w\W]*|^[\w\W]*%>/g),yie=Un(/\${[\w\W]*/g),Sie=Un(/^data-[\-\w.\u00B7-\uFFFF]+$/),Aie=Un(/^aria-[\-\w]+$/),Tj=Un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rie=Un(/^(?:\w+script|data):/i),Die=Un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cie=Un(/^html$/i),Nie=Un(/^[a-z][.\w]*(-[.\w]+)+$/i),Ij=Un(/<[/\w!]/g),Oie=Un(/<[/\w]/g),bie=Un(/<\/no(script|embed|frames)/i),wie=Un(/\/>/i),Uo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Lie=function(){return typeof window>"u"?null:window},Mie=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let t=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(t=n.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}},vj=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ka=function(e,n,t,i){return Cn(e,n)&&Ua(e[n])?$e(i.base?fr(i.base):{},e[n],i.transform):t};function Aj(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lie(),e=re=>Aj(re);if(e.version="3.4.11",e.removed=[],!r||!r.document||r.document.nodeType!==Uo.document||!r.Element)return e.isSupported=!1,e;let n=r.document,t=n,i=t.currentScript;r.DocumentFragment;let o=r.HTMLTemplateElement,s=r.Node,a=r.Element,c=r.NodeFilter,l=r.NamedNodeMap;l===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let u=r.DOMParser,d=r.trustedTypes,f=a.prototype,g=Vo(f,"cloneNode"),p=Vo(f,"remove"),_=Vo(f,"nextSibling"),T=Vo(f,"childNodes"),D=Vo(f,"parentNode"),L=Vo(f,"shadowRoot"),B=Vo(f,"attributes"),w=s&&s.prototype?Vo(s.prototype,"nodeType"):null,F=s&&s.prototype?Vo(s.prototype,"nodeName"):null;if(typeof o=="function"){let re=n.createElement("template");re.content&&re.content.ownerDocument&&(n=re.content.ownerDocument)}let U,A="",R,N=!1,b=0,x=function(){if(b>0)throw Vl('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.')},k=function(S){x(),b++;try{return U.createHTML(S)}finally{b--}},O=function(S){x(),b++;try{return U.createScriptURL(S)}finally{b--}},yi=function(){return N||(R=Mie(d,i),N=!0),R},eo=n,tf=eo.implementation,Bs=eo.createNodeIterator,dc=eo.createDocumentFragment,nf=eo.getElementsByTagName,Vp=t.importNode,Lt=vj();e.isSupported=typeof yj=="function"&&typeof D=="function"&&tf&&tf.createHTMLDocument!==void 0;let to=Iie,_n=vie,mS=yie,hc=Sie,pS=Aie,fc=Rie,Bp=Die,ES=Nie,gc=Tj,st=null,fu=$e({},[...mj,...xb,...Fb,...kb,...pj]),ft=null,gu=$e({},[...Ej,...Ub,..._j,...Nv]),gt=Object.seal(sh(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}})),Gs=null,rf=null,no=Object.seal(sh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),of=!0,mu=!0,pu=!1,sf=!0,ro=!1,Yo=!0,Si=!1,mc=!1,zt=null,on=null,$s=!1,Qo=!1,pc=!1,Eu=!1,js=!0,af=!1,cf="user-content-",Ec=!0,lf=!1,Hs={},gr=null,_u=$e({},["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"]),uf=null,Ws=$e({},["audio","video","img","source","image","track"]),_c=null,Tu=$e({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xr="http://www.w3.org/1998/Math/MathML",Tc="http://www.w3.org/2000/svg",nr="http://www.w3.org/1999/xhtml",Xo=nr,Jo=!1,Iu=null,On=$e({},[Xr,Tc,nr],Pb),df=kn(["mi","mo","mn","ms","mtext"]),Zo=$e({},df),zs=kn(["annotation-xml"]),hf=$e({},zs),_S=$e({},["title","style","font","a","script"]),Jr=null,TS=["application/xhtml+xml","text/html"],IS="text/html",at=null,es=null,ff=n.createElement("form"),Ic=function(S){return S instanceof RegExp||S instanceof Function},Zr=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(es&&es===S)return;(!S||typeof S!="object")&&(S={}),S=fr(S),Jr=TS.indexOf(S.PARSER_MEDIA_TYPE)===-1?IS:S.PARSER_MEDIA_TYPE,at=Jr==="application/xhtml+xml"?Pb:Fm,st=ka(S,"ALLOWED_TAGS",fu,{transform:at}),ft=ka(S,"ALLOWED_ATTR",gu,{transform:at}),Iu=ka(S,"ALLOWED_NAMESPACES",On,{transform:Pb}),_c=ka(S,"ADD_URI_SAFE_ATTR",Tu,{transform:at,base:Tu}),uf=ka(S,"ADD_DATA_URI_TAGS",Ws,{transform:at,base:Ws}),gr=ka(S,"FORBID_CONTENTS",_u,{transform:at}),Gs=ka(S,"FORBID_TAGS",fr({}),{transform:at}),rf=ka(S,"FORBID_ATTR",fr({}),{transform:at}),Hs=Cn(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?fr(S.USE_PROFILES):S.USE_PROFILES:!1,of=S.ALLOW_ARIA_ATTR!==!1,mu=S.ALLOW_DATA_ATTR!==!1,pu=S.ALLOW_UNKNOWN_PROTOCOLS||!1,sf=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ro=S.SAFE_FOR_TEMPLATES||!1,Yo=S.SAFE_FOR_XML!==!1,Si=S.WHOLE_DOCUMENT||!1,Qo=S.RETURN_DOM||!1,pc=S.RETURN_DOM_FRAGMENT||!1,Eu=S.RETURN_TRUSTED_TYPE||!1,$s=S.FORCE_BODY||!1,js=S.SANITIZE_DOM!==!1,af=S.SANITIZE_NAMED_PROPS||!1,Ec=S.KEEP_CONTENT!==!1,lf=S.IN_PLACE||!1,gc=Eie(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:Tj,Xo=typeof S.NAMESPACE=="string"?S.NAMESPACE:nr,Zo=Cn(S,"MATHML_TEXT_INTEGRATION_POINTS")&&S.MATHML_TEXT_INTEGRATION_POINTS&&typeof S.MATHML_TEXT_INTEGRATION_POINTS=="object"?fr(S.MATHML_TEXT_INTEGRATION_POINTS):$e({},df),hf=Cn(S,"HTML_INTEGRATION_POINTS")&&S.HTML_INTEGRATION_POINTS&&typeof S.HTML_INTEGRATION_POINTS=="object"?fr(S.HTML_INTEGRATION_POINTS):$e({},zs);let G=Cn(S,"CUSTOM_ELEMENT_HANDLING")&&S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING=="object"?fr(S.CUSTOM_ELEMENT_HANDLING):sh(null);if(gt=sh(null),Cn(G,"tagNameCheck")&&Ic(G.tagNameCheck)&&(gt.tagNameCheck=G.tagNameCheck),Cn(G,"attributeNameCheck")&&Ic(G.attributeNameCheck)&&(gt.attributeNameCheck=G.attributeNameCheck),Cn(G,"allowCustomizedBuiltInElements")&&typeof G.allowCustomizedBuiltInElements=="boolean"&&(gt.allowCustomizedBuiltInElements=G.allowCustomizedBuiltInElements),Un(gt),ro&&(mu=!1),pc&&(Qo=!0),Hs&&(st=$e({},pj),ft=sh(null),Hs.html===!0&&($e(st,mj),$e(ft,Ej)),Hs.svg===!0&&($e(st,xb),$e(ft,Ub),$e(ft,Nv)),Hs.svgFilters===!0&&($e(st,Fb),$e(ft,Ub),$e(ft,Nv)),Hs.mathMl===!0&&($e(st,kb),$e(ft,_j),$e(ft,Nv))),no.tagCheck=null,no.attributeCheck=null,Cn(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?no.tagCheck=S.ADD_TAGS:Ua(S.ADD_TAGS)&&(st===fu&&(st=fr(st)),$e(st,S.ADD_TAGS,at))),Cn(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?no.attributeCheck=S.ADD_ATTR:Ua(S.ADD_ATTR)&&(ft===gu&&(ft=fr(ft)),$e(ft,S.ADD_ATTR,at))),Cn(S,"ADD_URI_SAFE_ATTR")&&Ua(S.ADD_URI_SAFE_ATTR)&&$e(_c,S.ADD_URI_SAFE_ATTR,at),Cn(S,"FORBID_CONTENTS")&&Ua(S.FORBID_CONTENTS)&&(gr===_u&&(gr=fr(gr)),$e(gr,S.FORBID_CONTENTS,at)),Cn(S,"ADD_FORBID_CONTENTS")&&Ua(S.ADD_FORBID_CONTENTS)&&(gr===_u&&(gr=fr(gr)),$e(gr,S.ADD_FORBID_CONTENTS,at)),Ec&&(st["#text"]=!0),Si&&$e(st,["html","head","body"]),st.table&&($e(st,["tbody"]),delete Gs.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let ne=U;U=S.TRUSTED_TYPES_POLICY;try{A=k("")}catch(ue){throw U=ne,ue}}else S.TRUSTED_TYPES_POLICY===null?(U=void 0,A=""):(U===void 0&&(U=yi()),U&&typeof A=="string"&&(A=k("")));kn&&kn(S),es=S},gf=$e({},[...xb,...Fb,..._ie]),mf=$e({},[...kb,...Tie]),pf=function(S,G,ne){return G.namespaceURI===nr?S==="svg":G.namespaceURI===Xr?S==="svg"&&(ne==="annotation-xml"||Zo[ne]):!!gf[S]},Ef=function(S,G,ne){return G.namespaceURI===nr?S==="math":G.namespaceURI===Tc?S==="math"&&hf[ne]:!!mf[S]},Gp=function(S,G,ne){return G.namespaceURI===Tc&&!hf[ne]||G.namespaceURI===Xr&&!Zo[ne]?!1:!mf[S]&&(_S[S]||!gf[S])},$p=function(S){let G=D(S);(!G||!G.tagName)&&(G={namespaceURI:Xo,tagName:"template"});let ne=Fm(S.tagName),ue=Fm(G.tagName);return Iu[S.namespaceURI]?S.namespaceURI===Tc?pf(ne,G,ue):S.namespaceURI===Xr?Ef(ne,G,ue):S.namespaceURI===nr?Gp(ne,G,ue):!!(Jr==="application/xhtml+xml"&&Iu[S.namespaceURI]):!1},io=function(S){oh(e.removed,{element:S});try{D(S).removeChild(S)}catch{if(p(S),!D(S))throw Vl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},vc=function(S){let G=T(S);if(G){let ue=[];Mm(G,be=>{oh(ue,be)}),Mm(ue,be=>{try{p(be)}catch{}})}let ne=B(S);if(ne)for(let ue=ne.length-1;ue>=0;--ue){let be=ne[ue],Ve=be&&be.name;if(typeof Ve=="string")try{S.removeAttribute(Ve)}catch{}}},oo=function(S,G){try{oh(e.removed,{attribute:G.getAttributeNode(S),from:G})}catch{oh(e.removed,{attribute:null,from:G})}if(G.removeAttribute(S),S==="is")if(Qo||pc)try{io(G)}catch{}else try{G.setAttribute(S,"")}catch{}},_f=function(S){let G=B(S);if(G)for(let ne=G.length-1;ne>=0;--ne){let ue=G[ne],be=ue&&ue.name;if(!(typeof be!="string"||ft[at(be)]))try{S.removeAttribute(be)}catch{}}},yc=function(S){let G=[S];for(;G.length>0;){let ne=G.pop();(w?w(ne):ne.nodeType)===Uo.element&&_f(ne);let be=T(ne);if(be)for(let Ve=be.length-1;Ve>=0;--Ve)G.push(be[Ve])}},so=function(S){let G=null,ne=null;if($s)S="<remove></remove>"+S;else{let Ve=dj(S,/^[\r\n\t ]+/);ne=Ve&&Ve[0]}Jr==="application/xhtml+xml"&&Xo===nr&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");let ue=U?k(S):S;if(Xo===nr)try{G=new u().parseFromString(ue,Jr)}catch{}if(!G||!G.documentElement){G=tf.createDocument(Xo,"template",null);try{G.documentElement.innerHTML=Jo?A:ue}catch{}}let be=G.body||G.documentElement;return S&&ne&&be.insertBefore(n.createTextNode(ne),be.childNodes[0]||null),Xo===nr?nf.call(G,Si?"html":"body")[0]:Si?G.documentElement:be},vu=function(S){return Bs.call(S.ownerDocument||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},yu=function(S){return S=Pm(S,to," "),S=Pm(S,_n," "),S=Pm(S,mS," "),S},Su=function(S){var G;S.normalize();let ne=Bs.call(S.ownerDocument||S,S,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),ue=ne.nextNode();for(;ue;)ue.data=yu(ue.data),ue=ne.nextNode();let be=(G=S.querySelectorAll)===null||G===void 0?void 0:G.call(S,"template");be&&Mm(be,Ve=>{ts(Ve.content)&&Su(Ve.content)})},Sc=function(S){let G=F?F(S):null;return typeof G!="string"||at(G)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==B(S)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==w(S)||S.childNodes!==T(S)},ts=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return w(S)===Uo.documentFragment}catch{return!1}},ns=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return typeof w(S)=="number"}catch{return!1}};function br(re,S,G){re.length!==0&&Mm(re,ne=>{ne.call(e,S,G,es)})}let jp=function(S,G){return!!(Yo&&S.hasChildNodes()&&!ns(S.firstElementChild)&&Fn(Ij,S.textContent)&&Fn(Ij,S.innerHTML)||Yo&&S.namespaceURI===nr&&G==="style"&&ns(S.firstElementChild)||S.nodeType===Uo.processingInstruction||Yo&&S.nodeType===Uo.comment&&Fn(Oie,S.data))},Hp=function(S,G){if(!Gs[G]&&Tf(G)&&(gt.tagNameCheck instanceof RegExp&&Fn(gt.tagNameCheck,G)||gt.tagNameCheck instanceof Function&&gt.tagNameCheck(G)))return!1;if(Ec&&!gr[G]){let ne=D(S),ue=T(S);if(ue&&ne){let be=ue.length;for(let Ve=be-1;Ve>=0;--Ve){let qt=lf?ue[Ve]:g(ue[Ve],!0);ne.insertBefore(qt,_(S))}}}return io(S),!0},Wp=function(S){if(br(Lt.beforeSanitizeElements,S,null),Sc(S))return io(S),!0;let G=at(F?F(S):S.nodeName);if(br(Lt.uponSanitizeElement,S,{tagName:G,allowedTags:st}),jp(S,G))return io(S),!0;if(Gs[G]||!(no.tagCheck instanceof Function&&no.tagCheck(G))&&!st[G])return Hp(S,G);if((w?w(S):S.nodeType)===Uo.element&&!$p(S)||(G==="noscript"||G==="noembed"||G==="noframes")&&Fn(bie,S.innerHTML))return io(S),!0;if(ro&&S.nodeType===Uo.text){let ue=yu(S.textContent);S.textContent!==ue&&(oh(e.removed,{element:S.cloneNode()}),S.textContent=ue)}return br(Lt.afterSanitizeElements,S,null),!1},zp=function(S,G,ne){if(rf[G]||js&&(G==="id"||G==="name")&&(ne in n||ne in ff))return!1;let ue=ft[G]||no.attributeCheck instanceof Function&&no.attributeCheck(G,S);if(!(mu&&Fn(hc,G))){if(!(of&&Fn(pS,G))){if(ue){if(!_c[G]){if(!Fn(gc,Pm(ne,Bp,""))){if(!((G==="src"||G==="xlink:href"||G==="href")&&S!=="script"&&hj(ne,"data:")===0&&uf[S])){if(!(pu&&!Fn(fc,Pm(ne,Bp,"")))){if(ne)return!1}}}}}else if(!(Tf(S)&&(gt.tagNameCheck instanceof RegExp&&Fn(gt.tagNameCheck,S)||gt.tagNameCheck instanceof Function&&gt.tagNameCheck(S))&&(gt.attributeNameCheck instanceof RegExp&&Fn(gt.attributeNameCheck,G)||gt.attributeNameCheck instanceof Function&&gt.attributeNameCheck(G,S))||G==="is"&&gt.allowCustomizedBuiltInElements&&(gt.tagNameCheck instanceof RegExp&&Fn(gt.tagNameCheck,ne)||gt.tagNameCheck instanceof Function&&gt.tagNameCheck(ne))))return!1}}return!0},qp=$e({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Tf=function(S){return!qp[Fm(S)]&&Fn(ES,S)},vS=function(S,G,ne,ue){if(U&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ne)switch(d.getAttributeType(S,G)){case"TrustedHTML":return k(ue);case"TrustedScriptURL":return O(ue)}return ue},rs=function(S,G,ne,ue){try{ne?S.setAttributeNS(ne,G,ue):S.setAttribute(G,ue),Sc(S)?io(S):uj(e.removed)}catch{oo(G,S)}},ei=function(S){br(Lt.beforeSanitizeAttributes,S,null);let G=S.attributes;if(!G||Sc(S))return;let ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ft,forceKeepAttr:void 0},ue=G.length,be=at(S.nodeName);for(;ue--;){let Ve=G[ue],qt=Ve.name,Ut=Ve.namespaceURI,mr=Ve.value,wr=at(qt),os=mr,At=qt==="value"?os:die(os);if(ne.attrName=wr,ne.attrValue=At,ne.keepAttr=!0,ne.forceKeepAttr=void 0,br(Lt.uponSanitizeAttribute,S,ne),At=ne.attrValue,af&&(wr==="id"||wr==="name")&&hj(At,cf)!==0&&(oo(qt,S),At=cf+At),Yo&&Fn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){oo(qt,S);continue}if(wr==="attributename"&&dj(At,"href")){oo(qt,S);continue}if(!ne.forceKeepAttr){if(!ne.keepAttr){oo(qt,S);continue}if(!sf&&Fn(wie,At)){oo(qt,S);continue}if(ro&&(At=yu(At)),!zp(be,wr,At)){oo(qt,S);continue}At=vS(be,wr,Ut,At),At!==os&&rs(S,qt,Ut,At)}}br(Lt.afterSanitizeAttributes,S,null)},is=function(S){let G=null,ne=vu(S);for(br(Lt.beforeSanitizeShadowDOM,S,null);G=ne.nextNode();)if(br(Lt.uponSanitizeShadowNode,G,null),Wp(G),ei(G),ts(G.content)&&is(G.content),(w?w(G):G.nodeType)===Uo.element){let be=L(G);ts(be)&&(qs(be),is(be))}br(Lt.afterSanitizeShadowDOM,S,null)},qs=function(S){let G=[{node:S,shadow:null}];for(;G.length>0;){let ne=G.pop();if(ne.shadow){is(ne.shadow);continue}let ue=ne.node,Ve=(w?w(ue):ue.nodeType)===Uo.element,qt=T(ue);if(qt)for(let Ut=qt.length-1;Ut>=0;--Ut)G.push({node:qt[Ut],shadow:null});if(Ve){let Ut=F?F(ue):null;if(typeof Ut=="string"&&at(Ut)==="template"){let mr=ue.content;ts(mr)&&G.push({node:mr,shadow:null})}}if(Ve){let Ut=L(ue);ts(Ut)&&G.push({node:null,shadow:Ut},{node:Ut,shadow:null})}}};return e.sanitize=function(re){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=null,ne=null,ue=null,be=null;if(Jo=!re,Jo&&(re="<!-->"),typeof re!="string"&&!ns(re)&&(re=pie(re),typeof re!="string"))throw Vl("dirty is not a string, aborting");if(!e.isSupported)return re;mc?(st=zt,ft=on):Zr(S),(Lt.uponSanitizeElement.length>0||Lt.uponSanitizeAttribute.length>0)&&(st=fr(st)),Lt.uponSanitizeAttribute.length>0&&(ft=fr(ft)),e.removed=[];let Ve=lf&&typeof re!="string"&&ns(re);if(Ve){let mr=F?F(re):re.nodeName;if(typeof mr=="string"){let wr=at(mr);if(!st[wr]||Gs[wr])throw Vl("root node is forbidden and cannot be sanitized in-place")}if(Sc(re))throw Vl("root node is clobbered and cannot be sanitized in-place");try{qs(re)}catch(wr){throw vc(re),wr}}else if(ns(re))G=so("<!---->"),ne=G.ownerDocument.importNode(re,!0),ne.nodeType===Uo.element&&ne.nodeName==="BODY"||ne.nodeName==="HTML"?G=ne:G.appendChild(ne),qs(ne);else{if(!Qo&&!ro&&!Si&&re.indexOf("<")===-1)return U&&Eu?k(re):re;if(G=so(re),!G)return Qo?null:Eu?A:""}G&&$s&&io(G.firstChild);let qt=vu(Ve?re:G);try{for(;ue=qt.nextNode();)Wp(ue),ei(ue),ts(ue.content)&&is(ue.content)}catch(mr){throw Ve&&vc(re),mr}if(Ve)return Mm(e.removed,mr=>{mr.element&&yc(mr.element)}),ro&&Su(re),re;if(Qo){if(ro&&Su(G),pc)for(be=dc.call(G.ownerDocument);G.firstChild;)be.appendChild(G.firstChild);else be=G;return(ft.shadowroot||ft.shadowrootmode)&&(be=Vp.call(t,be,!0)),be}let Ut=Si?G.outerHTML:G.innerHTML;return Si&&st["!doctype"]&&G.ownerDocument&&G.ownerDocument.doctype&&G.ownerDocument.doctype.name&&Fn(Cie,G.ownerDocument.doctype.name)&&(Ut="<!DOCTYPE "+G.ownerDocument.doctype.name+`>
146
- `+Ut),ro&&(Ut=yu(Ut)),U&&Eu?k(Ut):Ut},e.setConfig=function(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zr(re),mc=!0,zt=st,on=ft},e.clearConfig=function(){es=null,mc=!1,zt=null,on=null,U=R,A=""},e.isValidAttribute=function(re,S,G){es||Zr({});let ne=at(re),ue=at(S);return zp(ne,ue,G)},e.addHook=function(re,S){typeof S=="function"&&Cn(Lt,re)&&oh(Lt[re],S)},e.removeHook=function(re,S){if(Cn(Lt,re)){if(S!==void 0){let G=lie(Lt[re],S);return G===-1?void 0:uie(Lt[re],G,1)[0]}return uj(Lt[re])}},e.removeHooks=function(re){Cn(Lt,re)&&(Lt[re]=[])},e.removeAllHooks=function(){Lt=vj()},e}var Ov=Aj();var Rj={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},bv=(()=>{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 Ct,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 Ct,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 hi),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(Pu(),ea(([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?KV("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):YV("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 UV(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&&Mg(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 D=this.getVisibleText(T),L=this.hashText(D);L&&L===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(ge(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&&Mg(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{ju(fo(window,"offline").pipe(ge(()=>!1)),fo(window,"online").pipe(ge(()=>!0)),new pe(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 hi),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 fo(window,"keydown")}catch(t){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",t),Oc}}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(),D=d-T.x,L=f-T.y,B=D*100/(T.width||1),w=L*100/(T.height||1),F={xpath:p,fXpath:_,leftPercentage:B,topPercentage:w};if(s){let U=this.getXPath(g,!0,!0);F.cfXpath=U}if(c){let U=this.generateAnchorRecord(g);U&&(F.anchor=U)}return F}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=[]:Mg(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)&&Mg(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=Z();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 bg;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 bg}}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(M({},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(ge(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(ge(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),de([])}}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),de([])}}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 pe(t=>{let i=fo(document,"mousedown").pipe(ge(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),o=fo(document,"mousemove").pipe(ge(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),s=fo(document,"mouseup").pipe(ge(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),c=i.pipe(pt(l=>o.pipe(Pu(),ge(([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=WC(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),de(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 mt}}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;"),Ov.sanitize(t,Rj)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeHtmlForPaste(t){try{let i=this.convertStylesToTags(t);return Ov.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 Ov.sanitize(t,Rj)}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 hi;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),de(new hi)}}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=Z(),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 hi}}isMobileDevice(){try{return new hi().getDeviceType()===Br.MOBILE}catch(t){return this.loggingService.catch("Error in DomService isMobileDevice: ",t),!1}}isTabletDevice(){try{return new hi().getDeviceType()===Br.TABLET}catch(t){return this.loggingService.catch("Error in DomService isTabletDevice: ",t),!1}}isDesktopDevice(){try{return new hi().getDeviceType()===Br.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 hi().getDeviceType()===Br.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)(C(Ot),C(Es),C(me),C(wC))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Pie=["unauthenticated","permission-denied","not-found","invalid-argument","failed-precondition","resource-exhausted"],bxe=[...Pie,"unimplemented"];function Cj(r){return!!r&&r.backend==="portable"&&typeof r.wsEndpoint=="string"&&typeof r.apiEndpoint=="string"}function xie(r,e){let n=M(M({},r),e||{});return n.userId=r.userId,n.userSnippylyId=r.userSnippylyId,n.type=r.type,n.organizationId=r.organizationId,n.clientOrganizationId=r.clientOrganizationId,n.groupId=r.groupId,n.clientGroupId=r.clientGroupId,n.contacts=r.contacts,n.plan=r.plan,n.isAdmin=r.isAdmin,n.isReadOnly=r.isReadOnly,n.isAnonymous=r.isAnonymous,n.isGuest=r.isGuest,n.color=e?.color||r.color,n.textColor=e?.textColor||r.textColor,n.initial=e?.initial||n.name?.charAt(0).toUpperCase()||n.email?.charAt(0).toUpperCase()||r.initial,n?.photoUrl===void 0&&(n.photoUrl=null),n}var Dr=(()=>{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.endpointsService=J(xo),this.portableBackend$=new Y(null),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 As,this.loggedInUserResolveRetryDelaysMs=[2e3,8e3,3e4],this.loggedInUserResolveRetryInFlightUserId=null,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(Rd).subscribe(f=>{this.commentService=f??void 0}),this.serviceBook.observe(GT).subscribe(f=>{this.reactionService=f??void 0}),this.serviceBook.observe($T).subscribe(f=>{this.areaService=f??void 0}),this.serviceBook.observe(jT).subscribe(f=>{this.activityService=f??void 0,f&&this.cachedActivityConfig&&f.setActivityFeatureConfig(this.cachedActivityConfig)}),this.serviceBook.observe(B1).subscribe(f=>{this.viewsService=f??null}),this.serviceBook.observe(G1).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=yl(this.afAuth).pipe(xu(this.afAuth.currentUser),Pu(),pt(([f,g])=>this.domService.onNetworkStatusChange$().pipe(Rt(p=>p),Dt(1),ge(()=>({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(),D=_-T;T>_&&(this.analyticsService.trackEvent(P.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:D,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(P.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:D,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(P.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:D,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(rt(Pt)).subscribe(f=>{let g=qC(f);this.coreActionsService.triggerAction(H.USER_UPDATE,g),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:H.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 YT),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)}else try{let s=this.afAuth?.config;s&&s.apiHost!=="identitytoolkit.googleapis.com"&&(s.apiHost="identitytoolkit.googleapis.com",s.tokenApiHost="securetoken.googleapis.com")}catch(s){this.loggingService.catch("Error resetting auth proxy config: ",s)}i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||yl(this.afAuth).pipe(Dt(1)).subscribe(s=>I(this,null,function*(){if(this.autoLoginCalled=!0,s){let a=yield Zg(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(M({},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(P.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 zC(()=>window.Velt.identify(t.user,M(M({},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(H.ERROR).pipe(Rt(s=>s.code==="token_expired"),Dt(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 zC(()=>I(this,null,function*(){try{let g=yield t.generateToken?.();return g?window.Velt.identify(t.user,M(M({},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 hl(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 HC(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(M({},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=WV(this.configService.getApiKey(),t.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let c=yield yl(this.afAuth).pipe(Dt(1)).toPromise().catch(u=>null),l=!0;if(this.providedUser=JSON.parse(JSON.stringify(t)),c){let u=yield Zg(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(P.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(P.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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("validateClient"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),d=Gr(),f=(yield u({apiKey:this.apiKey,user:t,version:d,authToken:i?.authToken}))?.data;if(f.error){if(this.analyticsService.trackEvent(P.Events.Core.SDK_VALIDATE_CLIENT_FAILED,le(M({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(H.ERROR,g)}else{let g={code:"too_many_retries",message:"Token expired. Too many retries.",error:f?.error,source:f?.source};this.coreActionsService.triggerAction(H.ERROR,g),this.analyticsService.trackEvent(P.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(H.ERROR,g)}throw f}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(P.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),this.configService?.getEnablePortableBackend()&&Cj(f))this.handlePortableBackendResponse(f);else if(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 Zg(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=Gr();return(t?parseInt(t.split(".")?.[0]||"0"):0)>=4}catch(t){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",t),!1}}isVersion4Point5(){try{let t=Gr();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:M(M({},this.endpointsService.getFirebaseConfig()),t)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}handlePortableBackendResponse(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: handlePortableBackendResponse","color: green;"),this.portableBackend$.next({backend:t?.backend,wsEndpoint:t?.wsEndpoint,apiEndpoint:t?.apiEndpoint}),this.loggingService.warn("Received a portable-backend identify() response. Portable transport is not implemented in this SDK build; recorded backend/endpoints but did not sign in. (self-hosting Step 0 scaffolding)")}catch(i){this.loggingService.catch("Error in handlePortableBackendResponse: ",i)}}getPortableBackend(){return this.portableBackend$.value}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 ti([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(ge(()=>this.getAdvancedQueriesEnabled()),as(()=>de(!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}getProvidedOrCurrentUserId(){try{return this.providedUser?.userId??this.user$.value?.userId??void 0}catch(t){this.loggingService.catch("Error in getProvidedOrCurrentUserId: ",t);return}}scheduleLoggedInUserResolveRetry(t,i){return I(this,null,function*(){try{if(!t||this.loggedInUserResolveRetryInFlightUserId===t)return;this.loggedInUserResolveRetryInFlightUserId=t;let o=this.loggedInUserResolveRetryDelaysMs;for(let s=0;s<o.length;s++){if(yield new Promise(l=>setTimeout(l,o[s])),(this.providedUser?.userId??this.user$.value?.userId)!==t)return;let a=yield this.usersService?.resolveUsers({userIds:[t],organizationId:i,skipUserCheck:!0,forceResolve:!0,moduleName:Ea.IDENTIFY});if((this.providedUser?.userId??this.user$.value?.userId)!==t)return;let c=a?.[t];if(c&&this.applyLateResolvedLoggedInUser(t,c))return}this.loggingService.catch(`User resolver did not return the logged-in user after ${o.length} retry attempts \u2014 comments created by this author will have no resolved profile until the resolver returns them`,{userId:t,organizationId:i,attempts:o.length})}catch(o){this.loggingService.catch("Error in scheduleLoggedInUserResolveRetry: ",o)}finally{this.loggedInUserResolveRetryInFlightUserId===t&&(this.loggedInUserResolveRetryInFlightUserId=null)}})}applyLateResolvedLoggedInUser(t,i){try{let o=this.user$.value;if(!o||o.userId!==t)return!1;if(!this.afAuth?.currentUser)return!0;let s=xie(o,i);return this.setUserToStorage(s),this.user$.next(s),!0}catch(o){return this.loggingService.catch("Error in applyLateResolvedLoggedInUser: ",o),!1}}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),yl(this.afAuth).pipe(pt(t=>t?this.user$.asObservable():de(null)),rt(Pt))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getAuthState$(){return yl(this.afAuth)}getIdTokenResultForUser(t,i){return Zg(t,i)}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=M(M({},this.providedUser),t),i){let o=M(M({},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 OG(this.afAuth,i).then(s=>(this.analyticsService.trackEvent(P.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(P.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(BT)?.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 As;s.userSnippylyId=t.uid,s.type="signedIn",o&&(s=M(M({},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=Z(),a=Ea.IDENTIFY;this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Ln.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]||{})):this.scheduleLoggedInUserResolveRetry(t.userId,this.providedUser?.organizationId||t.organizationId),t=M(M({},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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()})),s=Md({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:Qn.IDENTIFY,organizationId:t.clientOrganizationId}}],d=Z();this.coreActionsService.triggerAction(H.PERMISSION_PROVIDER,{event:P.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Qn.IDENTIFY,uniqueId:d,timestamp:new Date().getTime(),source:"internal",payload:{requests:u}}),a=this.userPermissionService?.onResourceAccessRequired({requests:u,uniqueId:d,userId:t.userId,methodName:Qn.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(M({},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 Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("getPlanDetails"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:Gr(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(P.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(Rt(t=>!!t),ge(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(pt(t=>t?this.userOrganization$.asObservable().pipe(ge(i=>i?.metadata?.organizationId===t.organizationId?i:null)):de(null)))}signOutUser(t="internal"){return I(this,null,function*(){try{this.userPermissionService?.invalidateAllPermissionsState(),t==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(P.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 yl(this.afAuth).pipe(Dt(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 qV(1e3),bG(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 $V(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 qC(t)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}getUserAvatarColor(t){try{return t?this.avatarService.generateUserColor(Tr(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)(C(Il),C(Xn),C(aj),C(vt),C(bv),C(ur),C(Ot),C(me),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Nj=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Oj={};var Ls,Gb;(function(){var r;function e(A,R){function N(){}N.prototype=R.prototype,A.D=R.prototype,A.prototype=new N,A.prototype.constructor=A,A.C=function(b,x,k){for(var O=Array(arguments.length-2),yi=2;yi<arguments.length;yi++)O[yi-2]=arguments[yi];return R.prototype[x].apply(b,O)}}function n(){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,n),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,R,N){N||(N=0);var b=Array(16);if(typeof R=="string")for(var x=0;16>x;++x)b[x]=R.charCodeAt(N++)|R.charCodeAt(N++)<<8|R.charCodeAt(N++)<<16|R.charCodeAt(N++)<<24;else for(x=0;16>x;++x)b[x]=R[N++]|R[N++]<<8|R[N++]<<16|R[N++]<<24;R=A.g[0],N=A.g[1],x=A.g[2];var k=A.g[3],O=R+(k^N&(x^k))+b[0]+3614090360&4294967295;R=N+(O<<7&4294967295|O>>>25),O=k+(x^R&(N^x))+b[1]+3905402710&4294967295,k=R+(O<<12&4294967295|O>>>20),O=x+(N^k&(R^N))+b[2]+606105819&4294967295,x=k+(O<<17&4294967295|O>>>15),O=N+(R^x&(k^R))+b[3]+3250441966&4294967295,N=x+(O<<22&4294967295|O>>>10),O=R+(k^N&(x^k))+b[4]+4118548399&4294967295,R=N+(O<<7&4294967295|O>>>25),O=k+(x^R&(N^x))+b[5]+1200080426&4294967295,k=R+(O<<12&4294967295|O>>>20),O=x+(N^k&(R^N))+b[6]+2821735955&4294967295,x=k+(O<<17&4294967295|O>>>15),O=N+(R^x&(k^R))+b[7]+4249261313&4294967295,N=x+(O<<22&4294967295|O>>>10),O=R+(k^N&(x^k))+b[8]+1770035416&4294967295,R=N+(O<<7&4294967295|O>>>25),O=k+(x^R&(N^x))+b[9]+2336552879&4294967295,k=R+(O<<12&4294967295|O>>>20),O=x+(N^k&(R^N))+b[10]+4294925233&4294967295,x=k+(O<<17&4294967295|O>>>15),O=N+(R^x&(k^R))+b[11]+2304563134&4294967295,N=x+(O<<22&4294967295|O>>>10),O=R+(k^N&(x^k))+b[12]+1804603682&4294967295,R=N+(O<<7&4294967295|O>>>25),O=k+(x^R&(N^x))+b[13]+4254626195&4294967295,k=R+(O<<12&4294967295|O>>>20),O=x+(N^k&(R^N))+b[14]+2792965006&4294967295,x=k+(O<<17&4294967295|O>>>15),O=N+(R^x&(k^R))+b[15]+1236535329&4294967295,N=x+(O<<22&4294967295|O>>>10),O=R+(x^k&(N^x))+b[1]+4129170786&4294967295,R=N+(O<<5&4294967295|O>>>27),O=k+(N^x&(R^N))+b[6]+3225465664&4294967295,k=R+(O<<9&4294967295|O>>>23),O=x+(R^N&(k^R))+b[11]+643717713&4294967295,x=k+(O<<14&4294967295|O>>>18),O=N+(k^R&(x^k))+b[0]+3921069994&4294967295,N=x+(O<<20&4294967295|O>>>12),O=R+(x^k&(N^x))+b[5]+3593408605&4294967295,R=N+(O<<5&4294967295|O>>>27),O=k+(N^x&(R^N))+b[10]+38016083&4294967295,k=R+(O<<9&4294967295|O>>>23),O=x+(R^N&(k^R))+b[15]+3634488961&4294967295,x=k+(O<<14&4294967295|O>>>18),O=N+(k^R&(x^k))+b[4]+3889429448&4294967295,N=x+(O<<20&4294967295|O>>>12),O=R+(x^k&(N^x))+b[9]+568446438&4294967295,R=N+(O<<5&4294967295|O>>>27),O=k+(N^x&(R^N))+b[14]+3275163606&4294967295,k=R+(O<<9&4294967295|O>>>23),O=x+(R^N&(k^R))+b[3]+4107603335&4294967295,x=k+(O<<14&4294967295|O>>>18),O=N+(k^R&(x^k))+b[8]+1163531501&4294967295,N=x+(O<<20&4294967295|O>>>12),O=R+(x^k&(N^x))+b[13]+2850285829&4294967295,R=N+(O<<5&4294967295|O>>>27),O=k+(N^x&(R^N))+b[2]+4243563512&4294967295,k=R+(O<<9&4294967295|O>>>23),O=x+(R^N&(k^R))+b[7]+1735328473&4294967295,x=k+(O<<14&4294967295|O>>>18),O=N+(k^R&(x^k))+b[12]+2368359562&4294967295,N=x+(O<<20&4294967295|O>>>12),O=R+(N^x^k)+b[5]+4294588738&4294967295,R=N+(O<<4&4294967295|O>>>28),O=k+(R^N^x)+b[8]+2272392833&4294967295,k=R+(O<<11&4294967295|O>>>21),O=x+(k^R^N)+b[11]+1839030562&4294967295,x=k+(O<<16&4294967295|O>>>16),O=N+(x^k^R)+b[14]+4259657740&4294967295,N=x+(O<<23&4294967295|O>>>9),O=R+(N^x^k)+b[1]+2763975236&4294967295,R=N+(O<<4&4294967295|O>>>28),O=k+(R^N^x)+b[4]+1272893353&4294967295,k=R+(O<<11&4294967295|O>>>21),O=x+(k^R^N)+b[7]+4139469664&4294967295,x=k+(O<<16&4294967295|O>>>16),O=N+(x^k^R)+b[10]+3200236656&4294967295,N=x+(O<<23&4294967295|O>>>9),O=R+(N^x^k)+b[13]+681279174&4294967295,R=N+(O<<4&4294967295|O>>>28),O=k+(R^N^x)+b[0]+3936430074&4294967295,k=R+(O<<11&4294967295|O>>>21),O=x+(k^R^N)+b[3]+3572445317&4294967295,x=k+(O<<16&4294967295|O>>>16),O=N+(x^k^R)+b[6]+76029189&4294967295,N=x+(O<<23&4294967295|O>>>9),O=R+(N^x^k)+b[9]+3654602809&4294967295,R=N+(O<<4&4294967295|O>>>28),O=k+(R^N^x)+b[12]+3873151461&4294967295,k=R+(O<<11&4294967295|O>>>21),O=x+(k^R^N)+b[15]+530742520&4294967295,x=k+(O<<16&4294967295|O>>>16),O=N+(x^k^R)+b[2]+3299628645&4294967295,N=x+(O<<23&4294967295|O>>>9),O=R+(x^(N|~k))+b[0]+4096336452&4294967295,R=N+(O<<6&4294967295|O>>>26),O=k+(N^(R|~x))+b[7]+1126891415&4294967295,k=R+(O<<10&4294967295|O>>>22),O=x+(R^(k|~N))+b[14]+2878612391&4294967295,x=k+(O<<15&4294967295|O>>>17),O=N+(k^(x|~R))+b[5]+4237533241&4294967295,N=x+(O<<21&4294967295|O>>>11),O=R+(x^(N|~k))+b[12]+1700485571&4294967295,R=N+(O<<6&4294967295|O>>>26),O=k+(N^(R|~x))+b[3]+2399980690&4294967295,k=R+(O<<10&4294967295|O>>>22),O=x+(R^(k|~N))+b[10]+4293915773&4294967295,x=k+(O<<15&4294967295|O>>>17),O=N+(k^(x|~R))+b[1]+2240044497&4294967295,N=x+(O<<21&4294967295|O>>>11),O=R+(x^(N|~k))+b[8]+1873313359&4294967295,R=N+(O<<6&4294967295|O>>>26),O=k+(N^(R|~x))+b[15]+4264355552&4294967295,k=R+(O<<10&4294967295|O>>>22),O=x+(R^(k|~N))+b[6]+2734768916&4294967295,x=k+(O<<15&4294967295|O>>>17),O=N+(k^(x|~R))+b[13]+1309151649&4294967295,N=x+(O<<21&4294967295|O>>>11),O=R+(x^(N|~k))+b[4]+4149444226&4294967295,R=N+(O<<6&4294967295|O>>>26),O=k+(N^(R|~x))+b[11]+3174756917&4294967295,k=R+(O<<10&4294967295|O>>>22),O=x+(R^(k|~N))+b[2]+718787259&4294967295,x=k+(O<<15&4294967295|O>>>17),O=N+(k^(x|~R))+b[9]+3951481745&4294967295,A.g[0]=A.g[0]+R&4294967295,A.g[1]=A.g[1]+(x+(O<<21&4294967295|O>>>11))&4294967295,A.g[2]=A.g[2]+x&4294967295,A.g[3]=A.g[3]+k&4294967295}t.prototype.u=function(A,R){R===void 0&&(R=A.length);for(var N=R-this.blockSize,b=this.B,x=this.h,k=0;k<R;){if(x==0)for(;k<=N;)i(this,A,k),k+=this.blockSize;if(typeof A=="string"){for(;k<R;)if(b[x++]=A.charCodeAt(k++),x==this.blockSize){i(this,b),x=0;break}}else for(;k<R;)if(b[x++]=A[k++],x==this.blockSize){i(this,b),x=0;break}}this.h=x,this.o+=R},t.prototype.v=function(){var A=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);A[0]=128;for(var R=1;R<A.length-8;++R)A[R]=0;var N=8*this.o;for(R=A.length-8;R<A.length;++R)A[R]=N&255,N/=256;for(this.u(A),A=Array(16),R=N=0;4>R;++R)for(var b=0;32>b;b+=8)A[N++]=this.g[R]>>>b&255;return A};function o(A,R){var N=a;return Object.prototype.hasOwnProperty.call(N,A)?N[A]:N[A]=R(A)}function s(A,R){this.h=R;for(var N=[],b=!0,x=A.length-1;0<=x;x--){var k=A[x]|0;b&&k==R||(N[x]=k,b=!1)}this.g=N}var a={};function c(A){return-128<=A&&128>A?o(A,function(R){return new s([R|0],0>R?-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 R=[],N=1,b=0;A>=N;b++)R[b]=A/N|0,N*=4294967296;return new s(R,0)}function u(A,R){if(A.length==0)throw Error("number format error: empty string");if(R=R||10,2>R||36<R)throw Error("radix out of range: "+R);if(A.charAt(0)=="-")return T(u(A.substring(1),R));if(0<=A.indexOf("-"))throw Error('number format error: interior "-" character');for(var N=l(Math.pow(R,8)),b=d,x=0;x<A.length;x+=8){var k=Math.min(8,A.length-x),O=parseInt(A.substring(x,x+k),R);8>k?(k=l(Math.pow(R,k)),b=b.j(k).add(l(O))):(b=b.j(N),b=b.add(l(O)))}return b}var d=c(0),f=c(1),g=c(16777216);r=s.prototype,r.m=function(){if(_(this))return-T(this).m();for(var A=0,R=1,N=0;N<this.g.length;N++){var b=this.i(N);A+=(0<=b?b:4294967296+b)*R,R*=4294967296}return A},r.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 R=l(Math.pow(A,6)),N=this,b="";;){var x=w(N,R).g;N=D(N,x.j(R));var k=((0<N.g.length?N.g[0]:N.h)>>>0).toString(A);if(N=x,p(N))return k+b;for(;6>k.length;)k="0"+k;b=k+b}},r.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 R=0;R<A.g.length;R++)if(A.g[R]!=0)return!1;return!0}function _(A){return A.h==-1}r.l=function(A){return A=D(this,A),_(A)?-1:p(A)?0:1};function T(A){for(var R=A.g.length,N=[],b=0;b<R;b++)N[b]=~A.g[b];return new s(N,~A.h).add(f)}r.abs=function(){return _(this)?T(this):this},r.add=function(A){for(var R=Math.max(this.g.length,A.g.length),N=[],b=0,x=0;x<=R;x++){var k=b+(this.i(x)&65535)+(A.i(x)&65535),O=(k>>>16)+(this.i(x)>>>16)+(A.i(x)>>>16);b=O>>>16,k&=65535,O&=65535,N[x]=O<<16|k}return new s(N,N[N.length-1]&-2147483648?-1:0)};function D(A,R){return A.add(T(R))}r.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 R=this.g.length+A.g.length,N=[],b=0;b<2*R;b++)N[b]=0;for(b=0;b<this.g.length;b++)for(var x=0;x<A.g.length;x++){var k=this.i(b)>>>16,O=this.i(b)&65535,yi=A.i(x)>>>16,eo=A.i(x)&65535;N[2*b+2*x]+=O*eo,L(N,2*b+2*x),N[2*b+2*x+1]+=k*eo,L(N,2*b+2*x+1),N[2*b+2*x+1]+=O*yi,L(N,2*b+2*x+1),N[2*b+2*x+2]+=k*yi,L(N,2*b+2*x+2)}for(b=0;b<R;b++)N[b]=N[2*b+1]<<16|N[2*b];for(b=R;b<2*R;b++)N[b]=0;return new s(N,0)};function L(A,R){for(;(A[R]&65535)!=A[R];)A[R+1]+=A[R]>>>16,A[R]&=65535,R++}function B(A,R){this.g=A,this.h=R}function w(A,R){if(p(R))throw Error("division by zero");if(p(A))return new B(d,d);if(_(A))return R=w(T(A),R),new B(T(R.g),T(R.h));if(_(R))return R=w(A,T(R)),new B(T(R.g),R.h);if(30<A.g.length){if(_(A)||_(R))throw Error("slowDivide_ only works with positive integers.");for(var N=f,b=R;0>=b.l(A);)N=F(N),b=F(b);var x=U(N,1),k=U(b,1);for(b=U(b,2),N=U(N,2);!p(b);){var O=k.add(b);0>=O.l(A)&&(x=x.add(N),k=O),b=U(b,1),N=U(N,1)}return R=D(A,x.j(R)),new B(x,R)}for(x=d;0<=A.l(R);){for(N=Math.max(1,Math.floor(A.m()/R.m())),b=Math.ceil(Math.log(N)/Math.LN2),b=48>=b?1:Math.pow(2,b-48),k=l(N),O=k.j(R);_(O)||0<O.l(A);)N-=b,k=l(N),O=k.j(R);p(k)&&(k=f),x=x.add(k),A=D(A,O)}return new B(x,A)}r.A=function(A){return w(this,A).h},r.and=function(A){for(var R=Math.max(this.g.length,A.g.length),N=[],b=0;b<R;b++)N[b]=this.i(b)&A.i(b);return new s(N,this.h&A.h)},r.or=function(A){for(var R=Math.max(this.g.length,A.g.length),N=[],b=0;b<R;b++)N[b]=this.i(b)|A.i(b);return new s(N,this.h|A.h)},r.xor=function(A){for(var R=Math.max(this.g.length,A.g.length),N=[],b=0;b<R;b++)N[b]=this.i(b)^A.i(b);return new s(N,this.h^A.h)};function F(A){for(var R=A.g.length+1,N=[],b=0;b<R;b++)N[b]=A.i(b)<<1|A.i(b-1)>>>31;return new s(N,A.h)}function U(A,R){var N=R>>5;R%=32;for(var b=A.g.length-N,x=[],k=0;k<b;k++)x[k]=0<R?A.i(k+N)>>>R|A.i(k+N+1)<<32-R:A.i(k+N);return new s(x,A.h)}t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,Gb=Oj.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,Ls=Oj.Integer=s}).apply(typeof Nj<"u"?Nj:typeof self<"u"?self:typeof window<"u"?window:{});var wv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ms={};var $b,Fie,ah,jb,km,Lv,Hb,Wb,zb;(function(){var r,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(h,m,E){return h==Array.prototype||h==Object.prototype||(h[m]=E.value),h};function n(h){h=[typeof globalThis=="object"&&globalThis,h,typeof window=="object"&&window,typeof self=="object"&&self,typeof wv=="object"&&wv];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=n(this);function i(h,m){if(m)e:{var E=t;h=h.split(".");for(var y=0;y<h.length-1;y++){var V=h[y];if(!(V in E))break e;E=E[V]}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,V={next:function(){if(!y&&E<h.length){var z=E++;return{value:m(z,h[z]),done:!1}}return y=!0,{done:!0,value:void 0}}};return V[Symbol.iterator]=function(){return V},V}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 V=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(V,y),h.apply(m,V)}}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,V,z){for(var ie=Array(arguments.length-2),ct=2;ct<arguments.length;ct++)ie[ct-2]=arguments[ct];return m.prototype[V].apply(y,ie)}}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 V=h.length||0,z=y.length||0;h.length=V+z;for(let ie=0;ie<z;ie++)h[V+ie]=y[ie]}else h.push(y)}}class D{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 L(h){return/^[\s\xa0]*$/.test(h)}function B(){var h=a.navigator;return h&&(h=h.userAgent)?h:""}function w(h){return w[" "](h),h}w[" "]=function(){};var F=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 U(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 R(h){let m={};for(let E in h)m[E]=h[E];return m}let N="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function b(h,m){let E,y;for(let V=1;V<arguments.length;V++){y=arguments[V];for(E in y)h[E]=y[E];for(let z=0;z<N.length;z++)E=N[z],Object.prototype.hasOwnProperty.call(y,E)&&(h[E]=y[E])}}function x(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 k(h){a.setTimeout(()=>{throw h},0)}function O(){var h=nf;let m=null;return h.g&&(m=h.g,h.g=h.g.next,h.g||(h.h=null),m.next=null),m}class yi{constructor(){this.h=this.g=null}add(m,E){let y=eo.get();y.set(m,E),this.h?this.h.next=y:this.g=y,this.h=y}}var eo=new D(()=>new tf,h=>h.reset());class tf{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 Bs,dc=!1,nf=new yi,Vp=()=>{let h=a.Promise.resolve(void 0);Bs=()=>{h.then(Lt)}};var Lt=()=>{for(var h;h=O();){try{h.h.call(h.g)}catch(E){k(E)}var m=eo;m.j(h),100>m.h&&(m.h++,h.next=m.g,m.g=h)}dc=!1};function to(){this.s=this.s,this.C=this.C}to.prototype.s=!1,to.prototype.ma=function(){this.s||(this.s=!0,this.N())},to.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function _n(h,m){this.type=h,this.g=this.target=m,this.defaultPrevented=!1}_n.prototype.h=function(){this.defaultPrevented=!0};var mS=(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 hc(h,m){if(_n.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(F){e:{try{w(m.nodeName);var V=!0;break e}catch{}V=!1}V||(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:pS[h.pointerType]||"",this.state=h.state,this.i=h,h.defaultPrevented&&hc.aa.h.call(this)}}p(hc,_n);var pS={2:"touch",3:"pen",4:"mouse"};hc.prototype.h=function(){hc.aa.h.call(this);var h=this.i;h.preventDefault?h.preventDefault():h.returnValue=!1};var fc="closure_listenable_"+(1e6*Math.random()|0),Bp=0;function ES(h,m,E,y,V){this.listener=h,this.proxy=null,this.src=m,this.type=E,this.capture=!!y,this.ha=V,this.key=++Bp,this.da=this.fa=!1}function gc(h){h.da=!0,h.listener=null,h.proxy=null,h.src=null,h.ha=null}function st(h){this.src=h,this.g={},this.h=0}st.prototype.add=function(h,m,E,y,V){var z=h.toString();h=this.g[z],h||(h=this.g[z]=[],this.h++);var ie=ft(h,m,y,V);return-1<ie?(m=h[ie],E||(m.fa=!1)):(m=new ES(m,this.src,z,!!y,V),m.fa=E,h.push(m)),m};function fu(h,m){var E=m.type;if(E in h.g){var y=h.g[E],V=Array.prototype.indexOf.call(y,m,void 0),z;(z=0<=V)&&Array.prototype.splice.call(y,V,1),z&&(gc(m),h.g[E].length==0&&(delete h.g[E],h.h--))}}function ft(h,m,E,y){for(var V=0;V<h.length;++V){var z=h[V];if(!z.da&&z.listener==m&&z.capture==!!E&&z.ha==y)return V}return-1}var gu="closure_lm_"+(1e6*Math.random()|0),gt={};function Gs(h,m,E,y,V){if(y&&y.once)return of(h,m,E,y,V);if(Array.isArray(m)){for(var z=0;z<m.length;z++)Gs(h,m[z],E,y,V);return null}return E=mc(E),h&&h[fc]?h.K(m,E,l(y)?!!y.capture:!!y,V):rf(h,m,E,!1,y,V)}function rf(h,m,E,y,V,z){if(!m)throw Error("Invalid event type");var ie=l(V)?!!V.capture:!!V,ct=Yo(h);if(ct||(h[gu]=ct=new st(h)),E=ct.add(m,E,y,ie,z),E.proxy)return E;if(y=no(),E.proxy=y,y.src=h,y.listener=E,h.addEventListener)mS||(V=ie),V===void 0&&(V=!1),h.addEventListener(m.toString(),y,V);else if(h.attachEvent)h.attachEvent(sf(m.toString()),y);else if(h.addListener&&h.removeListener)h.addListener(y);else throw Error("addEventListener and attachEvent are unavailable.");return E}function no(){function h(E){return m.call(h.src,h.listener,E)}let m=ro;return h}function of(h,m,E,y,V){if(Array.isArray(m)){for(var z=0;z<m.length;z++)of(h,m[z],E,y,V);return null}return E=mc(E),h&&h[fc]?h.L(m,E,l(y)?!!y.capture:!!y,V):rf(h,m,E,!0,y,V)}function mu(h,m,E,y,V){if(Array.isArray(m))for(var z=0;z<m.length;z++)mu(h,m[z],E,y,V);else y=l(y)?!!y.capture:!!y,E=mc(E),h&&h[fc]?(h=h.i,m=String(m).toString(),m in h.g&&(z=h.g[m],E=ft(z,E,y,V),-1<E&&(gc(z[E]),Array.prototype.splice.call(z,E,1),z.length==0&&(delete h.g[m],h.h--)))):h&&(h=Yo(h))&&(m=h.g[m.toString()],h=-1,m&&(h=ft(m,E,y,V)),(E=-1<h?m[h]:null)&&pu(E))}function pu(h){if(typeof h!="number"&&h&&!h.da){var m=h.src;if(m&&m[fc])fu(m.i,h);else{var E=h.type,y=h.proxy;m.removeEventListener?m.removeEventListener(E,y,h.capture):m.detachEvent?m.detachEvent(sf(E),y):m.addListener&&m.removeListener&&m.removeListener(y),(E=Yo(m))?(fu(E,h),E.h==0&&(E.src=null,m[gu]=null)):gc(h)}}}function sf(h){return h in gt?gt[h]:gt[h]="on"+h}function ro(h,m){if(h.da)h=!0;else{m=new hc(m,this);var E=h.listener,y=h.ha||h.src;h.fa&&pu(h),h=E.call(y,m)}return h}function Yo(h){return h=h[gu],h instanceof st?h:null}var Si="__closure_events_fn_"+(1e9*Math.random()>>>0);function mc(h){return typeof h=="function"?h:(h[Si]||(h[Si]=function(m){return h.handleEvent(m)}),h[Si])}function zt(){to.call(this),this.i=new st(this),this.M=this,this.F=null}p(zt,to),zt.prototype[fc]=!0,zt.prototype.removeEventListener=function(h,m,E,y){mu(this,h,m,E,y)};function on(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 _n(m,h);else if(m instanceof _n)m.target=m.target||h;else{var V=m;m=new _n(y,h),b(m,V)}if(V=!0,E)for(var z=E.length-1;0<=z;z--){var ie=m.g=E[z];V=$s(ie,y,!0,m)&&V}if(ie=m.g=h,V=$s(ie,y,!0,m)&&V,V=$s(ie,y,!1,m)&&V,E)for(z=0;z<E.length;z++)ie=m.g=E[z],V=$s(ie,y,!1,m)&&V}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++)gc(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 $s(h,m,E,y){if(m=h.i.g[String(m)],!m)return!0;m=m.concat();for(var V=!0,z=0;z<m.length;++z){var ie=m[z];if(ie&&!ie.da&&ie.capture==E){var ct=ie.listener,bn=ie.ha||ie.src;ie.fa&&fu(h.i,ie),V=ct.call(bn,y)!==!1&&V}}return V&&!y.defaultPrevented}function Qo(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 pc(h){h.g=Qo(()=>{h.g=null,h.i&&(h.i=!1,pc(h))},h.l);let m=h.h;h.h=null,h.m.apply(null,m)}class Eu extends to{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:pc(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function js(h){to.call(this),this.h=h,this.g={}}p(js,to);var af=[];function cf(h){U(h.g,function(m,E){this.g.hasOwnProperty(E)&&pu(m)},h),h.g={}}js.prototype.N=function(){js.aa.N.call(this),cf(this)},js.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ec=a.JSON.stringify,lf=a.JSON.parse,Hs=class{stringify(h){return a.JSON.stringify(h,void 0)}parse(h){return a.JSON.parse(h,void 0)}};function gr(){}gr.prototype.h=null;function _u(h){return h.h||(h.h=h.i())}function uf(){}var Ws={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function _c(){_n.call(this,"d")}p(_c,_n);function Tu(){_n.call(this,"c")}p(Tu,_n);var Xr={},Tc=null;function nr(){return Tc=Tc||new zt}Xr.La="serverreachability";function Xo(h){_n.call(this,Xr.La,h)}p(Xo,_n);function Jo(h){let m=nr();on(m,new Xo(m))}Xr.STAT_EVENT="statevent";function Iu(h,m){_n.call(this,Xr.STAT_EVENT,h),this.stat=m}p(Iu,_n);function On(h){let m=nr();on(m,new Iu(m,h))}Xr.Ma="timingevent";function df(h,m){_n.call(this,Xr.Ma,h),this.size=m}p(df,_n);function Zo(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 zs(){this.g=!0}zs.prototype.xa=function(){this.g=!1};function hf(h,m,E,y,V,z){h.info(function(){if(h.g)if(z)for(var ie="",ct=z.split("&"),bn=0;bn<ct.length;bn++){var We=ct[bn].split("=");if(1<We.length){var Bn=We[0];We=We[1];var Gn=Bn.split("_");ie=2<=Gn.length&&Gn[1]=="type"?ie+(Bn+"="+We+"&"):ie+(Bn+"=redacted&")}}else ie=null;else ie=z;return"XMLHTTP REQ ("+y+") [attempt "+V+"]: "+m+`
147
- `+E+`
148
- `+ie})}function _S(h,m,E,y,V,z,ie){h.info(function(){return"XMLHTTP RESP ("+y+") [ attempt "+V+"]: "+m+`
149
- `+E+`
150
- `+z+" "+ie})}function Jr(h,m,E,y){h.info(function(){return"XMLHTTP TEXT ("+m+"): "+IS(h,E)+(y?" "+y:"")})}function TS(h,m){h.info(function(){return"TIMEOUT: "+m})}zs.prototype.info=function(){};function IS(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 V=y[1];if(Array.isArray(V)&&!(1>V.length)){var z=V[0];if(z!="noop"&&z!="stop"&&z!="close")for(var ie=1;ie<V.length;ie++)V[ie]=""}}}}return Ec(E)}catch{return m}}var at={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},es={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},ff;function Ic(){}p(Ic,gr),Ic.prototype.g=function(){return new XMLHttpRequest},Ic.prototype.i=function(){return{}},ff=new Ic;function Zr(h,m,E,y){this.j=h,this.i=m,this.l=E,this.R=y||1,this.U=new js(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 gf}function gf(){this.i=null,this.g="",this.h=!1}var mf={},pf={};function Ef(h,m,E){h.L=1,h.v=G(ei(m)),h.m=E,h.P=!0,Gp(h,null)}function Gp(h,m){h.F=Date.now(),vc(h),h.A=ei(h.v);var E=h.A,y=h.R;Array.isArray(y)||(y=[String(y)]),QM(E.i,"t",y),h.C=0,E=h.j.J,h.h=new gf,h.g=gP(h.j,E?m:null,!h.m),0<h.O&&(h.M=new Eu(f(h.Y,h,h.g),h.O)),m=h.U,E=h.g,y=h.ca;var V="readystatechange";Array.isArray(V)||(V&&(af[0]=V.toString()),V=af);for(var z=0;z<V.length;z++){var ie=Gs(E,V[z],y||m.handleEvent,!1,m.h||m);if(!ie)break;m.g[ie.key]=ie}m=h.H?R(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)),Jo(),hf(h.i,h.u,h.A,h.l,h.R,h.m)}Zr.prototype.ca=function(h){h=h.target;let m=this.M;m&&ss(h)==3?m.j():this.Y(h)},Zr.prototype.Y=function(h){try{if(h==this.g)e:{let Gn=ss(this.g);var m=this.g.Ba();let Du=this.g.Z();if(!(3>Gn)&&(Gn!=3||this.g&&(this.h.h||this.g.oa()||rP(this.g)))){this.J||Gn!=4||m==7||(m==8||0>=Du?Jo(3):Jo(2)),_f(this);var E=this.g.Z();this.X=E;t:if($p(this)){var y=rP(this.g);h="";var V=y.length,z=ss(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){so(this),yc(this);var ie="";break t}this.h.i=new a.TextDecoder}for(m=0;m<V;m++)this.h.h=!0,h+=this.h.i.decode(y[m],{stream:!(z&&m==V-1)});y.length=0,this.h.g+=h,this.C=0,ie=this.h.g}else ie=this.g.oa();if(this.o=E==200,_S(this.i,this.u,this.A,this.l,this.R,Gn,E),this.o){if(this.T&&!this.K){t:{if(this.g){var ct,bn=this.g;if((ct=bn.g?bn.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!L(ct)){var We=ct;break t}}We=null}if(E=We)Jr(this.i,this.l,E,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,vu(this,E);else{this.o=!1,this.s=3,On(12),so(this),yc(this);break e}}if(this.P){E=!0;let Ai;for(;!this.J&&this.C<ie.length;)if(Ai=io(this,ie),Ai==pf){Gn==4&&(this.s=4,On(14),E=!1),Jr(this.i,this.l,null,"[Incomplete Response]");break}else if(Ai==mf){this.s=4,On(15),Jr(this.i,this.l,ie,"[Invalid Chunk]"),E=!1;break}else Jr(this.i,this.l,Ai,null),vu(this,Ai);if($p(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Gn!=4||ie.length!=0||this.h.h||(this.s=1,On(16),E=!1),this.o=this.o&&E,!E)Jr(this.i,this.l,ie,"[Invalid Chunked Response]"),so(this),yc(this);else if(0<ie.length&&!this.W){this.W=!0;var Bn=this.j;Bn.g==this&&Bn.ba&&!Bn.M&&(Bn.j.info("Great, no buffering proxy detected. Bytes received: "+ie.length),RS(Bn),Bn.M=!0,On(11))}}else Jr(this.i,this.l,ie,null),vu(this,ie);Gn==4&&so(this),this.o&&!this.J&&(Gn==4?uP(this.j,this):(this.o=!1,vc(this)))}else Gz(this.g),E==400&&0<ie.indexOf("Unknown SID")?(this.s=3,On(12)):(this.s=0,On(13)),so(this),yc(this)}}}catch{}};function $p(h){return h.g?h.u=="GET"&&h.L!=2&&h.j.Ca:!1}function io(h,m){var E=h.C,y=m.indexOf(`
151
- `,E);return y==-1?pf:(E=Number(m.substring(E,y)),isNaN(E)?mf:(y+=1,y+E>m.length?pf:(m=m.slice(y,y+E),h.C=y+E,m)))}Zr.prototype.cancel=function(){this.J=!0,so(this)};function vc(h){h.S=Date.now()+h.I,oo(h,h.I)}function oo(h,m){if(h.B!=null)throw Error("WatchDog timer not null");h.B=Zo(f(h.ba,h),m)}function _f(h){h.B&&(a.clearTimeout(h.B),h.B=null)}Zr.prototype.ba=function(){this.B=null;let h=Date.now();0<=h-this.S?(TS(this.i,this.A),this.L!=2&&(Jo(),On(17)),so(this),this.s=2,yc(this)):oo(this,this.S-h)};function yc(h){h.j.G==0||h.J||uP(h.j,h)}function so(h){_f(h);var m=h.M;m&&typeof m.ma=="function"&&m.ma(),h.M=null,cf(h.U),h.g&&(m=h.g,h.g=null,m.abort(),m.ma())}function vu(h,m){try{var E=h.j;if(E.G!=0&&(E.g==h||ns(E.h,h))){if(!h.K&&ns(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 V=y;if(V[0]==0){e:if(!E.u){if(E.g)if(E.g.F+3e3<h.F)Jp(E),Qp(E);else break e;AS(E),On(18)}}else E.za=V[1],0<E.za-E.T&&37500>V[2]&&E.F&&E.v==0&&!E.C&&(E.C=Zo(f(E.Za,E),6e3));if(1>=ts(E.h)&&E.ca){try{E.ca()}catch{}E.ca=void 0}}else Ac(E,11)}else if((h.K||E.g==h)&&Jp(E),!L(m))for(V=E.Da.g.parse(m),m=0;m<V.length;m++){let We=V[m];if(E.T=We[0],We=We[1],E.G==2)if(We[0]=="c"){E.K=We[1],E.ia=We[2];let Bn=We[3];Bn!=null&&(E.la=Bn,E.j.info("VER="+E.la));let Gn=We[4];Gn!=null&&(E.Aa=Gn,E.j.info("SVER="+E.Aa));let Du=We[5];Du!=null&&typeof Du=="number"&&0<Du&&(y=1.5*Du,E.L=y,E.j.info("backChannelRequestTimeoutMs_="+y)),y=E;let Ai=h.g;if(Ai){let eE=Ai.g?Ai.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(eE){var z=y.h;z.g||eE.indexOf("spdy")==-1&&eE.indexOf("quic")==-1&&eE.indexOf("h2")==-1||(z.j=z.l,z.g=new Set,z.h&&(br(z,z.h),z.h=null))}if(y.D){let DS=Ai.g?Ai.g.getResponseHeader("X-HTTP-Session-Id"):null;DS&&(y.ya=DS,S(y.I,y.D,DS))}}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 ie=h;if(y.qa=fP(y,y.J?y.ia:null,y.W),ie.K){jp(y.h,ie);var ct=ie,bn=y.L;bn&&(ct.I=bn),ct.B&&(_f(ct),vc(ct)),y.g=ie}else cP(y);0<E.i.length&&Xp(E)}else We[0]!="stop"&&We[0]!="close"||Ac(E,7);else E.G==3&&(We[0]=="stop"||We[0]=="close"?We[0]=="stop"?Ac(E,7):SS(E):We[0]!="noop"&&E.l&&E.l.ta(We),E.v=0)}}Jo(4)}catch{}}var yu=class{constructor(h,m){this.g=h,this.map=m}};function Su(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 Sc(h){return h.h?!0:h.g?h.g.size>=h.j:!1}function ts(h){return h.h?1:h.g?h.g.size:0}function ns(h,m){return h.h?h.h==m:h.g?h.g.has(m):!1}function br(h,m){h.g?h.g.add(m):h.h=m}function jp(h,m){h.h&&h.h==m?h.h=null:h.g&&h.g.has(m)&&h.g.delete(m)}Su.prototype.cancel=function(){if(this.i=Hp(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 Hp(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 Wp(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 zp(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 qp(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=zp(h),y=Wp(h),V=y.length,z=0;z<V;z++)m.call(void 0,y[z],E&&E[z],h)}var Tf=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function vS(h,m){if(h){h=h.split("&");for(var E=0;E<h.length;E++){var y=h[E].indexOf("="),V=null;if(0<=y){var z=h[E].substring(0,y);V=h[E].substring(y+1)}else z=h[E];m(z,V?decodeURIComponent(V.replace(/\+/g," ")):"")}}}function rs(h){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,h instanceof rs){this.h=h.h,is(this,h.j),this.o=h.o,this.g=h.g,qs(this,h.s),this.l=h.l;var m=h.i,E=new os;E.i=m.i,m.g&&(E.g=new Map(m.g),E.h=m.h),re(this,E),this.m=h.m}else h&&(m=String(h).match(Tf))?(this.h=!1,is(this,m[1]||"",!0),this.o=ne(m[2]||""),this.g=ne(m[3]||"",!0),qs(this,m[4]),this.l=ne(m[5]||"",!0),re(this,m[6]||"",!0),this.m=ne(m[7]||"")):(this.h=!1,this.i=new os(null,this.h))}rs.prototype.toString=function(){var h=[],m=this.j;m&&h.push(ue(m,Ve,!0),":");var E=this.g;return(E||m=="file")&&(h.push("//"),(m=this.o)&&h.push(ue(m,Ve,!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(ue(E,E.charAt(0)=="/"?Ut:qt,!0))),(E=this.i.toString())&&h.push("?",E),(E=this.m)&&h.push("#",ue(E,wr)),h.join("")};function ei(h){return new rs(h)}function is(h,m,E){h.j=E?ne(m,!0):m,h.j&&(h.j=h.j.replace(/:$/,""))}function qs(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 re(h,m,E){m instanceof os?(h.i=m,Pz(h.i,h.h)):(E||(m=ue(m,mr)),h.i=new os(m,h.h))}function S(h,m,E){h.i.set(m,E)}function G(h){return S(h,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),h}function ne(h,m){return h?m?decodeURI(h.replace(/%25/g,"%2525")):decodeURIComponent(h):""}function ue(h,m,E){return typeof h=="string"?(h=encodeURI(h).replace(m,be),E&&(h=h.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h):null}function be(h){return h=h.charCodeAt(0),"%"+(h>>4&15).toString(16)+(h&15).toString(16)}var Ve=/[#\/\?@]/g,qt=/[#\?:]/g,Ut=/[#\?]/g,mr=/[#\?@]/g,wr=/#/g;function os(h,m){this.h=this.g=null,this.i=h||null,this.j=!!m}function At(h){h.g||(h.g=new Map,h.h=0,h.i&&vS(h.i,function(m,E){h.add(decodeURIComponent(m.replace(/\+/g," ")),E)}))}r=os.prototype,r.add=function(h,m){At(this),this.i=null,h=Au(this,h);var E=this.g.get(h);return E||this.g.set(h,E=[]),E.push(m),this.h+=1,this};function KM(h,m){At(h),m=Au(h,m),h.g.has(m)&&(h.i=null,h.h-=h.g.get(m).length,h.g.delete(m))}function YM(h,m){return At(h),m=Au(h,m),h.g.has(m)}r.forEach=function(h,m){At(this),this.g.forEach(function(E,y){E.forEach(function(V){h.call(m,V,y,this)},this)},this)},r.na=function(){At(this);let h=Array.from(this.g.values()),m=Array.from(this.g.keys()),E=[];for(let y=0;y<m.length;y++){let V=h[y];for(let z=0;z<V.length;z++)E.push(m[y])}return E},r.V=function(h){At(this);let m=[];if(typeof h=="string")YM(this,h)&&(m=m.concat(this.g.get(Au(this,h))));else{h=Array.from(this.g.values());for(let E=0;E<h.length;E++)m=m.concat(h[E])}return m},r.set=function(h,m){return At(this),this.i=null,h=Au(this,h),YM(this,h)&&(this.h-=this.g.get(h).length),this.g.set(h,[m]),this.h+=1,this},r.get=function(h,m){return h?(h=this.V(h),0<h.length?String(h[0]):m):m};function QM(h,m,E){KM(h,m),0<E.length&&(h.i=null,h.g.set(Au(h,m),_(E)),h.h+=E.length)}r.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 z=encodeURIComponent(String(y)),ie=this.V(y);for(y=0;y<ie.length;y++){var V=z;ie[y]!==""&&(V+="="+encodeURIComponent(String(ie[y]))),h.push(V)}}return this.i=h.join("&")};function Au(h,m){return m=String(m),h.j&&(m=m.toLowerCase()),m}function Pz(h,m){m&&!h.j&&(At(h),h.i=null,h.g.forEach(function(E,y){var V=y.toLowerCase();y!=V&&(KM(this,y),QM(this,V,E))},h)),h.j=m}function xz(h,m){let E=new zs;if(a.Image){let y=new Image;y.onload=g(Ks,E,"TestLoadImage: loaded",!0,m,y),y.onerror=g(Ks,E,"TestLoadImage: error",!1,m,y),y.onabort=g(Ks,E,"TestLoadImage: abort",!1,m,y),y.ontimeout=g(Ks,E,"TestLoadImage: timeout",!1,m,y),a.setTimeout(function(){y.ontimeout&&y.ontimeout()},1e4),y.src=h}else m(!1)}function Fz(h,m){let E=new zs,y=new AbortController,V=setTimeout(()=>{y.abort(),Ks(E,"TestPingServer: timeout",!1,m)},1e4);fetch(h,{signal:y.signal}).then(z=>{clearTimeout(V),z.ok?Ks(E,"TestPingServer: ok",!0,m):Ks(E,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(V),Ks(E,"TestPingServer: error",!1,m)})}function Ks(h,m,E,y,V){try{V&&(V.onload=null,V.onerror=null,V.onabort=null,V.ontimeout=null),y(E)}catch{}}function kz(){this.g=new Hs}function Uz(h,m,E){let y=E||"";try{qp(h,function(V,z){let ie=V;l(V)&&(ie=Ec(V)),m.push(y+z+"="+encodeURIComponent(ie))})}catch(V){throw m.push(y+"type="+encodeURIComponent("_badmap")),V}}function If(h){this.l=h.Ub||null,this.j=h.eb||!1}p(If,gr),If.prototype.g=function(){return new Kp(this.l,this.j)},If.prototype.i=(function(h){return function(){return h}})({});function Kp(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(Kp,zt),r=Kp.prototype,r.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,yf(this)},r.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))},r.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,vf(this)),this.readyState=0},r.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,yf(this)),this.g&&(this.readyState=3,yf(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;XM(this)}else h.text().then(this.Ra.bind(this),this.ga.bind(this))};function XM(h){h.j.read().then(h.Pa.bind(h)).catch(h.ga.bind(h))}r.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?vf(this):yf(this),this.readyState==3&&XM(this)}},r.Ra=function(h){this.g&&(this.response=this.responseText=h,vf(this))},r.Qa=function(h){this.g&&(this.response=h,vf(this))},r.ga=function(){this.g&&vf(this)};function vf(h){h.readyState=4,h.l=null,h.j=null,h.v=null,yf(h)}r.setRequestHeader=function(h,m){this.u.append(h,m)},r.getResponseHeader=function(h){return this.h&&this.h.get(h.toLowerCase())||""},r.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 yf(h){h.onreadystatechange&&h.onreadystatechange.call(h)}Object.defineProperty(Kp.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(h){this.m=h?"include":"same-origin"}});function JM(h){let m="";return U(h,function(E,y){m+=y,m+=":",m+=E,m+=`\r
153
- `}),m}function yS(h,m,E){e:{for(y in E){var y=!1;break e}y=!0}y||(E=JM(E),typeof h=="string"?E!=null&&encodeURIComponent(String(E)):S(h,m,E))}function Vt(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(Vt,zt);var Vz=/^https?$/i,Bz=["POST","PUT"];r=Vt.prototype,r.Ha=function(h){this.J=h},r.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():ff.g(),this.v=this.o?_u(this.o):_u(ff),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(m,String(h),!0),this.B=!1}catch(z){ZM(this,z);return}if(h=E||"",E=new Map(this.headers),y)if(Object.getPrototypeOf(y)===Object.prototype)for(var V in y)E.set(V,y[V]);else if(typeof y.keys=="function"&&typeof y.get=="function")for(let z of y.keys())E.set(z,y.get(z));else throw Error("Unknown input type for opt_headers: "+String(y));y=Array.from(E.keys()).find(z=>z.toLowerCase()=="content-type"),V=a.FormData&&h instanceof a.FormData,!(0<=Array.prototype.indexOf.call(Bz,m,void 0))||y||V||E.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[z,ie]of E)this.g.setRequestHeader(z,ie);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{nP(this),this.u=!0,this.g.send(h),this.u=!1}catch(z){ZM(this,z)}};function ZM(h,m){h.h=!1,h.g&&(h.j=!0,h.g.abort(),h.j=!1),h.l=m,h.m=5,eP(h),Yp(h)}function eP(h){h.A||(h.A=!0,on(h,"complete"),on(h,"error"))}r.abort=function(h){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=h||7,on(this,"complete"),on(this,"abort"),Yp(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Yp(this,!0)),Vt.aa.N.call(this)},r.Ea=function(){this.s||(this.B||this.u||this.j?tP(this):this.bb())},r.bb=function(){tP(this)};function tP(h){if(h.h&&typeof s<"u"&&(!h.v[1]||ss(h)!=4||h.Z()!=2)){if(h.u&&ss(h)==4)Qo(h.Ea,0,h);else if(on(h,"readystatechange"),ss(h)==4){h.h=!1;try{let ie=h.Z();e:switch(ie){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=ie===0){var V=String(h.D).match(Tf)[1]||null;!V&&a.self&&a.self.location&&(V=a.self.location.protocol.slice(0,-1)),y=!Vz.test(V?V.toLowerCase():"")}E=y}if(E)on(h,"complete"),on(h,"success");else{h.m=6;try{var z=2<ss(h)?h.g.statusText:""}catch{z=""}h.l=z+" ["+h.Z()+"]",eP(h)}}finally{Yp(h)}}}}function Yp(h,m){if(h.g){nP(h);let E=h.g,y=h.v[0]?()=>{}:null;h.g=null,h.v=null,m||on(h,"ready");try{E.onreadystatechange=y}catch{}}}function nP(h){h.I&&(a.clearTimeout(h.I),h.I=null)}r.isActive=function(){return!!this.g};function ss(h){return h.g?h.g.readyState:0}r.Z=function(){try{return 2<ss(this)?this.g.status:-1}catch{return-1}},r.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.Oa=function(h){if(this.g){var m=this.g.responseText;return h&&m.indexOf(h)==0&&(m=m.substring(h.length)),lf(m)}};function rP(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 Gz(h){let m={};h=(h.g&&2<=ss(h)&&h.g.getAllResponseHeaders()||"").split(`\r
154
- `);for(let y=0;y<h.length;y++){if(L(h[y]))continue;var E=x(h[y]);let V=E[0];if(E=E[1],typeof E!="string")continue;E=E.trim();let z=m[V]||[];m[V]=z,z.push(E)}A(m,function(y){return y.join(", ")})}r.Ba=function(){return this.m},r.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Sf(h,m,E){return E&&E.internalChannelParams&&E.internalChannelParams[h]||m}function iP(h){this.Aa=0,this.i=[],this.j=new zs,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=Sf("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=Sf("baseRetryDelayMs",5e3,h),this.cb=Sf("retryDelaySeedMs",1e4,h),this.Wa=Sf("forwardChannelMaxRetries",2,h),this.wa=Sf("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 Su(h&&h.concurrentRequestLimit),this.Da=new kz,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}r=iP.prototype,r.la=8,r.G=1,r.connect=function(h,m,E,y){On(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=fP(this,null,this.W),Xp(this)};function SS(h){if(oP(h),h.G==3){var m=h.U++,E=ei(h.I);if(S(E,"SID",h.K),S(E,"RID",m),S(E,"TYPE","terminate"),Af(h,E),m=new Zr(h,h.j,m),m.L=2,m.v=G(ei(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=gP(m.j,null),m.g.ea(m.v)),m.F=Date.now(),vc(m)}hP(h)}function Qp(h){h.g&&(RS(h),h.g.cancel(),h.g=null)}function oP(h){Qp(h),h.u&&(a.clearTimeout(h.u),h.u=null),Jp(h),h.h.cancel(),h.s&&(typeof h.s=="number"&&a.clearTimeout(h.s),h.s=null)}function Xp(h){if(!Sc(h.h)&&!h.s){h.s=!0;var m=h.Ga;Bs||Vp(),dc||(Bs(),dc=!0),nf.add(m,h),h.B=0}}function $z(h,m){return ts(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=Zo(f(h.Ga,h,m),dP(h,h.B)),h.B++,!0)}r.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 V=new Zr(this,this.j,h),z=this.o;if(this.S&&(z?(z=R(z),b(z,this.S)):z=this.S),this.m!==null||this.O||(V.H=z,z=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=aP(this,V,m),E=ei(this.I),S(E,"RID",h),S(E,"CVER",22),this.D&&S(E,"X-HTTP-Session-Id",this.D),Af(this,E),z&&(this.O?m="headers="+encodeURIComponent(String(JM(z)))+"&"+m:this.m&&yS(E,this.m,z)),br(this.h,V),this.Ua&&S(E,"TYPE","init"),this.P?(S(E,"$req",m),S(E,"SID","null"),V.T=!0,Ef(V,E,null)):Ef(V,E,m),this.G=2}}else this.G==3&&(h?sP(this,h):this.i.length==0||Sc(this.h)||sP(this))};function sP(h,m){var E;m?E=m.l:E=h.U++;let y=ei(h.I);S(y,"SID",h.K),S(y,"RID",E),S(y,"AID",h.T),Af(h,y),h.m&&h.o&&yS(y,h.m,h.o),E=new Zr(h,h.j,E,h.B+1),h.m===null&&(E.H=h.o),m&&(h.i=m.D.concat(h.i)),m=aP(h,E,1e3),E.I=Math.round(.5*h.wa)+Math.round(.5*h.wa*Math.random()),br(h.h,E),Ef(E,y,m)}function Af(h,m){h.H&&U(h.H,function(E,y){S(m,y,E)}),h.l&&qp({},function(E,y){S(m,y,E)})}function aP(h,m,E){E=Math.min(h.i.length,E);var y=h.l?f(h.l.Na,h.l,h):null;e:{var V=h.i;let z=-1;for(;;){let ie=["count="+E];z==-1?0<E?(z=V[0].g,ie.push("ofs="+z)):z=0:ie.push("ofs="+z);let ct=!0;for(let bn=0;bn<E;bn++){let We=V[bn].g,Bn=V[bn].map;if(We-=z,0>We)z=Math.max(0,V[bn].g-100),ct=!1;else try{Uz(Bn,ie,"req"+We+"_")}catch{y&&y(Bn)}}if(ct){y=ie.join("&");break e}}}return h=h.i.splice(0,E),m.D=h,y}function cP(h){if(!h.g&&!h.u){h.Y=1;var m=h.Fa;Bs||Vp(),dc||(Bs(),dc=!0),nf.add(m,h),h.v=0}}function AS(h){return h.g||h.u||3<=h.v?!1:(h.Y++,h.u=Zo(f(h.Fa,h),dP(h,h.v)),h.v++,!0)}r.Fa=function(){if(this.u=null,lP(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=Zo(f(this.ab,this),h)}},r.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,On(10),Qp(this),lP(this))};function RS(h){h.A!=null&&(a.clearTimeout(h.A),h.A=null)}function lP(h){h.g=new Zr(h,h.j,"rpc",h.Y),h.m===null&&(h.g.H=h.o),h.g.O=0;var m=ei(h.qa);S(m,"RID","rpc"),S(m,"SID",h.K),S(m,"AID",h.T),S(m,"CI",h.F?"0":"1"),!h.F&&h.ja&&S(m,"TO",h.ja),S(m,"TYPE","xmlhttp"),Af(h,m),h.m&&h.o&&yS(m,h.m,h.o),h.L&&(h.g.I=h.L);var E=h.g;h=h.ia,E.L=1,E.v=G(ei(m)),E.m=null,E.P=!0,Gp(E,h)}r.Za=function(){this.C!=null&&(this.C=null,Qp(this),AS(this),On(19))};function Jp(h){h.C!=null&&(a.clearTimeout(h.C),h.C=null)}function uP(h,m){var E=null;if(h.g==m){Jp(h),RS(h),h.g=null;var y=2}else if(ns(h.h,m))E=m.D,jp(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 V=h.B;y=nr(),on(y,new df(y,E)),Xp(h)}else cP(h);else if(V=m.s,V==3||V==0&&0<m.X||!(y==1&&$z(h,m)||y==2&&AS(h)))switch(E&&0<E.length&&(m=h.h,m.i=m.i.concat(E)),V){case 1:Ac(h,5);break;case 4:Ac(h,10);break;case 3:Ac(h,6);break;default:Ac(h,2)}}}function dP(h,m){let E=h.Ta+Math.floor(Math.random()*h.cb);return h.isActive()||(E*=2),E*m}function Ac(h,m){if(h.j.info("Error code "+m),m==2){var E=f(h.fb,h),y=h.Xa;let V=!y;y=new rs(y||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||is(y,"https"),G(y),V?xz(y.toString(),E):Fz(y.toString(),E)}else On(2);h.G=0,h.l&&h.l.sa(m),hP(h),oP(h)}r.fb=function(h){h?(this.j.info("Successfully pinged google.com"),On(2)):(this.j.info("Failed to ping google.com"),On(1))};function hP(h){if(h.G=0,h.ka=[],h.l){let m=Hp(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 fP(h,m,E){var y=E instanceof rs?ei(E):new rs(E);if(y.g!="")m&&(y.g=m+"."+y.g),qs(y,y.s);else{var V=a.location;y=V.protocol,m=m?m+"."+V.hostname:V.hostname,V=+V.port;var z=new rs(null);y&&is(z,y),m&&(z.g=m),V&&qs(z,V),E&&(z.l=E),y=z}return E=h.D,m=h.ya,E&&m&&S(y,E,m),S(y,"VER",h.la),Af(h,y),y}function gP(h,m,E){if(m&&!h.J)throw Error("Can't create secondary domain capable XhrIo object.");return m=h.Ca&&!h.pa?new Vt(new If({eb:E})):new Vt(h.pa),m.Ha(h.J),m}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function mP(){}r=mP.prototype,r.ua=function(){},r.ta=function(){},r.sa=function(){},r.ra=function(){},r.isActive=function(){return!0},r.Na=function(){};function Zp(){}Zp.prototype.g=function(h,m){return new Lr(h,m)};function Lr(h,m){zt.call(this),this.g=new iP(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)&&!L(h)&&(this.g.m=h),this.v=m&&m.supportsCrossDomainXhr||!1,this.u=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!L(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 Ru(this)}p(Lr,zt),Lr.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Lr.prototype.close=function(){SS(this.g)},Lr.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__=Ec(h),h=E);m.i.push(new yu(m.Ya++,h)),m.G==3&&Xp(m)},Lr.prototype.N=function(){this.g.l=null,delete this.j,SS(this.g),delete this.g,Lr.aa.N.call(this)};function pP(h){_c.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(pP,_c);function EP(){Tu.call(this),this.status=1}p(EP,Tu);function Ru(h){this.g=h}p(Ru,mP),Ru.prototype.ua=function(){on(this.g,"a")},Ru.prototype.ta=function(h){on(this.g,new pP(h))},Ru.prototype.sa=function(h){on(this.g,new EP)},Ru.prototype.ra=function(){on(this.g,"b")},Zp.prototype.createWebChannel=Zp.prototype.g,Lr.prototype.send=Lr.prototype.o,Lr.prototype.open=Lr.prototype.m,Lr.prototype.close=Lr.prototype.close,zb=Ms.createWebChannelTransport=function(){return new Zp},Wb=Ms.getStatEventTarget=function(){return nr()},Hb=Ms.Event=Xr,Lv=Ms.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},at.NO_ERROR=0,at.TIMEOUT=8,at.HTTP_ERROR=6,km=Ms.ErrorCode=at,es.COMPLETE="complete",jb=Ms.EventType=es,uf.EventType=Ws,Ws.OPEN="a",Ws.CLOSE="b",Ws.ERROR="c",Ws.MESSAGE="d",zt.prototype.listen=zt.prototype.K,ah=Ms.WebChannel=uf,Fie=Ms.FetchXmlHttpFactory=If,Vt.prototype.listenOnce=Vt.prototype.L,Vt.prototype.getLastError=Vt.prototype.Ka,Vt.prototype.getLastErrorCode=Vt.prototype.Ba,Vt.prototype.getStatus=Vt.prototype.Z,Vt.prototype.getResponseJson=Vt.prototype.Oa,Vt.prototype.getResponseText=Vt.prototype.oa,Vt.prototype.send=Vt.prototype.ea,Vt.prototype.setWithCredentials=Vt.prototype.Ha,$b=Ms.XhrIo=Vt}).apply(typeof wv<"u"?wv:typeof self<"u"?self:typeof window<"u"?window:{});var bj="@firebase/firestore",wj="4.8.0";var tn=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}};tn.UNAUTHENTICATED=new tn(null),tn.GOOGLE_CREDENTIALS=new tn("google-credentials-uid"),tn.FIRST_PARTY=new tn("first-party-uid"),tn.MOCK_USER=new tn("mock-user");var qh="11.10.0";var Qa=new pi("@firebase/firestore");function gh(){return Qa.logLevel}function aM(r){Qa.setLogLevel(r)}function X(r,...e){if(Qa.logLevel<=Pe.DEBUG){let n=e.map(cM);Qa.debug(`Firestore (${qh}): ${r}`,...n)}}function Wt(r,...e){if(Qa.logLevel<=Pe.ERROR){let n=e.map(cM);Qa.error(`Firestore (${qh}): ${r}`,...n)}}function ks(r,...e){if(Qa.logLevel<=Pe.WARN){let n=e.map(cM);Qa.warn(`Firestore (${qh}): ${r}`,...n)}}function cM(r){if(typeof r=="string")return r;try{return(function(n){return JSON.stringify(n)})(r)}catch{return r}}function ae(r,e,n){let t="Unexpected state";typeof e=="string"?t=e:n=e,zH(r,t,n)}function zH(r,e,n){let t=`FIRESTORE (${qh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${r.toString(16)})`;if(n!==void 0)try{t+=" CONTEXT: "+JSON.stringify(n)}catch{t+=" CONTEXT: "+n}throw Wt(t),new Error(t)}function fe(r,e,n,t){let i="Unexpected state";typeof n=="string"?i=n:t=n,r||zH(e,i,t)}function he(r,e){return r}var W={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 vr{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Nr=class{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}};var zv=class{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},ew=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(tn.UNAUTHENTICATED))}shutdown(){}},tw=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}},nw=class{constructor(e){this.t=e,this.currentUser=tn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){fe(this.o===void 0,42304);let t=this.i,i=c=>this.i!==t?(t=this.i,n(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,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(t=>this.i!==e?(X("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(fe(typeof t.accessToken=="string",31837,{l:t}),new zv(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 fe(e===null||typeof e=="string",2055,{h:e}),new tn(e)}},rw=class{constructor(e,n,t){this.P=e,this.T=n,this.I=t,this.type="FirstParty",this.user=tn.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}},iw=class{constructor(e,n,t){this.P=e,this.T=n,this.I=t}getToken(){return Promise.resolve(new rw(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(tn.FIRST_PARTY))}shutdown(){}invalidateToken(){}},qv=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)}},ow=class{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,yr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){fe(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?n(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 qv(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(fe(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new qv(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function kie(r){let e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(r);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let t=0;t<r;t++)n[t]=Math.floor(256*Math.random());return n}function qH(){return new TextEncoder}var Zm=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516),t="";for(;t.length<20;){let i=kie(40);for(let o=0;o<i.length;++o)t.length<20&&i[o]<n&&(t+=e.charAt(i[o]%62))}return t}};function De(r,e){return r<e?-1:r>e?1:0}function sw(r,e){let n=0;for(;n<r.length&&n<e.length;){let t=r.codePointAt(n),i=e.codePointAt(n);if(t!==i){if(t<128&&i<128)return De(t,i);{let o=qH(),s=Uie(o.encode(Lj(r,n)),o.encode(Lj(e,n)));return s!==0?s:De(t,i)}}n+=t>65535?2:1}return De(r.length,e.length)}function Lj(r,e){return r.codePointAt(e)>65535?r.substring(e,e+2):r.substring(e,e+1)}function Uie(r,e){for(let n=0;n<r.length&&n<e.length;++n)if(r[n]!==e[n])return De(r[n],e[n]);return De(r.length,e.length)}function Sh(r,e,n){return r.length===e.length&&r.every((t,i)=>n(t,e[i]))}function KH(r){return r+"\0"}var Mj="__name__",Kv=class r{constructor(e,n,t){n===void 0?n=0:n>e.length&&ae(637,{offset:n,range:e.length}),t===void 0?t=e.length-n:t>e.length-n&&ae(1746,{length:t,range:e.length-n}),this.segments=e,this.offset=n,this.len=t}get length(){return this.len}isEqual(e){return r.comparator(this,e)===0}child(e){let n=this.segments.slice(this.offset,this.limit());return e instanceof r?e.forEach(t=>{n.push(t)}):n.push(e),this.construct(n)}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 n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,t=this.limit();n<t;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){let t=Math.min(e.length,n.length);for(let i=0;i<t;i++){let o=r.compareSegments(e.get(i),n.get(i));if(o!==0)return o}return De(e.length,n.length)}static compareSegments(e,n){let t=r.isNumericId(e),i=r.isNumericId(n);return t&&!i?-1:!t&&i?1:t&&i?r.extractNumericId(e).compare(r.extractNumericId(n)):sw(e,n)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ls.fromString(e.substring(4,e.length-2))}},He=class r extends Kv{construct(e,n,t){return new r(e,n,t)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let n=[];for(let t of e){if(t.indexOf("//")>=0)throw new Q(W.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);n.push(...t.split("/").filter(i=>i.length>0))}return new r(n)}static emptyPath(){return new r([])}},Vie=/^[_a-zA-Z][_a-zA-Z0-9]*$/,gn=class r extends Kv{construct(e,n,t){return new r(e,n,t)}static isValidIdentifier(e){return Vie.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),r.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Mj}static keyField(){return new r([Mj])}static fromServerFormat(e){let n=[],t="",i=0,o=()=>{if(t.length===0)throw new Q(W.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(t),t=""},s=!1;for(;i<e.length;){let a=e[i];if(a==="\\"){if(i+1===e.length)throw new Q(W.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[i+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new Q(W.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(W.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new r(n)}static emptyPath(){return new r([])}};var se=class r{constructor(e){this.path=e}static fromPath(e){return new r(He.fromString(e))}static fromName(e){return new r(He.fromString(e).popFirst(5))}static empty(){return new r(He.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&&He.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return He.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new r(new He(e.slice()))}};function lM(r,e,n){if(!n)throw new Q(W.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function Bie(r,e,n,t){if(e===!0&&t===!0)throw new Q(W.INVALID_ARGUMENT,`${r} and ${n} cannot be used together.`)}function Pj(r){if(!se.isDocumentKey(r))throw new Q(W.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function xj(r){if(se.isDocumentKey(r))throw new Q(W.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${r} has ${r.length}.`)}function YH(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function $y(r){if(r===void 0)return"undefined";if(r===null)return"null";if(typeof r=="string")return r.length>20&&(r=`${r.substring(0,20)}...`),JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean")return""+r;if(typeof r=="object"){if(r instanceof Array)return"an array";{let e=(function(t){return t.constructor?t.constructor.name:null})(r);return e?`a custom ${e} object`:"an object"}}return typeof r=="function"?"a function":ae(12329,{type:typeof r})}function Or(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new Q(W.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=$y(r);throw new Q(W.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return r}function Gie(r,e){if(e<=0)throw new Q(W.INVALID_ARGUMENT,`Function ${r}() requires a positive number, but it was: ${e}.`)}function nn(r,e){let n={typeString:r};return e&&(n.value=e),n}function Cp(r,e){if(!YH(r))throw new Q(W.INVALID_ARGUMENT,"JSON must be an object");let n;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 r)){n=`JSON missing required field: '${t}'`;break}let s=r[t];if(i&&typeof s!==i){n=`JSON field '${t}' must be a ${i}.`;break}if(o!==void 0&&s!==o.value){n=`Expected '${t}' field to equal '${o.value}'`;break}}if(n)throw new Q(W.INVALID_ARGUMENT,n);return!0}var Fj=-62135596800,kj=1e6,wt=class r{static now(){return r.fromMillis(Date.now())}static fromDate(e){return r.fromMillis(e.getTime())}static fromMillis(e){let n=Math.floor(e/1e3),t=Math.floor((e-1e3*n)*kj);return new r(n,t)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new Q(W.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new Q(W.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<Fj)throw new Q(W.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Q(W.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/kj}_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:r._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Cp(e,r._jsonSchema))return new r(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-Fj;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};wt._jsonSchemaVersion="firestore/timestamp/1.0",wt._jsonSchema={type:nn("string",wt._jsonSchemaVersion),seconds:nn("number"),nanoseconds:nn("number")};var Ee=class r{static fromTimestamp(e){return new r(e)}static min(){return new r(new wt(0,0))}static max(){return new r(new wt(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 Ah=-1,Rh=class{constructor(e,n,t,i){this.indexId=e,this.collectionGroup=n,this.fields=t,this.indexState=i}};function aw(r){return r.fields.find(e=>e.kind===2)}function $l(r){return r.fields.filter(e=>e.kind!==2)}Rh.UNKNOWN_ID=-1;var Th=class{constructor(e,n){this.fieldPath=e,this.kind=n}};var ep=class r{constructor(e,n){this.sequenceNumber=e,this.offset=n}static empty(){return new r(0,Ii.min())}};function QH(r,e){let n=r.toTimestamp().seconds,t=r.toTimestamp().nanoseconds+1,i=Ee.fromTimestamp(t===1e9?new wt(n+1,0):new wt(n,t));return new Ii(i,se.empty(),e)}function XH(r){return new Ii(r.readTime,r.key,Ah)}var Ii=class r{constructor(e,n,t){this.readTime=e,this.documentKey=n,this.largestBatchId=t}static min(){return new r(Ee.min(),se.empty(),Ah)}static max(){return new r(Ee.max(),se.empty(),Ah)}};function uM(r,e){let n=r.readTime.compareTo(e.readTime);return n!==0?n:(n=se.comparator(r.documentKey,e.documentKey),n!==0?n:De(r.largestBatchId,e.largestBatchId))}var JH="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Yv=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};function ic(r){return I(this,null,function*(){if(r.code!==W.FAILED_PRECONDITION||r.message!==JH)throw r;X("LocalStore","Unexpectedly lost primary lease")})}var $=class r{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&ae(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new r((t,i)=>{this.nextCallback=o=>{this.wrapSuccess(e,o).next(t,i)},this.catchCallback=o=>{this.wrapFailure(n,o).next(t,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{let n=e();return n instanceof r?n:r.resolve(n)}catch(n){return r.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):r.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):r.reject(n)}static resolve(e){return new r((n,t)=>{n(e)})}static reject(e){return new r((n,t)=>{t(e)})}static waitFor(e){return new r((n,t)=>{let i=0,o=0,s=!1;e.forEach(a=>{++i,a.next(()=>{++o,s&&o===i&&n()},c=>t(c))}),s=!0,o===i&&n()})}static or(e){let n=r.resolve(!1);for(let t of e)n=n.next(i=>i?r.resolve(i):t());return n}static forEach(e,n){let t=[];return e.forEach((i,o)=>{t.push(n.call(this,i,o))}),this.waitFor(t)}static mapArray(e,n){return new r((t,i)=>{let o=e.length,s=new Array(o),a=0;for(let c=0;c<o;c++){let l=c;n(e[l]).next(u=>{s[l]=u,++a,a===o&&t(s)},u=>i(u))}})}static doWhile(e,n){return new r((t,i)=>{let o=()=>{e()===!0?n().next(()=>{o()},i):t()};o()})}};var Wr="SimpleDb",Qv=class r{static open(e,n,t,i){try{return new r(n,e.transaction(i,t))}catch(o){throw new Ql(n,o)}}constructor(e,n){this.action=e,this.transaction=n,this.aborted=!1,this.S=new Nr,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{n.error?this.S.reject(new Ql(e,n.error)):this.S.resolve()},this.transaction.onerror=t=>{let i=dM(t.target.error);this.S.reject(new Ql(e,i))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(X(Wr,"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 n=this.transaction.objectStore(e);return new lw(n)}},Dh=class r{static delete(e){return X(Wr,"Removing database:",e),Hl(cI().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!Ud())return!1;if(r.F())return!0;let e=hn(),n=r.M(e),t=0<n&&n<10,i=ZH(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,n){return e.store(n)}static M(e){let n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,n,t){this.name=e,this.version=n,this.B=t,this.L=null,r.M(hn())===12.2&&Wt("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(Wr,"Opening database:",this.name),this.db=yield new Promise((n,t)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=o=>{let s=o.target.result;n(s)},i.onblocked=()=>{t(new Ql(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(W.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(W.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 Ql(e,s))},i.onupgradeneeded=o=>{X(Wr,'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(Wr,"Database upgrade to version "+this.version+" complete")})}}),this.db.addEventListener("close",n=>{let t=n.target;this.L=t.version},{passive:!0})),this.db.addEventListener("versionchange",n=>{var t;n.newVersion===null&&(ks('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,n,t,i){return I(this,null,function*(){let o=n==="readonly",s=0;for(;;){++s;try{this.db=yield this.k(e);let a=Qv.open(this.db,e,o?"readonly":"readwrite",t),c=i(a).next(l=>(a.v(),l)).catch(l=>(a.abort(l),$.reject(l))).toPromise();return c.catch(()=>{}),yield a.D,c}catch(a){let c=a,l=c.name!=="FirebaseError"&&s<3;if(X(Wr,"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 ZH(r){let e=r.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}var cw=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 Hl(this.$.delete())}},Ql=class extends Q{constructor(e,n){super(W.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${n}`),this.name="IndexedDbTransactionError"}};function oc(r){return r.name==="IndexedDbTransactionError"}var lw=class{constructor(e){this.store=e}put(e,n){let t;return n!==void 0?(X(Wr,"PUT",this.store.name,e,n),t=this.store.put(n,e)):(X(Wr,"PUT",this.store.name,"<auto-key>",e),t=this.store.put(e)),Hl(t)}add(e){return X(Wr,"ADD",this.store.name,e,e),Hl(this.store.add(e))}get(e){return Hl(this.store.get(e)).next(n=>(n===void 0&&(n=null),X(Wr,"GET",this.store.name,e,n),n))}delete(e){return X(Wr,"DELETE",this.store.name,e),Hl(this.store.delete(e))}count(){return X(Wr,"COUNT",this.store.name),Hl(this.store.count())}j(e,n){let t=this.options(e,n),i=t.index?this.store.index(t.index):this.store;if(typeof i.getAll=="function"){let o=i.getAll(t.range);return new $((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,n){let t=this.store.getAll(e,n===null?void 0:n);return new $((i,o)=>{t.onerror=s=>{o(s.target.error)},t.onsuccess=s=>{i(s.target.result)}})}Y(e,n){X(Wr,"DELETE ALL",this.store.name);let t=this.options(e,n);t.Z=!1;let i=this.cursor(t);return this.J(i,(o,s,a)=>a.delete())}X(e,n){let t;n?t=e:(t={},n=e);let i=this.cursor(t);return this.J(i,n)}ee(e){let n=this.cursor({});return new $((t,i)=>{n.onerror=o=>{let s=dM(o.target.error);i(s)},n.onsuccess=o=>{let s=o.target.result;s?e(s.primaryKey,s.value).next(a=>{a?s.continue():t()}):t()}})}J(e,n){let t=[];return new $((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 cw(a),l=n(a.primaryKey,a.value,c);if(l instanceof $){let u=l.catch(d=>(c.done(),$.reject(d)));t.push(u)}c.isDone?i():c.W===null?a.continue():a.continue(c.W)}}).next(()=>$.waitFor(t))}options(e,n){let t;return e!==void 0&&(typeof e=="string"?t=e:n=e),{index:t,range:n}}cursor(e){let n="next";if(e.reverse&&(n="prev"),e.index){let t=this.store.index(e.index);return e.Z?t.openKeyCursor(e.range,n):t.openCursor(e.range,n)}return this.store.openCursor(e.range,n)}};function Hl(r){return new $((e,n)=>{r.onsuccess=t=>{let i=t.target.result;e(i)},r.onerror=t=>{let i=dM(t.target.error);n(i)}})}var Uj=!1;function dM(r){let e=Dh.M(hn());if(e>=12.2&&e<13){let n="An internal error was encountered in the Indexed Database server";if(r.message.indexOf(n)>=0){let t=new Q("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${n}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Uj||(Uj=!0,setTimeout(()=>{throw t},0)),t}}return r}var Wm="IndexBackfiller",uw=class{constructor(e,n){this.asyncQueue=e,this.te=n,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(Wm,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,()=>I(this,null,function*(){this.task=null;try{let n=yield this.te.re();X(Wm,`Documents written: ${n}`)}catch(n){oc(n)?X(Wm,"Ignoring IndexedDB error during index backfill: ",n):yield ic(n)}yield this.ne(6e4)}))}},dw=class{constructor(e,n){this.localStore=e,this.persistence=n}re(e=50){return I(this,null,function*(){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",n=>this.ie(n,e))})}ie(e,n){let t=new Set,i=n,o=!0;return $.doWhile(()=>o===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(s=>{if(s!==null&&!t.has(s))return X(Wm,`Processing collection: ${s}`),this.se(e,s,i).next(a=>{i-=a,t.add(s)});o=!1})).next(()=>n-i)}se(e,n,t){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,n).next(i=>this.localStore.localDocuments.getNextDocuments(e,n,i,t).next(o=>{let s=o.changes;return this.localStore.indexManager.updateIndexEntries(e,s).next(()=>this.oe(i,o)).next(a=>(X(Wm,`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,n,a))).next(()=>s.size)}))}oe(e,n){let t=e;return n.changes.forEach((i,o)=>{let s=XH(o);uM(s,t)>0&&(t=s)}),new Ii(t.readTime,t.documentKey,Math.max(n.batchId,e.largestBatchId))}};var zr=(()=>{class r{constructor(n,t){this.previousValue=n,t&&(t.sequenceNumberHandler=i=>this._e(i),this.ae=i=>t.writeSequenceNumber(i))}_e(n){return this.previousValue=Math.max(n,this.previousValue),this.previousValue}next(){let n=++this.previousValue;return this.ae&&this.ae(n),n}}r.ue=-1;return r})(),Xl=-1;function Np(r){return r==null}function tp(r){return r===0&&1/r==-1/0}function eW(r){return typeof r=="number"&&Number.isInteger(r)&&!tp(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}var Xv="";function tr(r){let e="";for(let n=0;n<r.length;n++)e.length>0&&(e=Vj(e)),e=$ie(r.get(n),e);return Vj(e)}function $ie(r,e){let n=e,t=r.length;for(let i=0;i<t;i++){let o=r.charAt(i);switch(o){case"\0":n+="";break;case Xv:n+="";break;default:n+=o}}return n}function Vj(r){return r+Xv+""}function Go(r){let e=r.length;if(fe(e>=2,64408,{path:r}),e===2)return fe(r.charAt(0)===Xv&&r.charAt(1)==="",56145,{path:r}),He.emptyPath();let n=e-2,t=[],i="";for(let o=0;o<e;){let s=r.indexOf(Xv,o);switch((s<0||s>n)&&ae(50515,{path:r}),r.charAt(s+1)){case"":let a=r.substring(o,s),c;i.length===0?c=a:(i+=a,c=i,i=""),t.push(c);break;case"":i+=r.substring(o,s),i+="\0";break;case"":i+=r.substring(o,s+1);break;default:ae(61167,{path:r})}o=s+2}return new He(t)}var jl="remoteDocuments",Op="owner",ch="owner",np="mutationQueues",jie="userId",Ki="mutations",Bj="batchId",Kl="userMutationsIndex",Gj=["userId","batchId"];function Uv(r,e){return[r,tr(e)]}function tW(r,e,n){return[r,tr(e),n]}var Hie={},Ch="documentMutations",Jv="remoteDocumentsV14",Wie=["prefixPath","collectionGroup","readTime","documentId"],Vv="documentKeyIndex",zie=["prefixPath","collectionGroup","documentId"],nW="collectionGroupIndex",qie=["collectionGroup","readTime","prefixPath","documentId"],rp="remoteDocumentGlobal",hw="remoteDocumentGlobalKey",Nh="targets",rW="queryTargetsIndex",Kie=["canonicalId","targetId"],Oh="targetDocuments",Yie=["targetId","path"],hM="documentTargetsIndex",Qie=["path","targetId"],Zv="targetGlobalKey",Jl="targetGlobal",ip="collectionParents",Xie=["collectionId","parent"],bh="clientMetadata",Jie="clientId",jy="bundles",Zie="bundleId",Hy="namedQueries",eoe="name",fM="indexConfiguration",toe="indexId",fw="collectionGroupIndex",noe="collectionGroup",zm="indexState",roe=["indexId","uid"],iW="sequenceNumberIndex",ioe=["uid","sequenceNumber"],qm="indexEntries",ooe=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],oW="documentKeyIndex",soe=["indexId","uid","orderedDocumentKey"],Wy="documentOverlays",aoe=["userId","collectionPath","documentId"],gw="collectionPathOverlayIndex",coe=["userId","collectionPath","largestBatchId"],sW="collectionGroupOverlayIndex",loe=["userId","collectionGroup","largestBatchId"],gM="globals",uoe="name",aW=[np,Ki,Ch,jl,Nh,Op,Jl,Oh,bh,rp,ip,jy,Hy],doe=[...aW,Wy],cW=[np,Ki,Ch,Jv,Nh,Op,Jl,Oh,bh,rp,ip,jy,Hy,Wy],lW=cW,mM=[...lW,fM,zm,qm],hoe=mM,uW=[...mM,gM],foe=uW;var op=class extends Yv{constructor(e,n){super(),this.ce=e,this.currentSequenceNumber=n}};function En(r,e){let n=he(r);return Dh.N(n.ce,e)}function $j(r){let e=0;for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&e++;return e}function sc(r,e){for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&e(n,r[n])}function goe(r,e){let n=[];for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&n.push(e(r[t],t,r));return n}function dW(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}var St=class r{constructor(e,n){this.comparator=e,this.root=n||jo.EMPTY}insert(e,n){return new r(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,jo.BLACK,null,null))}remove(e){return new r(this.comparator,this.root.remove(e,this.comparator).copy(null,null,jo.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){let t=this.comparator(e,n.key);if(t===0)return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null}indexOf(e){let n=0,t=this.root;for(;!t.isEmpty();){let i=this.comparator(e,t.key);if(i===0)return n+t.left.size;i<0?t=t.left:(n+=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((n,t)=>(e(n,t),!1))}toString(){let e=[];return this.inorderTraversal((n,t)=>(e.push(`${n}:${t}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new _h(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new _h(this.root,e,this.comparator,!1)}getReverseIterator(){return new _h(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new _h(this.root,e,this.comparator,!0)}},_h=class{constructor(e,n,t,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!e.isEmpty();)if(o=n?t(e.key,n):1,n&&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(),n={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 n}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}}},jo=class r{constructor(e,n,t,i,o){this.key=e,this.value=n,this.color=t??r.RED,this.left=i??r.EMPTY,this.right=o??r.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,t,i,o){return new r(e??this.key,n??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,n,t){let i=this,o=t(e,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(e,n,t),null):o===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,t)),i.fixUp()}removeMin(){if(this.left.isEmpty())return r.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,n){let t,i=this;if(n(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,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return r.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,n))}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,r.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,r.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),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}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)}};jo.EMPTY=null,jo.RED=!0,jo.BLACK=!1;jo.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,n,t,i,o){return this}insert(e,n,t){return new jo(e,n)}remove(e,n){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 ot=class r{constructor(e){this.comparator=e,this.data=new St(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((n,t)=>(e(n),!1))}forEachInRange(e,n){let t=this.data.getIteratorFrom(e[0]);for(;t.hasNext();){let i=t.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let t;for(t=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();t.hasNext();)if(!e(t.getNext().key))return}firstAfterOrEqual(e){let n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new ey(this.data.getIterator())}getIteratorFrom(e){return new ey(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 n=this;return n.size<e.size&&(n=e,e=this),e.forEach(t=>{n=n.add(t)}),n}isEqual(e){if(!(e instanceof r)||this.size!==e.size)return!1;let n=this.data.getIterator(),t=e.data.getIterator();for(;n.hasNext();){let i=n.getNext().key,o=t.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){let e=[];return this.forEach(n=>{e.push(n)}),e}toString(){let e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){let n=new r(this.comparator);return n.data=e,n}},ey=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};function lh(r){return r.hasNext()?r.getNext():void 0}var qr=class r{constructor(e){this.fields=e,e.sort(gn.comparator)}static empty(){return new r([])}unionWith(e){let n=new ot(gn.comparator);for(let t of this.fields)n=n.add(t);for(let t of e)n=n.add(t);return new r(n.toArray())}covers(e){for(let n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Sh(this.fields,e.fields,(n,t)=>n.isEqual(t))}};var ty=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var rn=class r{constructor(e){this.binaryString=e}static fromBase64String(e){let n=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new ty("Invalid base64 string: "+o):o}})(e);return new r(n)}static fromUint8Array(e){let n=(function(i){let o="";for(let s=0;s<i.length;++s)o+=String.fromCharCode(i[s]);return o})(e);return new r(n)}[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(n){return btoa(n)})(this.binaryString)}toUint8Array(){return(function(n){let t=new Uint8Array(n.length);for(let i=0;i<n.length;i++)t[i]=n.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}};rn.EMPTY_BYTE_STRING=new rn("");var moe=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Us(r){if(fe(!!r,39018),typeof r=="string"){let e=0,n=moe.exec(r);if(fe(!!n,46558,{timestamp:r}),n[1]){let i=n[1];i=(i+"000000000").substr(0,9),e=Number(i)}let t=new Date(r);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}return{seconds:bt(r.seconds),nanos:bt(r.nanos)}}function bt(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function Vs(r){return typeof r=="string"?rn.fromBase64String(r):rn.fromUint8Array(r)}var hW="server_timestamp",fW="__type__",gW="__previous_value__",mW="__local_write_time__";function zy(r){var e,n;return((n=(((e=r?.mapValue)===null||e===void 0?void 0:e.fields)||{})[fW])===null||n===void 0?void 0:n.stringValue)===hW}function qy(r){let e=r.mapValue.fields[gW];return zy(e)?qy(e):e}function sp(r){let e=Us(r.mapValue.fields[mW].timestampValue);return new wt(e.seconds,e.nanos)}var mw=class{constructor(e,n,t,i,o,s,a,c,l,u){this.databaseId=e,this.appId=n,this.persistenceKey=t,this.host=i,this.ssl=o,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=l,this.isUsingEmulator=u}},ap="(default)",wh=class r{constructor(e,n){this.projectId=e,this.database=n||ap}static empty(){return new r("","")}get isDefaultDatabase(){return this.database===ap}isEqual(e){return e instanceof r&&e.projectId===this.projectId&&e.database===this.database}};var pM="__type__",pW="__max__",Ha={mapValue:{fields:{__type__:{stringValue:pW}}}},EM="__vector__",Lh="value",Bv={nullValue:"NULL_VALUE"};function Xa(r){return"nullValue"in r?0:"booleanValue"in r?1:"integerValue"in r||"doubleValue"in r?2:"timestampValue"in r?3:"stringValue"in r?5:"bytesValue"in r?6:"referenceValue"in r?7:"geoPointValue"in r?8:"arrayValue"in r?9:"mapValue"in r?zy(r)?4:EW(r)?9007199254740991:Ky(r)?10:11:ae(28295,{value:r})}function Ho(r,e){if(r===e)return!0;let n=Xa(r);if(n!==Xa(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return sp(r).isEqual(sp(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=Us(i.timestampValue),a=Us(o.timestampValue);return s.seconds===a.seconds&&s.nanos===a.nanos})(r,e);case 5:return r.stringValue===e.stringValue;case 6:return(function(i,o){return Vs(i.bytesValue).isEqual(Vs(o.bytesValue))})(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return(function(i,o){return bt(i.geoPointValue.latitude)===bt(o.geoPointValue.latitude)&&bt(i.geoPointValue.longitude)===bt(o.geoPointValue.longitude)})(r,e);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return bt(i.integerValue)===bt(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){let s=bt(i.doubleValue),a=bt(o.doubleValue);return s===a?tp(s)===tp(a):isNaN(s)&&isNaN(a)}return!1})(r,e);case 9:return Sh(r.arrayValue.values||[],e.arrayValue.values||[],Ho);case 10:case 11:return(function(i,o){let s=i.mapValue.fields||{},a=o.mapValue.fields||{};if($j(s)!==$j(a))return!1;for(let c in s)if(s.hasOwnProperty(c)&&(a[c]===void 0||!Ho(s[c],a[c])))return!1;return!0})(r,e);default:return ae(52216,{left:r})}}function cp(r,e){return(r.values||[]).find(n=>Ho(n,e))!==void 0}function Ja(r,e){if(r===e)return 0;let n=Xa(r),t=Xa(e);if(n!==t)return De(n,t);switch(n){case 0:case 9007199254740991:return 0;case 1:return De(r.booleanValue,e.booleanValue);case 2:return(function(o,s){let a=bt(o.integerValue||o.doubleValue),c=bt(s.integerValue||s.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1})(r,e);case 3:return jj(r.timestampValue,e.timestampValue);case 4:return jj(sp(r),sp(e));case 5:return sw(r.stringValue,e.stringValue);case 6:return(function(o,s){let a=Vs(o),c=Vs(s);return a.compareTo(c)})(r.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)})(r.referenceValue,e.referenceValue);case 8:return(function(o,s){let a=De(bt(o.latitude),bt(s.latitude));return a!==0?a:De(bt(o.longitude),bt(s.longitude))})(r.geoPointValue,e.geoPointValue);case 9:return Hj(r.arrayValue,e.arrayValue);case 10:return(function(o,s){var a,c,l,u;let d=o.fields||{},f=s.fields||{},g=(a=d[Lh])===null||a===void 0?void 0:a.arrayValue,p=(c=f[Lh])===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?_:Hj(g,p)})(r.mapValue,e.mapValue);case 11:return(function(o,s){if(o===Ha.mapValue&&s===Ha.mapValue)return 0;if(o===Ha.mapValue)return 1;if(s===Ha.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=sw(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)})(r.mapValue,e.mapValue);default:throw ae(23264,{le:n})}}function jj(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return De(r,e);let n=Us(r),t=Us(e),i=De(n.seconds,t.seconds);return i!==0?i:De(n.nanos,t.nanos)}function Hj(r,e){let n=r.values||[],t=e.values||[];for(let i=0;i<n.length&&i<t.length;++i){let o=Ja(n[i],t[i]);if(o)return o}return De(n.length,t.length)}function Mh(r){return pw(r)}function pw(r){return"nullValue"in r?"null":"booleanValue"in r?""+r.booleanValue:"integerValue"in r?""+r.integerValue:"doubleValue"in r?""+r.doubleValue:"timestampValue"in r?(function(n){let t=Us(n);return`time(${t.seconds},${t.nanos})`})(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?(function(n){return Vs(n).toBase64()})(r.bytesValue):"referenceValue"in r?(function(n){return se.fromName(n).toString()})(r.referenceValue):"geoPointValue"in r?(function(n){return`geo(${n.latitude},${n.longitude})`})(r.geoPointValue):"arrayValue"in r?(function(n){let t="[",i=!0;for(let o of n.values||[])i?i=!1:t+=",",t+=pw(o);return t+"]"})(r.arrayValue):"mapValue"in r?(function(n){let t=Object.keys(n.fields||{}).sort(),i="{",o=!0;for(let s of t)o?o=!1:i+=",",i+=`${s}:${pw(n.fields[s])}`;return i+"}"})(r.mapValue):ae(61005,{value:r})}function Gv(r){switch(Xa(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=qy(r);return e?16+Gv(e):16;case 5:return 2*r.stringValue.length;case 6:return Vs(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return(function(t){return(t.values||[]).reduce((i,o)=>i+Gv(o),0)})(r.arrayValue);case 10:case 11:return(function(t){let i=0;return sc(t.fields,(o,s)=>{i+=o.length+Gv(s)}),i})(r.mapValue);default:throw ae(13486,{value:r})}}function eu(r,e){return{referenceValue:`projects/${r.projectId}/databases/${r.database}/documents/${e.path.canonicalString()}`}}function Ew(r){return!!r&&"integerValue"in r}function lp(r){return!!r&&"arrayValue"in r}function Wj(r){return!!r&&"nullValue"in r}function zj(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function $v(r){return!!r&&"mapValue"in r}function Ky(r){var e,n;return((n=(((e=r?.mapValue)===null||e===void 0?void 0:e.fields)||{})[pM])===null||n===void 0?void 0:n.stringValue)===EM}function Km(r){if(r.geoPointValue)return{geoPointValue:Object.assign({},r.geoPointValue)};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:Object.assign({},r.timestampValue)};if(r.mapValue){let e={mapValue:{fields:{}}};return sc(r.mapValue.fields,(n,t)=>e.mapValue.fields[n]=Km(t)),e}if(r.arrayValue){let e={arrayValue:{values:[]}};for(let n=0;n<(r.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Km(r.arrayValue.values[n]);return e}return Object.assign({},r)}function EW(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===pW}var _W={mapValue:{fields:{[pM]:{stringValue:EM},[Lh]:{arrayValue:{}}}}};function poe(r){return"nullValue"in r?Bv:"booleanValue"in r?{booleanValue:!1}:"integerValue"in r||"doubleValue"in r?{doubleValue:NaN}:"timestampValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in r?{stringValue:""}:"bytesValue"in r?{bytesValue:""}:"referenceValue"in r?eu(wh.empty(),se.empty()):"geoPointValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in r?{arrayValue:{}}:"mapValue"in r?Ky(r)?_W:{mapValue:{}}:ae(35942,{value:r})}function Eoe(r){return"nullValue"in r?{booleanValue:!1}:"booleanValue"in r?{doubleValue:NaN}:"integerValue"in r||"doubleValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in r?{stringValue:""}:"stringValue"in r?{bytesValue:""}:"bytesValue"in r?eu(wh.empty(),se.empty()):"referenceValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in r?{arrayValue:{}}:"arrayValue"in r?_W:"mapValue"in r?Ky(r)?{mapValue:{}}:Ha:ae(61959,{value:r})}function qj(r,e){let n=Ja(r.value,e.value);return n!==0?n:r.inclusive&&!e.inclusive?-1:!r.inclusive&&e.inclusive?1:0}function Kj(r,e){let n=Ja(r.value,e.value);return n!==0?n:r.inclusive&&!e.inclusive?1:!r.inclusive&&e.inclusive?-1:0}var er=class r{constructor(e){this.value=e}static empty(){return new r({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let t=0;t<e.length-1;++t)if(n=(n.mapValue.fields||{})[e.get(t)],!$v(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=Km(n)}setAll(e){let n=gn.emptyPath(),t={},i=[];e.forEach((s,a)=>{if(!n.isImmediateParentOf(a)){let c=this.getFieldsMap(n);this.applyChanges(c,t,i),t={},i=[],n=a.popLast()}s?t[a.lastSegment()]=Km(s):i.push(a.lastSegment())});let o=this.getFieldsMap(n);this.applyChanges(o,t,i)}delete(e){let n=this.field(e.popLast());$v(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Ho(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let t=0;t<e.length;++t){let i=n.mapValue.fields[e.get(t)];$v(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},n.mapValue.fields[e.get(t)]=i),n=i}return n.mapValue.fields}applyChanges(e,n,t){sc(n,(i,o)=>e[i]=o);for(let i of t)delete e[i]}clone(){return new r(Km(this.value))}};function TW(r){let e=[];return sc(r.fields,(n,t)=>{let i=new gn([n]);if($v(t)){let o=TW(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 qr(e)}var mn=class r{constructor(e,n,t,i,o,s,a){this.key=e,this.documentType=n,this.version=t,this.readTime=i,this.createTime=o,this.data=s,this.documentState=a}static newInvalidDocument(e){return new r(e,0,Ee.min(),Ee.min(),Ee.min(),er.empty(),0)}static newFoundDocument(e,n,t,i){return new r(e,1,n,Ee.min(),t,i,0)}static newNoDocument(e,n){return new r(e,2,n,Ee.min(),Ee.min(),er.empty(),0)}static newUnknownDocument(e,n){return new r(e,3,n,Ee.min(),Ee.min(),er.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Ee.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=er.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=er.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ee.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 r&&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 r(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 Wo=class{constructor(e,n){this.position=e,this.inclusive=n}};function Yj(r,e,n){let t=0;for(let i=0;i<r.position.length;i++){let o=e[i],s=r.position[i];if(o.field.isKeyField()?t=se.comparator(se.fromName(s.referenceValue),n.key):t=Ja(s,n.data.field(o.field)),o.dir==="desc"&&(t*=-1),t!==0)break}return t}function Qj(r,e){if(r===null)return e===null;if(e===null||r.inclusive!==e.inclusive||r.position.length!==e.position.length)return!1;for(let n=0;n<r.position.length;n++)if(!Ho(r.position[n],e.position[n]))return!1;return!0}var tu=class{constructor(e,n="asc"){this.field=e,this.dir=n}};function _oe(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}var ny=class{},Ge=class r extends ny{constructor(e,n,t){super(),this.field=e,this.op=n,this.value=t}static create(e,n,t){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,t):new Iw(e,n,t):n==="array-contains"?new Sw(e,t):n==="in"?new ry(e,t):n==="not-in"?new Aw(e,t):n==="array-contains-any"?new Rw(e,t):new r(e,n,t)}static createKeyFieldInFilter(e,n,t){return n==="in"?new vw(e,t):new yw(e,t)}matches(e){let n=e.data.field(this.field);return this.op==="!="?n!==null&&n.nullValue===void 0&&this.matchesComparison(Ja(n,this.value)):n!==null&&Xa(this.value)===Xa(n)&&this.matchesComparison(Ja(n,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]}},tt=class r extends ny{constructor(e,n){super(),this.filters=e,this.op=n,this.he=null}static create(e,n){return new r(e,n)}matches(e){return Ph(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.he!==null||(this.he=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}};function Ph(r){return r.op==="and"}function _w(r){return r.op==="or"}function _M(r){return IW(r)&&Ph(r)}function IW(r){for(let e of r.filters)if(e instanceof tt)return!1;return!0}function Tw(r){if(r instanceof Ge)return r.field.canonicalString()+r.op.toString()+Mh(r.value);if(_M(r))return r.filters.map(e=>Tw(e)).join(",");{let e=r.filters.map(n=>Tw(n)).join(",");return`${r.op}(${e})`}}function vW(r,e){return r instanceof Ge?(function(t,i){return i instanceof Ge&&t.op===i.op&&t.field.isEqual(i.field)&&Ho(t.value,i.value)})(r,e):r instanceof tt?(function(t,i){return i instanceof tt&&t.op===i.op&&t.filters.length===i.filters.length?t.filters.reduce((o,s,a)=>o&&vW(s,i.filters[a]),!0):!1})(r,e):void ae(19439)}function yW(r,e){let n=r.filters.concat(e);return tt.create(n,r.op)}function SW(r){return r instanceof Ge?(function(n){return`${n.field.canonicalString()} ${n.op} ${Mh(n.value)}`})(r):r instanceof tt?(function(n){return n.op.toString()+" {"+n.getFilters().map(SW).join(" ,")+"}"})(r):"Filter"}var Iw=class extends Ge{constructor(e,n,t){super(e,n,t),this.key=se.fromName(t.referenceValue)}matches(e){let n=se.comparator(e.key,this.key);return this.matchesComparison(n)}},vw=class extends Ge{constructor(e,n){super(e,"in",n),this.keys=AW("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}},yw=class extends Ge{constructor(e,n){super(e,"not-in",n),this.keys=AW("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}};function AW(r,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(t=>se.fromName(t.referenceValue))}var Sw=class extends Ge{constructor(e,n){super(e,"array-contains",n)}matches(e){let n=e.data.field(this.field);return lp(n)&&cp(n.arrayValue,this.value)}},ry=class extends Ge{constructor(e,n){super(e,"in",n)}matches(e){let n=e.data.field(this.field);return n!==null&&cp(this.value.arrayValue,n)}},Aw=class extends Ge{constructor(e,n){super(e,"not-in",n)}matches(e){if(cp(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!cp(this.value.arrayValue,n)}},Rw=class extends Ge{constructor(e,n){super(e,"array-contains-any",n)}matches(e){let n=e.data.field(this.field);return!(!lp(n)||!n.arrayValue.values)&&n.arrayValue.values.some(t=>cp(this.value.arrayValue,t))}};var Dw=class{constructor(e,n=null,t=[],i=[],o=null,s=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=t,this.filters=i,this.limit=o,this.startAt=s,this.endAt=a,this.Pe=null}};function Cw(r,e=null,n=[],t=[],i=null,o=null,s=null){return new Dw(r,e,n,t,i,o,s)}function nu(r){let e=he(r);if(e.Pe===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(t=>Tw(t)).join(","),n+="|ob:",n+=e.orderBy.map(t=>(function(o){return o.field.canonicalString()+o.dir})(t)).join(","),Np(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(t=>Mh(t)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(t=>Mh(t)).join(",")),e.Pe=n}return e.Pe}function bp(r,e){if(r.limit!==e.limit||r.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<r.orderBy.length;n++)if(!_oe(r.orderBy[n],e.orderBy[n]))return!1;if(r.filters.length!==e.filters.length)return!1;for(let n=0;n<r.filters.length;n++)if(!vW(r.filters[n],e.filters[n]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!Qj(r.startAt,e.startAt)&&Qj(r.endAt,e.endAt)}function iy(r){return se.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function oy(r,e){return r.filters.filter(n=>n instanceof Ge&&n.field.isEqual(e))}function Xj(r,e,n){let t=Bv,i=!0;for(let o of oy(r,e)){let s=Bv,a=!0;switch(o.op){case"<":case"<=":s=poe(o.value);break;case"==":case"in":case">=":s=o.value;break;case">":s=o.value,a=!1;break;case"!=":case"not-in":s=Bv}qj({value:t,inclusive:i},{value:s,inclusive:a})<0&&(t=s,i=a)}if(n!==null){for(let o=0;o<r.orderBy.length;++o)if(r.orderBy[o].field.isEqual(e)){let s=n.position[o];qj({value:t,inclusive:i},{value:s,inclusive:n.inclusive})<0&&(t=s,i=n.inclusive);break}}return{value:t,inclusive:i}}function Jj(r,e,n){let t=Ha,i=!0;for(let o of oy(r,e)){let s=Ha,a=!0;switch(o.op){case">=":case">":s=Eoe(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=Ha}Kj({value:t,inclusive:i},{value:s,inclusive:a})>0&&(t=s,i=a)}if(n!==null){for(let o=0;o<r.orderBy.length;++o)if(r.orderBy[o].field.isEqual(e)){let s=n.position[o];Kj({value:t,inclusive:i},{value:s,inclusive:n.inclusive})>0&&(t=s,i=n.inclusive);break}}return{value:t,inclusive:i}}var zo=class{constructor(e,n=null,t=[],i=[],o=null,s="F",a=null,c=null){this.path=e,this.collectionGroup=n,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 RW(r,e,n,t,i,o,s,a){return new zo(r,e,n,t,i,o,s,a)}function wp(r){return new zo(r)}function Zj(r){return r.filters.length===0&&r.limit===null&&r.startAt==null&&r.endAt==null&&(r.explicitOrderBy.length===0||r.explicitOrderBy.length===1&&r.explicitOrderBy[0].field.isKeyField())}function TM(r){return r.collectionGroup!==null}function Ih(r){let e=he(r);if(e.Te===null){e.Te=[];let n=new Set;for(let o of e.explicitOrderBy)e.Te.push(o),n.add(o.field.canonicalString());let t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(s){let a=new ot(gn.comparator);return s.filters.forEach(c=>{c.getFlattenedFilters().forEach(l=>{l.isInequality()&&(a=a.add(l.field))})}),a})(e).forEach(o=>{n.has(o.canonicalString())||o.isKeyField()||e.Te.push(new tu(o,t))}),n.has(gn.keyField().canonicalString())||e.Te.push(new tu(gn.keyField(),t))}return e.Te}function Yr(r){let e=he(r);return e.Ie||(e.Ie=DW(e,Ih(r))),e.Ie}function Toe(r){let e=he(r);return e.de||(e.de=DW(e,r.explicitOrderBy)),e.de}function DW(r,e){if(r.limitType==="F")return Cw(r.path,r.collectionGroup,e,r.filters,r.limit,r.startAt,r.endAt);{e=e.map(i=>{let o=i.dir==="desc"?"asc":"desc";return new tu(i.field,o)});let n=r.endAt?new Wo(r.endAt.position,r.endAt.inclusive):null,t=r.startAt?new Wo(r.startAt.position,r.startAt.inclusive):null;return Cw(r.path,r.collectionGroup,e,r.filters,r.limit,n,t)}}function Nw(r,e){let n=r.filters.concat([e]);return new zo(r.path,r.collectionGroup,r.explicitOrderBy.slice(),n,r.limit,r.limitType,r.startAt,r.endAt)}function sy(r,e,n){return new zo(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,n,r.startAt,r.endAt)}function Yy(r,e){return bp(Yr(r),Yr(e))&&r.limitType===e.limitType}function CW(r){return`${nu(Yr(r))}|lt:${r.limitType}`}function mh(r){return`Query(target=${(function(n){let t=n.path.canonicalString();return n.collectionGroup!==null&&(t+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(t+=`, filters: [${n.filters.map(i=>SW(i)).join(", ")}]`),Np(n.limit)||(t+=", limit: "+n.limit),n.orderBy.length>0&&(t+=`, orderBy: [${n.orderBy.map(i=>(function(s){return`${s.field.canonicalString()} (${s.dir})`})(i)).join(", ")}]`),n.startAt&&(t+=", startAt: ",t+=n.startAt.inclusive?"b:":"a:",t+=n.startAt.position.map(i=>Mh(i)).join(",")),n.endAt&&(t+=", endAt: ",t+=n.endAt.inclusive?"a:":"b:",t+=n.endAt.position.map(i=>Mh(i)).join(",")),`Target(${t})`})(Yr(r))}; limitType=${r.limitType})`}function Lp(r,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):se.isDocumentKey(t.path)?t.path.isEqual(o):t.path.isImmediateParentOf(o)})(r,e)&&(function(t,i){for(let o of Ih(t))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(r,e)&&(function(t,i){for(let o of t.filters)if(!o.matches(i))return!1;return!0})(r,e)&&(function(t,i){return!(t.startAt&&!(function(s,a,c){let l=Yj(s,a,c);return s.inclusive?l<=0:l<0})(t.startAt,Ih(t),i)||t.endAt&&!(function(s,a,c){let l=Yj(s,a,c);return s.inclusive?l>=0:l>0})(t.endAt,Ih(t),i))})(r,e)}function NW(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function OW(r){return(e,n)=>{let t=!1;for(let i of Ih(r)){let o=Ioe(i,e,n);if(o!==0)return o;t=t||i.field.isKeyField()}return 0}}function Ioe(r,e,n){let t=r.field.isKeyField()?se.comparator(e.key,n.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)})(r.field,e,n);switch(r.dir){case"asc":return t;case"desc":return-1*t;default:return ae(19790,{direction:r.dir})}}var Yi=class{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){let n=this.mapKeyFn(e),t=this.inner[n];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,n){let t=this.mapKeyFn(e),i=this.inner[t];if(i===void 0)return this.inner[t]=[[e,n]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],e))return void(i[o]=[e,n]);i.push([e,n]),this.innerSize++}delete(e){let n=this.mapKeyFn(e),t=this.inner[n];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[n]:t.splice(i,1),this.innerSize--,!0;return!1}forEach(e){sc(this.inner,(n,t)=>{for(let[i,o]of t)e(i,o)})}isEmpty(){return dW(this.inner)}size(){return this.innerSize}};var voe=new St(se.comparator);function Kr(){return voe}var bW=new St(se.comparator);function $m(...r){let e=bW;for(let n of r)e=e.insert(n.key,n);return e}function wW(r){let e=bW;return r.forEach((n,t)=>e=e.insert(n,t.overlayedDocument)),e}function $o(){return Ym()}function LW(){return Ym()}function Ym(){return new Yi(r=>r.toString(),(r,e)=>r.isEqual(e))}var yoe=new St(se.comparator),Soe=new ot(se.comparator);function ke(...r){let e=Soe;for(let n of r)e=e.add(n);return e}var Aoe=new ot(De);function IM(){return Aoe}function vM(r,e){if(r.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:tp(e)?"-0":e}}function MW(r){return{integerValue:""+r}}function Roe(r,e){return eW(e)?MW(e):vM(r,e)}var xh=class{constructor(){this._=void 0}};function Doe(r,e,n){return r instanceof ru?(function(i,o){let s={fields:{[fW]:{stringValue:hW},[mW]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&zy(o)&&(o=qy(o)),o&&(s.fields[gW]=o),{mapValue:s}})(n,e):r instanceof Za?xW(r,e):r instanceof ec?FW(r,e):(function(i,o){let s=PW(i,o),a=eH(s)+eH(i.Ee);return Ew(s)&&Ew(i.Ee)?MW(a):vM(i.serializer,a)})(r,e)}function Coe(r,e,n){return r instanceof Za?xW(r,e):r instanceof ec?FW(r,e):n}function PW(r,e){return r instanceof iu?(function(t){return Ew(t)||(function(o){return!!o&&"doubleValue"in o})(t)})(e)?e:{integerValue:0}:null}var ru=class extends xh{},Za=class extends xh{constructor(e){super(),this.elements=e}};function xW(r,e){let n=kW(e);for(let t of r.elements)n.some(i=>Ho(i,t))||n.push(t);return{arrayValue:{values:n}}}var ec=class extends xh{constructor(e){super(),this.elements=e}};function FW(r,e){let n=kW(e);for(let t of r.elements)n=n.filter(i=>!Ho(i,t));return{arrayValue:{values:n}}}var iu=class extends xh{constructor(e,n){super(),this.serializer=e,this.Ee=n}};function eH(r){return bt(r.integerValue||r.doubleValue)}function kW(r){return lp(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}var Ow=class{constructor(e,n){this.field=e,this.transform=n}};function Noe(r,e){return r.field.isEqual(e.field)&&(function(t,i){return t instanceof Za&&i instanceof Za||t instanceof ec&&i instanceof ec?Sh(t.elements,i.elements,Ho):t instanceof iu&&i instanceof iu?Ho(t.Ee,i.Ee):t instanceof ru&&i instanceof ru})(r.transform,e.transform)}var bw=class{constructor(e,n){this.version=e,this.transformResults=n}},Vn=class r{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new r}static exists(e){return new r(void 0,e)}static updateTime(e){return new r(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 jv(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}var Fh=class{};function UW(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new ou(r.key,Vn.none()):new tc(r.key,r.data,Vn.none());{let n=r.data,t=er.empty(),i=new ot(gn.comparator);for(let o of e.fields)if(!i.has(o)){let s=n.field(o);s===null&&o.length>1&&(o=o.popLast(),s=n.field(o)),s===null?t.delete(o):t.set(o,s),i=i.add(o)}return new Qi(r.key,t,new qr(i.toArray()),Vn.none())}}function Ooe(r,e,n){r instanceof tc?(function(i,o,s){let a=i.value.clone(),c=nH(i.fieldTransforms,o,s.transformResults);a.setAll(c),o.convertToFoundDocument(s.version,a).setHasCommittedMutations()})(r,e,n):r instanceof Qi?(function(i,o,s){if(!jv(i.precondition,o))return void o.convertToUnknownDocument(s.version);let a=nH(i.fieldTransforms,o,s.transformResults),c=o.data;c.setAll(VW(i)),c.setAll(a),o.convertToFoundDocument(s.version,c).setHasCommittedMutations()})(r,e,n):(function(i,o,s){o.convertToNoDocument(s.version).setHasCommittedMutations()})(0,e,n)}function Qm(r,e,n,t){return r instanceof tc?(function(o,s,a,c){if(!jv(o.precondition,s))return a;let l=o.value.clone(),u=rH(o.fieldTransforms,c,s);return l.setAll(u),s.convertToFoundDocument(s.version,l).setHasLocalMutations(),null})(r,e,n,t):r instanceof Qi?(function(o,s,a,c){if(!jv(o.precondition,s))return a;let l=rH(o.fieldTransforms,c,s),u=s.data;return u.setAll(VW(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))})(r,e,n,t):(function(o,s,a){return jv(o.precondition,s)?(s.convertToNoDocument(s.version).setHasLocalMutations(),null):a})(r,e,n)}function boe(r,e){let n=null;for(let t of r.fieldTransforms){let i=e.data.field(t.field),o=PW(t.transform,i||null);o!=null&&(n===null&&(n=er.empty()),n.set(t.field,o))}return n||null}function tH(r,e){return r.type===e.type&&!!r.key.isEqual(e.key)&&!!r.precondition.isEqual(e.precondition)&&!!(function(t,i){return t===void 0&&i===void 0||!(!t||!i)&&Sh(t,i,(o,s)=>Noe(o,s))})(r.fieldTransforms,e.fieldTransforms)&&(r.type===0?r.value.isEqual(e.value):r.type!==1||r.data.isEqual(e.data)&&r.fieldMask.isEqual(e.fieldMask))}var tc=class extends Fh{constructor(e,n,t,i=[]){super(),this.key=e,this.value=n,this.precondition=t,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},Qi=class extends Fh{constructor(e,n,t,i,o=[]){super(),this.key=e,this.data=n,this.fieldMask=t,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}};function VW(r){let e=new Map;return r.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){let t=r.data.field(n);e.set(n,t)}}),e}function nH(r,e,n){let t=new Map;fe(r.length===n.length,32656,{Ae:n.length,Re:r.length});for(let i=0;i<n.length;i++){let o=r[i],s=o.transform,a=e.data.field(o.field);t.set(o.field,Coe(s,a,n[i]))}return t}function rH(r,e,n){let t=new Map;for(let i of r){let o=i.transform,s=n.data.field(i.field);t.set(i.field,Doe(o,s,e))}return t}var ou=class extends Fh{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},up=class extends Fh{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var dp=class{constructor(e,n,t,i){this.batchId=e,this.localWriteTime=n,this.baseMutations=t,this.mutations=i}applyToRemoteDocument(e,n){let t=n.mutationResults;for(let i=0;i<this.mutations.length;i++){let o=this.mutations[i];o.key.isEqual(e.key)&&Ooe(o,e,t[i])}}applyToLocalView(e,n){for(let t of this.baseMutations)t.key.isEqual(e.key)&&(n=Qm(t,e,n,this.localWriteTime));for(let t of this.mutations)t.key.isEqual(e.key)&&(n=Qm(t,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){let t=LW();return this.mutations.forEach(i=>{let o=e.get(i.key),s=o.overlayedDocument,a=this.applyToLocalView(s,o.mutatedFields);a=n.has(i.key)?null:a;let c=UW(s,a);c!==null&&t.set(i.key,c),s.isValidDocument()||s.convertToNoDocument(Ee.min())}),t}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),ke())}isEqual(e){return this.batchId===e.batchId&&Sh(this.mutations,e.mutations,(n,t)=>tH(n,t))&&Sh(this.baseMutations,e.baseMutations,(n,t)=>tH(n,t))}},ww=class r{constructor(e,n,t,i){this.batch=e,this.commitVersion=n,this.mutationResults=t,this.docVersions=i}static from(e,n,t){fe(e.mutations.length===t.length,58842,{Ve:e.mutations.length,me:t.length});let i=(function(){return yoe})(),o=e.mutations;for(let s=0;s<o.length;s++)i=i.insert(o[s].key,t[s].version);return new r(e,n,t,i)}};var hp=class{constructor(e,n){this.largestBatchId=e,this.mutation=n}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 Lw=class{constructor(e,n,t){this.alias=e,this.aggregateType=n,this.fieldPath=t}};var Mw=class{constructor(e,n){this.count=e,this.unchangedNames=n}};var Zt,je;function BW(r){switch(r){case W.OK:return ae(64938);case W.CANCELLED:case W.UNKNOWN:case W.DEADLINE_EXCEEDED:case W.RESOURCE_EXHAUSTED:case W.INTERNAL:case W.UNAVAILABLE:case W.UNAUTHENTICATED:return!1;case W.INVALID_ARGUMENT:case W.NOT_FOUND:case W.ALREADY_EXISTS:case W.PERMISSION_DENIED:case W.FAILED_PRECONDITION:case W.ABORTED:case W.OUT_OF_RANGE:case W.UNIMPLEMENTED:case W.DATA_LOSS:return!0;default:return ae(15467,{code:r})}}function GW(r){if(r===void 0)return Wt("GRPC error has no .code"),W.UNKNOWN;switch(r){case Zt.OK:return W.OK;case Zt.CANCELLED:return W.CANCELLED;case Zt.UNKNOWN:return W.UNKNOWN;case Zt.DEADLINE_EXCEEDED:return W.DEADLINE_EXCEEDED;case Zt.RESOURCE_EXHAUSTED:return W.RESOURCE_EXHAUSTED;case Zt.INTERNAL:return W.INTERNAL;case Zt.UNAVAILABLE:return W.UNAVAILABLE;case Zt.UNAUTHENTICATED:return W.UNAUTHENTICATED;case Zt.INVALID_ARGUMENT:return W.INVALID_ARGUMENT;case Zt.NOT_FOUND:return W.NOT_FOUND;case Zt.ALREADY_EXISTS:return W.ALREADY_EXISTS;case Zt.PERMISSION_DENIED:return W.PERMISSION_DENIED;case Zt.FAILED_PRECONDITION:return W.FAILED_PRECONDITION;case Zt.ABORTED:return W.ABORTED;case Zt.OUT_OF_RANGE:return W.OUT_OF_RANGE;case Zt.UNIMPLEMENTED:return W.UNIMPLEMENTED;case Zt.DATA_LOSS:return W.DATA_LOSS;default:return ae(39323,{code:r})}}(je=Zt||(Zt={}))[je.OK=0]="OK",je[je.CANCELLED=1]="CANCELLED",je[je.UNKNOWN=2]="UNKNOWN",je[je.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",je[je.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",je[je.NOT_FOUND=5]="NOT_FOUND",je[je.ALREADY_EXISTS=6]="ALREADY_EXISTS",je[je.PERMISSION_DENIED=7]="PERMISSION_DENIED",je[je.UNAUTHENTICATED=16]="UNAUTHENTICATED",je[je.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",je[je.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",je[je.ABORTED=10]="ABORTED",je[je.OUT_OF_RANGE=11]="OUT_OF_RANGE",je[je.UNIMPLEMENTED=12]="UNIMPLEMENTED",je[je.INTERNAL=13]="INTERNAL",je[je.UNAVAILABLE=14]="UNAVAILABLE",je[je.DATA_LOSS=15]="DATA_LOSS";var iH=null;var woe=new Ls([4294967295,4294967295],0);function oH(r){let e=qH().encode(r),n=new Gb;return n.update(e),new Uint8Array(n.digest())}function sH(r){let e=new DataView(r.buffer),n=e.getUint32(0,!0),t=e.getUint32(4,!0),i=e.getUint32(8,!0),o=e.getUint32(12,!0);return[new Ls([n,t],0),new Ls([i,o],0)]}var Pw=class r{constructor(e,n,t){if(this.bitmap=e,this.padding=n,this.hashCount=t,n<0||n>=8)throw new Yl(`Invalid padding: ${n}`);if(t<0)throw new Yl(`Invalid hash count: ${t}`);if(e.length>0&&this.hashCount===0)throw new Yl(`Invalid hash count: ${t}`);if(e.length===0&&n!==0)throw new Yl(`Invalid padding when bitmap length is 0: ${n}`);this.fe=8*e.length-n,this.ge=Ls.fromNumber(this.fe)}pe(e,n,t){let i=e.add(n.multiply(Ls.fromNumber(t)));return i.compare(woe)===1&&(i=new Ls([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 n=oH(e),[t,i]=sH(n);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,n,t){let i=e%8==0?0:8-e%8,o=new Uint8Array(Math.ceil(e/8)),s=new r(o,i,n);return t.forEach(a=>s.insert(a)),s}insert(e){if(this.fe===0)return;let n=oH(e),[t,i]=sH(n);for(let o=0;o<this.hashCount;o++){let s=this.pe(t,i,o);this.we(s)}}we(e){let n=Math.floor(e/8),t=e%8;this.bitmap[n]|=1<<t}},Yl=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var fp=class r{constructor(e,n,t,i,o){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=t,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,n,t){let i=new Map;return i.set(e,gp.createSynthesizedTargetChangeForCurrentChange(e,n,t)),new r(Ee.min(),i,new St(De),Kr(),ke())}},gp=class r{constructor(e,n,t,i,o){this.resumeToken=e,this.current=n,this.addedDocuments=t,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(e,n,t){return new r(t,n,ke(),ke(),ke())}};var vh=class{constructor(e,n,t,i){this.Se=e,this.removedTargetIds=n,this.key=t,this.be=i}},ay=class{constructor(e,n){this.targetId=e,this.De=n}},cy=class{constructor(e,n,t=rn.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=n,this.resumeToken=t,this.cause=i}},ly=class{constructor(){this.ve=0,this.Ce=aH(),this.Fe=rn.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=ke(),n=ke(),t=ke();return this.Ce.forEach((i,o)=>{switch(o){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:t=t.add(i);break;default:ae(38017,{changeType:o})}}),new gp(this.Fe,this.Me,e,n,t)}ke(){this.xe=!1,this.Ce=aH()}qe(e,n){this.xe=!0,this.Ce=this.Ce.insert(e,n)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,fe(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}},xw=class{constructor(e){this.We=e,this.Ge=new Map,this.ze=Kr(),this.je=Mv(),this.Je=Mv(),this.He=new St(De)}Ye(e){for(let n of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(n,e.be):this.Xe(n,e.key,e.be);for(let n of e.removedTargetIds)this.Xe(n,e.key,e.be)}et(e){this.forEachTarget(e,n=>{let t=this.tt(n);switch(e.state){case 0:this.nt(n)&&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(n);break;case 3:this.nt(n)&&(t.Ke(),t.Be(e.resumeToken));break;case 4:this.nt(n)&&(this.rt(n),t.Be(e.resumeToken));break;default:ae(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.Ge.forEach((t,i)=>{this.nt(i)&&n(i)})}it(e){let n=e.targetId,t=e.De.count,i=this.st(n);if(i){let o=i.target;if(iy(o))if(t===0){let s=new se(o.path);this.Xe(n,s,mn.newNoDocument(s,Ee.min()))}else fe(t===1,20013,{expectedCount:t});else{let s=this.ot(n);if(s!==t){let a=this._t(e),c=a?this.ut(a,e,s):1;if(c!==0){this.rt(n);let l=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(n,l)}iH?.ct((function(u,d,f,g,p){var _,T,D,L,B,w;let F={localCacheCount:u,existenceFilterCount:d.count,databaseId:f.database,projectId:f.projectId},U=d.unchangedNames;return U&&(F.bloomFilter={applied:p===0,hashCount:(_=U?.hashCount)!==null&&_!==void 0?_:0,bitmapLength:(L=(D=(T=U?.bits)===null||T===void 0?void 0:T.bitmap)===null||D===void 0?void 0:D.length)!==null&&L!==void 0?L:0,padding:(w=(B=U?.bits)===null||B===void 0?void 0:B.padding)!==null&&w!==void 0?w:0,mightContain:A=>{var R;return(R=g?.mightContain(A))!==null&&R!==void 0&&R}}),F})(s,e.De,this.We.lt(),a,c))}}}}_t(e){let n=e.De.unchangedNames;if(!n||!n.bits)return null;let{bits:{bitmap:t="",padding:i=0},hashCount:o=0}=n,s,a;try{s=Vs(t).toUint8Array()}catch(c){if(c instanceof ty)return ks("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 Pw(s,i,o)}catch(c){return ks(c instanceof Yl?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.fe===0?null:a}ut(e,n,t){return n.De.count===t-this.ht(e,n.targetId)?0:2}ht(e,n){let t=this.We.getRemoteKeysForTarget(n),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(n,o,null),i++)}),i}Pt(e){let n=new Map;this.Ge.forEach((o,s)=>{let a=this.st(s);if(a){if(o.current&&iy(a.target)){let c=new se(a.target.path);this.Tt(c).has(s)||this.It(s,c)||this.Xe(s,c,mn.newNoDocument(c,e))}o.Ne&&(n.set(s,o.Le()),o.ke())}});let t=ke();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 fp(e,n,this.He,this.ze,t);return this.ze=Kr(),this.je=Mv(),this.Je=Mv(),this.He=new St(De),i}Ze(e,n){if(!this.nt(e))return;let t=this.It(e,n.key)?2:0;this.tt(e).qe(n.key,t),this.ze=this.ze.insert(n.key,n),this.je=this.je.insert(n.key,this.Tt(n.key).add(e)),this.Je=this.Je.insert(n.key,this.dt(n.key).add(e))}Xe(e,n,t){if(!this.nt(e))return;let i=this.tt(e);this.It(e,n)?i.qe(n,1):i.Qe(n),this.Je=this.Je.insert(n,this.dt(n).delete(e)),this.Je=this.Je.insert(n,this.dt(n).add(e)),t&&(this.ze=this.ze.insert(n,t))}removeTarget(e){this.Ge.delete(e)}ot(e){let n=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let n=this.Ge.get(e);return n||(n=new ly,this.Ge.set(e,n)),n}dt(e){let n=this.Je.get(e);return n||(n=new ot(De),this.Je=this.Je.insert(e,n)),n}Tt(e){let n=this.je.get(e);return n||(n=new ot(De),this.je=this.je.insert(e,n)),n}nt(e){let n=this.st(e)!==null;return n||X("WatchChangeAggregator","Detected inactive target",e),n}st(e){let n=this.Ge.get(e);return n&&n.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new ly),this.We.getRemoteKeysForTarget(e).forEach(n=>{this.Xe(e,n,null)})}It(e,n){return this.We.getRemoteKeysForTarget(e).has(n)}};function Mv(){return new St(se.comparator)}function aH(){return new St(se.comparator)}var Loe={asc:"ASCENDING",desc:"DESCENDING"},Moe={"<":"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"},Poe={and:"AND",or:"OR"},Fw=class{constructor(e,n){this.databaseId=e,this.useProto3Json=n}};function kw(r,e){return r.useProto3Json||Np(e)?e:{value:e}}function kh(r,e){return r.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function $W(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function xoe(r,e){return kh(r,e.toTimestamp())}function Nn(r){return fe(!!r,49232),Ee.fromTimestamp((function(n){let t=Us(n);return new wt(t.seconds,t.nanos)})(r))}function yM(r,e){return Uw(r,e).canonicalString()}function Uw(r,e){let n=(function(i){return new He(["projects",i.projectId,"databases",i.database])})(r).child("documents");return e===void 0?n:n.child(e)}function jW(r){let e=He.fromString(r);return fe(XW(e),10190,{key:e.toString()}),e}function mp(r,e){return yM(r.databaseId,e.path)}function xs(r,e){let n=jW(e);if(n.get(1)!==r.databaseId.projectId)throw new Q(W.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+r.databaseId.projectId);if(n.get(3)!==r.databaseId.database)throw new Q(W.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+r.databaseId.database);return new se(zW(n))}function HW(r,e){return yM(r.databaseId,e)}function WW(r){let e=jW(r);return e.length===4?He.emptyPath():zW(e)}function Vw(r){return new He(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function zW(r){return fe(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function cH(r,e,n){return{name:mp(r,e),fields:n.value.mapValue.fields}}function Foe(r,e,n){let t=xs(r,e.name),i=Nn(e.updateTime),o=e.createTime?Nn(e.createTime):Ee.min(),s=new er({mapValue:{fields:e.fields}}),a=mn.newFoundDocument(t,i,o,s);return n&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}function koe(r,e){return"found"in e?(function(t,i){fe(!!i.found,43571),i.found.name,i.found.updateTime;let o=xs(t,i.found.name),s=Nn(i.found.updateTime),a=i.found.createTime?Nn(i.found.createTime):Ee.min(),c=new er({mapValue:{fields:i.found.fields}});return mn.newFoundDocument(o,s,a,c)})(r,e):"missing"in e?(function(t,i){fe(!!i.missing,3894),fe(!!i.readTime,22933);let o=xs(t,i.missing),s=Nn(i.readTime);return mn.newNoDocument(o,s)})(r,e):ae(7234,{result:e})}function Uoe(r,e){let n;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?(fe(u===void 0||typeof u=="string",58123),rn.fromBase64String(u||"")):(fe(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),rn.fromUint8Array(u||new Uint8Array))})(r,e.targetChange.resumeToken),s=e.targetChange.cause,a=s&&(function(l){let u=l.code===void 0?W.UNKNOWN:GW(l.code);return new Q(u,l.message||"")})(s);n=new cy(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=xs(r,t.document.name),o=Nn(t.document.updateTime),s=t.document.createTime?Nn(t.document.createTime):Ee.min(),a=new er({mapValue:{fields:t.document.fields}}),c=mn.newFoundDocument(i,o,s,a),l=t.targetIds||[],u=t.removedTargetIds||[];n=new vh(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;let t=e.documentDelete;t.document;let i=xs(r,t.document),o=t.readTime?Nn(t.readTime):Ee.min(),s=mn.newNoDocument(i,o),a=t.removedTargetIds||[];n=new vh([],a,s.key,s)}else if("documentRemove"in e){e.documentRemove;let t=e.documentRemove;t.document;let i=xs(r,t.document),o=t.removedTargetIds||[];n=new vh([],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 Mw(i,o),a=t.targetId;n=new ay(a,s)}}return n}function pp(r,e){let n;if(e instanceof tc)n={update:cH(r,e.key,e.value)};else if(e instanceof ou)n={delete:mp(r,e.key)};else if(e instanceof Qi)n={update:cH(r,e.key,e.data),updateMask:Woe(e.fieldMask)};else{if(!(e instanceof up))return ae(16599,{Rt:e.type});n={verify:mp(r,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(t=>(function(o,s){let a=s.transform;if(a instanceof ru)return{fieldPath:s.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Za)return{fieldPath:s.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof ec)return{fieldPath:s.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof iu)return{fieldPath:s.field.canonicalString(),increment:a.Ee};throw ae(20930,{transform:s.transform})})(0,t))),e.precondition.isNone||(n.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:xoe(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:ae(27497)})(r,e.precondition)),n}function Bw(r,e){let n=e.currentDocument?(function(o){return o.updateTime!==void 0?Vn.updateTime(Nn(o.updateTime)):o.exists!==void 0?Vn.exists(o.exists):Vn.none()})(e.currentDocument):Vn.none(),t=e.updateTransforms?e.updateTransforms.map(i=>(function(s,a){let c=null;if("setToServerValue"in a)fe(a.setToServerValue==="REQUEST_TIME",16630,{proto:a}),c=new ru;else if("appendMissingElements"in a){let u=a.appendMissingElements.values||[];c=new Za(u)}else if("removeAllFromArray"in a){let u=a.removeAllFromArray.values||[];c=new ec(u)}else"increment"in a?c=new iu(s,a.increment):ae(16584,{proto:a});let l=gn.fromServerFormat(a.fieldPath);return new Ow(l,c)})(r,i)):[];if(e.update){e.update.name;let i=xs(r,e.update.name),o=new er({mapValue:{fields:e.update.fields}});if(e.updateMask){let s=(function(c){let l=c.fieldPaths||[];return new qr(l.map(u=>gn.fromServerFormat(u)))})(e.updateMask);return new Qi(i,o,s,n,t)}return new tc(i,o,n,t)}if(e.delete){let i=xs(r,e.delete);return new ou(i,n)}if(e.verify){let i=xs(r,e.verify);return new up(i,n)}return ae(1463,{proto:e})}function Voe(r,e){return r&&r.length>0?(fe(e!==void 0,14353),r.map(n=>(function(i,o){let s=i.updateTime?Nn(i.updateTime):Nn(o);return s.isEqual(Ee.min())&&(s=Nn(o)),new bw(s,i.transformResults||[])})(n,e))):[]}function qW(r,e){return{documents:[HW(r,e.path)]}}function SM(r,e){let n={structuredQuery:{}},t=e.path,i;e.collectionGroup!==null?(i=t,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=t.popLast(),n.structuredQuery.from=[{collectionId:t.lastSegment()}]),n.parent=HW(r,i);let o=(function(l){if(l.length!==0)return QW(tt.create(l,"and"))})(e.filters);o&&(n.structuredQuery.where=o);let s=(function(l){if(l.length!==0)return l.map(u=>(function(f){return{field:$a(f.field),direction:$oe(f.dir)}})(u))})(e.orderBy);s&&(n.structuredQuery.orderBy=s);let a=kw(r,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=(function(l){return{before:l.inclusive,values:l.position}})(e.startAt)),e.endAt&&(n.structuredQuery.endAt=(function(l){return{before:!l.inclusive,values:l.position}})(e.endAt)),{Vt:n,parent:i}}function Boe(r,e,n,t){let{Vt:i,parent:o}=SM(r,e),s={},a=[],c=0;return n.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:$a(l.fieldPath)}}):l.aggregateType==="sum"&&a.push({alias:u,sum:{field:$a(l.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:a,structuredQuery:i.structuredQuery},parent:i.parent},ft:s,parent:o}}function KW(r){let e=WW(r.parent),n=r.structuredQuery,t=n.from?n.from.length:0,i=null;if(t>0){fe(t===1,65062);let u=n.from[0];u.allDescendants?i=u.collectionId:e=e.child(u.collectionId)}let o=[];n.where&&(o=(function(d){let f=YW(d);return f instanceof tt&&_M(f)?f.getFilters():[f]})(n.where));let s=[];n.orderBy&&(s=(function(d){return d.map(f=>(function(p){return new tu(ph(p.field),(function(T){switch(T){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(p.direction))})(f))})(n.orderBy));let a=null;n.limit&&(a=(function(d){let f;return f=typeof d=="object"?d.value:d,Np(f)?null:f})(n.limit));let c=null;n.startAt&&(c=(function(d){let f=!!d.before,g=d.values||[];return new Wo(g,f)})(n.startAt));let l=null;return n.endAt&&(l=(function(d){let f=!d.before,g=d.values||[];return new Wo(g,f)})(n.endAt)),RW(e,i,s,o,a,"F",c,l)}function Goe(r,e){let n=(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 n==null?null:{"goog-listen-tags":n}}function YW(r){return r.unaryFilter!==void 0?(function(n){switch(n.unaryFilter.op){case"IS_NAN":let t=ph(n.unaryFilter.field);return Ge.create(t,"==",{doubleValue:NaN});case"IS_NULL":let i=ph(n.unaryFilter.field);return Ge.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let o=ph(n.unaryFilter.field);return Ge.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let s=ph(n.unaryFilter.field);return Ge.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ae(61313);default:return ae(60726)}})(r):r.fieldFilter!==void 0?(function(n){return Ge.create(ph(n.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)}})(n.fieldFilter.op),n.fieldFilter.value)})(r):r.compositeFilter!==void 0?(function(n){return tt.create(n.compositeFilter.filters.map(t=>YW(t)),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return ae(1026)}})(n.compositeFilter.op))})(r):ae(30097,{filter:r})}function $oe(r){return Loe[r]}function joe(r){return Moe[r]}function Hoe(r){return Poe[r]}function $a(r){return{fieldPath:r.canonicalString()}}function ph(r){return gn.fromServerFormat(r.fieldPath)}function QW(r){return r instanceof Ge?(function(n){if(n.op==="=="){if(zj(n.value))return{unaryFilter:{field:$a(n.field),op:"IS_NAN"}};if(Wj(n.value))return{unaryFilter:{field:$a(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(zj(n.value))return{unaryFilter:{field:$a(n.field),op:"IS_NOT_NAN"}};if(Wj(n.value))return{unaryFilter:{field:$a(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$a(n.field),op:joe(n.op),value:n.value}}})(r):r instanceof tt?(function(n){let t=n.getFilters().map(i=>QW(i));return t.length===1?t[0]:{compositeFilter:{op:Hoe(n.op),filters:t}}})(r):ae(54877,{filter:r})}function Woe(r){let e=[];return r.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function XW(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}var Uh=class r{constructor(e,n,t,i,o=Ee.min(),s=Ee.min(),a=rn.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=n,this.purpose=t,this.sequenceNumber=i,this.snapshotVersion=o,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new r(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var uy=class{constructor(e){this.gt=e}};function zoe(r,e){let n;if(e.document)n=Foe(r.gt,e.document,!!e.hasCommittedMutations);else if(e.noDocument){let t=se.fromSegments(e.noDocument.path),i=au(e.noDocument.readTime);n=mn.newNoDocument(t,i),e.hasCommittedMutations&&n.setHasCommittedMutations()}else{if(!e.unknownDocument)return ae(56709);{let t=se.fromSegments(e.unknownDocument.path),i=au(e.unknownDocument.version);n=mn.newUnknownDocument(t,i)}}return e.readTime&&n.setReadTime((function(i){let o=new wt(i[0],i[1]);return Ee.fromTimestamp(o)})(e.readTime)),n}function lH(r,e){let n=e.key,t={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:dy(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())t.document=(function(o,s){return{name:mp(o,s.key),fields:s.data.value.mapValue.fields,updateTime:kh(o,s.version.toTimestamp()),createTime:kh(o,s.createTime.toTimestamp())}})(r.gt,e);else if(e.isNoDocument())t.noDocument={path:n.path.toArray(),readTime:su(e.version)};else{if(!e.isUnknownDocument())return ae(57904,{document:e});t.unknownDocument={path:n.path.toArray(),version:su(e.version)}}return t}function dy(r){let e=r.toTimestamp();return[e.seconds,e.nanoseconds]}function su(r){let e=r.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function au(r){let e=new wt(r.seconds,r.nanoseconds);return Ee.fromTimestamp(e)}function Wl(r,e){let n=(e.baseMutations||[]).map(o=>Bw(r.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=>Bw(r.gt,o)),i=wt.fromMillis(e.localWriteTimeMs);return new dp(e.batchId,i,n,t)}function jm(r){let e=au(r.readTime),n=r.lastLimboFreeSnapshotVersion!==void 0?au(r.lastLimboFreeSnapshotVersion):Ee.min(),t;return t=(function(o){return o.documents!==void 0})(r.query)?(function(o){let s=o.documents.length;return fe(s===1,1966,{count:s}),Yr(wp(WW(o.documents[0])))})(r.query):(function(o){return Yr(KW(o))})(r.query),new Uh(t,r.targetId,"TargetPurposeListen",r.lastListenSequenceNumber,e,n,rn.fromBase64String(r.resumeToken))}function JW(r,e){let n=su(e.snapshotVersion),t=su(e.lastLimboFreeSnapshotVersion),i;i=iy(e.target)?qW(r.gt,e.target):SM(r.gt,e.target).Vt;let o=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:nu(e.target),readTime:n,resumeToken:o,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:t,query:i}}function ZW(r){let e=KW({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?sy(e,e.limit,"L"):e}function qb(r,e){return new hp(e.largestBatchId,Bw(r.gt,e.overlayMutation))}function uH(r,e){let n=e.path.lastSegment();return[r,tr(e.path.popLast()),n]}function dH(r,e,n,t){return{indexId:r,uid:e,sequenceNumber:n,readTime:su(t.readTime),documentKey:tr(t.documentKey.path),largestBatchId:t.largestBatchId}}var Gw=class{getBundleMetadata(e,n){return hH(e).get(n).next(t=>{if(t)return(function(o){return{id:o.bundleId,createTime:au(o.createTime),version:o.version}})(t)})}saveBundleMetadata(e,n){return hH(e).put((function(i){return{bundleId:i.id,createTime:su(Nn(i.createTime)),version:i.version}})(n))}getNamedQuery(e,n){return fH(e).get(n).next(t=>{if(t)return(function(o){return{name:o.name,query:ZW(o.bundledQuery),readTime:au(o.readTime)}})(t)})}saveNamedQuery(e,n){return fH(e).put((function(i){return{name:i.name,readTime:su(Nn(i.readTime)),bundledQuery:i.bundledQuery}})(n))}};function hH(r){return En(r,jy)}function fH(r){return En(r,Hy)}var hy=class r{constructor(e,n){this.serializer=e,this.userId=n}static yt(e,n){let t=n.uid||"";return new r(e,t)}getOverlay(e,n){return Um(e).get(uH(this.userId,n)).next(t=>t?qb(this.serializer,t):null)}getOverlays(e,n){let t=$o();return $.forEach(n,i=>this.getOverlay(e,i).next(o=>{o!==null&&t.set(i,o)})).next(()=>t)}saveOverlays(e,n,t){let i=[];return t.forEach((o,s)=>{let a=new hp(n,s);i.push(this.wt(e,a))}),$.waitFor(i)}removeOverlaysForBatchId(e,n,t){let i=new Set;n.forEach(s=>i.add(tr(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(Um(e).Y(gw,a))}),$.waitFor(o)}getOverlaysForCollection(e,n,t){let i=$o(),o=tr(n),s=IDBKeyRange.bound([this.userId,o,t],[this.userId,o,Number.POSITIVE_INFINITY],!0);return Um(e).j(gw,s).next(a=>{for(let c of a){let l=qb(this.serializer,c);i.set(l.getKey(),l)}return i})}getOverlaysForCollectionGroup(e,n,t,i){let o=$o(),s,a=IDBKeyRange.bound([this.userId,n,t],[this.userId,n,Number.POSITIVE_INFINITY],!0);return Um(e).X({index:sW,range:a},(c,l,u)=>{let d=qb(this.serializer,l);o.size()<i||d.largestBatchId===s?(o.set(d.getKey(),d),s=d.largestBatchId):u.done()}).next(()=>o)}wt(e,n){return Um(e).put((function(i,o,s){let[a,c,l]=uH(o,s.mutation.key);return{userId:o,collectionPath:c,documentId:l,collectionGroup:s.mutation.key.getCollectionGroup(),largestBatchId:s.largestBatchId,overlayMutation:pp(i.gt,s.mutation)}})(this.serializer,this.userId,n))}};function Um(r){return En(r,Wy)}var $w=class{St(e){return En(e,gM)}getSessionToken(e){return this.St(e).get("sessionToken").next(n=>{let t=n?.value;return t?rn.fromUint8Array(t):rn.EMPTY_BYTE_STRING})}setSessionToken(e,n){return this.St(e).put({name:"sessionToken",value:n.toUint8Array()})}};var Ps=class{constructor(){}bt(e,n){this.Dt(e,n),n.vt()}Dt(e,n){if("nullValue"in e)this.Ct(n,5);else if("booleanValue"in e)this.Ct(n,10),n.Ft(e.booleanValue?1:0);else if("integerValue"in e)this.Ct(n,15),n.Ft(bt(e.integerValue));else if("doubleValue"in e){let t=bt(e.doubleValue);isNaN(t)?this.Ct(n,13):(this.Ct(n,15),tp(t)?n.Ft(0):n.Ft(t))}else if("timestampValue"in e){let t=e.timestampValue;this.Ct(n,20),typeof t=="string"&&(t=Us(t)),n.Mt(`${t.seconds||""}`),n.Ft(t.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,n),this.Ot(n);else if("bytesValue"in e)this.Ct(n,30),n.Nt(Vs(e.bytesValue)),this.Ot(n);else if("referenceValue"in e)this.Bt(e.referenceValue,n);else if("geoPointValue"in e){let t=e.geoPointValue;this.Ct(n,45),n.Ft(t.latitude||0),n.Ft(t.longitude||0)}else"mapValue"in e?EW(e)?this.Ct(n,Number.MAX_SAFE_INTEGER):Ky(e)?this.Lt(e.mapValue,n):(this.kt(e.mapValue,n),this.Ot(n)):"arrayValue"in e?(this.qt(e.arrayValue,n),this.Ot(n)):ae(19022,{Qt:e})}xt(e,n){this.Ct(n,25),this.$t(e,n)}$t(e,n){n.Mt(e)}kt(e,n){let t=e.fields||{};this.Ct(n,55);for(let i of Object.keys(t))this.xt(i,n),this.Dt(t[i],n)}Lt(e,n){var t,i;let o=e.fields||{};this.Ct(n,53);let s=Lh,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(n,15),n.Ft(bt(a)),this.xt(s,n),this.Dt(o[s],n)}qt(e,n){let t=e.values||[];this.Ct(n,50);for(let i of t)this.Dt(i,n)}Bt(e,n){this.Ct(n,37),se.fromName(e).path.forEach(t=>{this.Ct(n,60),this.$t(t,n)})}Ct(e,n){e.Ft(n)}Ot(e){e.Ft(2)}};Ps.Ut=new Ps;var uh=255;function qoe(r){if(r===0)return 8;let e=0;return r>>4||(e+=4,r<<=4),r>>6||(e+=2,r<<=2),r>>7||(e+=1),e}function gH(r){let e=64-(function(t){let i=0;for(let o=0;o<8;++o){let s=qoe(255&t[o]);if(i+=s,s!==8)break}return i})(r);return Math.ceil(e/8)}var jw=class{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Kt(e){let n=e[Symbol.iterator](),t=n.next();for(;!t.done;)this.Wt(t.value),t=n.next();this.Gt()}zt(e){let n=e[Symbol.iterator](),t=n.next();for(;!t.done;)this.jt(t.value),t=n.next();this.Jt()}Ht(e){for(let n of e){let t=n.charCodeAt(0);if(t<128)this.Wt(t);else if(t<2048)this.Wt(960|t>>>6),this.Wt(128|63&t);else if(n<"\uD800"||"\uDBFF"<n)this.Wt(480|t>>>12),this.Wt(128|63&t>>>6),this.Wt(128|63&t);else{let i=n.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 n of e){let t=n.charCodeAt(0);if(t<128)this.jt(t);else if(t<2048)this.jt(960|t>>>6),this.jt(128|63&t);else if(n<"\uD800"||"\uDBFF"<n)this.jt(480|t>>>12),this.jt(128|63&t>>>6),this.jt(128|63&t);else{let i=n.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 n=this.Xt(e),t=gH(n);this.en(1+t),this.buffer[this.position++]=255&t;for(let i=n.length-t;i<n.length;++i)this.buffer[this.position++]=255&n[i]}tn(e){let n=this.Xt(e),t=gH(n);this.en(1+t),this.buffer[this.position++]=~(255&t);for(let i=n.length-t;i<n.length;++i)this.buffer[this.position++]=~(255&n[i])}nn(){this.rn(uh),this.rn(255)}sn(){this._n(uh),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 n=(function(o){let s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,o,!1),new Uint8Array(s.buffer)})(e),t=!!(128&n[0]);n[0]^=t?255:128;for(let i=1;i<n.length;++i)n[i]^=t?255:0;return n}Wt(e){let n=255&e;n===0?(this.rn(0),this.rn(255)):n===uh?(this.rn(uh),this.rn(0)):this.rn(n)}jt(e){let n=255&e;n===0?(this._n(0),this._n(255)):n===uh?(this._n(uh),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 n=e+this.position;if(n<=this.buffer.length)return;let t=2*this.buffer.length;t<n&&(t=n);let i=new Uint8Array(t);i.set(this.buffer),this.buffer=i}},Hw=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()}},Ww=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()}},zl=class{constructor(){this.un=new jw,this.cn=new Hw(this.un),this.ln=new Ww(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 ql=class r{constructor(e,n,t,i){this.Pn=e,this.Tn=n,this.In=t,this.dn=i}En(){let e=this.dn.length,n=e===0||this.dn[e-1]===255?e+1:e,t=new Uint8Array(n);return t.set(this.dn,0),n!==e?t.set([0],this.dn.length):++t[t.length-1],new r(this.Pn,this.Tn,this.In,t)}An(e,n,t){return{indexId:this.Pn,uid:e,arrayValue:Hv(this.In),directionalValue:Hv(this.dn),orderedDocumentKey:Hv(n),documentKey:t.path.toArray()}}Rn(e,n,t){let i=this.An(e,n,t);return[i.indexId,i.uid,i.arrayValue,i.directionalValue,i.orderedDocumentKey,i.documentKey]}};function Va(r,e){let n=r.Pn-e.Pn;return n!==0?n:(n=mH(r.In,e.In),n!==0?n:(n=mH(r.dn,e.dn),n!==0?n:se.comparator(r.Tn,e.Tn)))}function mH(r,e){for(let n=0;n<r.length&&n<e.length;++n){let t=r[n]-e[n];if(t!==0)return t}return r.length-e.length}function Hv(r){return tN()?(function(n){let t="";for(let i=0;i<n.length;i++)t+=String.fromCharCode(n[i]);return t})(r):r}function pH(r){return typeof r!="string"?r:(function(n){let t=new Uint8Array(n.length);for(let i=0;i<n.length;i++)t[i]=n.charCodeAt(i);return t})(r)}var fy=class{constructor(e){this.Vn=new ot((n,t)=>gn.comparator(n.field,t.field)),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.mn=e.orderBy,this.fn=[];for(let n of e.filters){let t=n;t.isInequality()?this.Vn=this.Vn.add(t):this.fn.push(t)}}get gn(){return this.Vn.size>1}pn(e){if(fe(e.collectionGroup===this.collectionId,49279),this.gn)return!1;let n=aw(e);if(n!==void 0&&!this.yn(n))return!1;let t=$l(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 ot(gn.comparator),n=[];for(let t of this.fn)if(!t.field.isKeyField())if(t.op==="array-contains"||t.op==="array-contains-any")n.push(new Th(t.field,2));else{if(e.has(t.field))continue;e=e.add(t.field),n.push(new Th(t.field,0))}for(let t of this.mn)t.field.isKeyField()||e.has(t.field)||(e=e.add(t.field),n.push(new Th(t.field,t.dir==="asc"?0:1)));return new Rh(Rh.UNKNOWN_ID,this.collectionId,n,ep.empty())}yn(e){for(let n of this.fn)if(this.wn(n,e))return!0;return!1}wn(e,n){if(e===void 0||!e.field.isEqual(n.fieldPath))return!1;let t=e.op==="array-contains"||e.op==="array-contains-any";return n.kind===2===t}Sn(e,n){return!!e.field.isEqual(n.fieldPath)&&(n.kind===0&&e.dir==="asc"||n.kind===1&&e.dir==="desc")}};function e3(r){var e,n;if(fe(r instanceof Ge||r instanceof tt,20012),r instanceof Ge){if(r instanceof ry){let i=((n=(e=r.value.arrayValue)===null||e===void 0?void 0:e.values)===null||n===void 0?void 0:n.map(o=>Ge.create(r.field,"==",o)))||[];return tt.create(i,"or")}return r}let t=r.filters.map(i=>e3(i));return tt.create(t,r.op)}function Koe(r){if(r.getFilters().length===0)return[];let e=Kw(e3(r));return fe(t3(e),7391),zw(e)||qw(e)?[e]:e.getFilters()}function zw(r){return r instanceof Ge}function qw(r){return r instanceof tt&&_M(r)}function t3(r){return zw(r)||qw(r)||(function(n){if(n instanceof tt&&_w(n)){for(let t of n.getFilters())if(!zw(t)&&!qw(t))return!1;return!0}return!1})(r)}function Kw(r){if(fe(r instanceof Ge||r instanceof tt,34018),r instanceof Ge)return r;if(r.filters.length===1)return Kw(r.filters[0]);let e=r.filters.map(t=>Kw(t)),n=tt.create(e,r.op);return n=gy(n),t3(n)?n:(fe(n instanceof tt,64498),fe(Ph(n),40251),fe(n.filters.length>1,57927),n.filters.reduce((t,i)=>AM(t,i)))}function AM(r,e){let n;return fe(r instanceof Ge||r instanceof tt,38388),fe(e instanceof Ge||e instanceof tt,25473),n=r instanceof Ge?e instanceof Ge?(function(i,o){return tt.create([i,o],"and")})(r,e):EH(r,e):e instanceof Ge?EH(e,r):(function(i,o){if(fe(i.filters.length>0&&o.filters.length>0,48005),Ph(i)&&Ph(o))return yW(i,o.getFilters());let s=_w(i)?i:o,a=_w(i)?o:i,c=s.filters.map(l=>AM(l,a));return tt.create(c,"or")})(r,e),gy(n)}function EH(r,e){if(Ph(e))return yW(e,r.getFilters());{let n=e.filters.map(t=>AM(r,t));return tt.create(n,"or")}}function gy(r){if(fe(r instanceof Ge||r instanceof tt,11850),r instanceof Ge)return r;let e=r.getFilters();if(e.length===1)return gy(e[0]);if(IW(r))return r;let n=e.map(i=>gy(i)),t=[];return n.forEach(i=>{i instanceof Ge?t.push(i):i instanceof tt&&(i.op===r.op?t.push(...i.filters):t.push(i))}),t.length===1?t[0]:tt.create(t,r.op)}var Yw=class{constructor(){this.Dn=new Ep}addToCollectionParentIndex(e,n){return this.Dn.add(n),$.resolve()}getCollectionParents(e,n){return $.resolve(this.Dn.getEntries(n))}addFieldIndex(e,n){return $.resolve()}deleteFieldIndex(e,n){return $.resolve()}deleteAllFieldIndexes(e){return $.resolve()}createTargetIndexes(e,n){return $.resolve()}getDocumentsMatchingTarget(e,n){return $.resolve(null)}getIndexType(e,n){return $.resolve(0)}getFieldIndexes(e,n){return $.resolve([])}getNextCollectionGroupToUpdate(e){return $.resolve(null)}getMinOffset(e,n){return $.resolve(Ii.min())}getMinOffsetFromCollectionGroup(e,n){return $.resolve(Ii.min())}updateCollectionGroup(e,n,t){return $.resolve()}updateIndexEntries(e,n){return $.resolve()}},Ep=class{constructor(){this.index={}}add(e){let n=e.lastSegment(),t=e.popLast(),i=this.index[n]||new ot(He.comparator),o=!i.has(t);return this.index[n]=i.add(t),o}has(e){let n=e.lastSegment(),t=e.popLast(),i=this.index[n];return i&&i.has(t)}getEntries(e){return(this.index[e]||new ot(He.comparator)).toArray()}};var _H="IndexedDbIndexManager",Pv=new Uint8Array(0),Qw=class{constructor(e,n){this.databaseId=n,this.vn=new Ep,this.Cn=new Yi(t=>nu(t),(t,i)=>bp(t,i)),this.uid=e.uid||""}addToCollectionParentIndex(e,n){if(!this.vn.has(n)){let t=n.lastSegment(),i=n.popLast();e.addOnCommittedListener(()=>{this.vn.add(n)});let o={collectionId:t,parent:tr(i)};return TH(e).put(o)}return $.resolve()}getCollectionParents(e,n){let t=[],i=IDBKeyRange.bound([n,""],[KH(n),""],!1,!0);return TH(e).j(i).next(o=>{for(let s of o){if(s.collectionId!==n)break;t.push(Go(s.parent))}return t})}addFieldIndex(e,n){let t=Vm(e),i=(function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map(c=>[c.fieldPath.canonicalString(),c.kind])}})(n);delete i.indexId;let o=t.add(i);if(n.indexState){let s=hh(e);return o.next(a=>{s.put(dH(a,this.uid,n.indexState.sequenceNumber,n.indexState.offset))})}return o.next()}deleteFieldIndex(e,n){let t=Vm(e),i=hh(e),o=dh(e);return t.delete(n.indexId).next(()=>i.delete(IDBKeyRange.bound([n.indexId],[n.indexId+1],!1,!0))).next(()=>o.delete(IDBKeyRange.bound([n.indexId],[n.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){let n=Vm(e),t=dh(e),i=hh(e);return n.Y().next(()=>t.Y()).next(()=>i.Y())}createTargetIndexes(e,n){return $.forEach(this.Fn(n),t=>this.getIndexType(e,t).next(i=>{if(i===0||i===1){let o=new fy(t).bn();if(o!=null)return this.addFieldIndex(e,o)}}))}getDocumentsMatchingTarget(e,n){let t=dh(e),i=!0,o=new Map;return $.forEach(this.Fn(n),s=>this.Mn(e,s).next(a=>{i&&(i=!!a),o.set(s,a)})).next(()=>{if(i){let s=ke(),a=[];return $.forEach(o,(c,l)=>{X(_H,`Using index ${(function(B){return`id=${B.indexId}|cg=${B.collectionGroup}|f=${B.fields.map(w=>`${w.fieldPath}:${w.kind}`).join(",")}`})(c)} to execute ${nu(n)}`);let u=(function(B,w){let F=aw(w);if(F===void 0)return null;for(let U of oy(B,F.fieldPath))switch(U.op){case"array-contains-any":return U.value.arrayValue.values||[];case"array-contains":return[U.value]}return null})(l,c),d=(function(B,w){let F=new Map;for(let U of $l(w))for(let A of oy(B,U.fieldPath))switch(A.op){case"==":case"in":F.set(U.fieldPath.canonicalString(),A.value);break;case"not-in":case"!=":return F.set(U.fieldPath.canonicalString(),A.value),Array.from(F.values())}return null})(l,c),f=(function(B,w){let F=[],U=!0;for(let A of $l(w)){let R=A.kind===0?Xj(B,A.fieldPath,B.startAt):Jj(B,A.fieldPath,B.startAt);F.push(R.value),U&&(U=R.inclusive)}return new Wo(F,U)})(l,c),g=(function(B,w){let F=[],U=!0;for(let A of $l(w)){let R=A.kind===0?Jj(B,A.fieldPath,B.endAt):Xj(B,A.fieldPath,B.endAt);F.push(R.value),U&&(U=R.inclusive)}return new Wo(F,U)})(l,c),p=this.xn(c,l,f),_=this.xn(c,l,g),T=this.On(c,l,d),D=this.Nn(c.indexId,u,p,f.inclusive,_,g.inclusive,T);return $.forEach(D,L=>t.H(L,n.limit).next(B=>{B.forEach(w=>{let F=se.fromSegments(w.documentKey);s.has(F)||(s=s.add(F),a.push(F))})}))}).next(()=>a)}return $.resolve(null)})}Fn(e){let n=this.Cn.get(e);return n||(e.filters.length===0?n=[e]:n=Koe(tt.create(e.filters,"and")).map(t=>Cw(e.path,e.collectionGroup,e.orderBy,t.getFilters(),e.limit,e.startAt,e.endAt)),this.Cn.set(e,n),n)}Nn(e,n,t,i,o,s,a){let c=(n!=null?n.length:1)*Math.max(t.length,o.length),l=c/(n!=null?n.length:1),u=[];for(let d=0;d<c;++d){let f=n?this.Bn(n[d/l]):Pv,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,n,t,i){let o=new ql(e,se.empty(),n,t);return i?o:o.En()}kn(e,n,t,i){let o=new ql(e,se.empty(),n,t);return i?o.En():o}Mn(e,n){let t=new fy(n),i=n.collectionGroup!=null?n.collectionGroup:n.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,n){let t=2,i=this.Fn(n);return $.forEach(i,o=>this.Mn(e,o).next(s=>{s?t!==0&&s.fields.length<(function(c){let l=new ot(gn.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})(n)&&i.length>1&&t===2?1:t)}qn(e,n){let t=new zl;for(let i of $l(e)){let o=n.data.field(i.fieldPath);if(o==null)return null;let s=t.hn(i.kind);Ps.Ut.bt(o,s)}return t.an()}Bn(e){let n=new zl;return Ps.Ut.bt(e,n.hn(0)),n.an()}Qn(e,n){let t=new zl;return Ps.Ut.bt(eu(this.databaseId,n),t.hn((function(o){let s=$l(o);return s.length===0?0:s[s.length-1].kind})(e))),t.an()}On(e,n,t){if(t===null)return[];let i=[];i.push(new zl);let o=0;for(let s of $l(e)){let a=t[o++];for(let c of i)if(this.$n(n,s.fieldPath)&&lp(a))i=this.Un(i,s,a);else{let l=c.hn(s.kind);Ps.Ut.bt(a,l)}}return this.Kn(i)}xn(e,n,t){return this.On(e,n,t.position)}Kn(e){let n=[];for(let t=0;t<e.length;++t)n[t]=e[t].an();return n}Un(e,n,t){let i=[...e],o=[];for(let s of t.arrayValue.values||[])for(let a of i){let c=new zl;c.seed(a.an()),Ps.Ut.bt(s,c.hn(n.kind)),o.push(c)}return o}$n(e,n){return!!e.filters.find(t=>t instanceof Ge&&t.field.isEqual(n)&&(t.op==="in"||t.op==="not-in"))}getFieldIndexes(e,n){let t=Vm(e),i=hh(e);return(n?t.j(fw,IDBKeyRange.bound(n,n)):t.j()).next(o=>{let s=[];return $.forEach(o,a=>i.get([a.indexId,this.uid]).next(c=>{s.push((function(u,d){let f=d?new ep(d.sequenceNumber,new Ii(au(d.readTime),new se(Go(d.documentKey)),d.largestBatchId)):ep.empty(),g=u.fields.map(([p,_])=>new Th(gn.fromServerFormat(p),_));return new Rh(u.indexId,u.collectionGroup,g,f)})(a,c))})).next(()=>s)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(n=>n.length===0?null:(n.sort((t,i)=>{let o=t.indexState.sequenceNumber-i.indexState.sequenceNumber;return o!==0?o:De(t.collectionGroup,i.collectionGroup)}),n[0].collectionGroup))}updateCollectionGroup(e,n,t){let i=Vm(e),o=hh(e);return this.Wn(e).next(s=>i.j(fw,IDBKeyRange.bound(n,n)).next(a=>$.forEach(a,c=>o.put(dH(c.indexId,this.uid,s,t)))))}updateIndexEntries(e,n){let t=new Map;return $.forEach(n,(i,o)=>{let s=t.get(i.collectionGroup);return(s?$.resolve(s):this.getFieldIndexes(e,i.collectionGroup)).next(a=>(t.set(i.collectionGroup,a),$.forEach(a,c=>this.Gn(e,i,c).next(l=>{let u=this.zn(o,c);return l.isEqual(u)?$.resolve():this.jn(e,o,c,l,u)}))))})}Jn(e,n,t,i){return dh(e).put(i.An(this.uid,this.Qn(t,n.key),n.key))}Hn(e,n,t,i){return dh(e).delete(i.Rn(this.uid,this.Qn(t,n.key),n.key))}Gn(e,n,t){let i=dh(e),o=new ot(Va);return i.X({index:oW,range:IDBKeyRange.only([t.indexId,this.uid,Hv(this.Qn(t,n))])},(s,a)=>{o=o.add(new ql(t.indexId,n,pH(a.arrayValue),pH(a.directionalValue)))}).next(()=>o)}zn(e,n){let t=new ot(Va),i=this.qn(n,e);if(i==null)return t;let o=aw(n);if(o!=null){let s=e.data.field(o.fieldPath);if(lp(s))for(let a of s.arrayValue.values||[])t=t.add(new ql(n.indexId,e.key,this.Bn(a),i))}else t=t.add(new ql(n.indexId,e.key,Pv,i));return t}jn(e,n,t,i,o){X(_H,"Updating index entries for document '%s'",n.key);let s=[];return(function(c,l,u,d,f){let g=c.getIterator(),p=l.getIterator(),_=lh(g),T=lh(p);for(;_||T;){let D=!1,L=!1;if(_&&T){let B=u(_,T);B<0?L=!0:B>0&&(D=!0)}else _!=null?L=!0:D=!0;D?(d(T),T=lh(p)):L?(f(_),_=lh(g)):(_=lh(g),T=lh(p))}})(i,o,Va,a=>{s.push(this.Jn(e,n,t,a))},a=>{s.push(this.Hn(e,n,t,a))}),$.waitFor(s)}Wn(e){let n=1;return hh(e).X({index:iW,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(t,i,o)=>{o.done(),n=i.sequenceNumber+1}).next(()=>n)}createRange(e,n,t){t=t.sort((s,a)=>Va(s,a)).filter((s,a,c)=>!a||Va(s,c[a-1])!==0);let i=[];i.push(e);for(let s of t){let a=Va(s,e),c=Va(s,n);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(n);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,Pv,se.empty()),c=i[s+1].Rn(this.uid,Pv,se.empty());o.push(IDBKeyRange.bound(a,c))}return o}Yn(e,n){return Va(e,n)>0}getMinOffsetFromCollectionGroup(e,n){return this.getFieldIndexes(e,n).next(IH)}getMinOffset(e,n){return $.mapArray(this.Fn(n),t=>this.Mn(e,t).next(i=>i||ae(44426))).next(IH)}};function TH(r){return En(r,ip)}function dh(r){return En(r,qm)}function Vm(r){return En(r,fM)}function hh(r){return En(r,zm)}function IH(r){fe(r.length!==0,28825);let e=r[0].indexState.offset,n=e.largestBatchId;for(let t=1;t<r.length;t++){let i=r[t].indexState.offset;uM(i,e)<0&&(e=i),n<i.largestBatchId&&(n=i.largestBatchId)}return new Ii(e.readTime,e.documentKey,n)}var vH={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},n3=41943040,Cr=class r{static withCacheSize(e){return new r(e,r.DEFAULT_COLLECTION_PERCENTILE,r.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,t){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=t}};function r3(r,e,n){let t=r.store(Ki),i=r.store(Ch),o=[],s=IDBKeyRange.only(n.batchId),a=0,c=t.X({range:s},(u,d,f)=>(a++,f.delete()));o.push(c.next(()=>{fe(a===1,47070,{batchId:n.batchId})}));let l=[];for(let u of n.mutations){let d=tW(e,u.key.path,n.batchId);o.push(i.delete(d)),l.push(u.key)}return $.waitFor(o).next(()=>l)}function my(r){if(!r)return 0;let e;if(r.document)e=r.document;else if(r.unknownDocument)e=r.unknownDocument;else{if(!r.noDocument)throw ae(14731);e=r.noDocument}return JSON.stringify(e).length}Cr.DEFAULT_COLLECTION_PERCENTILE=10,Cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Cr.DEFAULT=new Cr(n3,Cr.DEFAULT_COLLECTION_PERCENTILE,Cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Cr.DISABLED=new Cr(-1,0,0);var py=class r{constructor(e,n,t,i){this.userId=e,this.serializer=n,this.indexManager=t,this.referenceDelegate=i,this.Zn={}}static yt(e,n,t,i){fe(e.uid!=="",64387);let o=e.isAuthenticated()?e.uid:"";return new r(o,n,t,i)}checkEmpty(e){let n=!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)=>{n=!1,s.done()}).next(()=>n)}addMutationBatch(e,n,t,i){let o=Eh(e),s=Ba(e);return s.add({}).next(a=>{fe(typeof a=="number",49019);let c=new dp(a,n,t,i),l=(function(g,p,_){let T=_.baseMutations.map(L=>pp(g.gt,L)),D=_.mutations.map(L=>pp(g.gt,L));return{userId:p,batchId:_.batchId,localWriteTimeMs:_.localWriteTime.toMillis(),baseMutations:T,mutations:D}})(this.serializer,this.userId,c),u=[],d=new ot((f,g)=>De(f.canonicalString(),g.canonicalString()));for(let f of i){let g=tW(this.userId,f.key.path,a);d=d.add(f.key.path.popLast()),u.push(s.put(l)),u.push(o.put(g,Hie))}return d.forEach(f=>{u.push(this.indexManager.addToCollectionParentIndex(e,f))}),e.addOnCommittedListener(()=>{this.Zn[a]=c.keys()}),$.waitFor(u).next(()=>c)})}lookupMutationBatch(e,n){return Ba(e).get(n).next(t=>t?(fe(t.userId===this.userId,48,"Unexpected user for mutation batch",{userId:t.userId,batchId:n}),Wl(this.serializer,t)):null)}Xn(e,n){return this.Zn[n]?$.resolve(this.Zn[n]):this.lookupMutationBatch(e,n).next(t=>{if(t){let i=t.keys();return this.Zn[n]=i,i}return null})}getNextMutationBatchAfterBatchId(e,n){let t=n+1,i=IDBKeyRange.lowerBound([this.userId,t]),o=null;return Ba(e).X({index:Kl,range:i},(s,a,c)=>{a.userId===this.userId&&(fe(a.batchId>=t,47524,{er:t}),o=Wl(this.serializer,a)),c.done()}).next(()=>o)}getHighestUnacknowledgedBatchId(e){let n=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),t=Xl;return Ba(e).X({index:Kl,range:n,reverse:!0},(i,o,s)=>{t=o.batchId,s.done()}).next(()=>t)}getAllMutationBatches(e){let n=IDBKeyRange.bound([this.userId,Xl],[this.userId,Number.POSITIVE_INFINITY]);return Ba(e).j(Kl,n).next(t=>t.map(i=>Wl(this.serializer,i)))}getAllMutationBatchesAffectingDocumentKey(e,n){let t=Uv(this.userId,n.path),i=IDBKeyRange.lowerBound(t),o=[];return Eh(e).X({range:i},(s,a,c)=>{let[l,u,d]=s,f=Go(u);if(l===this.userId&&n.path.isEqual(f))return Ba(e).get(d).next(g=>{if(!g)throw ae(61480,{tr:s,batchId:d});fe(g.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:g.userId,batchId:d}),o.push(Wl(this.serializer,g))});c.done()}).next(()=>o)}getAllMutationBatchesAffectingDocumentKeys(e,n){let t=new ot(De),i=[];return n.forEach(o=>{let s=Uv(this.userId,o.path),a=IDBKeyRange.lowerBound(s),c=Eh(e).X({range:a},(l,u,d)=>{let[f,g,p]=l,_=Go(g);f===this.userId&&o.path.isEqual(_)?t=t.add(p):d.done()});i.push(c)}),$.waitFor(i).next(()=>this.nr(e,t))}getAllMutationBatchesAffectingQuery(e,n){let t=n.path,i=t.length+1,o=Uv(this.userId,t),s=IDBKeyRange.lowerBound(o),a=new ot(De);return Eh(e).X({range:s},(c,l,u)=>{let[d,f,g]=c,p=Go(f);d===this.userId&&t.isPrefixOf(p)?p.length===i&&(a=a.add(g)):u.done()}).next(()=>this.nr(e,a))}nr(e,n){let t=[],i=[];return n.forEach(o=>{i.push(Ba(e).get(o).next(s=>{if(s===null)throw ae(35274,{batchId:o});fe(s.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:s.userId,batchId:o}),t.push(Wl(this.serializer,s))}))}),$.waitFor(i).next(()=>t)}removeMutationBatch(e,n){return r3(e.ce,this.userId,n).next(t=>(e.addOnCommittedListener(()=>{this.rr(n.batchId)}),$.forEach(t,i=>this.referenceDelegate.markPotentiallyOrphaned(e,i))))}rr(e){delete this.Zn[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(n=>{if(!n)return $.resolve();let t=IDBKeyRange.lowerBound((function(s){return[s]})(this.userId)),i=[];return Eh(e).X({range:t},(o,s,a)=>{if(o[0]===this.userId){let c=Go(o[1]);i.push(c)}else a.done()}).next(()=>{fe(i.length===0,56720,{ir:i.map(o=>o.canonicalString())})})})}containsKey(e,n){return i3(e,this.userId,n)}sr(e){return o3(e).get(this.userId).next(n=>n||{userId:this.userId,lastAcknowledgedBatchId:Xl,lastStreamToken:""})}};function i3(r,e,n){let t=Uv(e,n.path),i=t[1],o=IDBKeyRange.lowerBound(t),s=!1;return Eh(r).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(r){return En(r,Ki)}function Eh(r){return En(r,Ch)}function o3(r){return En(r,np)}var Vh=class r{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new r(0)}static ur(){return new r(-1)}};var Xw=class{constructor(e,n){this.referenceDelegate=e,this.serializer=n}allocateTargetId(e){return this.cr(e).next(n=>{let t=new Vh(n.highestTargetId);return n.highestTargetId=t.next(),this.lr(e,n).next(()=>n.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.cr(e).next(n=>Ee.fromTimestamp(new wt(n.lastRemoteSnapshotVersion.seconds,n.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.cr(e).next(n=>n.highestListenSequenceNumber)}setTargetsMetadata(e,n,t){return this.cr(e).next(i=>(i.highestListenSequenceNumber=n,t&&(i.lastRemoteSnapshotVersion=t.toTimestamp()),n>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=n),this.lr(e,i)))}addTargetData(e,n){return this.hr(e,n).next(()=>this.cr(e).next(t=>(t.targetCount+=1,this.Pr(n,t),this.lr(e,t))))}updateTargetData(e,n){return this.hr(e,n)}removeTargetData(e,n){return this.removeMatchingKeysForTargetId(e,n.targetId).next(()=>fh(e).delete(n.targetId)).next(()=>this.cr(e)).next(t=>(fe(t.targetCount>0,8065),t.targetCount-=1,this.lr(e,t)))}removeTargets(e,n,t){let i=0,o=[];return fh(e).X((s,a)=>{let c=jm(a);c.sequenceNumber<=n&&t.get(c.targetId)===null&&(i++,o.push(this.removeTargetData(e,c)))}).next(()=>$.waitFor(o)).next(()=>i)}forEachTarget(e,n){return fh(e).X((t,i)=>{let o=jm(i);n(o)})}cr(e){return yH(e).get(Zv).next(n=>(fe(n!==null,2888),n))}lr(e,n){return yH(e).put(Zv,n)}hr(e,n){return fh(e).put(JW(this.serializer,n))}Pr(e,n){let t=!1;return e.targetId>n.highestTargetId&&(n.highestTargetId=e.targetId,t=!0),e.sequenceNumber>n.highestListenSequenceNumber&&(n.highestListenSequenceNumber=e.sequenceNumber,t=!0),t}getTargetCount(e){return this.cr(e).next(n=>n.targetCount)}getTargetData(e,n){let t=nu(n),i=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Number.POSITIVE_INFINITY]),o=null;return fh(e).X({range:i,index:rW},(s,a,c)=>{let l=jm(a);bp(n,l.target)&&(o=l,c.done())}).next(()=>o)}addMatchingKeys(e,n,t){let i=[],o=ja(e);return n.forEach(s=>{let a=tr(s.path);i.push(o.put({targetId:t,path:a})),i.push(this.referenceDelegate.addReference(e,t,s))}),$.waitFor(i)}removeMatchingKeys(e,n,t){let i=ja(e);return $.forEach(n,o=>{let s=tr(o.path);return $.waitFor([i.delete([t,s]),this.referenceDelegate.removeReference(e,t,o)])})}removeMatchingKeysForTargetId(e,n){let t=ja(e),i=IDBKeyRange.bound([n],[n+1],!1,!0);return t.delete(i)}getMatchingKeysForTargetId(e,n){let t=IDBKeyRange.bound([n],[n+1],!1,!0),i=ja(e),o=ke();return i.X({range:t,Z:!0},(s,a,c)=>{let l=Go(s[1]),u=new se(l);o=o.add(u)}).next(()=>o)}containsKey(e,n){let t=tr(n.path),i=IDBKeyRange.bound([t],[KH(t)],!1,!0),o=0;return ja(e).X({index:hM,Z:!0,range:i},([s,a],c,l)=>{s!==0&&(o++,l.done())}).next(()=>o>0)}Et(e,n){return fh(e).get(n).next(t=>t?jm(t):null)}};function fh(r){return En(r,Nh)}function yH(r){return En(r,Jl)}function ja(r){return En(r,Oh)}var SH="LruGarbageCollector",s3=1048576;function AH([r,e],[n,t]){let i=De(r,n);return i===0?De(e,t):i}var Jw=class{constructor(e){this.Tr=e,this.buffer=new ot(AH),this.Ir=0}dr(){return++this.Ir}Er(e){let n=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(n);else{let t=this.buffer.last();AH(n,t)<0&&(this.buffer=this.buffer.delete(t).add(n))}}get maxValue(){return this.buffer.last()[0]}},Ey=class{constructor(e,n,t){this.garbageCollector=e,this.asyncQueue=n,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(SH,`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(n){oc(n)?X(SH,"Ignoring IndexedDB error during garbage collection: ",n):yield ic(n)}yield this.Rr(3e5)}))}},Zw=class{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.mr(e).next(t=>Math.floor(n/100*t))}nthSequenceNumber(e,n){if(n===0)return $.resolve(zr.ue);let t=new Jw(n);return this.Vr.forEachTarget(e,i=>t.Er(i.sequenceNumber)).next(()=>this.Vr.gr(e,i=>t.Er(i))).next(()=>t.maxValue)}removeTargets(e,n,t){return this.Vr.removeTargets(e,n,t)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(X("LruGarbageCollector","Garbage collection skipped; disabled"),$.resolve(vH)):this.getCacheSize(e).next(t=>t<this.params.cacheSizeCollectionThreshold?(X("LruGarbageCollector",`Garbage collection skipped; Cache size ${t} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),vH):this.pr(e,n))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,n){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,n))).next(d=>(o=d,c=Date.now(),this.removeOrphanedDocuments(e,t))).next(d=>(l=Date.now(),gh()<=Pe.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`),$.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:d})))}};function a3(r,e){return new Zw(r,e)}var eL=class{constructor(e,n){this.db=e,this.garbageCollector=a3(this,n)}mr(e){let n=this.yr(e);return this.db.getTargetCache().getTargetCount(e).next(t=>n.next(i=>t+i))}yr(e){let n=0;return this.gr(e,t=>{n++}).next(()=>n)}forEachTarget(e,n){return this.db.getTargetCache().forEachTarget(e,n)}gr(e,n){return this.wr(e,(t,i)=>n(i))}addReference(e,n,t){return xv(e,t)}removeReference(e,n,t){return xv(e,t)}removeTargets(e,n,t){return this.db.getTargetCache().removeTargets(e,n,t)}markPotentiallyOrphaned(e,n){return xv(e,n)}Sr(e,n){return(function(i,o){let s=!1;return o3(i).ee(a=>i3(i,a,o).next(c=>(c&&(s=!0),$.resolve(!c)))).next(()=>s)})(e,n)}removeOrphanedDocuments(e,n){let t=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[],o=0;return this.wr(e,(s,a)=>{if(a<=n){let c=this.Sr(e,s).next(l=>{if(!l)return o++,t.getEntry(e,s).next(()=>(t.removeEntry(s,Ee.min()),ja(e).delete((function(d){return[0,tr(d.path)]})(s))))});i.push(c)}}).next(()=>$.waitFor(i)).next(()=>t.apply(e)).next(()=>o)}removeTarget(e,n){let t=n.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,t)}updateLimboDocument(e,n){return xv(e,n)}wr(e,n){let t=ja(e),i,o=zr.ue;return t.X({index:hM},([s,a],{path:c,sequenceNumber:l})=>{s===0?(o!==zr.ue&&n(new se(Go(i)),o),o=l,i=c):o=zr.ue}).next(()=>{o!==zr.ue&&n(new se(Go(i)),o)})}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}};function xv(r,e){return ja(r).put((function(t,i){return{targetId:0,path:tr(t.path),sequenceNumber:i}})(e,r.currentSequenceNumber))}var _y=class{constructor(){this.changes=new Yi(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,mn.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();let t=this.changes.get(n);return t!==void 0?$.resolve(t):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};var tL=class{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,n,t){return Gl(e).put(t)}removeEntry(e,n,t){return Gl(e).delete((function(o,s){let a=o.path.toArray();return[a.slice(0,a.length-2),a[a.length-2],dy(s),a[a.length-1]]})(n,t))}updateMetadata(e,n){return this.getMetadata(e).next(t=>(t.byteSize+=n,this.br(e,t)))}getEntry(e,n){let t=mn.newInvalidDocument(n);return Gl(e).X({index:Vv,range:IDBKeyRange.only(Bm(n))},(i,o)=>{t=this.Dr(n,o)}).next(()=>t)}vr(e,n){let t={size:0,document:mn.newInvalidDocument(n)};return Gl(e).X({index:Vv,range:IDBKeyRange.only(Bm(n))},(i,o)=>{t={document:this.Dr(n,o),size:my(o)}}).next(()=>t)}getEntries(e,n){let t=Kr();return this.Cr(e,n,(i,o)=>{let s=this.Dr(i,o);t=t.insert(i,s)}).next(()=>t)}Fr(e,n){let t=Kr(),i=new St(se.comparator);return this.Cr(e,n,(o,s)=>{let a=this.Dr(o,s);t=t.insert(o,a),i=i.insert(o,my(s))}).next(()=>({documents:t,Mr:i}))}Cr(e,n,t){if(n.isEmpty())return $.resolve();let i=new ot(CH);n.forEach(c=>i=i.add(c));let o=IDBKeyRange.bound(Bm(i.first()),Bm(i.last())),s=i.getIterator(),a=s.getNext();return Gl(e).X({index:Vv,range:o},(c,l,u)=>{let d=se.fromSegments([...l.prefixPath,l.collectionGroup,l.documentId]);for(;a&&CH(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(Bm(a)):u.done()}).next(()=>{for(;a;)t(a,null),a=s.hasNext()?s.getNext():null})}getDocumentsMatchingQuery(e,n,t,i,o){let s=n.path,a=[s.popLast().toArray(),s.lastSegment(),dy(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 Gl(e).j(IDBKeyRange.bound(a,c,!0)).next(l=>{o?.incrementDocumentReadCount(l.length);let u=Kr();for(let d of l){let f=this.Dr(se.fromSegments(d.prefixPath.concat(d.collectionGroup,d.documentId)),d);f.isFoundDocument()&&(Lp(n,f)||i.has(f.key))&&(u=u.insert(f.key,f))}return u})}getAllFromCollectionGroup(e,n,t,i){let o=Kr(),s=DH(n,t),a=DH(n,Ii.max());return Gl(e).X({index:nW,range:IDBKeyRange.bound(s,a,!0)},(c,l,u)=>{let d=this.Dr(se.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 nL(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next(n=>n.byteSize)}getMetadata(e){return RH(e).get(hw).next(n=>(fe(!!n,20021),n))}br(e,n){return RH(e).put(hw,n)}Dr(e,n){if(n){let t=zoe(this.serializer,n);if(!(t.isNoDocument()&&t.version.isEqual(Ee.min())))return t}return mn.newInvalidDocument(e)}};function c3(r){return new tL(r)}var nL=class extends _y{constructor(e,n){super(),this.Or=e,this.trackRemovals=n,this.Nr=new Yi(t=>t.toString(),(t,i)=>t.isEqual(i))}applyChanges(e){let n=[],t=0,i=new ot((o,s)=>De(o.canonicalString(),s.canonicalString()));return this.changes.forEach((o,s)=>{let a=this.Nr.get(o);if(n.push(this.Or.removeEntry(e,o,a.readTime)),s.isValidDocument()){let c=lH(this.Or.serializer,s);i=i.add(o.path.popLast());let l=my(c);t+=l-a.size,n.push(this.Or.addEntry(e,o,c))}else if(t-=a.size,this.trackRemovals){let c=lH(this.Or.serializer,s.convertToNoDocument(Ee.min()));n.push(this.Or.addEntry(e,o,c))}}),i.forEach(o=>{n.push(this.Or.indexManager.addToCollectionParentIndex(e,o))}),n.push(this.Or.updateMetadata(e,t)),$.waitFor(n)}getFromCache(e,n){return this.Or.vr(e,n).next(t=>(this.Nr.set(n,{size:t.size,readTime:t.document.readTime}),t.document))}getAllFromCache(e,n){return this.Or.Fr(e,n).next(({documents:t,Mr:i})=>(i.forEach((o,s)=>{this.Nr.set(o,{size:s,readTime:t.get(o).readTime})}),t))}};function RH(r){return En(r,rp)}function Gl(r){return En(r,Jv)}function Bm(r){let e=r.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function DH(r,e){let n=e.documentKey.path.toArray();return[r,dy(e.readTime),n.slice(0,n.length-2),n.length>0?n[n.length-1]:""]}function CH(r,e){let n=r.path.toArray(),t=e.path.toArray(),i=0;for(let o=0;o<n.length-2&&o<t.length-2;++o)if(i=De(n[o],t[o]),i)return i;return i=De(n.length,t.length),i||(i=De(n[n.length-2],t[t.length-2]),i||De(n[n.length-1],t[t.length-1]))}var rL=class{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}};var Ty=class{constructor(e,n,t,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=t,this.indexManager=i}getDocument(e,n){let t=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(t=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(t!==null&&Qm(t.mutation,i,qr.empty(),wt.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(t=>this.getLocalViewOfDocuments(e,t,ke()).next(()=>t))}getLocalViewOfDocuments(e,n,t=ke()){let i=$o();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,t).next(o=>{let s=$m();return o.forEach((a,c)=>{s=s.insert(a,c.overlayedDocument)}),s}))}getOverlayedDocuments(e,n){let t=$o();return this.populateOverlays(e,t,n).next(()=>this.computeViews(e,n,t,ke()))}populateOverlays(e,n,t){let i=[];return t.forEach(o=>{n.has(o)||i.push(o)}),this.documentOverlayCache.getOverlays(e,i).next(o=>{o.forEach((s,a)=>{n.set(s,a)})})}computeViews(e,n,t,i){let o=Kr(),s=Ym(),a=(function(){return Ym()})();return n.forEach((c,l)=>{let u=t.get(l.key);i.has(l.key)&&(u===void 0||u.mutation instanceof Qi)?o=o.insert(l.key,l):u!==void 0?(s.set(l.key,u.mutation.getFieldMask()),Qm(u.mutation,l,u.mutation.getFieldMask(),wt.now())):s.set(l.key,qr.empty())}),this.recalculateAndSaveOverlays(e,o).next(c=>(c.forEach((l,u)=>s.set(l,u)),n.forEach((l,u)=>{var d;return a.set(l,new rL(u,(d=s.get(l))!==null&&d!==void 0?d:null))}),a))}recalculateAndSaveOverlays(e,n){let t=Ym(),i=new St((s,a)=>s-a),o=ke();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(s=>{for(let a of s)a.keys().forEach(c=>{let l=n.get(c);if(l===null)return;let u=t.get(c)||qr.empty();u=a.applyToLocalView(l,u),t.set(c,u);let d=(i.get(a.batchId)||ke()).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=LW();u.forEach(f=>{if(!o.has(f)){let g=UW(n.get(f),t.get(f));g!==null&&d.set(f,g),o=o.add(f)}}),s.push(this.documentOverlayCache.saveOverlays(e,l,d))}return $.waitFor(s)}).next(()=>t)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,n,t,i){return(function(s){return se.isDocumentKey(s.path)&&s.collectionGroup===null&&s.filters.length===0})(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):TM(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,t,i):this.getDocumentsMatchingCollectionQuery(e,n,t,i)}getNextDocuments(e,n,t,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,t,i).next(o=>{let s=i-o.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,t.largestBatchId,i-o.size):$.resolve($o()),a=Ah,c=o;return s.next(l=>$.forEach(l,(u,d)=>(a<d.largestBatchId&&(a=d.largestBatchId),o.get(u)?$.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,ke())).next(u=>({batchId:a,changes:wW(u)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new se(n)).next(t=>{let i=$m();return t.isFoundDocument()&&(i=i.insert(t.key,t)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,t,i){let o=n.collectionGroup,s=$m();return this.indexManager.getCollectionParents(e,o).next(a=>$.forEach(a,c=>{let l=(function(d,f){return new zo(f,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)})(n,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,n,t,i){let o;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,t.largestBatchId).next(s=>(o=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,t,o,i))).next(s=>{o.forEach((c,l)=>{let u=l.getKey();s.get(u)===null&&(s=s.insert(u,mn.newInvalidDocument(u)))});let a=$m();return s.forEach((c,l)=>{let u=o.get(c);u!==void 0&&Qm(u.mutation,l,qr.empty(),wt.now()),Lp(n,l)&&(a=a.insert(c,l))}),a})}};var iL=class{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,n){return $.resolve(this.Br.get(n))}saveBundleMetadata(e,n){return this.Br.set(n.id,(function(i){return{id:i.id,version:i.version,createTime:Nn(i.createTime)}})(n)),$.resolve()}getNamedQuery(e,n){return $.resolve(this.Lr.get(n))}saveNamedQuery(e,n){return this.Lr.set(n.name,(function(i){return{name:i.name,query:ZW(i.bundledQuery),readTime:Nn(i.readTime)}})(n)),$.resolve()}};var oL=class{constructor(){this.overlays=new St(se.comparator),this.kr=new Map}getOverlay(e,n){return $.resolve(this.overlays.get(n))}getOverlays(e,n){let t=$o();return $.forEach(n,i=>this.getOverlay(e,i).next(o=>{o!==null&&t.set(i,o)})).next(()=>t)}saveOverlays(e,n,t){return t.forEach((i,o)=>{this.wt(e,n,o)}),$.resolve()}removeOverlaysForBatchId(e,n,t){let i=this.kr.get(t);return i!==void 0&&(i.forEach(o=>this.overlays=this.overlays.remove(o)),this.kr.delete(t)),$.resolve()}getOverlaysForCollection(e,n,t){let i=$o(),o=n.length+1,s=new se(n.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let c=a.getNext().value,l=c.getKey();if(!n.isPrefixOf(l.path))break;l.path.length===o&&c.largestBatchId>t&&i.set(c.getKey(),c)}return $.resolve(i)}getOverlaysForCollectionGroup(e,n,t,i){let o=new St((l,u)=>l-u),s=this.overlays.getIterator();for(;s.hasNext();){let l=s.getNext().value;if(l.getKey().getCollectionGroup()===n&&l.largestBatchId>t){let u=o.get(l.largestBatchId);u===null&&(u=$o(),o=o.insert(l.largestBatchId,u)),u.set(l.getKey(),l)}}let a=$o(),c=o.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((l,u)=>a.set(l,u)),!(a.size()>=i)););return $.resolve(a)}wt(e,n,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 hp(n,t));let o=this.kr.get(n);o===void 0&&(o=ke(),this.kr.set(n,o)),this.kr.set(n,o.add(t.key))}};var sL=class{constructor(){this.sessionToken=rn.EMPTY_BYTE_STRING}getSessionToken(e){return $.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,$.resolve()}};var _p=class{constructor(){this.qr=new ot(en.Qr),this.$r=new ot(en.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,n){let t=new en(e,n);this.qr=this.qr.add(t),this.$r=this.$r.add(t)}Kr(e,n){e.forEach(t=>this.addReference(t,n))}removeReference(e,n){this.Wr(new en(e,n))}Gr(e,n){e.forEach(t=>this.removeReference(t,n))}zr(e){let n=new se(new He([])),t=new en(n,e),i=new en(n,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 n=new se(new He([])),t=new en(n,e),i=new en(n,e+1),o=ke();return this.$r.forEachInRange([t,i],s=>{o=o.add(s.key)}),o}containsKey(e){let n=new en(e,0),t=this.qr.firstAfterOrEqual(n);return t!==null&&e.isEqual(t.key)}},en=class{constructor(e,n){this.key=e,this.Hr=n}static Qr(e,n){return se.comparator(e.key,n.key)||De(e.Hr,n.Hr)}static Ur(e,n){return De(e.Hr,n.Hr)||se.comparator(e.key,n.key)}};var aL=class{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.er=1,this.Yr=new ot(en.Qr)}checkEmpty(e){return $.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,t,i){let o=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new dp(o,n,t,i);this.mutationQueue.push(s);for(let a of i)this.Yr=this.Yr.add(new en(a.key,o)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return $.resolve(s)}lookupMutationBatch(e,n){return $.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){let t=n+1,i=this.Xr(t),o=i<0?0:i;return $.resolve(this.mutationQueue.length>o?this.mutationQueue[o]:null)}getHighestUnacknowledgedBatchId(){return $.resolve(this.mutationQueue.length===0?Xl:this.er-1)}getAllMutationBatches(e){return $.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){let t=new en(n,0),i=new en(n,Number.POSITIVE_INFINITY),o=[];return this.Yr.forEachInRange([t,i],s=>{let a=this.Zr(s.Hr);o.push(a)}),$.resolve(o)}getAllMutationBatchesAffectingDocumentKeys(e,n){let t=new ot(De);return n.forEach(i=>{let o=new en(i,0),s=new en(i,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([o,s],a=>{t=t.add(a.Hr)})}),$.resolve(this.ei(t))}getAllMutationBatchesAffectingQuery(e,n){let t=n.path,i=t.length+1,o=t;se.isDocumentKey(o)||(o=o.child(""));let s=new en(new se(o),0),a=new ot(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),$.resolve(this.ei(a))}ei(e){let n=[];return e.forEach(t=>{let i=this.Zr(t);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){fe(this.ti(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let t=this.Yr;return $.forEach(n.mutations,i=>{let o=new en(i.key,n.batchId);return t=t.delete(o),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Yr=t})}rr(e){}containsKey(e,n){let t=new en(n,0),i=this.Yr.firstAfterOrEqual(t);return $.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,$.resolve()}ti(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){let n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}};var cL=class{constructor(e){this.ni=e,this.docs=(function(){return new St(se.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){let t=n.key,i=this.docs.get(t),o=i?i.size:0,s=this.ni(n);return this.docs=this.docs.insert(t,{document:n.mutableCopy(),size:s}),this.size+=s-o,this.indexManager.addToCollectionParentIndex(e,t.path.popLast())}removeEntry(e){let n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){let t=this.docs.get(n);return $.resolve(t?t.document.mutableCopy():mn.newInvalidDocument(n))}getEntries(e,n){let t=Kr();return n.forEach(i=>{let o=this.docs.get(i);t=t.insert(i,o?o.document.mutableCopy():mn.newInvalidDocument(i))}),$.resolve(t)}getDocumentsMatchingQuery(e,n,t,i){let o=Kr(),s=n.path,a=new se(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||uM(XH(u),t)<=0||(i.has(u.key)||Lp(n,u))&&(o=o.insert(u.key,u.mutableCopy()))}return $.resolve(o)}getAllFromCollectionGroup(e,n,t,i){ae(9500)}ri(e,n){return $.forEach(this.docs,t=>n(t))}newChangeBuffer(e){return new lL(this)}getSize(e){return $.resolve(this.size)}},lL=class extends _y{constructor(e){super(),this.Or=e}applyChanges(e){let n=[];return this.changes.forEach((t,i)=>{i.isValidDocument()?n.push(this.Or.addEntry(e,i)):this.Or.removeEntry(t)}),$.waitFor(n)}getFromCache(e,n){return this.Or.getEntry(e,n)}getAllFromCache(e,n){return this.Or.getEntries(e,n)}};var uL=class{constructor(e){this.persistence=e,this.ii=new Yi(n=>nu(n),bp),this.lastRemoteSnapshotVersion=Ee.min(),this.highestTargetId=0,this.si=0,this.oi=new _p,this.targetCount=0,this._i=Vh.ar()}forEachTarget(e,n){return this.ii.forEach((t,i)=>n(i)),$.resolve()}getLastRemoteSnapshotVersion(e){return $.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return $.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),$.resolve(this.highestTargetId)}setTargetsMetadata(e,n,t){return t&&(this.lastRemoteSnapshotVersion=t),n>this.si&&(this.si=n),$.resolve()}hr(e){this.ii.set(e.target,e);let n=e.targetId;n>this.highestTargetId&&(this._i=new Vh(n),this.highestTargetId=n),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,n){return this.hr(n),this.targetCount+=1,$.resolve()}updateTargetData(e,n){return this.hr(n),$.resolve()}removeTargetData(e,n){return this.ii.delete(n.target),this.oi.zr(n.targetId),this.targetCount-=1,$.resolve()}removeTargets(e,n,t){let i=0,o=[];return this.ii.forEach((s,a)=>{a.sequenceNumber<=n&&t.get(a.targetId)===null&&(this.ii.delete(s),o.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),$.waitFor(o).next(()=>i)}getTargetCount(e){return $.resolve(this.targetCount)}getTargetData(e,n){let t=this.ii.get(n)||null;return $.resolve(t)}addMatchingKeys(e,n,t){return this.oi.Kr(n,t),$.resolve()}removeMatchingKeys(e,n,t){this.oi.Gr(n,t);let i=this.persistence.referenceDelegate,o=[];return i&&n.forEach(s=>{o.push(i.markPotentiallyOrphaned(e,s))}),$.waitFor(o)}removeMatchingKeysForTargetId(e,n){return this.oi.zr(n),$.resolve()}getMatchingKeysForTargetId(e,n){let t=this.oi.Jr(n);return $.resolve(t)}containsKey(e,n){return $.resolve(this.oi.containsKey(n))}};var Tp=class{constructor(e,n){this.ai={},this.overlays={},this.ui=new zr(0),this.ci=!1,this.ci=!0,this.li=new sL,this.referenceDelegate=e(this),this.hi=new uL(this),this.indexManager=new Yw,this.remoteDocumentCache=(function(i){return new cL(i)})(t=>this.referenceDelegate.Pi(t)),this.serializer=new uy(n),this.Ti=new iL(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 n=this.overlays[e.toKey()];return n||(n=new oL,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let t=this.ai[e.toKey()];return t||(t=new aL(n,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,n,t){X("MemoryPersistence","Starting transaction:",e);let i=new dL(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,n){return $.or(Object.values(this.ai).map(t=>()=>t.containsKey(e,n)))}},dL=class extends Yv{constructor(e){super(),this.currentSequenceNumber=e}},Iy=class r{constructor(e){this.persistence=e,this.Ai=new _p,this.Ri=null}static Vi(e){return new r(e)}get mi(){if(this.Ri)return this.Ri;throw ae(60996)}addReference(e,n,t){return this.Ai.addReference(t,n),this.mi.delete(t.toString()),$.resolve()}removeReference(e,n,t){return this.Ai.removeReference(t,n),this.mi.add(t.toString()),$.resolve()}markPotentiallyOrphaned(e,n){return this.mi.add(n.toString()),$.resolve()}removeTarget(e,n){this.Ai.zr(n.targetId).forEach(i=>this.mi.add(i.toString()));let t=this.persistence.getTargetCache();return t.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(o=>this.mi.add(o.toString()))}).next(()=>t.removeTargetData(e,n))}Ii(){this.Ri=new Set}di(e){let n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return $.forEach(this.mi,t=>{let i=se.fromPath(t);return this.fi(e,i).next(o=>{o||n.removeEntry(i,Ee.min())})}).next(()=>(this.Ri=null,n.apply(e)))}updateLimboDocument(e,n){return this.fi(e,n).next(t=>{t?this.mi.delete(n.toString()):this.mi.add(n.toString())})}Pi(e){return 0}fi(e,n){return $.or([()=>$.resolve(this.Ai.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ei(e,n)])}},vy=class r{constructor(e,n){this.persistence=e,this.gi=new Yi(t=>tr(t.path),(t,i)=>t.isEqual(i)),this.garbageCollector=a3(this,n)}static Vi(e,n){return new r(e,n)}Ii(){}di(e){return $.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}mr(e){let n=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(t=>n.next(i=>t+i))}yr(e){let n=0;return this.gr(e,t=>{n++}).next(()=>n)}gr(e,n){return $.forEach(this.gi,(t,i)=>this.Sr(e,t,i).next(o=>o?$.resolve():n(i)))}removeTargets(e,n,t){return this.persistence.getTargetCache().removeTargets(e,n,t)}removeOrphanedDocuments(e,n){let t=0,i=this.persistence.getRemoteDocumentCache(),o=i.newChangeBuffer();return i.ri(e,s=>this.Sr(e,s,n).next(a=>{a||(t++,o.removeEntry(s,Ee.min()))})).next(()=>o.apply(e)).next(()=>t)}markPotentiallyOrphaned(e,n){return this.gi.set(n,e.currentSequenceNumber),$.resolve()}removeTarget(e,n){let t=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,t)}addReference(e,n,t){return this.gi.set(t,e.currentSequenceNumber),$.resolve()}removeReference(e,n,t){return this.gi.set(t,e.currentSequenceNumber),$.resolve()}updateLimboDocument(e,n){return this.gi.set(n,e.currentSequenceNumber),$.resolve()}Pi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Gv(e.data.value)),n}Sr(e,n,t){return $.or([()=>this.persistence.Ei(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{let i=this.gi.get(n);return $.resolve(i!==void 0&&i>t)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var hL=class{constructor(e){this.serializer=e}q(e,n,t,i){let o=new Qv("createOrUpgrade",n);t<1&&i>=1&&((function(c){c.createObjectStore(Op)})(e),(function(c){c.createObjectStore(np,{keyPath:jie}),c.createObjectStore(Ki,{keyPath:Bj,autoIncrement:!0}).createIndex(Kl,Gj,{unique:!0}),c.createObjectStore(Ch)})(e),NH(e),(function(c){c.createObjectStore(jl)})(e));let s=$.resolve();return t<3&&i>=3&&(t!==0&&((function(c){c.deleteObjectStore(Oh),c.deleteObjectStore(Nh),c.deleteObjectStore(Jl)})(e),NH(e)),s=s.next(()=>(function(c){let l=c.store(Jl),u={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:Ee.min().toTimestamp(),targetCount:0};return l.put(Zv,u)})(o))),t<4&&i>=4&&(t!==0&&(s=s.next(()=>(function(c,l){return l.store(Ki).j().next(d=>{c.deleteObjectStore(Ki),c.createObjectStore(Ki,{keyPath:Bj,autoIncrement:!0}).createIndex(Kl,Gj,{unique:!0});let f=l.store(Ki),g=d.map(p=>f.put(p));return $.waitFor(g)})})(e,o))),s=s.next(()=>{(function(c){c.createObjectStore(bh,{keyPath:Jie})})(e)})),t<5&&i>=5&&(s=s.next(()=>this.pi(o))),t<6&&i>=6&&(s=s.next(()=>((function(c){c.createObjectStore(rp)})(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(jy,{keyPath:Zie})})(e),(function(c){c.createObjectStore(Hy,{keyPath:eoe})})(e)})),t<12&&i>=12&&(s=s.next(()=>{(function(c){let l=c.createObjectStore(Wy,{keyPath:aoe});l.createIndex(gw,coe,{unique:!1}),l.createIndex(sW,loe,{unique:!1})})(e)})),t<13&&i>=13&&(s=s.next(()=>(function(c){let l=c.createObjectStore(Jv,{keyPath:Wie});l.createIndex(Vv,zie),l.createIndex(nW,qie)})(e)).next(()=>this.Di(e,o)).next(()=>e.deleteObjectStore(jl))),t<14&&i>=14&&(s=s.next(()=>this.Ci(e,o))),t<15&&i>=15&&(s=s.next(()=>(function(c){c.createObjectStore(fM,{keyPath:toe,autoIncrement:!0}).createIndex(fw,noe,{unique:!1}),c.createObjectStore(zm,{keyPath:roe}).createIndex(iW,ioe,{unique:!1}),c.createObjectStore(qm,{keyPath:ooe}).createIndex(oW,soe,{unique:!1})})(e))),t<16&&i>=16&&(s=s.next(()=>{n.objectStore(zm).clear()}).next(()=>{n.objectStore(qm).clear()})),t<17&&i>=17&&(s=s.next(()=>{(function(c){c.createObjectStore(gM,{keyPath:uoe})})(e)})),t<18&&i>=18&&tN()&&(s=s.next(()=>{n.objectStore(zm).clear()}).next(()=>{n.objectStore(qm).clear()})),s}yi(e){let n=0;return e.store(jl).X((t,i)=>{n+=my(i)}).next(()=>{let t={byteSize:n};return e.store(rp).put(hw,t)})}pi(e){let n=e.store(np),t=e.store(Ki);return n.j().next(i=>$.forEach(i,o=>{let s=IDBKeyRange.bound([o.userId,Xl],[o.userId,o.lastAcknowledgedBatchId]);return t.j(Kl,s).next(a=>$.forEach(a,c=>{fe(c.userId===o.userId,18650,"Cannot process batch from unexpected user",{batchId:c.batchId});let l=Wl(this.serializer,c);return r3(e,o.userId,l).next(()=>{})}))}))}wi(e){let n=e.store(Oh),t=e.store(jl);return e.store(Jl).get(Zv).next(i=>{let o=[];return t.X((s,a)=>{let c=new He(s),l=(function(d){return[0,tr(d)]})(c);o.push(n.get(l).next(u=>u?$.resolve():(d=>n.put({targetId:0,path:tr(d),sequenceNumber:i.highestListenSequenceNumber}))(c)))}).next(()=>$.waitFor(o))})}Si(e,n){e.createObjectStore(ip,{keyPath:Xie});let t=n.store(ip),i=new Ep,o=s=>{if(i.add(s)){let a=s.lastSegment(),c=s.popLast();return t.put({collectionId:a,parent:tr(c)})}};return n.store(jl).X({Z:!0},(s,a)=>{let c=new He(s);return o(c.popLast())}).next(()=>n.store(Ch).X({Z:!0},([s,a,c],l)=>{let u=Go(a);return o(u.popLast())}))}bi(e){let n=e.store(Nh);return n.X((t,i)=>{let o=jm(i),s=JW(this.serializer,o);return n.put(s)})}Di(e,n){let t=n.store(jl),i=[];return t.X((o,s)=>{let a=n.store(Jv),c=(function(d){return d.document?new se(He.fromString(d.document.name).popFirst(5)):d.noDocument?se.fromSegments(d.noDocument.path):d.unknownDocument?se.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(()=>$.waitFor(i))}Ci(e,n){let t=n.store(Ki),i=c3(this.serializer),o=new Tp(Iy.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:ke();Wl(this.serializer,c).keys().forEach(d=>u=u.add(d)),a.set(c.userId,u)}),$.forEach(a,(c,l)=>{let u=new tn(l),d=hy.yt(this.serializer,u),f=o.getIndexManager(u),g=py.yt(u,this.serializer,f,o.referenceDelegate);return new Ty(i,g,d,f).recalculateAndSaveOverlaysForDocumentKeys(new op(n,zr.ue),c).next()})})}};function NH(r){r.createObjectStore(Oh,{keyPath:Yie}).createIndex(hM,Qie,{unique:!0}),r.createObjectStore(Nh,{keyPath:"targetId"}).createIndex(rW,Kie,{unique:!0}),r.createObjectStore(Jl)}var Ga="IndexedDbPersistence",Kb=18e5,Yb=5e3,Qb="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.",Yoe="main",fL=class r{constructor(e,n,t,i,o,s,a,c,l,u,d=18){if(this.allowTabSynchronization=e,this.persistenceKey=n,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(),!r.C())throw new Q(W.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new eL(this,i),this.Qi=n+Yoe,this.serializer=new uy(c),this.$i=new Dh(this.Qi,this.Oi,new hL(this.serializer)),this.li=new $w,this.hi=new Xw(this.referenceDelegate,this.serializer),this.remoteDocumentCache=c3(this.serializer),this.Ti=new Gw,this.window&&this.window.localStorage?this.Ui=this.window.localStorage:(this.Ui=null,u===!1&&Wt(Ga,"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(W.FAILED_PRECONDITION,Qb);return this.Wi(),this.Gi(),this.zi(),this.runTransaction("getHighestListenSequenceNumber","readonly",e=>this.hi.getHighestSequenceNumber(e))}).then(e=>{this.ui=new zr(e,this.Mi)}).then(()=>{this.ci=!0}).catch(e=>(this.$i&&this.$i.close(),Promise.reject(e)))}ji(e){return this.qi=n=>I(this,null,function*(){if(this.started)return e(n)}),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=>Fv(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next(()=>{if(this.isPrimary)return this.Ji(e).next(n=>{n||(this.isPrimary=!1,this.Fi.enqueueRetryable(()=>this.qi(!1)))})}).next(()=>this.Hi(e)).next(n=>this.isPrimary&&!n?this.Yi(e).next(()=>!1):!!n&&this.Zi(e).next(()=>!0))).catch(e=>{if(oc(e))return X(Ga,"Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return X(Ga,"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 Gm(e).get(ch).next(n=>$.resolve(this.Xi(n)))}es(e){return Fv(e).delete(this.clientId)}ts(){return I(this,null,function*(){if(this.isPrimary&&!this.ns(this.ki,Kb)){this.ki=Date.now();let e=yield this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",n=>{let t=En(n,bh);return t.j().next(i=>{let o=this.rs(i,Kb),s=i.filter(a=>o.indexOf(a)===-1);return $.forEach(s,a=>t.delete(a.clientId)).next(()=>s)})}).catch(()=>[]);if(this.Ui)for(let n of e)this.Ui.removeItem(this.ss(n.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?$.resolve(!0):Gm(e).get(ch).next(n=>{if(n!==null&&this.ns(n.leaseTimestampMs,Yb)&&!this._s(n.ownerId)){if(this.Xi(n)&&this.networkEnabled)return!0;if(!this.Xi(n)){if(!n.allowTabSynchronization)throw new Q(W.FAILED_PRECONDITION,Qb);return!1}}return!(!this.networkEnabled||!this.inForeground)||Fv(e).j().next(t=>this.rs(t,Yb).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(n=>(this.isPrimary!==n&&X(Ga,`Client ${n?"is":"is not"} eligible for a primary lease.`),n))}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",[Op,bh],e=>{let n=new op(e,zr.ue);return this.Yi(n).next(()=>this.es(n))}),this.$i.close(),this.hs()})}rs(e,n){return e.filter(t=>this.ns(t.updateTimeMs,n)&&!this._s(t.clientId))}Ps(){return this.runTransaction("getActiveClients","readonly",e=>Fv(e).j().next(n=>this.rs(n,Kb).map(t=>t.clientId)))}get started(){return this.ci}getGlobalsCache(){return this.li}getMutationQueue(e,n){return py.yt(e,this.serializer,n,this.referenceDelegate)}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new Qw(e,this.serializer.gt.databaseId)}getDocumentOverlayCache(e){return hy.yt(this.serializer,e)}getBundleCache(){return this.Ti}runTransaction(e,n,t){X(Ga,"Starting transaction:",e);let i=n==="readonly"?"readonly":"readwrite",o=(function(c){return c===18?foe:c===17?uW:c===16?hoe:c===15?mM:c===14?lW:c===13?cW:c===12?doe:c===11?aW:void ae(60245)})(this.Oi),s;return this.$i.runTransaction(e,i,o,a=>(s=new op(a,this.ui?this.ui.next():zr.ue),n==="readwrite-primary"?this.Ji(s).next(c=>!!c||this.Hi(s)).next(c=>{if(!c)throw Wt(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.Fi.enqueueRetryable(()=>this.qi(!1)),new Q(W.FAILED_PRECONDITION,JH);return t(s)}).next(c=>this.Zi(s).next(()=>c)):this.Ts(s).next(()=>t(s)))).then(a=>(s.raiseOnCommittedEvent(),a))}Ts(e){return Gm(e).get(ch).next(n=>{if(n!==null&&this.ns(n.leaseTimestampMs,Yb)&&!this._s(n.ownerId)&&!this.Xi(n)&&!(this.xi||this.allowTabSynchronization&&n.allowTabSynchronization))throw new Q(W.FAILED_PRECONDITION,Qb)})}Zi(e){let n={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return Gm(e).put(ch,n)}static C(){return Dh.C()}Yi(e){let n=Gm(e);return n.get(ch).next(t=>this.Xi(t)?(X(Ga,"Releasing primary lease."),n.delete(ch)):$.resolve())}ns(e,n){let t=Date.now();return!(e<t-n)&&(!(e>t)||(Wt(`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 n=/(?:Version|Mobile)\/1[456]/;eN()&&(navigator.appVersion.match(n)||navigator.userAgent.match(n))&&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 n;try{let t=((n=this.Ui)===null||n===void 0?void 0:n.getItem(this.ss(e)))!==null;return X(Ga,`Client '${e}' ${t?"is":"is not"} zombied in LocalStorage`),t}catch(t){return Wt(Ga,"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){Wt("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 Gm(r){return En(r,Op)}function Fv(r){return En(r,bh)}function l3(r,e){let n=r.projectId;return r.isDefaultDatabase||(n+="."+r.database),"firestore/"+e+"/"+n+"/"}var gL=class r{constructor(e,n,t,i){this.targetId=e,this.fromCache=n,this.Is=t,this.ds=i}static Es(e,n){let t=ke(),i=ke();for(let o of n.docChanges)switch(o.type){case 0:t=t.add(o.doc.key);break;case 1:i=i.add(o.doc.key)}return new r(e,n.fromCache,t,i)}};var mL=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var yy=class{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(function(){return eN()?8:ZH(hn())>0?6:4})()}initialize(e,n){this.gs=e,this.indexManager=n,this.As=!0}getDocumentsMatchingQuery(e,n,t,i){let o={result:null};return this.ps(e,n).next(s=>{o.result=s}).next(()=>{if(!o.result)return this.ys(e,n,i,t).next(s=>{o.result=s})}).next(()=>{if(o.result)return;let s=new mL;return this.ws(e,n,s).next(a=>{if(o.result=a,this.Rs)return this.Ss(e,n,s,a.size)})}).next(()=>o.result)}Ss(e,n,t,i){return t.documentReadCount<this.Vs?(gh()<=Pe.DEBUG&&X("QueryEngine","SDK will not create cache indexes for query:",mh(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),$.resolve()):(gh()<=Pe.DEBUG&&X("QueryEngine","Query:",mh(n),"scans",t.documentReadCount,"local documents and returns",i,"documents as results."),t.documentReadCount>this.fs*i?(gh()<=Pe.DEBUG&&X("QueryEngine","The SDK decides to create cache indexes for query:",mh(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Yr(n))):$.resolve())}ps(e,n){if(Zj(n))return $.resolve(null);let t=Yr(n);return this.indexManager.getIndexType(e,t).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=sy(n,null,"F"),t=Yr(n)),this.indexManager.getDocumentsMatchingTarget(e,t).next(o=>{let s=ke(...o);return this.gs.getDocuments(e,s).next(a=>this.indexManager.getMinOffset(e,t).next(c=>{let l=this.bs(n,a);return this.Ds(n,l,s,c.readTime)?this.ps(e,sy(n,null,"F")):this.vs(e,l,n,c)}))})))}ys(e,n,t,i){return Zj(n)||i.isEqual(Ee.min())?$.resolve(null):this.gs.getDocuments(e,t).next(o=>{let s=this.bs(n,o);return this.Ds(n,s,t,i)?$.resolve(null):(gh()<=Pe.DEBUG&&X("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),mh(n)),this.vs(e,s,n,QH(i,Ah)).next(a=>a))})}bs(e,n){let t=new ot(OW(e));return n.forEach((i,o)=>{Lp(e,o)&&(t=t.add(o))}),t}Ds(e,n,t,i){if(e.limit===null)return!1;if(t.size!==n.size)return!0;let o=e.limitType==="F"?n.last():n.first();return!!o&&(o.hasPendingWrites||o.version.compareTo(i)>0)}ws(e,n,t){return gh()<=Pe.DEBUG&&X("QueryEngine","Using full collection scan to execute query:",mh(n)),this.gs.getDocumentsMatchingQuery(e,n,Ii.min(),t)}vs(e,n,t,i){return this.gs.getDocumentsMatchingQuery(e,t,i).next(o=>(n.forEach(s=>{o=o.insert(s.key,s)}),o))}};var RM="LocalStore",Qoe=3e8,pL=class{constructor(e,n,t,i){this.persistence=e,this.Cs=n,this.serializer=i,this.Fs=new St(De),this.Ms=new Yi(o=>nu(o),bp),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 Ty(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",n=>e.collect(n,this.Fs))}};function u3(r,e,n,t){return new pL(r,e,n,t)}function d3(r,e){return I(this,null,function*(){let n=he(r);return yield n.persistence.runTransaction("Handle user change","readonly",t=>{let i;return n.mutationQueue.getAllMutationBatches(t).next(o=>(i=o,n.Ns(e),n.mutationQueue.getAllMutationBatches(t))).next(o=>{let s=[],a=[],c=ke();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 n.localDocuments.getDocuments(t,c).next(l=>({Bs:l,removedBatchIds:s,addedBatchIds:a}))})})})}function Xoe(r,e){let n=he(r);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",t=>{let i=e.batch.keys(),o=n.Os.newChangeBuffer({trackRemovals:!0});return(function(a,c,l,u){let d=l.batch,f=d.keys(),g=$.resolve();return f.forEach(p=>{g=g.next(()=>u.getEntry(c,p)).next(_=>{let T=l.docVersions.get(p);fe(T!==null,48541),_.version.compareTo(T)<0&&(d.applyToRemoteDocument(_,l),_.isValidDocument()&&(_.setReadTime(l.commitVersion),u.addEntry(_)))})}),g.next(()=>a.mutationQueue.removeMutationBatch(c,d))})(n,t,e,o).next(()=>o.apply(t)).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,(function(a){let c=ke();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(()=>n.localDocuments.getDocuments(t,i))})}function h3(r){let e=he(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.hi.getLastRemoteSnapshotVersion(n))}function Joe(r,e){let n=he(r),t=e.snapshotVersion,i=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",o=>{let s=n.Os.newChangeBuffer({trackRemovals:!0});i=n.Fs;let a=[];e.targetChanges.forEach((u,d)=>{let f=i.get(d);if(!f)return;a.push(n.hi.removeMatchingKeys(o,u.removedDocuments,d).next(()=>n.hi.addMatchingKeys(o,u.addedDocuments,d)));let g=f.withSequenceNumber(o.currentSequenceNumber);e.targetMismatches.get(d)!==null?g=g.withResumeToken(rn.EMPTY_BYTE_STRING,Ee.min()).withLastLimboFreeSnapshotVersion(Ee.min()):u.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(u.resumeToken,t)),i=i.insert(d,g),(function(_,T,D){return _.resumeToken.approximateByteSize()===0||T.snapshotVersion.toMicroseconds()-_.snapshotVersion.toMicroseconds()>=Qoe?!0:D.addedDocuments.size+D.modifiedDocuments.size+D.removedDocuments.size>0})(f,g,u)&&a.push(n.hi.updateTargetData(o,g))});let c=Kr(),l=ke();if(e.documentUpdates.forEach(u=>{e.resolvedLimboDocuments.has(u)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(o,u))}),a.push(Zoe(o,s,e.documentUpdates).next(u=>{c=u.Ls,l=u.ks})),!t.isEqual(Ee.min())){let u=n.hi.getLastRemoteSnapshotVersion(o).next(d=>n.hi.setTargetsMetadata(o,o.currentSequenceNumber,t));a.push(u)}return $.waitFor(a).next(()=>s.apply(o)).next(()=>n.localDocuments.getLocalViewOfDocuments(o,c,l)).next(()=>c)}).then(o=>(n.Fs=i,o))}function Zoe(r,e,n){let t=ke(),i=ke();return n.forEach(o=>t=t.add(o)),e.getEntries(r,t).next(o=>{let s=Kr();return n.forEach((a,c)=>{let l=o.get(a);c.isFoundDocument()!==l.isFoundDocument()&&(i=i.add(a)),c.isNoDocument()&&c.version.isEqual(Ee.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(RM,"Ignoring outdated watch update for ",a,". Current version:",l.version," Watch version:",c.version)}),{Ls:s,ks:i}})}function ese(r,e){let n=he(r);return n.persistence.runTransaction("Get next mutation batch","readonly",t=>(e===void 0&&(e=Xl),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e)))}function Sy(r,e){let n=he(r);return n.persistence.runTransaction("Allocate target","readwrite",t=>{let i;return n.hi.getTargetData(t,e).next(o=>o?(i=o,$.resolve(i)):n.hi.allocateTargetId(t).next(s=>(i=new Uh(e,s,"TargetPurposeListen",t.currentSequenceNumber),n.hi.addTargetData(t,i).next(()=>i))))}).then(t=>{let i=n.Fs.get(t.targetId);return(i===null||t.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(t.targetId,t),n.Ms.set(e,t.targetId)),t})}function Bh(r,e,n){return I(this,null,function*(){let t=he(r),i=t.Fs.get(e),o=n?"readwrite":"readwrite-primary";try{n||(yield t.persistence.runTransaction("Release target",o,s=>t.persistence.referenceDelegate.removeTarget(s,i)))}catch(s){if(!oc(s))throw s;X(RM,`Failed to update sequence numbers for target ${e}: ${s}`)}t.Fs=t.Fs.remove(e),t.Ms.delete(i.target)})}function EL(r,e,n){let t=he(r),i=Ee.min(),o=ke();return t.persistence.runTransaction("Execute query","readwrite",s=>(function(c,l,u){let d=he(c),f=d.Ms.get(u);return f!==void 0?$.resolve(d.Fs.get(f)):d.hi.getTargetData(l,u)})(t,s,Yr(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,n?i:Ee.min(),n?o:ke())).next(a=>(m3(t,NW(e),a),{documents:a,qs:o})))}function f3(r,e){let n=he(r),t=he(n.hi),i=n.Fs.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",o=>t.Et(o,e).next(s=>s?s.target:null))}function g3(r,e){let n=he(r),t=n.xs.get(e)||Ee.min();return n.persistence.runTransaction("Get new document changes","readonly",i=>n.Os.getAllFromCollectionGroup(i,e,QH(t,Ah),Number.MAX_SAFE_INTEGER)).then(i=>(m3(n,e,i),i))}function m3(r,e,n){let t=r.xs.get(e)||Ee.min();n.forEach((i,o)=>{o.readTime.compareTo(t)>0&&(t=o.readTime)}),r.xs.set(e,t)}var p3="firestore_clients";function OH(r,e){return`${p3}_${r}_${e}`}var E3="firestore_mutations";function bH(r,e,n){let t=`${E3}_${r}_${n}`;return e.isAuthenticated()&&(t+=`_${e.uid}`),t}var _3="firestore_targets";function Xb(r,e){return`${_3}_${r}_${e}`}var Bo="SharedClientState",Ay=class r{constructor(e,n,t,i){this.user=e,this.batchId=n,this.state=t,this.error=i}static Ks(e,n,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 r(e,n,i.state,o):(Wt(Bo,`Failed to parse mutation state for ID '${n}': ${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)}},Xm=class r{constructor(e,n,t){this.targetId=e,this.state=n,this.error=t}static Ks(e,n){let t=JSON.parse(n),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 r(e,t.state,i):(Wt(Bo,`Failed to parse target state for ID '${e}': ${n}`),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)}},Ry=class r{constructor(e,n){this.clientId=e,this.activeTargetIds=n}static Ks(e,n){let t=JSON.parse(n),i=typeof t=="object"&&t.activeTargetIds instanceof Array,o=IM();for(let s=0;i&&s<t.activeTargetIds.length;++s)i=eW(t.activeTargetIds[s]),o=o.add(t.activeTargetIds[s]);return i?new r(e,o):(Wt(Bo,`Failed to parse client data for instance '${e}': ${n}`),null)}},_L=class r{constructor(e,n){this.clientId=e,this.onlineState=n}static Ks(e){let n=JSON.parse(e);return typeof n=="object"&&["Unknown","Online","Offline"].indexOf(n.onlineState)!==-1&&typeof n.clientId=="string"?new r(n.clientId,n.onlineState):(Wt(Bo,`Failed to parse online state: ${e}`),null)}},Ip=class{constructor(){this.activeTargetIds=IM()}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)}},Jm=class{constructor(e,n,t,i,o){this.window=e,this.Fi=n,this.persistenceKey=t,this.js=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.Js=this.Hs.bind(this),this.Ys=new St(De),this.started=!1,this.Zs=[];let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=o,this.Xs=OH(this.persistenceKey,this.js),this.eo=(function(c){return`firestore_sequence_number_${c}`})(this.persistenceKey),this.Ys=this.Ys.insert(this.js,new Ip),this.no=new RegExp(`^${p3}_${s}_([^_]*)$`),this.ro=new RegExp(`^${E3}_${s}_(\\d+)(?:_(.*))?$`),this.io=new RegExp(`^${_3}_${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(OH(this.persistenceKey,t));if(i){let o=Ry.Ks(t,i);o&&(this.Ys=this.Ys.insert(o.clientId,o))}}this._o();let n=this.storage.getItem(this.so);if(n){let t=this.ao(n);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 n=!1;return this.Ys.forEach((t,i)=>{i.activeTargetIds.has(e)&&(n=!0)}),n}addPendingMutation(e){this.lo(e,"pending")}updateMutationState(e,n,t){this.lo(e,n,t),this.ho(e)}addLocalQueryTarget(e,n=!0){let t="not-current";if(this.isActiveQueryTarget(e)){let i=this.storage.getItem(Xb(this.persistenceKey,e));if(i){let o=Xm.Ks(e,i);o&&(t=o.state)}}return n&&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(Xb(this.persistenceKey,e))}updateQueryState(e,n,t){this.To(e,n,t)}handleUserChange(e,n,t){n.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 n=this.storage.getItem(e);return X(Bo,"READ",e,n),n}setItem(e,n){X(Bo,"SET",e,n),this.storage.setItem(e,n)}removeItem(e){X(Bo,"REMOVE",e),this.storage.removeItem(e)}Hs(e){let n=e;if(n.storageArea===this.storage){if(X(Bo,"EVENT",n.key,n.newValue),n.key===this.Xs)return void Wt("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(n.key!==null){if(this.no.test(n.key)){if(n.newValue==null){let t=this.Ao(n.key);return this.Ro(t,null)}{let t=this.Vo(n.key,n.newValue);if(t)return this.Ro(t.clientId,t)}}else if(this.ro.test(n.key)){if(n.newValue!==null){let t=this.mo(n.key,n.newValue);if(t)return this.fo(t)}}else if(this.io.test(n.key)){if(n.newValue!==null){let t=this.po(n.key,n.newValue);if(t)return this.yo(t)}}else if(n.key===this.so){if(n.newValue!==null){let t=this.ao(n.newValue);if(t)return this.uo(t)}}else if(n.key===this.eo){let t=(function(o){let s=zr.ue;if(o!=null)try{let a=JSON.parse(o);fe(typeof a=="number",30636,{wo:o}),s=a}catch(a){Wt(Bo,"Failed to read sequence number from WebStorage",a)}return s})(n.newValue);t!==zr.ue&&this.sequenceNumberHandler(t)}else if(n.key===this.oo){let t=this.So(n.newValue);yield Promise.all(t.map(i=>this.syncEngine.bo(i)))}}}else this.Zs.push(n)}))}}get Po(){return this.Ys.get(this.js)}_o(){this.setItem(this.Xs,this.Po.Ws())}lo(e,n,t){let i=new Ay(this.currentUser,e,n,t),o=bH(this.persistenceKey,this.currentUser,e);this.setItem(o,i.Ws())}ho(e){let n=bH(this.persistenceKey,this.currentUser,e);this.removeItem(n)}Io(e){let n={clientId:this.js,onlineState:e};this.storage.setItem(this.so,JSON.stringify(n))}To(e,n,t){let i=Xb(this.persistenceKey,e),o=new Xm(e,n,t);this.setItem(i,o.Ws())}Eo(e){let n=JSON.stringify(Array.from(e));this.setItem(this.oo,n)}Ao(e){let n=this.no.exec(e);return n?n[1]:null}Vo(e,n){let t=this.Ao(e);return Ry.Ks(t,n)}mo(e,n){let t=this.ro.exec(e),i=Number(t[1]),o=t[2]!==void 0?t[2]:null;return Ay.Ks(new tn(o),i,n)}po(e,n){let t=this.io.exec(e),i=Number(t[1]);return Xm.Ks(i,n)}ao(e){return _L.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(Bo,`Ignoring mutation for non-active user ${e.user.uid}`)})}yo(e){return this.syncEngine.vo(e.targetId,e.state,e.error)}Ro(e,n){let t=n?this.Ys.insert(e,n):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 n=IM();return e.forEach((t,i)=>{n=n.unionWith(i.activeTargetIds)}),n}},Dy=class{constructor(){this.Fo=new Ip,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,t){}addLocalQueryTarget(e,n=!0){return n&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,n,t){this.Mo[e]=n}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 Ip,Promise.resolve()}handleUserChange(e,n,t){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var TL=class{xo(e){}shutdown(){}};var wH="ConnectivityMonitor",Cy=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(wH,"Network connectivity changed: AVAILABLE");for(let e of this.ko)e(0)}Lo(){X(wH,"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 kv=null;function IL(){return kv===null?kv=(function(){return 268435456+Math.round(2147483648*Math.random())})():kv++,"0x"+kv.toString(16)}var Jb="RestConnection",tse={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},vL=class{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let n=e.ssl?"https":"http",t=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=n+"://"+e.host,this.Uo=`projects/${t}/databases/${i}`,this.Ko=this.databaseId.database===ap?`project_id=${t}`:`project_id=${t}&database_id=${i}`}Wo(e,n,t,i,o){let s=IL(),a=this.Go(e,n.toUriEncodedString());X(Jb,`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=$r(l);return this.jo(e,a,c,t,u).then(d=>(X(Jb,`Received RPC '${e}' ${s}: `,d),d),d=>{throw ks(Jb,`RPC '${e}' ${s} failed with error: `,d,"url: ",a,"request:",t),d})}Jo(e,n,t,i,o,s){return this.Wo(e,n,t,i,o)}zo(e,n,t){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+qh})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((i,o)=>e[o]=i),t&&t.headers.forEach((i,o)=>e[o]=i)}Go(e,n){let t=tse[e];return`${this.$o}/v1/${n}:${t}`}terminate(){}};var yL=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 Zn="WebChannelConnection",SL=class extends vL{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,n,t,i,o){let s=IL();return new Promise((a,c)=>{let l=new $b;l.setWithCredentials(!0),l.listenOnce(jb.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case km.NO_ERROR:let d=l.getResponseJson();X(Zn,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(d)),a(d);break;case km.TIMEOUT:X(Zn,`RPC '${e}' ${s} timed out`),c(new Q(W.DEADLINE_EXCEEDED,"Request time out"));break;case km.HTTP_ERROR:let f=l.getStatus();if(X(Zn,`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(D){let L=D.toLowerCase().replace(/_/g,"-");return Object.values(W).indexOf(L)>=0?L:W.UNKNOWN})(p.status);c(new Q(_,p.message))}else c(new Q(W.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new Q(W.UNAVAILABLE,"Connection failed."));break;default:ae(9055,{c_:e,streamId:s,l_:l.getLastErrorCode(),h_:l.getLastError()})}}finally{X(Zn,`RPC '${e}' ${s} completed.`)}});let u=JSON.stringify(i);X(Zn,`RPC '${e}' ${s} sending request:`,i),l.send(n,"POST",u,t,15)})}P_(e,n,t){let i=IL(),o=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=zb(),a=Wb(),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,n,t),c.encodeInitMessageHeaders=!0;let u=o.join("");X(Zn,`Creating RPC '${e}' stream ${i}: ${u}`,c);let d=s.createWebChannel(u,c);this.T_(d);let f=!1,g=!1,p=new yL({Ho:T=>{g?X(Zn,`Not sending because RPC '${e}' stream ${i} is closed:`,T):(f||(X(Zn,`Opening RPC '${e}' stream ${i} transport.`),d.open(),f=!0),X(Zn,`RPC '${e}' stream ${i} sending:`,T),d.send(T))},Yo:()=>d.close()}),_=(T,D,L)=>{T.listen(D,B=>{try{L(B)}catch(w){setTimeout(()=>{throw w},0)}})};return _(d,ah.EventType.OPEN,()=>{g||(X(Zn,`RPC '${e}' stream ${i} transport opened.`),p.s_())}),_(d,ah.EventType.CLOSE,()=>{g||(g=!0,X(Zn,`RPC '${e}' stream ${i} transport closed`),p.__(),this.I_(d))}),_(d,ah.EventType.ERROR,T=>{g||(g=!0,ks(Zn,`RPC '${e}' stream ${i} transport errored. Name:`,T.name,"Message:",T.message),p.__(new Q(W.UNAVAILABLE,"The operation could not be completed")))}),_(d,ah.EventType.MESSAGE,T=>{var D;if(!g){let L=T.data[0];fe(!!L,16349);let B=L,w=B?.error||((D=B[0])===null||D===void 0?void 0:D.error);if(w){X(Zn,`RPC '${e}' stream ${i} received error:`,w);let F=w.status,U=(function(N){let b=Zt[N];if(b!==void 0)return GW(b)})(F),A=w.message;U===void 0&&(U=W.INTERNAL,A="Unknown error status: "+F+" with message "+w.message),g=!0,p.__(new Q(U,A)),d.close()}else X(Zn,`RPC '${e}' stream ${i} received:`,L),p.a_(L)}}),_(a,Hb.STAT_EVENT,T=>{T.stat===Lv.PROXY?X(Zn,`RPC '${e}' stream ${i} detected buffering proxy`):T.stat===Lv.NOPROXY&&X(Zn,`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(n=>n===e)}};function T3(){return typeof window<"u"?window:null}function Wv(){return typeof document<"u"?document:null}function Qy(r){return new Fw(r,!0)}var vp=class{constructor(e,n,t=1e3,i=1.5,o=6e4){this.Fi=e,this.timerId=n,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 n=Math.floor(this.R_+this.p_()),t=Math.max(0,Date.now()-this.m_),i=Math.max(0,n-t);i>0&&X("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.R_} ms, delay with jitter: ${n} 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 LH="PersistentStream",Ny=class{constructor(e,n,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 vp(e,n)}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,n){return I(this,null,function*(){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,e!==4?this.F_.reset():n&&n.code===W.RESOURCE_EXHAUSTED?(Wt(n.toString()),Wt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):n&&n.code===W.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_(n)})}U_(){}auth(){this.state=1;let e=this.K_(this.b_),n=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([t,i])=>{this.b_===n&&this.W_(t,i)},t=>{e(()=>{let i=new Q(W.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(i)})})}W_(e,n){let t=this.K_(this.b_);this.stream=this.z_(e,n),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(LH,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return n=>{this.Fi.enqueueAndForget(()=>this.b_===e?n():(X(LH,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},AL=class extends Ny{constructor(e,n,t,i,o,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,t,i,s),this.serializer=o}z_(e,n){return this.connection.P_("Listen",e,n)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();let n=Uoe(this.serializer,e),t=(function(o){if(!("targetChange"in o))return Ee.min();let s=o.targetChange;return s.targetIds&&s.targetIds.length?Ee.min():s.readTime?Nn(s.readTime):Ee.min()})(e);return this.listener.J_(n,t)}H_(e){let n={};n.database=Vw(this.serializer),n.addTarget=(function(o,s){let a,c=s.target;if(a=iy(c)?{documents:qW(o,c)}:{query:SM(o,c).Vt},a.targetId=s.targetId,s.resumeToken.approximateByteSize()>0){a.resumeToken=$W(o,s.resumeToken);let l=kw(o,s.expectedCount);l!==null&&(a.expectedCount=l)}else if(s.snapshotVersion.compareTo(Ee.min())>0){a.readTime=kh(o,s.snapshotVersion.toTimestamp());let l=kw(o,s.expectedCount);l!==null&&(a.expectedCount=l)}return a})(this.serializer,e);let t=Goe(this.serializer,e);t&&(n.labels=t),this.k_(n)}Y_(e){let n={};n.database=Vw(this.serializer),n.removeTarget=e,this.k_(n)}},RL=class extends Ny{constructor(e,n,t,i,o,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,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,n){return this.connection.P_("Write",e,n)}j_(e){return fe(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,fe(!e.writeResults||e.writeResults.length===0,55816),this.listener.ea()}onNext(e){fe(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();let n=Voe(e.writeResults,e.commitTime),t=Nn(e.commitTime);return this.listener.ta(t,n)}na(){let e={};e.database=Vw(this.serializer),this.k_(e)}X_(e){let n={streamToken:this.lastStreamToken,writes:e.map(t=>pp(this.serializer,t))};this.k_(n)}};var DL=class{},CL=class extends DL{constructor(e,n,t,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=t,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new Q(W.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,t,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,s])=>this.connection.Wo(e,Uw(n,t),i,o,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===W.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new Q(W.UNKNOWN,o.toString())})}Jo(e,n,t,i,o){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.Jo(e,Uw(n,t),i,s,a,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===W.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new Q(W.UNKNOWN,s.toString())})}terminate(){this.ra=!0,this.connection.terminate()}},NL=class{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,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 n=`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?(Wt(n),this._a=!1):X("OnlineStateTracker",n)}ha(){this.oa!==null&&(this.oa.cancel(),this.oa=null)}};var cu="RemoteStore",OL=class{constructor(e,n,t,i,o){this.localStore=e,this.datastore=n,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*(){hu(this)&&(X(cu,"Restarting streams for network reachability change."),yield(function(c){return I(this,null,function*(){let l=he(c);l.Ia.add(4),yield Mp(l),l.Aa.set("Unknown"),l.Ia.delete(4),yield Xy(l)})})(this))}))}),this.Aa=new NL(t,i)}};function Xy(r){return I(this,null,function*(){if(hu(r))for(let e of r.da)yield e(!0)})}function Mp(r){return I(this,null,function*(){for(let e of r.da)yield e(!1)})}function Jy(r,e){let n=he(r);n.Ta.has(e.targetId)||(n.Ta.set(e.targetId,e),NM(n)?CM(n):Yh(n).x_()&&DM(n,e))}function Gh(r,e){let n=he(r),t=Yh(n);n.Ta.delete(e),t.x_()&&I3(n,e),n.Ta.size===0&&(t.x_()?t.B_():hu(n)&&n.Aa.set("Unknown"))}function DM(r,e){if(r.Ra.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ee.min())>0){let n=r.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Yh(r).H_(e)}function I3(r,e){r.Ra.$e(e),Yh(r).Y_(e)}function CM(r){r.Ra=new xw({getRemoteKeysForTarget:e=>r.remoteSyncer.getRemoteKeysForTarget(e),Et:e=>r.Ta.get(e)||null,lt:()=>r.datastore.serializer.databaseId}),Yh(r).start(),r.Aa.aa()}function NM(r){return hu(r)&&!Yh(r).M_()&&r.Ta.size>0}function hu(r){return he(r).Ia.size===0}function v3(r){r.Ra=void 0}function nse(r){return I(this,null,function*(){r.Aa.set("Online")})}function rse(r){return I(this,null,function*(){r.Ta.forEach((e,n)=>{DM(r,e)})})}function ise(r,e){return I(this,null,function*(){v3(r),NM(r)?(r.Aa.la(e),CM(r)):r.Aa.set("Unknown")})}function ose(r,e,n){return I(this,null,function*(){if(r.Aa.set("Online"),e instanceof cy&&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))})})(r,e)}catch(t){X(cu,"Failed to remove targets %s: %s ",e.targetIds.join(","),t),yield Oy(r,t)}else if(e instanceof vh?r.Ra.Ye(e):e instanceof ay?r.Ra.it(e):r.Ra.et(e),!n.isEqual(Ee.min()))try{let t=yield h3(r.localStore);n.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(rn.EMPTY_BYTE_STRING,u.snapshotVersion)),I3(o,c);let d=new Uh(u.target,c,l,u.sequenceNumber);DM(o,d)}),o.remoteSyncer.applyRemoteEvent(a)})(r,n))}catch(t){X(cu,"Failed to raise snapshot:",t),yield Oy(r,t)}})}function Oy(r,e,n){return I(this,null,function*(){if(!oc(e))throw e;r.Ia.add(1),yield Mp(r),r.Aa.set("Offline"),n||(n=()=>h3(r.localStore)),r.asyncQueue.enqueueRetryable(()=>I(null,null,function*(){X(cu,"Retrying IndexedDB access"),yield n(),r.Ia.delete(1),yield Xy(r)}))})}function y3(r,e){return e().catch(n=>Oy(r,n,e))}function Kh(r){return I(this,null,function*(){let e=he(r),n=nc(e),t=e.Pa.length>0?e.Pa[e.Pa.length-1].batchId:Xl;for(;sse(e);)try{let i=yield ese(e.localStore,t);if(i===null){e.Pa.length===0&&n.B_();break}t=i.batchId,ase(e,i)}catch(i){yield Oy(e,i)}S3(e)&&A3(e)})}function sse(r){return hu(r)&&r.Pa.length<10}function ase(r,e){r.Pa.push(e);let n=nc(r);n.x_()&&n.Z_&&n.X_(e.mutations)}function S3(r){return hu(r)&&!nc(r).M_()&&r.Pa.length>0}function A3(r){nc(r).start()}function cse(r){return I(this,null,function*(){nc(r).na()})}function lse(r){return I(this,null,function*(){let e=nc(r);for(let n of r.Pa)e.X_(n.mutations)})}function use(r,e,n){return I(this,null,function*(){let t=r.Pa.shift(),i=ww.from(t,e,n);yield y3(r,()=>r.remoteSyncer.applySuccessfulWrite(i)),yield Kh(r)})}function dse(r,e){return I(this,null,function*(){e&&nc(r).Z_&&(yield(function(t,i){return I(this,null,function*(){if((function(s){return BW(s)&&s!==W.ABORTED})(i.code)){let o=t.Pa.shift();nc(t).N_(),yield y3(t,()=>t.remoteSyncer.rejectFailedWrite(o.batchId,i)),yield Kh(t)}})})(r,e)),S3(r)&&A3(r)})}function MH(r,e){return I(this,null,function*(){let n=he(r);n.asyncQueue.verifyOperationInProgress(),X(cu,"RemoteStore received new credentials");let t=hu(n);n.Ia.add(3),yield Mp(n),t&&n.Aa.set("Unknown"),yield n.remoteSyncer.handleCredentialChange(e),n.Ia.delete(3),yield Xy(n)})}function bL(r,e){return I(this,null,function*(){let n=he(r);e?(n.Ia.delete(2),yield Xy(n)):e||(n.Ia.add(2),yield Mp(n),n.Aa.set("Unknown"))})}function Yh(r){return r.Va||(r.Va=(function(n,t,i){let o=he(n);return o.ia(),new AL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(r.datastore,r.asyncQueue,{Zo:nse.bind(null,r),e_:rse.bind(null,r),n_:ise.bind(null,r),J_:ose.bind(null,r)}),r.da.push(e=>I(null,null,function*(){e?(r.Va.N_(),NM(r)?CM(r):r.Aa.set("Unknown")):(yield r.Va.stop(),v3(r))}))),r.Va}function nc(r){return r.ma||(r.ma=(function(n,t,i){let o=he(n);return o.ia(),new RL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(r.datastore,r.asyncQueue,{Zo:()=>Promise.resolve(),e_:cse.bind(null,r),n_:dse.bind(null,r),ea:lse.bind(null,r),ta:use.bind(null,r)}),r.da.push(e=>I(null,null,function*(){e?(r.ma.N_(),yield Kh(r)):(yield r.ma.stop(),r.Pa.length>0&&(X(cu,`Stopping write stream with ${r.Pa.length} pending writes`),r.Pa=[]))}))),r.ma}var wL=class r{constructor(e,n,t,i,o){this.asyncQueue=e,this.timerId=n,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,n,t,i,o){let s=Date.now()+t,a=new r(e,n,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(W.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 OM(r,e){if(Wt("AsyncQueue",`${e}: ${r}`),oc(r))return new Q(W.UNAVAILABLE,`${e}: ${r}`);throw r}var by=class r{static emptySet(e){return new r(e.comparator)}constructor(e){this.comparator=e?(n,t)=>e(n,t)||se.comparator(n.key,t.key):(n,t)=>se.comparator(n.key,t.key),this.keyedMap=$m(),this.sortedSet=new St(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 n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,t)=>(e(n),!1))}add(e){let n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){let n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof r)||this.size!==e.size)return!1;let n=this.sortedSet.getIterator(),t=e.sortedSet.getIterator();for(;n.hasNext();){let i=n.getNext().key,o=t.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){let e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
164
- `+e.join(`
165
- `)+`
166
- )`}copy(e,n){let t=new r;return t.comparator=this.comparator,t.keyedMap=e,t.sortedSet=n,t}};var wy=class{constructor(){this.fa=new St(se.comparator)}track(e){let n=e.doc.key,t=this.fa.get(n);t?e.type!==0&&t.type===3?this.fa=this.fa.insert(n,e):e.type===3&&t.type!==1?this.fa=this.fa.insert(n,{type:t.type,doc:e.doc}):e.type===2&&t.type===2?this.fa=this.fa.insert(n,{type:2,doc:e.doc}):e.type===2&&t.type===0?this.fa=this.fa.insert(n,{type:0,doc:e.doc}):e.type===1&&t.type===0?this.fa=this.fa.remove(n):e.type===1&&t.type===2?this.fa=this.fa.insert(n,{type:1,doc:t.doc}):e.type===0&&t.type===1?this.fa=this.fa.insert(n,{type:2,doc:e.doc}):ae(63341,{At:e,ga:t}):this.fa=this.fa.insert(n,e)}pa(){let e=[];return this.fa.inorderTraversal((n,t)=>{e.push(t)}),e}},$h=class r{constructor(e,n,t,i,o,s,a,c,l){this.query=e,this.docs=n,this.oldDocs=t,this.docChanges=i,this.mutatedKeys=o,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,n,t,i,o){let s=[];return n.forEach(a=>{s.push({type:0,doc:a})}),new r(e,n,by.emptySet(n),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)&&Yy(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let n=this.docChanges,t=e.docChanges;if(n.length!==t.length)return!1;for(let i=0;i<n.length;i++)if(n[i].type!==t[i].type||!n[i].doc.isEqual(t[i].doc))return!1;return!0}};var LL=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}},ML=class{constructor(){this.queries=PH(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(n,t){let i=he(n),o=i.queries;i.queries=PH(),o.forEach((s,a)=>{for(let c of a.wa)c.onError(t)})})(this,new Q(W.ABORTED,"Firestore shutting down"))}};function PH(){return new Yi(r=>CW(r),Yy)}function bM(r,e){return I(this,null,function*(){let n=he(r),t=3,i=e.query,o=n.queries.get(i);o?!o.Sa()&&e.ba()&&(t=2):(o=new LL,t=e.ba()?0:1);try{switch(t){case 0:o.ya=yield n.onListen(i,!0);break;case 1:o.ya=yield n.onListen(i,!1);break;case 2:yield n.onFirstRemoteStoreListen(i)}}catch(s){let a=OM(s,`Initialization of query '${mh(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,o),o.wa.push(e),e.va(n.onlineState),o.ya&&e.Ca(o.ya)&&LM(n)})}function wM(r,e){return I(this,null,function*(){let n=he(r),t=e.query,i=3,o=n.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 n.queries.delete(t),n.onUnlisten(t,!0);case 1:return n.queries.delete(t),n.onUnlisten(t,!1);case 2:return n.onLastRemoteStoreUnlisten(t);default:return}})}function hse(r,e){let n=he(r),t=!1;for(let i of e){let o=i.query,s=n.queries.get(o);if(s){for(let a of s.wa)a.Ca(i)&&(t=!0);s.ya=i}}t&&LM(n)}function fse(r,e,n){let t=he(r),i=t.queries.get(e);if(i)for(let o of i.wa)o.onError(n);t.queries.delete(e)}function LM(r){r.Da.forEach(e=>{e.next()})}var PL,xH;(xH=PL||(PL={})).Fa="default",xH.Cache="cache";var yp=class{constructor(e,n,t){this.query=e,this.Ma=n,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 $h(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),n=!0):this.Ba(e,this.onlineState)&&(this.La(e),n=!0),this.Oa=e,n}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let n=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),n=!0),n}Ba(e,n){if(!e.fromCache||!this.ba())return!0;let t=n!=="Offline";return(!this.options.ka||!t)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Na(e){if(e.docChanges.length>0)return!0;let n=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}La(e){e=$h.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==PL.Cache}};var Ly=class{constructor(e){this.key=e}},My=class{constructor(e){this.key=e}},xL=class{constructor(e,n){this.query=e,this.Ha=n,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=ke(),this.mutatedKeys=ke(),this.Xa=OW(e),this.eu=new by(this.Xa)}get tu(){return this.Ha}nu(e,n){let t=n?n.ru:new wy,i=n?n.eu:this.eu,o=n?n.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=Lp(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,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,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=n&&!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 $h(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 wy,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(n=>this.Ha=this.Ha.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ha=this.Ha.delete(n)),this.current=e.current)}ou(){if(!this.current)return[];let e=this.Za;this.Za=ke(),this.eu.forEach(t=>{this.au(t.key)&&(this.Za=this.Za.add(t.key))});let n=[];return e.forEach(t=>{this.Za.has(t)||n.push(new My(t))}),this.Za.forEach(t=>{e.has(t)||n.push(new Ly(t))}),n}uu(e){this.Ha=e.qs,this.Za=ke();let n=this.nu(e.documents);return this.applyChanges(n,!0)}cu(){return $h.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},Qh="SyncEngine",FL=class{constructor(e,n,t){this.query=e,this.targetId=n,this.view=t}},kL=class{constructor(e){this.key=e,this.lu=!1}},UL=class{constructor(e,n,t,i,o,s){this.localStore=e,this.remoteStore=n,this.eventManager=t,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new Yi(a=>CW(a),Yy),this.Tu=new Map,this.Iu=new Set,this.du=new St(se.comparator),this.Eu=new Map,this.Au=new _p,this.Ru={},this.Vu=new Map,this.mu=Vh.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function gse(r,e,n=!0){return I(this,null,function*(){let t=Zy(r),i,o=t.Pu.get(e);return o?(t.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield R3(t,e,n,!0),i})}function mse(r,e){return I(this,null,function*(){let n=Zy(r);yield R3(n,e,!0,!1)})}function R3(r,e,n,t){return I(this,null,function*(){let i=yield Sy(r.localStore,Yr(e)),o=i.targetId,s=r.sharedClientState.addLocalQueryTarget(o,n),a;return t&&(a=yield MM(r,e,o,s==="current",i.resumeToken)),r.isPrimaryClient&&n&&Jy(r.remoteStore,i),a})}function MM(r,e,n,t,i){return I(this,null,function*(){r.gu=(d,f,g)=>(function(_,T,D,L){return I(this,null,function*(){let B=T.view.nu(D);B.Ds&&(B=yield EL(_.localStore,T.query,!1).then(({documents:A})=>T.view.nu(A,B)));let w=L&&L.targetChanges.get(T.targetId),F=L&&L.targetMismatches.get(T.targetId)!=null,U=T.view.applyChanges(B,_.isPrimaryClient,w,F);return VL(_,T.targetId,U._u),U.snapshot})})(r,d,f,g);let o=yield EL(r.localStore,e,!0),s=new xL(e,o.qs),a=s.nu(o.documents),c=gp.createSynthesizedTargetChangeForCurrentChange(n,t&&r.onlineState!=="Offline",i),l=s.applyChanges(a,r.isPrimaryClient,c);VL(r,n,l._u);let u=new FL(e,n,s);return r.Pu.set(e,u),r.Tu.has(n)?r.Tu.get(n).push(e):r.Tu.set(n,[e]),l.snapshot})}function pse(r,e,n){return I(this,null,function*(){let t=he(r),i=t.Pu.get(e),o=t.Tu.get(i.targetId);if(o.length>1)return t.Tu.set(i.targetId,o.filter(s=>!Yy(s,e))),void t.Pu.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(i.targetId),t.sharedClientState.isActiveQueryTarget(i.targetId)||(yield Bh(t.localStore,i.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(i.targetId),n&&Gh(t.remoteStore,i.targetId),jh(t,i.targetId)}).catch(ic))):(jh(t,i.targetId),yield Bh(t.localStore,i.targetId,!0))})}function Ese(r,e){return I(this,null,function*(){let n=he(r),t=n.Pu.get(e),i=n.Tu.get(t.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(t.targetId),Gh(n.remoteStore,t.targetId))})}function _se(r,e,n){return I(this,null,function*(){let t=kM(r);try{let i=yield(function(s,a){let c=he(s),l=wt.now(),u=a.reduce((g,p)=>g.add(p.key),ke()),d,f;return c.persistence.runTransaction("Locally write mutations","readwrite",g=>{let p=Kr(),_=ke();return c.Os.getEntries(g,u).next(T=>{p=T,p.forEach((D,L)=>{L.isValidDocument()||(_=_.add(D))})}).next(()=>c.localDocuments.getOverlayedDocuments(g,p)).next(T=>{d=T;let D=[];for(let L of a){let B=boe(L,d.get(L.key).overlayedDocument);B!=null&&D.push(new Qi(L.key,B,TW(B.value.mapValue),Vn.exists(!0)))}return c.mutationQueue.addMutationBatch(g,l,D,a)}).next(T=>{f=T;let D=T.applyToLocalDocumentSet(d,_);return c.documentOverlayCache.saveOverlays(g,T.batchId,D)})}).then(()=>({batchId:f.batchId,changes:wW(d)}))})(t.localStore,e);t.sharedClientState.addPendingMutation(i.batchId),(function(s,a,c){let l=s.Ru[s.currentUser.toKey()];l||(l=new St(De)),l=l.insert(a,c),s.Ru[s.currentUser.toKey()]=l})(t,i.batchId,n),yield ac(t,i.changes),yield Kh(t.remoteStore)}catch(i){let o=OM(i,"Failed to persist write");n.reject(o)}})}function D3(r,e){return I(this,null,function*(){let n=he(r);try{let t=yield Joe(n.localStore,e);e.targetChanges.forEach((i,o)=>{let s=n.Eu.get(o);s&&(fe(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?s.lu=!0:i.modifiedDocuments.size>0?fe(s.lu,14607):i.removedDocuments.size>0&&(fe(s.lu,42227),s.lu=!1))}),yield ac(n,t,e)}catch(t){yield ic(t)}})}function FH(r,e,n){let t=he(r);if(t.isPrimaryClient&&n===0||!t.isPrimaryClient&&n===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=he(s);c.onlineState=a;let l=!1;c.queries.forEach((u,d)=>{for(let f of d.wa)f.va(a)&&(l=!0)}),l&&LM(c)})(t.eventManager,e),i.length&&t.hu.J_(i),t.onlineState=e,t.isPrimaryClient&&t.sharedClientState.setOnlineState(e)}}function Tse(r,e,n){return I(this,null,function*(){let t=he(r);t.sharedClientState.updateQueryState(e,"rejected",n);let i=t.Eu.get(e),o=i&&i.key;if(o){let s=new St(se.comparator);s=s.insert(o,mn.newNoDocument(o,Ee.min()));let a=ke().add(o),c=new fp(Ee.min(),new Map,new St(De),s,a);yield D3(t,c),t.du=t.du.remove(o),t.Eu.delete(e),FM(t)}else yield Bh(t.localStore,e,!1).then(()=>jh(t,e,n)).catch(ic)})}function Ise(r,e){return I(this,null,function*(){let n=he(r),t=e.batch.batchId;try{let i=yield Xoe(n.localStore,e);xM(n,t,null),PM(n,t),n.sharedClientState.updateMutationState(t,"acknowledged"),yield ac(n,i)}catch(i){yield ic(i)}})}function vse(r,e,n){return I(this,null,function*(){let t=he(r);try{let i=yield(function(s,a){let c=he(s);return c.persistence.runTransaction("Reject batch","readwrite-primary",l=>{let u;return c.mutationQueue.lookupMutationBatch(l,a).next(d=>(fe(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);xM(t,e,n),PM(t,e),t.sharedClientState.updateMutationState(e,"rejected",n),yield ac(t,i)}catch(i){yield ic(i)}})}function PM(r,e){(r.Vu.get(e)||[]).forEach(n=>{n.resolve()}),r.Vu.delete(e)}function xM(r,e,n){let t=he(r),i=t.Ru[t.currentUser.toKey()];if(i){let o=i.get(e);o&&(n?o.reject(n):o.resolve(),i=i.remove(e)),t.Ru[t.currentUser.toKey()]=i}}function jh(r,e,n=null){r.sharedClientState.removeLocalQueryTarget(e);for(let t of r.Tu.get(e))r.Pu.delete(t),n&&r.hu.pu(t,n);r.Tu.delete(e),r.isPrimaryClient&&r.Au.zr(e).forEach(t=>{r.Au.containsKey(t)||C3(r,t)})}function C3(r,e){r.Iu.delete(e.path.canonicalString());let n=r.du.get(e);n!==null&&(Gh(r.remoteStore,n),r.du=r.du.remove(e),r.Eu.delete(n),FM(r))}function VL(r,e,n){for(let t of n)t instanceof Ly?(r.Au.addReference(t.key,e),yse(r,t)):t instanceof My?(X(Qh,"Document no longer in limbo: "+t.key),r.Au.removeReference(t.key,e),r.Au.containsKey(t.key)||C3(r,t.key)):ae(19791,{yu:t})}function yse(r,e){let n=e.key,t=n.path.canonicalString();r.du.get(n)||r.Iu.has(t)||(X(Qh,"New document in limbo: "+n),r.Iu.add(t),FM(r))}function FM(r){for(;r.Iu.size>0&&r.du.size<r.maxConcurrentLimboResolutions;){let e=r.Iu.values().next().value;r.Iu.delete(e);let n=new se(He.fromString(e)),t=r.mu.next();r.Eu.set(t,new kL(n)),r.du=r.du.insert(n,t),Jy(r.remoteStore,new Uh(Yr(wp(n.path)),t,"TargetPurposeLimboResolution",zr.ue))}}function ac(r,e,n){return I(this,null,function*(){let t=he(r),i=[],o=[],s=[];t.Pu.isEmpty()||(t.Pu.forEach((a,c)=>{s.push(t.gu(c,e,n).then(l=>{var u;if((l||n)&&t.isPrimaryClient){let d=l?!l.fromCache:(u=n?.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=gL.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=he(c);try{yield u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>$.forEach(l,f=>$.forEach(f.Is,g=>u.persistence.referenceDelegate.addReference(d,f.targetId,g)).next(()=>$.forEach(f.ds,g=>u.persistence.referenceDelegate.removeReference(d,f.targetId,g)))))}catch(d){if(!oc(d))throw d;X(RM,"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 Sse(r,e){return I(this,null,function*(){let n=he(r);if(!n.currentUser.isEqual(e)){X(Qh,"User change. New user:",e.toKey());let t=yield d3(n.localStore,e);n.currentUser=e,(function(o,s){o.Vu.forEach(a=>{a.forEach(c=>{c.reject(new Q(W.CANCELLED,s))})}),o.Vu.clear()})(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),yield ac(n,t.Bs)}})}function Ase(r,e){let n=he(r),t=n.Eu.get(e);if(t&&t.lu)return ke().add(t.key);{let i=ke(),o=n.Tu.get(e);if(!o)return i;for(let s of o){let a=n.Pu.get(s);i=i.unionWith(a.view.tu)}return i}}function Rse(r,e){return I(this,null,function*(){let n=he(r),t=yield EL(n.localStore,e.query,!0),i=e.view.uu(t);return n.isPrimaryClient&&VL(n,e.targetId,i._u),i})}function Dse(r,e){return I(this,null,function*(){let n=he(r);return g3(n.localStore,e).then(t=>ac(n,t))})}function Cse(r,e,n,t){return I(this,null,function*(){let i=he(r),o=yield(function(a,c){let l=he(a),u=he(l.mutationQueue);return l.persistence.runTransaction("Lookup mutation documents","readonly",d=>u.Xn(d,c).next(f=>f?l.localDocuments.getDocuments(d,f):$.resolve(null)))})(i.localStore,e);o!==null?(n==="pending"?yield Kh(i.remoteStore):n==="acknowledged"||n==="rejected"?(xM(i,e,t||null),PM(i,e),(function(a,c){he(he(a).mutationQueue).rr(c)})(i.localStore,e)):ae(6720,"Unknown batchState",{wu:n}),yield ac(i,o)):X(Qh,"Cannot apply mutation batch with id: "+e)})}function Nse(r,e){return I(this,null,function*(){let n=he(r);if(Zy(n),kM(n),e===!0&&n.fu!==!0){let t=n.sharedClientState.getAllActiveQueryTargets(),i=yield kH(n,t.toArray());n.fu=!0,yield bL(n.remoteStore,!0);for(let o of i)Jy(n.remoteStore,o)}else if(e===!1&&n.fu!==!1){let t=[],i=Promise.resolve();n.Tu.forEach((o,s)=>{n.sharedClientState.isLocalQueryTarget(s)?t.push(s):i=i.then(()=>(jh(n,s),Bh(n.localStore,s,!0))),Gh(n.remoteStore,s)}),yield i,yield kH(n,t),(function(s){let a=he(s);a.Eu.forEach((c,l)=>{Gh(a.remoteStore,l)}),a.Au.jr(),a.Eu=new Map,a.du=new St(se.comparator)})(n),n.fu=!1,yield bL(n.remoteStore,!1)}})}function kH(r,e,n){return I(this,null,function*(){let t=he(r),i=[],o=[];for(let s of e){let a,c=t.Tu.get(s);if(c&&c.length!==0){a=yield Sy(t.localStore,Yr(c[0]));for(let l of c){let u=t.Pu.get(l),d=yield Rse(t,u);d.snapshot&&o.push(d.snapshot)}}else{let l=yield f3(t.localStore,s);a=yield Sy(t.localStore,l),yield MM(t,N3(l),s,!1,a.resumeToken)}i.push(a)}return t.hu.J_(o),i})}function N3(r){return RW(r.path,r.collectionGroup,r.orderBy,r.filters,r.limit,"F",r.startAt,r.endAt)}function Ose(r){return(function(n){return he(he(n).persistence).Ps()})(he(r).localStore)}function bse(r,e,n,t){return I(this,null,function*(){let i=he(r);if(i.fu)return void X(Qh,"Ignoring unexpected query state notification.");let o=i.Tu.get(e);if(o&&o.length>0)switch(n){case"current":case"not-current":{let s=yield g3(i.localStore,NW(o[0])),a=fp.createSynthesizedRemoteEventForCurrentChange(e,n==="current",rn.EMPTY_BYTE_STRING);yield ac(i,s,a);break}case"rejected":yield Bh(i.localStore,e,!0),jh(i,e,t);break;default:ae(64155,n)}})}function wse(r,e,n){return I(this,null,function*(){let t=Zy(r);if(t.fu){for(let i of e){if(t.Tu.has(i)&&t.sharedClientState.isActiveQueryTarget(i)){X(Qh,"Adding an already active target "+i);continue}let o=yield f3(t.localStore,i),s=yield Sy(t.localStore,o);yield MM(t,N3(o),s.targetId,!1,s.resumeToken),Jy(t.remoteStore,s)}for(let i of n)t.Tu.has(i)&&(yield Bh(t.localStore,i,!1).then(()=>{Gh(t.remoteStore,i),jh(t,i)}).catch(ic))}})}function Zy(r){let e=he(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=D3.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ase.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Tse.bind(null,e),e.hu.J_=hse.bind(null,e.eventManager),e.hu.pu=fse.bind(null,e.eventManager),e}function kM(r){let e=he(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Ise.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=vse.bind(null,e),e}var UM=(()=>{class r{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(n){return I(this,null,function*(){this.serializer=Qy(n.databaseInfo.databaseId),this.sharedClientState=this.bu(n),this.persistence=this.Du(n),yield this.persistence.start(),this.localStore=this.vu(n),this.gcScheduler=this.Cu(n,this.localStore),this.indexBackfillerScheduler=this.Fu(n,this.localStore)})}Cu(n,t){return null}Fu(n,t){return null}vu(n){return u3(this.persistence,new yy,n.initialUser,this.serializer)}Du(n){return new Tp(Iy.Vi,this.serializer)}bu(n){return new Dy}terminate(){return I(this,null,function*(){var n,t;(n=this.gcScheduler)===null||n===void 0||n.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return r.provider={build:()=>new r},r})(),BL=class extends UM{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,n){fe(this.persistence.referenceDelegate instanceof vy,46915);let t=this.persistence.referenceDelegate.garbageCollector;return new Ey(t,e.asyncQueue,n)}Du(e){let n=this.cacheSizeBytes!==void 0?Cr.withCacheSize(this.cacheSizeBytes):Cr.DEFAULT;return new Tp(t=>vy.Vi(t,n),this.serializer)}},Py=class r extends UM{constructor(e,n,t){super(),this.Mu=e,this.cacheSizeBytes=n,this.forceOwnership=t,this.kind="persistent",this.synchronizeTabs=!1}initialize(e){return I(this,null,function*(){yield Rc(r.prototype,this,"initialize").call(this,e),yield this.Mu.initialize(this,e),yield kM(this.Mu.syncEngine),yield Kh(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 u3(this.persistence,new yy,e.initialUser,this.serializer)}Cu(e,n){let t=this.persistence.referenceDelegate.garbageCollector;return new Ey(t,e.asyncQueue,n)}Fu(e,n){let t=new dw(n,this.persistence);return new uw(e.asyncQueue,t)}Du(e){let n=l3(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),t=this.cacheSizeBytes!==void 0?Cr.withCacheSize(this.cacheSizeBytes):Cr.DEFAULT;return new fL(this.synchronizeTabs,n,e.clientId,t,e.asyncQueue,T3(),Wv(),this.serializer,this.sharedClientState,!!this.forceOwnership)}bu(e){return new Dy}},GL=class r extends Py{constructor(e,n){super(e,n,!1),this.Mu=e,this.cacheSizeBytes=n,this.synchronizeTabs=!0}initialize(e){return I(this,null,function*(){yield Rc(r.prototype,this,"initialize").call(this,e);let n=this.Mu.syncEngine;this.sharedClientState instanceof Jm&&(this.sharedClientState.syncEngine={Do:Cse.bind(null,n),vo:bse.bind(null,n),Co:wse.bind(null,n),Ps:Ose.bind(null,n),bo:Dse.bind(null,n)},yield this.sharedClientState.start()),yield this.persistence.ji(t=>I(this,null,function*(){yield Nse(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 n=T3();if(!Jm.C(n))throw new Q(W.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let t=l3(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Jm(n,e.asyncQueue,t,e.clientId,e.initialUser)}},VM=(()=>{class r{initialize(n,t){return I(this,null,function*(){this.localStore||(this.localStore=n.localStore,this.sharedClientState=n.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!n.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>FH(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=Sse.bind(null,this.syncEngine),yield bL(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(n){return(function(){return new ML})()}createDatastore(n){let t=Qy(n.databaseInfo.databaseId),i=(function(s){return new SL(s)})(n.databaseInfo);return(function(s,a,c,l){return new CL(s,a,c,l)})(n.authCredentials,n.appCheckCredentials,i,t)}createRemoteStore(n){return(function(i,o,s,a,c){return new OL(i,o,s,a,c)})(this.localStore,this.datastore,n.asyncQueue,t=>FH(this.syncEngine,t,0),(function(){return Cy.C()?new Cy:new TL})())}createSyncEngine(n,t){return(function(o,s,a,c,l,u,d){let f=new UL(o,s,a,c,l,u);return d&&(f.fu=!0),f})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,n.initialUser,n.maxConcurrentLimboResolutions,t)}terminate(){return I(this,null,function*(){var n,t;yield(function(o){return I(this,null,function*(){let s=he(o);X(cu,"RemoteStore shutting down."),s.Ia.add(5),yield Mp(s),s.Ea.shutdown(),s.Aa.set("Unknown")})})(this.remoteStore),(n=this.datastore)===null||n===void 0||n.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()})}}return r.provider={build:()=>new r},r})();var Sp=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):Wt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,n){setTimeout(()=>{this.muted||e(n)},0)}};var $L=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(W.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let n=yield(function(i,o){return I(this,null,function*(){let s=he(i),a={documents:o.map(d=>mp(s.serializer,d))},c=yield s.Jo("BatchGetDocuments",s.serializer.databaseId,He.emptyPath(),a,o.length),l=new Map;c.forEach(d=>{let f=koe(s.serializer,d);l.set(f.key.toString(),f)});let u=[];return o.forEach(d=>{let f=l.get(d.toString());fe(!!f,55234,{key:d}),u.push(f)}),u})})(this.datastore,e);return n.forEach(t=>this.recordVersion(t)),n})}set(e,n){this.write(n.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,n){try{this.write(n.toMutation(e,this.preconditionForUpdate(e)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(e.toString())}delete(e){this.write(new ou(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(n=>{e.delete(n.key.toString())}),e.forEach((n,t)=>{let i=se.fromPath(t);this.mutations.push(new up(i,this.precondition(i)))}),yield(function(t,i){return I(this,null,function*(){let o=he(t),s={writes:i.map(a=>pp(o.serializer,a))};yield o.Wo("Commit",o.serializer.databaseId,He.emptyPath(),s)})})(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let n;if(e.isFoundDocument())n=e.version;else{if(!e.isNoDocument())throw ae(50498,{Wu:e.constructor.name});n=Ee.min()}let t=this.readVersions.get(e.key.toString());if(t){if(!n.isEqual(t))throw new Q(W.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),n)}precondition(e){let n=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&n?n.isEqual(Ee.min())?Vn.exists(!1):Vn.updateTime(n):Vn.none()}preconditionForUpdate(e){let n=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&n){if(n.isEqual(Ee.min()))throw new Q(W.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Vn.updateTime(n)}return Vn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var jL=class{constructor(e,n,t,i,o){this.asyncQueue=e,this.datastore=n,this.options=t,this.updateFunction=i,this.deferred=o,this.Gu=t.maxAttempts,this.F_=new vp(this.asyncQueue,"transaction_retry")}zu(){this.Gu-=1,this.ju()}ju(){this.F_.g_(()=>I(this,null,function*(){let e=new $L(this.datastore),n=this.Ju(e);n&&n.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 n=this.updateFunction(e);return!Np(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(n){return this.deferred.reject(n),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 n=e.code;return n==="aborted"||n==="failed-precondition"||n==="already-exists"||!BW(n)}return!1}};var rc="FirestoreClient",HL=class{constructor(e,n,t,i,o){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=t,this.databaseInfo=i,this.user=tn.UNAUTHENTICATED,this.clientId=Zm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(t,s=>I(this,null,function*(){X(rc,"Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(t,s=>(X(rc,"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(n){let t=OM(n,"Failed to shutdown persistence");e.reject(t)}})),e.promise}};function Zb(r,e){return I(this,null,function*(){r.asyncQueue.verifyOperationInProgress(),X(rc,"Initializing OfflineComponentProvider");let n=r.configuration;yield e.initialize(n);let t=n.initialUser;r.setCredentialChangeListener(i=>I(null,null,function*(){t.isEqual(i)||(yield d3(e.localStore,i),t=i)})),e.persistence.setDatabaseDeletedListener(()=>{ks("Terminating Firestore due to IndexedDb database deletion"),r.terminate().then(()=>{X("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{ks("Terminating Firestore due to IndexedDb database deletion failed",i)})}),r._offlineComponents=e})}function UH(r,e){return I(this,null,function*(){r.asyncQueue.verifyOperationInProgress();let n=yield Lse(r);X(rc,"Initializing OnlineComponentProvider"),yield e.initialize(n,r.configuration),r.setCredentialChangeListener(t=>MH(e.remoteStore,t)),r.setAppCheckTokenChangeListener((t,i)=>MH(e.remoteStore,i)),r._onlineComponents=e})}function Lse(r){return I(this,null,function*(){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){X(rc,"Using user provided OfflineComponentProvider");try{yield Zb(r,r._uninitializedComponentsProvider._offline)}catch(e){let n=e;if(!(function(i){return i.name==="FirebaseError"?i.code===W.FAILED_PRECONDITION||i.code===W.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(n))throw n;ks("Error using user provided cache. Falling back to memory cache: "+n),yield Zb(r,new UM)}}else X(rc,"Using default OfflineComponentProvider"),yield Zb(r,new BL(void 0));return r._offlineComponents})}function BM(r){return I(this,null,function*(){return r._onlineComponents||(r._uninitializedComponentsProvider?(X(rc,"Using user provided OnlineComponentProvider"),yield UH(r,r._uninitializedComponentsProvider._online)):(X(rc,"Using default OnlineComponentProvider"),yield UH(r,new VM))),r._onlineComponents})}function Mse(r){return BM(r).then(e=>e.syncEngine)}function O3(r){return BM(r).then(e=>e.datastore)}function xy(r){return I(this,null,function*(){let e=yield BM(r),n=e.eventManager;return n.onListen=gse.bind(null,e.syncEngine),n.onUnlisten=pse.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=mse.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=Ese.bind(null,e.syncEngine),n})}function Pse(r,e,n={}){let t=new Nr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new Sp({next:f=>{u.Ou(),s.enqueueAndForget(()=>wM(o,d));let g=f.docs.has(a);!g&&f.fromCache?l.reject(new Q(W.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&c&&c.source==="server"?l.reject(new Q(W.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 yp(wp(a.path),u,{includeMetadataChanges:!0,ka:!0});return bM(o,d)})(yield xy(r),r.asyncQueue,e,n,t)})),t.promise}function xse(r,e,n={}){let t=new Nr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new Sp({next:f=>{u.Ou(),s.enqueueAndForget(()=>wM(o,d)),f.fromCache&&c.source==="server"?l.reject(new Q(W.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 yp(a,u,{includeMetadataChanges:!0,ka:!0});return bM(o,d)})(yield xy(r),r.asyncQueue,e,n,t)})),t.promise}function Fse(r,e,n){let t=new Nr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){try{let i=yield O3(r);t.resolve((function(s,a,c){return I(this,null,function*(){var l;let u=he(s),{request:d,ft:f,parent:g}=Boe(u.serializer,Toe(a),c);u.connection.Qo||delete d.parent;let p=(yield u.Jo("RunAggregationQuery",u.serializer.databaseId,g,d,1)).filter(T=>!!T.result);fe(p.length===1,64727);let _=(l=p[0].result)===null||l===void 0?void 0:l.aggregateFields;return Object.keys(_).reduce((T,D)=>(T[f[D]]=_[D],T),{})})})(i,e,n))}catch(i){t.reject(i)}})),t.promise}function b3(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}var VH=new Map;var w3="firestore.googleapis.com",BH=!0,Fy=class{constructor(e){var n,t;if(e.host===void 0){if(e.ssl!==void 0)throw new Q(W.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=w3,this.ssl=BH}else this.host=e.host,this.ssl=(n=e.ssl)!==null&&n!==void 0?n:BH;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=n3;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<s3)throw new Q(W.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Bie("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=b3((t=e.experimentalLongPollingOptions)!==null&&t!==void 0?t:{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new Q(W.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new Q(W.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new Q(W.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}},lu=class{constructor(e,n,t,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=t,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Fy({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Q(W.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(W.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 Fy(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(t){if(!t)return new ew;switch(t.type){case"firstParty":return new iw(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Q(W.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(n){let t=VH.get(n);t&&(X("ComponentProvider","Removing Datastore"),VH.delete(n),t.terminate())})(this),Promise.resolve()}};function L3(r,e,n,t={}){var i;r=Or(r,lu);let o=$r(e),s=r._getSettings(),a=Object.assign(Object.assign({},s),{emulatorOptions:r._getEmulatorOptions()}),c=`${e}:${n}`;o&&(Ta(`https://${c}`),gl("Firestore",!0)),s.host!==w3&&s.host!==c&&ks("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(!Bi(l,a)&&(r._setSettings(l),t.mockUserToken)){let u,d;if(typeof t.mockUserToken=="string")u=t.mockUserToken,d=tn.MOCK_USER;else{u=uI(t.mockUserToken,(i=r._app)===null||i===void 0?void 0:i.options.projectId);let f=t.mockUserToken.sub||t.mockUserToken.user_id;if(!f)throw new Q(W.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new tn(f)}r._authCredentials=new tw(new zv(u,d))}}var Xi=class r{constructor(e,n,t){this.converter=n,this._query=t,this.type="query",this.firestore=e}withConverter(e){return new r(this.firestore,e,this._query)}},pn=class r{constructor(e,n,t){this.converter=n,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 za(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}toJSON(){return{type:r._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,t){if(Cp(n,r._jsonSchema))return new r(e,t||null,new se(He.fromString(n.referencePath)))}};pn._jsonSchemaVersion="firestore/documentReference/1.0",pn._jsonSchema={type:nn("string",pn._jsonSchemaVersion),referencePath:nn("string")};var za=class r extends Xi{constructor(e,n,t){super(e,n,wp(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 pn(this.firestore,null,new se(e))}withConverter(e){return new r(this.firestore,e,this._path)}};function M3(r,e,...n){if(r=Be(r),lM("collection","path",e),r instanceof lu){let t=He.fromString(e,...n);return xj(t),new za(r,null,t)}{if(!(r instanceof pn||r instanceof za))throw new Q(W.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=r._path.child(He.fromString(e,...n));return xj(t),new za(r.firestore,null,t)}}function P3(r,e){if(r=Or(r,lu),lM("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new Q(W.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Xi(r,null,(function(t){return new zo(He.emptyPath(),t)})(e))}function x3(r,e,...n){if(r=Be(r),arguments.length===1&&(e=Zm.newId()),lM("doc","path",e),r instanceof lu){let t=He.fromString(e,...n);return Pj(t),new pn(r,null,new se(t))}{if(!(r instanceof pn||r instanceof za))throw new Q(W.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=r._path.child(He.fromString(e,...n));return Pj(t),new pn(r.firestore,r instanceof za?r.converter:null,new se(t))}}var GH="AsyncQueue",ky=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 vp(this,"async_queue_retry"),this.oc=()=>{let t=Wv();t&&X(GH,"Visibility state changed to "+t.visibilityState),this.F_.y_()},this._c=e;let n=Wv();n&&typeof n.addEventListener=="function"&&n.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 n=Wv();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let n=new Nr;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.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(!oc(e))throw e;X(GH,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(e){let n=this._c.then(()=>(this.nc=!0,e().catch(t=>{throw this.tc=t,this.nc=!1,Wt("INTERNAL UNHANDLED ERROR: ",$H(t)),t}).then(t=>(this.nc=!1,t))));return this._c=n,n}enqueueAfterDelay(e,n,t){this.ac(),this.sc.indexOf(e)>-1&&(n=0);let i=wL.createAndSchedule(this,e,n,t,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&ae(47125,{hc:$H(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 n of this.ec)if(n.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((n,t)=>n.targetTimeMs-t.targetTimeMs);for(let n of this.ec)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let n=this.ec.indexOf(e);this.ec.splice(n,1)}};function $H(r){let e=r.message||"";return r.stack&&(e=r.stack.includes(r.message)?r.stack:r.message+`
167
- `+r.stack),e}function jH(r){return(function(n,t){if(typeof n!="object"||n===null)return!1;let i=n;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(r,["next","error","complete"])}var Ji=class extends lu{constructor(e,n,t,i){super(e,n,t,i),this.type="firestore",this._queue=new ky,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new ky(e),this._firestoreClient=void 0,yield e}})}};function eS(r,e,n){n||(n=ap);let t=Po(r,"firestore");if(t.isInitialized(n)){let i=t.getImmediate({identifier:n}),o=t.getOptions(n);if(Bi(o,e))return i;throw new Q(W.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(W.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<s3)throw new Q(W.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&$r(e.host)&&Ta(e.host),t.initialize({options:e,instanceIdentifier:n})}function Xh(r,e){let n=typeof r=="object"?r:Sr(),t=typeof r=="string"?r:e||ap,i=Po(n,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=kd("firestore");o&&L3(i,...o)}return i}function Jh(r){if(r._terminated)throw new Q(W.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||kse(r),r._firestoreClient}function kse(r){var e,n,t;let i=r._freezeSettings(),o=(function(a,c,l,u){return new mw(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,b3(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,i);r._componentsProvider||!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(r._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),r._firestoreClient=new HL(r._authCredentials,r._appCheckCredentials,r._queue,o,r._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(r._componentsProvider))}var WL=class{constructor(e="count",n){this._internalFieldPath=n,this.type="AggregateField",this.aggregateType=e}},zL=class{constructor(e,n,t){this._userDataWriter=n,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Fs=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(rn.fromBase64String(e))}catch(n){throw new Q(W.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new r(rn.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:r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Cp(e,r._jsonSchema))return r.fromBase64String(e.bytes)}};Fs._jsonSchemaVersion="firestore/bytes/1.0",Fs._jsonSchema={type:nn("string",Fs._jsonSchemaVersion),bytes:nn("string")};var Hh=class{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new Q(W.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new gn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var Ap=class{constructor(e){this._methodName=e}};var qa=class r{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new Q(W.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new Q(W.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}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:r._jsonSchemaVersion}}static fromJSON(e){if(Cp(e,r._jsonSchema))return new r(e.latitude,e.longitude)}};qa._jsonSchemaVersion="firestore/geoPoint/1.0",qa._jsonSchema={type:nn("string",qa._jsonSchemaVersion),latitude:nn("number"),longitude:nn("number")};var Ka=class r{constructor(e){this._values=(e||[]).map(n=>n)}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:r._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Cp(e,r._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(n=>typeof n=="number"))return new r(e.vectorValues);throw new Q(W.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};Ka._jsonSchemaVersion="firestore/vectorValue/1.0",Ka._jsonSchema={type:nn("string",Ka._jsonSchemaVersion),vectorValues:nn("object")};var Use=/^__.*__$/,qL=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return this.fieldMask!==null?new Qi(e,this.data,this.fieldMask,n,this.fieldTransforms):new tc(e,this.data,n,this.fieldTransforms)}},Uy=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return new Qi(e,this.data,this.fieldMask,n,this.fieldTransforms)}};function F3(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:r})}}var KL=class r{constructor(e,n,t,i,o,s){this.settings=e,this.databaseId=n,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 r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.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 By(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.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(F3(this.Ec)&&Use.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},YL=class{constructor(e,n,t){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=t||Qy(e)}Dc(e,n,t,i=!1){return new KL({Ec:e,methodName:n,bc:t,path:gn.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function tS(r){let e=r._freezeSettings(),n=Qy(r._databaseId);return new YL(r._databaseId,!!e.ignoreUndefinedProperties,n)}function k3(r,e,n,t,i,o={}){let s=r.Dc(o.merge||o.mergeFields?2:0,e,n,i);GM("Data must be an object, but it was:",s,t);let a=V3(t,s),c,l;if(o.merge)c=new qr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=QL(e,d,n);if(!s.contains(f))throw new Q(W.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);G3(u,f)||u.push(f)}c=new qr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new qL(new er(a),c,l)}var Vy=class r extends Ap{_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 r}};function Vse(r,e,n,t){let i=r.Dc(1,e,n);GM("Data must be an object, but it was:",i,t);let o=[],s=er.empty();sc(t,(c,l)=>{let u=$M(e,c,n);l=Be(l);let d=i.gc(u);if(l instanceof Vy)o.push(u);else{let f=Pp(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new qr(o);return new Uy(s,a,i.fieldTransforms)}function Bse(r,e,n,t,i,o){let s=r.Dc(1,e,n),a=[QL(e,t,n)],c=[i];if(o.length%2!=0)throw new Q(W.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(QL(e,o[f])),c.push(o[f+1]);let l=[],u=er.empty();for(let f=a.length-1;f>=0;--f)if(!G3(l,a[f])){let g=a[f],p=c[f];p=Be(p);let _=s.gc(g);if(p instanceof Vy)l.push(g);else{let T=Pp(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new qr(l);return new Uy(u,d,s.fieldTransforms)}function U3(r,e,n,t=!1){return Pp(n,r.Dc(t?4:3,e))}function Pp(r,e){if(B3(r=Be(r)))return GM("Unsupported field value:",e,r),V3(r,e);if(r instanceof Ap)return(function(t,i){if(!F3(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)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r 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=Pp(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(r,e)}return(function(t,i){if((t=Be(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return Roe(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=wt.fromDate(t);return{timestampValue:kh(i.serializer,o)}}if(t instanceof wt){let o=new wt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:kh(i.serializer,o)}}if(t instanceof qa)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Fs)return{bytesValue:$W(i.serializer,t._byteString)};if(t instanceof pn){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:yM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof Ka)return(function(s,a){return{mapValue:{fields:{[pM]:{stringValue:EM},[Lh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return vM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${$y(t)}`)})(r,e)}function V3(r,e){let n={};return dW(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):sc(r,(t,i)=>{let o=Pp(i,e.Vc(t));o!=null&&(n[t]=o)}),{mapValue:{fields:n}}}function B3(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof wt||r instanceof qa||r instanceof Fs||r instanceof pn||r instanceof Ap||r instanceof Ka)}function GM(r,e,n){if(!B3(n)||!YH(n)){let t=$y(n);throw t==="an object"?e.wc(r+" a custom object"):e.wc(r+" "+t)}}function QL(r,e,n){if((e=Be(e))instanceof Hh)return e._internalPath;if(typeof e=="string")return $M(r,e);throw By("Field path arguments must be of type string or ",r,!1,void 0,n)}var Gse=new RegExp("[~\\*/\\[\\]]");function $M(r,e,n){if(e.search(Gse)>=0)throw By(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,n);try{return new Hh(...e.split("."))._internalPath}catch{throw By(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,n)}}function By(r,e,n,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(o||s)&&(c+=" (found",o&&(c+=` in field ${t}`),s&&(c+=` in document ${i}`),c+=")"),new Q(W.INVALID_ARGUMENT,a+r+c)}function G3(r,e){return r.some(n=>n.isEqual(e))}var uu=class{constructor(e,n,t,i,o){this._firestore=e,this._userDataWriter=n,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new pn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new XL(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 n=this._document.data.field(nS("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}},XL=class extends uu{data(){return super.data()}};function nS(r,e){return typeof e=="string"?$M(r,e):e instanceof Hh?e._internalPath:e._delegate._internalPath}function $3(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new Q(W.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Rp=class{},Wh=class extends Rp{};function j3(r,e,...n){let t=[];e instanceof Rp&&t.push(e),t=t.concat(n),(function(o){let s=o.filter(c=>c instanceof zh).length,a=o.filter(c=>c instanceof Dp).length;if(s>1||s>0&&a>0)throw new Q(W.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)r=i._apply(r);return r}var Dp=class r extends Wh{constructor(e,n,t){super(),this._field=e,this._op=n,this._value=t,this.type="where"}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=this._parse(e);return Q3(e._query,n),new Xi(e.firestore,e.converter,Nw(e._query,n))}_parse(e){let n=tS(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(W.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){WH(d,u);let p=[];for(let _ of d)p.push(HH(c,o,_));f={arrayValue:{values:p}}}else f=HH(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||WH(d,u),f=U3(a,s,d,u==="in"||u==="not-in");return Ge.create(l,u,f)})(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}};function H3(r,e,n){let t=e,i=nS("where",r);return Dp._create(i,t,n)}var zh=class r extends Rp{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new r(e,n)}_parse(e){let n=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return n.length===1?n[0]:tt.create(n,this._getOperator())}_apply(e){let n=this._parse(e);return n.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)Q3(s,c),s=Nw(s,c)})(e._query,n),new Xi(e.firestore,e.converter,Nw(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function W3(...r){return r.forEach(e=>X3("or",e)),zh._create("or",r)}function z3(...r){return r.forEach(e=>X3("and",e)),zh._create("and",r)}var JL=class r extends Wh{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new r(e,n)}_apply(e){let n=(function(i,o,s){if(i.startAt!==null)throw new Q(W.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new Q(W.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new tu(o,s)})(e._query,this._field,this._direction);return new Xi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new zo(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,n))}};function q3(r,e="asc"){let n=e,t=nS("orderBy",r);return JL._create(t,n)}var ZL=class r extends Wh{constructor(e,n,t){super(),this.type=e,this._limit=n,this._limitType=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){return new Xi(e.firestore,e.converter,sy(e._query,this._limit,this._limitType))}};function K3(r){return Gie("limit",r),ZL._create("limit",r,"F")}var eM=class r extends Wh{constructor(e,n,t){super(),this.type=e,this._docOrFields=n,this._inclusive=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=$se(e,this.type,this._docOrFields,this._inclusive);return new Xi(e.firestore,e.converter,(function(i,o){return new zo(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,n))}};function Y3(...r){return eM._create("startAfter",r,!1)}function $se(r,e,n,t){if(n[0]=Be(n[0]),n[0]instanceof uu)return(function(o,s,a,c,l){if(!c)throw new Q(W.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);let u=[];for(let d of Ih(o))if(d.field.isKeyField())u.push(eu(s,c.key));else{let f=c.data.field(d.field);if(zy(f))throw new Q(W.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(W.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 Wo(u,l)})(r._query,r.firestore._databaseId,e,n[0]._document,t);{let i=tS(r.firestore);return(function(s,a,c,l,u,d){let f=s.explicitOrderBy;if(u.length>f.length)throw new Q(W.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(W.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${l}(), but got a ${typeof _}`);if(!TM(s)&&_.indexOf("/")!==-1)throw new Q(W.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(He.fromString(_));if(!se.isDocumentKey(T))throw new Q(W.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 D=new se(T);g.push(eu(a,D))}else{let T=U3(c,l,_);g.push(T)}}return new Wo(g,d)})(r._query,r.firestore._databaseId,i,e,n,t)}}function HH(r,e,n){if(typeof(n=Be(n))=="string"){if(n==="")throw new Q(W.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!TM(e)&&n.indexOf("/")!==-1)throw new Q(W.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let t=e.path.child(He.fromString(n));if(!se.isDocumentKey(t))throw new Q(W.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 eu(r,new se(t))}if(n instanceof pn)return eu(r,n._key);throw new Q(W.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${$y(n)}.`)}function WH(r,e){if(!Array.isArray(r)||r.length===0)throw new Q(W.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Q3(r,e){let n=(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})(r.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(n!==null)throw n===e.op?new Q(W.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Q(W.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function X3(r,e){if(!(e instanceof Dp||e instanceof zh))throw new Q(W.INVALID_ARGUMENT,`Function ${r}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var Gy=class{convertValue(e,n="none"){switch(Xa(e)){case 0:return null;case 1:return e.booleanValue;case 2:return bt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Vs(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){let t={};return sc(e,(i,o)=>{t[i]=this.convertValue(o,n)}),t}convertVectorValue(e){var n,t,i;let o=(i=(t=(n=e.fields)===null||n===void 0?void 0:n[Lh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>bt(s.doubleValue));return new Ka(o)}convertGeoPoint(e){return new qa(bt(e.latitude),bt(e.longitude))}convertArray(e,n){return(e.values||[]).map(t=>this.convertValue(t,n))}convertServerTimestamp(e,n){switch(n){case"previous":let t=qy(e);return t==null?null:this.convertValue(t,n);case"estimate":return this.convertTimestamp(sp(e));default:return null}}convertTimestamp(e){let n=Us(e);return new wt(n.seconds,n.nanos)}convertDocumentKey(e,n){let t=He.fromString(e);fe(XW(t),9688,{name:e});let i=new wh(t.get(1),t.get(3)),o=new se(t.popFirst(5));return i.isEqual(n)||Wt(`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 (${n.projectId}/${n.database}) instead.`),o}};function J3(r,e,n){let t;return t=r?n&&(n.merge||n.mergeFields)?r.toFirestore(e,n):r.toFirestore(e):e,t}var tM=class extends Gy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Fs(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new pn(this.firestore,null,n)}};function jse(){return new WL("count")}var Wa=class{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ya=class r extends uu{constructor(e,n,t,i,o,s){super(e,n,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 n=new yh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){let t=this._document.data.field(nS("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(W.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,n={};return n.type=r._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}};Ya._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ya._jsonSchema={type:nn("string",Ya._jsonSchemaVersion),bundleSource:nn("string","DocumentSnapshot"),bundleName:nn("string"),bundle:nn("string")};var yh=class extends Ya{data(e={}){return super.data(e)}},Zl=class r{constructor(e,n,t,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new Wa(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(t=>{e.call(n,new yh(this._firestore,this._userDataWriter,t.key,t,new Wa(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new Q(W.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new yh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Wa(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 yh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Wa(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:Hse(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(W.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=r._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Zm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(n.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 Hse(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:r})}}function Z3(r){r=Or(r,pn);let e=Or(r.firestore,Ji);return Pse(Jh(e),r._key).then(n=>oz(e,r,n))}Zl._jsonSchemaVersion="firestore/querySnapshot/1.0",Zl._jsonSchema={type:nn("string",Zl._jsonSchemaVersion),bundleSource:nn("string","QuerySnapshot"),bundleName:nn("string"),bundle:nn("string")};var du=class extends Gy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Fs(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new pn(this.firestore,null,n)}};function ez(r){r=Or(r,Xi);let e=Or(r.firestore,Ji),n=Jh(e),t=new du(e);return $3(r._query),xse(n,r._query).then(i=>new Zl(e,t,r,i))}function tz(r,e,n){r=Or(r,pn);let t=Or(r.firestore,Ji),i=J3(r.converter,e,n);return iz(t,[k3(tS(t),"setDoc",r._key,i,r.converter!==null,n).toMutation(r._key,Vn.none())])}function nz(r){return iz(Or(r.firestore,Ji),[new ou(r._key,Vn.none())])}function rz(r,...e){var n,t,i;r=Be(r);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||jH(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(jH(e[s])){let d=e[s];e[s]=(n=d.next)===null||n===void 0?void 0:n.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(r instanceof pn)l=Or(r.firestore,Ji),u=wp(r._key.path),c={next:d=>{e[s]&&e[s](oz(l,r,d))},error:e[s+1],complete:e[s+2]};else{let d=Or(r,Xi);l=Or(d.firestore,Ji),u=d._query;let f=new du(l);c={next:g=>{e[s]&&e[s](new Zl(l,f,d,g))},error:e[s+1],complete:e[s+2]},$3(r._query)}return(function(f,g,p,_){let T=new Sp(_),D=new yp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return bM(yield xy(f),D)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return wM(yield xy(f),D)}))}})(Jh(l),u,a,c)}function iz(r,e){return(function(t,i){let o=new Nr;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return _se(yield Mse(t),i,o)})),o.promise})(Jh(r),e)}function oz(r,e,n){let t=n.docs.get(e._key),i=new du(r);return new Ya(r,i,e._key,t,new Wa(n.hasPendingWrites,n.fromCache),e.converter)}function sz(r){return az(r,{count:jse()})}function az(r,e){let n=Or(r.firestore,Ji),t=Jh(n),i=goe(e,(o,s)=>new Lw(s,o.aggregateType,o._internalFieldPath));return Fse(t,r._query,i).then(o=>(function(a,c,l){let u=new du(a);return new zL(c,u,l)})(n,r,o))}var nM=class{constructor(e){let n;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),n=e.tabManager):(n=Wse(void 0),n._initialize(e)),this._onlineComponentProvider=n._onlineComponentProvider,this._offlineComponentProvider=n._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function jM(r){return new nM(r)}var rM=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=VM.provider,this._offlineComponentProvider={build:n=>new Py(n,e?.cacheSizeBytes,this.forceOwnership)}}},iM=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=VM.provider,this._offlineComponentProvider={build:n=>new GL(n,e?.cacheSizeBytes)}}};function Wse(r){return new rM(r?.forceOwnership)}function HM(){return new iM}var zse={maxAttempts:5};function Hm(r,e){if((r=Be(r)).firestore!==e)throw new Q(W.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}var oM=class{constructor(e,n){this._firestore=e,this._transaction=n,this._dataReader=tS(e)}get(e){let n=Hm(e,this._firestore),t=new tM(this._firestore);return this._transaction.lookup([n._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new uu(this._firestore,t,o.key,o,n.converter);if(o.isNoDocument())return new uu(this._firestore,t,n._key,null,n.converter);throw ae(18433,{doc:o})})}set(e,n,t){let i=Hm(e,this._firestore),o=J3(i.converter,n,t),s=k3(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,n,t,...i){let o=Hm(e,this._firestore),s;return s=typeof(n=Be(n))=="string"||n instanceof Hh?Bse(this._dataReader,"Transaction.update",o._key,n,t,i):Vse(this._dataReader,"Transaction.update",o._key,n),this._transaction.update(o._key,s),this}delete(e){let n=Hm(e,this._firestore);return this._transaction.delete(n._key),this}};var sM=class extends oM{constructor(e,n){super(e,n),this._firestore=e}get(e){let n=Hm(e,this._firestore),t=new du(this._firestore);return super.get(e).then(i=>new Ya(this._firestore,t,n._key,i._document,new Wa(!1,!1),n.converter))}};function cz(r,e,n){r=Or(r,Ji);let t=Object.assign(Object.assign({},zse),n);return(function(o){if(o.maxAttempts<1)throw new Q(W.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 O3(o);new jL(o.asyncQueue,l,a,s,c).zu()})),c.promise})(Jh(r),i=>e(new sM(r,i)),t)}(function(e,n=!0){(function(i){qh=i})(Sa),lr(new fn("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new Ji(new nw(t.getProvider("auth-internal")),new ow(s,t.getProvider("app-check-internal")),(function(l,u){if(!Object.prototype.hasOwnProperty.apply(l.options,["projectId"]))throw new Q(W.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new wh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:n},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Ke(bj,wj,e),Ke(bj,wj,"esm2017")})();var rS=_e(z3,!0,2);var iS=_e(M3,!0,2),lz=_e(P3,!0,2);var uz=_e(nz,!0,2);var xp=_e(x3,!0,2);var dz=_e(sz,!0),WM=_e(Z3,!0);var hz=_e(ez,!0);var qse=_e(K3,!0,2);var fz=_e(rz,!0);var Kse=_e(W3,!0,2),Yse=_e(q3,!0,2),gz=_e(j3,!0,2);var mz=_e(cz,!0),pz=_e(tz,!0,2);var Qse=_e(Y3,!0,2);var vi=_e(H3,!0,2);var cc=(()=>{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=kV(c,a.v1DbHost),a?.forceLongPolling&&Nb());let l=rh(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)(C(Dr),C(Xn),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var qo=(()=>{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.additionalSaveEvents=[],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||[]),this.additionalSaveEvents=(s.config?.additionalSaveEvents||[]).map(a=>a?.event).filter(a=>!!a))})}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 L=i||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:_t.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(M({},t),{commentAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let L=i||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=xt(()=>g?.config?.getConfig?.url?$t(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),this.loggingService.catch(w?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield B)||{},this.analyticsService.trackEvent(P.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:_});let w={};Object.entries(p).forEach(([F,U])=>{let A=this.commentAnnotationById$.value?.[F];A?A&&JSON.stringify(A)!==JSON.stringify(U)&&(w[F]=U):w[F]=U}),Object.keys(w).length>0&&this.commentAnnotationById$.next(M(M({},this.commentAnnotationById$.getValue()),w)),this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),d(w)}catch(w){let F=i||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:w,request:T}}),c||f(w),d(p)}}else u(),d({})}catch(L){u();let B=i||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:L,request:T}}),f(L)}})})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",a);let c=i||Z();return this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.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||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=M(M({},a),t.commentAnnotation);let c=this.getTargetComment(t.commentAnnotation,t.commentId),l=yield xt(()=>{if(o?.config?.saveConfig?.url){let u={commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata};return $t(o.config.saveConfig.url,o.config.saveConfig.headers,u,!1,o.config.saveConfig.credentials)}return o?.save?.({commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveCommentAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(t.commentAnnotation),eventType:t.eventType,commentId:t.commentId}),this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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||Z();return this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}getTargetComment(t,i){if(!(!i||!t))for(let o of Object.values(t)){let s=o?.comments?.[i];if(s)return s}}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?yn(i):void 0),u=l?M({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:t.toString(),metadata:u}});let f=M({},a);delete f?.[t],this.commentAnnotationById$._value=f;let g=yield xt(()=>{if(s?.config?.deleteConfig?.url){let p={commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE};return $t(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}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(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:t.toString()}),this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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||Z(),c=i?yn(i):void 0;return this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.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()):de(void 0)}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",t),de(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}}getAdditionalSaveEvents(){try{return this.additionalSaveEvents}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalSaveEvents:",t),this.additionalSaveEvents}}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)(C(vt),C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Ko=(()=>{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.fieldsToRemove=[],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),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove||[]))})}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)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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 L=i||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:Tt.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(M({},t),{reactionAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let L=i||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=xt(()=>g?.config?.getConfig?.url?$t(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),this.loggingService.catch(w?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield B)||{},this.analyticsService.trackEvent(P.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:_});let w={};Object.entries(p).forEach(([F,U])=>{let A=this.reactionAnnotationById$.value?.[F];A?A&&JSON.stringify(A)!==JSON.stringify(U)&&(w[F]=U):w[F]=U}),Object.keys(w).length>0&&this.reactionAnnotationById$.next(M(M({},this.reactionAnnotationById$.getValue()),w)),this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),d(w)}catch(w){let F=i||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:w,request:T}}),c||f(w),d(p)}}else u(),d({})}catch(L){u();let B=i||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:L,request:T}}),f(L)}})})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",a);let c=i||Z();return this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.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||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=M(M({},a),t);let c={reactionAnnotation:t,event:Qt.REACTION_ADD,metadata:Object.values(t??{})?.[0]?.metadata},l=yield xt(()=>o?.config?.saveConfig?.url?$t(o.config.saveConfig.url,o.config.saveConfig.headers,c,!1,o.config.saveConfig.credentials):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(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(t),eventType:c.event}),this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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||Z();return this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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?yn(c):void 0,u=l?M({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:t.toString(),metadata:u}});let f=M({},a);delete f?.[t],this.reactionAnnotationById$._value=f;let g=yield xt(()=>{if(s?.config?.deleteConfig?.url){let p={reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE};return $t(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}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(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:t.toString()}),this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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||Z(),c=i?yn(i):void 0;return this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.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()):de(void 0)}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",t),de(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)(C(vt),C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Zh=(()=>{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,a){return I(this,null,function*(){try{let c=typeof i=="function"?yield i():i||{},l=new FormData;l.append("file",o);let u={attachment:{attachmentId:s.attachment.attachmentId,name:s.attachment.name,mimeType:s.attachment.mimeType},metadata:s.metadata,event:s.event};l.append("request",JSON.stringify(u));let d={};Object.entries(c).forEach(([p,_])=>{p.toLowerCase()!=="content-type"&&(d[p]=_)});let f=yield fetch(t,M({method:"POST",headers:d,body:l},a?{credentials:a}:{}));return f.ok?{data:(yield f.json())?.data??{},success:!0,statusCode:200}:(j.catch(`Error in makeAttachmentConfigBasedRequest: ${f.status} ${f.statusText}`),{data:{},success:!1,statusCode:f.status})}catch(c){return j.catch("Error in makeAttachmentConfigBasedRequest:",c),{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||Z();this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:Oo.SAVE_ATTACHMENT,source:"internal",payload:{request:t}});let l=yield xt(()=>I(this,null,function*(){if(s?.config?.saveConfig?.url){let u=t.attachment,{file:d}=u,f=NS(u,["file"]);return this.makeAttachmentConfigBasedRequest(s.config.saveConfig.url,s.config.saveConfig.headers,d,{attachment:f,event:t.eventType,metadata:t.attachment.metadata},s.config.saveConfig.credentials)}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(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Oo.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:t}});return}return this.analyticsService.trackEvent(P.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:t.attachment.attachmentId,eventType:t.eventType}),this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:c,methodName:Oo.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||Z();this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Oo.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?M({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||Z();this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:Oo.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield xt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE};return $t(u.config.deleteConfig.url,u.config.deleteConfig.headers,_,!1,u.config.deleteConfig.credentials)}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(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:g,methodName:Oo.DELETE_ATTACHMENT,source:"internal",payload:{error:p,attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:t}),this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:g,methodName:Oo.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||Z(),g=i?M({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0;return this.coreActionsService.triggerAction(H.ATTACHMENT_RESOLVER,{event:P.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Oo.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)(C(vt),C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var lc=(()=>{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.fieldsToRemove=[],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||[]),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove||[]),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 L=i||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:It.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(M({},t),{recorderAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let L=i||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let B=xt(()=>g?.config?.getConfig?.url?$t(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getRecorderAnnotations",this.retryGetConfig).then(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),this.loggingService.catch(w?.message??"Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield B)||{},this.analyticsService.trackEvent(P.Events.Resolver.RECORDER_RESOLVER_GET,{sourceMethod:"resolveRecorderAnnotations",source:"sdk",recorderAnnotationIds:_});let w={};Object.entries(p).forEach(([F,U])=>{let A=this.recorderAnnotationById$.value?.[F];A?A&&JSON.stringify(A)!==JSON.stringify(U)&&(w[F]=U):w[F]=U}),Object.keys(w).length>0&&this.recorderAnnotationById$.next(M(M({},this.recorderAnnotationById$.getValue()),w)),this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:w,request:T}}),d(w)}catch(w){let F=i||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:w,request:T}}),c||f(w),d(p)}}else u(),d({})}catch(L){u();let B=i||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:L,request:T}}),f(L)}})})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:",a);let c=i||Z();return this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:It.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||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.recorderAnnotationById$.getValue()));this.recorderAnnotationById$._value=M(M({},a),t.recorderAnnotation);let c=yield xt(()=>{if(o?.config?.saveConfig?.url){let l={recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata};return $t(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}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(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:It.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.RECORDER_RESOLVER_SAVE,{sourceMethod:"saveRecorderAnnotation",source:"sdk",recorderAnnotationIds:Object.keys(t.recorderAnnotation),eventType:t.eventType}),this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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||Z();return this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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?yn(i):void 0),u=l?M({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{recorderAnnotationId:t.toString(),metadata:u}});let f=M({},a);delete f?.[t],this.recorderAnnotationById$._value=f;let g=yield xt(()=>{if(s?.config?.deleteConfig?.url){let p={recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE};return $t(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}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(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:It.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:g,recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.RECORDER_RESOLVER_DELETE,{sourceMethod:"deleteRecorderAnnotation",source:"sdk",recorderAnnotationId:t.toString()}),this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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||Z(),c=i?yn(i):void 0;return this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:It.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()):de(void 0)}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationsById$:",t),de(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}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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)(C(vt),C(me),C(Ot),C(Zh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var aS=class{};var ef=(()=>{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.endpointsService=J(xo),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 Ct,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(Rd).subscribe(_=>{this.commentService=_??void 0}),z1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(BS(()=>Oi(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(Rt(_=>!!_),Dt(1)).subscribe(_=>{_&&(this.db=_)}),this.configService.getApiKey$().subscribe(_=>{if(this.apiKey=_,this.apiKey){if(!this.isCustomDocId){let T=sI(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(Rt(_=>!!_),Dt(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=sI(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=sI(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(P.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,documentMetadata:i,methodName:"setDocument",source:s}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pn.SET_DOCUMENTS,source:s,payload:{documentId:t,documentMetadata:i,options:o}}),yield this.setDocumentsImpl({documents:[{id:t,metadata:i}],options:M({organizationId:i?.organizationId},o??{}),source:s})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}getEffectiveCompareOptions(t={}){let i=this.authService.getUser(),o=M({},t);return o.organizationId==null&&i?.organizationId&&i?.clientOrganizationId&&(o.organizationId=i.clientOrganizationId),oI(o)??{}}shouldSetDocumentsAgain(t,i={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let o=this.getEffectiveCompareOptions(i),s=t.some(f=>f?.metadata&&typeof f.metadata=="object"&&!gi(this.clientDocumentMetadataMap[f.id],f.metadata));if(this.pendingDocumentIds.length>0&&!s&&t.length===this.pendingDocumentIds.length&&t.every(g=>this.pendingDocumentIds.includes(g.id))&&gi(o,this.pendingOptions))return!1;let a=this.documentPaths$.value?.clientDocumentId,c=i?.rootDocumentId??t[0]?.id,l=this.documentIds$.value.map(f=>f.clientDocumentId),u=oI(this.getOptionsFromDocumentPaths()??{})??{};return!((i?.allDocuments===!0||t.length===l.length)&&t.every(f=>l.includes(f.id)))||s||!gi(u,o)||a!==c}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=`${Tr(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(P.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:t,options:i,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pn.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(H.INIT_UPDATE,{event:P.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Pn.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(rt(Pt))}getProcessedDocContext(){return JV(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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Md({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:_a(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:Qn.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:Ui.FOLDER,source:Qn.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context}}),i&&i.forEach(a=>{s.push({userId:o.userId,resource:M({id:a.clientDocumentId,type:Ui.DOCUMENT,source:Qn.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&ZV({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:Ui.CONTEXT,source:Qn.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=eB({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=Z();this.coreActionsService.triggerAction(H.PERMISSION_PROVIDER,{event:P.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Qn.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:Qn.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===Rs.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===Rs.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===Rs.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(H.ERROR,{event:P.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===Rs.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===Rs.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===Rs.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(H.ERROR,{event:P.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(H.ERROR,{event:P.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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Md({data:M({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,oI(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=Z();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=this.getEffectiveCompareOptions(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(P.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,clientOrganizationId:i,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pn.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=`${Tr(t)}`,l=o?.folderId,u=o?.folderId?bo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?fi(i):s?.organizationId:void 0,_=Z(),T=Nd.SET_DOCUMENTS;this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:_t.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let D=Z(),L=Od.SET_DOCUMENTS;this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:D,moduleName:L,methodName:Tt.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let B=Z(),w=bd.GET_RECORDER_ANNOTATIONS;if(this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:B,moduleName:w,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:D,moduleName:L}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:B,moduleName:w})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==p){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let F=new XT,U=new aS;F.clientDocumentId=t,U.clientDocumentId=t,F.folderId=l,U.folderId=l,F.locationId=d,U.locationId=d,F.allDocuments=f,F.optimisticPermissions=g,U.allDocuments=f,U.optimisticPermissions=g,F.veltFolderId=u,U.veltFolderId=u,F.documentId=c,U.documentId=c,p&&(F.organizationId=p,F.clientOrganizationId=i??s?.clientOrganizationId,U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId);let A=`${this.apiKey}`,R=`apiKey/${this.apiKey}`;p&&(A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`,R=`${R}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`),U.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,U.document=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,F.presence=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,F.cursor=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,F.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,U.comment=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,F.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,U.multiThread=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,F.tag=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,F.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,U.area=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,F.arrow=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,F.selection=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,F.audioHuddle=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,F.huddle=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,F.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,U.recorder=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,F.flock=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,F.syncVideoPlayer=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,F.liveState=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,F.liveStateSingleEditorMode=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,F.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,U.reaction=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,F.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,U.crdt=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,F.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,F.views=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,U.notificationViews=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,U.documentViews=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,U.locationViews=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,F.notifications=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,F.metadata=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,F.users=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.documentIam=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.groupContacts=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,F.globalContacts=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,F.logins=`${A}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,F.userFeedback=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,F.userReportBugs=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,F.userContactUs=`${A}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(F.organizationMetadata=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,F.organizationIam=`${A}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.organizationGroups=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,F.organizationNotifications=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(F.organizationNotificationsWithDocumentId=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,F.heartbeatByDocument=`${A}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),F.organizationNotificationsLastNotificationTimestamp=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,F.organizationNotificationsUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.heartbeat=`${A}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),U.organizationUsers=`${R}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,U.users=`${R}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,U.documentUsers=`${R}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,U.notificationDocs=`${R}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,U.notificationUsers=`${R}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(F),this.firestorePaths$.next(U),F?.clientOrganizationId&&F?.organizationId&&!(F?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&F?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:F?.organizationId,clientOrganizationId:F?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),a&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:t}}),this.analyticsService.trackEvent(P.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(P.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:t}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Pn.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(H.INIT_UPDATE,{event:P.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:t}),this.analyticsService.trackEvent(P.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(P.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:t}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:t,methodName:Pn.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===Rs.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(M({},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(M(M({},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(M({},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(as(i=>de(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(ge(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`${Tr(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${fi(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(P.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:void 0,methodName:"setLocation",source:i}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:Pn.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(P.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:t,options:i,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pn.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(P.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:t,methodName:"setRootLocation",source:i}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Pn.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(M(M({},this.draftLocationMap.options??{}),i??{}),{rootLocationId:t[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...t],this.draftLocationMap.options=M(M({},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=Ld(l),f=Tr(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=Ld(l),f=Tr(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=M({},d),g=this.locations$.value;d?.id&&Object.keys(g).forEach(D=>{let L=g[D];L.location?.id===d.id&&(f=M(M({},L.location),d),delete g?.[D])});let p=this.genarateLocationId(f),_={locationId:p,location:f};f.id&&a.push({locationId:p,location:f}),u.push(_);let T=le(M({},g),{[p]:_});this.locations$.next(T)}}),this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Pn.SET_LOCATIONS,payload:{locations:s,options:i}}),this.analyticsService.trackEvent(P.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(P.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:{appendLocation:!0},methodName:"addLocation",source:i}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pn.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(P.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[t],methodName:"removeLocation",source:i}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:Pn.REMOVE_LOCATION,payload:{locations:[t]}}),t?this.removeLocationsImpl([t],i):i==="external"&&this.removeLocationsImpl(void 0,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(P.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t,methodName:"removeLocations",source:i}}),this.coreActionsService.triggerAction(H.INIT_UPDATE,{event:P.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Pn.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(P.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(P.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(H.INIT_UPDATE,{event:P.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Pn.UNSET_LOCATION_IDS,source:i,payload:{locationIds:t}}),i==="internal"&&this.analyticsService.trackEvent(P.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(H.INIT_UPDATE,{event:P.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Pn.REMOVE_LOCATIONS_SUCCESS,source:i,payload:{locationIds:t}}),this.analyticsService.trackEvent(P.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),de([])}}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 ZT;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===Rs.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=Rr(this.functions,Ir({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Md({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 QT;this.clientDocumentMetadataMap?.[s.clientDocumentId]&&(a=M(M({},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=Pg(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}),gi(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 JT;u.locationId=l?.locationId,u.veltLocationId=$C(l?.location?.id??""),u.location=l?.location,u.pageInfo=Pg(s?.clientDocumentId),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let d=le(M({},a),{[v.FIREBASE_PARTIAL_PATH_LOCATIONS]:le(M({},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(M({},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"?Tr(JSON.stringify(Ld(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(M({},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(M({},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(M({},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),de({})}}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(ge(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),rt(Pt))}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(ge(t=>t||{}),rt(Pt))}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(ge(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),rt(Pt))}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(ge(i=>i?.[t]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(ge(t=>t||{}),rt(Pt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(rt(Pt))}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 M(M({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=Gr(),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=bo(t?.folderId);o.push(vi("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(vi("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=bo(t?.folderId);o.push(vi("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(vi("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=Ds(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=_a(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=bo(a||this.documentPaths$.value?.folderId||""));let g=()=>{if(a&&this.documentPaths$.value?.folderId&&a!==this.documentPaths$.value?.folderId)return;let _=u?.[f];_?u[f]=M(M({},_),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=>_a(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=$C(f.id),_=u?.[d],T=_?.[f.id];u&&(_||(u[d]={}),T||(u[d][f.id]={}),u[d][f.id]=le(M({},T),{location:f})),f&&this.commonDbService&&l.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:f})),properties:{organizationId:Ds(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=bo(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:[vi("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(pt(t=>t?this.documentPaths$.pipe(pt(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(ge(o=>o?.data?.docIamConfig??o?.data),rt((o,s)=>JSON.stringify(o??{})===JSON.stringify(s??{}))):de(null))):de(null)))}getDocumentAccessType(t){try{return t&&t.features&&t.features.all?t.features.all.restricted?Mt.RESTRICTED:Mt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:Mt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),Mt.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 Mt.PUBLIC:o.features.all.restricted=!1;break;case Mt.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(M(M({},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)(C(Ot),C(Dr),C(cc),C(bv),C(Xn),C(me),C(qo),C(Ko),C(lc),C(vt),C(ur),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var jt=(()=>{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 mt,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?M(M({},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(Rt(c=>!!c),pt(()=>this.getUnresolvedUsers$().pipe(Rt(c=>c.length>0),Mu(300),Dt(20),pt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[rS(vi("user.userId","in",c.slice(0,20)))]}}).pipe(ge(u=>u?.data),ea(u=>{if(u&&typeof u=="object"){delete u.undefined,delete u.null;let d=Object.values(u??{}),f=d.map(p=>p?.user).filter(p=>!!p&&(!!p.name||!!p.email||!!p.photoUrl));f.length>0&&this.setUserByIds(f);let g=c.filter(p=>!d.some(_=>_.user.userId===p));g.length!==c.length&&this.setUnresolvedUsers(g)}})):de([])})))).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(M({},this.userByIdCalled$.getValue()),{[_]:!0})))}),g.length>0){let _=c||Z();this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:Ln.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={},D=!1,L=new Set;try{let B,w=new Promise((U,A)=>{B=setTimeout(()=>{A(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)}),F=yield Promise.race([this.getUsersFromDB({userIds:g,organizationId:s,skipUserCheck:a}).finally(()=>{clearTimeout(B)}),w]);F==null?D=!0:T=F,this.analyticsService.trackEvent(P.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:g}),this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:_,methodName:Ln.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(B){D=!0,this.loggingService.catch("Error in UsersService resolveUsers getUsers:",B,{userIds:g}),this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:Ln.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:B,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{let B=this.authService.getProvidedOrCurrentUserId?.();g?.forEach(w=>{if(!T[w]){let F=new Set([...this.getUnresolvedUsers(),w]);if(this.unresolvedUsers.next(Array.from(F)),D&&this.clearUserByIdCalledFlag(w),B&&w===B)return;T[w]={userId:w,name:`User ${w}`},D&&L.add(w)}})}Object.entries(T).forEach(([B,w])=>{w&&(f[B]=T?.[B],L.has(B)||(p[B]=T?.[B]))}),L.size>0&&this.authService.setOptionalPropertiesToUsers(Array.from(L).map(B=>T[B]).filter(Boolean))}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||Z();return this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Ln.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:d,userIds:t,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}clearUserByIdCalledFlag(t){try{let i=this.userByIdCalled$.getValue();if(i?.[t]){let o=M({},i);delete o[t],this.userByIdCalled$.next(o)}}catch(i){this.loggingService.catch("Error in UsersService clearUserByIdCalledFlag:",i)}}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"),null;let d={organizationId:i,userIds:t},f=yield $t(a.config.getConfig.url,a.config.getConfig.headers,d,!0,a.config.getConfig.credentials);return f.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${f.statusCode}. Message: ${f.message||"Unknown error"}`),null):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}`),null)}return u}if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return null;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),null}})}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:[vi("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:[rS(vi("userId","in",_),vi("veltResourceId","in",T))]}}))??[])||[]}catch(D){return this.loggingService.catch(`Error in batch ${u+1}:`,D),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,D)=>T===D.findIndex(L=>L.userId===_.userId&&L.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;"),ti([this.userById$,this.customContactUserById$]).pipe(ge(([t,i])=>this.applyContactOverlay(t,i)),rt(Pt))}catch(t){return this.loggingService.catch("Error in UsersService getUserById$:",t),de({})}}applyContactOverlay(t,i){let o=M({},t??{});return Object.entries(i??{}).forEach(([s,a])=>{o[s]=M(M({},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]=M(M({},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(w=>!!w))];if(a.length===0)return{};let c={},l=[];if(a.forEach(w=>{let F=this.userIdByEmailCache[w];F?c[w]=F:l.push(w)}),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||Z();this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:Ln.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,D=new Promise((w,F)=>{T=setTimeout(()=>{F(new Error("resolveUserIdsByEmail timeout"))},_)}),L=s.config?.getRetryConfig||{retryCount:0,retryDelay:0},B=I(this,null,function*(){try{let w=yield xt(()=>s.resolveUserIdsByEmail(g),"resolveUserIdsByEmail",L);return w?.statusCode===200&&w?.data?w.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${w?.statusCode}. Message: ${w?.message||"Unknown error"}`),{})}finally{clearTimeout(T)}});try{let w=yield Promise.race([B,D]);return Object.entries(w).forEach(([F,U])=>{U&&(this.userIdByEmailCache[F]=U,c[F]=U,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:U,name:F,email:F},currentUserId:this.authService.getUser()?.userId??""}).catch(A=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",A)}))}),this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:Ln.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:w,emails:l}}),c}catch(w){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",w),this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:Ln.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:w,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)(C(Ot),C(Dr),C(vt),C(ef),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var uc=class{static getFirestoreProdDbName(e,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(n){return j.error("Error in isTestingDb:",n),!1}}};var cS=(()=>{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.endpointsService=J(xo),this.notificationActionTypeMap={[ye.NEWLY_ADDED]:Qt.COMMENT_ANNOTATION_ADD,[ye.ADDED]:Qt.COMMENT_ADD,[ye.UPDATED]:Qt.COMMENT_UPDATE,[ye.DELETED]:Qt.COMMENT_DELETE},this.additionalEventTypeMap={[ye.STATUS_CHANGED]:ar.STATUS_CHANGE,[ye.PRIORITY_CHANGED]:ar.PRIORITY_CHANGE,[ye.ASSIGNED]:ar.ASSIGN,[ye.ACCESS_MODE_CHANGED]:ar.ACCESS_MODE_CHANGE,[ye.CUSTOM_LIST_CHANGED]:ar.CUSTOM_LIST_CHANGE,[ye.APPROVED]:ar.APPROVE,[ye.ACCEPTED]:ar.ACCEPT,[ye.REJECTED]:ar.REJECT,[ye.SUGGESTION_ACCEPTED]:ar.SUGGESTION_ACCEPT,[ye.SUGGESTION_REJECTED]:ar.SUGGESTION_REJECT,[ye.REACTION_ADDED]:ar.REACTION_ADD,[ye.REACTION_DELETED]:ar.REACTION_DELETE,[ye.SUBSCRIBED]:ar.SUBSCRIBE,[ye.UNSUBSCRIBED]:ar.UNSUBSCRIBE}}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 M(M({},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(dl(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(dl(`@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?!gi(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 KT;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=Z();this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:Ln.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=dl(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(M({},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,d;i&&(u=this.notificationActionTypeMap?.[i],d=this.additionalEventTypeMap?.[i]);let f=this.commentAnnotationsResolverService.getAdditionalSaveEvents(),g=Array.isArray(f)?f:[],p={},_=null,T=!1;if(t&&t.annotationId){let w=t.annotationId;if(p[w]=M(M(M(M({annotationId:w,metadata:yn(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(U=>{t?.[U]&&(p[w][U]=t[U],delete t[U])}),l?.length)for(let U of l)t?.[U]!==void 0&&(p[w][U]=JSON.parse(JSON.stringify(t[U])));t.comments?.forEach(U=>{if(U.commentId){let A;a&&(A={},U.attachments?.forEach(R=>{A[R.attachmentId]={attachmentId:R.attachmentId,name:R.name,url:R.url}})),p[w].comments[U.commentId]=M(M(M(M(M(M({commentId:U.commentId},U?.commentHtml&&{commentHtml:U?.commentHtml}),U?.commentText&&{commentText:U?.commentText}),A&&{attachments:A}),U?.from&&{from:U?.from}),U?.to&&{to:U?.to}),U?.taggedUserContacts&&{taggedUserContacts:U?.taggedUserContacts})}}),T=this.isCommentsDataChanged(p[w],w);let F=new qT;Object.assign(F,t),c?.length>0&&c.forEach(U=>{U in t||delete F[U]}),F.comments=t.comments?.map(U=>this.stripCommentsFromAnnotationData({comment:U}))||[],_=F}let D=_?.comments?.find(w=>w.commentId===o);D?.isDraft&&(u=_?.comments?.length&&_?.comments?.length>0?Qt.COMMENT_ADD:Qt.COMMENT_ANNOTATION_ADD);let L=!!i&&!!this.notificationActionTypeMap?.[i],B=!!d&&!!_&&!L&&!D?.isDraft&&g.includes(d);return B&&(u=d),{strippedData:T&&(i&&this.notificationActionTypeMap?.[i]||D?.isDraft)||B?p:null,originalData:_,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(M({},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(dl(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}}applyNotificationVisibility({annotation:t,extraData:i,deniedForYouUsers:o}){try{let s=jC(t);if(!s)return o??[];i&&typeof i=="object"&&(i.visibility=s);let a=Object.values(i?.annotationData?.subscribedUsers||{}).map(l=>l?.user?.userId).filter(l=>!!l),c=GV(t,a);return[...new Set([...o??[],...c])]}catch(s){return this.loggingService.catch("Error in CommentUtilsService applyNotificationVisibility:",s),o??[]}}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=[],u=t?.metadata?.folderId;o.forEach(g=>{if(l.push({userId:g,resource:M({id:a,type:Ui.DOCUMENT,source:Qn.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:c?{access:c}:void 0},u&&{parentFolderId:u})}),c){let p=JSON.stringify(c);l.push({userId:g,resource:{id:p,type:Ui.CONTEXT,source:Qn.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let d=Z();this.coreActionsService.triggerAction(H.PERMISSION_PROVIDER,{event:P.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Qn.SET_NOTIFICATIONS,uniqueId:d,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let f=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:d,methodName:Qn.SET_NOTIFICATIONS});f?.success&&f?.data?.length&&f.data.forEach(g=>{g.hasAccess||s.push(g.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=iI(this.authService.getFirebaseConfig()?.firebaseOptions),u=Rr(this.functions,Ir({url:this.endpointsService.getSetEncryptedDataUrl(l),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),d={from:t?.from,visibilityConfig:t?.visibilityConfig,context:{accessFields:t?.context?.accessFields}};if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=t;let T=o?.targetAnnotationData?.commentId;if(T){let D=t?.comments?.find(L=>L?.commentId===T);D&&(o.targetAnnotationData=D)}try{let D=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??ye.NEWLY_ADDED});D?.originalData&&(o.annotationData=this.formatCommentData(D.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(D){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",D)}}let f=uc.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),g=yield this.getDeniedForYouUsers({extraData:o});g=this.applyNotificationVisibility({annotation:d,extraData:o,deniedForYouUsers:g});let p={path:i??"",data:t??{},dbId:f??"",notificationData:o||void 0,notificationURL:this.endpointsService.getNotificationsDbUrl(),feature:"comment",eventType:s??"PATCH",sdkVersion:Gr(),deniedForYouUsers:g,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},_=yield hl(p,this.authService.getUser()?.userId??"");yield u({veltData:_})}catch(l){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",l)}})}};e.\u0275fac=function(i){return new(i||e)(C(me),C(jt),C(Dr),C(ur),C(Xn),C(qo),C(Zh),C(vt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var lS=(()=>{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 L=i||Z();this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,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(M({},t),{activityIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let L=i||Z();this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{request:T}});let B=xt(()=>g?.config?.getConfig?.url?$t(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"resolveActivities",this.retryGetConfig).then(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:w,request:T}}),this.loggingService.catch(w?.message??"Error in ActivityResolverService resolveActivities:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield B)||{},this.analyticsService.trackEvent(P.Events.Resolver.ACTIVITY_RESOLVER_GET,{sourceMethod:"resolveActivities",source:"sdk",activityIds:_});let w={};Object.entries(p).forEach(([F,U])=>{let A=this.activityById$.value?.[F];A?A&&JSON.stringify(A)!==JSON.stringify(U)&&(w[F]=U):w[F]=U}),Object.keys(w).length>0&&this.activityById$.next(M(M({},this.activityById$.getValue()),w)),this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:w,request:T}}),d(w)}catch(w){let F=i||Z();this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:w,request:T}}),c||f(w),d(p)}}else u(),d({})}catch(L){u();let B=i||Z();this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:B,methodName:cr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:L,request:T}}),f(L)}})})}catch(a){this.loggingService.catch("Error in ActivityResolverService resolveActivities:",a);let c=i||Z();return this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.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||Z();this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.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=M(M({},a),t.activity);let c=yield xt(()=>{if(o?.config?.saveConfig?.url){let l={activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata};return $t(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}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(H.ACTIVITY_RESOLVER,{event:P.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(P.Events.Resolver.ACTIVITY_RESOLVER_SAVE,{sourceMethod:"saveActivity",source:"sdk",activityIds:Object.keys(t.activity),event:t.event}),this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.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||Z();return this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.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()):de(void 0)}catch(t){return this.loggingService.catch("Error in ActivityResolverService getActivitiesById$:",t),de(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)(C(vt),C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var uS=(()=>{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,this.endpointsService=J(xo)}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=iI(this.authService.getFirebaseConfig()?.firebaseOptions),c=Rr(this.functions,Ir({url:this.endpointsService.getSetEncryptedDataUrl(a),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=uc.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:Gr()},f=yield hl(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?!gi(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={},o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(t&&t.annotationId){let s=t.annotationId;if(i[s]=M({annotationId:s,metadata:yn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),o?.length>0)for(let c of o)t?.[c]!==void 0&&(i[s][c]=t[c],delete t[c]);if(!this.isReactionDataChanged(i[s],s))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);if(i){i.icon&&(t.icon=i.icon);let o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(o?.length>0)for(let s of o)i?.[s]!==void 0&&(t[s]=i[s])}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(C(me),C(jt),C(Dr),C(ur),C(Xn),C(Ko))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var dS=(()=>{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=M(M({},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,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=yn(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?yn(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?yn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ui)?.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 Me.ANNOTATION_ADD:return`${i} added a comment`;case Me.COMMENT_ADD:return`${i} replied to a comment`;case Me.COMMENT_UPDATE:return`${i} edited a comment`;case Me.COMMENT_DELETE:return`${i} deleted a comment`;case Me.ANNOTATION_DELETE:return`${i} deleted a comment thread`;case Me.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 Me.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 Me.ASSIGN:{let s=t.changes?.assignedTo?.to;return s&&typeof s=="object"&&s.name?`${i} assigned to ${s.name}`:`${i} assigned the comment`}case Me.ACCESS_MODE_CHANGE:{let s=t.changes?.accessMode?.to;return s?`${i} changed access to ${s}`:`${i} changed the access mode`}case Me.CUSTOM_LIST_CHANGE:return`${i} changed the custom list`;case Me.APPROVE:return`${i} approved the comment`;case Me.ACCEPT:case Me.SUGGESTION_ACCEPT:return`${i} accepted a suggestion`;case Me.REJECT:case Me.SUGGESTION_REJECT:return`${i} rejected a suggestion`;case Me.REACTION_ADD:return`${i} reacted to a comment`;case Me.REACTION_DELETE:return`${i} removed a reaction`;case Me.SUBSCRIBE:return`${i} subscribed to the thread`;case Me.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 Cg.RECORDING_ADD:return`${i} added a recording`;case Cg.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 Ng.REACTION_ADD:return`${i} added a reaction`;case Ng.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??ye.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(ui)?.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(ui)?.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(ui)?.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===ye.DELETED&&a?.isAnnotationDelete?Me.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 ye.NEWLY_ADDED:return Me.ANNOTATION_ADD;case ye.ADDED:return Me.COMMENT_ADD;case ye.UPDATED:return Me.COMMENT_UPDATE;case ye.DELETED:return Me.COMMENT_DELETE;case ye.STATUS_CHANGED:return Me.STATUS_CHANGE;case ye.PRIORITY_CHANGED:return Me.PRIORITY_CHANGE;case ye.ASSIGNED:return Me.ASSIGN;case ye.ACCESS_MODE_CHANGED:return Me.ACCESS_MODE_CHANGE;case ye.CUSTOM_LIST_CHANGED:return Me.CUSTOM_LIST_CHANGE;case ye.APPROVED:return Me.APPROVE;case ye.ACCEPTED:return Me.ACCEPT;case ye.REJECTED:return Me.REJECT;case ye.SUGGESTION_ACCEPTED:return Me.SUGGESTION_ACCEPT;case ye.SUGGESTION_REJECTED:return Me.SUGGESTION_REJECT;case ye.REACTION_ADDED:return Me.REACTION_ADD;case ye.REACTION_DELETED:return Me.REACTION_DELETE;case ye.SUBSCRIBED:return Me.SUBSCRIBE;case ye.UNSUBSCRIBED:return Me.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 MT.ADDED:return Cg.RECORDING_ADD;case MT.DELETED:return Cg.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 Ng.REACTION_ADD;case"delete":return Ng.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 ye.NEWLY_ADDED:case ye.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case ye.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case ye.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case ye.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case ye.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case ye.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case ye.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case ye.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(ui)?.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)(C(me),C(jt),C(cS),C(uS),C(qo),C(Ko),C(lc),C(lS),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var hS=class{constructor({apiKey:e,documentId:n,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=_a(s)),a&&(this.organizationId=Ds(a)),i&&(this.folderId=i,this.veltFolderId=bo(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 vz=(()=>{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=Z(),s=Ea.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:Ln.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)(C(vt),C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var fS=(()=>{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 U=i||Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Mn.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||[])],D=[],L=[],B=[];for(let U of T)_[U]||(this.inFlightRequests.has(U)?(D.push(this.inFlightRequests.get(U)),L.push(U)):B.push(U));let w=le(M({},t),{notificationIds:B});I(this,null,function*(){try{if(D.length>0&&(yield Promise.allSettled(D)),B.length>0){let U=i||Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:U,methodName:Mn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:w}});let A,R=new Promise(b=>{A=b});for(let b of B)this.inFlightRequests.set(b,R.then(x=>x?.[b]));let N=xt(()=>g?.config?.getConfig?.url?$t(g.config.getConfig.url,g.config.getConfig.headers,w,!0,g.config.getConfig.credentials):g?.get?.(w)||Promise.resolve(void 0),"getNotifications",this.retryGetConfig).then(b=>c?{}:(u(),b&&b.statusCode!==200?(this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Mn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:b,request:w}}),this.loggingService.catch(b?.message??"Error in NotificationResolverService resolveNotifications:"),{}):b?.data)).catch(b=>{throw u(),b});try{p=(yield N)||{},A(p);for(let x of B)this.inFlightRequests.delete(x);this.analyticsService.trackEvent(P.Events.Resolver.NOTIFICATION_RESOLVER_GET,{sourceMethod:"resolveNotifications",source:"sdk",notificationIds:B});let b={};Object.entries(p).forEach(([x,k])=>{let O=this.notificationById$.value?.[x];O?O&&JSON.stringify(O)!==JSON.stringify(k)&&(b[x]=k):b[x]=k}),Object.keys(b).length>0&&this.notificationById$.next(M(M({},this.notificationById$.getValue()),b)),this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:U,methodName:Mn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:b,request:w}}),d(b)}catch(b){A({});for(let k of B)this.inFlightRequests.delete(k);let x=i||Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:x,methodName:Mn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:b,request:w}}),c||f(b),d(p)}}else u(),d({})}catch(U){u();let A=i||Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:A,methodName:Mn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:U,request:w}}),f(U)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||Z();return this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Mn.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||Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Mn.DELETE_NOTIFICATION,source:"internal",payload:{notificationId:t,organizationId:i}});let c=this.notificationById$.getValue(),l=M({},c);delete l?.[t],this.notificationById$._value=l;let u={notificationId:t,organizationId:i},d=yield xt(()=>s?.config?.deleteConfig?.url?$t(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1,s.config.deleteConfig.credentials):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(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Mn.DELETE_NOTIFICATION,source:"internal",payload:{error:d,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(P.Events.Resolver.NOTIFICATION_RESOLVER_DELETE,{sourceMethod:"deleteNotification",source:"sdk",notificationId:t}),this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Mn.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||Z();return this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Mn.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()):de(void 0)}catch(t){return this.loggingService.catch("Error in NotificationResolverService getNotificationsById$:",t),de(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)(C(vt),C(me),C(Ot))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Up=class{constructor({apiKey:e,documentId:n,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=_a(i)),o&&(this.organizationId=Ds(o)),s&&(this.folderId=s,this.veltFolderId=bo(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 Sz=(()=>{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)(C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Az=(()=>{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=M(M({},o),t.user));let s=this.usersService.getContactListUser(t.user.userId);s&&(o=M(M({},o),s)),t=le(M({},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)(C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Rz=(()=>{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)(C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Dz=(()=>{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)(C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Cz=(()=>{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)(C(me),C(jt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Nz=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D,L,B,w,F,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=D,this.recorderAnnotationsResolverService=L,this.notificationResolverService=B,this.activityResolverService=w,this.serviceBook=F,this.attachmentResolverService=U}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 Up({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 Up({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 hS({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=Z(),a=Nd.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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=Z(),a=Od.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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=Z(),a=bd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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??this.docService.getOrganizationConfig()?.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(FT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(kT)?.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(ki)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ki)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(UT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ui)?.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(VT)?.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=Z(),D=Ea.GET_USERS;this.coreActionsService.triggerAction(H.USER_RESOLVER,{event:P.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Ln.FORMAT_RESPONSE,source:"internal",moduleName:D,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(ki)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(D=>!this.notificationResolverService.getNotificationById(D)));break}default:_=[]}if(_?.length){let T=Z(),D=kC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Mn.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let D=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(L=>!this.commentAnnotationsResolverService.getCommentAnnotationById(L))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let D=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(L=>!this.commentAnnotationsResolverService.getCommentAnnotationById(L))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),D=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...D],_=_.filter(L=>!this.commentAnnotationsResolverService.getCommentAnnotationById(L))}break}default:_=[]}if(_?.length){let T=Z(),D=Nd.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}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 D=[];for(let L of _)L?.id&&!this.activityResolverService.getActivityById(L.id)&&D.push(L.id);if(D.length){let L=Z(),B=UC.GET_ACTIVITIES;this.coreActionsService.triggerAction(H.ACTIVITY_RESOLVER,{event:P.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:L,methodName:cr.FORMAT_RESPONSE,moduleName:B,source:"internal",payload:{activityIds:D,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:L,moduleName:B}):this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:L,moduleName:B})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(D=D.filter(L=>!this.reactionAnnotationsResolverService.getAnnotationById(L)),D.length){let L=Z(),B=Od.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:L,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:B,source:"internal",payload:{reactionAnnotationIds:D,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:L,moduleName:B}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:L,moduleName:B})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(D=D.filter(L=>!this.recorderAnnotationsResolverService.getAnnotationById(L)),D.length){let L=Z(),B=bd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:L,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:B,source:"internal",payload:{recorderAnnotationIds:D,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:L,moduleName:B}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:L,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(ki);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(ki);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(ge(()=>{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}}),rt(Pt))}catch(o){return this.loggingService.catch("Error in mergeNotificationsWithResolvedData$:",o),de(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(ui);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(ki);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(FT);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(kT);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(ki);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(ki);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(UT);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(ui);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(VT);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(ge(()=>{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}}),rt(Pt))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),de(t)}}mergeReactionAnnotationsWithData$({data:t,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(ge(()=>{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}}),rt(Pt))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),de(t)}}mergeRecorderAnnotationsWithData$({data:t,feature:i}){try{return this.recorderAnnotationsResolverService.getRecorderAnnotationsById$().pipe(ge(()=>{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}}),rt(Pt))}catch(o){return this.loggingService.catch("Error in mergeRecorderAnnotationsWithData:",o),de(t)}}mergeUsersWithData$({feature:t,data:i}){try{return this.usersService.getUserById$().pipe(ge(()=>{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}}),rt(Pt))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${t}:`,o),de(i)}}mergeLocationMetadataWithData$({data:t,feature:i}){try{return this.docService.getLocationMetadata$().pipe(ge(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}}),rt(Pt))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,o),de(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(ui)?.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(M({},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 nB(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return rB(i);case"recorder":return iB(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(kT);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(FT);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(ui)?.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(VT)?.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(UT);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(M({},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(M({},_?.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=M({},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)(C(dS),C(Sz),C(cS),C(Az),C(vt),C(vz),C(me),C(Rz),C(uS),C(Dz),C(Cz),C(jt),C(ef),C(qo),C(Ko),C(lc),C(fS),C(lS),C(di),C(Zh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var iae={comment:{mode:"persistent",scope:"doc"},notification:{mode:"persistent",scope:"user"},notificationIndex:{mode:"persistent",scope:"user"},presence:{mode:"ephemeral",scope:"doc"},liveState:{mode:"ephemeral",scope:"doc"},cursor:{mode:"ephemeral",scope:"doc"},huddle:{mode:"ephemeral",scope:"doc"},syncVideoPlayer:{mode:"ephemeral",scope:"doc"},heartbeat:{mode:"ephemeral",scope:"org"},flockSession:{mode:"ephemeral",scope:"doc"},selection:{mode:"ephemeral",scope:"doc"}};function Oz(r){return iae[r]}var nt={getDatabase:rh,ref:ih,query:tj,get:Lm,set:ij,update:oj,remove:nj,push:ej,runTransaction:rj,onValue:Mb,onChildAdded:Q2,onChildChanged:X2,onChildRemoved:J2,off:Y2,objectVal:q2,listVal:z2,stateChanges:K2,onDisconnect:Z2},bz=(()=>{let e=class e{constructor(t,i){this.databaseService=t,this.loggingService=i}getServerTimeOffset(){return I(this,null,function*(){try{let t=this.databaseService.getDbValue();if(!t)return 0;let o=(yield Lm(ih(t,e.SERVER_TIME_OFFSET_PATH)))?.val();return typeof o=="number"?o:0}catch(t){return this.loggingService.catch("Error in FirebaseRealtimeAdapter getServerTimeOffset: ",t),0}})}onServerTimeOffset(t){let i=null,o=null;try{o=this.databaseService.getDb().subscribe(s=>{if(s){let a=ih(s,e.SERVER_TIME_OFFSET_PATH);i=Mb(a,c=>{try{t(c?.val())}catch(l){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset callback: ",l)}})}})}catch(s){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset: ",s)}return()=>{try{i&&(i(),i=null),o?.unsubscribe(),o=null}catch(s){this.loggingService.catch("Error tearing down FirebaseRealtimeAdapter onServerTimeOffset: ",s)}}}getChannelTag(t){return Oz(t)}getDatabaseInstance(t){return t?nt.getDatabase(void 0,t):nt.getDatabase()}rtdbRef(t,i){return nt.ref(t,i)}rtdbQueryRef(t,...i){return nt.query(t,...i)}rtdbGet(t){return nt.get(t)}rtdbSet(t,i,o){return this.getChannelTag(t),nt.set(i,o)}rtdbUpdate(t,i,o){return this.getChannelTag(t),nt.update(i,o)}rtdbRemove(t,i){return this.getChannelTag(t),nt.remove(i)}rtdbPush(t,i,o){return this.getChannelTag(t),o===void 0?nt.push(i):nt.push(i,o)}rtdbRunTransaction(t,i,o){return this.getChannelTag(t),nt.runTransaction(i,o)}rtdbOnValue(t,i,o,s,a){return this.getChannelTag(t),typeof s=="function"?a?nt.onValue(i,o,s,a):nt.onValue(i,o,s):s?nt.onValue(i,o,s):nt.onValue(i,o)}rtdbOnChildAdded(t,i,o,s){return this.getChannelTag(t),s?nt.onChildAdded(i,o,s):nt.onChildAdded(i,o)}rtdbOnChildChanged(t,i,o,s){return this.getChannelTag(t),s?nt.onChildChanged(i,o,s):nt.onChildChanged(i,o)}rtdbOnChildRemoved(t,i,o,s){return this.getChannelTag(t),s?nt.onChildRemoved(i,o,s):nt.onChildRemoved(i,o)}rtdbOff(t,i,o){nt.off(t,i,o)}rtdbObjectVal$(t,i){return this.getChannelTag(t),nt.objectVal(i)}rtdbListVal$(t,i){return this.getChannelTag(t),nt.listVal(i)}rtdbStateChanges$(t,i){return this.getChannelTag(t),nt.stateChanges(i)}rtdbOnDisconnectSet(t,i,o){return this.getChannelTag(t),nt.onDisconnect(i).set(o)}rtdbOnDisconnectUpdate(t,i,o){return this.getChannelTag(t),nt.onDisconnect(i).update(o)}rtdbOnDisconnectRemove(t,i){return this.getChannelTag(t),nt.onDisconnect(i).remove()}rtdbOnDisconnectCancel(t,i){return this.getChannelTag(t),nt.onDisconnect(i).cancel()}subscribe(t,i,o,s){return{unsubscribe:()=>{}}}publish(t,i,o){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.publish wiring deferred to Phase A"}})}presence(t,i){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.presence wiring deferred to Phase A"}})}onDisconnect(t,i){return I(this,null,function*(){return()=>{}})}};e.SERVER_TIME_OFFSET_PATH=".info/serverTimeOffset",e.\u0275fac=function(i){return new(i||e)(C(cc),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var gS=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{ti([this.authService.getFirebaseConfig$(),this.configService.getApiKey$(),this.configService.getFirestorePersistentCacheEnabled$()]).pipe(Rt(([s,a])=>!!s&&!!a),Dt(1)).subscribe(([s,a,c])=>{if(s&&a&&s?.firebaseOptions?.storeDbId){try{let d=sessionStorage?.getItem("veltFirestoreLogLevel")||dn?.firebaseLogLevel||"silent";aM(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=uc.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=jM({tabManager:HM()}));try{this.firestore$.next(eS(Sr(),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(Xh(l))}}else if(c)try{let d=Sr(),f=eS(d,{localCache:jM({tabManager:HM()})},l);this.firestore$.next(f)}catch{this.firestore$.next(Xh(l))}else this.firestore$.next(Xh(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||Xh("DocumentIdDb");if(t){let i=iS(t,"generateDocumentId");return xp(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(C(Xn),C(Dr),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Qr={doc:xp,collection:iS,collectionGroup:lz,query:gz,getDoc:WM,getDocs:hz,getCountFromServer:dz,setDoc:pz,deleteDoc:uz,onSnapshot:fz,runTransaction:mz},Lz=(()=>{let e=class e{constructor(t,i,o){this.firestoreService=t,this.databaseService=i,this.loggingService=o}read(t){return I(this,null,function*(){if((t.store??"firestore")==="rtdb"){let a=this.databaseService.getDbValue();return a?{data:(yield Lm(ih(a,t.location)))?.val()}:{data:void 0}}let o=this.firestoreService.getFirestoreValue();return o?{data:(yield WM(xp(o,t.location)))?.data()}:{data:void 0}})}runTransaction(t){return I(this,null,function*(){return t()})}firestoreDoc(t,i){return Qr.doc(t,i)}firestoreCollection(t,i){return Qr.collection(t,i)}firestoreCollectionGroup(t,i){return Qr.collectionGroup(t,i)}firestoreQuery(t,...i){return Qr.query(t,...i)}firestoreGetDoc(t){return Qr.getDoc(t)}firestoreGetDocs(t){return Qr.getDocs(t)}firestoreGetCountFromServer(t){return Qr.getCountFromServer(t)}firestoreSetDoc(t,i,o){return o?Qr.setDoc(t,i,o):Qr.setDoc(t,i)}firestoreDeleteDoc(t){return Qr.deleteDoc(t)}firestoreOnSnapshot(t,i,o){return o?Qr.onSnapshot(t,i,o):Qr.onSnapshot(t,i)}firestoreRunTransaction(t,i){return Qr.runTransaction(t,i)}addComment(t){return this.deferred("addComment")}editComment(t){return this.deferred("editComment")}deleteComment(t){return this.deferred("deleteComment")}setCommentResolved(t){return this.deferred("setCommentResolved")}setCommentMetadata(t){return this.deferred("setCommentMetadata")}bumpCommentViews(t){return this.deferred("bumpCommentViews")}markCommentThreadRead(t){return this.deferred("markCommentThreadRead")}markNotificationRead(t){return this.deferred("markNotificationRead")}addNotification(t){return this.deferred("addNotification")}deleteNotification(t){return this.deferred("deleteNotification")}updateNotification(t){return this.deferred("updateNotification")}updatePresence(t){return this.deferred("updatePresence")}grantAccess(t){return this.deferred("grantAccess")}revokeAccess(t){return this.deferred("revokeAccess")}getAccess(t){return this.deferred("getAccess")}upsertOrgUserProfile(t){return this.deferred("upsertOrgUserProfile")}upsertDocMetadata(t){return this.deferred("upsertDocMetadata")}upsertOrgMetadata(t){return this.deferred("upsertOrgMetadata")}createActivity(t){return this.deferred("createActivity")}deferred(t){return this.loggingService.warn(`[WB] FirebaseDbAdapter.${t} called but write-op wiring is deferred to Phase A (self-hosting Step 0). The SDK uses its existing direct write path in Step 0.`),Promise.resolve({ok:!1,code:"unimplemented",message:`FirebaseDbAdapter.${t} wiring deferred to Phase A`})}};e.\u0275fac=function(i){return new(i||e)(C(gS),C(cc),C(me))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Mz=(()=>{let e=class e{allow(){return Promise.resolve({allow:!0})}canRead(t){return I(this,null,function*(){return this.allow()})}canWrite(t){return I(this,null,function*(){return this.allow()})}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var T1e=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D,L,B,w){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=D,this.realtimeAdapter=L,this.dbAdapter=B,this.authzAdapter=w,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.serverTimeOffsetUnsub=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(jT).subscribe(F=>{this.activityService=F??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(F=>{F&&(this.db=F)})),this.serverTimeOffsetUnsub=this.realtimeAdapter.onServerTimeOffset(F=>{this.offset=F}),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(F=>{F&&(this.firestore=F)}))}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.serverTimeOffsetUnsub&&(this.serverTimeOffsetUnsub(),this.serverTimeOffsetUnsub=null),this.unsubscribeFromObservables()}setupOnDisconnect(t,i,o){return I(this,null,function*(){try{if(this.db){let s=this.realtimeAdapter.rtdbRef(this.db,t);return this.realtimeAdapter.rtdbOnDisconnectUpdate(o??"commondb",s,i)}return Promise.resolve()}catch(s){return this.loggingService.catch("Error in setupOnDisconnect:",s),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){ti([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Rt(([i,o])=>!!i),Dt(1),ea(([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=this.realtimeAdapter.rtdbRef(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=this.dbAdapter.firestoreDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield this.realtimeAdapter.rtdbSet(t,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=Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,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 this.realtimeAdapter.rtdbUpdate(t,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=Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRemove(t,l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=Z();this.coreActionsService.triggerAction(H.COMMENT_RESOLVER,{event:P.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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=Z();this.coreActionsService.triggerAction(H.REACTION_RESOLVER,{event:P.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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=Z();this.coreActionsService.triggerAction(H.RECORDER_RESOLVER,{event:P.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=Z();this.coreActionsService.triggerAction(H.NOTIFICATION_RESOLVER,{event:P.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Mn.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else yield this.dbAdapter.firestoreDeleteDoc(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=Z()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),Z()||"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=this.dbAdapter.firestoreCollection(this.firestore,o);i?.useCollectionGroup&&(s=this.dbAdapter.firestoreCollectionGroup(this.firestore,o));let a=i?.firestoreQuery??[],c=this.dbAdapter.firestoreQuery(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield this.dbAdapter.firestoreGetCountFromServer(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 this.dbAdapter.firestoreGetDocs(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=this.realtimeAdapter.rtdbRef(this.db,o),a=i?.rtdbQuery??[],c=this.realtimeAdapter.rtdbQueryRef(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield this.realtimeAdapter.rtdbGet(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),[]}})}buildAuthzRequest(t,i){return{feature:t,scope:"doc",resourceId:i?.id!=null?String(i.id):void 0,apiKey:i?.apiKey??this.configService.getApiKey()??void 0,organizationId:i?.organizationId!=null?String(i.organizationId):void 0,documentId:i?.documentId!=null?String(i.documentId):void 0}}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),{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"firestore",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"rtdb",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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 ti([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Rt(a=>!!a))]).pipe(Rt(([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)),pt(([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 pe(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 pe(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 de({})}catch(l){return this.loggingService.catch(`Error setting up listener for ${t}:`,l),de({})}}),Lc(()=>{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 pe(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(pt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),pt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):de(c)),pt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):de(c)),pt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):de(c)),rt(Pt)):(this.loggingService.warn(`[WB] No firestore path found for ${t} and key ${a}`),de({}))}setupCollectionListener(t,i,o,s,a){let c=`${o}-${JSON.stringify(a)}`,l=this.dbAdapter.firestoreCollection(t,i);if(a?.useCollectionGroup&&(l=this.dbAdapter.firestoreCollectionGroup(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=this.dbAdapter.firestoreQuery(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")),this.dbAdapter.firestoreOnSnapshot(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=this.dbAdapter.firestoreDoc(t,i);return this.dbAdapter.firestoreOnSnapshot(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}`),de({});let a=this.realtimeAdapter.rtdbRef(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=this.realtimeAdapter.rtdbQueryRef(a,...c)}return this.objectValFromChildEvents(a,t).pipe(as(c=>(this.loggingService.catch(`RTDB listener error for ${t}:`,c),de({}))),ge(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))),pt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),pt(c=>this.usersService.getUserById$().pipe(ge(()=>({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=this.realtimeAdapter.rtdbPush(t,a.dbRef);yield this.realtimeAdapter.rtdbSet(t,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 pe(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=this.realtimeAdapter.rtdbRef(u,d),p=!1,_=L=>{try{let B=L.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=L=>{try{this.loggingService.catch(`streamChildAdded error for ${t}:`,L),s.error(L)}catch(B){this.loggingService.catch(`streamChildAdded onError handler error for ${t}:`,B)}};this.realtimeAdapter.rtdbOnChildAdded(t,g,_,T);let D=this.realtimeAdapter.rtdbOnValue(t,g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{D&&typeof D=="function"&&D(),this.realtimeAdapter.rtdbOff(g,"child_added",_)}catch(L){this.loggingService.catch(`streamChildAdded cleanup error for ${t}:`,L)}}};return this.subscribeToServices(l),()=>{c=!0,a&&a()}})}catch(s){return this.loggingService.catch(`Error in streamChildAdded for ${t}`,s),de(null)}}objectValFromChildEvents(t,i){return new pe(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(!gi(T,c)){let D=JSON.parse(JSON.stringify(T));c=D,o.next(D)}}catch{}},d=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(M({},s)))}catch{}},f=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(M({},s)))}catch{}},g=T=>{try{T.key&&(delete s[T.key],a&&u(M({},s)))}catch{}},p=T=>{try{if(!a){let D=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=D,o.next(D),a=!0}}catch{}};this.realtimeAdapter.rtdbOnChildAdded(i,t,d,l),this.realtimeAdapter.rtdbOnChildChanged(i,t,f,l),this.realtimeAdapter.rtdbOnChildRemoved(i,t,g,l);let _=this.realtimeAdapter.rtdbOnValue(i,t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),this.realtimeAdapter.rtdbOff(t,"child_added",d),this.realtimeAdapter.rtdbOff(t,"child_changed",f),this.realtimeAdapter.rtdbOff(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(C(dS),C(Dr),C(Nz),C(vt),C(me),C(gS),C(cc),C(Xn),C(ef),C(jt),C(qo),C(Ko),C(lc),C(fS),C(di),C(bz),C(Lz),C(Mz))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{M as a,le as b,NS as c,cae as d,lae as e,uae as f,I as g,mt as h,pe as i,jS as j,Ct as k,Y as l,Mc as m,k6 as n,U6 as o,Oc as p,Mr as q,de as r,V6 as s,B6 as t,A6 as u,ge as v,ti as w,iA as x,G6 as y,fo as z,K6 as A,Oi as B,_6 as C,ju as D,Rt as E,c6 as F,as as G,VS as H,Mu as I,Dt as J,$S as K,rt as L,Pu as M,AE as N,WS as O,T6 as P,zS as Q,I6 as R,xu as S,pt as T,Zs as U,v6 as V,ea as W,y6 as X,D6 as Y,oe as Z,zE as _,K as $,us as aa,ee as ba,C as ca,J as da,pr as ea,zn as fa,go as ga,F0 as ha,k0 as ia,K0 as ja,Y0 as ka,lt as la,In as ma,sr as na,Pr as oa,Io as pa,Jc as qa,ni as ra,D4 as sa,un as ta,rD as ua,W4 as va,ha as wa,C_ as xa,j_ as ya,Z4 as za,Lq as Aa,Mq as Ba,Pq as Ca,xq as Da,Fq as Ea,Zq as Fa,gs as Ga,we as Ha,a8 as Ia,Q8 as Ja,X8 as Ka,So as La,tg as Ma,Es as Na,nT as Oa,dt as Pa,a5 as Qa,Do as Ra,rl as Sa,Ak as Ta,Y5 as Ua,fa as Va,Co as Wa,rg as Xa,bk as Ya,o9 as Za,Mk as _a,Pk as $a,oT as ab,ga as bb,Bk as cb,Gk as db,h9 as eb,g9 as fb,m9 as gb,p9 as hb,E9 as ib,_9 as jb,T9 as kb,$k as lb,$D as mb,jD as nb,jk as ob,HD as pb,WD as qb,Hk as rb,zD as sb,qD as tb,zk as ub,R9 as vb,qk as wb,Yk as xb,Qk as yb,b9 as zb,L9 as Ab,M9 as Bb,x9 as Cb,F9 as Db,k9 as Eb,U9 as Fb,V9 as Gb,B9 as Hb,G9 as Ib,nU as Jb,rU as Kb,eK as Lb,nK as Mb,hK as Nb,hU as Ob,KD as Pb,fU as Qb,gU as Rb,mU as Sb,pK as Tb,pU as Ub,_U as Vb,EK as Wb,_K as Xb,TK as Yb,IK as Zb,RK as _b,DK as $b,CK as ac,NK as bc,OK as cc,bK as dc,wK as ec,LK as fc,MK as gc,PK as hc,xK as ic,FK as jc,UK as kc,BK as lc,GK as mc,$K as nc,jK as oc,HK as pc,qK as qc,lg as rc,ug as sc,ZD as tc,Vye as uc,Bye as vc,Gye as wc,SY as xc,dC as yc,$ye as zc,jye as Ac,Hye as Bc,No as Cc,YU as Dc,HY as Ec,h1 as Fc,WY as Gc,_C as Hc,zY as Ic,qY as Jc,KY as Kc,YY as Lc,XY as Mc,ZY as Nc,t7 as Oc,TC as Pc,AT as Qc,RT as Rc,E7 as Sc,I7 as Tc,x1 as Uc,H7 as Vc,W7 as Wc,wC as Xc,q1 as Yc,xC as Zc,kd as _c,$r as $c,Ta as ad,uI as bd,gl as cd,vr as dd,Be as ed,fn as fd,lr as gd,Po as hd,yr as id,Sa as jd,Sr as kd,Ke as ld,jX as md,yLe as nd,SLe as od,ALe as pd,Gi as qd,Aa as rd,Ns as sd,$i as td,_e as ud,ji as vd,Os as wd,$Le as xd,jLe as yd,HLe as zd,Da as Ad,hZ as Bd,gZ as Cd,CZ as Dd,Il as Ed,vl as Fd,DPe as Gd,CPe as Hd,hxe as Id,Yre as Jd,fxe as Kd,Qre as Ld,Xre as Md,Jre as Nd,ur as Od,WPe as Pd,zPe as Qd,qPe as Rd,Q1 as Sd,uQ as Td,Og as Ud,dn as Vd,j as Wd,ye as Xd,Qt as Yd,lRe as Zd,uRe as _d,dRe as $d,hRe as ae,H as be,fRe as ce,gRe as de,mRe as ee,pRe as fe,K7 as ge,Y7 as he,Q7 as ie,X7 as je,MT as ke,J7 as le,ERe as me,Z7 as ne,LC as oe,eQ as pe,Br as qe,PT as re,tQ as se,Ad as te,Mt as ue,nQ as ve,xT as we,rQ as xe,iQ as ye,oQ as ze,_Re as Ae,TRe as Be,IRe as Ce,sQ as De,v as Ee,H1 as Fe,JRe as Ge,Cd as He,nDe as Ie,rDe as Je,hi as Ke,Nt as Le,X1 as Me,J1 as Ne,LDe as Oe,MDe as Pe,qT as Qe,FC as Re,KT as Se,Ln as Te,Ea as Ue,Oo as Ve,nV as We,rV as Xe,iV as Ye,As as Ze,iCe as _e,Qn as $e,Ui as af,oV as bf,sV as cf,aV as df,cV as ef,lV as ff,uV as gf,dV as hf,hV as if,fV as jf,gV as kf,mV as lf,BCe as mf,GCe as nf,pV as of,VC as pf,EV as qf,_V as rf,IV as sf,INe as tf,Rs as uf,dQ as vf,hQ as wf,Abe as xf,FV as yf,kV as zf,xbe as Af,Tr as Bf,fi as Cf,_a as Df,Ds as Ef,bo as Ff,Fbe as Gf,kbe as Hf,Ube as If,Vbe as Jf,Bbe as Kf,Gbe as Lf,VV as Mf,BV as Nf,$be as Of,jbe as Pf,jC as Qf,GV as Rf,Hbe as Sf,Wbe as Tf,$V as Uf,Z as Vf,zbe as Wf,jV as Xf,Ld as Yf,bV as Zf,wV as _f,gQ as $f,mQ as ag,hl as bg,HC as cg,qbe as dg,wo as eg,Kbe as fg,Mg as gg,gi as hg,Ybe as ig,WC as jg,dl as kg,_Q as lg,tI as mg,Qbe as ng,Xbe as og,WV as pg,Pg as qg,TQ as rg,IQ as sg,vQ as tg,yQ as ug,SQ as vg,Gr as wg,Jbe as xg,GC as yg,Zbe as zg,RQ as Ag,ewe as Bg,twe as Cg,qV as Dg,nwe as Eg,rwe as Fg,iwe as Gg,owe as Hg,swe as Ig,awe as Jg,cwe as Kg,eI as Lg,lwe as Mg,uwe as Ng,dwe as Og,hwe as Pg,fwe as Qg,gwe as Rg,mwe as Sg,pwe as Tg,Ewe as Ug,_we as Vg,Twe as Wg,Iwe as Xg,vwe as Yg,ywe as Zg,Swe as _g,Awe as $g,Rwe as ah,Dwe as bh,Cwe as ch,Nwe as dh,Owe as eh,bwe as fh,wwe as gh,Lwe as hh,Mwe as ih,OQ as jh,Pwe as kh,xwe as lh,Fwe as mh,MV as nh,kwe as oh,Uwe as ph,Pt as qh,yn as rh,Vwe as sh,xt as th,$t as uh,bQ as vh,ZV as wh,Md as xh,qC as yh,Ir as zh,Bwe as Ah,PV as Bh,P as Ch,Rr as Dh,FT as Eh,RRe as Fh,DRe as Gh,ki as Hh,CRe as Ih,kT as Jh,NRe as Kh,ORe as Lh,UT as Mh,bRe as Nh,VT as Oh,wRe as Ph,BT as Qh,LRe as Rh,ui as Sh,MRe as Th,Rd as Uh,PRe as Vh,xRe as Wh,FRe as Xh,kRe as Yh,URe as Zh,VRe as _h,BRe as $h,GT as ai,GRe as bi,$Re as ci,$T as di,jT as ei,B1 as fi,G1 as gi,$1 as hi,di as ii,Ot as ji,me as ki,Xn as li,Zee as mi,a0e as ni,xo as oi,aj as pi,vt as qi,Ov as ri,bv as si,Dr as ti,rS as ui,qse as vi,Kse as wi,Yse as xi,Qse as yi,vi as zi,cc as Ai,qo as Bi,Ko as Ci,Zh as Di,lc as Ei,ef as Fi,jt as Gi,cS as Hi,lS as Ii,dS as Ji,hS as Ki,vz as Li,fS as Mi,Nz as Ni,bz as Oi,T1e as Pi};