@veltdev/sdk-dev 4.5.0-beta.42 → 4.5.0-beta.43

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 (2) hide show
  1. package/package.json +1 -1
  2. package/velt.js +3 -3
package/velt.js CHANGED
@@ -1,4 +1,4 @@
1
- var SNIPPYLY_VERSION = '4.5.0-beta.42';
1
+ var SNIPPYLY_VERSION = '4.5.0-beta.43';
2
2
  (function(m,w){"use strict";function rt(){var e=K.splice(0,K.length);for(ie=0;e.length;)e.shift().call(null,e.shift())}function me(e,t){for(var n=0,r=e.length;n<r;n++)Te(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],U(t,q[pe(t)])}function fe(e){return function(t){Lt(t)&&(Te(t,e),L.length&&me(t.querySelectorAll(L),e))}}function pe(e){var t=le.call(e,"is"),n=e.nodeName.toUpperCase(),r=v.call(D,t?Y+t.toUpperCase():x+n);return t&&-1<r&&!De(n,t)?-1:r}function De(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Ie(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[W]||2,a=e[He]||3;!ce||o&&o!==t||!t[y]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[y](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Fe(e){var t=fe(e);return function(n){K.push(t,n.target),ie&&clearTimeout(ie),ie=setTimeout(rt,1)}}function de(e){nt&&(nt=!1,e.currentTarget.removeEventListener(Ze,de)),L.length&&me((e.target||u).querySelectorAll(L),e.detail===E?E:b),R&&at()}function lt(e,t){var n=this;Ye.call(n,e,t),Me.call(n,{target:n})}function Se(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&U(r,q[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function he(e,t){Tt(e,t),$?$.observe(e,gt):(ue&&(e.setAttribute=lt,e[H]=Ee(e),e[g](st,Me)),e[g](N,Ie)),e[k]&&ce&&(e.created=!0,e[k](),e.created=!1)}function at(){for(var e,t=0,n=G.length;t<n;t++)e=G[t],V.contains(e)||(n--,G.splice(t--,1),Te(e,E))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Te(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(Q(e,q[o]),o=0,t!==b||e[b]?t!==E||e[E]||(e[b]=!1,e[E]=!0,r="disconnected",o=1):(e[E]=!1,e[b]=!0,r="connected",o=1,R&&v.call(G,e)<0&&G.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function z(){}function Pe(e,t,n){var r=n&&n[_]||"",o=t.prototype,l=Ce(o),a=t.observedAttributes||ye,s={prototype:l};oe(l,k,{value:function(){if(te)te=!1;else if(!this[B]){this[B]=!0,new t(this),o[k]&&o[k].call(this);var i=j[ne.get(t)];(!Z||i.create.length>1)&&_e(this)}}}),oe(l,y,{value:function(i){-1<v.call(a,i)&&o[y]&&o[y].apply(this,arguments)}}),o[qe]&&oe(l,ut,{value:o[qe]}),o[Be]&&oe(l,ct,{value:o[Be]}),r&&(s[_]=r),e=e.toUpperCase(),j[e]={constructor:t,create:r?[r,re(e)]:[e]},ne.set(t,e),u[S](e.toLowerCase(),s),Le(e),P[e].r()}function Re(e){var t=j[e.toUpperCase()];return t&&t.constructor}function Ue(e){return typeof e=="string"?e:e&&e.is||""}function _e(e){for(var t,n=e[y],r=n?e.attributes:ye,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Le(e){return e=e.toUpperCase(),e in P||(P[e]={},P[e].p=new Xe(function(t){P[e].r=t})),P[e].p}function ke(){C&&delete m.customElements,I(m,"customElements",{configurable:!0,value:new z}),I(m,"CustomElementRegistry",{configurable:!0,value:z});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;function(n){var r=m[n];if(r){m[n]=function(o){var l,a;return o||(o=this),o[B]||(te=!0,l=j[ne.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,ye,l.constructor):u.createElement.apply(u,l.create),o[B]=!0,te=!1,a||_e(o)),o},m[n].prototype=r.prototype;try{r.prototype.constructor=m[n]}catch{dt=!0,I(r,B,{value:m[n]})}}}(e[t]));u.createElement=function(n,r){var o=Ue(r);return o?Ae.call(this,n,re(o)):Ae.call(this,n)},et||(Oe=!0,u[S](""))}var u=m.document,T=m.Object,it=function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(p){var f,h=[];for(f in i)p.test(f)&&h.push(f);return h},s=function(p,f){(f=f.toLowerCase())in i||(i[p]=(i[p]||[]).concat(f),i[f]=i[f.toUpperCase()]=p)},i=(T.create||T)(null),c={};for(n in e)for(o in e[n])for(r=e[n][o],i[o]=r,t=0;t<r.length;t++)i[r[t].toLowerCase()]=i[r[t].toUpperCase()]=o;return c.get=function(p){return typeof p=="string"?i[p]||(l.test(p)?[]:""):a(p)},c.set=function(p,f){return l.test(p)?s(p,f):s(f,p),c},c}({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLShadowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});typeof w!="object"&&(w={type:w||"auto"});var K,Me,X,Ee,$,ve,Q,U,A,S="registerElement",xe=1e5*m.Math.random()>>0,H="__"+S+xe,g="addEventListener",b="attached",O="Callback",E="detached",_="extends",y="attributeChanged"+O,ut=b+O,qe="connected"+O,Be="disconnected"+O,k="created"+O,ct=E+O,W="ADDITION",He="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",x="<",Y="=",mt=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ft=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],D=[],q=[],L="",V=u.documentElement,v=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},ge=T.prototype,be=ge.hasOwnProperty,J=ge.isPrototypeOf,I=T.defineProperty,ye=[],ee=T.getOwnPropertyDescriptor,je=T.getOwnPropertyNames,pt=T.getPrototypeOf,Ge=T.setPrototypeOf,ze=!!T.__proto__,dt=!1,B="__dreCEv1",C=m.customElements,Z=!/^force/.test(w.type)&&!!(C&&C.define&&C.get&&C.whenDefined),Ke=T.create||T,ht=m.Map||function(){var e,t=[],n=[];return{get:function(r){return n[v.call(t,r)]},set:function(r,o){e=v.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},Xe=m.Promise||function(e){function t(l){for(r=!0;n.length;)n.shift()(l)}var n=[],r=!1,o={catch:function(){return o},then:function(l){return n.push(l),r&&setTimeout(t,1),o}};return e(t),o},te=!1,j=Ke(null),P=Ke(null),ne=new ht,re=function(e){return e.toLowerCase()},Ce=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=Ge||(ze?function(e,t){return e.__proto__=t,e}:je&&ee?function(){function e(t,n){for(var r,o=je(n),l=0,a=o.length;l<a;l++)r=o[l],be.call(t,r)||I(t,r,ee(n,r))}return function(t,n){do e(t,n);while((n=pt(n))&&!J.call(n,t));return t}}():function(e,t){for(var n in t)e[n]=t[n];return e}),F=m.MutationObserver||m.WebKitMutationObserver,$e=m.HTMLAnchorElement,d=(m.HTMLElement||m.Element||m.Node).prototype,R=!J.call(d,V),oe=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return J.call(d,e)},G=R&&[],Qe=d.attachShadow,We=d.cloneNode,Mt=d.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},we=d.dispatchEvent,le=d.getAttribute,Et=d.hasAttribute,vt=d.removeAttribute,Ye=d.setAttribute,ae=u.createElement,Ht=u.importNode,Ae=ae,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},Je=F||function(e){ue=!1,V.removeEventListener(N,Je)},ie=0,et=S in u&&!/^force-all/.test(w.type),tt=!0,Oe=!1,ue=!0,nt=!0,ce=!0;if(F&&(A=u.createElement("div"),A.innerHTML="<div><div></div></div>",new F(function(e,t){if(e[0]&&e[0].type=="childList"&&!e[0].removedNodes[0].childNodes.length){A=ee(d,"innerHTML");var n=A&&A.set;n&&I(d,"innerHTML",{set:function(r){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,r)}})}t.disconnect(),A=null}).observe(A,{childList:!0,subtree:!0}),A.innerHTML=""),et||(Ge||ze?(Q=function(e,t){J.call(t,e)||he(e,t)},U=he):(Q=function(e,t){e[H]||(e[H]=T(!0),he(e,t))},U=Q),R?(ue=!1,function(){var e=ee(d,g),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=le.call(this,l),a.newValue=null,a[He]=a.attrChange=2,vt.call(this,l),we.call(this,a)},r=function(l,a){var s=Et.call(this,l),i=s&&le.call(this,l),c=new CustomEvent(N,{bubbles:!0});Ye.call(this,l,a),c.attrName=l,c.prevValue=s?i:null,c.newValue=a,s?c.MODIFICATION=c.attrChange=1:c[W]=c.attrChange=0,we.call(this,c)},o=function(l){var a,s=l.currentTarget,i=s[H],c=l.propertyName;i.hasOwnProperty(c)&&(i=i[c],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=s[c]||null,a.prevValue==null?a[W]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,we.call(s,a))};e.value=function(l,a,s){l===N&&this[y]&&this.setAttribute!==r&&(this[H]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,s)},I(d,g,e)}()):F||(V[g](N,Je),V.setAttribute(H,1),V.removeAttribute(H),ue&&(Me=function(e){var t,n,r,o=this;if(o===e.target){t=o[H],o[H]=n=Ee(o);for(r in n){if(!(r in t))return X(0,o,r,t[r],n[r],W);if(n[r]!==t[r])return X(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return X(2,o,r,t[r],n[r],He)}},X=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Ie(a)},Ee=function(e){for(var t,n,r={},o=e.attributes,l=0,a=o.length;l<a;l++)t=o[l],(n=t.name)!=="setAttribute"&&(r[n]=t.value);return r})),u[S]=function(e,t){if(n=e.toUpperCase(),tt&&(tt=!1,F?($=function(i,c){function p(f,h){for(var M=0,se=f.length;M<se;h(f[M++]));}return new F(function(f){for(var h,M,se,Ne=0,bt=f.length;Ne<bt;Ne++)h=f[Ne],h.type==="childList"?(p(h.addedNodes,i),p(h.removedNodes,c)):(M=h.target,ce&&M[y]&&h.attributeName!=="style"&&(se=le.call(M,h.attributeName))!==h.oldValue&&M[y](h.attributeName,h.oldValue,se))})}(fe(b),fe(E)),ve=function(i){return $.observe(i,{childList:!0,subtree:!0}),i},ve(u),Qe&&(d.attachShadow=function(){return ve(Qe.apply(this,arguments))})):(K=[],u[g]("DOMNodeInserted",Fe(b)),u[g]("DOMNodeRemoved",Fe(E))),u[g](Ze,de),u[g]("readystatechange",de),u.importNode=function(i,c){switch(i.nodeType){case 1:return Se(u,Ht,[i,!!c]);case 11:for(var p=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)p.appendChild(u.importNode(f[M],!!c));return p;default:return We.call(i,!!c)}},d.cloneNode=function(i){return Se(this,We,[!!i])}),Oe)return Oe=!1;if(-2<v.call(D,Y+n)+v.call(D,x+n)&&Ve(e),!mt.test(n)||-1<v.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(s,n):u.createElement(s)},l=t||ge,a=be.call(l,_),s=a?t[_].toUpperCase():n;return a&&-1<v.call(D,x+s)&&Ve(s),r=D.push((a?Y:x)+n)-1,L=L.concat(L.length?",":"",a?s+'[is="'+e.toLowerCase()+'"]':s),o.prototype=q[r]=be.call(l,"prototype")?l.prototype:Ce(d),L.length&&me(u.querySelectorAll(L),b),o},u.createElement=Ae=function(e,t){var n=Ue(t),r=n?ae.call(u,e,re(n)):ae.call(u,e),o=""+e,l=v.call(D,(n?Y:x)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=De(o.toUpperCase(),n))),ce=!u.createElement.innerHTMLHelper,a&&U(r,q[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),z.prototype={constructor:z,define:Z?function(e,t,n){if(n)Pe(e,t,n);else{var r=e.toUpperCase();j[r]={constructor:t,create:[r]},ne.set(t,r),C.define(e,t)}}:Pe,get:Z?function(e){return C.get(e)||Re(e)}:Re,whenDefined:Z?function(e){return Xe.race([C.whenDefined(e),Le(e)])}:Le},!C||/^force/.test(w.type))ke();else if(!w.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[_]="a",e.prototype=Ce($e.prototype),e.prototype.constructor=e,m.customElements.define(n,e,t),!r.test(u.createElement("a",{is:n}).outerHTML)||!r.test(new e().outerHTML))throw t})(function e(){return Reflect.construct($e,[],e)},{},"document-register-element-a"+xe)}catch{ke()}if(!w.noBuiltIn)try{if(ae.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{re=function(t){return{is:t.toLowerCase()}}}})(window);
3
3
 
4
4
  var Eve=Object.create;var QD=Object.defineProperty,xve=Object.defineProperties,Tve=Object.getOwnPropertyDescriptor,Dve=Object.getOwnPropertyDescriptors,wve=Object.getOwnPropertyNames,XD=Object.getOwnPropertySymbols,Hz=Object.getPrototypeOf,H9=Object.prototype.hasOwnProperty,zz=Object.prototype.propertyIsEnumerable,Ove=Reflect.get;var $z=(n,o,t)=>o in n?QD(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,I=(n,o)=>{for(var t in o||={})H9.call(o,t)&&$z(n,t,o[t]);if(XD)for(var t of XD(o))zz.call(o,t)&&$z(n,t,o[t]);return n},T=(n,o)=>xve(n,Dve(o));var z9=(n,o)=>{var t={};for(var e in n)H9.call(n,e)&&o.indexOf(e)<0&&(t[e]=n[e]);if(n!=null&&XD)for(var e of XD(n))o.indexOf(e)<0&&zz.call(n,e)&&(t[e]=n[e]);return t};var Ave=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports),JD=(n,o)=>{for(var t in o)QD(n,t,{get:o[t],enumerable:!0})},Pve=(n,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of wve(o))!H9.call(n,i)&&i!==t&&QD(n,i,{get:()=>o[i],enumerable:!(e=Tve(o,i))||e.enumerable});return n};var Gz=(n,o,t)=>(t=n!=null?Eve(Hz(n)):{},Pve(o||!n||!n.__esModule?QD(t,"default",{value:n,enumerable:!0}):t,n));var Ud=(n,o,t)=>Ove(Hz(n),t,o);var ee=(n,o,t)=>new Promise((e,i)=>{var r=c=>{try{s(t.next(c))}catch(p){i(p)}},a=c=>{try{s(t.throw(c))}catch(p){i(p)}},s=c=>c.done?e(c.value):Promise.resolve(c.value).then(r,a);s((t=t.apply(n,o)).next())});var sz=Ave((OJi,az)=>{"use strict";var _t={};_t.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};_t.localCName=_t.generateIdentifier();_t.splitLines=function(n){return n.trim().split(`
@@ -67,7 +67,7 @@ Content-Type: `+p.contentType+`\r
67
67
  `],encapsulation:2})}return n})(),tS=class{overlayRef;config;componentInstance;componentRef;containerInstance;disableClose;closed=new Xe;backdropClick;keydownEvents;outsidePointerEvents;id;_detachSubscription;constructor(o,t){this.overlayRef=o,this.config=t,this.disableClose=t.disableClose,this.backdropClick=o.backdropClick(),this.keydownEvents=o.keydownEvents(),this.outsidePointerEvents=o.outsidePointerEvents(),this.id=t.id,this.keydownEvents.subscribe(e=>{e.keyCode===27&&!this.disableClose&&!Kr(e)&&(e.preventDefault(),this.close(void 0,{focusOrigin:"keyboard"}))}),this.backdropClick.subscribe(()=>{this.disableClose||this.close(void 0,{focusOrigin:"mouse"})}),this._detachSubscription=o.detachments().subscribe(()=>{t.closeOnOverlayDetachments!==!1&&this.close()})}close(o,t){if(this.containerInstance){let e=this.closed;this.containerInstance._closeInteractionType=t?.focusOrigin||"program",this._detachSubscription.unsubscribe(),this.overlayRef.dispose(),e.next(o),e.complete(),this.componentInstance=this.containerInstance=null}}updatePosition(){return this.overlayRef.updatePosition(),this}updateSize(o="",t=""){return this.overlayRef.updateSize({width:o,height:t}),this}addPanelClass(o){return this.overlayRef.addPanelClass(o),this}removePanelClass(o){return this.overlayRef.removePanelClass(o),this}},E5e=new at("DialogScrollStrategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.block()}}),x5e=new at("DialogData"),T5e=new at("DefaultDialogConfig");var iS=(()=>{class n{_overlay=Se(Bi);_injector=Se(Et);_defaultOptions=Se(T5e,{optional:!0});_parentDialog=Se(n,{optional:!0,skipSelf:!0});_overlayContainer=Se($O);_idGenerator=Se(fs);_openDialogsAtThisLevel=[];_afterAllClosedAtThisLevel=new Xe;_afterOpenedAtThisLevel=new Xe;_ariaHiddenElements=new Map;_scrollStrategy=Se(E5e);get openDialogs(){return this._parentDialog?this._parentDialog.openDialogs:this._openDialogsAtThisLevel}get afterOpened(){return this._parentDialog?this._parentDialog.afterOpened:this._afterOpenedAtThisLevel}afterAllClosed=Og(()=>this.openDialogs.length?this._getAfterAllClosed():this._getAfterAllClosed().pipe(qo(void 0)));constructor(){}open(t,e){let i=this._defaultOptions||new Ep;e=I(I({},i),e),e.id=e.id||this._idGenerator.getId("cdk-dialog-"),e.id&&this.getDialogById(e.id);let r=this._getOverlayConfig(e),a=this._overlay.create(r),s=new tS(a,e),c=this._attachContainer(a,s,e);return s.containerInstance=c,this._attachDialogContent(t,s,c,e),this.openDialogs.length||this._hideNonDialogContentFromAssistiveTechnology(),this.openDialogs.push(s),s.closed.subscribe(()=>this._removeOpenDialog(s,!0)),this.afterOpened.next(s),s}closeAll(){YB(this.openDialogs,t=>t.close())}getDialogById(t){return this.openDialogs.find(e=>e.id===t)}ngOnDestroy(){YB(this._openDialogsAtThisLevel,t=>{t.config.closeOnDestroy===!1&&this._removeOpenDialog(t,!1)}),YB(this._openDialogsAtThisLevel,t=>t.close()),this._afterAllClosedAtThisLevel.complete(),this._afterOpenedAtThisLevel.complete(),this._openDialogsAtThisLevel=[]}_getOverlayConfig(t){let e=new Xl({positionStrategy:t.positionStrategy||this._overlay.position().global().centerHorizontally().centerVertically(),scrollStrategy:t.scrollStrategy||this._scrollStrategy(),panelClass:t.panelClass,hasBackdrop:t.hasBackdrop,direction:t.direction,minWidth:t.minWidth,minHeight:t.minHeight,maxWidth:t.maxWidth,maxHeight:t.maxHeight,width:t.width,height:t.height,disposeOnNavigation:t.closeOnNavigation});return t.backdropClass&&(e.backdropClass=t.backdropClass),e}_attachContainer(t,e,i){let r=i.injector||i.viewContainerRef?.injector,a=[{provide:Ep,useValue:i},{provide:tS,useValue:e},{provide:tu,useValue:t}],s;i.container?typeof i.container=="function"?s=i.container:(s=i.container.type,a.push(...i.container.providers(i))):s=nS;let c=new Fo(s,i.viewContainerRef,Et.create({parent:r||this._injector,providers:a}));return t.attach(c).instance}_attachDialogContent(t,e,i,r){if(t instanceof vo){let a=this._createInjector(r,e,i,void 0),s={$implicit:r.data,dialogRef:e};r.templateContext&&(s=I(I({},s),typeof r.templateContext=="function"?r.templateContext():r.templateContext)),i.attachTemplatePortal(new ja(t,null,s,a))}else{let a=this._createInjector(r,e,i,this._injector),s=i.attachComponentPortal(new Fo(t,r.viewContainerRef,a));e.componentRef=s,e.componentInstance=s.instance}}_createInjector(t,e,i,r){let a=t.injector||t.viewContainerRef?.injector,s=[{provide:x5e,useValue:t.data},{provide:tS,useValue:e}];return t.providers&&(typeof t.providers=="function"?s.push(...t.providers(e,t,i)):s.push(...t.providers)),t.direction&&(!a||!a.get(Vr,null,{optional:!0}))&&s.push({provide:Vr,useValue:{value:t.direction,change:se()}}),Et.create({parent:a||r,providers:s})}_removeOpenDialog(t,e){let i=this.openDialogs.indexOf(t);i>-1&&(this.openDialogs.splice(i,1),this.openDialogs.length||(this._ariaHiddenElements.forEach((r,a)=>{r?a.setAttribute("aria-hidden",r):a.removeAttribute("aria-hidden")}),this._ariaHiddenElements.clear(),e&&this._getAfterAllClosed().next()))}_hideNonDialogContentFromAssistiveTechnology(){let t=this._overlayContainer.getContainerElement();if(t.parentElement){let e=t.parentElement.children;for(let i=e.length-1;i>-1;i--){let r=e[i];r!==t&&r.nodeName!=="SCRIPT"&&r.nodeName!=="STYLE"&&!r.hasAttribute("aria-live")&&(this._ariaHiddenElements.set(r,r.getAttribute("aria-hidden")),r.setAttribute("aria-hidden","true"))}}}_getAfterAllClosed(){let t=this._parentDialog;return t?t._getAfterAllClosed():this._afterAllClosedAtThisLevel}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Pe({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function YB(n,o){let t=n.length;for(;t--;)o(n[t])}var F5=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[iS],imports:[Ls,sl,qy,sl]})}return n})();function D5e(n,o){}var Bne="_mat-bottom-sheet-enter",Vne="_mat-bottom-sheet-exit",w5e=(()=>{class n extends nS{_breakpointSubscription;_animationsDisabled=Se(sr,{optional:!0})==="NoopAnimations";_animationState="void";_animationStateChanged=new Ae;_destroyed;constructor(){super();let t=Se(mo);this._breakpointSubscription=t.observe([wi.Medium,wi.Large,wi.XLarge]).subscribe(()=>{let e=this._elementRef.nativeElement.classList;e.toggle("mat-bottom-sheet-container-medium",t.isMatched(wi.Medium)),e.toggle("mat-bottom-sheet-container-large",t.isMatched(wi.Large)),e.toggle("mat-bottom-sheet-container-xlarge",t.isMatched(wi.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(Bne))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(Vne))}ngOnDestroy(){super.ngOnDestroy(),this._breakpointSubscription.unsubscribe(),this._destroyed=!0}_simulateAnimation(t){this._ngZone.run(()=>{this._handleAnimationEvent(!0,t),setTimeout(()=>this._handleAnimationEvent(!1,t))})}_trapFocus(){super._trapFocus({preventScroll:!0})}_handleAnimationEvent(t,e){let i=e===Bne;(i||e===Vne)&&this._animationStateChanged.emit({toState:i?"visible":"hidden",phase:t?"start":"done"})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(e,i){e&1&&G("animationstart",function(a){return i._handleAnimationEvent(!0,a.animationName)})("animationend",function(a){return i._handleAnimationEvent(!1,a.animationName)})("animationcancel",function(a){return i._handleAnimationEvent(!1,a.animationName)}),e&2&&(x("role",i._config.role)("aria-modal",i._config.ariaModal)("aria-label",i._config.ariaLabel),ge("mat-bottom-sheet-container-animations-enabled",!i._animationsDisabled)("mat-bottom-sheet-container-enter",i._animationState==="visible")("mat-bottom-sheet-container-exit",i._animationState==="hidden"))},features:[V],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(e,i){e&1&&g(0,D5e,0,0,"ng-template",0)},dependencies:[ip],styles:[`@keyframes _mat-bottom-sheet-enter{from{transform:translateY(100%)}to{transform:none}}@keyframes _mat-bottom-sheet-exit{from{transform:none}to{transform:translateY(100%)}}.mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;position:relative;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-animations-enabled{transform:translateY(100%)}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter{animation:_mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit{animation:_mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}
68
68
  `],encapsulation:2})}return n})(),ac=new at("MatBottomSheetData"),KB=class{viewContainerRef;panelClass;direction;data=null;hasBackdrop=!0;backdropClass;disableClose=!1;ariaLabel=null;ariaModal=!1;closeOnNavigation=!0;autoFocus="first-tabbable";restoreFocus=!0;scrollStrategy;height="";minHeight;maxHeight},lm=class{_ref;get instance(){return this._ref.componentInstance}get componentRef(){return this._ref.componentRef}containerInstance;disableClose;_afterOpened=new Xe;_result;_closeFallbackTimeout;constructor(o,t,e){this._ref=o,this.containerInstance=e,this.disableClose=t.disableClose,e._animationStateChanged.pipe(Ne(i=>i.phase==="done"&&i.toState==="visible"),et(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),e._animationStateChanged.pipe(Ne(i=>i.phase==="done"&&i.toState==="hidden"),et(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._ref.close(this._result)}),o.overlayRef.detachments().subscribe(()=>{this._ref.close(this._result)}),oo(this.backdropClick(),this.keydownEvents().pipe(Ne(i=>i.keyCode===27))).subscribe(i=>{!this.disableClose&&(i.type!=="keydown"||!Kr(i))&&(i.preventDefault(),this.dismiss())})}dismiss(o){this.containerInstance&&(this.containerInstance._animationStateChanged.pipe(Ne(t=>t.phase==="start"),et(1)).subscribe(()=>{this._closeFallbackTimeout=setTimeout(()=>this._ref.close(this._result),500),this._ref.overlayRef.detachBackdrop()}),this._result=o,this.containerInstance.exit(),this.containerInstance=null)}afterDismissed(){return this._ref.closed}afterOpened(){return this._afterOpened}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}},O5e=new at("mat-bottom-sheet-default-options"),sc=(()=>{class n{_overlay=Se(Bi);_parentBottomSheet=Se(n,{optional:!0,skipSelf:!0});_defaultOptions=Se(O5e,{optional:!0});_bottomSheetRefAtThisLevel=null;_dialog=Se(iS);get _openedBottomSheetRef(){let t=this._parentBottomSheet;return t?t._openedBottomSheetRef:this._bottomSheetRefAtThisLevel}set _openedBottomSheetRef(t){this._parentBottomSheet?this._parentBottomSheet._openedBottomSheetRef=t:this._bottomSheetRefAtThisLevel=t}constructor(){}open(t,e){let i=I(I({},this._defaultOptions||new KB),e),r;return this._dialog.open(t,T(I({},i),{disableClose:!0,closeOnOverlayDetachments:!1,maxWidth:"100%",container:w5e,scrollStrategy:i.scrollStrategy||this._overlay.scrollStrategies.block(),positionStrategy:this._overlay.position().global().centerHorizontally().bottom("0"),templateContext:()=>({bottomSheetRef:r}),providers:(a,s,c)=>(r=new lm(a,i,c),[{provide:lm,useValue:r},{provide:ac,useValue:i.data}])})),r.afterDismissed().subscribe(()=>{this._openedBottomSheetRef===r&&(this._openedBottomSheetRef=null)}),this._openedBottomSheetRef?(this._openedBottomSheetRef.afterDismissed().subscribe(()=>r.containerInstance?.enter()),this._openedBottomSheetRef.dismiss()):r.containerInstance.enter(),this._openedBottomSheetRef=r,r}dismiss(t){this._openedBottomSheetRef&&this._openedBottomSheetRef.dismiss(t)}ngOnDestroy(){this._bottomSheetRefAtThisLevel&&this._bottomSheetRefAtThisLevel.dismiss()}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Pe({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Une=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[sc],imports:[F5,Po,sl,Po]})}return n})();function A5e(n,o){}var rS=class{viewContainerRef;injector;id;role="dialog";panelClass="";hasBackdrop=!0;backdropClass="";disableClose=!1;width="";height="";minWidth;minHeight;maxWidth;maxHeight;position;data=null;direction;ariaDescribedBy=null;ariaLabelledBy=null;ariaLabel=null;ariaModal=!1;autoFocus="first-tabbable";restoreFocus=!0;delayFocusTrap=!0;scrollStrategy;closeOnNavigation=!0;componentFactoryResolver;enterAnimationDuration;exitAnimationDuration},ZB="mdc-dialog--open",jne="mdc-dialog--opening",$ne="mdc-dialog--closing",P5e=150,M5e=75,Gne=(()=>{class n extends nS{_animationMode=Se(sr,{optional:!0});_animationStateChanged=new Ae;_animationsEnabled=this._animationMode!=="NoopAnimations";_actionSectionCount=0;_hostElement=this._elementRef.nativeElement;_enterAnimationDuration=this._animationsEnabled?zne(this._config.enterAnimationDuration)??P5e:0;_exitAnimationDuration=this._animationsEnabled?zne(this._config.exitAnimationDuration)??M5e:0;_animationTimer=null;_contentAttached(){super._contentAttached(),this._startOpenAnimation()}_startOpenAnimation(){this._animationStateChanged.emit({state:"opening",totalTime:this._enterAnimationDuration}),this._animationsEnabled?(this._hostElement.style.setProperty(Hne,`${this._enterAnimationDuration}ms`),this._requestAnimationFrame(()=>this._hostElement.classList.add(jne,ZB)),this._waitForAnimationToComplete(this._enterAnimationDuration,this._finishDialogOpen)):(this._hostElement.classList.add(ZB),Promise.resolve().then(()=>this._finishDialogOpen()))}_startExitAnimation(){this._animationStateChanged.emit({state:"closing",totalTime:this._exitAnimationDuration}),this._hostElement.classList.remove(ZB),this._animationsEnabled?(this._hostElement.style.setProperty(Hne,`${this._exitAnimationDuration}ms`),this._requestAnimationFrame(()=>this._hostElement.classList.add($ne)),this._waitForAnimationToComplete(this._exitAnimationDuration,this._finishDialogClose)):Promise.resolve().then(()=>this._finishDialogClose())}_updateActionSectionCount(t){this._actionSectionCount+=t,this._changeDetectorRef.markForCheck()}_finishDialogOpen=()=>{this._clearAnimationClasses(),this._openAnimationDone(this._enterAnimationDuration)};_finishDialogClose=()=>{this._clearAnimationClasses(),this._animationStateChanged.emit({state:"closed",totalTime:this._exitAnimationDuration})};_clearAnimationClasses(){this._hostElement.classList.remove(jne,$ne)}_waitForAnimationToComplete(t,e){this._animationTimer!==null&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(e,t)}_requestAnimationFrame(t){this._ngZone.runOutsideAngular(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()})}_captureInitialFocus(){this._config.delayFocusTrap||this._trapFocus()}_openAnimationDone(t){this._config.delayFocusTrap&&this._trapFocus(),this._animationStateChanged.next({state:"opened",totalTime:t})}ngOnDestroy(){super.ngOnDestroy(),this._animationTimer!==null&&clearTimeout(this._animationTimer)}attachComponentPortal(t){let e=super.attachComponentPortal(t);return e.location.nativeElement.classList.add("mat-mdc-dialog-component-host"),e}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Va(n)))(i||n)}})();static \u0275cmp=P({type:n,selectors:[["mat-dialog-container"]],hostAttrs:["tabindex","-1",1,"mat-mdc-dialog-container","mdc-dialog"],hostVars:10,hostBindings:function(e,i){e&2&&(xa("id",i._config.id),x("aria-modal",i._config.ariaModal)("role",i._config.role)("aria-labelledby",i._config.ariaLabel?null:i._ariaLabelledByQueue[0])("aria-label",i._config.ariaLabel)("aria-describedby",i._config.ariaDescribedBy||null),ge("_mat-animation-noopable",!i._animationsEnabled)("mat-mdc-dialog-container-with-actions",i._actionSectionCount>0))},features:[V],decls:3,vars:0,consts:[[1,"mat-mdc-dialog-inner-container","mdc-dialog__container"],[1,"mat-mdc-dialog-surface","mdc-dialog__surface"],["cdkPortalOutlet",""]],template:function(e,i){e&1&&(_(0,"div",0)(1,"div",1),g(2,A5e,0,0,"ng-template",2),S()())},dependencies:[ip],styles:[`.mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mdc-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mdc-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:"";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mdc-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mdc-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mdc-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mdc-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mdc-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mdc-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mdc-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mdc-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mdc-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mdc-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mdc-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mdc-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;justify-content:flex-end;box-sizing:border-box;min-height:52px;margin:0;padding:8px;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}
69
69
  `],encapsulation:2})}return n})(),Hne="--mat-dialog-transition-duration";function zne(n){return n==null?null:typeof n=="number"?n:n.endsWith("ms")?hs(n.substring(0,n.length-2)):n.endsWith("s")?hs(n.substring(0,n.length-1))*1e3:n==="0"?0:null}var oS=function(n){return n[n.OPEN=0]="OPEN",n[n.CLOSING=1]="CLOSING",n[n.CLOSED=2]="CLOSED",n}(oS||{}),Xo=class{_ref;_containerInstance;componentInstance;componentRef;disableClose;id;_afterOpened=new Xe;_beforeClosed=new Xe;_result;_closeFallbackTimeout;_state=oS.OPEN;_closeInteractionType;constructor(o,t,e){this._ref=o,this._containerInstance=e,this.disableClose=t.disableClose,this.id=o.id,o.addPanelClass("mat-mdc-dialog-panel"),e._animationStateChanged.pipe(Ne(i=>i.state==="opened"),et(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),e._animationStateChanged.pipe(Ne(i=>i.state==="closed"),et(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._finishDialogClose()}),o.overlayRef.detachments().subscribe(()=>{this._beforeClosed.next(this._result),this._beforeClosed.complete(),this._finishDialogClose()}),oo(this.backdropClick(),this.keydownEvents().pipe(Ne(i=>i.keyCode===27&&!this.disableClose&&!Kr(i)))).subscribe(i=>{this.disableClose||(i.preventDefault(),XB(this,i.type==="keydown"?"keyboard":"mouse"))})}close(o){this._result=o,this._containerInstance._animationStateChanged.pipe(Ne(t=>t.state==="closing"),et(1)).subscribe(t=>{this._beforeClosed.next(o),this._beforeClosed.complete(),this._ref.overlayRef.detachBackdrop(),this._closeFallbackTimeout=setTimeout(()=>this._finishDialogClose(),t.totalTime+100)}),this._state=oS.CLOSING,this._containerInstance._startExitAnimation()}afterOpened(){return this._afterOpened}afterClosed(){return this._ref.closed}beforeClosed(){return this._beforeClosed}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}updatePosition(o){let t=this._ref.config.positionStrategy;return o&&(o.left||o.right)?o.left?t.left(o.left):t.right(o.right):t.centerHorizontally(),o&&(o.top||o.bottom)?o.top?t.top(o.top):t.bottom(o.bottom):t.centerVertically(),this._ref.updatePosition(),this}updateSize(o="",t=""){return this._ref.updateSize(o,t),this}addPanelClass(o){return this._ref.addPanelClass(o),this}removePanelClass(o){return this._ref.removePanelClass(o),this}getState(){return this._state}_finishDialogClose(){this._state=oS.CLOSED,this._ref.close(this._result,{focusOrigin:this._closeInteractionType}),this.componentInstance=null}};function XB(n,o,t){return n._closeInteractionType=o,n.close(t)}var fl=new at("MatMdcDialogData"),Wne=new at("mat-mdc-dialog-default-options"),qne=new at("mat-mdc-dialog-scroll-strategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.block()}});var Ki=(()=>{class n{_overlay=Se(Bi);_defaultOptions=Se(Wne,{optional:!0});_scrollStrategy=Se(qne);_parentDialog=Se(n,{optional:!0,skipSelf:!0});_idGenerator=Se(fs);_dialog=Se(iS);_openDialogsAtThisLevel=[];_afterAllClosedAtThisLevel=new Xe;_afterOpenedAtThisLevel=new Xe;dialogConfigClass=rS;_dialogRefConstructor;_dialogContainerType;_dialogDataToken;get openDialogs(){return this._parentDialog?this._parentDialog.openDialogs:this._openDialogsAtThisLevel}get afterOpened(){return this._parentDialog?this._parentDialog.afterOpened:this._afterOpenedAtThisLevel}_getAfterAllClosed(){let t=this._parentDialog;return t?t._getAfterAllClosed():this._afterAllClosedAtThisLevel}afterAllClosed=Og(()=>this.openDialogs.length?this._getAfterAllClosed():this._getAfterAllClosed().pipe(qo(void 0)));constructor(){this._dialogRefConstructor=Xo,this._dialogContainerType=Gne,this._dialogDataToken=fl}open(t,e){let i;e=I(I({},this._defaultOptions||new rS),e),e.id=e.id||this._idGenerator.getId("mat-mdc-dialog-"),e.scrollStrategy=e.scrollStrategy||this._scrollStrategy();let r=this._dialog.open(t,T(I({},e),{positionStrategy:this._overlay.position().global().centerHorizontally().centerVertically(),disableClose:!0,closeOnDestroy:!1,closeOnOverlayDetachments:!1,container:{type:this._dialogContainerType,providers:()=>[{provide:this.dialogConfigClass,useValue:e},{provide:Ep,useValue:e}]},templateContext:()=>({dialogRef:i}),providers:(a,s,c)=>(i=new this._dialogRefConstructor(a,e,c),i.updatePosition(e?.position),[{provide:this._dialogContainerType,useValue:c},{provide:this._dialogDataToken,useValue:s.data},{provide:this._dialogRefConstructor,useValue:i}])}));return i.componentRef=r.componentRef,i.componentInstance=r.componentInstance,this.openDialogs.push(i),this.afterOpened.next(i),i.afterClosed().subscribe(()=>{let a=this.openDialogs.indexOf(i);a>-1&&(this.openDialogs.splice(a,1),this.openDialogs.length||this._getAfterAllClosed().next())}),i}closeAll(){this._closeDialogs(this.openDialogs)}getDialogById(t){return this.openDialogs.find(e=>e.id===t)}ngOnDestroy(){this._closeDialogs(this._openDialogsAtThisLevel),this._afterAllClosedAtThisLevel.complete(),this._afterOpenedAtThisLevel.complete()}_closeDialogs(t){let e=t.length;for(;e--;)t[e].close()}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Pe({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),QB=(()=>{class n{dialogRef=Se(Xo,{optional:!0});_elementRef=Se(N);_dialog=Se(Ki);ariaLabel;type="button";dialogResult;_matDialogClose;constructor(){}ngOnInit(){this.dialogRef||(this.dialogRef=Kne(this._elementRef,this._dialog.openDialogs))}ngOnChanges(t){let e=t._matDialogClose||t._matDialogCloseResult;e&&(this.dialogResult=e.currentValue)}_onButtonClick(t){XB(this.dialogRef,t.screenX===0&&t.screenY===0?"keyboard":"mouse",this.dialogResult)}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n,selectors:[["","mat-dialog-close",""],["","matDialogClose",""]],hostVars:2,hostBindings:function(e,i){e&1&&G("click",function(a){return i._onButtonClick(a)}),e&2&&x("aria-label",i.ariaLabel||null)("type",i.type)},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],type:"type",dialogResult:[0,"mat-dialog-close","dialogResult"],_matDialogClose:[0,"matDialogClose","_matDialogClose"]},exportAs:["matDialogClose"],features:[Ze]})}return n})(),Yne=(()=>{class n{_dialogRef=Se(Xo,{optional:!0});_elementRef=Se(N);_dialog=Se(Ki);constructor(){}ngOnInit(){this._dialogRef||(this._dialogRef=Kne(this._elementRef,this._dialog.openDialogs)),this._dialogRef&&Promise.resolve().then(()=>{this._onAdd()})}ngOnDestroy(){this._dialogRef?._containerInstance&&Promise.resolve().then(()=>{this._onRemove()})}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n})}return n})(),JB=(()=>{class n extends Yne{id=Se(fs).getId("mat-mdc-dialog-title-");_onAdd(){this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id)}_onRemove(){this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id)}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Va(n)))(i||n)}})();static \u0275dir=Bt({type:n,selectors:[["","mat-dialog-title",""],["","matDialogTitle",""]],hostAttrs:[1,"mat-mdc-dialog-title","mdc-dialog__title"],hostVars:1,hostBindings:function(e,i){e&2&&xa("id",i.id)},inputs:{id:"id"},exportAs:["matDialogTitle"],features:[V]})}return n})(),eV=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n,selectors:[["","mat-dialog-content",""],["mat-dialog-content"],["","matDialogContent",""]],hostAttrs:[1,"mat-mdc-dialog-content","mdc-dialog__content"],features:[RY([O1])]})}return n})(),tV=(()=>{class n extends Yne{align;_onAdd(){this._dialogRef._containerInstance?._updateActionSectionCount?.(1)}_onRemove(){this._dialogRef._containerInstance?._updateActionSectionCount?.(-1)}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Va(n)))(i||n)}})();static \u0275dir=Bt({type:n,selectors:[["","mat-dialog-actions",""],["mat-dialog-actions"],["","matDialogActions",""]],hostAttrs:[1,"mat-mdc-dialog-actions","mdc-dialog__actions"],hostVars:6,hostBindings:function(e,i){e&2&&ge("mat-mdc-dialog-actions-align-start",i.align==="start")("mat-mdc-dialog-actions-align-center",i.align==="center")("mat-mdc-dialog-actions-align-end",i.align==="end")},inputs:{align:"align"},features:[V]})}return n})();function Kne(n,o){let t=n.nativeElement.parentElement;for(;t&&!t.classList.contains("mat-mdc-dialog-container");)t=t.parentElement;return t?o.find(e=>e.id===t.id):null}var nV=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[Ki],imports:[F5,Ls,sl,Po,Po]})}return n})();var k5e=["mat-menu-item",""],R5e=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],N5e=["mat-icon, [matMenuItemIcon]","*"];function F5e(n,o){n&1&&(re(),_(0,"svg",2),w(1,"polygon",3),S())}var L5e=["*"];function B5e(n,o){if(n&1){let t=W();_(0,"div",0),G("click",function(){k(t);let i=l();return R(i.closed.emit("click"))})("animationstart",function(i){k(t);let r=l();return R(r._onAnimationStart(i.animationName))})("animationend",function(i){k(t);let r=l();return R(r._onAnimationDone(i.animationName))})("animationcancel",function(i){k(t);let r=l();return R(r._onAnimationDone(i.animationName))}),_(1,"div",1),kt(2),S()()}if(n&2){let t=l();Zo(t._classList),ge("mat-menu-panel-animations-disabled",t._animationsDisabled)("mat-menu-panel-exit-animation",t._panelAnimationState==="void")("mat-menu-panel-animating",t._isAnimating),m("id",t.panelId),x("aria-label",t.ariaLabel||null)("aria-labelledby",t.ariaLabelledby||null)("aria-describedby",t.ariaDescribedby||null)}}var oV=new at("MAT_MENU_PANEL"),Hs=(()=>{class n{_elementRef=Se(N);_document=Se(Dn);_focusMonitor=Se(xu);_parentMenu=Se(oV,{optional:!0});_changeDetectorRef=Se(Kt);role="menuitem";disabled=!1;disableRipple=!1;_hovered=new Xe;_focused=new Xe;_highlighted=!1;_triggersSubmenu=!1;constructor(){Se(Da).load(tv),this._parentMenu?.addItem?.(this)}focus(t,e){this._focusMonitor&&t?this._focusMonitor.focusVia(this._getHostElement(),t,e):this._getHostElement().focus(e),this._focused.next(this)}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,!1)}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete()}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(t){this.disabled&&(t.preventDefault(),t.stopPropagation())}_handleMouseEnter(){this._hovered.next(this)}getLabel(){let t=this._elementRef.nativeElement.cloneNode(!0),e=t.querySelectorAll("mat-icon, .material-icons");for(let i=0;i<e.length;i++)e[i].remove();return t.textContent?.trim()||""}_setHighlighted(t){this._highlighted=t,this._changeDetectorRef.markForCheck()}_setTriggersSubmenu(t){this._triggersSubmenu=t,this._changeDetectorRef.markForCheck()}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(e,i){e&1&&G("click",function(a){return i._checkDisabled(a)})("mouseenter",function(){return i._handleMouseEnter()}),e&2&&(x("role",i.role)("tabindex",i._getTabIndex())("aria-disabled",i.disabled)("disabled",i.disabled||null),ge("mat-mdc-menu-item-highlighted",i._highlighted)("mat-mdc-menu-item-submenu-trigger",i._triggersSubmenu))},inputs:{role:"role",disabled:[2,"disabled","disabled",ti],disableRipple:[2,"disableRipple","disableRipple",ti]},exportAs:["matMenuItem"],attrs:k5e,ngContentSelectors:N5e,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(e,i){e&1&&(Vt(R5e),kt(0),_(1,"span",0),kt(2,1),S(),w(3,"div",1),g(4,F5e,2,0,":svg:svg",2)),e&2&&(d(3),m("matRippleDisabled",i.disableRipple||i.disabled)("matRippleTrigger",i._getHostElement()),d(),Wl(i._triggersSubmenu?4:-1))},dependencies:[Du],encapsulation:2,changeDetection:0})}return n})();var Zne=new at("MatMenuContent"),Xne=(()=>{class n{_template=Se(vo);_appRef=Se(di);_injector=Se(Et);_viewContainerRef=Se(yi);_document=Se(Dn);_changeDetectorRef=Se(Kt);_portal;_outlet;_attached=new Xe;constructor(){}attach(t={}){this._portal||(this._portal=new ja(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new Lo(this._document.createElement("div"),null,this._appRef,this._injector));let e=this._template.elementRef.nativeElement;e.parentNode.insertBefore(this._outlet.outletElement,e),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,t),this._attached.next()}detach(){this._portal?.isAttached&&this._portal.detach()}ngOnDestroy(){this.detach(),this._outlet?.dispose()}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n,selectors:[["ng-template","matMenuContent",""]],features:[U([{provide:Zne,useExisting:n}])]})}return n})(),V5e=new at("mat-menu-default-options",{providedIn:"root",factory:U5e});function U5e(){return{overlapTrigger:!1,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"}}var iV="_mat-menu-enter",L5="_mat-menu-exit",vl=(()=>{class n{_elementRef=Se(N);_changeDetectorRef=Se(Kt);_injector=Se(Et);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled;_allItems;_directDescendantItems=new Yd;_classList={};_panelAnimationState="void";_animationDone=new Xe;_isAnimating=!1;parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(t){this._xPosition=t,this.setPositionClasses()}get yPosition(){return this._yPosition}set yPosition(t){this._yPosition=t,this.setPositionClasses()}templateRef;items;lazyContent;overlapTrigger;hasBackdrop;set panelClass(t){let e=this._previousPanelClass,i=I({},this._classList);e&&e.length&&e.split(" ").forEach(r=>{i[r]=!1}),this._previousPanelClass=t,t&&t.length&&(t.split(" ").forEach(r=>{i[r]=!0}),this._elementRef.nativeElement.className=""),this._classList=i}_previousPanelClass;get classList(){return this.panelClass}set classList(t){this.panelClass=t}closed=new Ae;close=this.closed;panelId=Se(fs).getId("mat-menu-panel-");constructor(){let t=Se(V5e);this.overlayPanelClass=t.overlayPanelClass||"",this._xPosition=t.xPosition,this._yPosition=t.yPosition,this.backdropClass=t.backdropClass,this.overlapTrigger=t.overlapTrigger,this.hasBackdrop=t.hasBackdrop,this._animationsDisabled=Se(sr,{optional:!0})==="NoopAnimations"}ngOnInit(){this.setPositionClasses()}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Zy(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(qo(this._directDescendantItems),ue(t=>oo(...t.map(e=>e._focused)))).subscribe(t=>this._keyManager.updateActiveItem(t)),this._directDescendantItems.changes.subscribe(t=>{let e=this._keyManager;if(this._panelAnimationState==="enter"&&e.activeItem?._hasFocus()){let i=t.toArray(),r=Math.max(0,Math.min(i.length-1,e.activeItemIndex||0));i[r]&&!i[r].disabled?e.setActiveItem(r):e.setNextItemActive()}})}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout)}_hovered(){return this._directDescendantItems.changes.pipe(qo(this._directDescendantItems),ue(e=>oo(...e.map(i=>i._hovered))))}addItem(t){}removeItem(t){}_handleKeydown(t){let e=t.keyCode,i=this._keyManager;switch(e){case 27:Kr(t)||(t.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(e===38||e===40)&&i.setFocusOrigin("keyboard"),i.onKeydown(t);return}}focusFirstItem(t="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=Ia(()=>{let e=this._resolvePanel();if(!e||!e.contains(document.activeElement)){let i=this._keyManager;i.setFocusOrigin(t).setFirstItemActive(),!i.activeItem&&e&&e.focus()}},{injector:this._injector})}resetActiveItem(){this._keyManager.setActiveItem(-1)}setElevation(t){}setPositionClasses(t=this.xPosition,e=this.yPosition){this._classList=T(I({},this._classList),{"mat-menu-before":t==="before","mat-menu-after":t==="after","mat-menu-above":e==="above","mat-menu-below":e==="below"}),this._changeDetectorRef.markForCheck()}_onAnimationDone(t){let e=t===L5;(e||t===iV)&&(e&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(e?"void":"enter"),this._isAnimating=!1)}_onAnimationStart(t){(t===iV||t===L5)&&(this._isAnimating=!0)}_setIsOpen(t){if(this._panelAnimationState=t?"enter":"void",t){if(this._keyManager.activeItemIndex===0){let e=this._resolvePanel();e&&(e.scrollTop=0)}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(L5),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(t?iV:L5)}),this._changeDetectorRef.markForCheck()}_updateDirectDescendants(){this._allItems.changes.pipe(qo(this._allItems)).subscribe(t=>{this._directDescendantItems.reset(t.filter(e=>e._parentMenu===this)),this._directDescendantItems.notifyOnChanges()})}_resolvePanel(){let t=null;return this._directDescendantItems.length&&(t=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),t}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["mat-menu"]],contentQueries:function(e,i,r){if(e&1&&(Ps(r,Zne,5),Ps(r,Hs,5),Ps(r,Hs,4)),e&2){let a;Qe(a=Je())&&(i.lazyContent=a.first),Qe(a=Je())&&(i._allItems=a),Qe(a=Je())&&(i.items=a)}},viewQuery:function(e,i){if(e&1&&ot(vo,5),e&2){let r;Qe(r=Je())&&(i.templateRef=r.first)}},hostVars:3,hostBindings:function(e,i){e&2&&x("aria-label",null)("aria-labelledby",null)("aria-describedby",null)},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",ti],hasBackdrop:[2,"hasBackdrop","hasBackdrop",t=>t==null?null:ti(t)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[U([{provide:oV,useExisting:n}])],ngContentSelectors:L5e,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(e,i){e&1&&(Vt(),g(0,B5e,3,12,"ng-template"))},styles:[`mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:"";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}
70
- `],encapsulation:2,changeDetection:0})}return n})(),Qne=new at("mat-menu-scroll-strategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.reposition()}});function j5e(n){return()=>n.scrollStrategies.reposition()}var $5e={provide:Qne,deps:[Bi],useFactory:j5e},H5e={passive:!0};var aS=new WeakMap,Tp=(()=>{class n{_overlay=Se(Bi);_element=Se(N);_viewContainerRef=Se(yi);_menuItemInstance=Se(Hs,{optional:!0,self:!0});_dir=Se(Vr,{optional:!0});_focusMonitor=Se(xu);_ngZone=Se(Mt);_scrollStrategy=Se(Qne);_changeDetectorRef=Se(Kt);_cleanupTouchstart;_portal;_overlayRef=null;_menuOpen=!1;_closingActionsSubscription=cn.EMPTY;_hoverSubscription=cn.EMPTY;_menuCloseSubscription=cn.EMPTY;_pendingRemoval;_parentMaterialMenu;_parentInnerPadding;_openedBy=void 0;get _deprecatedMatMenuTriggerFor(){return this.menu}set _deprecatedMatMenuTriggerFor(t){this.menu=t}get menu(){return this._menu}set menu(t){t!==this._menu&&(this._menu=t,this._menuCloseSubscription.unsubscribe(),t&&(this._parentMaterialMenu,this._menuCloseSubscription=t.close.subscribe(e=>{this._destroyMenu(e),(e==="click"||e==="tab")&&this._parentMaterialMenu&&this._parentMaterialMenu.closed.emit(e)})),this._menuItemInstance?._setTriggersSubmenu(this.triggersSubmenu()))}_menu;menuData;restoreFocus=!0;menuOpened=new Ae;onMenuOpen=this.menuOpened;menuClosed=new Ae;onMenuClose=this.menuClosed;constructor(){let t=Se(oV,{optional:!0}),e=Se(Wi);this._parentMaterialMenu=t instanceof vl?t:void 0,this._cleanupTouchstart=vr(e,this._element.nativeElement,"touchstart",i=>{gd(i)||(this._openedBy="touch")},H5e)}ngAfterContentInit(){this._handleHover()}ngOnDestroy(){this.menu&&this._ownsMenu(this.menu)&&aS.delete(this.menu),this._cleanupTouchstart(),this._pendingRemoval?.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe(),this._hoverSubscription.unsubscribe(),this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=null)}get menuOpen(){return this._menuOpen}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}triggersSubmenu(){return!!(this._menuItemInstance&&this._parentMaterialMenu&&this.menu)}toggleMenu(){return this._menuOpen?this.closeMenu():this.openMenu()}openMenu(){let t=this.menu;if(this._menuOpen||!t)return;this._pendingRemoval?.unsubscribe();let e=aS.get(t);aS.set(t,this),e&&e!==this&&e.closeMenu();let i=this._createOverlay(t),r=i.getConfig(),a=r.positionStrategy;this._setPosition(t,a),r.hasBackdrop=t.hasBackdrop==null?!this.triggersSubmenu():t.hasBackdrop,i.hasAttached()||(i.attach(this._getPortal(t)),t.lazyContent?.attach(this.menuData)),this._closingActionsSubscription=this._menuClosingActions().subscribe(()=>this.closeMenu()),t.parentMenu=this.triggersSubmenu()?this._parentMaterialMenu:void 0,t.direction=this.dir,t.focusFirstItem(this._openedBy||"program"),this._setIsMenuOpen(!0),t instanceof vl&&(t._setIsOpen(!0),t._directDescendantItems.changes.pipe(ro(t.close)).subscribe(()=>{a.withLockedPosition(!1).reapplyLastPosition(),a.withLockedPosition(!0)}))}closeMenu(){this.menu?.close.emit()}focus(t,e){this._focusMonitor&&t?this._focusMonitor.focusVia(this._element,t,e):this._element.nativeElement.focus(e)}updatePosition(){this._overlayRef?.updatePosition()}_destroyMenu(t){let e=this._overlayRef,i=this._menu;!e||!this.menuOpen||(this._closingActionsSubscription.unsubscribe(),this._pendingRemoval?.unsubscribe(),i instanceof vl&&this._ownsMenu(i)?(this._pendingRemoval=i._animationDone.pipe(et(1)).subscribe(()=>{e.detach(),i.lazyContent?.detach()}),i._setIsOpen(!1)):(e.detach(),i?.lazyContent?.detach()),i&&this._ownsMenu(i)&&aS.delete(i),this.restoreFocus&&(t==="keydown"||!this._openedBy||!this.triggersSubmenu())&&this.focus(this._openedBy),this._openedBy=void 0,this._setIsMenuOpen(!1))}_setIsMenuOpen(t){t!==this._menuOpen&&(this._menuOpen=t,this._menuOpen?this.menuOpened.emit():this.menuClosed.emit(),this.triggersSubmenu()&&this._menuItemInstance._setHighlighted(t),this._changeDetectorRef.markForCheck())}_createOverlay(t){if(!this._overlayRef){let e=this._getOverlayConfig(t);this._subscribeToPositions(t,e.positionStrategy),this._overlayRef=this._overlay.create(e),this._overlayRef.keydownEvents().subscribe(i=>{this.menu instanceof vl&&this.menu._handleKeydown(i)})}return this._overlayRef}_getOverlayConfig(t){return new Xl({positionStrategy:this._overlay.position().flexibleConnectedTo(this._element).withLockedPosition().withGrowAfterOpen().withTransformOriginOn(".mat-menu-panel, .mat-mdc-menu-panel"),backdropClass:t.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:t.overlayPanelClass,scrollStrategy:this._scrollStrategy(),direction:this._dir||"ltr"})}_subscribeToPositions(t,e){t.setPositionClasses&&e.positionChanges.subscribe(i=>{this._ngZone.run(()=>{let r=i.connectionPair.overlayX==="start"?"after":"before",a=i.connectionPair.overlayY==="top"?"below":"above";t.setPositionClasses(r,a)})})}_setPosition(t,e){let[i,r]=t.xPosition==="before"?["end","start"]:["start","end"],[a,s]=t.yPosition==="above"?["bottom","top"]:["top","bottom"],[c,p]=[a,s],[u,C]=[i,r],E=0;if(this.triggersSubmenu()){if(C=i=t.xPosition==="before"?"start":"end",r=u=i==="end"?"start":"end",this._parentMaterialMenu){if(this._parentInnerPadding==null){let D=this._parentMaterialMenu.items.first;this._parentInnerPadding=D?D._getHostElement().offsetTop:0}E=a==="bottom"?this._parentInnerPadding:-this._parentInnerPadding}}else t.overlapTrigger||(c=a==="top"?"bottom":"top",p=s==="top"?"bottom":"top");e.withPositions([{originX:i,originY:c,overlayX:u,overlayY:a,offsetY:E},{originX:r,originY:c,overlayX:C,overlayY:a,offsetY:E},{originX:i,originY:p,overlayX:u,overlayY:s,offsetY:-E},{originX:r,originY:p,overlayX:C,overlayY:s,offsetY:-E}])}_menuClosingActions(){let t=this._overlayRef.backdropClick(),e=this._overlayRef.detachments(),i=this._parentMaterialMenu?this._parentMaterialMenu.closed:se(),r=this._parentMaterialMenu?this._parentMaterialMenu._hovered().pipe(Ne(a=>this._menuOpen&&a!==this._menuItemInstance)):se();return oo(t,i,r,e)}_handleMousedown(t){pd(t)||(this._openedBy=t.button===0?"mouse":void 0,this.triggersSubmenu()&&t.preventDefault())}_handleKeydown(t){let e=t.keyCode;(e===13||e===32)&&(this._openedBy="keyboard"),this.triggersSubmenu()&&(e===39&&this.dir==="ltr"||e===37&&this.dir==="rtl")&&(this._openedBy="keyboard",this.openMenu())}_handleClick(t){this.triggersSubmenu()?(t.stopPropagation(),this.openMenu()):this.toggleMenu()}_handleHover(){this.triggersSubmenu()&&this._parentMaterialMenu&&(this._hoverSubscription=this._parentMaterialMenu._hovered().subscribe(t=>{t===this._menuItemInstance&&!t.disabled&&(this._openedBy="mouse",this.openMenu())}))}_getPortal(t){return(!this._portal||this._portal.templateRef!==t.templateRef)&&(this._portal=new ja(t.templateRef,this._viewContainerRef)),this._portal}_ownsMenu(t){return aS.get(t)===this}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n,selectors:[["","mat-menu-trigger-for",""],["","matMenuTriggerFor",""]],hostAttrs:[1,"mat-mdc-menu-trigger"],hostVars:3,hostBindings:function(e,i){e&1&&G("click",function(a){return i._handleClick(a)})("mousedown",function(a){return i._handleMousedown(a)})("keydown",function(a){return i._handleKeydown(a)}),e&2&&x("aria-haspopup",i.menu?"menu":null)("aria-expanded",i.menuOpen)("aria-controls",i.menuOpen?i.menu.panelId:null)},inputs:{_deprecatedMatMenuTriggerFor:[0,"mat-menu-trigger-for","_deprecatedMatMenuTriggerFor"],menu:[0,"matMenuTriggerFor","menu"],menuData:[0,"matMenuTriggerData","menuData"],restoreFocus:[0,"matMenuTriggerRestoreFocus","restoreFocus"]},outputs:{menuOpened:"menuOpened",onMenuOpen:"onMenuOpen",menuClosed:"menuClosed",onMenuClose:"onMenuClose"},exportAs:["matMenuTrigger"]})}return n})(),Jne=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[$5e],imports:[nv,Po,Ls,Zl,Po]})}return n})(),eie={transformMenu:{type:7,name:"transformMenu",definitions:[{type:0,name:"void",styles:{type:6,styles:{opacity:0,transform:"scale(0.8)"},offset:null}},{type:1,expr:"void => enter",animation:{type:4,styles:{type:6,styles:{opacity:1,transform:"scale(1)"},offset:null},timings:"120ms cubic-bezier(0, 0, 0.2, 1)"},options:null},{type:1,expr:"* => void",animation:{type:4,styles:{type:6,styles:{opacity:0},offset:null},timings:"100ms 25ms linear"},options:null}],options:{}},fadeInItems:{type:7,name:"fadeInItems",definitions:[{type:0,name:"showing",styles:{type:6,styles:{opacity:1},offset:null}},{type:1,expr:"void => *",animation:[{type:6,styles:{opacity:0},offset:null},{type:4,styles:null,timings:"400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)"}],options:null}],options:{}}},K0n=eie.fadeInItems,Z0n=eie.transformMenu;var rV=20;var tie=new at("mat-tooltip-scroll-strategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.reposition({scrollThrottle:rV})}});function nie(n){return()=>n.scrollStrategies.reposition({scrollThrottle:rV})}var iie={provide:tie,deps:[Bi],useFactory:nie};var aV=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[iie],imports:[qy,Ls,Po,Po,Zl]})}return n})();var kn=function(n){return n[n.State=0]="State",n[n.Transition=1]="Transition",n[n.Sequence=2]="Sequence",n[n.Group=3]="Group",n[n.Animate=4]="Animate",n[n.Keyframes=5]="Keyframes",n[n.Style=6]="Style",n[n.Trigger=7]="Trigger",n[n.Reference=8]="Reference",n[n.AnimateChild=9]="AnimateChild",n[n.AnimateRef=10]="AnimateRef",n[n.Query=11]="Query",n[n.Stagger=12]="Stagger",n}(kn||{}),Cl="*";function sV(n,o){return{type:kn.Trigger,name:n,definitions:o,options:{}}}function B5(n,o=null){return{type:kn.Animate,styles:o,timings:n}}function oie(n,o=null){return{type:kn.Sequence,steps:n,options:o}}function mm(n){return{type:kn.Style,styles:n,offset:null}}function V5(n,o,t){return{type:kn.State,name:n,styles:o,options:t}}function U5(n,o,t=null){return{type:kn.Transition,expr:n,animation:o,options:t}}var cm=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(o=0,t=0){this.totalTime=o+t}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(o=>o()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(o){this._position=this.totalTime?o*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(o){let t=o=="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},wu=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(o){this.players=o;let t=0,e=0,i=0,r=this.players.length;r==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(a=>{a.onDone(()=>{++t==r&&this._onFinish()}),a.onDestroy(()=>{++e==r&&this._onDestroy()}),a.onStart(()=>{++i==r&&this._onStart()})}),this.totalTime=this.players.reduce((a,s)=>Math.max(a,s.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this.players.forEach(o=>o.init())}onStart(o){this._onStartFns.push(o)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(o=>o()),this._onStartFns=[])}onDone(o){this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(o=>o.play())}pause(){this.players.forEach(o=>o.pause())}restart(){this.players.forEach(o=>o.restart())}finish(){this._onFinish(),this.players.forEach(o=>o.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(o=>o.destroy()),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this.players.forEach(o=>o.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(o){let t=o*this.totalTime;this.players.forEach(e=>{let i=e.totalTime?Math.min(1,t/e.totalTime):1;e.setPosition(i)})}getPosition(){let o=this.players.reduce((t,e)=>t===null||e.totalTime>t.totalTime?e:t,null);return o!=null?o.getPosition():0}beforeDestroy(){this.players.forEach(o=>{o.beforeDestroy&&o.beforeDestroy()})}triggerCallback(o){let t=o=="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},iv="!";function rie(n){return new yt(3e3,!1)}function z5e(){return new yt(3100,!1)}function G5e(){return new yt(3101,!1)}function W5e(n){return new yt(3001,!1)}function q5e(n){return new yt(3003,!1)}function Y5e(n){return new yt(3004,!1)}function sie(n,o){return new yt(3005,!1)}function lie(){return new yt(3006,!1)}function cie(){return new yt(3007,!1)}function mie(n,o){return new yt(3008,!1)}function die(n){return new yt(3002,!1)}function pie(n,o,t,e,i){return new yt(3010,!1)}function gie(){return new yt(3011,!1)}function uie(){return new yt(3012,!1)}function hie(){return new yt(3200,!1)}function fie(){return new yt(3202,!1)}function vie(){return new yt(3013,!1)}function Cie(n){return new yt(3014,!1)}function _ie(n){return new yt(3015,!1)}function yie(n){return new yt(3016,!1)}function Sie(n,o){return new yt(3404,!1)}function K5e(n){return new yt(3502,!1)}function bie(n){return new yt(3503,!1)}function Iie(){return new yt(3300,!1)}function Eie(n){return new yt(3504,!1)}function xie(n){return new yt(3301,!1)}function Tie(n,o){return new yt(3302,!1)}function Die(n){return new yt(3303,!1)}function wie(n,o){return new yt(3400,!1)}function Oie(n){return new yt(3401,!1)}function Aie(n){return new yt(3402,!1)}function Pie(n,o){return new yt(3505,!1)}function Ed(n){switch(n.length){case 0:return new cm;case 1:return n[0];default:return new wu(n)}}function dV(n,o,t=new Map,e=new Map){let i=[],r=[],a=-1,s=null;if(o.forEach(c=>{let p=c.get("offset"),u=p==a,C=u&&s||new Map;c.forEach((E,D)=>{let L=D,$=E;if(D!=="offset")switch(L=n.normalizePropertyName(L,i),$){case iv:$=t.get(D);break;case Cl:$=e.get(D);break;default:$=n.normalizeStyleValue(D,L,$,i);break}C.set(L,$)}),u||r.push(C),s=C,a=p}),i.length)throw K5e(i);return r}function j5(n,o,t,e){switch(o){case"start":n.onStart(()=>e(t&&lV(t,"start",n)));break;case"done":n.onDone(()=>e(t&&lV(t,"done",n)));break;case"destroy":n.onDestroy(()=>e(t&&lV(t,"destroy",n)));break}}function lV(n,o,t){let e=t.totalTime,i=!!t.disabled,r=$5(n.element,n.triggerName,n.fromState,n.toState,o||n.phaseName,e??n.totalTime,i),a=n._data;return a!=null&&(r._data=a),r}function $5(n,o,t,e,i="",r=0,a){return{element:n,triggerName:o,fromState:t,toState:e,phaseName:i,totalTime:r,disabled:!!a}}function ys(n,o,t){let e=n.get(o);return e||n.set(o,e=t),e}function pV(n){let o=n.indexOf(":"),t=n.substring(1,o),e=n.slice(o+1);return[t,e]}var Z5e=typeof document>"u"?null:document.documentElement;function H5(n){let o=n.parentNode||n.host||null;return o===Z5e?null:o}function X5e(n){return n.substring(1,6)=="ebkit"}var Ou=null,aie=!1;function Mie(n){Ou||(Ou=Q5e()||{},aie=Ou.style?"WebkitAppearance"in Ou.style:!1);let o=!0;return Ou.style&&!X5e(n)&&(o=n in Ou.style,!o&&aie&&(o="Webkit"+n.charAt(0).toUpperCase()+n.slice(1)in Ou.style)),o}function Q5e(){return typeof document<"u"?document.body:null}function gV(n,o){for(;o;){if(o===n)return!0;o=H5(o)}return!1}function uV(n,o,t){if(t)return Array.from(n.querySelectorAll(o));let e=n.querySelector(o);return e?[e]:[]}var J5e=1e3,hV="{{",e6e="}}",fV="ng-enter",z5="ng-leave",lS="ng-trigger",cS=".ng-trigger",vV="ng-animating",G5=".ng-animating";function dm(n){if(typeof n=="number")return n;let o=n.match(/^(-?[\.\d]+)(m?s)/);return!o||o.length<2?0:cV(parseFloat(o[1]),o[2])}function cV(n,o){switch(o){case"s":return n*J5e;default:return n}}function mS(n,o,t){return n.hasOwnProperty("duration")?n:t6e(n,o,t)}function t6e(n,o,t){let e=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,i,r=0,a="";if(typeof n=="string"){let s=n.match(e);if(s===null)return o.push(rie(n)),{duration:0,delay:0,easing:""};i=cV(parseFloat(s[1]),s[2]);let c=s[3];c!=null&&(r=cV(parseFloat(c),s[4]));let p=s[5];p&&(a=p)}else i=n;if(!t){let s=!1,c=o.length;i<0&&(o.push(z5e()),s=!0),r<0&&(o.push(G5e()),s=!0),s&&o.splice(c,0,rie(n))}return{duration:i,delay:r,easing:a}}function kie(n){return n.length?n[0]instanceof Map?n:n.map(o=>new Map(Object.entries(o))):[]}function lc(n,o,t){o.forEach((e,i)=>{let r=W5(i);t&&!t.has(i)&&t.set(i,n.style[r]),n.style[r]=e})}function Dp(n,o){o.forEach((t,e)=>{let i=W5(e);n.style[i]=""})}function ov(n){return Array.isArray(n)?n.length==1?n[0]:oie(n):n}function Rie(n,o,t){let e=o.params||{},i=CV(n);i.length&&i.forEach(r=>{e.hasOwnProperty(r)||t.push(W5e(r))})}var mV=new RegExp(`${hV}\\s*(.+?)\\s*${e6e}`,"g");function CV(n){let o=[];if(typeof n=="string"){let t;for(;t=mV.exec(n);)o.push(t[1]);mV.lastIndex=0}return o}function rv(n,o,t){let e=`${n}`,i=e.replace(mV,(r,a)=>{let s=o[a];return s==null&&(t.push(q5e(a)),s=""),s.toString()});return i==e?n:i}var n6e=/-+([a-z0-9])/g;function W5(n){return n.replace(n6e,(...o)=>o[1].toUpperCase())}function Nie(n,o){return n===0||o===0}function Fie(n,o,t){if(t.size&&o.length){let e=o[0],i=[];if(t.forEach((r,a)=>{e.has(a)||i.push(a),e.set(a,r)}),i.length)for(let r=1;r<o.length;r++){let a=o[r];i.forEach(s=>a.set(s,q5(n,s)))}}return o}function Ss(n,o,t){switch(o.type){case kn.Trigger:return n.visitTrigger(o,t);case kn.State:return n.visitState(o,t);case kn.Transition:return n.visitTransition(o,t);case kn.Sequence:return n.visitSequence(o,t);case kn.Group:return n.visitGroup(o,t);case kn.Animate:return n.visitAnimate(o,t);case kn.Keyframes:return n.visitKeyframes(o,t);case kn.Style:return n.visitStyle(o,t);case kn.Reference:return n.visitReference(o,t);case kn.AnimateChild:return n.visitAnimateChild(o,t);case kn.AnimateRef:return n.visitAnimateRef(o,t);case kn.Query:return n.visitQuery(o,t);case kn.Stagger:return n.visitStagger(o,t);default:throw Y5e(o.type)}}function q5(n,o){return window.getComputedStyle(n)[o]}var NV=(()=>{class n{validateStyleProperty(t){return Mie(t)}containsElement(t,e){return gV(t,e)}getParentElement(t){return H5(t)}query(t,e,i){return uV(t,e,i)}computeStyle(t,e,i){return i||""}animate(t,e,i,r,a,s=[],c){return new cm(i,r)}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Pe({token:n,factory:n.\u0275fac})}return n})(),Pu=class{static NOOP=new NV},Mu=class{};var i6e=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),Q5=class extends Mu{normalizePropertyName(o,t){return W5(o)}normalizeStyleValue(o,t,e,i){let r="",a=e.toString().trim();if(i6e.has(t)&&e!==0&&e!=="0")if(typeof e=="number")r="px";else{let s=e.match(/^[+-]?[\d\.]+([a-z]*)$/);s&&s[1].length==0&&i.push(sie(o,e))}return a+r}};var J5="*";function o6e(n,o){let t=[];return typeof n=="string"?n.split(/\s*,\s*/).forEach(e=>r6e(e,t,o)):t.push(n),t}function r6e(n,o,t){if(n[0]==":"){let c=a6e(n,t);if(typeof c=="function"){o.push(c);return}n=c}let e=n.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(e==null||e.length<4)return t.push(_ie(n)),o;let i=e[1],r=e[2],a=e[3];o.push(Lie(i,a));let s=i==J5&&a==J5;r[0]=="<"&&!s&&o.push(Lie(a,i))}function a6e(n,o){switch(n){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(t,e)=>parseFloat(e)>parseFloat(t);case":decrement":return(t,e)=>parseFloat(e)<parseFloat(t);default:return o.push(yie(n)),"* => *"}}var Y5=new Set(["true","1"]),K5=new Set(["false","0"]);function Lie(n,o){let t=Y5.has(n)||K5.has(n),e=Y5.has(o)||K5.has(o);return(i,r)=>{let a=n==J5||n==i,s=o==J5||o==r;return!a&&t&&typeof i=="boolean"&&(a=i?Y5.has(n):K5.has(n)),!s&&e&&typeof r=="boolean"&&(s=r?Y5.has(o):K5.has(o)),a&&s}}var qie=":self",s6e=new RegExp(`s*${qie}s*,?`,"g");function Yie(n,o,t,e){return new EV(n).build(o,t,e)}var Bie="",EV=class{_driver;constructor(o){this._driver=o}build(o,t,e){let i=new xV(t);return this._resetContextStyleTimingState(i),Ss(this,ov(o),i)}_resetContextStyleTimingState(o){o.currentQuerySelector=Bie,o.collectedStyles=new Map,o.collectedStyles.set(Bie,new Map),o.currentTime=0}visitTrigger(o,t){let e=t.queryCount=0,i=t.depCount=0,r=[],a=[];return o.name.charAt(0)=="@"&&t.errors.push(lie()),o.definitions.forEach(s=>{if(this._resetContextStyleTimingState(t),s.type==kn.State){let c=s,p=c.name;p.toString().split(/\s*,\s*/).forEach(u=>{c.name=u,r.push(this.visitState(c,t))}),c.name=p}else if(s.type==kn.Transition){let c=this.visitTransition(s,t);e+=c.queryCount,i+=c.depCount,a.push(c)}else t.errors.push(cie())}),{type:kn.Trigger,name:o.name,states:r,transitions:a,queryCount:e,depCount:i,options:null}}visitState(o,t){let e=this.visitStyle(o.styles,t),i=o.options&&o.options.params||null;if(e.containsDynamicStyles){let r=new Set,a=i||{};e.styles.forEach(s=>{s instanceof Map&&s.forEach(c=>{CV(c).forEach(p=>{a.hasOwnProperty(p)||r.add(p)})})}),r.size&&t.errors.push(mie(o.name,[...r.values()]))}return{type:kn.State,name:o.name,style:e,options:i?{params:i}:null}}visitTransition(o,t){t.queryCount=0,t.depCount=0;let e=Ss(this,ov(o.animation),t),i=o6e(o.expr,t.errors);return{type:kn.Transition,matchers:i,animation:e,queryCount:t.queryCount,depCount:t.depCount,options:Au(o.options)}}visitSequence(o,t){return{type:kn.Sequence,steps:o.steps.map(e=>Ss(this,e,t)),options:Au(o.options)}}visitGroup(o,t){let e=t.currentTime,i=0,r=o.steps.map(a=>{t.currentTime=e;let s=Ss(this,a,t);return i=Math.max(i,t.currentTime),s});return t.currentTime=i,{type:kn.Group,steps:r,options:Au(o.options)}}visitAnimate(o,t){let e=d6e(o.timings,t.errors);t.currentAnimateTimings=e;let i,r=o.styles?o.styles:mm({});if(r.type==kn.Keyframes)i=this.visitKeyframes(r,t);else{let a=o.styles,s=!1;if(!a){s=!0;let p={};e.easing&&(p.easing=e.easing),a=mm(p)}t.currentTime+=e.duration+e.delay;let c=this.visitStyle(a,t);c.isEmptyStep=s,i=c}return t.currentAnimateTimings=null,{type:kn.Animate,timings:e,style:i,options:null}}visitStyle(o,t){let e=this._makeStyleAst(o,t);return this._validateStyleAst(e,t),e}_makeStyleAst(o,t){let e=[],i=Array.isArray(o.styles)?o.styles:[o.styles];for(let s of i)typeof s=="string"?s===Cl?e.push(s):t.errors.push(die(s)):e.push(new Map(Object.entries(s)));let r=!1,a=null;return e.forEach(s=>{if(s instanceof Map&&(s.has("easing")&&(a=s.get("easing"),s.delete("easing")),!r)){for(let c of s.values())if(c.toString().indexOf(hV)>=0){r=!0;break}}}),{type:kn.Style,styles:e,easing:a,offset:o.offset,containsDynamicStyles:r,options:null}}_validateStyleAst(o,t){let e=t.currentAnimateTimings,i=t.currentTime,r=t.currentTime;e&&r>0&&(r-=e.duration+e.delay),o.styles.forEach(a=>{typeof a!="string"&&a.forEach((s,c)=>{let p=t.collectedStyles.get(t.currentQuerySelector),u=p.get(c),C=!0;u&&(r!=i&&r>=u.startTime&&i<=u.endTime&&(t.errors.push(pie(c,u.startTime,u.endTime,r,i)),C=!1),r=u.startTime),C&&p.set(c,{startTime:r,endTime:i}),t.options&&Rie(s,t.options,t.errors)})})}visitKeyframes(o,t){let e={type:kn.Keyframes,styles:[],options:null};if(!t.currentAnimateTimings)return t.errors.push(gie()),e;let i=1,r=0,a=[],s=!1,c=!1,p=0,u=o.steps.map(ce=>{let Ce=this._makeStyleAst(ce,t),Ie=Ce.offset!=null?Ce.offset:m6e(Ce.styles),$e=0;return Ie!=null&&(r++,$e=Ce.offset=Ie),c=c||$e<0||$e>1,s=s||$e<p,p=$e,a.push($e),Ce});c&&t.errors.push(uie()),s&&t.errors.push(hie());let C=o.steps.length,E=0;r>0&&r<C?t.errors.push(fie()):r==0&&(E=i/(C-1));let D=C-1,L=t.currentTime,$=t.currentAnimateTimings,Y=$.duration;return u.forEach((ce,Ce)=>{let Ie=E>0?Ce==D?1:E*Ce:a[Ce],$e=Ie*Y;t.currentTime=L+$.delay+$e,$.duration=$e,this._validateStyleAst(ce,t),ce.offset=Ie,e.styles.push(ce)}),e}visitReference(o,t){return{type:kn.Reference,animation:Ss(this,ov(o.animation),t),options:Au(o.options)}}visitAnimateChild(o,t){return t.depCount++,{type:kn.AnimateChild,options:Au(o.options)}}visitAnimateRef(o,t){return{type:kn.AnimateRef,animation:this.visitReference(o.animation,t),options:Au(o.options)}}visitQuery(o,t){let e=t.currentQuerySelector,i=o.options||{};t.queryCount++,t.currentQuery=o;let[r,a]=l6e(o.selector);t.currentQuerySelector=e.length?e+" "+r:r,ys(t.collectedStyles,t.currentQuerySelector,new Map);let s=Ss(this,ov(o.animation),t);return t.currentQuery=null,t.currentQuerySelector=e,{type:kn.Query,selector:r,limit:i.limit||0,optional:!!i.optional,includeSelf:a,animation:s,originalSelector:o.selector,options:Au(o.options)}}visitStagger(o,t){t.currentQuery||t.errors.push(vie());let e=o.timings==="full"?{duration:0,delay:0,easing:"full"}:mS(o.timings,t.errors,!0);return{type:kn.Stagger,animation:Ss(this,ov(o.animation),t),timings:e,options:null}}};function l6e(n){let o=!!n.split(/\s*,\s*/).find(t=>t==qie);return o&&(n=n.replace(s6e,"")),n=n.replace(/@\*/g,cS).replace(/@\w+/g,t=>cS+"-"+t.slice(1)).replace(/:animating/g,G5),[n,o]}function c6e(n){return n?I({},n):null}var xV=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(o){this.errors=o}};function m6e(n){if(typeof n=="string")return null;let o=null;if(Array.isArray(n))n.forEach(t=>{if(t instanceof Map&&t.has("offset")){let e=t;o=parseFloat(e.get("offset")),e.delete("offset")}});else if(n instanceof Map&&n.has("offset")){let t=n;o=parseFloat(t.get("offset")),t.delete("offset")}return o}function d6e(n,o){if(n.hasOwnProperty("duration"))return n;if(typeof n=="number"){let r=mS(n,o).duration;return _V(r,0,"")}let t=n;if(t.split(/\s+/).some(r=>r.charAt(0)=="{"&&r.charAt(1)=="{")){let r=_V(0,0,"");return r.dynamic=!0,r.strValue=t,r}let i=mS(t,o);return _V(i.duration,i.delay,i.easing)}function Au(n){return n?(n=I({},n),n.params&&(n.params=c6e(n.params))):n={},n}function _V(n,o,t){return{duration:n,delay:o,easing:t}}function FV(n,o,t,e,i,r,a=null,s=!1){return{type:1,element:n,keyframes:o,preStyleProps:t,postStyleProps:e,duration:i,delay:r,totalTime:i+r,easing:a,subTimeline:s}}var pS=class{_map=new Map;get(o){return this._map.get(o)||[]}append(o,t){let e=this._map.get(o);e||this._map.set(o,e=[]),e.push(...t)}has(o){return this._map.has(o)}clear(){this._map.clear()}},p6e=1,g6e=":enter",u6e=new RegExp(g6e,"g"),h6e=":leave",f6e=new RegExp(h6e,"g");function Kie(n,o,t,e,i,r=new Map,a=new Map,s,c,p=[]){return new TV().buildKeyframes(n,o,t,e,i,r,a,s,c,p)}var TV=class{buildKeyframes(o,t,e,i,r,a,s,c,p,u=[]){p=p||new pS;let C=new DV(o,t,p,i,r,u,[]);C.options=c;let E=c.delay?dm(c.delay):0;C.currentTimeline.delayNextStep(E),C.currentTimeline.setStyles([a],null,C.errors,c),Ss(this,e,C);let D=C.timelines.filter(L=>L.containsAnimation());if(D.length&&s.size){let L;for(let $=D.length-1;$>=0;$--){let Y=D[$];if(Y.element===t){L=Y;break}}L&&!L.allowOnlyTimelineStyles()&&L.setStyles([s],null,C.errors,c)}return D.length?D.map(L=>L.buildKeyframes()):[FV(t,[],[],[],0,E,"",!1)]}visitTrigger(o,t){}visitState(o,t){}visitTransition(o,t){}visitAnimateChild(o,t){let e=t.subInstructions.get(t.element);if(e){let i=t.createSubContext(o.options),r=t.currentTimeline.currentTime,a=this._visitSubInstructions(e,i,i.options);r!=a&&t.transformIntoNewTimeline(a)}t.previousNode=o}visitAnimateRef(o,t){let e=t.createSubContext(o.options);e.transformIntoNewTimeline(),this._applyAnimationRefDelays([o.options,o.animation.options],t,e),this.visitReference(o.animation,e),t.transformIntoNewTimeline(e.currentTimeline.currentTime),t.previousNode=o}_applyAnimationRefDelays(o,t,e){for(let i of o){let r=i?.delay;if(r){let a=typeof r=="number"?r:dm(rv(r,i?.params??{},t.errors));e.delayNextStep(a)}}}_visitSubInstructions(o,t,e){let r=t.currentTimeline.currentTime,a=e.duration!=null?dm(e.duration):null,s=e.delay!=null?dm(e.delay):null;return a!==0&&o.forEach(c=>{let p=t.appendInstructionToTimeline(c,a,s);r=Math.max(r,p.duration+p.delay)}),r}visitReference(o,t){t.updateOptions(o.options,!0),Ss(this,o.animation,t),t.previousNode=o}visitSequence(o,t){let e=t.subContextCount,i=t,r=o.options;if(r&&(r.params||r.delay)&&(i=t.createSubContext(r),i.transformIntoNewTimeline(),r.delay!=null)){i.previousNode.type==kn.Style&&(i.currentTimeline.snapshotCurrentStyles(),i.previousNode=e6);let a=dm(r.delay);i.delayNextStep(a)}o.steps.length&&(o.steps.forEach(a=>Ss(this,a,i)),i.currentTimeline.applyStylesToKeyframe(),i.subContextCount>e&&i.transformIntoNewTimeline()),t.previousNode=o}visitGroup(o,t){let e=[],i=t.currentTimeline.currentTime,r=o.options&&o.options.delay?dm(o.options.delay):0;o.steps.forEach(a=>{let s=t.createSubContext(o.options);r&&s.delayNextStep(r),Ss(this,a,s),i=Math.max(i,s.currentTimeline.currentTime),e.push(s.currentTimeline)}),e.forEach(a=>t.currentTimeline.mergeTimelineCollectedStyles(a)),t.transformIntoNewTimeline(i),t.previousNode=o}_visitTiming(o,t){if(o.dynamic){let e=o.strValue,i=t.params?rv(e,t.params,t.errors):e;return mS(i,t.errors)}else return{duration:o.duration,delay:o.delay,easing:o.easing}}visitAnimate(o,t){let e=t.currentAnimateTimings=this._visitTiming(o.timings,t),i=t.currentTimeline;e.delay&&(t.incrementTime(e.delay),i.snapshotCurrentStyles());let r=o.style;r.type==kn.Keyframes?this.visitKeyframes(r,t):(t.incrementTime(e.duration),this.visitStyle(r,t),i.applyStylesToKeyframe()),t.currentAnimateTimings=null,t.previousNode=o}visitStyle(o,t){let e=t.currentTimeline,i=t.currentAnimateTimings;!i&&e.hasCurrentStyleProperties()&&e.forwardFrame();let r=i&&i.easing||o.easing;o.isEmptyStep?e.applyEmptyStep(r):e.setStyles(o.styles,r,t.errors,t.options),t.previousNode=o}visitKeyframes(o,t){let e=t.currentAnimateTimings,i=t.currentTimeline.duration,r=e.duration,s=t.createSubContext().currentTimeline;s.easing=e.easing,o.styles.forEach(c=>{let p=c.offset||0;s.forwardTime(p*r),s.setStyles(c.styles,c.easing,t.errors,t.options),s.applyStylesToKeyframe()}),t.currentTimeline.mergeTimelineCollectedStyles(s),t.transformIntoNewTimeline(i+r),t.previousNode=o}visitQuery(o,t){let e=t.currentTimeline.currentTime,i=o.options||{},r=i.delay?dm(i.delay):0;r&&(t.previousNode.type===kn.Style||e==0&&t.currentTimeline.hasCurrentStyleProperties())&&(t.currentTimeline.snapshotCurrentStyles(),t.previousNode=e6);let a=e,s=t.invokeQuery(o.selector,o.originalSelector,o.limit,o.includeSelf,!!i.optional,t.errors);t.currentQueryTotal=s.length;let c=null;s.forEach((p,u)=>{t.currentQueryIndex=u;let C=t.createSubContext(o.options,p);r&&C.delayNextStep(r),p===t.element&&(c=C.currentTimeline),Ss(this,o.animation,C),C.currentTimeline.applyStylesToKeyframe();let E=C.currentTimeline.currentTime;a=Math.max(a,E)}),t.currentQueryIndex=0,t.currentQueryTotal=0,t.transformIntoNewTimeline(a),c&&(t.currentTimeline.mergeTimelineCollectedStyles(c),t.currentTimeline.snapshotCurrentStyles()),t.previousNode=o}visitStagger(o,t){let e=t.parentContext,i=t.currentTimeline,r=o.timings,a=Math.abs(r.duration),s=a*(t.currentQueryTotal-1),c=a*t.currentQueryIndex;switch(r.duration<0?"reverse":r.easing){case"reverse":c=s-c;break;case"full":c=e.currentStaggerTime;break}let u=t.currentTimeline;c&&u.delayNextStep(c);let C=u.currentTime;Ss(this,o.animation,t),t.previousNode=o,e.currentStaggerTime=i.currentTime-C+(i.startTime-e.currentTimeline.startTime)}},e6={},DV=class n{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=e6;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(o,t,e,i,r,a,s,c){this._driver=o,this.element=t,this.subInstructions=e,this._enterClassName=i,this._leaveClassName=r,this.errors=a,this.timelines=s,this.currentTimeline=c||new t6(this._driver,t,0),s.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(o,t){if(!o)return;let e=o,i=this.options;e.duration!=null&&(i.duration=dm(e.duration)),e.delay!=null&&(i.delay=dm(e.delay));let r=e.params;if(r){let a=i.params;a||(a=this.options.params={}),Object.keys(r).forEach(s=>{(!t||!a.hasOwnProperty(s))&&(a[s]=rv(r[s],a,this.errors))})}}_copyOptions(){let o={};if(this.options){let t=this.options.params;if(t){let e=o.params={};Object.keys(t).forEach(i=>{e[i]=t[i]})}}return o}createSubContext(o=null,t,e){let i=t||this.element,r=new n(this._driver,i,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(i,e||0));return r.previousNode=this.previousNode,r.currentAnimateTimings=this.currentAnimateTimings,r.options=this._copyOptions(),r.updateOptions(o),r.currentQueryIndex=this.currentQueryIndex,r.currentQueryTotal=this.currentQueryTotal,r.parentContext=this,this.subContextCount++,r}transformIntoNewTimeline(o){return this.previousNode=e6,this.currentTimeline=this.currentTimeline.fork(this.element,o),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(o,t,e){let i={duration:t??o.duration,delay:this.currentTimeline.currentTime+(e??0)+o.delay,easing:""},r=new wV(this._driver,o.element,o.keyframes,o.preStyleProps,o.postStyleProps,i,o.stretchStartingKeyframe);return this.timelines.push(r),i}incrementTime(o){this.currentTimeline.forwardTime(this.currentTimeline.duration+o)}delayNextStep(o){o>0&&this.currentTimeline.delayNextStep(o)}invokeQuery(o,t,e,i,r,a){let s=[];if(i&&s.push(this.element),o.length>0){o=o.replace(u6e,"."+this._enterClassName),o=o.replace(f6e,"."+this._leaveClassName);let c=e!=1,p=this._driver.query(this.element,o,c);e!==0&&(p=e<0?p.slice(p.length+e,p.length):p.slice(0,e)),s.push(...p)}return!r&&s.length==0&&a.push(Cie(t)),s}},t6=class n{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(o,t,e,i){this._driver=o,this.element=t,this.startTime=e,this._elementTimelineStylesLookup=i,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(t),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(t,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(o){let t=this._keyframes.size===1&&this._pendingStyles.size;this.duration||t?(this.forwardTime(this.currentTime+o),t&&this.snapshotCurrentStyles()):this.startTime+=o}fork(o,t){return this.applyStylesToKeyframe(),new n(this._driver,o,t||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=p6e,this._loadKeyframe()}forwardTime(o){this.applyStylesToKeyframe(),this.duration=o,this._loadKeyframe()}_updateStyle(o,t){this._localTimelineStyles.set(o,t),this._globalTimelineStyles.set(o,t),this._styleSummary.set(o,{time:this.currentTime,value:t})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(o){o&&this._previousKeyframe.set("easing",o);for(let[t,e]of this._globalTimelineStyles)this._backFill.set(t,e||Cl),this._currentKeyframe.set(t,Cl);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(o,t,e,i){t&&this._previousKeyframe.set("easing",t);let r=i&&i.params||{},a=v6e(o,this._globalTimelineStyles);for(let[s,c]of a){let p=rv(c,r,e);this._pendingStyles.set(s,p),this._localTimelineStyles.has(s)||this._backFill.set(s,this._globalTimelineStyles.get(s)??Cl),this._updateStyle(s,p)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((o,t)=>{this._currentKeyframe.set(t,o)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((o,t)=>{this._currentKeyframe.has(t)||this._currentKeyframe.set(t,o)}))}snapshotCurrentStyles(){for(let[o,t]of this._localTimelineStyles)this._pendingStyles.set(o,t),this._updateStyle(o,t)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let o=[];for(let t in this._currentKeyframe)o.push(t);return o}mergeTimelineCollectedStyles(o){o._styleSummary.forEach((t,e)=>{let i=this._styleSummary.get(e);(!i||t.time>i.time)&&this._updateStyle(e,t.value)})}buildKeyframes(){this.applyStylesToKeyframe();let o=new Set,t=new Set,e=this._keyframes.size===1&&this.duration===0,i=[];this._keyframes.forEach((s,c)=>{let p=new Map([...this._backFill,...s]);p.forEach((u,C)=>{u===iv?o.add(C):u===Cl&&t.add(C)}),e||p.set("offset",c/this.duration),i.push(p)});let r=[...o.values()],a=[...t.values()];if(e){let s=i[0],c=new Map(s);s.set("offset",0),c.set("offset",1),i=[s,c]}return FV(this.element,i,r,a,this.duration,this.startTime,this.easing,!1)}},wV=class extends t6{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(o,t,e,i,r,a,s=!1){super(o,t,a.delay),this.keyframes=e,this.preStyleProps=i,this.postStyleProps=r,this._stretchStartingKeyframe=s,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let o=this.keyframes,{delay:t,duration:e,easing:i}=this.timings;if(this._stretchStartingKeyframe&&t){let r=[],a=e+t,s=t/a,c=new Map(o[0]);c.set("offset",0),r.push(c);let p=new Map(o[0]);p.set("offset",Vie(s)),r.push(p);let u=o.length-1;for(let C=1;C<=u;C++){let E=new Map(o[C]),D=E.get("offset"),L=t+D*e;E.set("offset",Vie(L/a)),r.push(E)}e=a,t=0,i="",o=r}return FV(this.element,o,this.preStyleProps,this.postStyleProps,e,t,i,!0)}};function Vie(n,o=3){let t=Math.pow(10,o-1);return Math.round(n*t)/t}function v6e(n,o){let t=new Map,e;return n.forEach(i=>{if(i==="*"){e??=o.keys();for(let r of e)t.set(r,Cl)}else for(let[r,a]of i)t.set(r,a)}),t}function Uie(n,o,t,e,i,r,a,s,c,p,u,C,E){return{type:0,element:n,triggerName:o,isRemovalTransition:i,fromState:t,fromStyles:r,toState:e,toStyles:a,timelines:s,queriedElements:c,preStyleProps:p,postStyleProps:u,totalTime:C,errors:E}}var yV={},n6=class{_triggerName;ast;_stateStyles;constructor(o,t,e){this._triggerName=o,this.ast=t,this._stateStyles=e}match(o,t,e,i){return C6e(this.ast.matchers,o,t,e,i)}buildStyles(o,t,e){let i=this._stateStyles.get("*");return o!==void 0&&(i=this._stateStyles.get(o?.toString())||i),i?i.buildStyles(t,e):new Map}build(o,t,e,i,r,a,s,c,p,u){let C=[],E=this.ast.options&&this.ast.options.params||yV,D=s&&s.params||yV,L=this.buildStyles(e,D,C),$=c&&c.params||yV,Y=this.buildStyles(i,$,C),ce=new Set,Ce=new Map,Ie=new Map,$e=i==="void",Ye={params:Zie($,E),delay:this.ast.options?.delay},Re=u?[]:Kie(o,t,this.ast.animation,r,a,L,Y,Ye,p,C),_e=0;return Re.forEach(Ee=>{_e=Math.max(Ee.duration+Ee.delay,_e)}),C.length?Uie(t,this._triggerName,e,i,$e,L,Y,[],[],Ce,Ie,_e,C):(Re.forEach(Ee=>{let Oe=Ee.element,ye=ys(Ce,Oe,new Set);Ee.preStyleProps.forEach(Le=>ye.add(Le));let he=ys(Ie,Oe,new Set);Ee.postStyleProps.forEach(Le=>he.add(Le)),Oe!==t&&ce.add(Oe)}),Uie(t,this._triggerName,e,i,$e,L,Y,Re,[...ce.values()],Ce,Ie,_e))}};function C6e(n,o,t,e,i){return n.some(r=>r(o,t,e,i))}function Zie(n,o){let t=I({},o);return Object.entries(n).forEach(([e,i])=>{i!=null&&(t[e]=i)}),t}var OV=class{styles;defaultParams;normalizer;constructor(o,t,e){this.styles=o,this.defaultParams=t,this.normalizer=e}buildStyles(o,t){let e=new Map,i=Zie(o,this.defaultParams);return this.styles.styles.forEach(r=>{typeof r!="string"&&r.forEach((a,s)=>{a&&(a=rv(a,i,t));let c=this.normalizer.normalizePropertyName(s,t);a=this.normalizer.normalizeStyleValue(s,c,a,t),e.set(s,a)})}),e}};function _6e(n,o,t){return new AV(n,o,t)}var AV=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(o,t,e){this.name=o,this.ast=t,this._normalizer=e,t.states.forEach(i=>{let r=i.options&&i.options.params||{};this.states.set(i.name,new OV(i.style,r,e))}),jie(this.states,"true","1"),jie(this.states,"false","0"),t.transitions.forEach(i=>{this.transitionFactories.push(new n6(o,i,this.states))}),this.fallbackTransition=y6e(o,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(o,t,e,i){return this.transitionFactories.find(a=>a.match(o,t,e,i))||null}matchStyles(o,t,e){return this.fallbackTransition.buildStyles(o,t,e)}};function y6e(n,o,t){let e=[(a,s)=>!0],i={type:kn.Sequence,steps:[],options:null},r={type:kn.Transition,animation:i,matchers:e,options:null,queryCount:0,depCount:0};return new n6(n,r,o)}function jie(n,o,t){n.has(o)?n.has(t)||n.set(t,n.get(o)):n.has(t)&&n.set(o,n.get(t))}var S6e=new pS,PV=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(o,t,e){this.bodyNode=o,this._driver=t,this._normalizer=e}register(o,t){let e=[],i=[],r=Yie(this._driver,t,e,i);if(e.length)throw bie(e);this._animations.set(o,r)}_buildPlayer(o,t,e){let i=o.element,r=dV(this._normalizer,o.keyframes,t,e);return this._driver.animate(i,r,o.duration,o.delay,o.easing,[],!0)}create(o,t,e={}){let i=[],r=this._animations.get(o),a,s=new Map;if(r?(a=Kie(this._driver,t,r,fV,z5,new Map,new Map,e,S6e,i),a.forEach(u=>{let C=ys(s,u.element,new Map);u.postStyleProps.forEach(E=>C.set(E,null))})):(i.push(Iie()),a=[]),i.length)throw Eie(i);s.forEach((u,C)=>{u.forEach((E,D)=>{u.set(D,this._driver.computeStyle(C,D,Cl))})});let c=a.map(u=>{let C=s.get(u.element);return this._buildPlayer(u,new Map,C)}),p=Ed(c);return this._playersById.set(o,p),p.onDestroy(()=>this.destroy(o)),this.players.push(p),p}destroy(o){let t=this._getPlayer(o);t.destroy(),this._playersById.delete(o);let e=this.players.indexOf(t);e>=0&&this.players.splice(e,1)}_getPlayer(o){let t=this._playersById.get(o);if(!t)throw xie(o);return t}listen(o,t,e,i){let r=$5(t,"","","");return j5(this._getPlayer(o),e,r,i),()=>{}}command(o,t,e,i){if(e=="register"){this.register(o,i[0]);return}if(e=="create"){let a=i[0]||{};this.create(o,t,a);return}let r=this._getPlayer(o);switch(e){case"play":r.play();break;case"pause":r.pause();break;case"reset":r.reset();break;case"restart":r.restart();break;case"finish":r.finish();break;case"init":r.init();break;case"setPosition":r.setPosition(parseFloat(i[0]));break;case"destroy":this.destroy(o);break}}},$ie="ng-animate-queued",b6e=".ng-animate-queued",SV="ng-animate-disabled",I6e=".ng-animate-disabled",E6e="ng-star-inserted",x6e=".ng-star-inserted",T6e=[],Xie={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},D6e={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},cc="__ng_removed",gS=class{namespaceId;value;options;get params(){return this.options.params}constructor(o,t=""){this.namespaceId=t;let e=o&&o.hasOwnProperty("value"),i=e?o.value:o;if(this.value=O6e(i),e){let r=o,{value:a}=r,s=z9(r,["value"]);this.options=s}else this.options={};this.options.params||(this.options.params={})}absorbOptions(o){let t=o.params;if(t){let e=this.options.params;Object.keys(t).forEach(i=>{e[i]==null&&(e[i]=t[i])})}}},dS="void",bV=new gS(dS),MV=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(o,t,e){this.id=o,this.hostElement=t,this._engine=e,this._hostClassName="ng-tns-"+o,_l(t,this._hostClassName)}listen(o,t,e,i){if(!this._triggers.has(t))throw Tie(e,t);if(e==null||e.length==0)throw Die(t);if(!A6e(e))throw wie(e,t);let r=ys(this._elementListeners,o,[]),a={name:t,phase:e,callback:i};r.push(a);let s=ys(this._engine.statesByElement,o,new Map);return s.has(t)||(_l(o,lS),_l(o,lS+"-"+t),s.set(t,bV)),()=>{this._engine.afterFlush(()=>{let c=r.indexOf(a);c>=0&&r.splice(c,1),this._triggers.has(t)||s.delete(t)})}}register(o,t){return this._triggers.has(o)?!1:(this._triggers.set(o,t),!0)}_getTrigger(o){let t=this._triggers.get(o);if(!t)throw Oie(o);return t}trigger(o,t,e,i=!0){let r=this._getTrigger(t),a=new uS(this.id,t,o),s=this._engine.statesByElement.get(o);s||(_l(o,lS),_l(o,lS+"-"+t),this._engine.statesByElement.set(o,s=new Map));let c=s.get(t),p=new gS(e,this.id);if(!(e&&e.hasOwnProperty("value"))&&c&&p.absorbOptions(c.options),s.set(t,p),c||(c=bV),!(p.value===dS)&&c.value===p.value){if(!k6e(c.params,p.params)){let $=[],Y=r.matchStyles(c.value,c.params,$),ce=r.matchStyles(p.value,p.params,$);$.length?this._engine.reportError($):this._engine.afterFlush(()=>{Dp(o,Y),lc(o,ce)})}return}let E=ys(this._engine.playersByElement,o,[]);E.forEach($=>{$.namespaceId==this.id&&$.triggerName==t&&$.queued&&$.destroy()});let D=r.matchTransition(c.value,p.value,o,p.params),L=!1;if(!D){if(!i)return;D=r.fallbackTransition,L=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:t,transition:D,fromState:c,toState:p,player:a,isFallbackTransition:L}),L||(_l(o,$ie),a.onStart(()=>{av(o,$ie)})),a.onDone(()=>{let $=this.players.indexOf(a);$>=0&&this.players.splice($,1);let Y=this._engine.playersByElement.get(o);if(Y){let ce=Y.indexOf(a);ce>=0&&Y.splice(ce,1)}}),this.players.push(a),E.push(a),a}deregister(o){this._triggers.delete(o),this._engine.statesByElement.forEach(t=>t.delete(o)),this._elementListeners.forEach((t,e)=>{this._elementListeners.set(e,t.filter(i=>i.name!=o))})}clearElementCache(o){this._engine.statesByElement.delete(o),this._elementListeners.delete(o);let t=this._engine.playersByElement.get(o);t&&(t.forEach(e=>e.destroy()),this._engine.playersByElement.delete(o))}_signalRemovalForInnerTriggers(o,t){let e=this._engine.driver.query(o,cS,!0);e.forEach(i=>{if(i[cc])return;let r=this._engine.fetchNamespacesByElement(i);r.size?r.forEach(a=>a.triggerLeaveAnimation(i,t,!1,!0)):this.clearElementCache(i)}),this._engine.afterFlushAnimationsDone(()=>e.forEach(i=>this.clearElementCache(i)))}triggerLeaveAnimation(o,t,e,i){let r=this._engine.statesByElement.get(o),a=new Map;if(r){let s=[];if(r.forEach((c,p)=>{if(a.set(p,c.value),this._triggers.has(p)){let u=this.trigger(o,p,dS,i);u&&s.push(u)}}),s.length)return this._engine.markElementAsRemoved(this.id,o,!0,t,a),e&&Ed(s).onDone(()=>this._engine.processLeaveNode(o)),!0}return!1}prepareLeaveAnimationListeners(o){let t=this._elementListeners.get(o),e=this._engine.statesByElement.get(o);if(t&&e){let i=new Set;t.forEach(r=>{let a=r.name;if(i.has(a))return;i.add(a);let c=this._triggers.get(a).fallbackTransition,p=e.get(a)||bV,u=new gS(dS),C=new uS(this.id,a,o);this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:a,transition:c,fromState:p,toState:u,player:C,isFallbackTransition:!0})})}}removeNode(o,t){let e=this._engine;if(o.childElementCount&&this._signalRemovalForInnerTriggers(o,t),this.triggerLeaveAnimation(o,t,!0))return;let i=!1;if(e.totalAnimations){let r=e.players.length?e.playersByQueriedElement.get(o):[];if(r&&r.length)i=!0;else{let a=o;for(;a=a.parentNode;)if(e.statesByElement.get(a)){i=!0;break}}}if(this.prepareLeaveAnimationListeners(o),i)e.markElementAsRemoved(this.id,o,!1,t);else{let r=o[cc];(!r||r===Xie)&&(e.afterFlush(()=>this.clearElementCache(o)),e.destroyInnerAnimations(o),e._onRemovalComplete(o,t))}}insertNode(o,t){_l(o,this._hostClassName)}drainQueuedTransitions(o){let t=[];return this._queue.forEach(e=>{let i=e.player;if(i.destroyed)return;let r=e.element,a=this._elementListeners.get(r);a&&a.forEach(s=>{if(s.name==e.triggerName){let c=$5(r,e.triggerName,e.fromState.value,e.toState.value);c._data=o,j5(e.player,s.phase,c,s.callback)}}),i.markedForDestroy?this._engine.afterFlush(()=>{i.destroy()}):t.push(e)}),this._queue=[],t.sort((e,i)=>{let r=e.transition.ast.depCount,a=i.transition.ast.depCount;return r==0||a==0?r-a:this._engine.driver.containsElement(e.element,i.element)?1:-1})}destroy(o){this.players.forEach(t=>t.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,o)}},kV=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(o,t)=>{};_onRemovalComplete(o,t){this.onRemovalComplete(o,t)}constructor(o,t,e){this.bodyNode=o,this.driver=t,this._normalizer=e}get queuedPlayers(){let o=[];return this._namespaceList.forEach(t=>{t.players.forEach(e=>{e.queued&&o.push(e)})}),o}createNamespace(o,t){let e=new MV(o,t,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,t)?this._balanceNamespaceList(e,t):(this.newHostElements.set(t,e),this.collectEnterElement(t)),this._namespaceLookup[o]=e}_balanceNamespaceList(o,t){let e=this._namespaceList,i=this.namespacesByHostElement;if(e.length-1>=0){let a=!1,s=this.driver.getParentElement(t);for(;s;){let c=i.get(s);if(c){let p=e.indexOf(c);e.splice(p+1,0,o),a=!0;break}s=this.driver.getParentElement(s)}a||e.unshift(o)}else e.push(o);return i.set(t,o),o}register(o,t){let e=this._namespaceLookup[o];return e||(e=this.createNamespace(o,t)),e}registerTrigger(o,t,e){let i=this._namespaceLookup[o];i&&i.register(t,e)&&this.totalAnimations++}destroy(o,t){o&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let e=this._fetchNamespace(o);this.namespacesByHostElement.delete(e.hostElement);let i=this._namespaceList.indexOf(e);i>=0&&this._namespaceList.splice(i,1),e.destroy(t),delete this._namespaceLookup[o]}))}_fetchNamespace(o){return this._namespaceLookup[o]}fetchNamespacesByElement(o){let t=new Set,e=this.statesByElement.get(o);if(e){for(let i of e.values())if(i.namespaceId){let r=this._fetchNamespace(i.namespaceId);r&&t.add(r)}}return t}trigger(o,t,e,i){if(Z5(t)){let r=this._fetchNamespace(o);if(r)return r.trigger(t,e,i),!0}return!1}insertNode(o,t,e,i){if(!Z5(t))return;let r=t[cc];if(r&&r.setForRemoval){r.setForRemoval=!1,r.setForMove=!0;let a=this.collectedLeaveElements.indexOf(t);a>=0&&this.collectedLeaveElements.splice(a,1)}if(o){let a=this._fetchNamespace(o);a&&a.insertNode(t,e)}i&&this.collectEnterElement(t)}collectEnterElement(o){this.collectedEnterElements.push(o)}markElementAsDisabled(o,t){t?this.disabledNodes.has(o)||(this.disabledNodes.add(o),_l(o,SV)):this.disabledNodes.has(o)&&(this.disabledNodes.delete(o),av(o,SV))}removeNode(o,t,e){if(Z5(t)){let i=o?this._fetchNamespace(o):null;i?i.removeNode(t,e):this.markElementAsRemoved(o,t,!1,e);let r=this.namespacesByHostElement.get(t);r&&r.id!==o&&r.removeNode(t,e)}else this._onRemovalComplete(t,e)}markElementAsRemoved(o,t,e,i,r){this.collectedLeaveElements.push(t),t[cc]={namespaceId:o,setForRemoval:i,hasAnimation:e,removedBeforeQueried:!1,previousTriggersValues:r}}listen(o,t,e,i,r){return Z5(t)?this._fetchNamespace(o).listen(t,e,i,r):()=>{}}_buildInstruction(o,t,e,i,r){return o.transition.build(this.driver,o.element,o.fromState.value,o.toState.value,e,i,o.fromState.options,o.toState.options,t,r)}destroyInnerAnimations(o){let t=this.driver.query(o,cS,!0);t.forEach(e=>this.destroyActiveAnimationsForElement(e)),this.playersByQueriedElement.size!=0&&(t=this.driver.query(o,G5,!0),t.forEach(e=>this.finishActiveQueriedAnimationOnElement(e)))}destroyActiveAnimationsForElement(o){let t=this.playersByElement.get(o);t&&t.forEach(e=>{e.queued?e.markedForDestroy=!0:e.destroy()})}finishActiveQueriedAnimationOnElement(o){let t=this.playersByQueriedElement.get(o);t&&t.forEach(e=>e.finish())}whenRenderingDone(){return new Promise(o=>{if(this.players.length)return Ed(this.players).onDone(()=>o());o()})}processLeaveNode(o){let t=o[cc];if(t&&t.setForRemoval){if(o[cc]=Xie,t.namespaceId){this.destroyInnerAnimations(o);let e=this._fetchNamespace(t.namespaceId);e&&e.clearElementCache(o)}this._onRemovalComplete(o,t.setForRemoval)}o.classList?.contains(SV)&&this.markElementAsDisabled(o,!1),this.driver.query(o,I6e,!0).forEach(e=>{this.markElementAsDisabled(e,!1)})}flush(o=-1){let t=[];if(this.newHostElements.size&&(this.newHostElements.forEach((e,i)=>this._balanceNamespaceList(e,i)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let e=0;e<this.collectedEnterElements.length;e++){let i=this.collectedEnterElements[e];_l(i,E6e)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let e=[];try{t=this._flushAnimations(e,o)}finally{for(let i=0;i<e.length;i++)e[i]()}}else for(let e=0;e<this.collectedLeaveElements.length;e++){let i=this.collectedLeaveElements[e];this.processLeaveNode(i)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(e=>e()),this._flushFns=[],this._whenQuietFns.length){let e=this._whenQuietFns;this._whenQuietFns=[],t.length?Ed(t).onDone(()=>{e.forEach(i=>i())}):e.forEach(i=>i())}}reportError(o){throw Aie(o)}_flushAnimations(o,t){let e=new pS,i=[],r=new Map,a=[],s=new Map,c=new Map,p=new Map,u=new Set;this.disabledNodes.forEach(ut=>{u.add(ut);let wt=this.driver.query(ut,b6e,!0);for(let At=0;At<wt.length;At++)u.add(wt[At])});let C=this.bodyNode,E=Array.from(this.statesByElement.keys()),D=Gie(E,this.collectedEnterElements),L=new Map,$=0;D.forEach((ut,wt)=>{let At=fV+$++;L.set(wt,At),ut.forEach(sn=>_l(sn,At))});let Y=[],ce=new Set,Ce=new Set;for(let ut=0;ut<this.collectedLeaveElements.length;ut++){let wt=this.collectedLeaveElements[ut],At=wt[cc];At&&At.setForRemoval&&(Y.push(wt),ce.add(wt),At.hasAnimation?this.driver.query(wt,x6e,!0).forEach(sn=>ce.add(sn)):Ce.add(wt))}let Ie=new Map,$e=Gie(E,Array.from(ce));$e.forEach((ut,wt)=>{let At=z5+$++;Ie.set(wt,At),ut.forEach(sn=>_l(sn,At))}),o.push(()=>{D.forEach((ut,wt)=>{let At=L.get(wt);ut.forEach(sn=>av(sn,At))}),$e.forEach((ut,wt)=>{let At=Ie.get(wt);ut.forEach(sn=>av(sn,At))}),Y.forEach(ut=>{this.processLeaveNode(ut)})});let Ye=[],Re=[];for(let ut=this._namespaceList.length-1;ut>=0;ut--)this._namespaceList[ut].drainQueuedTransitions(t).forEach(At=>{let sn=At.player,to=At.element;if(Ye.push(sn),this.collectedEnterElements.length){let uo=to[cc];if(uo&&uo.setForMove){if(uo.previousTriggersValues&&uo.previousTriggersValues.has(At.triggerName)){let Qs=uo.previousTriggersValues.get(At.triggerName),$r=this.statesByElement.get(At.element);if($r&&$r.has(At.triggerName)){let Js=$r.get(At.triggerName);Js.value=Qs,$r.set(At.triggerName,Js)}}sn.destroy();return}}let oi=!C||!this.driver.containsElement(C,to),Ri=Ie.get(to),pn=L.get(to),Ci=this._buildInstruction(At,e,pn,Ri,oi);if(Ci.errors&&Ci.errors.length){Re.push(Ci);return}if(oi){sn.onStart(()=>Dp(to,Ci.fromStyles)),sn.onDestroy(()=>lc(to,Ci.toStyles)),i.push(sn);return}if(At.isFallbackTransition){sn.onStart(()=>Dp(to,Ci.fromStyles)),sn.onDestroy(()=>lc(to,Ci.toStyles)),i.push(sn);return}let Ni=[];Ci.timelines.forEach(uo=>{uo.stretchStartingKeyframe=!0,this.disabledNodes.has(uo.element)||Ni.push(uo)}),Ci.timelines=Ni,e.append(to,Ci.timelines);let jm={instruction:Ci,player:sn,element:to};a.push(jm),Ci.queriedElements.forEach(uo=>ys(s,uo,[]).push(sn)),Ci.preStyleProps.forEach((uo,Qs)=>{if(uo.size){let $r=c.get(Qs);$r||c.set(Qs,$r=new Set),uo.forEach((Js,Ml)=>$r.add(Ml))}}),Ci.postStyleProps.forEach((uo,Qs)=>{let $r=p.get(Qs);$r||p.set(Qs,$r=new Set),uo.forEach((Js,Ml)=>$r.add(Ml))})});if(Re.length){let ut=[];Re.forEach(wt=>{ut.push(Pie(wt.triggerName,wt.errors))}),Ye.forEach(wt=>wt.destroy()),this.reportError(ut)}let _e=new Map,Ee=new Map;a.forEach(ut=>{let wt=ut.element;e.has(wt)&&(Ee.set(wt,wt),this._beforeAnimationBuild(ut.player.namespaceId,ut.instruction,_e))}),i.forEach(ut=>{let wt=ut.element;this._getPreviousPlayers(wt,!1,ut.namespaceId,ut.triggerName,null).forEach(sn=>{ys(_e,wt,[]).push(sn),sn.destroy()})});let Oe=Y.filter(ut=>Wie(ut,c,p)),ye=new Map;zie(ye,this.driver,Ce,p,Cl).forEach(ut=>{Wie(ut,c,p)&&Oe.push(ut)});let Le=new Map;D.forEach((ut,wt)=>{zie(Le,this.driver,new Set(ut),c,iv)}),Oe.forEach(ut=>{let wt=ye.get(ut),At=Le.get(ut);ye.set(ut,new Map([...wt?.entries()??[],...At?.entries()??[]]))});let xe=[],Tn=[],Ht={};a.forEach(ut=>{let{element:wt,player:At,instruction:sn}=ut;if(e.has(wt)){if(u.has(wt)){At.onDestroy(()=>lc(wt,sn.toStyles)),At.disabled=!0,At.overrideTotalTime(sn.totalTime),i.push(At);return}let to=Ht;if(Ee.size>1){let Ri=wt,pn=[];for(;Ri=Ri.parentNode;){let Ci=Ee.get(Ri);if(Ci){to=Ci;break}pn.push(Ri)}pn.forEach(Ci=>Ee.set(Ci,to))}let oi=this._buildAnimation(At.namespaceId,sn,_e,r,Le,ye);if(At.setRealPlayer(oi),to===Ht)xe.push(At);else{let Ri=this.playersByElement.get(to);Ri&&Ri.length&&(At.parentPlayer=Ed(Ri)),i.push(At)}}else Dp(wt,sn.fromStyles),At.onDestroy(()=>lc(wt,sn.toStyles)),Tn.push(At),u.has(wt)&&i.push(At)}),Tn.forEach(ut=>{let wt=r.get(ut.element);if(wt&&wt.length){let At=Ed(wt);ut.setRealPlayer(At)}}),i.forEach(ut=>{ut.parentPlayer?ut.syncPlayerEvents(ut.parentPlayer):ut.destroy()});for(let ut=0;ut<Y.length;ut++){let wt=Y[ut],At=wt[cc];if(av(wt,z5),At&&At.hasAnimation)continue;let sn=[];if(s.size){let oi=s.get(wt);oi&&oi.length&&sn.push(...oi);let Ri=this.driver.query(wt,G5,!0);for(let pn=0;pn<Ri.length;pn++){let Ci=s.get(Ri[pn]);Ci&&Ci.length&&sn.push(...Ci)}}let to=sn.filter(oi=>!oi.destroyed);to.length?P6e(this,wt,to):this.processLeaveNode(wt)}return Y.length=0,xe.forEach(ut=>{this.players.push(ut),ut.onDone(()=>{ut.destroy();let wt=this.players.indexOf(ut);this.players.splice(wt,1)}),ut.play()}),xe}afterFlush(o){this._flushFns.push(o)}afterFlushAnimationsDone(o){this._whenQuietFns.push(o)}_getPreviousPlayers(o,t,e,i,r){let a=[];if(t){let s=this.playersByQueriedElement.get(o);s&&(a=s)}else{let s=this.playersByElement.get(o);if(s){let c=!r||r==dS;s.forEach(p=>{p.queued||!c&&p.triggerName!=i||a.push(p)})}}return(e||i)&&(a=a.filter(s=>!(e&&e!=s.namespaceId||i&&i!=s.triggerName))),a}_beforeAnimationBuild(o,t,e){let i=t.triggerName,r=t.element,a=t.isRemovalTransition?void 0:o,s=t.isRemovalTransition?void 0:i;for(let c of t.timelines){let p=c.element,u=p!==r,C=ys(e,p,[]);this._getPreviousPlayers(p,u,a,s,t.toState).forEach(D=>{let L=D.getRealPlayer();L.beforeDestroy&&L.beforeDestroy(),D.destroy(),C.push(D)})}Dp(r,t.fromStyles)}_buildAnimation(o,t,e,i,r,a){let s=t.triggerName,c=t.element,p=[],u=new Set,C=new Set,E=t.timelines.map(L=>{let $=L.element;u.add($);let Y=$[cc];if(Y&&Y.removedBeforeQueried)return new cm(L.duration,L.delay);let ce=$!==c,Ce=M6e((e.get($)||T6e).map(_e=>_e.getRealPlayer())).filter(_e=>{let Ee=_e;return Ee.element?Ee.element===$:!1}),Ie=r.get($),$e=a.get($),Ye=dV(this._normalizer,L.keyframes,Ie,$e),Re=this._buildPlayer(L,Ye,Ce);if(L.subTimeline&&i&&C.add($),ce){let _e=new uS(o,s,$);_e.setRealPlayer(Re),p.push(_e)}return Re});p.forEach(L=>{ys(this.playersByQueriedElement,L.element,[]).push(L),L.onDone(()=>w6e(this.playersByQueriedElement,L.element,L))}),u.forEach(L=>_l(L,vV));let D=Ed(E);return D.onDestroy(()=>{u.forEach(L=>av(L,vV)),lc(c,t.toStyles)}),C.forEach(L=>{ys(i,L,[]).push(D)}),D}_buildPlayer(o,t,e){return t.length>0?this.driver.animate(o.element,t,o.duration,o.delay,o.easing,e):new cm(o.duration,o.delay)}},uS=class{namespaceId;triggerName;element;_player=new cm;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(o,t,e){this.namespaceId=o,this.triggerName=t,this.element=e}setRealPlayer(o){this._containsRealPlayer||(this._player=o,this._queuedCallbacks.forEach((t,e)=>{t.forEach(i=>j5(o,e,void 0,i))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(o.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(o){this.totalTime=o}syncPlayerEvents(o){let t=this._player;t.triggerCallback&&o.onStart(()=>t.triggerCallback("start")),o.onDone(()=>this.finish()),o.onDestroy(()=>this.destroy())}_queueEvent(o,t){ys(this._queuedCallbacks,o,[]).push(t)}onDone(o){this.queued&&this._queueEvent("done",o),this._player.onDone(o)}onStart(o){this.queued&&this._queueEvent("start",o),this._player.onStart(o)}onDestroy(o){this.queued&&this._queueEvent("destroy",o),this._player.onDestroy(o)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(o){this.queued||this._player.setPosition(o)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(o){let t=this._player;t.triggerCallback&&t.triggerCallback(o)}};function w6e(n,o,t){let e=n.get(o);if(e){if(e.length){let i=e.indexOf(t);e.splice(i,1)}e.length==0&&n.delete(o)}return e}function O6e(n){return n??null}function Z5(n){return n&&n.nodeType===1}function A6e(n){return n=="start"||n=="done"}function Hie(n,o){let t=n.style.display;return n.style.display=o??"none",t}function zie(n,o,t,e,i){let r=[];t.forEach(c=>r.push(Hie(c)));let a=[];e.forEach((c,p)=>{let u=new Map;c.forEach(C=>{let E=o.computeStyle(p,C,i);u.set(C,E),(!E||E.length==0)&&(p[cc]=D6e,a.push(p))}),n.set(p,u)});let s=0;return t.forEach(c=>Hie(c,r[s++])),a}function Gie(n,o){let t=new Map;if(n.forEach(s=>t.set(s,[])),o.length==0)return t;let e=1,i=new Set(o),r=new Map;function a(s){if(!s)return e;let c=r.get(s);if(c)return c;let p=s.parentNode;return t.has(p)?c=p:i.has(p)?c=e:c=a(p),r.set(s,c),c}return o.forEach(s=>{let c=a(s);c!==e&&t.get(c).push(s)}),t}function _l(n,o){n.classList?.add(o)}function av(n,o){n.classList?.remove(o)}function P6e(n,o,t){Ed(t).onDone(()=>n.processLeaveNode(o))}function M6e(n){let o=[];return Qie(n,o),o}function Qie(n,o){for(let t=0;t<n.length;t++){let e=n[t];e instanceof wu?Qie(e.players,o):o.push(e)}}function k6e(n,o){let t=Object.keys(n),e=Object.keys(o);if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let r=t[i];if(!o.hasOwnProperty(r)||n[r]!==o[r])return!1}return!0}function Wie(n,o,t){let e=t.get(n);if(!e)return!1;let i=o.get(n);return i?e.forEach(r=>i.add(r)):o.set(n,e),t.delete(n),!0}var sv=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(o,t)=>{};constructor(o,t,e){this._driver=t,this._normalizer=e,this._transitionEngine=new kV(o.body,t,e),this._timelineEngine=new PV(o.body,t,e),this._transitionEngine.onRemovalComplete=(i,r)=>this.onRemovalComplete(i,r)}registerTrigger(o,t,e,i,r){let a=o+"-"+i,s=this._triggerCache[a];if(!s){let c=[],p=[],u=Yie(this._driver,r,c,p);if(c.length)throw Sie(i,c);s=_6e(i,u,this._normalizer),this._triggerCache[a]=s}this._transitionEngine.registerTrigger(t,i,s)}register(o,t){this._transitionEngine.register(o,t)}destroy(o,t){this._transitionEngine.destroy(o,t)}onInsert(o,t,e,i){this._transitionEngine.insertNode(o,t,e,i)}onRemove(o,t,e){this._transitionEngine.removeNode(o,t,e)}disableAnimations(o,t){this._transitionEngine.markElementAsDisabled(o,t)}process(o,t,e,i){if(e.charAt(0)=="@"){let[r,a]=pV(e),s=i;this._timelineEngine.command(r,t,a,s)}else this._transitionEngine.trigger(o,t,e,i)}listen(o,t,e,i,r){if(e.charAt(0)=="@"){let[a,s]=pV(e);return this._timelineEngine.listen(a,t,s,r)}return this._transitionEngine.listen(o,t,e,i,r)}flush(o=-1){this._transitionEngine.flush(o)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(o){this._transitionEngine.afterFlushAnimationsDone(o)}};function R6e(n,o){let t=null,e=null;return Array.isArray(o)&&o.length?(t=IV(o[0]),o.length>1&&(e=IV(o[o.length-1]))):o instanceof Map&&(t=IV(o)),t||e?new N6e(n,t,e):null}var N6e=(()=>{class n{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(t,e,i){this._element=t,this._startStyles=e,this._endStyles=i;let r=n.initialStylesByElement.get(t);r||n.initialStylesByElement.set(t,r=new Map),this._initialStyles=r}start(){this._state<1&&(this._startStyles&&lc(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(lc(this._element,this._initialStyles),this._endStyles&&(lc(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(n.initialStylesByElement.delete(this._element),this._startStyles&&(Dp(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(Dp(this._element,this._endStyles),this._endStyles=null),lc(this._element,this._initialStyles),this._state=3)}}return n})();function IV(n){let o=null;return n.forEach((t,e)=>{F6e(e)&&(o=o||new Map,o.set(e,t))}),o}function F6e(n){return n==="display"||n==="position"}var i6=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(o,t,e,i){this.element=o,this.keyframes=t,this.options=e,this._specialStyles=i,this._duration=e.duration,this._delay=e.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let o=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,o,this.options),this._finalKeyframe=o.length?o[o.length-1]:new Map;let t=()=>this._onFinish();this.domPlayer.addEventListener("finish",t),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",t)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(o){let t=[];return o.forEach(e=>{t.push(Object.fromEntries(e))}),t}_triggerWebAnimation(o,t,e){return o.animate(this._convertKeyframesToObject(t),e)}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(o=>o()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}setPosition(o){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=o*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let o=new Map;this.hasStarted()&&this._finalKeyframe.forEach((e,i)=>{i!=="offset"&&o.set(i,this._finished?e:q5(this.element,i))}),this.currentSnapshot=o}triggerCallback(o){let t=o==="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},o6=class{validateStyleProperty(o){return!0}validateAnimatableStyleProperty(o){return!0}containsElement(o,t){return gV(o,t)}getParentElement(o){return H5(o)}query(o,t,e){return uV(o,t,e)}computeStyle(o,t,e){return q5(o,t)}animate(o,t,e,i,r,a=[]){let s=i==0?"both":"forwards",c={duration:e,delay:i,fill:s};r&&(c.easing=r);let p=new Map,u=a.filter(D=>D instanceof i6);Nie(e,i)&&u.forEach(D=>{D.currentSnapshot.forEach((L,$)=>p.set($,L))});let C=kie(t).map(D=>new Map(D));C=Fie(o,C,p);let E=R6e(o,C);return new i6(o,C,c,E)}};var X5="@",Jie="@.disabled",r6=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(o,t,e,i){this.namespaceId=o,this.delegate=t,this.engine=e,this._onDestroy=i}get data(){return this.delegate.data}destroyNode(o){this.delegate.destroyNode?.(o)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(o,t){return this.delegate.createElement(o,t)}createComment(o){return this.delegate.createComment(o)}createText(o){return this.delegate.createText(o)}appendChild(o,t){this.delegate.appendChild(o,t),this.engine.onInsert(this.namespaceId,t,o,!1)}insertBefore(o,t,e,i=!0){this.delegate.insertBefore(o,t,e),this.engine.onInsert(this.namespaceId,t,o,i)}removeChild(o,t,e){this.parentNode(t)&&this.engine.onRemove(this.namespaceId,t,this.delegate)}selectRootElement(o,t){return this.delegate.selectRootElement(o,t)}parentNode(o){return this.delegate.parentNode(o)}nextSibling(o){return this.delegate.nextSibling(o)}setAttribute(o,t,e,i){this.delegate.setAttribute(o,t,e,i)}removeAttribute(o,t,e){this.delegate.removeAttribute(o,t,e)}addClass(o,t){this.delegate.addClass(o,t)}removeClass(o,t){this.delegate.removeClass(o,t)}setStyle(o,t,e,i){this.delegate.setStyle(o,t,e,i)}removeStyle(o,t,e){this.delegate.removeStyle(o,t,e)}setProperty(o,t,e){t.charAt(0)==X5&&t==Jie?this.disableAnimations(o,!!e):this.delegate.setProperty(o,t,e)}setValue(o,t){this.delegate.setValue(o,t)}listen(o,t,e,i){return this.delegate.listen(o,t,e,i)}disableAnimations(o,t){this.engine.disableAnimations(o,t)}},RV=class extends r6{factory;constructor(o,t,e,i,r){super(t,e,i,r),this.factory=o,this.namespaceId=t}setProperty(o,t,e){t.charAt(0)==X5?t.charAt(1)=="."&&t==Jie?(e=e===void 0?!0:!!e,this.disableAnimations(o,e)):this.engine.process(this.namespaceId,o,t.slice(1),e):this.delegate.setProperty(o,t,e)}listen(o,t,e,i){if(t.charAt(0)==X5){let r=L6e(o),a=t.slice(1),s="";return a.charAt(0)!=X5&&([a,s]=B6e(a)),this.engine.listen(this.namespaceId,r,a,s,c=>{let p=c._data||-1;this.factory.scheduleListenerCallback(p,e,c)})}return this.delegate.listen(o,t,e,i)}};function L6e(n){switch(n){case"body":return document.body;case"document":return document;case"window":return window;default:return n}}function B6e(n){let o=n.indexOf("."),t=n.substring(0,o),e=n.slice(o+1);return[t,e]}var a6=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(o,t,e){this.delegate=o,this.engine=t,this._zone=e,t.onRemovalComplete=(i,r)=>{r?.removeChild(null,i)}}createRenderer(o,t){let e="",i=this.delegate.createRenderer(o,t);if(!o||!t?.data?.animation){let p=this._rendererCache,u=p.get(i);if(!u){let C=()=>p.delete(i);u=new r6(e,i,this.engine,C),p.set(i,u)}return u}let r=t.id,a=t.id+"-"+this._currentId;this._currentId++,this.engine.register(a,o);let s=p=>{Array.isArray(p)?p.forEach(s):this.engine.registerTrigger(r,a,o,p.name,p)};return t.data.animation.forEach(s),new RV(this,a,i,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(o,t,e){if(o>=0&&o<this._microtaskId){this._zone.run(()=>t(e));return}let i=this._animationCallbacksBuffer;i.length==0&&queueMicrotask(()=>{this._zone.run(()=>{i.forEach(r=>{let[a,s]=r;a(s)}),this._animationCallbacksBuffer=[]})}),i.push([t,e])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(o){this.engine.flush(),this.delegate.componentReplaced?.(o)}};var U6e=(()=>{class n extends sv{constructor(t,e,i){super(t,e,i)}ngOnDestroy(){this.flush()}static \u0275fac=function(e){return new(e||n)(Q(Dn),Q(Pu),Q(Mu))};static \u0275prov=Pe({token:n,factory:n.\u0275fac})}return n})();function j6e(){return new Q5}function $6e(n,o,t){return new a6(n,o,t)}var toe=[{provide:Mu,useFactory:j6e},{provide:sv,useClass:U6e},{provide:Ko,useFactory:$6e,deps:[S1,sv,Mt]}],H6e=[{provide:Pu,useClass:NV},{provide:sr,useValue:"NoopAnimations"},...toe],eoe=[{provide:Pu,useFactory:()=>new o6},{provide:sr,useFactory:()=>"BrowserAnimations"},...toe],noe=(()=>{class n{static withConfig(t){return{ngModule:n,providers:t.disableAnimations?H6e:eoe}}static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:eoe,imports:[I1]})}return n})();var Xn={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",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",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"}}};var X=(()=>{let o=class o{};o.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",SIGN_OUT_USER_TRIGGERED:"signOutUserTriggered",SET_DOCUMENTS_TRIGGERED:"setDocumentsTriggered",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_DATA_PROVIDERS_TRIGGERED:"setDataProvidersTriggered",GET_DOCUMENT_ID_TRIGGERED:"getDocumentIdTriggered",SET_LOCATIONS_TRIGGERED:"setLocationsTriggered",SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"setScrollableElementsIdsTriggered",REMOVE_LOCATIONS_TRIGGERED:"removeLocationsTriggered",EXCLUDE_LOCATION_IDS_TRIGGERED:"excludeLocationIdsTriggered",UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",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",DISABLE_FEATURES_TRIGGERED:"disableFeaturesTriggered",SET_DARK_MODE_TRIGGERED:"setDarkModeTriggered",ENABLE_LOGS_TRIGGERED:"enableLogsTriggered",DISABLE_LOGS_TRIGGERED:"disableLogsTriggered",IS_USER_ALLOWED_TRIGGERED:"isUserAllowedTriggered",GET_USER_TRIGGERED:"getUserTriggered",GET_USER_ROLE_TRIGGERED:"getUserRoleTriggered",GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED:"getFeaturesAccessLevelIamTriggered",IS_PLAN_EXPIRED_TRIGGERED:"isPlanExpiredTriggered",GET_VELT_INIT_STATE_TRIGGERED:"getVeltInitStateTriggered",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",ST_TRIGGERED:"stTriggered",ON_ACTION_TRIGGERED:"onActionTriggered",SET_UI_STATE_TRIGGERED:"setUiStateTriggered",GET_UI_STATE_TRIGGERED:"getUiStateTriggered",RESET_VELT_BUTTON_STATE_TRIGGERED:"resetVeltButtonStateTriggered"},Resolver:{COMMENT_RESOLVER_GET:"comment_resolver_get",COMMENT_RESOLVER_SAVE:"comment_resolver_save",COMMENT_RESOLVER_DELETE:"comment_resolver_delete",REACTION_RESOLVER_GET:"reaction_resolver_get",REACTION_RESOLVER_SAVE:"reaction_resolver_save",REACTION_RESOLVER_DELETE:"reaction_resolver_delete",USER_RESOLVER_GET:"user_resolver_get",ATTACHMENT_RESOLVER_SAVE:"attachment_resolver_save",ATTACHMENT_RESOLVER_DELETE:"attachment_resolver_delete"},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_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",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",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",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",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",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_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",SET_RECORDINGS_TRIGGERED:"setRecordingsTriggered",ADD_COMMENT_ON_ELEMENT_TRIGGERED:"addCommentOnElementTriggered",ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"enablePrivateCommentModeTriggered",DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"disablePrivateCommentModeTriggered",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_MULTI_THREAD_MODE_TRIGGERED:"enableMultiThreadModeTriggered",DISABLE_MULTI_THREAD_MODE_TRIGGERED:"disableMultiThreadModeTriggered",ENABLE_MULTI_THREAD_TRIGGERED:"enableMultiThreadTriggered",DISABLE_MULTI_THREAD_TRIGGERED:"disableMultiThreadTriggered",UPDATE_CONTEXT_TRIGGERED:"updateContextTriggered",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",ON_COMMENT_SIDEBAR_ACTION_BUTTON_CLICK_TRIGGERED:"onCommentSidebarActionButtonClickTriggered",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_SEEN_BY_USERS_TRIGGERED:"enableSeenByUsersTriggered",DISABLE_SEEN_BY_USERS_TRIGGERED:"disableSeenByUsersTriggered",ENABLE_SHORT_USER_NAME_TRIGGERED:"enableShortUserNameTriggered",DISABLE_SHORT_USER_NAME_TRIGGERED:"disableShortUserNameTriggered",ENABLE_READ_ONLY_TRIGGERED:"enableReadOnlyTriggered",DISABLE_READ_ONLY_TRIGGERED:"disableReadOnlyTriggered",ADD_COMMENT_ANNOTATION_TRIGGERED:"addCommentAnnotationTriggered",APPROVE_COMMENT_ANNOTATION_TRIGGERED:"approveCommentAnnotationTriggered",ACCEPT_COMMENT_ANNOTATION_TRIGGERED:"acceptCommentAnnotationTriggered",REJECT_COMMENT_ANNOTATION_TRIGGERED:"rejectCommentAnnotationTriggered",SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"subscribeCommentAnnotationTriggered",UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"unsubscribeCommentAnnotationTriggered",DELETE_COMMENT_ANNOTATION_TRIGGERED:"deleteCommentAnnotationTriggered",GET_COMMENT_ANNOTATIONS_TRIGGERED:"getCommentAnnotationsTriggered",GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED:"getCommentAnnotationsCountTriggered",ASSIGN_USER_TRIGGERED:"assignUserTriggered",UPDATE_PRIORITY_TRIGGERED:"updatePriorityTriggered",UPDATE_STATUS_TRIGGERED:"updateStatusTriggered",UPDATE_ACCESS_TRIGGERED:"updateAccessTriggered",RESOLVE_COMMENT_ANNOTATION_TRIGGERED:"resolveCommentAnnotationTriggered",GET_LINK_TRIGGERED:"getLinkTriggered",COPY_LINK_TRIGGERED:"copyLinkTriggered",ADD_COMMENT_TRIGGERED:"addCommentTriggered",UPDATE_COMMENT_TRIGGERED:"updateCommentTriggered",DELETE_COMMENT_TRIGGERED:"deleteCommentTriggered",GET_COMMENT_TRIGGERED:"getCommentTriggered",ADD_ATTACHMENT_TRIGGERED:"addAttachmentTriggered",DELETE_ATTACHMENT_TRIGGERED:"deleteAttachmentTriggered",GET_ATTACHMENT_TRIGGERED:"getAttachmentTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",GET_RECORDING_TRIGGERED:"getRecordingTriggered",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",ON_ACTION_TRIGGERED:"onActionTriggered"},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_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",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",ON_ACTION_TRIGGERED:"onActionTriggered",DOWNLOAD_LATEST_VIDEO_TRIGGERED:"downloadLatestVideoTriggered"},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",ON_ACTION_TRIGGERED:"onActionTriggered"},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",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"},LiveStateSync:{SET_USER_AS_EDITOR_TRIGGERED:"setUserAsEditorTriggered",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",GET_LIVE_STATE_DATA_TRIGGERED:"getLiveStateDataTriggered",SET_LIVE_STATE_DATA_TRIGGERED:"setLiveStateDataTriggered",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",ON_ACTION_TRIGGERED:"onActionTriggered"},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"},Feedback:{FEEDBACK_BUTTON_CLICKED:"feedbackButtonClicked",FEEDBACK_SUBMITTED:"feedbackSubmitted"},Contact:{UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",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",DOCUMENT_SET_SUCCESS:"documentSetSuccess",LOCATION_SET_SUCCESS:"locationSetSuccess",REMOVE_LOCATIONS_SUCCESS:"removeLocationsSuccess",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",NOTIFICATION_HISTORY_PANEL_CLOSED:"notificationHistoryPanelClosed",NOTIFICATION_HISTORY_PANEL_TOGGLED:"notificationHistoryPanelToggled",NOTIFICATION_MARK_ALL_AS_READ_CLICKED:"notificationMarkAllAsReadClicked",NOTIFICATION_CLICKED:"notificationClicked",NOTIFICATION_TAB_CLICKED:"notificationTabClicked",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"}};let n=o;return n})(),ioe=[X.Events.Rewriter.REWRITER_ENABLED];var Oa=class n{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(o,t=!1){return this.onePassHasher.start().appendStr(o).end(t)}static hashAsciiStr(o,t=!1){return this.onePassHasher.start().appendAsciiStr(o).end(t)}static _hex(o){let t=n.hexChars,e=n.hexOut,i,r,a,s;for(s=0;s<4;s+=1)for(r=s*8,i=o[s],a=0;a<8;a+=2)e[r+1+a]=t.charAt(i&15),i>>>=4,e[r+0+a]=t.charAt(i&15),i>>>=4;return e.join("")}static _md5cycle(o,t){let e=o[0],i=o[1],r=o[2],a=o[3];e+=(i&r|~i&a)+t[0]-680876936|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[1]-389564586|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[2]+606105819|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[3]-1044525330|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[4]-176418897|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[5]+1200080426|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[6]-1473231341|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[7]-45705983|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[8]+1770035416|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[9]-1958414417|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[10]-42063|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[11]-1990404162|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[12]+1804603682|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[13]-40341101|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[14]-1502002290|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[15]+1236535329|0,i=(i<<22|i>>>10)+r|0,e+=(i&a|r&~a)+t[1]-165796510|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[6]-1069501632|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[11]+643717713|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[0]-373897302|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[5]-701558691|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[10]+38016083|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[15]-660478335|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[4]-405537848|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[9]+568446438|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[14]-1019803690|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[3]-187363961|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[8]+1163531501|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[13]-1444681467|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[2]-51403784|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[7]+1735328473|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[12]-1926607734|0,i=(i<<20|i>>>12)+r|0,e+=(i^r^a)+t[5]-378558|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[8]-2022574463|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[11]+1839030562|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[14]-35309556|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[1]-1530992060|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[4]+1272893353|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[7]-155497632|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[10]-1094730640|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[13]+681279174|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[0]-358537222|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[3]-722521979|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[6]+76029189|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[9]-640364487|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[12]-421815835|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[15]+530742520|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[2]-995338651|0,i=(i<<23|i>>>9)+r|0,e+=(r^(i|~a))+t[0]-198630844|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[7]+1126891415|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[14]-1416354905|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[5]-57434055|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[12]+1700485571|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[3]-1894986606|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[10]-1051523|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[1]-2054922799|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[8]+1873313359|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[15]-30611744|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[6]-1560198380|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[13]+1309151649|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[4]-145523070|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[11]-1120210379|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[2]+718787259|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[9]-343485551|0,i=(i<<21|i>>>11)+r|0,o[0]=e+o[0]|0,o[1]=i+o[1]|0,o[2]=r+o[2]|0,o[3]=a+o[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(n.stateIdentity),this}appendStr(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a;for(a=0;a<o.length;a+=1){if(r=o.charCodeAt(a),r<128)t[i++]=r;else if(r<2048)t[i++]=(r>>>6)+192,t[i++]=r&63|128;else if(r<55296||r>56319)t[i++]=(r>>>12)+224,t[i++]=r>>>6&63|128,t[i++]=r&63|128;else{if(r=(r-55296)*1024+(o.charCodeAt(++a)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(r>>>18)+240,t[i++]=r>>>12&63|128,t[i++]=r>>>6&63|128,t[i++]=r&63|128}i>=64&&(this._dataLength+=64,n._md5cycle(this._state,e),i-=64,e[0]=e[16])}return this._bufferLength=i,this}appendAsciiStr(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a=0;for(;;){for(r=Math.min(o.length-a,64-i);r--;)t[i++]=o.charCodeAt(a++);if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,e),i=0}return this._bufferLength=i,this}appendByteArray(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a=0;for(;;){for(r=Math.min(o.length-a,64-i);r--;)t[i++]=o[a++];if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,e),i=0}return this._bufferLength=i,this}getState(){let o=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[o[0],o[1],o[2],o[3]]}}setState(o){let t=o.buffer,e=o.state,i=this._state,r;for(this._dataLength=o.length,this._bufferLength=o.buflen,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(o=!1){let t=this._bufferLength,e=this._buffer8,i=this._buffer32,r=(t>>2)+1;this._dataLength+=t;let a=this._dataLength*8;if(e[t]=128,e[t+1]=e[t+2]=e[t+3]=0,i.set(n.buffer32Identity.subarray(r),r),t>55&&(n._md5cycle(this._state,i),i.set(n.buffer32Identity)),a<=4294967295)i[14]=a;else{let s=a.toString(16).match(/(.*?)(.{0,8})$/);if(s===null)return;let c=parseInt(s[2],16),p=parseInt(s[1],16)||0;i[14]=c,i[15]=p}return n._md5cycle(this._state,i),o?this._state:n._hex(this._state)}};Oa.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);Oa.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Oa.hexChars="0123456789abcdef";Oa.hexOut=[];Oa.onePassHasher=new Oa;if(Oa.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var Ut=function(n){return n.NEWLY_ADDED="newlyAdded",n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.ASSIGNED="assigned",n.STATUS_CHANGED="statusChanged",n.PRIORITY_CHANGED="priorityChanged",n.ACCESS_MODE_CHANGED="accessModeChanged",n.CUSTOM_LIST_CHANGED="customListChanged",n.ACCEPTED="accepted",n.REJECTED="rejected",n.REACTION_ADDED="reactionAdded",n.REACTION_DELETED="reactionDeleted",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",n}(Ut||{}),qa=function(n){return n.COMMENT_ANNOTATION_ADD="comment_annotation.add",n.COMMENT_ANNOTATION_DELETE="comment_annotation.delete",n.COMMENT_ADD="comment.add",n.COMMENT_DELETE="comment.delete",n.COMMENT_UPDATE="comment.update",n.REACTION_ADD="reaction.add",n.REACTION_DELETE="reaction.delete",n.ATTACHMENT_ADD="attachment.add",n.ATTACHMENT_DELETE="attachment.delete",n}(qa||{}),Zi={ADD_COMMENT_ANNOTATION:"addCommentAnnotation",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",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"},ku={TRANSCRIPTION_DONE:"transcriptionDone",RECORDING_DONE:"recordingDone",RECORDING_EDIT_DONE:"recordingEditDone",DELETE_RECORDING:"deleteRecording",ERROR:"error",RECORDING_SAVE_INITIATED:"recordingSaveInitiated"},$o={VELT_BUTTON_CLICK:"veltButtonClick",USER_UPDATE:"userUpdate",INIT_UPDATE:"initUpdate",DOCUMENT_INIT:"documentInit",ERROR:"error"},wp={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"},LV={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},hS=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n}(hS||{}),BV=function(n){return n.INVITE="invite",n.REMOVE="remove",n}(BV||{}),s6=function(n){return n.CREATED="created",n.JOINED="joined",n}(s6||{}),lv=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n}(lv||{}),l6=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n}(l6||{}),c6=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n}(c6||{}),VV=function(n){return n.FIRST_VIEWED="firstViewed",n}(VV||{}),ke=function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n}(ke||{}),Ru=function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.AREA_COMMENT="areaComment",n.INLINE_COMMENT="inlineComment",n.COMMENT_SIDEBAR="commentSidebar",n}(Ru||{}),Qo=function(n){return n.DESKTOP="Desktop",n.MOBILE="Mobile",n.TABLET="Tablet",n.MONITOR="Monitor",n.UNKNOWN="Unknown",n}(Qo||{}),cv=function(n){return n.PORTRAIT="portrait",n.LANDSCAPE="landscape",n.UNKNOWN="unknown",n}(cv||{}),mv=function(n){return n.Portrait="(orientation: portrait)",n.Landscape="(orientation: landscape)",n}(mv||{}),zs=function(n){return n.DIFFERENT_DEVICE="differentDevice",n.ELEMENT_DELETED="elementDeleted",n}(zs||{}),po=function(n){return n.ADMIN="Admin",n.COMMENTER="Commenter",n}(po||{}),pi=function(n){return n.PUBLIC="public",n.RESTRICTED="restricted",n.ORGANIZATION_PRIVATE="organizationPrivate",n}(pi||{}),m6=function(n){return n.DEFAULT="default",n.DYNAMIC_ID="dynamicId",n}(m6||{}),Xi=function(n){return n.PUBLIC="public",n.PRIVATE="private",n}(Xi||{}),Nu=function(n){return n.MINIMAL="minimal",n.VERBOSE="verbose",n}(Nu||{}),Fu=function(n){return n.DEFAULT="default",n.EXPANDED="expanded",n}(Fu||{}),UV=function(n){return n.TOTAL="total",n.UNREAD="unread",n}(UV||{}),Gs=function(n){return n.ONLINE="online",n.OFFLINE="offline",n.PENDING_INIT="pendingInit",n.PENDING_DATA="pendingData",n}(Gs||{}),Mi=function(n){return n.ALL="all",n.ORGANIZATION="organization",n.ORGANIZATION_USER_GROUP="organizationUserGroup",n.DOCUMENT="document",n.FOLDER="folder",n}(Mi||{}),mc=function(n){return n.AND="and",n.OR="or",n}(mc||{});var ei=(()=>{let o=class o{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 o.Breakpoints[wi.Handset]?Qo.MOBILE:o.Breakpoints[wi.Tablet]?Qo.TABLET:o.Breakpoints[wi.XLarge]?Qo.MONITOR:o.Breakpoints[wi.Web]?Qo.DESKTOP:Qo.UNKNOWN}catch{return Qo.UNKNOWN}}getOrientation(){try{return o.Orientations[mv.Portrait]?cv.PORTRAIT:o.Orientations[mv.Landscape]?cv.LANDSCAPE:cv.UNKNOWN}catch{return cv.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 a=navigator?.userAgent,s="Unknown";if(a.indexOf("Windows")!==-1)a.indexOf("Windows NT 5.1")!==-1?s="Windows XP":a.indexOf("Windows NT 6.0")!==-1?s="Windows Vista":a.indexOf("Windows NT 6.1")!==-1?s="Windows 7":a.indexOf("Windows NT 6.2")!==-1?s="Windows 8":a.indexOf("Windows NT 6.3")!==-1?s="Windows 8.1":a.indexOf("Windows NT 10.0")!==-1&&(s="Windows 10");else if(a.indexOf("Mac OS X")!==-1)s=a.match(/Mac OS X ([0-9_.]+)/)[1],s=s.replace(/_/g,".");else if(a.indexOf("iOS")!==-1)s=a.match(/OS ([0-9_.]+) like Mac OS X/)[1],s=s.replace(/_/g,".");else if(a.indexOf("Firefox")!==-1){var e=/\(([^)]+)\)/,i=e.exec(a)[1],r=i.split("; ");s=r[2]}return s||"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 e=navigator.userAgent.match(/(?:Opera|OPR)\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getChromeVersion(){try{var e=navigator.userAgent.match(/(?:Chrome|Chromium)\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getSafariVersion(){try{var e=navigator.userAgent.match(/Version\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getFirefoxVersion(){try{var e=navigator.userAgent.match(/Firefox\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getIEVersion(){try{var e=navigator.userAgent.match(/MSIE (\d+)/);return e?e[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"}}}};o.Breakpoints={},o.Orientations={};let n=o;return n})();var Qi=class{constructor(){this.deviceInfo=new ei().getDeviceInfo()}};var Aa=class Aa{static showLogs(){try{return Xn.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(o){return Aa.catch("Error in showLogs: ",o),!1}}};Aa.log=Aa.showLogs()?console.log:()=>{},Aa.warn=Aa.showLogs()?console.warn:()=>{},Aa.error=Aa.showLogs()?console.error:()=>{},Aa.debug=Aa.showLogs()?console.debug:()=>{},Aa.info=Aa.showLogs()?console.info:()=>{},Aa.logsEnabled=!0,Aa.catch=(o,t)=>{try{Aa.logsEnabled&&(t!==void 0?console.warn("Velt: ",o,t):console.warn("Velt: ",o))}catch{}};var mt=Aa;var pt=class pt{};pt.SNIPPYLY_HOST_URL_PROD="https://snippyly.com",pt.SNIPPYLY_HOST_URL_STAGING="https://snippyly-staging.web.app",pt.USER_TYPE_ANONYMOUS="anonymous",pt.USER_TYPE_SIGNED_IN="signedIn",pt.LOCALSTORAGE_DATA_ID="snippylytempdata",pt.NO_ORGANIZATION_ID="veltNoOrganization",pt.DEFAULT_QUERY_HASH="default",pt.LISTENER_BATCH_SIZE=5,pt.FIREBASE_PARTIAL_PATH_ORGANIZATIONS="organizations",pt.FIREBASE_PARTIAL_PATH_FOLDERS="folders",pt.FIREBASE_PARTIAL_PATH_DOCS="docs",pt.FIREBASE_PARTIAL_PATH_PRESENCE="presence",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS="orgIamUsers",pt.FIREBASE_PARTIAL_PATH_FOLDER_USERS="folderIamUsers",pt.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS="docIamUsers",pt.FIREBASE_PARTIAL_PATH_CURSOR="cursor",pt.FIREBASE_PARTIAL_PATH_ARROW="arrow",pt.FIREBASE_PARTIAL_PATH_AREA="area",pt.FIREBASE_PARTIAL_PATH_COMMENT="comment",pt.FIREBASE_PARTIAL_PATH_LOCATION="location",pt.FIREBASE_PARTIAL_PATH_MULTI_THREAD="multiThread",pt.FIREBASE_PARTIAL_PATH_TAG="tag",pt.FIREBASE_PARTIAL_PATH_SELECTION="selection",pt.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE="audioHuddle",pt.FIREBASE_PARTIAL_PATH_HUDDLE="huddle",pt.FIREBASE_PARTIAL_PATH_CONTACTS="contacts",pt.FIREBASE_PARTIAL_PATH_GROUPS="groups",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS="notificationsDocs",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS="notificationsUsers",pt.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION="notificationsDocs__notification",pt.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION="notificationsUsers__notification",pt.FIREBASE_PARTIAL_PATH_GLOBAL="global",pt.FIREBASE_PARTIAL_PATH_LOGINS="logins",pt.FIREBASE_PARTIAL_PATH_METADATA="metadata",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA="metadata",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS="groups",pt.FIREBASE_PARTIAL_PATH_LOCATIONS="locations",pt.FIREBASE_PARTIAL_PATH_RECORDER="recorder",pt.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG="flock",pt.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER="syncVideoPlayer",pt.FIREBASE_PARTIAL_PATH_LIVE_STATE="liveState",pt.FIREBASE_PARTIAL_PATH_IAM="iam",pt.FIREBASE_PARTIAL_PATH_REACTION="reaction",pt.FIREBASE_PARTIAL_PATH_VIEWS="views",pt.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS="commentViews",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS="notificationViews",pt.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS="documentViews",pt.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS="locationViews",pt.FIREBASE_PARTIAL_PATH_NOTIFICATIONS="notifications",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS="notifications",pt.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP="lastNotificationTimestamp",pt.FIREBASE_PARTIAL_PATH_USERS="users",pt.FIREBASE_PARTIAL_PATH_USER_REQUESTS="userRequests",pt.FIREBASE_PARTIAL_PATH_FEEDBACK="feedback",pt.FIREBASE_PARTIAL_PATH_BUGS="bugs",pt.FIREBASE_PARTIAL_PATH_CONTACT_US="contactUs",pt.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA="metadata",pt.PRESENCE_STATUS_ONLINE="online",pt.PRESENCE_STATUS_OFFLINE="offline",pt.PRESENCE_STATUS_AWAY="away",pt.IMG_URL_NOT_FOUND="https://snippyly.com/assets/icons/anon-user.svg",pt.IMG_CLASS_NOT_FOUND="presence-avatar-image-small",pt.AVATAR_COLOR_LIST=["#a259fe","#9746ff","#19bcfe","#FE8947","#2c83fc","#0dcf82","#ffcb00","#ff7162","#FFD600","#A5A7FE","#67DBF4","#FDA192"],pt.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"},pt.UNREAD_COMMENTS_CHECK_FROM_DATE="2024-02-05",pt.DEFAULT_ANNOTATION_COLOR="#a259fe",pt.REGEX_EMAIL=/(\+|@)+([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,pt.REGEX_URL=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,pt.REGEX_SPECIAL_CHARS=/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,pt.SNIPPYLY_HIGHLIGHT="snippyly-highlight",pt.SNIPPYLY_HIGHLIGHT_PREVIEW="snippyly-highlight-preview",pt.SNIPPYLY_HIGHLIGHT_USER="snippyly-highlight-user",pt.SNIPPYLY_HIGHLIGHT_USER_NAME="snippyly-highlight-user-name",pt.SNIPPYLY_HIGHLIGHT_USER_TEXT="snippyly-highlight-user-text",pt.VELT_LIVE_SELECTION_ON_ELEMENT="velt-live-selection-on-element",pt.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT="velt-live-selection-on-element-default",pt.VELT_LIVE_SELECTION_ON_TEXT="velt-live-selection-on-text",pt.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT="velt-live-selection-on-text-default",pt.VELT_IGNORE_CHANGE_DETECTION="velt-ignore-change-detection",pt.VELT_CUSTOM_CSS="velt-custom-css",pt.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_INTERNAL:"velt-recorder-control-panel-internal",VELT_RECORDER_PLAYER:"velt-recorder-player",VELT_TEXT_HIGHLIGHT:"velt-text-highlight",VELT_COMMENT_TEXT_PORTAL:"velt-comment-text-portal",VELT_COMMENTS_SIDEBAR:"velt-comments-sidebar",VELT_COMMENT_BUBBLE:"velt-comment-bubble",VELT_COMMENT_THREAD:"velt-comment-thread",VELT_COMMENT_PIN:"velt-comment-pin",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_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",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",VELT_INLINE_REACTIONS_SECTION:"velt-inline-reactions-section",VELT_VIEW_ANALYTICS:"velt-view-analytics",VELT_NOTIFICATIONS_TOOL:"velt-notifications-tool",VELT_NOTIFICATIONS_PANEL:"velt-notifications-panel",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel",VELT_WIREFRAME:"velt-wireframe",VELT_AUTOCOMPLETE:"velt-autocomplete",VELT_AUTOCOMPLETE_CHIP:"velt-autocomplete-chip",VELT_COMMENT_DIALOG_HEADER:"velt-comment-dialog-header",VELT_COMMENT_DIALOG_BODY:"velt-comment-dialog-body",VELT_COMMENT_DIALOG_FOOTER:"velt-comment-dialog-footer",VELT_COMMENT_DIALOG_PRIORITY:"velt-comment-dialog-priority",VELT_COMMENT_DIALOG_STATUS:"velt-comment-dialog-status",VELT_COMMENT_DIALOG_COPY_LINK:"velt-comment-dialog-copy-link",VELT_COMMENT_DIALOG_RESOLVE_BUTTON:"velt-comment-dialog-resolve-button",VELT_COMMENT_DIALOG_OPTIONS:"velt-comment-dialog-options",VELT_COMMENT_DIALOG_BODY_THREAD_CARD:"velt-comment-dialog-thread-card",VELT_COMMENT_DIALOG_PRIVATE_BANNER:"velt-comment-dialog-private-banner",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"},pt.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_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"},pt.INJECTION_STYLE_PROPS={VELT_AVATAR_COLOR:"data-velt-avatar-color",VELT_COMMENT_PRIORITY_COLOR:"data-velt-priority-color"},pt.INJECTION_ATTRIBUTES={VELT_AVATAR_IMG:"data-velt-avatar-img",VELT_COMMENT_LENGTH:"data-velt-comment-thread-length"},pt.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_CUSTOM_PRIORITY_MAP:"veltCustomPriorityMap",VELT_CUSTOM_STATUS_MAP:"veltCustomStatusMap",VELT_CUSTOM_CATEGORY_MAP:"veltCustomCategoryMap"},pt.LOCAL_STORAGE={SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS:"snippylyDefaultMediaSourceOptions",SNIPPYLY_QUEUED_COMMENT:"snippylyQueuedComment",VELT_USER:"_vu",VELT_USER_FORCE_RE_LOGGED_IN:"_vurli",VELT_VERSION:"_vv",VELT_ADVANCED_QUERIES:"_vadq"},pt.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},pt.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS={svg:!0},pt.SELECTION_ENABLED_ELEMENTS={input:!0,textarea:!0,select:!0,button:!0},pt.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"},pt.VELT_BASE_REM_UNIT="--velt-base-rem-unit",pt.VELT_VIEWPORT_WIDTH="--legacy-velt-viewport-width",pt.VELT_VIEWPORT_HEIGHT="--legacy-velt-viewport-height",pt.VELT_SELECTION_COLOR="--velt-selection-color",pt.VELT_MIN_ARROW_LENGTH=100,pt.VELT_ARROW_VIEWPORT_PADDING=20,pt.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME=5,pt.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"},pt.VIDEO_POSTER_DEFAULT_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURQAAAAEAAKSl0/gAAAAxSURBVFjD7dBBDQAgCABARjKjGZUofi0Ac+4uwkUAAAAAAMCIpYD/bQVNSsEtFfCaA8vLAaMbkVUtAAAAAElFTkSuQmCC",pt.HUDDLE_TYPE_CONFIGS={audio:{audio:!0,video:!1,presentation:!1},video:{audio:!0,video:!0,presentation:!1},presentation:{audio:!1,video:!1,presentation:!0}},pt.RecorderModes={VIDEO:"video",AUDIO:"audio",SCREEN:"screen",ALL:"all"},pt.CommentAnnotationStatusMap={OPEN:{id:"OPEN",name:"Open",color:"var(--velt-accent, #625DF5)",lightColor:"var(--velt-accent-light, #E7E8FA)",type:"default",svg:`
70
+ `],encapsulation:2,changeDetection:0})}return n})(),Qne=new at("mat-menu-scroll-strategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.reposition()}});function j5e(n){return()=>n.scrollStrategies.reposition()}var $5e={provide:Qne,deps:[Bi],useFactory:j5e},H5e={passive:!0};var aS=new WeakMap,Tp=(()=>{class n{_overlay=Se(Bi);_element=Se(N);_viewContainerRef=Se(yi);_menuItemInstance=Se(Hs,{optional:!0,self:!0});_dir=Se(Vr,{optional:!0});_focusMonitor=Se(xu);_ngZone=Se(Mt);_scrollStrategy=Se(Qne);_changeDetectorRef=Se(Kt);_cleanupTouchstart;_portal;_overlayRef=null;_menuOpen=!1;_closingActionsSubscription=cn.EMPTY;_hoverSubscription=cn.EMPTY;_menuCloseSubscription=cn.EMPTY;_pendingRemoval;_parentMaterialMenu;_parentInnerPadding;_openedBy=void 0;get _deprecatedMatMenuTriggerFor(){return this.menu}set _deprecatedMatMenuTriggerFor(t){this.menu=t}get menu(){return this._menu}set menu(t){t!==this._menu&&(this._menu=t,this._menuCloseSubscription.unsubscribe(),t&&(this._parentMaterialMenu,this._menuCloseSubscription=t.close.subscribe(e=>{this._destroyMenu(e),(e==="click"||e==="tab")&&this._parentMaterialMenu&&this._parentMaterialMenu.closed.emit(e)})),this._menuItemInstance?._setTriggersSubmenu(this.triggersSubmenu()))}_menu;menuData;restoreFocus=!0;menuOpened=new Ae;onMenuOpen=this.menuOpened;menuClosed=new Ae;onMenuClose=this.menuClosed;constructor(){let t=Se(oV,{optional:!0}),e=Se(Wi);this._parentMaterialMenu=t instanceof vl?t:void 0,this._cleanupTouchstart=vr(e,this._element.nativeElement,"touchstart",i=>{gd(i)||(this._openedBy="touch")},H5e)}ngAfterContentInit(){this._handleHover()}ngOnDestroy(){this.menu&&this._ownsMenu(this.menu)&&aS.delete(this.menu),this._cleanupTouchstart(),this._pendingRemoval?.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe(),this._hoverSubscription.unsubscribe(),this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=null)}get menuOpen(){return this._menuOpen}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}triggersSubmenu(){return!!(this._menuItemInstance&&this._parentMaterialMenu&&this.menu)}toggleMenu(){return this._menuOpen?this.closeMenu():this.openMenu()}openMenu(){let t=this.menu;if(this._menuOpen||!t)return;this._pendingRemoval?.unsubscribe();let e=aS.get(t);aS.set(t,this),e&&e!==this&&e.closeMenu();let i=this._createOverlay(t),r=i.getConfig(),a=r.positionStrategy;this._setPosition(t,a),r.hasBackdrop=t.hasBackdrop==null?!this.triggersSubmenu():t.hasBackdrop,i.hasAttached()||(i.attach(this._getPortal(t)),t.lazyContent?.attach(this.menuData)),this._closingActionsSubscription=this._menuClosingActions().subscribe(()=>this.closeMenu()),t.parentMenu=this.triggersSubmenu()?this._parentMaterialMenu:void 0,t.direction=this.dir,t.focusFirstItem(this._openedBy||"program"),this._setIsMenuOpen(!0),t instanceof vl&&(t._setIsOpen(!0),t._directDescendantItems.changes.pipe(ro(t.close)).subscribe(()=>{a.withLockedPosition(!1).reapplyLastPosition(),a.withLockedPosition(!0)}))}closeMenu(){this.menu?.close.emit()}focus(t,e){this._focusMonitor&&t?this._focusMonitor.focusVia(this._element,t,e):this._element.nativeElement.focus(e)}updatePosition(){this._overlayRef?.updatePosition()}_destroyMenu(t){let e=this._overlayRef,i=this._menu;!e||!this.menuOpen||(this._closingActionsSubscription.unsubscribe(),this._pendingRemoval?.unsubscribe(),i instanceof vl&&this._ownsMenu(i)?(this._pendingRemoval=i._animationDone.pipe(et(1)).subscribe(()=>{e.detach(),i.lazyContent?.detach()}),i._setIsOpen(!1)):(e.detach(),i?.lazyContent?.detach()),i&&this._ownsMenu(i)&&aS.delete(i),this.restoreFocus&&(t==="keydown"||!this._openedBy||!this.triggersSubmenu())&&this.focus(this._openedBy),this._openedBy=void 0,this._setIsMenuOpen(!1))}_setIsMenuOpen(t){t!==this._menuOpen&&(this._menuOpen=t,this._menuOpen?this.menuOpened.emit():this.menuClosed.emit(),this.triggersSubmenu()&&this._menuItemInstance._setHighlighted(t),this._changeDetectorRef.markForCheck())}_createOverlay(t){if(!this._overlayRef){let e=this._getOverlayConfig(t);this._subscribeToPositions(t,e.positionStrategy),this._overlayRef=this._overlay.create(e),this._overlayRef.keydownEvents().subscribe(i=>{this.menu instanceof vl&&this.menu._handleKeydown(i)})}return this._overlayRef}_getOverlayConfig(t){return new Xl({positionStrategy:this._overlay.position().flexibleConnectedTo(this._element).withLockedPosition().withGrowAfterOpen().withTransformOriginOn(".mat-menu-panel, .mat-mdc-menu-panel"),backdropClass:t.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:t.overlayPanelClass,scrollStrategy:this._scrollStrategy(),direction:this._dir||"ltr"})}_subscribeToPositions(t,e){t.setPositionClasses&&e.positionChanges.subscribe(i=>{this._ngZone.run(()=>{let r=i.connectionPair.overlayX==="start"?"after":"before",a=i.connectionPair.overlayY==="top"?"below":"above";t.setPositionClasses(r,a)})})}_setPosition(t,e){let[i,r]=t.xPosition==="before"?["end","start"]:["start","end"],[a,s]=t.yPosition==="above"?["bottom","top"]:["top","bottom"],[c,p]=[a,s],[u,C]=[i,r],E=0;if(this.triggersSubmenu()){if(C=i=t.xPosition==="before"?"start":"end",r=u=i==="end"?"start":"end",this._parentMaterialMenu){if(this._parentInnerPadding==null){let D=this._parentMaterialMenu.items.first;this._parentInnerPadding=D?D._getHostElement().offsetTop:0}E=a==="bottom"?this._parentInnerPadding:-this._parentInnerPadding}}else t.overlapTrigger||(c=a==="top"?"bottom":"top",p=s==="top"?"bottom":"top");e.withPositions([{originX:i,originY:c,overlayX:u,overlayY:a,offsetY:E},{originX:r,originY:c,overlayX:C,overlayY:a,offsetY:E},{originX:i,originY:p,overlayX:u,overlayY:s,offsetY:-E},{originX:r,originY:p,overlayX:C,overlayY:s,offsetY:-E}])}_menuClosingActions(){let t=this._overlayRef.backdropClick(),e=this._overlayRef.detachments(),i=this._parentMaterialMenu?this._parentMaterialMenu.closed:se(),r=this._parentMaterialMenu?this._parentMaterialMenu._hovered().pipe(Ne(a=>this._menuOpen&&a!==this._menuItemInstance)):se();return oo(t,i,r,e)}_handleMousedown(t){pd(t)||(this._openedBy=t.button===0?"mouse":void 0,this.triggersSubmenu()&&t.preventDefault())}_handleKeydown(t){let e=t.keyCode;(e===13||e===32)&&(this._openedBy="keyboard"),this.triggersSubmenu()&&(e===39&&this.dir==="ltr"||e===37&&this.dir==="rtl")&&(this._openedBy="keyboard",this.openMenu())}_handleClick(t){this.triggersSubmenu()?(t.stopPropagation(),this.openMenu()):this.toggleMenu()}_handleHover(){this.triggersSubmenu()&&this._parentMaterialMenu&&(this._hoverSubscription=this._parentMaterialMenu._hovered().subscribe(t=>{t===this._menuItemInstance&&!t.disabled&&(this._openedBy="mouse",this.openMenu())}))}_getPortal(t){return(!this._portal||this._portal.templateRef!==t.templateRef)&&(this._portal=new ja(t.templateRef,this._viewContainerRef)),this._portal}_ownsMenu(t){return aS.get(t)===this}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Bt({type:n,selectors:[["","mat-menu-trigger-for",""],["","matMenuTriggerFor",""]],hostAttrs:[1,"mat-mdc-menu-trigger"],hostVars:3,hostBindings:function(e,i){e&1&&G("click",function(a){return i._handleClick(a)})("mousedown",function(a){return i._handleMousedown(a)})("keydown",function(a){return i._handleKeydown(a)}),e&2&&x("aria-haspopup",i.menu?"menu":null)("aria-expanded",i.menuOpen)("aria-controls",i.menuOpen?i.menu.panelId:null)},inputs:{_deprecatedMatMenuTriggerFor:[0,"mat-menu-trigger-for","_deprecatedMatMenuTriggerFor"],menu:[0,"matMenuTriggerFor","menu"],menuData:[0,"matMenuTriggerData","menuData"],restoreFocus:[0,"matMenuTriggerRestoreFocus","restoreFocus"]},outputs:{menuOpened:"menuOpened",onMenuOpen:"onMenuOpen",menuClosed:"menuClosed",onMenuClose:"onMenuClose"},exportAs:["matMenuTrigger"]})}return n})(),Jne=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[$5e],imports:[nv,Po,Ls,Zl,Po]})}return n})(),eie={transformMenu:{type:7,name:"transformMenu",definitions:[{type:0,name:"void",styles:{type:6,styles:{opacity:0,transform:"scale(0.8)"},offset:null}},{type:1,expr:"void => enter",animation:{type:4,styles:{type:6,styles:{opacity:1,transform:"scale(1)"},offset:null},timings:"120ms cubic-bezier(0, 0, 0.2, 1)"},options:null},{type:1,expr:"* => void",animation:{type:4,styles:{type:6,styles:{opacity:0},offset:null},timings:"100ms 25ms linear"},options:null}],options:{}},fadeInItems:{type:7,name:"fadeInItems",definitions:[{type:0,name:"showing",styles:{type:6,styles:{opacity:1},offset:null}},{type:1,expr:"void => *",animation:[{type:6,styles:{opacity:0},offset:null},{type:4,styles:null,timings:"400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)"}],options:null}],options:{}}},K0n=eie.fadeInItems,Z0n=eie.transformMenu;var rV=20;var tie=new at("mat-tooltip-scroll-strategy",{providedIn:"root",factory:()=>{let n=Se(Bi);return()=>n.scrollStrategies.reposition({scrollThrottle:rV})}});function nie(n){return()=>n.scrollStrategies.reposition({scrollThrottle:rV})}var iie={provide:tie,deps:[Bi],useFactory:nie};var aV=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:[iie],imports:[qy,Ls,Po,Po,Zl]})}return n})();var kn=function(n){return n[n.State=0]="State",n[n.Transition=1]="Transition",n[n.Sequence=2]="Sequence",n[n.Group=3]="Group",n[n.Animate=4]="Animate",n[n.Keyframes=5]="Keyframes",n[n.Style=6]="Style",n[n.Trigger=7]="Trigger",n[n.Reference=8]="Reference",n[n.AnimateChild=9]="AnimateChild",n[n.AnimateRef=10]="AnimateRef",n[n.Query=11]="Query",n[n.Stagger=12]="Stagger",n}(kn||{}),Cl="*";function sV(n,o){return{type:kn.Trigger,name:n,definitions:o,options:{}}}function B5(n,o=null){return{type:kn.Animate,styles:o,timings:n}}function oie(n,o=null){return{type:kn.Sequence,steps:n,options:o}}function mm(n){return{type:kn.Style,styles:n,offset:null}}function V5(n,o,t){return{type:kn.State,name:n,styles:o,options:t}}function U5(n,o,t=null){return{type:kn.Transition,expr:n,animation:o,options:t}}var cm=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(o=0,t=0){this.totalTime=o+t}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(o=>o()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(o){this._position=this.totalTime?o*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(o){let t=o=="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},wu=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(o){this.players=o;let t=0,e=0,i=0,r=this.players.length;r==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(a=>{a.onDone(()=>{++t==r&&this._onFinish()}),a.onDestroy(()=>{++e==r&&this._onDestroy()}),a.onStart(()=>{++i==r&&this._onStart()})}),this.totalTime=this.players.reduce((a,s)=>Math.max(a,s.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this.players.forEach(o=>o.init())}onStart(o){this._onStartFns.push(o)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(o=>o()),this._onStartFns=[])}onDone(o){this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(o=>o.play())}pause(){this.players.forEach(o=>o.pause())}restart(){this.players.forEach(o=>o.restart())}finish(){this._onFinish(),this.players.forEach(o=>o.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(o=>o.destroy()),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this.players.forEach(o=>o.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(o){let t=o*this.totalTime;this.players.forEach(e=>{let i=e.totalTime?Math.min(1,t/e.totalTime):1;e.setPosition(i)})}getPosition(){let o=this.players.reduce((t,e)=>t===null||e.totalTime>t.totalTime?e:t,null);return o!=null?o.getPosition():0}beforeDestroy(){this.players.forEach(o=>{o.beforeDestroy&&o.beforeDestroy()})}triggerCallback(o){let t=o=="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},iv="!";function rie(n){return new yt(3e3,!1)}function z5e(){return new yt(3100,!1)}function G5e(){return new yt(3101,!1)}function W5e(n){return new yt(3001,!1)}function q5e(n){return new yt(3003,!1)}function Y5e(n){return new yt(3004,!1)}function sie(n,o){return new yt(3005,!1)}function lie(){return new yt(3006,!1)}function cie(){return new yt(3007,!1)}function mie(n,o){return new yt(3008,!1)}function die(n){return new yt(3002,!1)}function pie(n,o,t,e,i){return new yt(3010,!1)}function gie(){return new yt(3011,!1)}function uie(){return new yt(3012,!1)}function hie(){return new yt(3200,!1)}function fie(){return new yt(3202,!1)}function vie(){return new yt(3013,!1)}function Cie(n){return new yt(3014,!1)}function _ie(n){return new yt(3015,!1)}function yie(n){return new yt(3016,!1)}function Sie(n,o){return new yt(3404,!1)}function K5e(n){return new yt(3502,!1)}function bie(n){return new yt(3503,!1)}function Iie(){return new yt(3300,!1)}function Eie(n){return new yt(3504,!1)}function xie(n){return new yt(3301,!1)}function Tie(n,o){return new yt(3302,!1)}function Die(n){return new yt(3303,!1)}function wie(n,o){return new yt(3400,!1)}function Oie(n){return new yt(3401,!1)}function Aie(n){return new yt(3402,!1)}function Pie(n,o){return new yt(3505,!1)}function Ed(n){switch(n.length){case 0:return new cm;case 1:return n[0];default:return new wu(n)}}function dV(n,o,t=new Map,e=new Map){let i=[],r=[],a=-1,s=null;if(o.forEach(c=>{let p=c.get("offset"),u=p==a,C=u&&s||new Map;c.forEach((E,D)=>{let L=D,$=E;if(D!=="offset")switch(L=n.normalizePropertyName(L,i),$){case iv:$=t.get(D);break;case Cl:$=e.get(D);break;default:$=n.normalizeStyleValue(D,L,$,i);break}C.set(L,$)}),u||r.push(C),s=C,a=p}),i.length)throw K5e(i);return r}function j5(n,o,t,e){switch(o){case"start":n.onStart(()=>e(t&&lV(t,"start",n)));break;case"done":n.onDone(()=>e(t&&lV(t,"done",n)));break;case"destroy":n.onDestroy(()=>e(t&&lV(t,"destroy",n)));break}}function lV(n,o,t){let e=t.totalTime,i=!!t.disabled,r=$5(n.element,n.triggerName,n.fromState,n.toState,o||n.phaseName,e??n.totalTime,i),a=n._data;return a!=null&&(r._data=a),r}function $5(n,o,t,e,i="",r=0,a){return{element:n,triggerName:o,fromState:t,toState:e,phaseName:i,totalTime:r,disabled:!!a}}function ys(n,o,t){let e=n.get(o);return e||n.set(o,e=t),e}function pV(n){let o=n.indexOf(":"),t=n.substring(1,o),e=n.slice(o+1);return[t,e]}var Z5e=typeof document>"u"?null:document.documentElement;function H5(n){let o=n.parentNode||n.host||null;return o===Z5e?null:o}function X5e(n){return n.substring(1,6)=="ebkit"}var Ou=null,aie=!1;function Mie(n){Ou||(Ou=Q5e()||{},aie=Ou.style?"WebkitAppearance"in Ou.style:!1);let o=!0;return Ou.style&&!X5e(n)&&(o=n in Ou.style,!o&&aie&&(o="Webkit"+n.charAt(0).toUpperCase()+n.slice(1)in Ou.style)),o}function Q5e(){return typeof document<"u"?document.body:null}function gV(n,o){for(;o;){if(o===n)return!0;o=H5(o)}return!1}function uV(n,o,t){if(t)return Array.from(n.querySelectorAll(o));let e=n.querySelector(o);return e?[e]:[]}var J5e=1e3,hV="{{",e6e="}}",fV="ng-enter",z5="ng-leave",lS="ng-trigger",cS=".ng-trigger",vV="ng-animating",G5=".ng-animating";function dm(n){if(typeof n=="number")return n;let o=n.match(/^(-?[\.\d]+)(m?s)/);return!o||o.length<2?0:cV(parseFloat(o[1]),o[2])}function cV(n,o){switch(o){case"s":return n*J5e;default:return n}}function mS(n,o,t){return n.hasOwnProperty("duration")?n:t6e(n,o,t)}function t6e(n,o,t){let e=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,i,r=0,a="";if(typeof n=="string"){let s=n.match(e);if(s===null)return o.push(rie(n)),{duration:0,delay:0,easing:""};i=cV(parseFloat(s[1]),s[2]);let c=s[3];c!=null&&(r=cV(parseFloat(c),s[4]));let p=s[5];p&&(a=p)}else i=n;if(!t){let s=!1,c=o.length;i<0&&(o.push(z5e()),s=!0),r<0&&(o.push(G5e()),s=!0),s&&o.splice(c,0,rie(n))}return{duration:i,delay:r,easing:a}}function kie(n){return n.length?n[0]instanceof Map?n:n.map(o=>new Map(Object.entries(o))):[]}function lc(n,o,t){o.forEach((e,i)=>{let r=W5(i);t&&!t.has(i)&&t.set(i,n.style[r]),n.style[r]=e})}function Dp(n,o){o.forEach((t,e)=>{let i=W5(e);n.style[i]=""})}function ov(n){return Array.isArray(n)?n.length==1?n[0]:oie(n):n}function Rie(n,o,t){let e=o.params||{},i=CV(n);i.length&&i.forEach(r=>{e.hasOwnProperty(r)||t.push(W5e(r))})}var mV=new RegExp(`${hV}\\s*(.+?)\\s*${e6e}`,"g");function CV(n){let o=[];if(typeof n=="string"){let t;for(;t=mV.exec(n);)o.push(t[1]);mV.lastIndex=0}return o}function rv(n,o,t){let e=`${n}`,i=e.replace(mV,(r,a)=>{let s=o[a];return s==null&&(t.push(q5e(a)),s=""),s.toString()});return i==e?n:i}var n6e=/-+([a-z0-9])/g;function W5(n){return n.replace(n6e,(...o)=>o[1].toUpperCase())}function Nie(n,o){return n===0||o===0}function Fie(n,o,t){if(t.size&&o.length){let e=o[0],i=[];if(t.forEach((r,a)=>{e.has(a)||i.push(a),e.set(a,r)}),i.length)for(let r=1;r<o.length;r++){let a=o[r];i.forEach(s=>a.set(s,q5(n,s)))}}return o}function Ss(n,o,t){switch(o.type){case kn.Trigger:return n.visitTrigger(o,t);case kn.State:return n.visitState(o,t);case kn.Transition:return n.visitTransition(o,t);case kn.Sequence:return n.visitSequence(o,t);case kn.Group:return n.visitGroup(o,t);case kn.Animate:return n.visitAnimate(o,t);case kn.Keyframes:return n.visitKeyframes(o,t);case kn.Style:return n.visitStyle(o,t);case kn.Reference:return n.visitReference(o,t);case kn.AnimateChild:return n.visitAnimateChild(o,t);case kn.AnimateRef:return n.visitAnimateRef(o,t);case kn.Query:return n.visitQuery(o,t);case kn.Stagger:return n.visitStagger(o,t);default:throw Y5e(o.type)}}function q5(n,o){return window.getComputedStyle(n)[o]}var NV=(()=>{class n{validateStyleProperty(t){return Mie(t)}containsElement(t,e){return gV(t,e)}getParentElement(t){return H5(t)}query(t,e,i){return uV(t,e,i)}computeStyle(t,e,i){return i||""}animate(t,e,i,r,a,s=[],c){return new cm(i,r)}static \u0275fac=function(e){return new(e||n)};static \u0275prov=Pe({token:n,factory:n.\u0275fac})}return n})(),Pu=class{static NOOP=new NV},Mu=class{};var i6e=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),Q5=class extends Mu{normalizePropertyName(o,t){return W5(o)}normalizeStyleValue(o,t,e,i){let r="",a=e.toString().trim();if(i6e.has(t)&&e!==0&&e!=="0")if(typeof e=="number")r="px";else{let s=e.match(/^[+-]?[\d\.]+([a-z]*)$/);s&&s[1].length==0&&i.push(sie(o,e))}return a+r}};var J5="*";function o6e(n,o){let t=[];return typeof n=="string"?n.split(/\s*,\s*/).forEach(e=>r6e(e,t,o)):t.push(n),t}function r6e(n,o,t){if(n[0]==":"){let c=a6e(n,t);if(typeof c=="function"){o.push(c);return}n=c}let e=n.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(e==null||e.length<4)return t.push(_ie(n)),o;let i=e[1],r=e[2],a=e[3];o.push(Lie(i,a));let s=i==J5&&a==J5;r[0]=="<"&&!s&&o.push(Lie(a,i))}function a6e(n,o){switch(n){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(t,e)=>parseFloat(e)>parseFloat(t);case":decrement":return(t,e)=>parseFloat(e)<parseFloat(t);default:return o.push(yie(n)),"* => *"}}var Y5=new Set(["true","1"]),K5=new Set(["false","0"]);function Lie(n,o){let t=Y5.has(n)||K5.has(n),e=Y5.has(o)||K5.has(o);return(i,r)=>{let a=n==J5||n==i,s=o==J5||o==r;return!a&&t&&typeof i=="boolean"&&(a=i?Y5.has(n):K5.has(n)),!s&&e&&typeof r=="boolean"&&(s=r?Y5.has(o):K5.has(o)),a&&s}}var qie=":self",s6e=new RegExp(`s*${qie}s*,?`,"g");function Yie(n,o,t,e){return new EV(n).build(o,t,e)}var Bie="",EV=class{_driver;constructor(o){this._driver=o}build(o,t,e){let i=new xV(t);return this._resetContextStyleTimingState(i),Ss(this,ov(o),i)}_resetContextStyleTimingState(o){o.currentQuerySelector=Bie,o.collectedStyles=new Map,o.collectedStyles.set(Bie,new Map),o.currentTime=0}visitTrigger(o,t){let e=t.queryCount=0,i=t.depCount=0,r=[],a=[];return o.name.charAt(0)=="@"&&t.errors.push(lie()),o.definitions.forEach(s=>{if(this._resetContextStyleTimingState(t),s.type==kn.State){let c=s,p=c.name;p.toString().split(/\s*,\s*/).forEach(u=>{c.name=u,r.push(this.visitState(c,t))}),c.name=p}else if(s.type==kn.Transition){let c=this.visitTransition(s,t);e+=c.queryCount,i+=c.depCount,a.push(c)}else t.errors.push(cie())}),{type:kn.Trigger,name:o.name,states:r,transitions:a,queryCount:e,depCount:i,options:null}}visitState(o,t){let e=this.visitStyle(o.styles,t),i=o.options&&o.options.params||null;if(e.containsDynamicStyles){let r=new Set,a=i||{};e.styles.forEach(s=>{s instanceof Map&&s.forEach(c=>{CV(c).forEach(p=>{a.hasOwnProperty(p)||r.add(p)})})}),r.size&&t.errors.push(mie(o.name,[...r.values()]))}return{type:kn.State,name:o.name,style:e,options:i?{params:i}:null}}visitTransition(o,t){t.queryCount=0,t.depCount=0;let e=Ss(this,ov(o.animation),t),i=o6e(o.expr,t.errors);return{type:kn.Transition,matchers:i,animation:e,queryCount:t.queryCount,depCount:t.depCount,options:Au(o.options)}}visitSequence(o,t){return{type:kn.Sequence,steps:o.steps.map(e=>Ss(this,e,t)),options:Au(o.options)}}visitGroup(o,t){let e=t.currentTime,i=0,r=o.steps.map(a=>{t.currentTime=e;let s=Ss(this,a,t);return i=Math.max(i,t.currentTime),s});return t.currentTime=i,{type:kn.Group,steps:r,options:Au(o.options)}}visitAnimate(o,t){let e=d6e(o.timings,t.errors);t.currentAnimateTimings=e;let i,r=o.styles?o.styles:mm({});if(r.type==kn.Keyframes)i=this.visitKeyframes(r,t);else{let a=o.styles,s=!1;if(!a){s=!0;let p={};e.easing&&(p.easing=e.easing),a=mm(p)}t.currentTime+=e.duration+e.delay;let c=this.visitStyle(a,t);c.isEmptyStep=s,i=c}return t.currentAnimateTimings=null,{type:kn.Animate,timings:e,style:i,options:null}}visitStyle(o,t){let e=this._makeStyleAst(o,t);return this._validateStyleAst(e,t),e}_makeStyleAst(o,t){let e=[],i=Array.isArray(o.styles)?o.styles:[o.styles];for(let s of i)typeof s=="string"?s===Cl?e.push(s):t.errors.push(die(s)):e.push(new Map(Object.entries(s)));let r=!1,a=null;return e.forEach(s=>{if(s instanceof Map&&(s.has("easing")&&(a=s.get("easing"),s.delete("easing")),!r)){for(let c of s.values())if(c.toString().indexOf(hV)>=0){r=!0;break}}}),{type:kn.Style,styles:e,easing:a,offset:o.offset,containsDynamicStyles:r,options:null}}_validateStyleAst(o,t){let e=t.currentAnimateTimings,i=t.currentTime,r=t.currentTime;e&&r>0&&(r-=e.duration+e.delay),o.styles.forEach(a=>{typeof a!="string"&&a.forEach((s,c)=>{let p=t.collectedStyles.get(t.currentQuerySelector),u=p.get(c),C=!0;u&&(r!=i&&r>=u.startTime&&i<=u.endTime&&(t.errors.push(pie(c,u.startTime,u.endTime,r,i)),C=!1),r=u.startTime),C&&p.set(c,{startTime:r,endTime:i}),t.options&&Rie(s,t.options,t.errors)})})}visitKeyframes(o,t){let e={type:kn.Keyframes,styles:[],options:null};if(!t.currentAnimateTimings)return t.errors.push(gie()),e;let i=1,r=0,a=[],s=!1,c=!1,p=0,u=o.steps.map(ce=>{let Ce=this._makeStyleAst(ce,t),Ie=Ce.offset!=null?Ce.offset:m6e(Ce.styles),$e=0;return Ie!=null&&(r++,$e=Ce.offset=Ie),c=c||$e<0||$e>1,s=s||$e<p,p=$e,a.push($e),Ce});c&&t.errors.push(uie()),s&&t.errors.push(hie());let C=o.steps.length,E=0;r>0&&r<C?t.errors.push(fie()):r==0&&(E=i/(C-1));let D=C-1,L=t.currentTime,$=t.currentAnimateTimings,Y=$.duration;return u.forEach((ce,Ce)=>{let Ie=E>0?Ce==D?1:E*Ce:a[Ce],$e=Ie*Y;t.currentTime=L+$.delay+$e,$.duration=$e,this._validateStyleAst(ce,t),ce.offset=Ie,e.styles.push(ce)}),e}visitReference(o,t){return{type:kn.Reference,animation:Ss(this,ov(o.animation),t),options:Au(o.options)}}visitAnimateChild(o,t){return t.depCount++,{type:kn.AnimateChild,options:Au(o.options)}}visitAnimateRef(o,t){return{type:kn.AnimateRef,animation:this.visitReference(o.animation,t),options:Au(o.options)}}visitQuery(o,t){let e=t.currentQuerySelector,i=o.options||{};t.queryCount++,t.currentQuery=o;let[r,a]=l6e(o.selector);t.currentQuerySelector=e.length?e+" "+r:r,ys(t.collectedStyles,t.currentQuerySelector,new Map);let s=Ss(this,ov(o.animation),t);return t.currentQuery=null,t.currentQuerySelector=e,{type:kn.Query,selector:r,limit:i.limit||0,optional:!!i.optional,includeSelf:a,animation:s,originalSelector:o.selector,options:Au(o.options)}}visitStagger(o,t){t.currentQuery||t.errors.push(vie());let e=o.timings==="full"?{duration:0,delay:0,easing:"full"}:mS(o.timings,t.errors,!0);return{type:kn.Stagger,animation:Ss(this,ov(o.animation),t),timings:e,options:null}}};function l6e(n){let o=!!n.split(/\s*,\s*/).find(t=>t==qie);return o&&(n=n.replace(s6e,"")),n=n.replace(/@\*/g,cS).replace(/@\w+/g,t=>cS+"-"+t.slice(1)).replace(/:animating/g,G5),[n,o]}function c6e(n){return n?I({},n):null}var xV=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(o){this.errors=o}};function m6e(n){if(typeof n=="string")return null;let o=null;if(Array.isArray(n))n.forEach(t=>{if(t instanceof Map&&t.has("offset")){let e=t;o=parseFloat(e.get("offset")),e.delete("offset")}});else if(n instanceof Map&&n.has("offset")){let t=n;o=parseFloat(t.get("offset")),t.delete("offset")}return o}function d6e(n,o){if(n.hasOwnProperty("duration"))return n;if(typeof n=="number"){let r=mS(n,o).duration;return _V(r,0,"")}let t=n;if(t.split(/\s+/).some(r=>r.charAt(0)=="{"&&r.charAt(1)=="{")){let r=_V(0,0,"");return r.dynamic=!0,r.strValue=t,r}let i=mS(t,o);return _V(i.duration,i.delay,i.easing)}function Au(n){return n?(n=I({},n),n.params&&(n.params=c6e(n.params))):n={},n}function _V(n,o,t){return{duration:n,delay:o,easing:t}}function FV(n,o,t,e,i,r,a=null,s=!1){return{type:1,element:n,keyframes:o,preStyleProps:t,postStyleProps:e,duration:i,delay:r,totalTime:i+r,easing:a,subTimeline:s}}var pS=class{_map=new Map;get(o){return this._map.get(o)||[]}append(o,t){let e=this._map.get(o);e||this._map.set(o,e=[]),e.push(...t)}has(o){return this._map.has(o)}clear(){this._map.clear()}},p6e=1,g6e=":enter",u6e=new RegExp(g6e,"g"),h6e=":leave",f6e=new RegExp(h6e,"g");function Kie(n,o,t,e,i,r=new Map,a=new Map,s,c,p=[]){return new TV().buildKeyframes(n,o,t,e,i,r,a,s,c,p)}var TV=class{buildKeyframes(o,t,e,i,r,a,s,c,p,u=[]){p=p||new pS;let C=new DV(o,t,p,i,r,u,[]);C.options=c;let E=c.delay?dm(c.delay):0;C.currentTimeline.delayNextStep(E),C.currentTimeline.setStyles([a],null,C.errors,c),Ss(this,e,C);let D=C.timelines.filter(L=>L.containsAnimation());if(D.length&&s.size){let L;for(let $=D.length-1;$>=0;$--){let Y=D[$];if(Y.element===t){L=Y;break}}L&&!L.allowOnlyTimelineStyles()&&L.setStyles([s],null,C.errors,c)}return D.length?D.map(L=>L.buildKeyframes()):[FV(t,[],[],[],0,E,"",!1)]}visitTrigger(o,t){}visitState(o,t){}visitTransition(o,t){}visitAnimateChild(o,t){let e=t.subInstructions.get(t.element);if(e){let i=t.createSubContext(o.options),r=t.currentTimeline.currentTime,a=this._visitSubInstructions(e,i,i.options);r!=a&&t.transformIntoNewTimeline(a)}t.previousNode=o}visitAnimateRef(o,t){let e=t.createSubContext(o.options);e.transformIntoNewTimeline(),this._applyAnimationRefDelays([o.options,o.animation.options],t,e),this.visitReference(o.animation,e),t.transformIntoNewTimeline(e.currentTimeline.currentTime),t.previousNode=o}_applyAnimationRefDelays(o,t,e){for(let i of o){let r=i?.delay;if(r){let a=typeof r=="number"?r:dm(rv(r,i?.params??{},t.errors));e.delayNextStep(a)}}}_visitSubInstructions(o,t,e){let r=t.currentTimeline.currentTime,a=e.duration!=null?dm(e.duration):null,s=e.delay!=null?dm(e.delay):null;return a!==0&&o.forEach(c=>{let p=t.appendInstructionToTimeline(c,a,s);r=Math.max(r,p.duration+p.delay)}),r}visitReference(o,t){t.updateOptions(o.options,!0),Ss(this,o.animation,t),t.previousNode=o}visitSequence(o,t){let e=t.subContextCount,i=t,r=o.options;if(r&&(r.params||r.delay)&&(i=t.createSubContext(r),i.transformIntoNewTimeline(),r.delay!=null)){i.previousNode.type==kn.Style&&(i.currentTimeline.snapshotCurrentStyles(),i.previousNode=e6);let a=dm(r.delay);i.delayNextStep(a)}o.steps.length&&(o.steps.forEach(a=>Ss(this,a,i)),i.currentTimeline.applyStylesToKeyframe(),i.subContextCount>e&&i.transformIntoNewTimeline()),t.previousNode=o}visitGroup(o,t){let e=[],i=t.currentTimeline.currentTime,r=o.options&&o.options.delay?dm(o.options.delay):0;o.steps.forEach(a=>{let s=t.createSubContext(o.options);r&&s.delayNextStep(r),Ss(this,a,s),i=Math.max(i,s.currentTimeline.currentTime),e.push(s.currentTimeline)}),e.forEach(a=>t.currentTimeline.mergeTimelineCollectedStyles(a)),t.transformIntoNewTimeline(i),t.previousNode=o}_visitTiming(o,t){if(o.dynamic){let e=o.strValue,i=t.params?rv(e,t.params,t.errors):e;return mS(i,t.errors)}else return{duration:o.duration,delay:o.delay,easing:o.easing}}visitAnimate(o,t){let e=t.currentAnimateTimings=this._visitTiming(o.timings,t),i=t.currentTimeline;e.delay&&(t.incrementTime(e.delay),i.snapshotCurrentStyles());let r=o.style;r.type==kn.Keyframes?this.visitKeyframes(r,t):(t.incrementTime(e.duration),this.visitStyle(r,t),i.applyStylesToKeyframe()),t.currentAnimateTimings=null,t.previousNode=o}visitStyle(o,t){let e=t.currentTimeline,i=t.currentAnimateTimings;!i&&e.hasCurrentStyleProperties()&&e.forwardFrame();let r=i&&i.easing||o.easing;o.isEmptyStep?e.applyEmptyStep(r):e.setStyles(o.styles,r,t.errors,t.options),t.previousNode=o}visitKeyframes(o,t){let e=t.currentAnimateTimings,i=t.currentTimeline.duration,r=e.duration,s=t.createSubContext().currentTimeline;s.easing=e.easing,o.styles.forEach(c=>{let p=c.offset||0;s.forwardTime(p*r),s.setStyles(c.styles,c.easing,t.errors,t.options),s.applyStylesToKeyframe()}),t.currentTimeline.mergeTimelineCollectedStyles(s),t.transformIntoNewTimeline(i+r),t.previousNode=o}visitQuery(o,t){let e=t.currentTimeline.currentTime,i=o.options||{},r=i.delay?dm(i.delay):0;r&&(t.previousNode.type===kn.Style||e==0&&t.currentTimeline.hasCurrentStyleProperties())&&(t.currentTimeline.snapshotCurrentStyles(),t.previousNode=e6);let a=e,s=t.invokeQuery(o.selector,o.originalSelector,o.limit,o.includeSelf,!!i.optional,t.errors);t.currentQueryTotal=s.length;let c=null;s.forEach((p,u)=>{t.currentQueryIndex=u;let C=t.createSubContext(o.options,p);r&&C.delayNextStep(r),p===t.element&&(c=C.currentTimeline),Ss(this,o.animation,C),C.currentTimeline.applyStylesToKeyframe();let E=C.currentTimeline.currentTime;a=Math.max(a,E)}),t.currentQueryIndex=0,t.currentQueryTotal=0,t.transformIntoNewTimeline(a),c&&(t.currentTimeline.mergeTimelineCollectedStyles(c),t.currentTimeline.snapshotCurrentStyles()),t.previousNode=o}visitStagger(o,t){let e=t.parentContext,i=t.currentTimeline,r=o.timings,a=Math.abs(r.duration),s=a*(t.currentQueryTotal-1),c=a*t.currentQueryIndex;switch(r.duration<0?"reverse":r.easing){case"reverse":c=s-c;break;case"full":c=e.currentStaggerTime;break}let u=t.currentTimeline;c&&u.delayNextStep(c);let C=u.currentTime;Ss(this,o.animation,t),t.previousNode=o,e.currentStaggerTime=i.currentTime-C+(i.startTime-e.currentTimeline.startTime)}},e6={},DV=class n{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=e6;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(o,t,e,i,r,a,s,c){this._driver=o,this.element=t,this.subInstructions=e,this._enterClassName=i,this._leaveClassName=r,this.errors=a,this.timelines=s,this.currentTimeline=c||new t6(this._driver,t,0),s.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(o,t){if(!o)return;let e=o,i=this.options;e.duration!=null&&(i.duration=dm(e.duration)),e.delay!=null&&(i.delay=dm(e.delay));let r=e.params;if(r){let a=i.params;a||(a=this.options.params={}),Object.keys(r).forEach(s=>{(!t||!a.hasOwnProperty(s))&&(a[s]=rv(r[s],a,this.errors))})}}_copyOptions(){let o={};if(this.options){let t=this.options.params;if(t){let e=o.params={};Object.keys(t).forEach(i=>{e[i]=t[i]})}}return o}createSubContext(o=null,t,e){let i=t||this.element,r=new n(this._driver,i,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(i,e||0));return r.previousNode=this.previousNode,r.currentAnimateTimings=this.currentAnimateTimings,r.options=this._copyOptions(),r.updateOptions(o),r.currentQueryIndex=this.currentQueryIndex,r.currentQueryTotal=this.currentQueryTotal,r.parentContext=this,this.subContextCount++,r}transformIntoNewTimeline(o){return this.previousNode=e6,this.currentTimeline=this.currentTimeline.fork(this.element,o),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(o,t,e){let i={duration:t??o.duration,delay:this.currentTimeline.currentTime+(e??0)+o.delay,easing:""},r=new wV(this._driver,o.element,o.keyframes,o.preStyleProps,o.postStyleProps,i,o.stretchStartingKeyframe);return this.timelines.push(r),i}incrementTime(o){this.currentTimeline.forwardTime(this.currentTimeline.duration+o)}delayNextStep(o){o>0&&this.currentTimeline.delayNextStep(o)}invokeQuery(o,t,e,i,r,a){let s=[];if(i&&s.push(this.element),o.length>0){o=o.replace(u6e,"."+this._enterClassName),o=o.replace(f6e,"."+this._leaveClassName);let c=e!=1,p=this._driver.query(this.element,o,c);e!==0&&(p=e<0?p.slice(p.length+e,p.length):p.slice(0,e)),s.push(...p)}return!r&&s.length==0&&a.push(Cie(t)),s}},t6=class n{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(o,t,e,i){this._driver=o,this.element=t,this.startTime=e,this._elementTimelineStylesLookup=i,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(t),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(t,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(o){let t=this._keyframes.size===1&&this._pendingStyles.size;this.duration||t?(this.forwardTime(this.currentTime+o),t&&this.snapshotCurrentStyles()):this.startTime+=o}fork(o,t){return this.applyStylesToKeyframe(),new n(this._driver,o,t||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=p6e,this._loadKeyframe()}forwardTime(o){this.applyStylesToKeyframe(),this.duration=o,this._loadKeyframe()}_updateStyle(o,t){this._localTimelineStyles.set(o,t),this._globalTimelineStyles.set(o,t),this._styleSummary.set(o,{time:this.currentTime,value:t})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(o){o&&this._previousKeyframe.set("easing",o);for(let[t,e]of this._globalTimelineStyles)this._backFill.set(t,e||Cl),this._currentKeyframe.set(t,Cl);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(o,t,e,i){t&&this._previousKeyframe.set("easing",t);let r=i&&i.params||{},a=v6e(o,this._globalTimelineStyles);for(let[s,c]of a){let p=rv(c,r,e);this._pendingStyles.set(s,p),this._localTimelineStyles.has(s)||this._backFill.set(s,this._globalTimelineStyles.get(s)??Cl),this._updateStyle(s,p)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((o,t)=>{this._currentKeyframe.set(t,o)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((o,t)=>{this._currentKeyframe.has(t)||this._currentKeyframe.set(t,o)}))}snapshotCurrentStyles(){for(let[o,t]of this._localTimelineStyles)this._pendingStyles.set(o,t),this._updateStyle(o,t)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let o=[];for(let t in this._currentKeyframe)o.push(t);return o}mergeTimelineCollectedStyles(o){o._styleSummary.forEach((t,e)=>{let i=this._styleSummary.get(e);(!i||t.time>i.time)&&this._updateStyle(e,t.value)})}buildKeyframes(){this.applyStylesToKeyframe();let o=new Set,t=new Set,e=this._keyframes.size===1&&this.duration===0,i=[];this._keyframes.forEach((s,c)=>{let p=new Map([...this._backFill,...s]);p.forEach((u,C)=>{u===iv?o.add(C):u===Cl&&t.add(C)}),e||p.set("offset",c/this.duration),i.push(p)});let r=[...o.values()],a=[...t.values()];if(e){let s=i[0],c=new Map(s);s.set("offset",0),c.set("offset",1),i=[s,c]}return FV(this.element,i,r,a,this.duration,this.startTime,this.easing,!1)}},wV=class extends t6{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(o,t,e,i,r,a,s=!1){super(o,t,a.delay),this.keyframes=e,this.preStyleProps=i,this.postStyleProps=r,this._stretchStartingKeyframe=s,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let o=this.keyframes,{delay:t,duration:e,easing:i}=this.timings;if(this._stretchStartingKeyframe&&t){let r=[],a=e+t,s=t/a,c=new Map(o[0]);c.set("offset",0),r.push(c);let p=new Map(o[0]);p.set("offset",Vie(s)),r.push(p);let u=o.length-1;for(let C=1;C<=u;C++){let E=new Map(o[C]),D=E.get("offset"),L=t+D*e;E.set("offset",Vie(L/a)),r.push(E)}e=a,t=0,i="",o=r}return FV(this.element,o,this.preStyleProps,this.postStyleProps,e,t,i,!0)}};function Vie(n,o=3){let t=Math.pow(10,o-1);return Math.round(n*t)/t}function v6e(n,o){let t=new Map,e;return n.forEach(i=>{if(i==="*"){e??=o.keys();for(let r of e)t.set(r,Cl)}else for(let[r,a]of i)t.set(r,a)}),t}function Uie(n,o,t,e,i,r,a,s,c,p,u,C,E){return{type:0,element:n,triggerName:o,isRemovalTransition:i,fromState:t,fromStyles:r,toState:e,toStyles:a,timelines:s,queriedElements:c,preStyleProps:p,postStyleProps:u,totalTime:C,errors:E}}var yV={},n6=class{_triggerName;ast;_stateStyles;constructor(o,t,e){this._triggerName=o,this.ast=t,this._stateStyles=e}match(o,t,e,i){return C6e(this.ast.matchers,o,t,e,i)}buildStyles(o,t,e){let i=this._stateStyles.get("*");return o!==void 0&&(i=this._stateStyles.get(o?.toString())||i),i?i.buildStyles(t,e):new Map}build(o,t,e,i,r,a,s,c,p,u){let C=[],E=this.ast.options&&this.ast.options.params||yV,D=s&&s.params||yV,L=this.buildStyles(e,D,C),$=c&&c.params||yV,Y=this.buildStyles(i,$,C),ce=new Set,Ce=new Map,Ie=new Map,$e=i==="void",Ye={params:Zie($,E),delay:this.ast.options?.delay},Re=u?[]:Kie(o,t,this.ast.animation,r,a,L,Y,Ye,p,C),_e=0;return Re.forEach(Ee=>{_e=Math.max(Ee.duration+Ee.delay,_e)}),C.length?Uie(t,this._triggerName,e,i,$e,L,Y,[],[],Ce,Ie,_e,C):(Re.forEach(Ee=>{let Oe=Ee.element,ye=ys(Ce,Oe,new Set);Ee.preStyleProps.forEach(Le=>ye.add(Le));let he=ys(Ie,Oe,new Set);Ee.postStyleProps.forEach(Le=>he.add(Le)),Oe!==t&&ce.add(Oe)}),Uie(t,this._triggerName,e,i,$e,L,Y,Re,[...ce.values()],Ce,Ie,_e))}};function C6e(n,o,t,e,i){return n.some(r=>r(o,t,e,i))}function Zie(n,o){let t=I({},o);return Object.entries(n).forEach(([e,i])=>{i!=null&&(t[e]=i)}),t}var OV=class{styles;defaultParams;normalizer;constructor(o,t,e){this.styles=o,this.defaultParams=t,this.normalizer=e}buildStyles(o,t){let e=new Map,i=Zie(o,this.defaultParams);return this.styles.styles.forEach(r=>{typeof r!="string"&&r.forEach((a,s)=>{a&&(a=rv(a,i,t));let c=this.normalizer.normalizePropertyName(s,t);a=this.normalizer.normalizeStyleValue(s,c,a,t),e.set(s,a)})}),e}};function _6e(n,o,t){return new AV(n,o,t)}var AV=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(o,t,e){this.name=o,this.ast=t,this._normalizer=e,t.states.forEach(i=>{let r=i.options&&i.options.params||{};this.states.set(i.name,new OV(i.style,r,e))}),jie(this.states,"true","1"),jie(this.states,"false","0"),t.transitions.forEach(i=>{this.transitionFactories.push(new n6(o,i,this.states))}),this.fallbackTransition=y6e(o,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(o,t,e,i){return this.transitionFactories.find(a=>a.match(o,t,e,i))||null}matchStyles(o,t,e){return this.fallbackTransition.buildStyles(o,t,e)}};function y6e(n,o,t){let e=[(a,s)=>!0],i={type:kn.Sequence,steps:[],options:null},r={type:kn.Transition,animation:i,matchers:e,options:null,queryCount:0,depCount:0};return new n6(n,r,o)}function jie(n,o,t){n.has(o)?n.has(t)||n.set(t,n.get(o)):n.has(t)&&n.set(o,n.get(t))}var S6e=new pS,PV=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(o,t,e){this.bodyNode=o,this._driver=t,this._normalizer=e}register(o,t){let e=[],i=[],r=Yie(this._driver,t,e,i);if(e.length)throw bie(e);this._animations.set(o,r)}_buildPlayer(o,t,e){let i=o.element,r=dV(this._normalizer,o.keyframes,t,e);return this._driver.animate(i,r,o.duration,o.delay,o.easing,[],!0)}create(o,t,e={}){let i=[],r=this._animations.get(o),a,s=new Map;if(r?(a=Kie(this._driver,t,r,fV,z5,new Map,new Map,e,S6e,i),a.forEach(u=>{let C=ys(s,u.element,new Map);u.postStyleProps.forEach(E=>C.set(E,null))})):(i.push(Iie()),a=[]),i.length)throw Eie(i);s.forEach((u,C)=>{u.forEach((E,D)=>{u.set(D,this._driver.computeStyle(C,D,Cl))})});let c=a.map(u=>{let C=s.get(u.element);return this._buildPlayer(u,new Map,C)}),p=Ed(c);return this._playersById.set(o,p),p.onDestroy(()=>this.destroy(o)),this.players.push(p),p}destroy(o){let t=this._getPlayer(o);t.destroy(),this._playersById.delete(o);let e=this.players.indexOf(t);e>=0&&this.players.splice(e,1)}_getPlayer(o){let t=this._playersById.get(o);if(!t)throw xie(o);return t}listen(o,t,e,i){let r=$5(t,"","","");return j5(this._getPlayer(o),e,r,i),()=>{}}command(o,t,e,i){if(e=="register"){this.register(o,i[0]);return}if(e=="create"){let a=i[0]||{};this.create(o,t,a);return}let r=this._getPlayer(o);switch(e){case"play":r.play();break;case"pause":r.pause();break;case"reset":r.reset();break;case"restart":r.restart();break;case"finish":r.finish();break;case"init":r.init();break;case"setPosition":r.setPosition(parseFloat(i[0]));break;case"destroy":this.destroy(o);break}}},$ie="ng-animate-queued",b6e=".ng-animate-queued",SV="ng-animate-disabled",I6e=".ng-animate-disabled",E6e="ng-star-inserted",x6e=".ng-star-inserted",T6e=[],Xie={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},D6e={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},cc="__ng_removed",gS=class{namespaceId;value;options;get params(){return this.options.params}constructor(o,t=""){this.namespaceId=t;let e=o&&o.hasOwnProperty("value"),i=e?o.value:o;if(this.value=O6e(i),e){let r=o,{value:a}=r,s=z9(r,["value"]);this.options=s}else this.options={};this.options.params||(this.options.params={})}absorbOptions(o){let t=o.params;if(t){let e=this.options.params;Object.keys(t).forEach(i=>{e[i]==null&&(e[i]=t[i])})}}},dS="void",bV=new gS(dS),MV=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(o,t,e){this.id=o,this.hostElement=t,this._engine=e,this._hostClassName="ng-tns-"+o,_l(t,this._hostClassName)}listen(o,t,e,i){if(!this._triggers.has(t))throw Tie(e,t);if(e==null||e.length==0)throw Die(t);if(!A6e(e))throw wie(e,t);let r=ys(this._elementListeners,o,[]),a={name:t,phase:e,callback:i};r.push(a);let s=ys(this._engine.statesByElement,o,new Map);return s.has(t)||(_l(o,lS),_l(o,lS+"-"+t),s.set(t,bV)),()=>{this._engine.afterFlush(()=>{let c=r.indexOf(a);c>=0&&r.splice(c,1),this._triggers.has(t)||s.delete(t)})}}register(o,t){return this._triggers.has(o)?!1:(this._triggers.set(o,t),!0)}_getTrigger(o){let t=this._triggers.get(o);if(!t)throw Oie(o);return t}trigger(o,t,e,i=!0){let r=this._getTrigger(t),a=new uS(this.id,t,o),s=this._engine.statesByElement.get(o);s||(_l(o,lS),_l(o,lS+"-"+t),this._engine.statesByElement.set(o,s=new Map));let c=s.get(t),p=new gS(e,this.id);if(!(e&&e.hasOwnProperty("value"))&&c&&p.absorbOptions(c.options),s.set(t,p),c||(c=bV),!(p.value===dS)&&c.value===p.value){if(!k6e(c.params,p.params)){let $=[],Y=r.matchStyles(c.value,c.params,$),ce=r.matchStyles(p.value,p.params,$);$.length?this._engine.reportError($):this._engine.afterFlush(()=>{Dp(o,Y),lc(o,ce)})}return}let E=ys(this._engine.playersByElement,o,[]);E.forEach($=>{$.namespaceId==this.id&&$.triggerName==t&&$.queued&&$.destroy()});let D=r.matchTransition(c.value,p.value,o,p.params),L=!1;if(!D){if(!i)return;D=r.fallbackTransition,L=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:t,transition:D,fromState:c,toState:p,player:a,isFallbackTransition:L}),L||(_l(o,$ie),a.onStart(()=>{av(o,$ie)})),a.onDone(()=>{let $=this.players.indexOf(a);$>=0&&this.players.splice($,1);let Y=this._engine.playersByElement.get(o);if(Y){let ce=Y.indexOf(a);ce>=0&&Y.splice(ce,1)}}),this.players.push(a),E.push(a),a}deregister(o){this._triggers.delete(o),this._engine.statesByElement.forEach(t=>t.delete(o)),this._elementListeners.forEach((t,e)=>{this._elementListeners.set(e,t.filter(i=>i.name!=o))})}clearElementCache(o){this._engine.statesByElement.delete(o),this._elementListeners.delete(o);let t=this._engine.playersByElement.get(o);t&&(t.forEach(e=>e.destroy()),this._engine.playersByElement.delete(o))}_signalRemovalForInnerTriggers(o,t){let e=this._engine.driver.query(o,cS,!0);e.forEach(i=>{if(i[cc])return;let r=this._engine.fetchNamespacesByElement(i);r.size?r.forEach(a=>a.triggerLeaveAnimation(i,t,!1,!0)):this.clearElementCache(i)}),this._engine.afterFlushAnimationsDone(()=>e.forEach(i=>this.clearElementCache(i)))}triggerLeaveAnimation(o,t,e,i){let r=this._engine.statesByElement.get(o),a=new Map;if(r){let s=[];if(r.forEach((c,p)=>{if(a.set(p,c.value),this._triggers.has(p)){let u=this.trigger(o,p,dS,i);u&&s.push(u)}}),s.length)return this._engine.markElementAsRemoved(this.id,o,!0,t,a),e&&Ed(s).onDone(()=>this._engine.processLeaveNode(o)),!0}return!1}prepareLeaveAnimationListeners(o){let t=this._elementListeners.get(o),e=this._engine.statesByElement.get(o);if(t&&e){let i=new Set;t.forEach(r=>{let a=r.name;if(i.has(a))return;i.add(a);let c=this._triggers.get(a).fallbackTransition,p=e.get(a)||bV,u=new gS(dS),C=new uS(this.id,a,o);this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:a,transition:c,fromState:p,toState:u,player:C,isFallbackTransition:!0})})}}removeNode(o,t){let e=this._engine;if(o.childElementCount&&this._signalRemovalForInnerTriggers(o,t),this.triggerLeaveAnimation(o,t,!0))return;let i=!1;if(e.totalAnimations){let r=e.players.length?e.playersByQueriedElement.get(o):[];if(r&&r.length)i=!0;else{let a=o;for(;a=a.parentNode;)if(e.statesByElement.get(a)){i=!0;break}}}if(this.prepareLeaveAnimationListeners(o),i)e.markElementAsRemoved(this.id,o,!1,t);else{let r=o[cc];(!r||r===Xie)&&(e.afterFlush(()=>this.clearElementCache(o)),e.destroyInnerAnimations(o),e._onRemovalComplete(o,t))}}insertNode(o,t){_l(o,this._hostClassName)}drainQueuedTransitions(o){let t=[];return this._queue.forEach(e=>{let i=e.player;if(i.destroyed)return;let r=e.element,a=this._elementListeners.get(r);a&&a.forEach(s=>{if(s.name==e.triggerName){let c=$5(r,e.triggerName,e.fromState.value,e.toState.value);c._data=o,j5(e.player,s.phase,c,s.callback)}}),i.markedForDestroy?this._engine.afterFlush(()=>{i.destroy()}):t.push(e)}),this._queue=[],t.sort((e,i)=>{let r=e.transition.ast.depCount,a=i.transition.ast.depCount;return r==0||a==0?r-a:this._engine.driver.containsElement(e.element,i.element)?1:-1})}destroy(o){this.players.forEach(t=>t.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,o)}},kV=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(o,t)=>{};_onRemovalComplete(o,t){this.onRemovalComplete(o,t)}constructor(o,t,e){this.bodyNode=o,this.driver=t,this._normalizer=e}get queuedPlayers(){let o=[];return this._namespaceList.forEach(t=>{t.players.forEach(e=>{e.queued&&o.push(e)})}),o}createNamespace(o,t){let e=new MV(o,t,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,t)?this._balanceNamespaceList(e,t):(this.newHostElements.set(t,e),this.collectEnterElement(t)),this._namespaceLookup[o]=e}_balanceNamespaceList(o,t){let e=this._namespaceList,i=this.namespacesByHostElement;if(e.length-1>=0){let a=!1,s=this.driver.getParentElement(t);for(;s;){let c=i.get(s);if(c){let p=e.indexOf(c);e.splice(p+1,0,o),a=!0;break}s=this.driver.getParentElement(s)}a||e.unshift(o)}else e.push(o);return i.set(t,o),o}register(o,t){let e=this._namespaceLookup[o];return e||(e=this.createNamespace(o,t)),e}registerTrigger(o,t,e){let i=this._namespaceLookup[o];i&&i.register(t,e)&&this.totalAnimations++}destroy(o,t){o&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let e=this._fetchNamespace(o);this.namespacesByHostElement.delete(e.hostElement);let i=this._namespaceList.indexOf(e);i>=0&&this._namespaceList.splice(i,1),e.destroy(t),delete this._namespaceLookup[o]}))}_fetchNamespace(o){return this._namespaceLookup[o]}fetchNamespacesByElement(o){let t=new Set,e=this.statesByElement.get(o);if(e){for(let i of e.values())if(i.namespaceId){let r=this._fetchNamespace(i.namespaceId);r&&t.add(r)}}return t}trigger(o,t,e,i){if(Z5(t)){let r=this._fetchNamespace(o);if(r)return r.trigger(t,e,i),!0}return!1}insertNode(o,t,e,i){if(!Z5(t))return;let r=t[cc];if(r&&r.setForRemoval){r.setForRemoval=!1,r.setForMove=!0;let a=this.collectedLeaveElements.indexOf(t);a>=0&&this.collectedLeaveElements.splice(a,1)}if(o){let a=this._fetchNamespace(o);a&&a.insertNode(t,e)}i&&this.collectEnterElement(t)}collectEnterElement(o){this.collectedEnterElements.push(o)}markElementAsDisabled(o,t){t?this.disabledNodes.has(o)||(this.disabledNodes.add(o),_l(o,SV)):this.disabledNodes.has(o)&&(this.disabledNodes.delete(o),av(o,SV))}removeNode(o,t,e){if(Z5(t)){let i=o?this._fetchNamespace(o):null;i?i.removeNode(t,e):this.markElementAsRemoved(o,t,!1,e);let r=this.namespacesByHostElement.get(t);r&&r.id!==o&&r.removeNode(t,e)}else this._onRemovalComplete(t,e)}markElementAsRemoved(o,t,e,i,r){this.collectedLeaveElements.push(t),t[cc]={namespaceId:o,setForRemoval:i,hasAnimation:e,removedBeforeQueried:!1,previousTriggersValues:r}}listen(o,t,e,i,r){return Z5(t)?this._fetchNamespace(o).listen(t,e,i,r):()=>{}}_buildInstruction(o,t,e,i,r){return o.transition.build(this.driver,o.element,o.fromState.value,o.toState.value,e,i,o.fromState.options,o.toState.options,t,r)}destroyInnerAnimations(o){let t=this.driver.query(o,cS,!0);t.forEach(e=>this.destroyActiveAnimationsForElement(e)),this.playersByQueriedElement.size!=0&&(t=this.driver.query(o,G5,!0),t.forEach(e=>this.finishActiveQueriedAnimationOnElement(e)))}destroyActiveAnimationsForElement(o){let t=this.playersByElement.get(o);t&&t.forEach(e=>{e.queued?e.markedForDestroy=!0:e.destroy()})}finishActiveQueriedAnimationOnElement(o){let t=this.playersByQueriedElement.get(o);t&&t.forEach(e=>e.finish())}whenRenderingDone(){return new Promise(o=>{if(this.players.length)return Ed(this.players).onDone(()=>o());o()})}processLeaveNode(o){let t=o[cc];if(t&&t.setForRemoval){if(o[cc]=Xie,t.namespaceId){this.destroyInnerAnimations(o);let e=this._fetchNamespace(t.namespaceId);e&&e.clearElementCache(o)}this._onRemovalComplete(o,t.setForRemoval)}o.classList?.contains(SV)&&this.markElementAsDisabled(o,!1),this.driver.query(o,I6e,!0).forEach(e=>{this.markElementAsDisabled(e,!1)})}flush(o=-1){let t=[];if(this.newHostElements.size&&(this.newHostElements.forEach((e,i)=>this._balanceNamespaceList(e,i)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let e=0;e<this.collectedEnterElements.length;e++){let i=this.collectedEnterElements[e];_l(i,E6e)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let e=[];try{t=this._flushAnimations(e,o)}finally{for(let i=0;i<e.length;i++)e[i]()}}else for(let e=0;e<this.collectedLeaveElements.length;e++){let i=this.collectedLeaveElements[e];this.processLeaveNode(i)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(e=>e()),this._flushFns=[],this._whenQuietFns.length){let e=this._whenQuietFns;this._whenQuietFns=[],t.length?Ed(t).onDone(()=>{e.forEach(i=>i())}):e.forEach(i=>i())}}reportError(o){throw Aie(o)}_flushAnimations(o,t){let e=new pS,i=[],r=new Map,a=[],s=new Map,c=new Map,p=new Map,u=new Set;this.disabledNodes.forEach(ut=>{u.add(ut);let wt=this.driver.query(ut,b6e,!0);for(let At=0;At<wt.length;At++)u.add(wt[At])});let C=this.bodyNode,E=Array.from(this.statesByElement.keys()),D=Gie(E,this.collectedEnterElements),L=new Map,$=0;D.forEach((ut,wt)=>{let At=fV+$++;L.set(wt,At),ut.forEach(sn=>_l(sn,At))});let Y=[],ce=new Set,Ce=new Set;for(let ut=0;ut<this.collectedLeaveElements.length;ut++){let wt=this.collectedLeaveElements[ut],At=wt[cc];At&&At.setForRemoval&&(Y.push(wt),ce.add(wt),At.hasAnimation?this.driver.query(wt,x6e,!0).forEach(sn=>ce.add(sn)):Ce.add(wt))}let Ie=new Map,$e=Gie(E,Array.from(ce));$e.forEach((ut,wt)=>{let At=z5+$++;Ie.set(wt,At),ut.forEach(sn=>_l(sn,At))}),o.push(()=>{D.forEach((ut,wt)=>{let At=L.get(wt);ut.forEach(sn=>av(sn,At))}),$e.forEach((ut,wt)=>{let At=Ie.get(wt);ut.forEach(sn=>av(sn,At))}),Y.forEach(ut=>{this.processLeaveNode(ut)})});let Ye=[],Re=[];for(let ut=this._namespaceList.length-1;ut>=0;ut--)this._namespaceList[ut].drainQueuedTransitions(t).forEach(At=>{let sn=At.player,to=At.element;if(Ye.push(sn),this.collectedEnterElements.length){let uo=to[cc];if(uo&&uo.setForMove){if(uo.previousTriggersValues&&uo.previousTriggersValues.has(At.triggerName)){let Qs=uo.previousTriggersValues.get(At.triggerName),$r=this.statesByElement.get(At.element);if($r&&$r.has(At.triggerName)){let Js=$r.get(At.triggerName);Js.value=Qs,$r.set(At.triggerName,Js)}}sn.destroy();return}}let oi=!C||!this.driver.containsElement(C,to),Ri=Ie.get(to),pn=L.get(to),Ci=this._buildInstruction(At,e,pn,Ri,oi);if(Ci.errors&&Ci.errors.length){Re.push(Ci);return}if(oi){sn.onStart(()=>Dp(to,Ci.fromStyles)),sn.onDestroy(()=>lc(to,Ci.toStyles)),i.push(sn);return}if(At.isFallbackTransition){sn.onStart(()=>Dp(to,Ci.fromStyles)),sn.onDestroy(()=>lc(to,Ci.toStyles)),i.push(sn);return}let Ni=[];Ci.timelines.forEach(uo=>{uo.stretchStartingKeyframe=!0,this.disabledNodes.has(uo.element)||Ni.push(uo)}),Ci.timelines=Ni,e.append(to,Ci.timelines);let jm={instruction:Ci,player:sn,element:to};a.push(jm),Ci.queriedElements.forEach(uo=>ys(s,uo,[]).push(sn)),Ci.preStyleProps.forEach((uo,Qs)=>{if(uo.size){let $r=c.get(Qs);$r||c.set(Qs,$r=new Set),uo.forEach((Js,Ml)=>$r.add(Ml))}}),Ci.postStyleProps.forEach((uo,Qs)=>{let $r=p.get(Qs);$r||p.set(Qs,$r=new Set),uo.forEach((Js,Ml)=>$r.add(Ml))})});if(Re.length){let ut=[];Re.forEach(wt=>{ut.push(Pie(wt.triggerName,wt.errors))}),Ye.forEach(wt=>wt.destroy()),this.reportError(ut)}let _e=new Map,Ee=new Map;a.forEach(ut=>{let wt=ut.element;e.has(wt)&&(Ee.set(wt,wt),this._beforeAnimationBuild(ut.player.namespaceId,ut.instruction,_e))}),i.forEach(ut=>{let wt=ut.element;this._getPreviousPlayers(wt,!1,ut.namespaceId,ut.triggerName,null).forEach(sn=>{ys(_e,wt,[]).push(sn),sn.destroy()})});let Oe=Y.filter(ut=>Wie(ut,c,p)),ye=new Map;zie(ye,this.driver,Ce,p,Cl).forEach(ut=>{Wie(ut,c,p)&&Oe.push(ut)});let Le=new Map;D.forEach((ut,wt)=>{zie(Le,this.driver,new Set(ut),c,iv)}),Oe.forEach(ut=>{let wt=ye.get(ut),At=Le.get(ut);ye.set(ut,new Map([...wt?.entries()??[],...At?.entries()??[]]))});let xe=[],Tn=[],Ht={};a.forEach(ut=>{let{element:wt,player:At,instruction:sn}=ut;if(e.has(wt)){if(u.has(wt)){At.onDestroy(()=>lc(wt,sn.toStyles)),At.disabled=!0,At.overrideTotalTime(sn.totalTime),i.push(At);return}let to=Ht;if(Ee.size>1){let Ri=wt,pn=[];for(;Ri=Ri.parentNode;){let Ci=Ee.get(Ri);if(Ci){to=Ci;break}pn.push(Ri)}pn.forEach(Ci=>Ee.set(Ci,to))}let oi=this._buildAnimation(At.namespaceId,sn,_e,r,Le,ye);if(At.setRealPlayer(oi),to===Ht)xe.push(At);else{let Ri=this.playersByElement.get(to);Ri&&Ri.length&&(At.parentPlayer=Ed(Ri)),i.push(At)}}else Dp(wt,sn.fromStyles),At.onDestroy(()=>lc(wt,sn.toStyles)),Tn.push(At),u.has(wt)&&i.push(At)}),Tn.forEach(ut=>{let wt=r.get(ut.element);if(wt&&wt.length){let At=Ed(wt);ut.setRealPlayer(At)}}),i.forEach(ut=>{ut.parentPlayer?ut.syncPlayerEvents(ut.parentPlayer):ut.destroy()});for(let ut=0;ut<Y.length;ut++){let wt=Y[ut],At=wt[cc];if(av(wt,z5),At&&At.hasAnimation)continue;let sn=[];if(s.size){let oi=s.get(wt);oi&&oi.length&&sn.push(...oi);let Ri=this.driver.query(wt,G5,!0);for(let pn=0;pn<Ri.length;pn++){let Ci=s.get(Ri[pn]);Ci&&Ci.length&&sn.push(...Ci)}}let to=sn.filter(oi=>!oi.destroyed);to.length?P6e(this,wt,to):this.processLeaveNode(wt)}return Y.length=0,xe.forEach(ut=>{this.players.push(ut),ut.onDone(()=>{ut.destroy();let wt=this.players.indexOf(ut);this.players.splice(wt,1)}),ut.play()}),xe}afterFlush(o){this._flushFns.push(o)}afterFlushAnimationsDone(o){this._whenQuietFns.push(o)}_getPreviousPlayers(o,t,e,i,r){let a=[];if(t){let s=this.playersByQueriedElement.get(o);s&&(a=s)}else{let s=this.playersByElement.get(o);if(s){let c=!r||r==dS;s.forEach(p=>{p.queued||!c&&p.triggerName!=i||a.push(p)})}}return(e||i)&&(a=a.filter(s=>!(e&&e!=s.namespaceId||i&&i!=s.triggerName))),a}_beforeAnimationBuild(o,t,e){let i=t.triggerName,r=t.element,a=t.isRemovalTransition?void 0:o,s=t.isRemovalTransition?void 0:i;for(let c of t.timelines){let p=c.element,u=p!==r,C=ys(e,p,[]);this._getPreviousPlayers(p,u,a,s,t.toState).forEach(D=>{let L=D.getRealPlayer();L.beforeDestroy&&L.beforeDestroy(),D.destroy(),C.push(D)})}Dp(r,t.fromStyles)}_buildAnimation(o,t,e,i,r,a){let s=t.triggerName,c=t.element,p=[],u=new Set,C=new Set,E=t.timelines.map(L=>{let $=L.element;u.add($);let Y=$[cc];if(Y&&Y.removedBeforeQueried)return new cm(L.duration,L.delay);let ce=$!==c,Ce=M6e((e.get($)||T6e).map(_e=>_e.getRealPlayer())).filter(_e=>{let Ee=_e;return Ee.element?Ee.element===$:!1}),Ie=r.get($),$e=a.get($),Ye=dV(this._normalizer,L.keyframes,Ie,$e),Re=this._buildPlayer(L,Ye,Ce);if(L.subTimeline&&i&&C.add($),ce){let _e=new uS(o,s,$);_e.setRealPlayer(Re),p.push(_e)}return Re});p.forEach(L=>{ys(this.playersByQueriedElement,L.element,[]).push(L),L.onDone(()=>w6e(this.playersByQueriedElement,L.element,L))}),u.forEach(L=>_l(L,vV));let D=Ed(E);return D.onDestroy(()=>{u.forEach(L=>av(L,vV)),lc(c,t.toStyles)}),C.forEach(L=>{ys(i,L,[]).push(D)}),D}_buildPlayer(o,t,e){return t.length>0?this.driver.animate(o.element,t,o.duration,o.delay,o.easing,e):new cm(o.duration,o.delay)}},uS=class{namespaceId;triggerName;element;_player=new cm;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(o,t,e){this.namespaceId=o,this.triggerName=t,this.element=e}setRealPlayer(o){this._containsRealPlayer||(this._player=o,this._queuedCallbacks.forEach((t,e)=>{t.forEach(i=>j5(o,e,void 0,i))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(o.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(o){this.totalTime=o}syncPlayerEvents(o){let t=this._player;t.triggerCallback&&o.onStart(()=>t.triggerCallback("start")),o.onDone(()=>this.finish()),o.onDestroy(()=>this.destroy())}_queueEvent(o,t){ys(this._queuedCallbacks,o,[]).push(t)}onDone(o){this.queued&&this._queueEvent("done",o),this._player.onDone(o)}onStart(o){this.queued&&this._queueEvent("start",o),this._player.onStart(o)}onDestroy(o){this.queued&&this._queueEvent("destroy",o),this._player.onDestroy(o)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(o){this.queued||this._player.setPosition(o)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(o){let t=this._player;t.triggerCallback&&t.triggerCallback(o)}};function w6e(n,o,t){let e=n.get(o);if(e){if(e.length){let i=e.indexOf(t);e.splice(i,1)}e.length==0&&n.delete(o)}return e}function O6e(n){return n??null}function Z5(n){return n&&n.nodeType===1}function A6e(n){return n=="start"||n=="done"}function Hie(n,o){let t=n.style.display;return n.style.display=o??"none",t}function zie(n,o,t,e,i){let r=[];t.forEach(c=>r.push(Hie(c)));let a=[];e.forEach((c,p)=>{let u=new Map;c.forEach(C=>{let E=o.computeStyle(p,C,i);u.set(C,E),(!E||E.length==0)&&(p[cc]=D6e,a.push(p))}),n.set(p,u)});let s=0;return t.forEach(c=>Hie(c,r[s++])),a}function Gie(n,o){let t=new Map;if(n.forEach(s=>t.set(s,[])),o.length==0)return t;let e=1,i=new Set(o),r=new Map;function a(s){if(!s)return e;let c=r.get(s);if(c)return c;let p=s.parentNode;return t.has(p)?c=p:i.has(p)?c=e:c=a(p),r.set(s,c),c}return o.forEach(s=>{let c=a(s);c!==e&&t.get(c).push(s)}),t}function _l(n,o){n.classList?.add(o)}function av(n,o){n.classList?.remove(o)}function P6e(n,o,t){Ed(t).onDone(()=>n.processLeaveNode(o))}function M6e(n){let o=[];return Qie(n,o),o}function Qie(n,o){for(let t=0;t<n.length;t++){let e=n[t];e instanceof wu?Qie(e.players,o):o.push(e)}}function k6e(n,o){let t=Object.keys(n),e=Object.keys(o);if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let r=t[i];if(!o.hasOwnProperty(r)||n[r]!==o[r])return!1}return!0}function Wie(n,o,t){let e=t.get(n);if(!e)return!1;let i=o.get(n);return i?e.forEach(r=>i.add(r)):o.set(n,e),t.delete(n),!0}var sv=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(o,t)=>{};constructor(o,t,e){this._driver=t,this._normalizer=e,this._transitionEngine=new kV(o.body,t,e),this._timelineEngine=new PV(o.body,t,e),this._transitionEngine.onRemovalComplete=(i,r)=>this.onRemovalComplete(i,r)}registerTrigger(o,t,e,i,r){let a=o+"-"+i,s=this._triggerCache[a];if(!s){let c=[],p=[],u=Yie(this._driver,r,c,p);if(c.length)throw Sie(i,c);s=_6e(i,u,this._normalizer),this._triggerCache[a]=s}this._transitionEngine.registerTrigger(t,i,s)}register(o,t){this._transitionEngine.register(o,t)}destroy(o,t){this._transitionEngine.destroy(o,t)}onInsert(o,t,e,i){this._transitionEngine.insertNode(o,t,e,i)}onRemove(o,t,e){this._transitionEngine.removeNode(o,t,e)}disableAnimations(o,t){this._transitionEngine.markElementAsDisabled(o,t)}process(o,t,e,i){if(e.charAt(0)=="@"){let[r,a]=pV(e),s=i;this._timelineEngine.command(r,t,a,s)}else this._transitionEngine.trigger(o,t,e,i)}listen(o,t,e,i,r){if(e.charAt(0)=="@"){let[a,s]=pV(e);return this._timelineEngine.listen(a,t,s,r)}return this._transitionEngine.listen(o,t,e,i,r)}flush(o=-1){this._transitionEngine.flush(o)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(o){this._transitionEngine.afterFlushAnimationsDone(o)}};function R6e(n,o){let t=null,e=null;return Array.isArray(o)&&o.length?(t=IV(o[0]),o.length>1&&(e=IV(o[o.length-1]))):o instanceof Map&&(t=IV(o)),t||e?new N6e(n,t,e):null}var N6e=(()=>{class n{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(t,e,i){this._element=t,this._startStyles=e,this._endStyles=i;let r=n.initialStylesByElement.get(t);r||n.initialStylesByElement.set(t,r=new Map),this._initialStyles=r}start(){this._state<1&&(this._startStyles&&lc(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(lc(this._element,this._initialStyles),this._endStyles&&(lc(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(n.initialStylesByElement.delete(this._element),this._startStyles&&(Dp(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(Dp(this._element,this._endStyles),this._endStyles=null),lc(this._element,this._initialStyles),this._state=3)}}return n})();function IV(n){let o=null;return n.forEach((t,e)=>{F6e(e)&&(o=o||new Map,o.set(e,t))}),o}function F6e(n){return n==="display"||n==="position"}var i6=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(o,t,e,i){this.element=o,this.keyframes=t,this.options=e,this._specialStyles=i,this._duration=e.duration,this._delay=e.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let o=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,o,this.options),this._finalKeyframe=o.length?o[o.length-1]:new Map;let t=()=>this._onFinish();this.domPlayer.addEventListener("finish",t),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",t)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(o){let t=[];return o.forEach(e=>{t.push(Object.fromEntries(e))}),t}_triggerWebAnimation(o,t,e){return o.animate(this._convertKeyframesToObject(t),e)}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(o=>o()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}setPosition(o){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=o*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let o=new Map;this.hasStarted()&&this._finalKeyframe.forEach((e,i)=>{i!=="offset"&&o.set(i,this._finished?e:q5(this.element,i))}),this.currentSnapshot=o}triggerCallback(o){let t=o==="start"?this._onStartFns:this._onDoneFns;t.forEach(e=>e()),t.length=0}},o6=class{validateStyleProperty(o){return!0}validateAnimatableStyleProperty(o){return!0}containsElement(o,t){return gV(o,t)}getParentElement(o){return H5(o)}query(o,t,e){return uV(o,t,e)}computeStyle(o,t,e){return q5(o,t)}animate(o,t,e,i,r,a=[]){let s=i==0?"both":"forwards",c={duration:e,delay:i,fill:s};r&&(c.easing=r);let p=new Map,u=a.filter(D=>D instanceof i6);Nie(e,i)&&u.forEach(D=>{D.currentSnapshot.forEach((L,$)=>p.set($,L))});let C=kie(t).map(D=>new Map(D));C=Fie(o,C,p);let E=R6e(o,C);return new i6(o,C,c,E)}};var X5="@",Jie="@.disabled",r6=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(o,t,e,i){this.namespaceId=o,this.delegate=t,this.engine=e,this._onDestroy=i}get data(){return this.delegate.data}destroyNode(o){this.delegate.destroyNode?.(o)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(o,t){return this.delegate.createElement(o,t)}createComment(o){return this.delegate.createComment(o)}createText(o){return this.delegate.createText(o)}appendChild(o,t){this.delegate.appendChild(o,t),this.engine.onInsert(this.namespaceId,t,o,!1)}insertBefore(o,t,e,i=!0){this.delegate.insertBefore(o,t,e),this.engine.onInsert(this.namespaceId,t,o,i)}removeChild(o,t,e){this.parentNode(t)&&this.engine.onRemove(this.namespaceId,t,this.delegate)}selectRootElement(o,t){return this.delegate.selectRootElement(o,t)}parentNode(o){return this.delegate.parentNode(o)}nextSibling(o){return this.delegate.nextSibling(o)}setAttribute(o,t,e,i){this.delegate.setAttribute(o,t,e,i)}removeAttribute(o,t,e){this.delegate.removeAttribute(o,t,e)}addClass(o,t){this.delegate.addClass(o,t)}removeClass(o,t){this.delegate.removeClass(o,t)}setStyle(o,t,e,i){this.delegate.setStyle(o,t,e,i)}removeStyle(o,t,e){this.delegate.removeStyle(o,t,e)}setProperty(o,t,e){t.charAt(0)==X5&&t==Jie?this.disableAnimations(o,!!e):this.delegate.setProperty(o,t,e)}setValue(o,t){this.delegate.setValue(o,t)}listen(o,t,e,i){return this.delegate.listen(o,t,e,i)}disableAnimations(o,t){this.engine.disableAnimations(o,t)}},RV=class extends r6{factory;constructor(o,t,e,i,r){super(t,e,i,r),this.factory=o,this.namespaceId=t}setProperty(o,t,e){t.charAt(0)==X5?t.charAt(1)=="."&&t==Jie?(e=e===void 0?!0:!!e,this.disableAnimations(o,e)):this.engine.process(this.namespaceId,o,t.slice(1),e):this.delegate.setProperty(o,t,e)}listen(o,t,e,i){if(t.charAt(0)==X5){let r=L6e(o),a=t.slice(1),s="";return a.charAt(0)!=X5&&([a,s]=B6e(a)),this.engine.listen(this.namespaceId,r,a,s,c=>{let p=c._data||-1;this.factory.scheduleListenerCallback(p,e,c)})}return this.delegate.listen(o,t,e,i)}};function L6e(n){switch(n){case"body":return document.body;case"document":return document;case"window":return window;default:return n}}function B6e(n){let o=n.indexOf("."),t=n.substring(0,o),e=n.slice(o+1);return[t,e]}var a6=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(o,t,e){this.delegate=o,this.engine=t,this._zone=e,t.onRemovalComplete=(i,r)=>{r?.removeChild(null,i)}}createRenderer(o,t){let e="",i=this.delegate.createRenderer(o,t);if(!o||!t?.data?.animation){let p=this._rendererCache,u=p.get(i);if(!u){let C=()=>p.delete(i);u=new r6(e,i,this.engine,C),p.set(i,u)}return u}let r=t.id,a=t.id+"-"+this._currentId;this._currentId++,this.engine.register(a,o);let s=p=>{Array.isArray(p)?p.forEach(s):this.engine.registerTrigger(r,a,o,p.name,p)};return t.data.animation.forEach(s),new RV(this,a,i,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(o,t,e){if(o>=0&&o<this._microtaskId){this._zone.run(()=>t(e));return}let i=this._animationCallbacksBuffer;i.length==0&&queueMicrotask(()=>{this._zone.run(()=>{i.forEach(r=>{let[a,s]=r;a(s)}),this._animationCallbacksBuffer=[]})}),i.push([t,e])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(o){this.engine.flush(),this.delegate.componentReplaced?.(o)}};var U6e=(()=>{class n extends sv{constructor(t,e,i){super(t,e,i)}ngOnDestroy(){this.flush()}static \u0275fac=function(e){return new(e||n)(Q(Dn),Q(Pu),Q(Mu))};static \u0275prov=Pe({token:n,factory:n.\u0275fac})}return n})();function j6e(){return new Q5}function $6e(n,o,t){return new a6(n,o,t)}var toe=[{provide:Mu,useFactory:j6e},{provide:sv,useClass:U6e},{provide:Ko,useFactory:$6e,deps:[S1,sv,Mt]}],H6e=[{provide:Pu,useClass:NV},{provide:sr,useValue:"NoopAnimations"},...toe],eoe=[{provide:Pu,useFactory:()=>new o6},{provide:sr,useFactory:()=>"BrowserAnimations"},...toe],noe=(()=>{class n{static withConfig(t){return{ngModule:n,providers:t.disableAnimations?H6e:eoe}}static \u0275fac=function(e){return new(e||n)};static \u0275mod=Qt({type:n});static \u0275inj=Xt({providers:eoe,imports:[I1]})}return n})();var Xn={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",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",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"}}};var X=(()=>{let o=class o{};o.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",SIGN_OUT_USER_TRIGGERED:"signOutUserTriggered",SET_DOCUMENTS_TRIGGERED:"setDocumentsTriggered",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_DATA_PROVIDERS_TRIGGERED:"setDataProvidersTriggered",GET_DOCUMENT_ID_TRIGGERED:"getDocumentIdTriggered",SET_LOCATIONS_TRIGGERED:"setLocationsTriggered",SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"setScrollableElementsIdsTriggered",REMOVE_LOCATIONS_TRIGGERED:"removeLocationsTriggered",EXCLUDE_LOCATION_IDS_TRIGGERED:"excludeLocationIdsTriggered",UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",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",DISABLE_FEATURES_TRIGGERED:"disableFeaturesTriggered",SET_DARK_MODE_TRIGGERED:"setDarkModeTriggered",ENABLE_LOGS_TRIGGERED:"enableLogsTriggered",DISABLE_LOGS_TRIGGERED:"disableLogsTriggered",IS_USER_ALLOWED_TRIGGERED:"isUserAllowedTriggered",GET_USER_TRIGGERED:"getUserTriggered",GET_USER_ROLE_TRIGGERED:"getUserRoleTriggered",GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED:"getFeaturesAccessLevelIamTriggered",IS_PLAN_EXPIRED_TRIGGERED:"isPlanExpiredTriggered",GET_VELT_INIT_STATE_TRIGGERED:"getVeltInitStateTriggered",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",ST_TRIGGERED:"stTriggered",ON_ACTION_TRIGGERED:"onActionTriggered",SET_UI_STATE_TRIGGERED:"setUiStateTriggered",GET_UI_STATE_TRIGGERED:"getUiStateTriggered",RESET_VELT_BUTTON_STATE_TRIGGERED:"resetVeltButtonStateTriggered"},Resolver:{COMMENT_RESOLVER_GET:"comment_resolver_get",COMMENT_RESOLVER_SAVE:"comment_resolver_save",COMMENT_RESOLVER_DELETE:"comment_resolver_delete",REACTION_RESOLVER_GET:"reaction_resolver_get",REACTION_RESOLVER_SAVE:"reaction_resolver_save",REACTION_RESOLVER_DELETE:"reaction_resolver_delete",USER_RESOLVER_GET:"user_resolver_get",ATTACHMENT_RESOLVER_SAVE:"attachment_resolver_save",ATTACHMENT_RESOLVER_DELETE:"attachment_resolver_delete"},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_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",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",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",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",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",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_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",SET_RECORDINGS_TRIGGERED:"setRecordingsTriggered",ADD_COMMENT_ON_ELEMENT_TRIGGERED:"addCommentOnElementTriggered",ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"enablePrivateCommentModeTriggered",DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"disablePrivateCommentModeTriggered",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_MULTI_THREAD_MODE_TRIGGERED:"enableMultiThreadModeTriggered",DISABLE_MULTI_THREAD_MODE_TRIGGERED:"disableMultiThreadModeTriggered",ENABLE_MULTI_THREAD_TRIGGERED:"enableMultiThreadTriggered",DISABLE_MULTI_THREAD_TRIGGERED:"disableMultiThreadTriggered",UPDATE_CONTEXT_TRIGGERED:"updateContextTriggered",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",ON_COMMENT_SIDEBAR_ACTION_BUTTON_CLICK_TRIGGERED:"onCommentSidebarActionButtonClickTriggered",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_SEEN_BY_USERS_TRIGGERED:"enableSeenByUsersTriggered",DISABLE_SEEN_BY_USERS_TRIGGERED:"disableSeenByUsersTriggered",ENABLE_SHORT_USER_NAME_TRIGGERED:"enableShortUserNameTriggered",DISABLE_SHORT_USER_NAME_TRIGGERED:"disableShortUserNameTriggered",ENABLE_READ_ONLY_TRIGGERED:"enableReadOnlyTriggered",DISABLE_READ_ONLY_TRIGGERED:"disableReadOnlyTriggered",ADD_COMMENT_ANNOTATION_TRIGGERED:"addCommentAnnotationTriggered",APPROVE_COMMENT_ANNOTATION_TRIGGERED:"approveCommentAnnotationTriggered",ACCEPT_COMMENT_ANNOTATION_TRIGGERED:"acceptCommentAnnotationTriggered",REJECT_COMMENT_ANNOTATION_TRIGGERED:"rejectCommentAnnotationTriggered",SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"subscribeCommentAnnotationTriggered",UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"unsubscribeCommentAnnotationTriggered",DELETE_COMMENT_ANNOTATION_TRIGGERED:"deleteCommentAnnotationTriggered",GET_COMMENT_ANNOTATIONS_TRIGGERED:"getCommentAnnotationsTriggered",GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED:"getCommentAnnotationsCountTriggered",ASSIGN_USER_TRIGGERED:"assignUserTriggered",UPDATE_PRIORITY_TRIGGERED:"updatePriorityTriggered",UPDATE_STATUS_TRIGGERED:"updateStatusTriggered",UPDATE_ACCESS_TRIGGERED:"updateAccessTriggered",RESOLVE_COMMENT_ANNOTATION_TRIGGERED:"resolveCommentAnnotationTriggered",GET_LINK_TRIGGERED:"getLinkTriggered",COPY_LINK_TRIGGERED:"copyLinkTriggered",ADD_COMMENT_TRIGGERED:"addCommentTriggered",UPDATE_COMMENT_TRIGGERED:"updateCommentTriggered",DELETE_COMMENT_TRIGGERED:"deleteCommentTriggered",GET_COMMENT_TRIGGERED:"getCommentTriggered",ADD_ATTACHMENT_TRIGGERED:"addAttachmentTriggered",DELETE_ATTACHMENT_TRIGGERED:"deleteAttachmentTriggered",GET_ATTACHMENT_TRIGGERED:"getAttachmentTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",GET_RECORDING_TRIGGERED:"getRecordingTriggered",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",ON_ACTION_TRIGGERED:"onActionTriggered"},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_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",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",ON_ACTION_TRIGGERED:"onActionTriggered",DOWNLOAD_LATEST_VIDEO_TRIGGERED:"downloadLatestVideoTriggered"},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",ON_ACTION_TRIGGERED:"onActionTriggered"},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",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"},LiveStateSync:{SET_USER_AS_EDITOR_TRIGGERED:"setUserAsEditorTriggered",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",GET_LIVE_STATE_DATA_TRIGGERED:"getLiveStateDataTriggered",SET_LIVE_STATE_DATA_TRIGGERED:"setLiveStateDataTriggered",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",ON_ACTION_TRIGGERED:"onActionTriggered"},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"},Feedback:{FEEDBACK_BUTTON_CLICKED:"feedbackButtonClicked",FEEDBACK_SUBMITTED:"feedbackSubmitted"},Contact:{UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",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",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",NOTIFICATION_HISTORY_PANEL_CLOSED:"notificationHistoryPanelClosed",NOTIFICATION_HISTORY_PANEL_TOGGLED:"notificationHistoryPanelToggled",NOTIFICATION_MARK_ALL_AS_READ_CLICKED:"notificationMarkAllAsReadClicked",NOTIFICATION_CLICKED:"notificationClicked",NOTIFICATION_TAB_CLICKED:"notificationTabClicked",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"}};let n=o;return n})(),ioe=[X.Events.Rewriter.REWRITER_ENABLED];var Oa=class n{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(o,t=!1){return this.onePassHasher.start().appendStr(o).end(t)}static hashAsciiStr(o,t=!1){return this.onePassHasher.start().appendAsciiStr(o).end(t)}static _hex(o){let t=n.hexChars,e=n.hexOut,i,r,a,s;for(s=0;s<4;s+=1)for(r=s*8,i=o[s],a=0;a<8;a+=2)e[r+1+a]=t.charAt(i&15),i>>>=4,e[r+0+a]=t.charAt(i&15),i>>>=4;return e.join("")}static _md5cycle(o,t){let e=o[0],i=o[1],r=o[2],a=o[3];e+=(i&r|~i&a)+t[0]-680876936|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[1]-389564586|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[2]+606105819|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[3]-1044525330|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[4]-176418897|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[5]+1200080426|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[6]-1473231341|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[7]-45705983|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[8]+1770035416|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[9]-1958414417|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[10]-42063|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[11]-1990404162|0,i=(i<<22|i>>>10)+r|0,e+=(i&r|~i&a)+t[12]+1804603682|0,e=(e<<7|e>>>25)+i|0,a+=(e&i|~e&r)+t[13]-40341101|0,a=(a<<12|a>>>20)+e|0,r+=(a&e|~a&i)+t[14]-1502002290|0,r=(r<<17|r>>>15)+a|0,i+=(r&a|~r&e)+t[15]+1236535329|0,i=(i<<22|i>>>10)+r|0,e+=(i&a|r&~a)+t[1]-165796510|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[6]-1069501632|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[11]+643717713|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[0]-373897302|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[5]-701558691|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[10]+38016083|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[15]-660478335|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[4]-405537848|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[9]+568446438|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[14]-1019803690|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[3]-187363961|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[8]+1163531501|0,i=(i<<20|i>>>12)+r|0,e+=(i&a|r&~a)+t[13]-1444681467|0,e=(e<<5|e>>>27)+i|0,a+=(e&r|i&~r)+t[2]-51403784|0,a=(a<<9|a>>>23)+e|0,r+=(a&i|e&~i)+t[7]+1735328473|0,r=(r<<14|r>>>18)+a|0,i+=(r&e|a&~e)+t[12]-1926607734|0,i=(i<<20|i>>>12)+r|0,e+=(i^r^a)+t[5]-378558|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[8]-2022574463|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[11]+1839030562|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[14]-35309556|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[1]-1530992060|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[4]+1272893353|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[7]-155497632|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[10]-1094730640|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[13]+681279174|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[0]-358537222|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[3]-722521979|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[6]+76029189|0,i=(i<<23|i>>>9)+r|0,e+=(i^r^a)+t[9]-640364487|0,e=(e<<4|e>>>28)+i|0,a+=(e^i^r)+t[12]-421815835|0,a=(a<<11|a>>>21)+e|0,r+=(a^e^i)+t[15]+530742520|0,r=(r<<16|r>>>16)+a|0,i+=(r^a^e)+t[2]-995338651|0,i=(i<<23|i>>>9)+r|0,e+=(r^(i|~a))+t[0]-198630844|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[7]+1126891415|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[14]-1416354905|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[5]-57434055|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[12]+1700485571|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[3]-1894986606|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[10]-1051523|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[1]-2054922799|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[8]+1873313359|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[15]-30611744|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[6]-1560198380|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[13]+1309151649|0,i=(i<<21|i>>>11)+r|0,e+=(r^(i|~a))+t[4]-145523070|0,e=(e<<6|e>>>26)+i|0,a+=(i^(e|~r))+t[11]-1120210379|0,a=(a<<10|a>>>22)+e|0,r+=(e^(a|~i))+t[2]+718787259|0,r=(r<<15|r>>>17)+a|0,i+=(a^(r|~e))+t[9]-343485551|0,i=(i<<21|i>>>11)+r|0,o[0]=e+o[0]|0,o[1]=i+o[1]|0,o[2]=r+o[2]|0,o[3]=a+o[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(n.stateIdentity),this}appendStr(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a;for(a=0;a<o.length;a+=1){if(r=o.charCodeAt(a),r<128)t[i++]=r;else if(r<2048)t[i++]=(r>>>6)+192,t[i++]=r&63|128;else if(r<55296||r>56319)t[i++]=(r>>>12)+224,t[i++]=r>>>6&63|128,t[i++]=r&63|128;else{if(r=(r-55296)*1024+(o.charCodeAt(++a)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(r>>>18)+240,t[i++]=r>>>12&63|128,t[i++]=r>>>6&63|128,t[i++]=r&63|128}i>=64&&(this._dataLength+=64,n._md5cycle(this._state,e),i-=64,e[0]=e[16])}return this._bufferLength=i,this}appendAsciiStr(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a=0;for(;;){for(r=Math.min(o.length-a,64-i);r--;)t[i++]=o.charCodeAt(a++);if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,e),i=0}return this._bufferLength=i,this}appendByteArray(o){let t=this._buffer8,e=this._buffer32,i=this._bufferLength,r,a=0;for(;;){for(r=Math.min(o.length-a,64-i);r--;)t[i++]=o[a++];if(i<64)break;this._dataLength+=64,n._md5cycle(this._state,e),i=0}return this._bufferLength=i,this}getState(){let o=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[o[0],o[1],o[2],o[3]]}}setState(o){let t=o.buffer,e=o.state,i=this._state,r;for(this._dataLength=o.length,this._bufferLength=o.buflen,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(o=!1){let t=this._bufferLength,e=this._buffer8,i=this._buffer32,r=(t>>2)+1;this._dataLength+=t;let a=this._dataLength*8;if(e[t]=128,e[t+1]=e[t+2]=e[t+3]=0,i.set(n.buffer32Identity.subarray(r),r),t>55&&(n._md5cycle(this._state,i),i.set(n.buffer32Identity)),a<=4294967295)i[14]=a;else{let s=a.toString(16).match(/(.*?)(.{0,8})$/);if(s===null)return;let c=parseInt(s[2],16),p=parseInt(s[1],16)||0;i[14]=c,i[15]=p}return n._md5cycle(this._state,i),o?this._state:n._hex(this._state)}};Oa.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);Oa.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Oa.hexChars="0123456789abcdef";Oa.hexOut=[];Oa.onePassHasher=new Oa;if(Oa.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var Ut=function(n){return n.NEWLY_ADDED="newlyAdded",n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.ASSIGNED="assigned",n.STATUS_CHANGED="statusChanged",n.PRIORITY_CHANGED="priorityChanged",n.ACCESS_MODE_CHANGED="accessModeChanged",n.CUSTOM_LIST_CHANGED="customListChanged",n.ACCEPTED="accepted",n.REJECTED="rejected",n.REACTION_ADDED="reactionAdded",n.REACTION_DELETED="reactionDeleted",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",n}(Ut||{}),qa=function(n){return n.COMMENT_ANNOTATION_ADD="comment_annotation.add",n.COMMENT_ANNOTATION_DELETE="comment_annotation.delete",n.COMMENT_ADD="comment.add",n.COMMENT_DELETE="comment.delete",n.COMMENT_UPDATE="comment.update",n.REACTION_ADD="reaction.add",n.REACTION_DELETE="reaction.delete",n.ATTACHMENT_ADD="attachment.add",n.ATTACHMENT_DELETE="attachment.delete",n}(qa||{}),Zi={ADD_COMMENT_ANNOTATION:"addCommentAnnotation",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",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"},ku={TRANSCRIPTION_DONE:"transcriptionDone",RECORDING_DONE:"recordingDone",RECORDING_EDIT_DONE:"recordingEditDone",DELETE_RECORDING:"deleteRecording",ERROR:"error",RECORDING_SAVE_INITIATED:"recordingSaveInitiated"},$o={VELT_BUTTON_CLICK:"veltButtonClick",USER_UPDATE:"userUpdate",INIT_UPDATE:"initUpdate",DOCUMENT_INIT:"documentInit",ERROR:"error"},wp={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"},LV={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},hS=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n}(hS||{}),BV=function(n){return n.INVITE="invite",n.REMOVE="remove",n}(BV||{}),s6=function(n){return n.CREATED="created",n.JOINED="joined",n}(s6||{}),lv=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n}(lv||{}),l6=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n}(l6||{}),c6=function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n}(c6||{}),VV=function(n){return n.FIRST_VIEWED="firstViewed",n}(VV||{}),ke=function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n}(ke||{}),Ru=function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.AREA_COMMENT="areaComment",n.INLINE_COMMENT="inlineComment",n.COMMENT_SIDEBAR="commentSidebar",n}(Ru||{}),Qo=function(n){return n.DESKTOP="Desktop",n.MOBILE="Mobile",n.TABLET="Tablet",n.MONITOR="Monitor",n.UNKNOWN="Unknown",n}(Qo||{}),cv=function(n){return n.PORTRAIT="portrait",n.LANDSCAPE="landscape",n.UNKNOWN="unknown",n}(cv||{}),mv=function(n){return n.Portrait="(orientation: portrait)",n.Landscape="(orientation: landscape)",n}(mv||{}),zs=function(n){return n.DIFFERENT_DEVICE="differentDevice",n.ELEMENT_DELETED="elementDeleted",n}(zs||{}),po=function(n){return n.ADMIN="Admin",n.COMMENTER="Commenter",n}(po||{}),pi=function(n){return n.PUBLIC="public",n.RESTRICTED="restricted",n.ORGANIZATION_PRIVATE="organizationPrivate",n}(pi||{}),m6=function(n){return n.DEFAULT="default",n.DYNAMIC_ID="dynamicId",n}(m6||{}),Xi=function(n){return n.PUBLIC="public",n.PRIVATE="private",n}(Xi||{}),Nu=function(n){return n.MINIMAL="minimal",n.VERBOSE="verbose",n}(Nu||{}),Fu=function(n){return n.DEFAULT="default",n.EXPANDED="expanded",n}(Fu||{}),UV=function(n){return n.TOTAL="total",n.UNREAD="unread",n}(UV||{}),Gs=function(n){return n.ONLINE="online",n.OFFLINE="offline",n.PENDING_INIT="pendingInit",n.PENDING_DATA="pendingData",n}(Gs||{}),Mi=function(n){return n.ALL="all",n.ORGANIZATION="organization",n.ORGANIZATION_USER_GROUP="organizationUserGroup",n.DOCUMENT="document",n.FOLDER="folder",n}(Mi||{}),mc=function(n){return n.AND="and",n.OR="or",n}(mc||{});var ei=(()=>{let o=class o{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 o.Breakpoints[wi.Handset]?Qo.MOBILE:o.Breakpoints[wi.Tablet]?Qo.TABLET:o.Breakpoints[wi.XLarge]?Qo.MONITOR:o.Breakpoints[wi.Web]?Qo.DESKTOP:Qo.UNKNOWN}catch{return Qo.UNKNOWN}}getOrientation(){try{return o.Orientations[mv.Portrait]?cv.PORTRAIT:o.Orientations[mv.Landscape]?cv.LANDSCAPE:cv.UNKNOWN}catch{return cv.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 a=navigator?.userAgent,s="Unknown";if(a.indexOf("Windows")!==-1)a.indexOf("Windows NT 5.1")!==-1?s="Windows XP":a.indexOf("Windows NT 6.0")!==-1?s="Windows Vista":a.indexOf("Windows NT 6.1")!==-1?s="Windows 7":a.indexOf("Windows NT 6.2")!==-1?s="Windows 8":a.indexOf("Windows NT 6.3")!==-1?s="Windows 8.1":a.indexOf("Windows NT 10.0")!==-1&&(s="Windows 10");else if(a.indexOf("Mac OS X")!==-1)s=a.match(/Mac OS X ([0-9_.]+)/)[1],s=s.replace(/_/g,".");else if(a.indexOf("iOS")!==-1)s=a.match(/OS ([0-9_.]+) like Mac OS X/)[1],s=s.replace(/_/g,".");else if(a.indexOf("Firefox")!==-1){var e=/\(([^)]+)\)/,i=e.exec(a)[1],r=i.split("; ");s=r[2]}return s||"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 e=navigator.userAgent.match(/(?:Opera|OPR)\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getChromeVersion(){try{var e=navigator.userAgent.match(/(?:Chrome|Chromium)\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getSafariVersion(){try{var e=navigator.userAgent.match(/Version\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getFirefoxVersion(){try{var e=navigator.userAgent.match(/Firefox\/(\d+)/);return e?e[1]:"Unknown"}catch{return"Unknown"}}getIEVersion(){try{var e=navigator.userAgent.match(/MSIE (\d+)/);return e?e[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"}}}};o.Breakpoints={},o.Orientations={};let n=o;return n})();var Qi=class{constructor(){this.deviceInfo=new ei().getDeviceInfo()}};var Aa=class Aa{static showLogs(){try{return Xn.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(o){return Aa.catch("Error in showLogs: ",o),!1}}};Aa.log=Aa.showLogs()?console.log:()=>{},Aa.warn=Aa.showLogs()?console.warn:()=>{},Aa.error=Aa.showLogs()?console.error:()=>{},Aa.debug=Aa.showLogs()?console.debug:()=>{},Aa.info=Aa.showLogs()?console.info:()=>{},Aa.logsEnabled=!0,Aa.catch=(o,t)=>{try{Aa.logsEnabled&&(t!==void 0?console.warn("Velt: ",o,t):console.warn("Velt: ",o))}catch{}};var mt=Aa;var pt=class pt{};pt.SNIPPYLY_HOST_URL_PROD="https://snippyly.com",pt.SNIPPYLY_HOST_URL_STAGING="https://snippyly-staging.web.app",pt.USER_TYPE_ANONYMOUS="anonymous",pt.USER_TYPE_SIGNED_IN="signedIn",pt.LOCALSTORAGE_DATA_ID="snippylytempdata",pt.NO_ORGANIZATION_ID="veltNoOrganization",pt.DEFAULT_QUERY_HASH="default",pt.LISTENER_BATCH_SIZE=5,pt.FIREBASE_PARTIAL_PATH_ORGANIZATIONS="organizations",pt.FIREBASE_PARTIAL_PATH_FOLDERS="folders",pt.FIREBASE_PARTIAL_PATH_DOCS="docs",pt.FIREBASE_PARTIAL_PATH_PRESENCE="presence",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS="orgIamUsers",pt.FIREBASE_PARTIAL_PATH_FOLDER_USERS="folderIamUsers",pt.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS="docIamUsers",pt.FIREBASE_PARTIAL_PATH_CURSOR="cursor",pt.FIREBASE_PARTIAL_PATH_ARROW="arrow",pt.FIREBASE_PARTIAL_PATH_AREA="area",pt.FIREBASE_PARTIAL_PATH_COMMENT="comment",pt.FIREBASE_PARTIAL_PATH_LOCATION="location",pt.FIREBASE_PARTIAL_PATH_MULTI_THREAD="multiThread",pt.FIREBASE_PARTIAL_PATH_TAG="tag",pt.FIREBASE_PARTIAL_PATH_SELECTION="selection",pt.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE="audioHuddle",pt.FIREBASE_PARTIAL_PATH_HUDDLE="huddle",pt.FIREBASE_PARTIAL_PATH_CONTACTS="contacts",pt.FIREBASE_PARTIAL_PATH_GROUPS="groups",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS="notificationsDocs",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS="notificationsUsers",pt.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION="notificationsDocs__notification",pt.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION="notificationsUsers__notification",pt.FIREBASE_PARTIAL_PATH_GLOBAL="global",pt.FIREBASE_PARTIAL_PATH_LOGINS="logins",pt.FIREBASE_PARTIAL_PATH_METADATA="metadata",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA="metadata",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS="groups",pt.FIREBASE_PARTIAL_PATH_LOCATIONS="locations",pt.FIREBASE_PARTIAL_PATH_RECORDER="recorder",pt.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG="flock",pt.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER="syncVideoPlayer",pt.FIREBASE_PARTIAL_PATH_LIVE_STATE="liveState",pt.FIREBASE_PARTIAL_PATH_IAM="iam",pt.FIREBASE_PARTIAL_PATH_REACTION="reaction",pt.FIREBASE_PARTIAL_PATH_VIEWS="views",pt.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS="commentViews",pt.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS="notificationViews",pt.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS="documentViews",pt.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS="locationViews",pt.FIREBASE_PARTIAL_PATH_NOTIFICATIONS="notifications",pt.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS="notifications",pt.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP="lastNotificationTimestamp",pt.FIREBASE_PARTIAL_PATH_USERS="users",pt.FIREBASE_PARTIAL_PATH_USER_REQUESTS="userRequests",pt.FIREBASE_PARTIAL_PATH_FEEDBACK="feedback",pt.FIREBASE_PARTIAL_PATH_BUGS="bugs",pt.FIREBASE_PARTIAL_PATH_CONTACT_US="contactUs",pt.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA="metadata",pt.PRESENCE_STATUS_ONLINE="online",pt.PRESENCE_STATUS_OFFLINE="offline",pt.PRESENCE_STATUS_AWAY="away",pt.IMG_URL_NOT_FOUND="https://snippyly.com/assets/icons/anon-user.svg",pt.IMG_CLASS_NOT_FOUND="presence-avatar-image-small",pt.AVATAR_COLOR_LIST=["#a259fe","#9746ff","#19bcfe","#FE8947","#2c83fc","#0dcf82","#ffcb00","#ff7162","#FFD600","#A5A7FE","#67DBF4","#FDA192"],pt.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"},pt.UNREAD_COMMENTS_CHECK_FROM_DATE="2024-02-05",pt.DEFAULT_ANNOTATION_COLOR="#a259fe",pt.REGEX_EMAIL=/(\+|@)+([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,pt.REGEX_URL=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,pt.REGEX_SPECIAL_CHARS=/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,pt.SNIPPYLY_HIGHLIGHT="snippyly-highlight",pt.SNIPPYLY_HIGHLIGHT_PREVIEW="snippyly-highlight-preview",pt.SNIPPYLY_HIGHLIGHT_USER="snippyly-highlight-user",pt.SNIPPYLY_HIGHLIGHT_USER_NAME="snippyly-highlight-user-name",pt.SNIPPYLY_HIGHLIGHT_USER_TEXT="snippyly-highlight-user-text",pt.VELT_LIVE_SELECTION_ON_ELEMENT="velt-live-selection-on-element",pt.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT="velt-live-selection-on-element-default",pt.VELT_LIVE_SELECTION_ON_TEXT="velt-live-selection-on-text",pt.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT="velt-live-selection-on-text-default",pt.VELT_IGNORE_CHANGE_DETECTION="velt-ignore-change-detection",pt.VELT_CUSTOM_CSS="velt-custom-css",pt.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_INTERNAL:"velt-recorder-control-panel-internal",VELT_RECORDER_PLAYER:"velt-recorder-player",VELT_TEXT_HIGHLIGHT:"velt-text-highlight",VELT_COMMENT_TEXT_PORTAL:"velt-comment-text-portal",VELT_COMMENTS_SIDEBAR:"velt-comments-sidebar",VELT_COMMENT_BUBBLE:"velt-comment-bubble",VELT_COMMENT_THREAD:"velt-comment-thread",VELT_COMMENT_PIN:"velt-comment-pin",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_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",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",VELT_INLINE_REACTIONS_SECTION:"velt-inline-reactions-section",VELT_VIEW_ANALYTICS:"velt-view-analytics",VELT_NOTIFICATIONS_TOOL:"velt-notifications-tool",VELT_NOTIFICATIONS_PANEL:"velt-notifications-panel",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel",VELT_WIREFRAME:"velt-wireframe",VELT_AUTOCOMPLETE:"velt-autocomplete",VELT_AUTOCOMPLETE_CHIP:"velt-autocomplete-chip",VELT_COMMENT_DIALOG_HEADER:"velt-comment-dialog-header",VELT_COMMENT_DIALOG_BODY:"velt-comment-dialog-body",VELT_COMMENT_DIALOG_FOOTER:"velt-comment-dialog-footer",VELT_COMMENT_DIALOG_PRIORITY:"velt-comment-dialog-priority",VELT_COMMENT_DIALOG_STATUS:"velt-comment-dialog-status",VELT_COMMENT_DIALOG_COPY_LINK:"velt-comment-dialog-copy-link",VELT_COMMENT_DIALOG_RESOLVE_BUTTON:"velt-comment-dialog-resolve-button",VELT_COMMENT_DIALOG_OPTIONS:"velt-comment-dialog-options",VELT_COMMENT_DIALOG_BODY_THREAD_CARD:"velt-comment-dialog-thread-card",VELT_COMMENT_DIALOG_PRIVATE_BANNER:"velt-comment-dialog-private-banner",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"},pt.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_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"},pt.INJECTION_STYLE_PROPS={VELT_AVATAR_COLOR:"data-velt-avatar-color",VELT_COMMENT_PRIORITY_COLOR:"data-velt-priority-color"},pt.INJECTION_ATTRIBUTES={VELT_AVATAR_IMG:"data-velt-avatar-img",VELT_COMMENT_LENGTH:"data-velt-comment-thread-length"},pt.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_CUSTOM_PRIORITY_MAP:"veltCustomPriorityMap",VELT_CUSTOM_STATUS_MAP:"veltCustomStatusMap",VELT_CUSTOM_CATEGORY_MAP:"veltCustomCategoryMap"},pt.LOCAL_STORAGE={SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS:"snippylyDefaultMediaSourceOptions",SNIPPYLY_QUEUED_COMMENT:"snippylyQueuedComment",VELT_USER:"_vu",VELT_USER_FORCE_RE_LOGGED_IN:"_vurli",VELT_VERSION:"_vv",VELT_ADVANCED_QUERIES:"_vadq"},pt.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},pt.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS={svg:!0},pt.SELECTION_ENABLED_ELEMENTS={input:!0,textarea:!0,select:!0,button:!0},pt.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"},pt.VELT_BASE_REM_UNIT="--velt-base-rem-unit",pt.VELT_VIEWPORT_WIDTH="--legacy-velt-viewport-width",pt.VELT_VIEWPORT_HEIGHT="--legacy-velt-viewport-height",pt.VELT_SELECTION_COLOR="--velt-selection-color",pt.VELT_MIN_ARROW_LENGTH=100,pt.VELT_ARROW_VIEWPORT_PADDING=20,pt.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME=5,pt.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"},pt.VIDEO_POSTER_DEFAULT_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURQAAAAEAAKSl0/gAAAAxSURBVFjD7dBBDQAgCABARjKjGZUofi0Ac+4uwkUAAAAAAMCIpYD/bQVNSsEtFfCaA8vLAaMbkVUtAAAAAElFTkSuQmCC",pt.HUDDLE_TYPE_CONFIGS={audio:{audio:!0,video:!1,presentation:!1},video:{audio:!0,video:!0,presentation:!1},presentation:{audio:!1,video:!1,presentation:!0}},pt.RecorderModes={VIDEO:"video",AUDIO:"audio",SCREEN:"screen",ALL:"all"},pt.CommentAnnotationStatusMap={OPEN:{id:"OPEN",name:"Open",color:"var(--velt-accent, #625DF5)",lightColor:"var(--velt-accent-light, #E7E8FA)",type:"default",svg:`
71
71
  <svg
72
72
  width="16"
73
73
  height="16"
@@ -192,7 +192,7 @@ This typically indicates that your device does not have a healthy Internet conne
192
192
  <img src="${o||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
193
193
  </a>
194
194
  `}};var jp=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new Qi}};var BP=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new Qi}};var GS=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var $p=class{constructor(){this.pageInfo=new Qi}},WS=function(n){return n.Start="start",n.End="end",n}(WS||{}),Wv=function(n){return n.Avatar="avatar",n.Label="label",n}(Wv||{});var VP=class{constructor(){this.sources=[],this.playerState=new qS}},qS=class{constructor(){this.volume=1}};var YS=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new Qi}};var Hp=class{constructor(){this.visibility="private"}};var UP=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new Qi,this.isReactionResolverUsed=!1}};var jP=class{};var jt=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.config$=new ve(null),this.disableLogsConfig$=new ve({warnings:!0,suppressAll:!1}),this.apiKey$=new ve(""),this.baseFeatureAllowList=[],this.sf$=new ve(!1),this.sdkType$=new ve("core"),this.logsEnabled$=new ve(!0);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(r=>{this.analyticsService.updateDefaultProperties({sdkType:r})},r=>{this.loggingService.catch("Error in ConfigService sdkType$: ",r)}),this.logsEnabled$.subscribe(r=>{r?this.loggingService.enableLogs():this.loggingService.disableLogs(),mt.logsEnabled=r},r=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",r)})}catch(r){this.loggingService.catch("Error in ConfigService constructor: ",r)}}initConfig(e){try{e.featureAllowList?.length||(e.featureAllowList=Object.values(ke)),this.baseFeatureAllowList=e.featureAllowList?.slice(),this.config$.next(e)}catch(i){this.loggingService.catch("Error in ConfigService initConfig: ",i)}}setApiKey(e){this.apiKey$.next(e)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(e){try{let i=this.config$.value;i&&(e?.length?i.featureAllowList=this.baseFeatureAllowList.filter(r=>!e.includes(r)):i.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService disableFeatures: ",i)}}setSF(e){try{this.sf$.next(e),this.analyticsService.setSF(e)}catch(i){this.loggingService.catch("Error in ConfigService setSF: ",i)}}getSF(){try{return this.sf$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSF: ",e),!1}}getSF$(){try{return this.sf$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSF$: ",e),se(!1)}}setSdkType(e){try{this.sdkType$.next(e)}catch(i){this.loggingService.catch("Error in ConfigService setSdkType: ",i)}}getSdkType(){try{return this.sdkType$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType: ",e),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType$: ",e),se("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableLogs: ",e)}}disableLogs(e){try{e&&this.disableLogsConfig$.next({warnings:e.warnings??!0,suppressAll:e.suppressAll??!1}),e?.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()}getApiProxyDomain(){try{return this.config$.value?.apiProxyDomain}catch(e){this.loggingService.catch("Error in ConfigService getApiProxyDomain: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vse=(()=>{let o=class o{constructor(e){this.loggingService=e,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 e=localStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let i=new Qu;return this.setLocalStorageData(i),i}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new Qu}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let i=JSON.stringify(e);localStorage?.setItem(j.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(j.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let i=new Qu;return this.setSessionStorageData(i),i}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new Qu}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let i=JSON.stringify(e);sessionStorage?.setItem(j.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(j.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};o.\u0275fac=function(i){return new(i||o)(Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Im=(()=>{let o=class o{constructor(e,i){this.localStorageService=e,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 e=new Do,i=this.localStorageService.getSessionStorageData();if(i.snippylyAvatar)e=i.snippylyAvatar;else{let r=this.generateUserAvatar();i.snippylyAvatar=r,this.localStorageService.setSessionStorageData(i)}return e}catch(e){return this.loggingService.catch("Error in getSessionAvatar:",e),new Do}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let e=Math.floor(Math.random()*this.avatarList.length),i=this.avatarList[e];return i.color=this.generateUserColor(),i}catch(e){return this.loggingService.catch("Error in generateUserAvatar:",e),this.avatarList[0]}}generateUserColor(e){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserColor","color: green;");try{if(e)return j.AVATAR_COLOR_LIST[e%j.AVATAR_COLOR_LIST.length];let i=Math.floor(Math.random()*j.AVATAR_COLOR_LIST.length);return j.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(e){return this.loggingService.catch("Error in generateUserImage:",e),""}}};o.\u0275fac=function(i){return new(i||o)(Q(vse),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Em=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,i){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.next(i)}catch(r){this.loggingService.catch("Error in CoreActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.asObservable()}catch(i){return this.loggingService.catch("Error in CoreActionsService onAction: ",i),se(null)}}};o.\u0275fac=function(i){return new(i||o)(Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var{entries:Dse,setPrototypeOf:Cse,isFrozen:s9e,getPrototypeOf:l9e,getOwnPropertyDescriptor:c9e}=Object,{freeze:Xa,seal:El,create:wse}=Object,{apply:P$,construct:M$}=typeof Reflect<"u"&&Reflect;Xa||(Xa=function(o){return o});El||(El=function(o){return o});P$||(P$=function(o,t,e){return o.apply(t,e)});M$||(M$=function(o,t){return new o(...t)});var HP=Qa(Array.prototype.forEach),m9e=Qa(Array.prototype.lastIndexOf),_se=Qa(Array.prototype.pop),ZS=Qa(Array.prototype.push),d9e=Qa(Array.prototype.splice),GP=Qa(String.prototype.toLowerCase),T$=Qa(String.prototype.toString),yse=Qa(String.prototype.match),XS=Qa(String.prototype.replace),p9e=Qa(String.prototype.indexOf),g9e=Qa(String.prototype.trim),Sc=Qa(Object.prototype.hasOwnProperty),Za=Qa(RegExp.prototype.test),QS=u9e(TypeError);function Qa(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];return P$(n,o,e)}}function u9e(n){return function(){for(var o=arguments.length,t=new Array(o),e=0;e<o;e++)t[e]=arguments[e];return M$(n,t)}}function ni(n,o){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:GP;Cse&&Cse(n,null);let e=o.length;for(;e--;){let i=o[e];if(typeof i=="string"){let r=t(i);r!==i&&(s9e(o)||(o[e]=r),i=r)}n[i]=!0}return n}function h9e(n){for(let o=0;o<n.length;o++)Sc(n,o)||(n[o]=null);return n}function Ju(n){let o=wse(null);for(let[t,e]of Dse(n))Sc(n,t)&&(Array.isArray(e)?o[t]=h9e(e):e&&typeof e=="object"&&e.constructor===Object?o[t]=Ju(e):o[t]=e);return o}function JS(n,o){for(;n!==null;){let e=c9e(n,o);if(e){if(e.get)return Qa(e.get);if(typeof e.value=="function")return Qa(e.value)}n=l9e(n)}function t(){return null}return t}var Sse=Xa(["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","section","select","shadow","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"]),D$=Xa(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),w$=Xa(["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"]),f9e=Xa(["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"]),O$=Xa(["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"]),v9e=Xa(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bse=Xa(["#text"]),Ise=Xa(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),A$=Xa(["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","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"]),Ese=Xa(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","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"]),zP=Xa(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),C9e=El(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_9e=El(/<%[\w\W]*|[\w\W]*%>/gm),y9e=El(/\$\{[\w\W]*/gm),S9e=El(/^data-[\-\w.\u00B7-\uFFFF]+$/),b9e=El(/^aria-[\-\w]+$/),Ose=El(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),I9e=El(/^(?:\w+script|data):/i),E9e=El(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ase=El(/^html$/i),x9e=El(/^[a-z][.\w]*(-[.\w]+)+$/i),xse=Object.freeze({__proto__:null,ARIA_ATTR:b9e,ATTR_WHITESPACE:E9e,CUSTOM_ELEMENT:x9e,DATA_ATTR:S9e,DOCTYPE_NAME:Ase,ERB_EXPR:_9e,IS_ALLOWED_URI:Ose,IS_SCRIPT_OR_DATA:I9e,MUSTACHE_EXPR:C9e,TMPLIT_EXPR:y9e}),eb={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},T9e=function(){return typeof window>"u"?null:window},D9e=function(o,t){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let e=null,i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(e=t.getAttribute(i));let r="dompurify"+(e?"#"+e:"");try{return o.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Tse=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Pse(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T9e(),o=Yt=>Pse(Yt);if(o.version="3.2.5",o.removed=[],!n||!n.document||n.document.nodeType!==eb.document||!n.Element)return o.isSupported=!1,o;let{document:t}=n,e=t,i=e.currentScript,{DocumentFragment:r,HTMLTemplateElement:a,Node:s,Element:c,NodeFilter:p,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:C,DOMParser:E,trustedTypes:D}=n,L=c.prototype,$=JS(L,"cloneNode"),Y=JS(L,"remove"),ce=JS(L,"nextSibling"),Ce=JS(L,"childNodes"),Ie=JS(L,"parentNode");if(typeof a=="function"){let Yt=t.createElement("template");Yt.content&&Yt.content.ownerDocument&&(t=Yt.content.ownerDocument)}let $e,Ye="",{implementation:Re,createNodeIterator:_e,createDocumentFragment:Ee,getElementsByTagName:Oe}=t,{importNode:ye}=e,he=Tse();o.isSupported=typeof Dse=="function"&&typeof Ie=="function"&&Re&&Re.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:xe,TMPLIT_EXPR:Tn,DATA_ATTR:Ht,ARIA_ATTR:ut,IS_SCRIPT_OR_DATA:wt,ATTR_WHITESPACE:At,CUSTOM_ELEMENT:sn}=xse,{IS_ALLOWED_URI:to}=xse,oi=null,Ri=ni({},[...Sse,...D$,...w$,...O$,...bse]),pn=null,Ci=ni({},[...Ise,...A$,...Ese,...zP]),Ni=Object.seal(wse(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}})),jm=null,uo=null,Qs=!0,$r=!0,Js=!1,Ml=!0,Dc=!1,pg=!0,kl=!1,gg=!1,ph=!1,$m=!1,gh=!1,ug=!1,i_=!0,uh=!1,ND="user-content-",o_=!0,Hm=!1,wc={},Oc=null,wr=ni({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Hr=null,hg=ni({},["audio","video","img","source","image","track"]),hh=null,r_=ni({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fh="http://www.w3.org/1998/Math/MathML",Ac="http://www.w3.org/2000/svg",el="http://www.w3.org/1999/xhtml",zm=el,fg=!1,a_=null,N9=ni({},[fh,Ac,el],T$),Ld=ni({},["mi","mo","mn","ms","mtext"]),vg=ni({},["annotation-xml"]),FD=ni({},["title","style","font","a","script"]),Rl=null,s_=["application/xhtml+xml","text/html"],l_="text/html",ho=null,Gm=null,vh=t.createElement("form"),c_=function(Be){return Be instanceof RegExp||Be instanceof Function},Wm=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Gm&&Gm===Be)){if((!Be||typeof Be!="object")&&(Be={}),Be=Ju(Be),Rl=s_.indexOf(Be.PARSER_MEDIA_TYPE)===-1?l_:Be.PARSER_MEDIA_TYPE,ho=Rl==="application/xhtml+xml"?T$:GP,oi=Sc(Be,"ALLOWED_TAGS")?ni({},Be.ALLOWED_TAGS,ho):Ri,pn=Sc(Be,"ALLOWED_ATTR")?ni({},Be.ALLOWED_ATTR,ho):Ci,a_=Sc(Be,"ALLOWED_NAMESPACES")?ni({},Be.ALLOWED_NAMESPACES,T$):N9,hh=Sc(Be,"ADD_URI_SAFE_ATTR")?ni(Ju(r_),Be.ADD_URI_SAFE_ATTR,ho):r_,Hr=Sc(Be,"ADD_DATA_URI_TAGS")?ni(Ju(hg),Be.ADD_DATA_URI_TAGS,ho):hg,Oc=Sc(Be,"FORBID_CONTENTS")?ni({},Be.FORBID_CONTENTS,ho):wr,jm=Sc(Be,"FORBID_TAGS")?ni({},Be.FORBID_TAGS,ho):{},uo=Sc(Be,"FORBID_ATTR")?ni({},Be.FORBID_ATTR,ho):{},wc=Sc(Be,"USE_PROFILES")?Be.USE_PROFILES:!1,Qs=Be.ALLOW_ARIA_ATTR!==!1,$r=Be.ALLOW_DATA_ATTR!==!1,Js=Be.ALLOW_UNKNOWN_PROTOCOLS||!1,Ml=Be.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Dc=Be.SAFE_FOR_TEMPLATES||!1,pg=Be.SAFE_FOR_XML!==!1,kl=Be.WHOLE_DOCUMENT||!1,$m=Be.RETURN_DOM||!1,gh=Be.RETURN_DOM_FRAGMENT||!1,ug=Be.RETURN_TRUSTED_TYPE||!1,ph=Be.FORCE_BODY||!1,i_=Be.SANITIZE_DOM!==!1,uh=Be.SANITIZE_NAMED_PROPS||!1,o_=Be.KEEP_CONTENT!==!1,Hm=Be.IN_PLACE||!1,to=Be.ALLOWED_URI_REGEXP||Ose,zm=Be.NAMESPACE||el,Ld=Be.MATHML_TEXT_INTEGRATION_POINTS||Ld,vg=Be.HTML_INTEGRATION_POINTS||vg,Ni=Be.CUSTOM_ELEMENT_HANDLING||{},Be.CUSTOM_ELEMENT_HANDLING&&c_(Be.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ni.tagNameCheck=Be.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Be.CUSTOM_ELEMENT_HANDLING&&c_(Be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ni.attributeNameCheck=Be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Be.CUSTOM_ELEMENT_HANDLING&&typeof Be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ni.allowCustomizedBuiltInElements=Be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Dc&&($r=!1),gh&&($m=!0),wc&&(oi=ni({},bse),pn=[],wc.html===!0&&(ni(oi,Sse),ni(pn,Ise)),wc.svg===!0&&(ni(oi,D$),ni(pn,A$),ni(pn,zP)),wc.svgFilters===!0&&(ni(oi,w$),ni(pn,A$),ni(pn,zP)),wc.mathMl===!0&&(ni(oi,O$),ni(pn,Ese),ni(pn,zP))),Be.ADD_TAGS&&(oi===Ri&&(oi=Ju(oi)),ni(oi,Be.ADD_TAGS,ho)),Be.ADD_ATTR&&(pn===Ci&&(pn=Ju(pn)),ni(pn,Be.ADD_ATTR,ho)),Be.ADD_URI_SAFE_ATTR&&ni(hh,Be.ADD_URI_SAFE_ATTR,ho),Be.FORBID_CONTENTS&&(Oc===wr&&(Oc=Ju(Oc)),ni(Oc,Be.FORBID_CONTENTS,ho)),o_&&(oi["#text"]=!0),kl&&ni(oi,["html","head","body"]),oi.table&&(ni(oi,["tbody"]),delete jm.tbody),Be.TRUSTED_TYPES_POLICY){if(typeof Be.TRUSTED_TYPES_POLICY.createHTML!="function")throw QS('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Be.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw QS('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');$e=Be.TRUSTED_TYPES_POLICY,Ye=$e.createHTML("")}else $e===void 0&&($e=D9e(D,i)),$e!==null&&typeof Ye=="string"&&(Ye=$e.createHTML(""));Xa&&Xa(Be),Gm=Be}},m_=ni({},[...D$,...w$,...f9e]),zr=ni({},[...O$,...v9e]),LD=function(Be){let St=Ie(Be);(!St||!St.tagName)&&(St={namespaceURI:zm,tagName:"template"});let Gt=GP(Be.tagName),no=GP(St.tagName);return a_[Be.namespaceURI]?Be.namespaceURI===Ac?St.namespaceURI===el?Gt==="svg":St.namespaceURI===fh?Gt==="svg"&&(no==="annotation-xml"||Ld[no]):!!m_[Gt]:Be.namespaceURI===fh?St.namespaceURI===el?Gt==="math":St.namespaceURI===Ac?Gt==="math"&&vg[no]:!!zr[Gt]:Be.namespaceURI===el?St.namespaceURI===Ac&&!vg[no]||St.namespaceURI===fh&&!Ld[no]?!1:!zr[Gt]&&(FD[Gt]||!m_[Gt]):!!(Rl==="application/xhtml+xml"&&a_[Be.namespaceURI]):!1},Ca=function(Be){ZS(o.removed,{element:Be});try{Ie(Be).removeChild(Be)}catch{Y(Be)}},Pc=function(Be,St){try{ZS(o.removed,{attribute:St.getAttributeNode(Be),from:St})}catch{ZS(o.removed,{attribute:null,from:St})}if(St.removeAttribute(Be),Be==="is")if($m||gh)try{Ca(St)}catch{}else try{St.setAttribute(Be,"")}catch{}},BD=function(Be){let St=null,Gt=null;if(ph)Be="<remove></remove>"+Be;else{let Ar=yse(Be,/^[\r\n\t ]+/);Gt=Ar&&Ar[0]}Rl==="application/xhtml+xml"&&zm===el&&(Be='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Be+"</body></html>");let no=$e?$e.createHTML(Be):Be;if(zm===el)try{St=new E().parseFromString(no,Rl)}catch{}if(!St||!St.documentElement){St=Re.createDocument(zm,"template",null);try{St.documentElement.innerHTML=fg?Ye:no}catch{}}let Or=St.body||St.documentElement;return Be&&Gt&&Or.insertBefore(t.createTextNode(Gt),Or.childNodes[0]||null),zm===el?Oe.call(St,kl?"html":"body")[0]:kl?St.documentElement:Or},VD=function(Be){return _e.call(Be.ownerDocument||Be,Be,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Mc=function(Be){return Be instanceof C&&(typeof Be.nodeName!="string"||typeof Be.textContent!="string"||typeof Be.removeChild!="function"||!(Be.attributes instanceof u)||typeof Be.removeAttribute!="function"||typeof Be.setAttribute!="function"||typeof Be.namespaceURI!="string"||typeof Be.insertBefore!="function"||typeof Be.hasChildNodes!="function")},UD=function(Be){return typeof s=="function"&&Be instanceof s};function Nl(Yt,Be,St){HP(Yt,Gt=>{Gt.call(o,Be,St,Gm)})}let Cg=function(Be){let St=null;if(Nl(he.beforeSanitizeElements,Be,null),Mc(Be))return Ca(Be),!0;let Gt=ho(Be.nodeName);if(Nl(he.uponSanitizeElement,Be,{tagName:Gt,allowedTags:oi}),Be.hasChildNodes()&&!UD(Be.firstElementChild)&&Za(/<[/\w!]/g,Be.innerHTML)&&Za(/<[/\w!]/g,Be.textContent)||Be.nodeType===eb.progressingInstruction||pg&&Be.nodeType===eb.comment&&Za(/<[/\w]/g,Be.data))return Ca(Be),!0;if(!oi[Gt]||jm[Gt]){if(!jm[Gt]&&Ch(Gt)&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Gt)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Gt)))return!1;if(o_&&!Oc[Gt]){let no=Ie(Be)||Be.parentNode,Or=Ce(Be)||Be.childNodes;if(Or&&no){let Ar=Or.length;for(let Pr=Ar-1;Pr>=0;--Pr){let Ds=$(Or[Pr],!0);Ds.__removalCount=(Be.__removalCount||0)+1,no.insertBefore(Ds,ce(Be))}}}return Ca(Be),!0}return Be instanceof c&&!LD(Be)||(Gt==="noscript"||Gt==="noembed"||Gt==="noframes")&&Za(/<\/no(script|embed|frames)/i,Be.innerHTML)?(Ca(Be),!0):(Dc&&Be.nodeType===eb.text&&(St=Be.textContent,HP([Le,xe,Tn],no=>{St=XS(St,no," ")}),Be.textContent!==St&&(ZS(o.removed,{element:Be.cloneNode()}),Be.textContent=St)),Nl(he.afterSanitizeElements,Be,null),!1)},d_=function(Be,St,Gt){if(i_&&(St==="id"||St==="name")&&(Gt in t||Gt in vh))return!1;if(!($r&&!uo[St]&&Za(Ht,St))){if(!(Qs&&Za(ut,St))){if(!pn[St]||uo[St]){if(!(Ch(Be)&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Be)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Be))&&(Ni.attributeNameCheck instanceof RegExp&&Za(Ni.attributeNameCheck,St)||Ni.attributeNameCheck instanceof Function&&Ni.attributeNameCheck(St))||St==="is"&&Ni.allowCustomizedBuiltInElements&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Gt)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Gt))))return!1}else if(!hh[St]){if(!Za(to,XS(Gt,At,""))){if(!((St==="src"||St==="xlink:href"||St==="href")&&Be!=="script"&&p9e(Gt,"data:")===0&&Hr[Be])){if(!(Js&&!Za(wt,XS(Gt,At,"")))){if(Gt)return!1}}}}}}return!0},Ch=function(Be){return Be!=="annotation-xml"&&yse(Be,sn)},_g=function(Be){Nl(he.beforeSanitizeAttributes,Be,null);let{attributes:St}=Be;if(!St||Mc(Be))return;let Gt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pn,forceKeepAttr:void 0},no=St.length;for(;no--;){let Or=St[no],{name:Ar,namespaceURI:Pr,value:Ds}=Or,qm=ho(Ar),or=Ar==="value"?Ds:g9e(Ds);if(Gt.attrName=qm,Gt.attrValue=or,Gt.keepAttr=!0,Gt.forceKeepAttr=void 0,Nl(he.uponSanitizeAttribute,Be,Gt),or=Gt.attrValue,uh&&(qm==="id"||qm==="name")&&(Pc(Ar,Be),or=ND+or),pg&&Za(/((--!?|])>)|<\/(style|title)/i,or)){Pc(Ar,Be);continue}if(Gt.forceKeepAttr||(Pc(Ar,Be),!Gt.keepAttr))continue;if(!Ml&&Za(/\/>/i,or)){Pc(Ar,Be);continue}Dc&&HP([Le,xe,Tn],_h=>{or=XS(or,_h," ")});let Rc=ho(Be.nodeName);if(d_(Rc,qm,or)){if($e&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Pr)switch(D.getAttributeType(Rc,qm)){case"TrustedHTML":{or=$e.createHTML(or);break}case"TrustedScriptURL":{or=$e.createScriptURL(or);break}}try{Pr?Be.setAttributeNS(Pr,Ar,or):Be.setAttribute(Ar,or),Mc(Be)?Ca(Be):_se(o.removed)}catch{}}}Nl(he.afterSanitizeAttributes,Be,null)},kc=function Yt(Be){let St=null,Gt=VD(Be);for(Nl(he.beforeSanitizeShadowDOM,Be,null);St=Gt.nextNode();)Nl(he.uponSanitizeShadowNode,St,null),Cg(St),_g(St),St.content instanceof r&&Yt(St.content);Nl(he.afterSanitizeShadowDOM,Be,null)};return o.sanitize=function(Yt){let Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},St=null,Gt=null,no=null,Or=null;if(fg=!Yt,fg&&(Yt="<!-->"),typeof Yt!="string"&&!UD(Yt))if(typeof Yt.toString=="function"){if(Yt=Yt.toString(),typeof Yt!="string")throw QS("dirty is not a string, aborting")}else throw QS("toString is not a function");if(!o.isSupported)return Yt;if(gg||Wm(Be),o.removed=[],typeof Yt=="string"&&(Hm=!1),Hm){if(Yt.nodeName){let Ds=ho(Yt.nodeName);if(!oi[Ds]||jm[Ds])throw QS("root node is forbidden and cannot be sanitized in-place")}}else if(Yt instanceof s)St=BD("<!---->"),Gt=St.ownerDocument.importNode(Yt,!0),Gt.nodeType===eb.element&&Gt.nodeName==="BODY"||Gt.nodeName==="HTML"?St=Gt:St.appendChild(Gt);else{if(!$m&&!Dc&&!kl&&Yt.indexOf("<")===-1)return $e&&ug?$e.createHTML(Yt):Yt;if(St=BD(Yt),!St)return $m?null:ug?Ye:""}St&&ph&&Ca(St.firstChild);let Ar=VD(Hm?Yt:St);for(;no=Ar.nextNode();)Cg(no),_g(no),no.content instanceof r&&kc(no.content);if(Hm)return Yt;if($m){if(gh)for(Or=Ee.call(St.ownerDocument);St.firstChild;)Or.appendChild(St.firstChild);else Or=St;return(pn.shadowroot||pn.shadowrootmode)&&(Or=ye.call(e,Or,!0)),Or}let Pr=kl?St.outerHTML:St.innerHTML;return kl&&oi["!doctype"]&&St.ownerDocument&&St.ownerDocument.doctype&&St.ownerDocument.doctype.name&&Za(Ase,St.ownerDocument.doctype.name)&&(Pr="<!DOCTYPE "+St.ownerDocument.doctype.name+`>
195
- `+Pr),Dc&&HP([Le,xe,Tn],Ds=>{Pr=XS(Pr,Ds," ")}),$e&&ug?$e.createHTML(Pr):Pr},o.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wm(Yt),gg=!0},o.clearConfig=function(){Gm=null,gg=!1},o.isValidAttribute=function(Yt,Be,St){Gm||Wm({});let Gt=ho(Yt),no=ho(Be);return d_(Gt,no,St)},o.addHook=function(Yt,Be){typeof Be=="function"&&ZS(he[Yt],Be)},o.removeHook=function(Yt,Be){if(Be!==void 0){let St=m9e(he[Yt],Be);return St===-1?void 0:d9e(he[Yt],St,1)[0]}return _se(he[Yt])},o.removeHooks=function(Yt){he[Yt]=[]},o.removeAllHooks=function(){he=Tse()},o}var k$=Pse();var Mse={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Fe=(()=>{let o=class o{constructor(e,i,r){this.rendererFactory2=e,this.loggingService=i,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new Xe,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new Xe,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new ei),this.customCss$=new ve(null),this.mutationObserver=null,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.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(c=>{if(!zi(c))if(c instanceof HTMLElement){if(c.className.includes("cdk-overlay-container")||c.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(c.className.includes("cdk-overlay")){let p=!1;c.childNodes.forEach(u=>{zi(u)&&(p=!0)}),p||s.push(c)}else s.push(c)}else s.push(c)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new ve(a),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ai(),gn(([s,c])=>{try{let p=c.filter(C=>!s.includes(C)),u=s.filter(C=>!c.includes(C));u.length&&u.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?foe("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):voe("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(me(e=>{e?(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.onDocumentClick(),this.onDocumentFocus()):(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.unsubscribeFromDocumentClick(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}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(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=i.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let u=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(u!==null&&u!==""){let C=this.xpathCacheId.get(u);C!==void 0&&(this.xpathCacheId.delete(u),this.xpathCache.delete(C))}}}),zi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...i.filter(a=>a.type==="attributes").filter(a=>!zi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&xo(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{oo(ri(window,"offline").pipe(me(()=>!1)),ri(window,"online").pipe(me(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let i=this.calculateScreenSize();this.deviceInfo$.next(new ei),this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let i=this.calculateScreenSize();this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return ri(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Dg}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let i=this.getXPath(e.target),r=e.target;if(i?.includes("name()='svg'")){let C=this.getXPath(i);C&&(r=C.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),u=c*100/(a.height||1);this.currentMousePosition.element={xpath:i,topPercentage:u,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(e,i=!0,r=!1,a=!0,s){try{let c=e,p=c?.touches?.length?c.touches[0]?.clientX:c.clientX,u=c?.touches?.length?c.touches[0]?.clientY:c.clientY,C=this.getBackgroundElement(p,u,i,r);if(C&&s&&typeof s=="function"&&(C=s(C)),C){let E=this.getXPath(C),D=this.getXPath(C,!0),L=C.getBoundingClientRect(),$=p-L.x,Y=u-L.y,ce=$*100/(L.width||1),Ce=Y*100/(L.height||1),Ie={xpath:E,fXpath:D,leftPercentage:ce,topPercentage:Ce};if(a){let $e=this.getXPath(C,!0,!0);Ie.cfXpath=$e}return Ie}else return null}catch(c){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",c),null}}getBackgroundElement(e,i,r=!0,a=!1){try{let s=document.elementsFromPoint(e,i),c=[];s.forEach(u=>{zi(u)?c=[]:xo(u)&&c.push(u)}),a&&(c=c.filter(u=>this.isElementVisibleOnScreen(u)));let p=0;return r||c?.forEach((u,C)=>{u.tagName.toLowerCase()==="svg"&&(p=C)}),c[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,i){try{let r=document.elementsFromPoint(e,i),a=[];return r.forEach(s=>{zi(s)&&xo(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(e){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 e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||e.x+200,r=Math.min(i,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}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(e,i,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),i&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",i,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,i,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,i),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,i=!1,r=!1,a){try{let s=this.calculateXPath(e,i,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let c=s.split("/"),p=!1;c.forEach((u,C)=>{u.includes("svg")&&(p=!0),p&&(c[C]="svg:"+u)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,i,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!i)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,i,r,a)+"/"+e.tagName.toLowerCase(),u=Array.from(e.parentNode?.children||[]).filter(C=>C.nodeType===1&&C.tagName===e.tagName?C.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===c:!1);if(u.length>1){let C=u.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${C}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,i,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,i=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,i);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=On();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[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 r=new GS;return r.screenWidth=Math.max(...i),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new GS}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),u;for(;u=p.nextNode();)u?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),e}}mergeAdjacentTextNodes(e){try{let i=e.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let r=i.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)i.textContent+=r.textContent,r.remove(),r=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(e){try{for(let i=e.length-1;i>=0;i--){if(e[i]?.scrollHeight&&e[i]?.clientHeight){let r=Math.max(e[i]?.scrollHeight,e[i]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[i]}e[i]?.childNodes?.length&&this.findLongestNode(e[i]?.childNodes)}}catch(i){this.loggingService.catch("Error in DomService findLongestNode: ",i)}}resetSelectedAnnotationsMap(e=!0,i){try{let r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(C=>C.classList.contains("velt-annotation-draft-checked")?(C.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(C,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(C,"velt-comment-dialog-shake"),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||C.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(C,"velt-annotation-draft-checked")},100),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(C=>C),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let C=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||C.push(D)}else p[E]?.comments?.length||s.includes(E)||C.push(p[E])}),this.deleteAnnotations$.next(C),this.deleteAnnotations$.next([])}let u={};Object.keys(p).forEach(C=>{if(s.includes(C)&&(u[C]=p[C]),i)switch(i){case"comment":["comment","videoPin"].includes(p[C]?.type)||(u[C]=p[C]);break;default:p[C]?.type!==i&&(u[C]=p[C]);break}}),Object.keys(u).forEach(C=>{let E=u[C]?.multiThreadAnnotationId;E&&!u[E]&&(u[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(u)&&this.selectedAnnotationsMap$.next(u),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,i){try{if(i)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:i}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let i=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(i).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(i[a].type)&&(r[a]=i[a]);break;default:i[a].type===e&&(r[a]=i[a]);break}}),r}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(me(i=>{if(e){let r={};return Object.keys(i).forEach(a=>{i[a].type===e&&(r[a]=i[a])}),r}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(me(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,i,r,a=!1){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),c=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));if(s[e.annotationId]&&!a)delete s[e.annotationId];else{(!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,c[e.annotationId]=i;let p=e?.multiThreadAnnotationId;p&&(s[p]={annotationId:p,type:"multiThread"},c[p]=i)}this.selectedAnnotationsMap$.next(s),Object.keys(c).forEach(p=>{s[p]||delete c[p]}),this.selectedAnnotationsLocationMap$.next(c)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,i){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==i&&(r[e]=i,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let i=this.selectedAnnotationsMap$.value;e.forEach(r=>{i[r.annotationId]&&(i[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}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$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,i){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===i){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==i)if(e?.closest("svg"))for(;a&&a!==i;){let c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let u=p.getBoundingClientRect(),C=a.getBoundingClientRect();r.offsetLeft+=C.left-u.left,r.offsetTop+=C.top-u.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===i){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:i,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return i>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let i=e,r=window.getComputedStyle(i);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let i=ri(document,"mousedown").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=ri(document,"mousemove").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=ri(document,"mouseup").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=i.pipe(ue(p=>r.pipe(Ai(),me(([u,C])=>({startPoint:p,prevPoint:u,curPoint:C})),ro(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,i){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(i.x-e.x),s=Math.abs(i.y-e.y),c=Math.min(e.x,i.x),p=Math.min(e.y,i.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),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(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let i={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),i.commonAncestorContainer=this.getTextXPath(a),i.commonAncestorContainer){let c=this.getElementFromXPath(i.commonAncestorContainer);c&&(i.commonAncestorContainerFXpath=this.getXPath(c,!0),i.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0))}return i.text=e.toString(),i.occurrence=Lu(a,0,e.startContainer,e.startOffset,e.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let i=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&i++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(e){try{if(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let i=e.closest("svg");return i?i?.parentElement:e}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:e,elementClassNames:i,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let c=document.getElementById(e[s]);c&&a.push(c)}if(i?.length)for(let s=0;s<i.length;s++){let c=document.getElementsByClassName(i[s]);for(let p=0;p<c.length;p++){let u=c[p];u&&u instanceof HTMLElement&&a.push(u)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let u=c[p];u&&u instanceof HTMLElement&&a.push(u)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementById(i[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementsByClassName(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.querySelectorAll(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(i)||e.classList?.add(i))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(i)&&e.classList?.remove(i)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,i,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(i)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}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(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),i?.type==="link"){let a=document.createElement("link");a.href=i?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(i?.value),a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}trimCommentHtml(e){try{let i=document.createElement("div");i.innerHTML=e,this.removeEmptyElements(i);let r=i.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var i=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.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(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),k$.sanitize(e,Mse)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeSvg(e){try{return k$.sanitize(e,Mse)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ei;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new ei)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),i=this.getTabIdFromWindowName();return(!e||e!==i)&&(e=On(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}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(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new ei}}isMobileDevice(){try{return new ei().getDeviceType()===Qo.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ei().getDeviceType()===Qo.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ei().getDeviceType()===Qo.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var i=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{i.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(r.nodeValue))}),i}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let i=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",i)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new ei().getDeviceType()===Qo.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?:&nbsp;\s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?:&nbsp;\s*)+|(?:&nbsp;\s*)+$/g,o.\u0275fac=function(i){return new(i||o)(Q(Ko),Q(y),Q(Ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var je=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.afAuth=e,this.configService=i,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=u,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Do,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(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.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(C=>{this.config=C}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=qn(this.afAuth).pipe(qo(this.afAuth.currentUser),Ai(),ue(([C,E])=>this.domService.onNetworkStatusChange$().pipe(Ne(D=>D),et(1),me(()=>({previousUser:C,currentUser:E}))))).subscribe(D=>ee(this,[D],function*({previousUser:C,currentUser:E}){if(!E&&C){let L=C?.stsTokenManager?.expirationTime,$=new Date().getTime(),Y=L-$;$>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&C?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.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:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),C=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",C)}),this.getUser$().pipe(qt(Vi)).subscribe(C=>{let E=ha(C);this.coreActionsService.triggerAction($o.USER_UPDATE,E)})}catch(C){this.loggingService.catch("Error in AuthService constructor: ",C)}}setApiKey(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),i||(i=new TP),this.configService.initConfig(i),i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||qn(this.afAuth).pipe(et(1)).subscribe(r=>ee(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Cd(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(i){this.loggingService.catch("Error in setAreaService: ",i)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(i){this.loggingService.catch("Error in setReactionService: ",i)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(i){this.loggingService.catch("Error in setRecorderAnnotationService: ",i)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(i){this.loggingService.catch("Error in setViewsService: ",i)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.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")}initializeClient(e,i,r,a,s){return ee(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=um(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield qn(this.afAuth).pipe(et(1)).toPromise().catch(u=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let u=yield Cd(c,!0).catch(D=>null);if(!u)return;let{user:C,firebaseConfig:E}=u.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==C?.groupId||e?.organizationId!==C?.organizationId||i?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Cd(c,!0).catch(ce=>null);if(!D)return;let{firebaseConfig:L,user:$,advancedQueries:Y}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(Y),$&&(this.providedUser.isAdmin=!!$.isAdmin),this.initializeSignedInUser(c,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId);let u=yr(this.functions,br({url:Xn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),C=ga(),E=(yield u({apiKey:this.apiKey,user:e,version:C,authToken:i?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId),E.error&&typeof E.error=="string"&&E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired"};this.coreActionsService.triggerAction($o.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries."};this.coreActionsService.triggerAction($o.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId)}throw E.error}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Cd(this.afAuth.currentUser,!0).catch(Y=>null);if(!D)return;let{user:L,advancedQueries:$}=D.claims;this.setAdvancedQueries($),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:i,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let i=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(i&&e.organizationId&&!r)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForRegion(e,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!i?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},Xn.firebaseConfig),e)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}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 Mn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(me(()=>this.getAdvancedQueriesEnabled()),Vn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),qn(this.afAuth).pipe(ue(e=>e?this.user$.asObservable():se(null)))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(e.userId&&e.userId!==i?.userId||e?.groupId&&e?.groupId!==i?.groupId||e?.organizationId&&e?.organizationId!==i?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=I(I({},this.providedUser),e),i){let r=I(I({},i),e);this.updateUserInternally(r)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(e,i,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return UQ(this.afAuth,i).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new Do;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,i)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers([e.userId]);a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?r?.color:this.providedUser?.color||this.avatarService.generateUserColor(Cn(e.userId)),e.textColor=r?r?.textColor:this.providedUser?.textColor||"#FFFFFF",e.initial=r?r?.initial:this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},e);delete i.contacts,this.analyticsService.identifyUser(e.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||(yield this.getPlanDetailsFromDb()),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(e)),r=T(I({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return ee(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yr(this.functions,br({url:Xn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.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(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Ne(e=>!!e),me(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,i){try{this.preSignOutFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(i.metadata=e,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(e){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=e,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(ue(e=>e?this.userOrganization$.asObservable().pipe(me(i=>i?.metadata?.organizationId===e.organizationId?i:null)):se(null)))}signOutUser(e="internal"){return ee(this,null,function*(){try{yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let i=yield qn(this.afAuth).pipe(et(1)).toPromise().catch(r=>null);if(i){this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(i)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.resetServicesCache(),this.user$.next(null),jQ(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}})}isFeatureAllowed(e){return Ji(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let i=JSON.parse(JSON.stringify(e));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForClient(e){try{return ha(e)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(Q(Si),Q(jt),Q(Im),Q(Em),Q(Fe),Q(Uo),Q(Ke),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xm=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.clientDocumentId=i,this.clientOrganizationId=r,i&&(this.documentId=pc(i)),r&&(this.organizationId=gc(r)),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.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}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 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 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(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var WP=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.veltFolderId=s,i&&(this.documentId=pc(i)),r&&(this.organizationId=gc(r)),a&&(this.folderId=a,this.veltFolderId=yl(a)),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 o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}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 commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews 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.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var qP=class{};var un=(()=>{let o=class o{constructor(e,i){this.authService=e,this.loggingService=i,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(Lf(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Is=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*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 ve(null),this.commentAnnotationById$=new ve({}),this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((c,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),c({});let C={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});ee(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let $=hc(()=>u?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield $)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let Y={};Object.entries(C).forEach(([ce,Ce])=>{let Ie=this.commentAnnotationById$.value?.[ce];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(Ce)&&(Y[ce]=Ce):Y[ce]=Ce}),Object.keys(Y).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),Y)),c(Y)}catch(Y){r||p(Y),c(C)}}else s(),c({})}catch($){s(),p($)}})})}catch(i){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",i),{}}})}saveCommentAnnotation(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let i=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield hc(()=>i?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let c=yield hc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:i,event:qa.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{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()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Tm=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*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 ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((c,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),c({});let C={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});ee(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let $=hc(()=>u?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield $)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let Y={};Object.entries(C).forEach(([ce,Ce])=>{let Ie=this.reactionAnnotationById$.value?.[ce];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(Ce)&&(Y[ce]=Ce):Y[ce]=Ce}),Object.keys(Y).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),Y)),c(Y)}catch(Y){r||p(Y),c(C)}}else s(),c({})}catch($){s(),p($)}})})}catch(i){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",i),{}}})}saveReactionAnnotation(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let i=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:qa.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield hc(()=>i?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let c=yield hc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:i,event:qa.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{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()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var lt=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C){this.analyticsService=e,this.authService=i,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=u,this.coreActionsService=C,this.documentPaths$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocumentId=null,this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Xe,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,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.setDocumentIdSubject.pipe(rr(this.DEBOUNCE_TIME)).subscribe({next:E=>ee(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations&&(yield this.setLocations(this.draftLocationMap.locations,this.draftLocationMap.options)),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Ne(E=>!!E),et(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=f6(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>{E?(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),this.draftDocumentId?(this.setDocuments([{id:this.draftDocumentId,metadata:{organizationId:this.draftOrganizationId}}],this.draftOptions??void 0),this.draftDocumentId=null,this.draftLocationMap.locations&&this.setLocations(this.draftLocationMap.locations,this.draftLocationMap.options).then(()=>this.draftLocationMap={locations:[],options:void 0}),this.draftOrganizationId=void 0,this.draftOptions=void 0):this.documentPaths$?.value&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&this.setDocuments([{id:this.documentPaths$.value?.clientDocumentId,metadata:{organizationId:E?.organizationId}}]),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),E?.organizationId&&E?.clientOrganizationId&&this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId})):(this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftDocumentId=this.documentPaths$.value?.clientDocumentId??null,this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(D=>D.location)].filter(D=>D!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)))}),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.organizationConfig$.subscribe(E=>{E&&this.updateOrganizationMetadata()}),this.documentPaths$.pipe(Ne(E=>!!E),et(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId}}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.unsetDocuments("internal")}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setCommentService(e){try{this.commentService=e}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 e=f6(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=f6(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(e,i,r){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",payload:{documentId:e,documentMetadata:i,options:r}}),yield this.setDocumentsImpl([{id:e,metadata:i}],I({organizationId:i?.organizationId},r??{}))}catch(a){this.loggingService.catch("Error in DocService setDocument:",a)}})}shouldSetDocumentsAgain(e,i={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentIds$.value.map(c=>c.clientDocumentId),a=this.getOptionsFromDocumentPaths()??{};return!e.every(c=>r.includes(c.id))||!_o(a,i)}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:i=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,c=`${Cn(s)}`;i&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",payload:{documents:e,options:i}}),yield this.setDocumentsImpl(e,i)}catch(r){this.loggingService.catch("Error in DocService setDocuments:",r)}})}setDocumentsImpl(e,i){return ee(this,null,function*(){try{if(!this.shouldSetDocumentsAgain(e,i)){this.loggingService.warn("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.organizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments("internal",!1);let r=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(r?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}this.documentIds$.next(r),e?.length&&(yield this.debounceSetDocuments({documentId:e[0]?.id,clientOrganizationId:i?.organizationId}));return}catch(r){this.loggingService.catch("Error in DocService setDocumentsImpl:",r)}})}setDocumentId(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",payload:{documentId:e,clientOrganizationId:i}}),yield this.setDocumentsImpl([{id:e,metadata:{organizationId:i}}])}catch(r){this.loggingService.catch("Error in setDocumentId:",r);return}})}debounceSetDocuments(a){return ee(this,arguments,function*({documentId:e,clientOrganizationId:i,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,i,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:i,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,i,r){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a){this.draftDocumentId=e,this.draftOrganizationId=i,this.draftOptions=r;return}this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let c=`${Cn(e)}`,p=r?.folderId,u=r?.folderId?yl(r?.folderId):void 0,C=r?.locationId,E=r?.allDocuments,D=a?.organizationId?i?Nt(i):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let L=new OP,$=new qP;L.clientDocumentId=e,$.clientDocumentId=e,L.folderId=p,$.folderId=p,L.locationId=C,$.locationId=C,L.allDocuments=E,$.allDocuments=E,L.veltFolderId=u,$.veltFolderId=u,L.documentId=c,$.documentId=c,D&&(L.organizationId=D,L.clientOrganizationId=i??a?.clientOrganizationId,$.organizationId=D,$.clientOrganizationId=i??a?.clientOrganizationId);let Y=`${this.apiKey}`,ce=`apiKey/${this.apiKey}`;D&&(Y=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,ce=`${ce}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),$.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,$.document=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,$.comment=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,$.multiThread=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,$.area=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,$.recorder=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,$.reaction=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,$.commentViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,$.notificationViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,$.documentViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,$.locationViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(L.organizationNotificationsWithDocumentId=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`),L.organizationNotificationsLastNotificationTimestamp=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),$.organizationUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,$.documentUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,$.notificationDocs=`${ce}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,$.notificationUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next($),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata()]),s&&this.location$.value&&this.removeLocation(),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.DOCUMENT_SET_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.DOCUMENT_SET_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{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.customerMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments(e="internal",i=!0){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.authService.getUser()?.organizationId){let e=this.organizationConfig$.value?.organizationId;this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(i=>{i&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:i}))}).catch(i=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}}fetchDocumentMetadata(e){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let a=i?.folderId,s=i?.allDocuments,c=[],p={organizationId:i?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)c.push(this.fetchDocuments(p));else{let C=[];for(let D=0;D<e.length;D+=20)C.push(e.slice(D,D+20));C.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map($=>$.clientDocumentId),c.push(this.fetchDocuments(L))})}let u={};c.length>0&&Promise.all(c).then(C=>{C?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(u[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),u))}).catch(C=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",C)})}else r?.[i?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}}fetchLocationMetadata(){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,i=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(c));else{let u=[];for(let E=0;E<i.length;E+=20)u.push(i.slice(E,E+20));u.forEach(E=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(u=>{u?.forEach(C=>{C?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(u=>{this.loggingService.catch("Error in fetchLocationMetadata: ",u)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}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(Vn(i=>se(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}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(me(e=>e?.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(e){try{return`${Cn(e)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(e){try{return`${Nt(e)}`}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(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocation",payload:{locations:[e],options:void 0}}),yield this.setLocationsImpl([e])}catch(i){this.loggingService.catch("Error in setLocation: ",i)}})}setLocations(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",payload:{locations:e,options:i}}),yield this.setLocationsImpl(e,i)}catch(r){this.loggingService.catch("Error in setLocations: ",r)}})}getValidLocations(e){try{let i=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&i.push(r)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return e}setLocationsImpl(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0){this.loggingService.catch("Error in setting locations, locations array is empty.");return}this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=e,this.draftLocationMap.options=i);let r=this.getValidLocations(e),a=[],s=[this.location$.value?.location.id,...Object.values(this.locations$.value).map(u=>u.location.id)].filter(u=>u!==void 0),c;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(c=r.find(u=>u.id===i?.rootLocationId),!c)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(!i?.appendLocation){c||(c=r[0]);let u=Jo(c),C=Cn(JSON.stringify(u));u.id&&!s.includes(u.id)&&a.push({locationId:C,location:u}),this.location$.next({locationId:C,location:u})}let p=[];return r.slice(1).forEach(u=>{let C=I({},u),E=this.locations$.value;u?.id&&Object.keys(E).forEach($=>{let Y=E[$];Y.location?.id===u.id&&(C=I(I({},Y.location),u),delete E?.[$])});let D=this.genarateLocationId(C),L={locationId:D,location:C};C.id&&!s.includes(C.id)&&a.push({locationId:D,location:C}),p.push(L),this.locations$.next(T(I({},E),{[D]:L}))}),yield this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.LOCATION_SET_SUCCESS,methodName:"setLocations",payload:{locations:r,options:i}}),this.analyticsService.trackEvent(X.Events.Doc.LOCATION_SET_SUCCESS,{locations:r,options:i},!0,this.getUserIdForAnalytics()),p}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}})}addLocation(e){return ee(this,null,function*(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",payload:{locations:[e],options:{appendLocation:!0}}}),yield this.setLocationsImpl([e],{appendLocation:!0})}catch(i){this.loggingService.catch("Error in DocService addLocation:",i);return}})}removeLocation(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocation",payload:{locations:[e]}}),this.removeLocationImpl([e],i)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",payload:{locations:e}}),this.removeLocationImpl(e,i)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationImpl(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}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(e){try{this.excludedLocationIds$.next([...e])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){try{if(this.db&&this.authService.getUser()?.organizationId){let e=this.documentPaths$.value,i=this.organizationConfig$.value?.organizationId;if(!this.organizationMetadata$.value?.[i]){let a=new jP;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=i,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:i,documentId:e?.documentId??""}}),this.fetchOrganizationMetadata()}}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}}updateFolderMetadata(){return ee(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 e=this.documentPaths$.value;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let i=this.getDocumentIds();i.find(a=>a.documentId===e.documentId)||i.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=i.map(a=>ee(this,null,function*(){let s=new wP;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Ii();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let u=!0,C=this.documentMetadata$.value?.[a.documentId];if(c&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==c||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),u=!1):E?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),u=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(C){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),_o(E,C)&&(u=!1)}u&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.all(r),this.fetchDocumentMetadata(i)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let r=this.getDocumentIds();r.find(a=>a.documentId===i.documentId)||r.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}});for(let c of e){let p=new kP;p.locationId=c?.locationId,p.veltLocationId=jV(c?.location?.id??""),p.location=c?.location,p.pageInfo=Ii(),p?.pageInfo?.deviceInfo&&delete p?.pageInfo?.deviceInfo;let u=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[c?.locationId]:p})}),C=T(I({},p),{metadata:I({},this.getBaseMetadata()??{})});this.commonDbService?.shouldUseFirestore()||this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??""}}),this.commonDbService?.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify(C)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",id:p.veltLocationId}});let E=this.locationMetadata$.value;if(E||(E={}),c?.location?.id){let D=E?.[a.documentId],L=D?.[c?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][c?.location?.id??""]={}),E[a.documentId][c?.location?.id??""]=T(I({},L),{location:c?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Cn(JSON.stringify(Jo(e))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(e,i="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}getLocationByClientLocationId(e){try{let i=this.getLocation()?.location;if(i?.id===e)return i;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(i=s.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,i=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];i.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?i=e:i=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),i){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}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 e={};return document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},i={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(i[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(c=>{let p=e?.[c.documentId];p&&(i[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(i[this.documentPaths$.value?.documentId]=c)}}return Object.values(i)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(me(i=>i?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(me(i=>i?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable()}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,i){try{switch(e){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(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:i}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=i||r.documentId,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,u=c?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),u?{veltFolderId:u}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,i){try{let r,a;i?.element?r=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(r=i.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,i),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:i}){try{return e&&(e=this.generateDocumentId(e)),i&&(i=this.generateOrganizationId(i)),{documentId:e,organizationId:i}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=yl(e?.folderId);r.push(dt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(dt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=yl(e?.folderId);r.push(dt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(dt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(e){return ee(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:r,documents:a}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let s=[],c=this.documentMetadata$.value;a.forEach(p=>{delete p?.organizationId,delete p?.clientDocumentId,delete p?.clientOrganizationId,delete p?.apiKey;let u=pc(p.documentId),C=c?.[u];C&&(c[u]=I(I({},C),p)),p&&this.commonDbService&&s.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(p)),properties:{organizationId:gc(r),documentId:u}}))}),yield Promise.all(s),this.documentMetadata$.next(c)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(e){return ee(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:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(C=>C.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(C=>pc(C)),p=[],u=this.locationMetadata$.value;u||(u={}),c.forEach(C=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=jV(E.id),$=u?.[C],Y=$?.[E.id];u&&($||(u[C]={}),Y||(u[C][E.id]={}),u[C][E.id]=T(I({},Y),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:gc(r),documentId:C,id:L}}))}})}),yield Promise.all(p),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let c=yl(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[dt("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(ue(e=>e?this.documentPaths$.pipe(ue(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(me(r=>r?.data?.docIamConfig??r?.data),qt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?pi.RESTRICTED:pi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:pi.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),pi.PUBLIC}}changeDocumentAccessType(e){return ee(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case pi.PUBLIC:r.features.all.restricted=!1;break;case pi.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),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(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(I(I({},this.uiState.value),e))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(un),Q(Fe),Q(jt),Q(y),Q(Is),Q(Tm),Q(Em))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zn=(()=>{let o=class o{constructor(e,i,r,a){this.analyticsService=e,this.authService=i,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>ee(this,null,function*(){return{}})},this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new cn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(c){this.loggingService.catch("Error in UsersService getUserById:",c);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}resolveUsers(e,i=!1){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;"),this.userDataProvider$.getValue()){let r={},a=[],s={};if(e?.forEach(c=>{let p=this.getUserById(c);p?r[c]=p:this.userByIdCalled$.getValue()[c]?i&&a.push(c):(a.push(c),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[c]:!0})))}),a.length>0){let c=this.userDataProvider$.getValue();if(c){let p={};try{let u,C=new Promise((E,D)=>{u=setTimeout(()=>{D(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});p=yield Promise.race([c.get(a).finally(()=>{clearTimeout(u)}),C]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:a})}catch(u){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",u,{userIds:a})}finally{a?.forEach(u=>{p[u]||(p[u]={userId:u,name:`User ${u}`})})}Object.entries(p).forEach(([u,C])=>{C&&(r[u]=p?.[u],s[u]=p?.[u])})}}return Object.keys(s).length>0&&this.userById$.next(I(I({},this.userById$.getValue()),s)),r}else return{}}catch(r){return this.loggingService.catch("Error in UsersService resolveUsers:",r),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>ee(this,null,function*(){let i=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers(i)})))}getUsersFromCentralDb(i){return ee(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e)}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(lt),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var kse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Rse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",i),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",i),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zp=class{static getFirestoreProdDbName(o,t){return t?.storeDbId??(this.isTestingDb(t?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(t){return mt.error("Error in isTestingDb:",t),!1}}};var Gp=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let i=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield hc(()=>i?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(i){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",i);return}})}deleteAttachment(r){return ee(this,arguments,function*({attachmentId:e,metadata:i}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield hc(()=>a?.delete({attachmentId:e,metadata:i,event:qa.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",i)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Yv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.notificationActionTypeMap={[Ut.NEWLY_ADDED]:qa.COMMENT_ANNOTATION_ADD,[Ut.ADDED]:qa.COMMENT_ADD,[Ut.UPDATED]:qa.COMMENT_UPDATE,[Ut.DELETED]:qa.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let r of e){if(r?.from?.userId&&i.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&i.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&i.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&i.add(s?.userId)}if(r?.assignedTo?.userId&&i.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&i.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&i.add(a.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.comments)for(let i of e?.comments){if(i?.from?.userId){let a=this.usersService.getUserById(i?.from?.userId);a&&(i.from=a)}i?.to&&(i.to=i?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(i?.taggedUserContacts?.filter((a,s,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(pm(`{{${a.userId}}}`),"g");i.commentText=i.commentText?.replaceAll(s,a.text),i.commentHtml=i.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let i=this.usersService.getUserById(e?.assignedTo?.userId);i&&(e.assignedTo=i)}if(e?.subscribedUsers)for(let i of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let i of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let i of Object.keys(e?.subscribedUsers))e.subscribedUsers[i].user={userId:e?.subscribedUsers[i].user.userId};if(e?.unsubscribedUsers)for(let i of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[i].user={userId:e?.unsubscribedUsers[i].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(i=>this.formatCommentThreadData(i))),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable();return i&&e?.comments?.forEach(a=>{let s=i?.comments?.[a?.commentId];if(s){a.commentHtml=s?.commentHtml,a.commentText=s?.commentText;let c=s?.attachments;r&&c&&a.attachments?.forEach(p=>{let u=p?.attachmentId;c?.[u]&&(p.name=c?.[u]?.name,p.url=c?.[u]?.url)})}}),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),e}}mergeLocationWithCommentAnnotations(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return r?!_o(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentAnnotationData({data:e,actionType:i}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!i)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.notificationActionTypeMap?.[i];if(!a)return{originalData:e,strippedData:null};let s={},c=null;if(e&&e.annotationId){let p=e.annotationId;if(s[p]={annotationId:p,metadata:hv(e.metadata??{}),comments:{}},e.comments?.forEach(E=>{if(E.commentId){let D;r&&(D={},E.attachments?.forEach(L=>{D[L.attachmentId]={attachmentId:L.attachmentId,name:L.name,url:L.url}})),s[p].comments[E.commentId]=I(I(I({commentId:E.commentId},E?.commentHtml&&{commentHtml:E?.commentHtml}),E?.commentText&&{commentText:E?.commentText}),D&&{attachments:D})}}),!this.isCommentsDataChanged(s[p],p))return{strippedData:null,originalData:e};let C=new ko;Object.assign(C,e),C.comments=e.comments?.map(E=>{let D=new yc;if(Object.assign(D,E),D.isCommentResolverUsed=!0,r){let L=D.attachments?.map($=>($.isAttachmentResolverUsed=!0,delete $?.name,delete $?.url,$));D.attachments=L}return delete D?.commentHtml,delete D?.commentText,D})||[],c=C}return{strippedData:s,originalData:c,eventType:a}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let i=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];i.forEach(r=>{if(r?.text){let a=new RegExp(pm(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),i.forEach(r=>{r?.text&&(r.text="")})}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),e}}handleCommentEncryption(s){return ee(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let c=d6(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:Xn.cloudFunction?.[c]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find($=>$?.commentId===D);L&&(r.targetAnnotationData=L)}}let u=zp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),C={path:i??"",data:e??{},dbId:u??"",notificationData:r||void 0,notificationURL:Xn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga()},E=yield Pp(C,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(c){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",c)}})}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn),Q(je),Q(Uo),Q(jt),Q(Is),Q(Gp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Nse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(e?.length)for(let r of e)r?.user?.userId&&i.add(r?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e=T(I({},e),{user:i}))}return e}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Fse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",i),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",i),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let i=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var KP=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",i),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",i),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",i),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",i),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",i),e}}resolveUsersFromHuddleMessages(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let i=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers(i);for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",i),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Bse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromLiveStateCustom(e){try{let i=new Set;return e?.updatedBy&&i.add(e?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let i=this.usersService.getUserById(e?.updatedBy?.userId);i&&(e.updatedBy=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let i=new Set;for(let r of e)r?.updatedBy?.userId&&i.add(r?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(e){try{let i=new Set;return e?.default?.singleEditorMode?.editor?.userId&&i.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);i&&(e.default.singleEditorMode.editor=i)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(e.default.singleEditorMode.requestEditorAccess.user=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),e}}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),e}}mergeLiveStateCustomsWithUsers(e){try{for(let i of e)if(i?.updatedBy?.userId){let r=this.usersService.getUserById(i?.updatedBy?.userId);r&&(i.updatedBy=r)}return e}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Vse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromMultiThreads(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Kv=(()=>{let o=class o{constructor(e,i,r){this.authService=e,this.loggingService=i,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId),r?.transcription?.from?.userId&&i.add(r?.transcription?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.transcription?.from?.userId){let i=this.usersService.getUserById(e?.transcription?.from?.userId);i&&(e.transcription.from=i)}return e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",i),e}}formatRecorderData(e,i){try{return e.transcription=e?.transcription?T(I({},e.transcription),{lastUpdated:i}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",i),e}}encryptRecorderAnnotation(e){return ee(this,null,function*(){try{return yield Pp(e,this.authService.getUser()?.userId??"")}catch(i){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",i);return}})}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZP=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=i,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}getUserIdsToResolveFromNotifications(e){try{let i=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&i.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let c of s)i.add(c)}break}}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=i?.comments?.[r]?.commentText,s=i?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",i),e}}mergeLocationWithNotification(e,i){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:i}=e;if(i?.actionUser?.userId){let r=this.usersService.getUserById(i?.actionUser?.userId);r&&(i.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(i.displayHeadlineMessageTemplateData.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(i.displayHeadlineMessageTemplateData.recipientUser=r)}switch(i?.notificationSource){case"comment":i?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(i?.notificationSourceData);break}return e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",i),e}}formatNotification(e,i){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,i);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let i=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&i.push(r.notification.targetAnnotationId)}),i}catch(i){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",i),[]}}handleNotificationEncryption(i){return ee(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Pp(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(i){return new(i||o)(Q(Yv),Q(Kv),Q(y),Q(zn),Q(je),Q(Is))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromPresenceUsers(e){try{let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",i),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",i),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var $se=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&i.add(a?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(a){return ee(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{let s=d6(this.authService.getFirebaseConfig()?.firebaseOptions),c=yr(this.functions,br({url:Xn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=zp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",C={path:i??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},E=yield Pp(C,u);yield c({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.reactions?.length){for(let i of e?.reactions)if(i?.from?.userId){let r=this.usersService.getUserById(i?.from?.userId);r&&(i.from=r)}}}return e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),e}}isReactionDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return r?!_o(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let i={};if(e&&e.annotationId){let r=e.annotationId;if(i[r]={annotationId:r,metadata:hv(e.metadata??{}),icon:e.icon},!this.isReactionDataChanged(i[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:i,originalData:e}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return i&&i.icon&&(e.icon=i.icon),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn),Q(je),Q(Uo),Q(jt),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Hse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromSelections(e){try{let i=new Set;for(let r of e)r?.user?.userId&&i.add(r.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e.user=i)}return e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromTags(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&i.add(a.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e?.to?.length&&(e.to=e.to.map(i=>{if(i?.userId){let r=this.usersService.getUserById(i?.userId);r&&(i=r)}return i})),e}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),e}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Zv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E,D,L,$,Y,ce,Ce,Ie,$e,Ye){this.areaUtilsService=e,this.arrowUtilsService=i,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=c,this.liveStateUtilsService=p,this.loggingService=u,this.multiThreadUtilsService=C,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=$,this.selectionUtilsService=Y,this.tagUtilsService=ce,this.usersService=Ce,this.docService=Ie,this.commentAnnotationsResolverService=$e,this.reactionAnnotationsResolverService=Ye}getFirestorePath({feature:e,properties:i,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=i;c||(c=r?.organizationId);let u=new WP({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){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"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${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"documentAccessType":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`: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 i?.documentId&&u?.documentUsers?`${u?.documentUsers}`:void 0;case"allFolderUsers":return i?.folderId&&u?.folderUsers?`${u?.folderUsers}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.organizationUsers?`${u?.organizationUsers}`:void 0;case"commentViews":return i?.documentId&&i?.id&&u?.commentViews?`${u?.commentViews}/${i?.id}`:void 0;case"allCommentViews":return i?.documentId&&u?.commentViews?`${u?.commentViews}`: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}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"allUserNotifications":return i?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:e,properties:i,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:c,organizationId:p}=i;p||(p=r?.organizationId);let u=new xm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"allComments":return!s&&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"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!s&&i?.documentId&&i?.id&&u?.comment?`${u?.comment}${i?.id}`:void 0;case"allMultiThreads":return!s&&i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"multiThread":return!s&&i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&i?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!s&&i?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocuments":return!s&&u?.docs&&i?.documentId?`${u?.docs}/${i?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&i?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!s&&i?.id&&u?.area?`${u?.area}${i?.id}`:void 0;case"documentUserAccess":return!s&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!s&&i?.documentId&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!s&&i?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!s&&i?.id&&u?.reaction?`${u?.reaction}${i?.id}`:void 0;case"allReactions":return!s&&i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!s&&i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}${i?.id}`:void 0;case"allRecorders":return!s&&i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!s&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentIam":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"commentViews":return!s&&i?.documentId&&i?.id&&u?.views?`${u?.views}comment/${i?.id}`:void 0;case"allDocumentViews":return!s&&i?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!s&&i?.documentId&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}`:void 0;case"allCommentViews":return!s&&i?.documentId&&u?.views?`${u?.views}comment/`:void 0;case"allLocationViews":return!s&&i?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&i?.id&&i?.user&&u?.views?`${u?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!s&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!s&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!s&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/location`:void 0;case"location":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!s&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!s&&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;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return ee(this,arguments,function*({data:e,feature:i}){try{if(e&&e?.length>0)switch(i){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,a)}})}formatResponse(c){return ee(this,arguments,function*({feature:e,data:i,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(i)));break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(i)));break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i)));break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(i)));break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(i)));break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(i)));break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(i)));break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers(p,a):this.usersService.resolveUsers(p,a))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(i&&typeof i=="object"){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:i,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):i;case"allArrows":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):i;case"allCursors":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):i;case"allDocNotifications":return i&&typeof i=="object"?i?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):i;case"allUserNotifications":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):i;case"allPresence":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):i;case"allRecorders":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):i;case"allHuddleAttendees":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):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((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):i;default:return i}return i}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),i}}mergeCommentAnnotationsWithData$({data:e,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(me(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(me(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:i}){try{return this.usersService.getUserById$().pipe(me(()=>{let r=this.mergeUsersWithData({feature:e,data:i?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:i?.operation??null}:{data:r,operation:i?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(i)}}mergeLocationMetadataWithData$({data:e,feature:i}){try{return this.docService.getLocationMetadata$().pipe(me(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:i,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,r),se(e)}}handleDataStripping({feature:e,data:i,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(i);default:return{originalData:i,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:i,strippedData:null}}}formatData({feature:e,data:i,properties:r,offset:a,isRealtimeDb:s}){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()+a;switch(e){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return s?i:{metadata:i};case"cursor":return this.cursorUtilsService.formatCursorUserData(i);case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":return this.arrowUtilsService.formatArrowData(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.recorderUtilsService.formatRecorderData(i,c);case"notificationViewsTimestamp":return{views:{[r.user??""]:i}};case"documentUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"documentDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"documentMetadataViews":return s?i:{metadata:i};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(i);case"locationMetadataViews":return s?i:{metadata:i};case"locationUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"locationDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"locationViews":return s?i:{location:i};case"docNotificationViews":return s?i:{views:i.views};case"userNotificationViews":return s?i:{views:i.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(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(s){return ee(this,arguments,function*({feature:e,data:i,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:i});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:i,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(i.type==="removed")return!Object.keys(r??{}).includes(i.doc.id);if(r?.[i.doc.id]){let a=i.doc.data(),s=r?.[i.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return ee(this,arguments,function*({feature:e,data:i}){try{return yield this.formatResponse({feature:e,data:i})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),i}})}addMetadata(e,i){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(I({},e),{metadata:e?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return ee(this,arguments,function*({feature:e,data:i,observablesCache:r,eventType:a,id:s,operation:c=null}){try{let C={comment:"allComments",reaction:"allReactions"}[e];if(!C)return null;let E=i?.metadata?.documentId,D=i?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(C)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let $=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&$?.data?.[s]&&(delete $?.data?.[s],r[L]?.subject&&r[L].subject.next({data:$?.data,operation:c})):r[L]?.subject?.next({data:T(I({},$?.data),{[i?.annotationId]:i}),operation:c})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(s){return ee(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:i,extraData:r,eventType:a})}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",c),e}})}handleReactionEncryption(a){return ee(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:i,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(i){return new(i||o)(Q(kse),Q(Rse),Q(Yv),Q(Nse),Q(Fse),Q(KP),Q(Bse),Q(y),Q(Vse),Q(ZP),Q(jse),Q($se),Q(Kv),Q(Hse),Q(zse),Q(zn),Q(lt),Q(Is),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Gse=(()=>{let o=class o{constructor(e,i,r){this.configService=e,this.authService=i,this.loggingService=r,this.firestore$=new ve(null);try{Mn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Ne(([a,s])=>!!a&&!!s),et(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(SP(zp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||SP("DocumentIdDb");if(e){let i=HS(e,"generateDocumentId");return jv(i).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(Q(jt),Q(je),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var En=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E){this.authService=e,this.commonDbUtilsService=i,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=c,this.docService=p,this.usersService=u,this.commentAnnotationsResolverService=C,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let L=on(D,".info/serverTimeOffset");this.offsetListener=yu(L,$=>{let Y=$.val();this.offset=Y})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){Mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ne(([i,r])=>!!i),et(1),gn(([i,r])=>{e({db:i,firestore:r})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(e,i,r,a,s,c){return ee(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(C=>ee(this,[C],function*({db:p,firestore:u}){let E;i?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,$;try{D&&(L=on(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&u&&E&&($=jv(u,`${E}`))}catch{this.loggingService.catch("Error in docRef")}yield r({dbRef:L,firestoreRef:$,data:a,firestorePath:E}),c&&c({firestoreAvailable:!!u})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return ee(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,u=>ee(this,null,function*(){if(u.dbRef){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Vf(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:c?.actionType});if(e==="comment"){let $=null;E&&($=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:c?.targetAnnotationData?.commentId})),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:c}))}else if(e==="reaction"){let $=null;E&&($=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield x$(u.firestoreRef,C)}}catch(C){this.loggingService.catch(`Error in setData for ${e}`,C)}}),i,s,a))}catch(u){this.loggingService.catch(`Error in setData for ${e}`,u)}})}updateData(p){return ee(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,u=>ee(this,null,function*(){if(u.dbRef&&!r?.skipRtdb){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield d5(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:c?.actionType});if(e==="comment"){let $=null;E&&($=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:c?.targetAnnotationData?.commentId})),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:c}))}else if(e==="reaction"){let $=null;E&&($=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield x$(u.firestoreRef,C,{merge:!0})}}catch(C){this.loggingService.catch(`Error in updateDoc for ${e}`,C)}}),i,s,a))}catch(u){this.loggingService.catch(`Error in updateData for ${e}`,u)}})}deleteData(s){return ee(this,arguments,function*({feature:e,properties:i,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.performDatabaseOperation(e,i,c=>ee(this,null,function*(){c.dbRef&&(yield c5(c.dbRef));try{if(c.firestoreRef&&!i?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield mse(c.firestoreRef)}catch(p){this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=On()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),On()||"noDocumentId"}}queryData(r){return ee(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();return!e||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,i):yield this.handleRtdbQuery(e,i)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,i){return ee(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=HS(this.firestore,r);i?.useCollectionGroup&&(a=b$(this.firestore,r));let s=i?.firestoreQuery??[],c=E$(a,...s);if(i?.getCount){let p=yield pse(c).catch(u=>(this.loggingService.catch(`Error in getCountFromServer for ${e}`,u),null));return p?p.data().count:0}else{let p=yield use(c).catch(E=>(this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let u=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:u})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,i){return ee(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=on(this.db,r),s=i?.rtdbQuery??[],c=XL(a,...s),p=yield YL(c).catch(C=>(this.loggingService.catch(`Error in get for ${e}`,C),null));if(!p)return[];let u=p.val();return u?i?.skipObjectValues?u:Object.values(u??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return ee(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();if(i?.skipFirestore&&(a=!1),!e||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{let c=yield gse(jv(this.firestore,s)).catch(u=>(this.loggingService.catch(`Error in getDoc for ${e}`,u),null));if(!c)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return i?.field?p?.[i.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{let c=yield YL(on(this.db,s)).catch(u=>(this.loggingService.catch(`Error in get for ${e}`,u),null));if(!c)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return i?.field?p?.[i.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:i}){let r=this.shouldUseFirestore();i?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(i)}`;return Mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ne(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),ue(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleFirestoreListener(e,i,c).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s)return this.handleRealtimeDbListener(e,i,s);return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Pg(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,i,r){let a=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(i)}`;return a?new Lt(c=>{let p=i.isCollection?this.setupCollectionListener(r,a,e,c,i):this.setupDocumentListener(r,a,e,c,i);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(ue(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),ue(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),ue(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),qt(Vi)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,i,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=HS(e,i);if(s?.useCollectionGroup&&(p=b$(e,i)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=E$(p,...E)}let u=!0,C=[];return I$(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),L=null,$=!1;E?.docChanges()?.length?E.docChanges().forEach(Y=>{["allComments","allReactions"].includes(r)&&!u&&Y.type!=="removed"&&C.push(Y.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:Y,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||($=!0,Object.assign(D,this.handleCollectionChange(Y,D)),Y.type==="removed"&&(L||(L={type:Y.type,ids:[]}),L.ids.push(Y.doc.id)))}):$=!0,$&&(["allComments","allReactions"].includes(r)&&C?.length&&(this.commonDbUtilsService.resolveAnnotations({data:C,feature:r}),C=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),u=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,i){switch(e.type){case"added":case"modified":i[e.doc.id]=e.doc.data();break;case"removed":delete i?.[e.doc.id];break}return i}setupDocumentListener(e,i,r,a,s){let c=jv(e,i);return I$(c,p=>{try{let u=p.data()||{};s?.field&&(u=u?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:u,subscriber:a,operation:null})}catch(u){this.handleListenerError(u,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,i,r){this.loggingService.catch(`Firestore listener error for ${i}:`,e),r.error(e)}handleRealtimeDbListener(e,i,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=on(r,a);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];s=XL(s,...c)}return Bf(s).pipe(Vn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),me(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((u,[C,E])=>(u[C]=this.commonDbUtilsService.addMetadata(E,i),u),{}):this.commonDbUtilsService.addMetadata(c,i))),ue(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),ue(c=>this.usersService.getUserById$().pipe(me(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(Zv),Q(y),Q(Gse),Q(un),Q(jt),Q(lt),Q(zn),Q(Is),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vi=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.analyticsService=e,this.authService=i,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=c,this.commonDbService=p,this.usersService=u,this.db=bi(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new Xe,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Mi.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(ue(C=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),me(()=>C)))).subscribe(C=>ee(this,null,function*(){this.user=C,C&&this.documentPaths?C?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(C),this.setLoggedInUser(C),yield this.moveGlobalContactUserFromEmailToUserIdPath(C),this.updateUserInGlobalContactsIfAvailable(C),C?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(C?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),C=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",C)}),this.databaseService.getDb().pipe(Ne(C=>!!C),et(1)).subscribe(C=>{C&&(this.db=C)},C=>{this.loggingService.catch("Error in ContactService constructor getDb: ",C)}),this.getOrganizationGroups$().subscribe(C=>{this.authService.setOrganizationUserGroups(C)}),Mn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([C,E,D])=>{E?D?.merge?this.userContacts$.next([...C||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(C||[])}),this.getUserContacts$().subscribe(C=>{try{C?.forEach(E=>{let D=E?.userSnippylyId||um(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(i){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",i)}}checkIfUserGlobalContact(e){return ee(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}return!1}catch(i){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",i),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUser: ",i)}}migrateLoggedInUserFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let i=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let c=r.contacts[s];if(c?.userId){let p=Nt(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}})}}}}catch(i){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",i)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(i){this.loggingService.catch("Error in ContactService addGlobalContact: ",i)}}updateUserInGlobalContactsIfAvailable(e){return ee(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Do;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",i)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}}))}}}catch(i){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",i)}})}setLoggedInUserPrivateContacts(e,i){try{if(e?.userId&&this.documentPaths?.logins){let r,a=i?.filter(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Nt(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let i=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});i&&Object.keys(i??{}).forEach(r=>ee(this,null,function*(){let a=i[r];a?.email&&a?.userId&&Nt(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(i){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",i)}})}checkToSetLoggedInUserInGroupContacts(){return ee(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(et(1)).subscribe(i=>ee(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(i);if(!a||a===pi.PUBLIC)r=!0;else if(a===pi.RESTRICTED){let s=Nt(this.user?.userId);if(i?.users?.[s]&&(r=!0),this.user?.email){let c=Nt(this.user?.email);i?.users?.[c]&&(r=!0)}}if(r){let s=new Hp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,i){try{let r=i?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>ee(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return ee(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in ContactService removeGroupContacts: ",i)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let i={};e.forEach(r=>{r?.userId?(!r?.email||!i[r.email])&&(i[r.userId]=r):r?.email&&(!r?.userId||!i[r.userId])&&(i[r.email]=r)}),e=Object.values(i??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:i,documentId:r,veltFolderId:a}=e||{};return i&&r?Mn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$()]).pipe(me(([s,c,p,u,C,E,D])=>{let L={},$=!1;E&&!E?.merge&&($=!0);let Y=Ye=>D.some(Re=>Ye.includes(Re)),ce=Y([Mi.ALL,Mi.ORGANIZATION])?Object.keys(s?.[i]||{}):[],Ce=a?Y([Mi.ALL,Mi.FOLDER])?Object.keys(c?.[i]?.[a]||{}):[]:[],Ie=Y([Mi.ALL,Mi.DOCUMENT])?Object.keys(p?.[i]?.[r]||{}):[];if([...ce,...Ce||[],...Ie].forEach(Ye=>{let Re=u?.[Ye];Re&&(L[Ye]=Re)}),C){let{merge:Ye,options:Re}=E||{},{organizationId:_e,documentId:Ee,folderId:Oe}=Re||{},ye=Oe?yl(Oe):void 0;(!_e||_e===i)&&(!Ee||Ee===r)&&(!ye||ye===a)&&(Ye||(L={}),C.forEach(he=>{he?.userId&&(L[he.userId]=he)}))}return Object.values(L??{})})):this.userContacts$.asObservable().pipe(me(s=>s))}catch(i){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",i),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Ne(e=>!!e),ue(e=>this.docService.getDocumentPaths$().pipe(Ne(i=>!!i),gn(i=>{this.documentPaths=i}),me(()=>e))),ue(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let i=[];return i.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(me(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(me(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Nt(e?.userId)}}).pipe(me(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),oo(...i).pipe(ro(this.authService.getUser$().pipe(Ne(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(i){this.loggingService.catch("Error in ContactService addUserContact: ",i)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(ue(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(me(i=>i?.data),gn(i=>{i?this.users=Object.values(i??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(ue(e=>e?.organizationId?this.userById$.pipe(me(i=>{let r={};return Object.values(i||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(me(i=>{let r={};return i.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(me(i=>i.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(i=>i.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(i=>i.email===e)}getUserByUserId$(e){return this.users$.pipe(me(i=>i.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?.organizationId?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),i?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0}}).pipe(me(a=>a?.data),me(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!i)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0}}).pipe(me(s=>s?.data)),a.pipe(me(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let c=Object.values(s??{});this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?se(e).pipe(ue(i=>this.docService.getDocumentPaths$().pipe(Ne(r=>!!r),gn(r=>{this.documentPaths=r}),me(()=>i))),ue(i=>(this.setUserDocumentContacts([]),i?this.documentPaths?this.docService.getDocumentIds$().pipe(ue(r=>{let a=r?.length>0?r.map(p=>p.documentId):[this.documentPaths?.documentId??""];if(a.some(p=>!p)||!this.documentPaths)return se();let s=se([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.documentPaths?.veltFolderId&&this.documentPaths?.allDocuments)s=this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},c),{firestoreQuery:[Ui(dt("metadata.apiKey","==",this.configService?.getApiKey()),dt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId),dt("metadata.organizationId","==",this.documentPaths?.organizationId))]})}).pipe(me(p=>p?.data));else{let p=[];for(let u=0;u<a.length;u+=j.LISTENER_BATCH_SIZE)p.push(a.slice(u,u+j.LISTENER_BATCH_SIZE));s=Mn(p.map(u=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},c),{firestoreQuery:[Ui(dt("metadata.apiKey","==",this.configService?.getApiKey()),dt("metadata.documentId","in",u),dt("metadata.organizationId","==",this.documentPaths?.organizationId),...this.documentPaths?.veltFolderId?[dt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId)]:[])]})}).pipe(Gr()))).pipe(me(u=>ua(u)?.data))}return s.pipe(me(p=>{if(p){typeof p=="object"&&(p?.undefined&&delete p.undefined,p?.null&&delete p.null);let u=Object.values(p??{});this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):se():se())),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,i){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),i){let s={};s[i]={},e.forEach(c=>{s[i][c.user.userId]=c,this.userById$.next(T(I({},this.userById$.value),{[c.user.userId]:c.user}))}),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[i]:s[i]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{this.userFolderContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,veltFolderId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndFolderId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{this.userDocumentContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,documentId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndDocumentId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Mi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let i=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(ue(e=>e?.organizationId?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{if(this.setUserOrganizationGroups([]),!i)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(me(a=>a?.data),me(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",i)}}onContactSelected(e){try{if(e?.userId){let i=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case pi.RESTRICTED:if(!i){let a={contact:e,isOrganizationContact:r,isDocumentContact:i,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let i={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(i)}}catch(i){this.loggingService.catch("Error in ContactService onContactSelected: ",i)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereLabel: ",i)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereDescription: ",i)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(i){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",i)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(i=>e.includes(i))}updateContactList(e,i){return ee(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:i}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers(r);let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(i)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:i,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:i,organizationId:r})}return this}catch(i){return this.loggingService.catch("Error in ContactService convert: ",i),this}}getContactList$(){try{return this.authService.getUser$().pipe(ue(e=>e?Mn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(me(([i,r,a,s,c])=>{let p={};p.organizationUsers=i?.map(C=>this.convertToClientUser(C)),p.folderUsers=r?.map(C=>this.convertToClientUser(C)),p.documentUsers=a?.map(C=>this.convertToClientUser(C)),p.updatedContactList=c?.map(C=>this.convertToClientUser(C));let u=[];return s?.forEach(C=>{let E=this.convertToClientUserGroup(C,p.organizationUsers||[]);E&&u.push(E)}),p.userGroups=u,p}),qt(Vi)):se(null)),Vn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,i){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return i?.forEach(s=>{if(s?.userId){let c=Nt(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUser: ",i),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(jt),Q(un),Q(lt),Q(y),Q(En),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Wse=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){mt.catch("Error in File utils getFileName: ",o);return}},B$=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){mt.catch("Error in File utils getFileExtension: ",o);return}},qse=(n,o)=>{try{let t=n.slice(0,-1,n.type);return new File([t],o+"."+B$(n),{type:n.type})}catch(t){mt.catch("Error in File utils updateFile: ",t);return}},Yse=n=>new Promise((o,t)=>{let e=new FileReader;e.readAsDataURL(n),e.onload=()=>{o(e.result)},e.onerror=i=>{t(i)}}),Kse={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Wp=(()=>{let o=class o{constructor(e,i,r,a){this.authService=e,this.configService=i,this.loggingService=r,this.attachmentResolverService=a,this.storage=Ly();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=Ly(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:i}){try{let r=new Hv;r.name=i.name;let a=qse(i,`${r.attachmentId}_${Wse(i)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=i.size,r.type=B$(i),r?.type&&(r.mimeType=Kse[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:i,resolve:r,reject:a}){try{let s=By(this.storage,e.bucketPath),c=EB(s,i,{cacheControl:"public,max-age=3600"});c.on("state_changed",p=>{let u=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{IB(c.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(c){return ee(this,arguments,function*({file:e,attachment:i,metadata:r,resolve:a,reject:s}){try{r.attachmentId=i.attachmentId;let p={attachmentId:i.attachmentId,name:i.name,file:e,metadata:r,mimeType:i.mimeType},u=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:qa.ATTACHMENT_ADD});u&&u.data?.url?(i.url=u.data?.url,a(i)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:i,useAttachmentResolver:r,metadata:a}){return new Promise((s,c)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:i});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:i,attachment:p,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:p,file:i,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}})}uploadChunk(e,i,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${i.name}`,p=By(this.storage,c),u=EB(p,i,{cacheControl:"public,max-age=3600"});u.on("state_changed",C=>{let E=C.bytesTransferred/C.totalBytes*100},C=>{s(C)},()=>{IB(u.snapshot.ref).then(C=>{a(C)}).catch(C=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,C),s(C)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let i=new XMLHttpRequest;i.responseType="blob",i.onload=()=>{let r=i.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},i.onerror=()=>{window.open(e.url,"_blank")},i.open("GET",e.url),i.send()}}catch(i){this.loggingService.catch("Error in StorageService downloadAttachment: ",i)}}deleteAttachment({attachment:e,metadata:i,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:i}).then(()=>{a(null)}).catch(c=>{s(c)});else{let c=By(this.storage,e.bucketPath);bB(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((i,r)=>{let a=By(this.storage,e);bB(a).then(()=>{i(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(jt),Q(y),Q(Gp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var hn=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.analyticsService=e,this.authService=i,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=u,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Ne(C=>!!C),et(1)).subscribe(C=>{C&&(this.db=C,this.getUser(),this.getDocumentPaths())},C=>{this.loggingService.catch("Error in CommentService getDb subscription: ",C)}),this.getRole$().pipe(et(1)).subscribe(C=>{this.authService?.getUser()&&!C&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(C=>{C?.accessType&&this.contactService.setDocumentAccessType(C.accessType)})}catch(C){this.loggingService.catch("Error in IamService constructor: ",C)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Ne(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let i=e||new DP;this.documentIAM$.next(i)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(Vn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(me(e=>!!e),qt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(me(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(me(e=>e?.features),ue(e=>this.getRole$().pipe(me(i=>(i===po.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(i){return this.loggingService.catch("Error in IamService hasRole: ",i),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(i){return this.loggingService.catch("Error in IamService hasRoleAny: ",i),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(ue(()=>this.documentIAM$.pipe(Ne(i=>!!i),ue(()=>this.workspaceIAM$.pipe(me(()=>e===this.getRole()))))))}catch(i){return this.loggingService.catch("Error in IamService hasRole$: ",i),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(ue(()=>this.configService.getSF$()),ue(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),ue(()=>this.documentIAM$.pipe(Ne(e=>!!e))),ue(()=>this.workspaceIAM$),me(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return po.ADMIN;if(!e&&this.user?.isAdmin)return po.ADMIN;let i=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?pi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||pi.PUBLIC:null){case pi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||po.COMMENTER;break;case pi.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||null;break;default:break}return i}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(me(e=>e===po.ADMIN),qt())}isUserAdmin(){try{return this.getRole()===po.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,i){try{if(e||i){let r;return e&&(r=this.documentIAM$.value?.users?.[Nt(e)]),!r&&i&&(r=this.documentIAM$.value?.users?.[Nt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,i){try{if(e||i){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Nt(e)]),!r&&i&&(r=this.workspaceIAM$.value?.users?.[Nt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(vi),Q(un),Q(lt),Q(jt),Q(y),Q(En))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jn=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E,D,L,$,Y,ce,Ce){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=u,this.databaseService=C,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=$,this.notificationUtilsService=Y,this.usersService=ce,this.functions=Ce,this.db=bi(),this.notificationsDb=bi(void 0,Xn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}});try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Ne(Ie=>!!Ie),et(1)).subscribe(Ie=>{Ie&&(this.db=Ie,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},Ie=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Ie)}),this.authService.getUser$().subscribe(Ie=>{Ie?(this.subscribeGetNotificationsForYou(),this.getDocumentIds()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach($e=>{this.notificationsByDocumentIdSubscription[$e]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Ie=>{if(Ie){let $e=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Ie||{}).forEach(Ye=>{let Re=$e?.[Ye]?.notifications;Re?.length&&Re.forEach(_e=>{this.notificationUtilsService.mergeLocationWithNotification({notification:_e},Ie)?.notification})}),this.notificationsByDocumentIdMap$.next($e)}})}catch(Ie){this.loggingService.catch("Error in NotificationService constructor: ",Ie)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in NotificationService setCommentService: ",i)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.getDocumentIdsByLastNotificationTimestamp().pipe(Ai(),me(([e,i])=>{let r=e?.map(u=>u.documentId),a=i?.map(u=>u.documentId),s=r?.filter(u=>!a?.includes(u)),c=a?.map(u=>({documentId:u,timestamp:i?.find(C=>C.documentId===u)?.timestamp})).filter(u=>!r?.includes(u.documentId)),p=a?.map(u=>{let C=i?.find(E=>E.documentId===u)?.timestamp;return{documentId:u,timestamp:C}}).filter(u=>{let C=e?.find(E=>E.documentId===u.documentId)?.timestamp;return C&&u.timestamp&&C!==u.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(u=>{this.removeNotificationsForDocumentId(u)}),i&&!i?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(me(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||i?.organizationId;return s&&c&&(a=new xm({apiKey:s,organizationId:c})),{user:i,documentPaths:a}}))),ue(i=>{let{user:r,documentPaths:a}=i;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Ui(dt("timestamp",">=",p)),Ka("timestamp","desc"),$v(e)]}}).pipe(me(u=>u?.data),me(u=>{let C=[];return Object.keys(u||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?u[E]?.timestamp??0:u[E],L=this.commonDbService.shouldUseFirestore()?u[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let $=L.id,Y=u[E]?.metadata?.documentId,ce=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),Ce=ce?.[Y]??{documentMetadata:null,notifications:[]},Ie=Ce.notifications??[],$e=Ie?.findIndex(Ye=>Ye.id===$);$e!==-1&&(Ie.splice($e,1),this.notificationsByDocumentIdMap$.next(T(I({},ce),{[Y]:T(I({},Ce),{notifications:Ie})})))}C.push({documentId:E,timestamp:D})}),C}),Vn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),se([]))))}return se(null)}))}catch(i){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",i),se([])}}fetchNotificationsForDocumentIds(e,i=15){return ee(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:Xn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),c={};e.forEach(L=>{if(L?.documentId){let $=this.getAllowedDocumentMetadataByDocumentId(L.documentId);$&&(c[L.documentId]=$)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:i,documentMetadataByDocumentId:c},u=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),C=(yield r({veltData:u}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield roe(C,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),$=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Y=[],ce=[];Object.keys(D).forEach((Ce,Ie)=>{let $e=D[Ce].documentMetadata;if($e){let Re=this.allowedDocumentMetadataMap$.value||{};(!Re?.[Ce]||!_o(Re?.[Ce],$e))&&this.allowedDocumentMetadataMap$.next(T(I({},Re),{[Ce]:$e}))}let Ye=D[Ce].notifications||[];Ye.forEach(Re=>{Re.notification=this.getClientNotificationObject(Re)}),this.setNotificationForDocumentIdInCache(Ce,$e,Ye),L&&Y.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ye,shouldAwait:!0,forceResolve:!0})),$&&ce.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ye,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(Y).then(()=>{Object.keys(D).forEach(Ce=>{let Ie=D?.[Ce]?.documentMetadata||{},$e=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[Ce]?.notifications||[]});$e.forEach(Ye=>{Ye.notification=this.getClientNotificationObject(Ye)}),this.setNotificationForDocumentIdInCache(Ce,Ie,$e)})}),$&&Promise.all(ce).then(()=>{Object.keys(D).forEach(Ce=>{let Ie=D?.[Ce]?.documentMetadata||{},$e=D?.[Ce]?.notifications?.reduce((Ye,Re)=>(Ye[Re.notificationId]=Re,Ye),{});$e=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:$e}),$e=Object.values($e??{}),$e.forEach(Ye=>{Ye.notification=this.getClientNotificationObject(Ye)}),this.setNotificationForDocumentIdInCache(Ce,Ie,$e)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,i,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);i||(i=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),u=p?.[e]?.notifications||[],C=this.docService.getLocationMetadatas(),E=r?.map($=>{let Y=$.notification;return Y.metadata&&(Y.metadata.documentName=i?.documentName||Y.metadata.documentName,Y.metadata.organizationMetadata=c||Y.metadata.organizationMetadata,Y.metadata.documentMetadata=i||Y.metadata.documentMetadata),C&&(Y=this.notificationUtilsService.mergeLocationWithNotification({notification:Y},C)?.notification),Y})?.filter($=>!!$)||[],D=new Map(u.map($=>[$.id,$]));E.forEach($=>{D.set($.id,$)});let L=Array.from(D.values()).sort(($,Y)=>(Y.timestamp||0)-($.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:i}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let i=this.notificationsByDocumentIdMap$.getValue();delete i?.[e],this.notificationsByDocumentIdMap$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",i)}}getNotificationsForDocumentId$(e,i=50){try{return this.authService.getUser$().pipe(me(r=>({user:r})),ue(r=>this.maxNotificationDays$.pipe(me(()=>r))),ue(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let c=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;c.setDate(c.getDate()-p);let u=c.getTime();return bo(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[ZL("timestamp"),QL(u),KL(i)],firestoreQuery:[Ka("timestamp","desc"),dt("timestamp",">=",u),dt("notification.actionUser.userId","!=",a.userId),$v(i)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(ue(C=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:C,operation:null}})),me(C=>C?.data??[]),me(C=>(C.sort((E,D)=>D.timestamp-E.timestamp),C)),Vn(C=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",C),se([]))),me(C=>(C.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),C)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,i=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-i),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.databaseService.getDb().pipe(ue(e=>this.authService.getUser$().pipe(me(i=>({db:e,user:i})))),ue(e=>this.maxNotificationDays$.pipe(me(()=>e))),ue(e=>{let{db:i,user:r}=e,a=this.configService.getApiKey();if(i&&r?.organizationId&&a){let s=Nt(r?.userId),c=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;c.setDate(c.getDate()-p);let u=c.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[ZL("timestamp"),QL(u),KL(50)],firestoreQuery:[Ka("timestamp","desc"),dt("timestamp",">=",u),dt("notification.actionUser.userId","!=",r.userId),$v(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(ue(C=>C?.data?se(C).pipe(me(E=>E?.data),me(E=>{let D=Object.values(E||{});return D.forEach($=>{$.notification=this.getClientNotificationObject($)}),D.sort(($,Y)=>Y.timestamp-$.timestamp),D.map($=>$.notification).filter($=>!!$)}),ue(E=>{let D={data:E?.reduce((L,$)=>(L[$.id]={notification:$},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(me(L=>Object.values(L?.data||{}).map($=>$?.notification)))})):se(null)))}return se(null)}),ue(e=>{let i=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(i).pipe(me(()=>e))}),ue(e=>this.allowedDocumentMetadataMap$.pipe(me(()=>e))),me(e=>(e?.length&&(e=e.map(i=>{if(i?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(i.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),i.metadata.documentName=a?.documentName||i.metadata.documentName,i.metadata.organizationMetadata=s||i.metadata.organizationMetadata,i.metadata.documentMetadata=a||i.metadata.documentMetadata}return i})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(e):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=Cn(e)),i&&typeof i=="object"){let s=Jo(i);r=Cn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return qn(this.afAuth).pipe(Ne(s=>!!s),ue(s=>this.isFeatureAllowed({firebaseUser:s})),ue(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(me(c=>(s.featureAllowed=c,s))):se(s)),ue(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(ue(c=>this.docService.getDocumentPaths$().pipe(me(p=>(this.documentPaths=p,c.documentPaths=p,c)))),ue(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),me(i=>T(I({},e),{config:i})),ue(i=>this.authService.getUser$().pipe(me(r=>T(I({},i),{user:r})))),ue(i=>Ji(i.config,i.user,ke.NOTIFICATION)?se(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ue(i=>{if(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=on(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return Bf(a).pipe(Vn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),me(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(C=>{let E=s?.raw[C];E?.id&&c.push(E)}),c.forEach(C=>{C.id&&p.set(C.id,C)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let u=[];s?.processed&&Object.keys(s?.processed||{}).forEach(C=>{let E=s?.processed[C];E?.id&&u.push(E)}),this.processedNotifications$.next(u),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let i=this.notificationViews$.getValue(),r;e?.email&&(r=Nt(e?.email));let a;e?.userId&&(a=Nt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let u=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(u=!0);let C={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:u,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(C.id);if(E?.metadata&&(C.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),C?.notificationSource==="comment"&&C?.targetAnnotationId){let D=this.commentService?.getAnnotationById(C.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(C.notificationSourceData=Hn(D))}s.set(p.id,C)}}),s.forEach((p,u)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!i?.notification?.[u]?.views?.[e?.userSnippylyId],s.set(u,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:i,metadata:r,views:a,notification:s}){try{let c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let u=null;c?.email&&(u=Nt(c?.email));let C=null;c?.userId&&(C=Nt(c?.userId));let E=!1,D=!0;(u&&p.notifyUsers?.[u]||C&&p.notifyUsersByUserId?.[C])&&(E=!0),C&&a?.[C]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let $=this.commentService?.getAnnotationById(L.targetAnnotationId);$||s?.notificationSourceData&&($=s?.notificationSourceData),$||i?.annotationData&&($=i.annotationData),$&&(L.notificationSourceData=Hn($))}return i?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=i?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(me(e=>e?Object.keys(e??{}).map(i=>{let r=e[i].notifications||[],a=r.filter(c=>c.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:i,notifications:e[i]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[i]?.documentMetadata}}).filter(i=>i.notifications?.length>0).sort((i,r)=>r.latestNotificationTimestamp-i.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(me(e=>{let i=null;return e?(i=[],e.forEach(r=>{r.notifications.forEach(a=>{i?.push(a)})}),i?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let i=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=i?.documentId?new xm({apiKey:a,documentId:i.documentId,organizationId:i?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),u=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(u))}catch(i){return this.loggingService.catch("Error in NotificationService processNotificationData: ",i),null}}updateNotificationDatabase(e){try{let i=on(this.notificationsDb),r=this.processNotificationData(e);o5(i,JSON.parse(JSON.stringify(r)))}catch(i){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",i)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(){return this.authService.getUser$().pipe(ue(e=>e?e.organizationId?this.getAllNotifications$().pipe(ue(i=>this.notificationsForYou$.pipe(me(r=>{let a=new Map;return(i||[]).forEach(s=>{s.id&&a.set(s.id,s)}),(r||[]).forEach(s=>{s.id&&!a.has(s.id)&&a.set(s.id,s)}),Array.from(a.values()).sort((s,c)=>(c.timestamp||0)-(s.timestamp||0))})))):this.notificationsByIdMap$.asObservable().pipe(me(i=>Array.from(i.values())),me(i=>i.sort((r,a)=>a.timestamp-r.timestamp)),Mg()):se(null)))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(i){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",i);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(i){this.loggingService.catch("Error in NotificationService setNotificationViews: ",i)}}getNotificationHeadlineMessage(e){try{let i=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,c=r.replace(s,(p,u)=>(u==="actionUser"||u==="recipientUser")&&a[u]?i?.email&&a[u].email===i?.email||i?.userId&&a[u]?.userId===i?.userId?"You":a[u].name||a[u].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[u]?a[u]:p);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",i),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let i=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);i=i?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(i)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",i),""}}setHistoryPanelVisibility(e,i=!1,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,i=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return ee(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let c=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(c)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let c=r?.[s]?.notifications||[],p=c.find(u=>u.id===a.id);p&&(p.isUnread=!1),r[s].notifications=c}}),this.notificationsByDocumentIdMap$.next(r)}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",i)}})}setAllNotificationsAsRead(e){return ee(this,null,function*(){try{if(e?.tabId==="for-you"){let i=this.notificationsForYou$.value||[];this.setNotificationsAsRead(i)}else this.getNotifications$().pipe(et(1)).subscribe(i=>{i&&this.setNotificationsAsRead(i)})}catch(i){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",i)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(me(e=>e?.filter(r=>r?.isUnread)?.length??null),ue(e=>this.getNotifications$().pipe(me(i=>{let r=i?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return ee(this,null,function*(){try{let i=this.authService.getUser();if(i&&e?.id){let r=Nt(i?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:c,documentId:p}=a;if(s&&c&&p&&r){let u=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:c,documentId:p,apiKey:s}});u?.notificationId&&(u?.views?.[r]||(u.views||(u.views={}),u.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:c,documentId:p,apiKey:s},data:u})));let C=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:c}});C?.notificationId&&(this.getReadNotificationsOnForYouTab()?C?.views?.[r]||(C.views||(C.views={}),C.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:c},data:C})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:c}}))}}}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",i)}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(i){this.loggingService.catch("Error in NotificationService setMaxDays: ",i)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setTabConfig: ",i)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}markNotificationAsReadById(e){return ee(this,null,function*(){try{this.getNotifications$().pipe(et(1)).subscribe(i=>{if(i){let r=i.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(i){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",i)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(i){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(Q(Si),Q(Ke),Q(je),Q(jt),Q(En),Q(Zv),Q(Yv),Q(Is),Q(un),Q(lt),Q(Fe),Q(hn),Q(y),Q(ZP),Q(zn),Q(Uo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(j.CommentAnnotationStatusMap),this._customPriorityMap=new ve(j.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(j.CommentCategoryMap);try{let i=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);i&&this._customPriorityMap.next(JSON.parse(i));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(i){this.loggingService.catch("Error in CustomFilterService constructor: ",i)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",i)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r}),this._customPriorityMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",i)}}setCustomCategories(e){try{let i={};e.forEach(r=>{i[r.id]=r}),this._customCategoryMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",i)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let i=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(i)return i.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let i=Object.entries(this._customStatusMap.value),r=i.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=i.find(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=i.find(([c,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(i){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",i),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=j.CommentAnnotationPriorityMap[e.priority])}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",i)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(i=>j.CommentCategoryMap[i]))}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",i)}return e}};o.\u0275fac=function(i){return new(i||o)(Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ic=(()=>{let o=class o{constructor(e,i,r){this.domService=e,this.loggingService=i,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,i){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return i&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${i}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(i=>{let r=e[i];if(r.svg)this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${i}" />`;this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[i]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(i){this.loggingService.catch("Error in EmojiService setEmojiList: ",i)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
195
+ `+Pr),Dc&&HP([Le,xe,Tn],Ds=>{Pr=XS(Pr,Ds," ")}),$e&&ug?$e.createHTML(Pr):Pr},o.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wm(Yt),gg=!0},o.clearConfig=function(){Gm=null,gg=!1},o.isValidAttribute=function(Yt,Be,St){Gm||Wm({});let Gt=ho(Yt),no=ho(Be);return d_(Gt,no,St)},o.addHook=function(Yt,Be){typeof Be=="function"&&ZS(he[Yt],Be)},o.removeHook=function(Yt,Be){if(Be!==void 0){let St=m9e(he[Yt],Be);return St===-1?void 0:d9e(he[Yt],St,1)[0]}return _se(he[Yt])},o.removeHooks=function(Yt){he[Yt]=[]},o.removeAllHooks=function(){he=Tse()},o}var k$=Pse();var Mse={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Fe=(()=>{let o=class o{constructor(e,i,r){this.rendererFactory2=e,this.loggingService=i,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new Xe,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new Xe,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new ei),this.customCss$=new ve(null),this.mutationObserver=null,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.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(c=>{if(!zi(c))if(c instanceof HTMLElement){if(c.className.includes("cdk-overlay-container")||c.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(c.className.includes("cdk-overlay")){let p=!1;c.childNodes.forEach(u=>{zi(u)&&(p=!0)}),p||s.push(c)}else s.push(c)}else s.push(c)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new ve(a),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ai(),gn(([s,c])=>{try{let p=c.filter(C=>!s.includes(C)),u=s.filter(C=>!c.includes(C));u.length&&u.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?foe("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):voe("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(me(e=>{e?(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.onDocumentClick(),this.onDocumentFocus()):(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.unsubscribeFromDocumentClick(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}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(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=i.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let u=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(u!==null&&u!==""){let C=this.xpathCacheId.get(u);C!==void 0&&(this.xpathCacheId.delete(u),this.xpathCache.delete(C))}}}),zi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...i.filter(a=>a.type==="attributes").filter(a=>!zi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&xo(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{oo(ri(window,"offline").pipe(me(()=>!1)),ri(window,"online").pipe(me(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let i=this.calculateScreenSize();this.deviceInfo$.next(new ei),this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let i=this.calculateScreenSize();this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return ri(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Dg}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let i=this.getXPath(e.target),r=e.target;if(i?.includes("name()='svg'")){let C=this.getXPath(i);C&&(r=C.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),u=c*100/(a.height||1);this.currentMousePosition.element={xpath:i,topPercentage:u,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(e,i=!0,r=!1,a=!0,s){try{let c=e,p=c?.touches?.length?c.touches[0]?.clientX:c.clientX,u=c?.touches?.length?c.touches[0]?.clientY:c.clientY,C=this.getBackgroundElement(p,u,i,r);if(C&&s&&typeof s=="function"&&(C=s(C)),C){let E=this.getXPath(C),D=this.getXPath(C,!0),L=C.getBoundingClientRect(),$=p-L.x,Y=u-L.y,ce=$*100/(L.width||1),Ce=Y*100/(L.height||1),Ie={xpath:E,fXpath:D,leftPercentage:ce,topPercentage:Ce};if(a){let $e=this.getXPath(C,!0,!0);Ie.cfXpath=$e}return Ie}else return null}catch(c){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",c),null}}getBackgroundElement(e,i,r=!0,a=!1){try{let s=document.elementsFromPoint(e,i),c=[];s.forEach(u=>{zi(u)?c=[]:xo(u)&&c.push(u)}),a&&(c=c.filter(u=>this.isElementVisibleOnScreen(u)));let p=0;return r||c?.forEach((u,C)=>{u.tagName.toLowerCase()==="svg"&&(p=C)}),c[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,i){try{let r=document.elementsFromPoint(e,i),a=[];return r.forEach(s=>{zi(s)&&xo(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(e){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 e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||e.x+200,r=Math.min(i,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}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(e,i,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),i&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",i,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,i,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,i),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,i=!1,r=!1,a){try{let s=this.calculateXPath(e,i,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let c=s.split("/"),p=!1;c.forEach((u,C)=>{u.includes("svg")&&(p=!0),p&&(c[C]="svg:"+u)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,i,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!i)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,i,r,a)+"/"+e.tagName.toLowerCase(),u=Array.from(e.parentNode?.children||[]).filter(C=>C.nodeType===1&&C.tagName===e.tagName?C.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===c:!1);if(u.length>1){let C=u.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${C}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,i,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,i=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,i);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=On();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[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 r=new GS;return r.screenWidth=Math.max(...i),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new GS}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),u;for(;u=p.nextNode();)u?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),e}}mergeAdjacentTextNodes(e){try{let i=e.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let r=i.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)i.textContent+=r.textContent,r.remove(),r=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(e){try{for(let i=e.length-1;i>=0;i--){if(e[i]?.scrollHeight&&e[i]?.clientHeight){let r=Math.max(e[i]?.scrollHeight,e[i]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[i]}e[i]?.childNodes?.length&&this.findLongestNode(e[i]?.childNodes)}}catch(i){this.loggingService.catch("Error in DomService findLongestNode: ",i)}}resetSelectedAnnotationsMap(e=!0,i){try{let r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(C=>C.classList.contains("velt-annotation-draft-checked")?(C.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(C,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(C,"velt-comment-dialog-shake"),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||C.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(C,"velt-annotation-draft-checked")},100),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(C=>C),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let C=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||C.push(D)}else p[E]?.comments?.length||s.includes(E)||C.push(p[E])}),this.deleteAnnotations$.next(C),this.deleteAnnotations$.next([])}let u={};Object.keys(p).forEach(C=>{if(s.includes(C)&&(u[C]=p[C]),i)switch(i){case"comment":["comment","videoPin"].includes(p[C]?.type)||(u[C]=p[C]);break;default:p[C]?.type!==i&&(u[C]=p[C]);break}}),Object.keys(u).forEach(C=>{let E=u[C]?.multiThreadAnnotationId;E&&!u[E]&&(u[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(u)&&this.selectedAnnotationsMap$.next(u),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,i){try{if(i)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:i}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let i=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(i).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(i[a].type)&&(r[a]=i[a]);break;default:i[a].type===e&&(r[a]=i[a]);break}}),r}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(me(i=>{if(e){let r={};return Object.keys(i).forEach(a=>{i[a].type===e&&(r[a]=i[a])}),r}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(me(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,i,r,a=!1){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),c=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));if(s[e.annotationId]&&!a)delete s[e.annotationId];else{(!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,c[e.annotationId]=i;let p=e?.multiThreadAnnotationId;p&&(s[p]={annotationId:p,type:"multiThread"},c[p]=i)}this.selectedAnnotationsMap$.next(s),Object.keys(c).forEach(p=>{s[p]||delete c[p]}),this.selectedAnnotationsLocationMap$.next(c)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,i){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==i&&(r[e]=i,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let i=this.selectedAnnotationsMap$.value;e.forEach(r=>{i[r.annotationId]&&(i[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}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$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,i){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===i){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==i)if(e?.closest("svg"))for(;a&&a!==i;){let c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let u=p.getBoundingClientRect(),C=a.getBoundingClientRect();r.offsetLeft+=C.left-u.left,r.offsetTop+=C.top-u.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===i){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:i,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return i>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let i=e,r=window.getComputedStyle(i);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let i=ri(document,"mousedown").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=ri(document,"mousemove").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=ri(document,"mouseup").pipe(me(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=i.pipe(ue(p=>r.pipe(Ai(),me(([u,C])=>({startPoint:p,prevPoint:u,curPoint:C})),ro(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,i){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(i.x-e.x),s=Math.abs(i.y-e.y),c=Math.min(e.x,i.x),p=Math.min(e.y,i.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),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(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let i={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),i.commonAncestorContainer=this.getTextXPath(a),i.commonAncestorContainer){let c=this.getElementFromXPath(i.commonAncestorContainer);c&&(i.commonAncestorContainerFXpath=this.getXPath(c,!0),i.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0))}return i.text=e.toString(),i.occurrence=Lu(a,0,e.startContainer,e.startOffset,e.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let i=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&i++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(e){try{if(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let i=e.closest("svg");return i?i?.parentElement:e}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:e,elementClassNames:i,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let c=document.getElementById(e[s]);c&&a.push(c)}if(i?.length)for(let s=0;s<i.length;s++){let c=document.getElementsByClassName(i[s]);for(let p=0;p<c.length;p++){let u=c[p];u&&u instanceof HTMLElement&&a.push(u)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let u=c[p];u&&u instanceof HTMLElement&&a.push(u)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementById(i[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementsByClassName(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.querySelectorAll(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(i)||e.classList?.add(i))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(i)&&e.classList?.remove(i)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,i,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(i)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}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(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),i?.type==="link"){let a=document.createElement("link");a.href=i?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(i?.value),a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}trimCommentHtml(e){try{let i=document.createElement("div");i.innerHTML=e,this.removeEmptyElements(i);let r=i.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var i=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.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(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),k$.sanitize(e,Mse)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeSvg(e){try{return k$.sanitize(e,Mse)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ei;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new ei)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),i=this.getTabIdFromWindowName();return(!e||e!==i)&&(e=On(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}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(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new ei}}isMobileDevice(){try{return new ei().getDeviceType()===Qo.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ei().getDeviceType()===Qo.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ei().getDeviceType()===Qo.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var i=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{i.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(r.nodeValue))}),i}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let i=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",i)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new ei().getDeviceType()===Qo.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?:&nbsp;\s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?:&nbsp;\s*)+|(?:&nbsp;\s*)+$/g,o.\u0275fac=function(i){return new(i||o)(Q(Ko),Q(y),Q(Ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var je=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.afAuth=e,this.configService=i,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=u,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Do,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(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.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(C=>{this.config=C}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=qn(this.afAuth).pipe(qo(this.afAuth.currentUser),Ai(),ue(([C,E])=>this.domService.onNetworkStatusChange$().pipe(Ne(D=>D),et(1),me(()=>({previousUser:C,currentUser:E}))))).subscribe(D=>ee(this,[D],function*({previousUser:C,currentUser:E}){if(!E&&C){let L=C?.stsTokenManager?.expirationTime,$=new Date().getTime(),Y=L-$;$>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&C?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.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:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),C=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",C)}),this.getUser$().pipe(qt(Vi)).subscribe(C=>{let E=ha(C);this.coreActionsService.triggerAction($o.USER_UPDATE,E)})}catch(C){this.loggingService.catch("Error in AuthService constructor: ",C)}}setApiKey(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),i||(i=new TP),this.configService.initConfig(i),i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||qn(this.afAuth).pipe(et(1)).subscribe(r=>ee(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Cd(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(i){this.loggingService.catch("Error in setAreaService: ",i)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(i){this.loggingService.catch("Error in setReactionService: ",i)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(i){this.loggingService.catch("Error in setRecorderAnnotationService: ",i)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(i){this.loggingService.catch("Error in setViewsService: ",i)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.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")}initializeClient(e,i,r,a,s){return ee(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=um(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield qn(this.afAuth).pipe(et(1)).toPromise().catch(u=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let u=yield Cd(c,!0).catch(D=>null);if(!u)return;let{user:C,firebaseConfig:E}=u.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==C?.groupId||e?.organizationId!==C?.organizationId||i?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Cd(c,!0).catch(ce=>null);if(!D)return;let{firebaseConfig:L,user:$,advancedQueries:Y}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(Y),$&&(this.providedUser.isAdmin=!!$.isAdmin),this.initializeSignedInUser(c,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId);let u=yr(this.functions,br({url:Xn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),C=ga(),E=(yield u({apiKey:this.apiKey,user:e,version:C,authToken:i?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId),E.error&&typeof E.error=="string"&&E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired"};this.coreActionsService.triggerAction($o.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries."};this.coreActionsService.triggerAction($o.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId)}throw E.error}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Cd(this.afAuth.currentUser,!0).catch(Y=>null);if(!D)return;let{user:L,advancedQueries:$}=D.claims;this.setAdvancedQueries($),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:i,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let i=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(i&&e.organizationId&&!r)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForRegion(e,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!i?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},Xn.firebaseConfig),e)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}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 Mn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(me(()=>this.getAdvancedQueriesEnabled()),Vn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),qn(this.afAuth).pipe(ue(e=>e?this.user$.asObservable():se(null)))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(e.userId&&e.userId!==i?.userId||e?.groupId&&e?.groupId!==i?.groupId||e?.organizationId&&e?.organizationId!==i?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=I(I({},this.providedUser),e),i){let r=I(I({},i),e);this.updateUserInternally(r)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(e,i,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return UQ(this.afAuth,i).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new Do;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,i)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers([e.userId]);a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?r?.color:this.providedUser?.color||this.avatarService.generateUserColor(Cn(e.userId)),e.textColor=r?r?.textColor:this.providedUser?.textColor||"#FFFFFF",e.initial=r?r?.initial:this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},e);delete i.contacts,this.analyticsService.identifyUser(e.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||(yield this.getPlanDetailsFromDb()),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(e)),r=T(I({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return ee(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yr(this.functions,br({url:Xn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.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(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Ne(e=>!!e),me(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,i){try{this.preSignOutFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(i.metadata=e,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(e){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=e,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(ue(e=>e?this.userOrganization$.asObservable().pipe(me(i=>i?.metadata?.organizationId===e.organizationId?i:null)):se(null)))}signOutUser(e="internal"){return ee(this,null,function*(){try{yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let i=yield qn(this.afAuth).pipe(et(1)).toPromise().catch(r=>null);if(i){this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(i)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.resetServicesCache(),this.user$.next(null),jQ(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}})}isFeatureAllowed(e){return Ji(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let i=JSON.parse(JSON.stringify(e));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForClient(e){try{return ha(e)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(Q(Si),Q(jt),Q(Im),Q(Em),Q(Fe),Q(Uo),Q(Ke),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xm=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.clientDocumentId=i,this.clientOrganizationId=r,i&&(this.documentId=pc(i)),r&&(this.organizationId=gc(r)),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.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}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 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 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(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var WP=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.veltFolderId=s,i&&(this.documentId=pc(i)),r&&(this.organizationId=gc(r)),a&&(this.folderId=a,this.veltFolderId=yl(a)),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 o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}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 commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews 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.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var qP=class{};var un=(()=>{let o=class o{constructor(e,i){this.authService=e,this.loggingService=i,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(Lf(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Is=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*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 ve(null),this.commentAnnotationById$=new ve({}),this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((c,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),c({});let C={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});ee(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let $=hc(()=>u?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield $)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let Y={};Object.entries(C).forEach(([ce,Ce])=>{let Ie=this.commentAnnotationById$.value?.[ce];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(Ce)&&(Y[ce]=Ce):Y[ce]=Ce}),Object.keys(Y).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),Y)),c(Y)}catch(Y){r||p(Y),c(C)}}else s(),c({})}catch($){s(),p($)}})})}catch(i){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",i),{}}})}saveCommentAnnotation(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let i=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield hc(()=>i?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let c=yield hc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:i,event:qa.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{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()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Tm=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*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 ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((c,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),c({});let C={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});ee(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let $=hc(()=>u?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield $)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let Y={};Object.entries(C).forEach(([ce,Ce])=>{let Ie=this.reactionAnnotationById$.value?.[ce];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(Ce)&&(Y[ce]=Ce):Y[ce]=Ce}),Object.keys(Y).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),Y)),c(Y)}catch(Y){r||p(Y),c(C)}}else s(),c({})}catch($){s(),p($)}})})}catch(i){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",i),{}}})}saveReactionAnnotation(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let i=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:qa.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield hc(()=>i?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let c=yield hc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:i,event:qa.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{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()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var lt=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C){this.analyticsService=e,this.authService=i,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=u,this.coreActionsService=C,this.documentPaths$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocumentId=null,this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Xe,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,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.setDocumentIdSubject.pipe(rr(this.DEBOUNCE_TIME)).subscribe({next:E=>ee(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations&&(yield this.setLocations(this.draftLocationMap.locations,this.draftLocationMap.options)),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Ne(E=>!!E),et(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=f6(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>{E?(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),this.draftDocumentId?(this.setDocuments([{id:this.draftDocumentId,metadata:{organizationId:this.draftOrganizationId}}],this.draftOptions??void 0),this.draftDocumentId=null,this.draftLocationMap.locations&&this.setLocations(this.draftLocationMap.locations,this.draftLocationMap.options).then(()=>this.draftLocationMap={locations:[],options:void 0}),this.draftOrganizationId=void 0,this.draftOptions=void 0):this.documentPaths$?.value&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&this.setDocuments([{id:this.documentPaths$.value?.clientDocumentId,metadata:{organizationId:E?.organizationId}}]),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),E?.organizationId&&E?.clientOrganizationId&&this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId})):(this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftDocumentId=this.documentPaths$.value?.clientDocumentId??null,this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(D=>D.location)].filter(D=>D!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)))}),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.organizationConfig$.subscribe(E=>{E&&this.updateOrganizationMetadata()}),this.documentPaths$.pipe(Ne(E=>!!E),et(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId}}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.unsetDocuments("internal")}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setCommentService(e){try{this.commentService=e}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 e=f6(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=f6(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(e,i,r){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",payload:{documentId:e,documentMetadata:i,options:r}}),yield this.setDocumentsImpl([{id:e,metadata:i}],I({organizationId:i?.organizationId},r??{}))}catch(a){this.loggingService.catch("Error in DocService setDocument:",a)}})}shouldSetDocumentsAgain(e,i={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentIds$.value.map(c=>c.clientDocumentId),a=this.getOptionsFromDocumentPaths()??{};return!e.every(c=>r.includes(c.id))||!_o(a,i)}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:i=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,c=`${Cn(s)}`;i&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",payload:{documents:e,options:i}}),yield this.setDocumentsImpl(e,i)}catch(r){this.loggingService.catch("Error in DocService setDocuments:",r)}})}setDocumentsImpl(e,i){return ee(this,null,function*(){try{if(!this.shouldSetDocumentsAgain(e,i)){this.loggingService.warn("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.organizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments("internal",!1);let r=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(r?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}this.documentIds$.next(r),e?.length&&(yield this.debounceSetDocuments({documentId:e[0]?.id,clientOrganizationId:i?.organizationId}));return}catch(r){this.loggingService.catch("Error in DocService setDocumentsImpl:",r)}})}setDocumentId(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",payload:{documentId:e,clientOrganizationId:i}}),yield this.setDocumentsImpl([{id:e,metadata:{organizationId:i}}])}catch(r){this.loggingService.catch("Error in setDocumentId:",r);return}})}debounceSetDocuments(a){return ee(this,arguments,function*({documentId:e,clientOrganizationId:i,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,i,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:i,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,i,r){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a){this.draftDocumentId=e,this.draftOrganizationId=i,this.draftOptions=r;return}this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let c=`${Cn(e)}`,p=r?.folderId,u=r?.folderId?yl(r?.folderId):void 0,C=r?.locationId,E=r?.allDocuments,D=a?.organizationId?i?Nt(i):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let L=new OP,$=new qP;L.clientDocumentId=e,$.clientDocumentId=e,L.folderId=p,$.folderId=p,L.locationId=C,$.locationId=C,L.allDocuments=E,$.allDocuments=E,L.veltFolderId=u,$.veltFolderId=u,L.documentId=c,$.documentId=c,D&&(L.organizationId=D,L.clientOrganizationId=i??a?.clientOrganizationId,$.organizationId=D,$.clientOrganizationId=i??a?.clientOrganizationId);let Y=`${this.apiKey}`,ce=`apiKey/${this.apiKey}`;D&&(Y=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,ce=`${ce}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),$.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,$.document=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,$.comment=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,$.multiThread=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,$.area=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,$.recorder=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,$.reaction=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,$.commentViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,$.notificationViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,$.documentViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,$.locationViews=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(L.organizationNotificationsWithDocumentId=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`),L.organizationNotificationsLastNotificationTimestamp=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),$.organizationUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,$.documentUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,$.notificationDocs=`${ce}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,$.notificationUsers=`${ce}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next($),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata()]),s&&this.location$.value&&this.removeLocation(),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{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.customerMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments(e="internal",i=!0){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.authService.getUser()?.organizationId){let e=this.organizationConfig$.value?.organizationId;this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(i=>{i&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:i}))}).catch(i=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}}fetchDocumentMetadata(e){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let a=i?.folderId,s=i?.allDocuments,c=[],p={organizationId:i?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)c.push(this.fetchDocuments(p));else{let C=[];for(let D=0;D<e.length;D+=20)C.push(e.slice(D,D+20));C.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map($=>$.clientDocumentId),c.push(this.fetchDocuments(L))})}let u={};c.length>0&&Promise.all(c).then(C=>{C?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(u[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),u))}).catch(C=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",C)})}else r?.[i?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}}fetchLocationMetadata(){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,i=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(c));else{let u=[];for(let E=0;E<i.length;E+=20)u.push(i.slice(E,E+20));u.forEach(E=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(u=>{u?.forEach(C=>{C?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(u=>{this.loggingService.catch("Error in fetchLocationMetadata: ",u)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}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(Vn(i=>se(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}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(me(e=>e?.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(e){try{return`${Cn(e)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(e){try{return`${Nt(e)}`}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(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocation",payload:{locations:[e],options:void 0}}),yield this.setLocationsImpl([e])}catch(i){this.loggingService.catch("Error in setLocation: ",i)}})}setLocations(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",payload:{locations:e,options:i}}),yield this.setLocationsImpl(e,i)}catch(r){this.loggingService.catch("Error in setLocations: ",r)}})}getValidLocations(e){try{let i=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&i.push(r)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return e}setLocationsImpl(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0){this.loggingService.catch("Error in setting locations, locations array is empty.");return}this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=e,this.draftLocationMap.options=i);let r=this.getValidLocations(e),a=[],s=[this.location$.value?.location.id,...Object.values(this.locations$.value).map(u=>u.location.id)].filter(u=>u!==void 0),c;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(c=r.find(u=>u.id===i?.rootLocationId),!c)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(!i?.appendLocation){c||(c=r[0]);let u=Jo(c),C=Cn(JSON.stringify(u));u.id&&!s.includes(u.id)&&a.push({locationId:C,location:u}),this.location$.next({locationId:C,location:u})}let p=[];return r.slice(1).forEach(u=>{let C=I({},u),E=this.locations$.value;u?.id&&Object.keys(E).forEach($=>{let Y=E[$];Y.location?.id===u.id&&(C=I(I({},Y.location),u),delete E?.[$])});let D=this.genarateLocationId(C),L={locationId:D,location:C};C.id&&!s.includes(C.id)&&a.push({locationId:D,location:C}),p.push(L),this.locations$.next(T(I({},E),{[D]:L}))}),yield this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:"setLocations",payload:{locations:r,options:i}}),this.analyticsService.trackEvent(X.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:r,options:i},!0,this.getUserIdForAnalytics()),p}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}})}addLocation(e){return ee(this,null,function*(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",payload:{locations:[e],options:{appendLocation:!0}}}),yield this.setLocationsImpl([e],{appendLocation:!0})}catch(i){this.loggingService.catch("Error in DocService addLocation:",i);return}})}removeLocation(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocation",payload:{locations:[e]}}),this.removeLocationImpl([e],i)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),this.coreActionsService.triggerAction($o.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",payload:{locations:e}}),this.removeLocationImpl(e,i)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationImpl(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}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(e){try{this.excludedLocationIds$.next([...e])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){try{if(this.db&&this.authService.getUser()?.organizationId){let e=this.documentPaths$.value,i=this.organizationConfig$.value?.organizationId;if(!this.organizationMetadata$.value?.[i]){let a=new jP;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=i,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:i,documentId:e?.documentId??""}}),this.fetchOrganizationMetadata()}}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}}updateFolderMetadata(){return ee(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 e=this.documentPaths$.value;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let i=this.getDocumentIds();i.find(a=>a.documentId===e.documentId)||i.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=i.map(a=>ee(this,null,function*(){let s=new wP;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Ii();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let u=!0,C=this.documentMetadata$.value?.[a.documentId];if(c&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==c||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),u=!1):E?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),u=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(C){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),_o(E,C)&&(u=!1)}u&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.all(r),this.fetchDocumentMetadata(i)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return ee(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let r=this.getDocumentIds();r.find(a=>a.documentId===i.documentId)||r.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}});for(let c of e){let p=new kP;p.locationId=c?.locationId,p.veltLocationId=jV(c?.location?.id??""),p.location=c?.location,p.pageInfo=Ii(),p?.pageInfo?.deviceInfo&&delete p?.pageInfo?.deviceInfo;let u=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[c?.locationId]:p})}),C=T(I({},p),{metadata:I({},this.getBaseMetadata()??{})});this.commonDbService?.shouldUseFirestore()||this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??""}}),this.commonDbService?.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify(C)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",id:p.veltLocationId}});let E=this.locationMetadata$.value;if(E||(E={}),c?.location?.id){let D=E?.[a.documentId],L=D?.[c?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][c?.location?.id??""]={}),E[a.documentId][c?.location?.id??""]=T(I({},L),{location:c?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Cn(JSON.stringify(Jo(e))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(e,i="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}getLocationByClientLocationId(e){try{let i=this.getLocation()?.location;if(i?.id===e)return i;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(i=s.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,i=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];i.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?i=e:i=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),i){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}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 e={};return document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},i={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(i[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(c=>{let p=e?.[c.documentId];p&&(i[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(i[this.documentPaths$.value?.documentId]=c)}}return Object.values(i)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(me(i=>i?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(me(i=>i?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable()}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,i){try{switch(e){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(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:i}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=i||r.documentId,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,u=c?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),u?{veltFolderId:u}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,i){try{let r,a;i?.element?r=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(r=i.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,i),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:i}){try{return e&&(e=this.generateDocumentId(e)),i&&(i=this.generateOrganizationId(i)),{documentId:e,organizationId:i}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=yl(e?.folderId);r.push(dt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(dt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=yl(e?.folderId);r.push(dt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(dt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(e){return ee(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:r,documents:a}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let s=[],c=this.documentMetadata$.value;a.forEach(p=>{delete p?.organizationId,delete p?.clientDocumentId,delete p?.clientOrganizationId,delete p?.apiKey;let u=pc(p.documentId),C=c?.[u];C&&(c[u]=I(I({},C),p)),p&&this.commonDbService&&s.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(p)),properties:{organizationId:gc(r),documentId:u}}))}),yield Promise.all(s),this.documentMetadata$.next(c)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(e){return ee(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:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(C=>C.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(C=>pc(C)),p=[],u=this.locationMetadata$.value;u||(u={}),c.forEach(C=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=jV(E.id),$=u?.[C],Y=$?.[E.id];u&&($||(u[C]={}),Y||(u[C][E.id]={}),u[C][E.id]=T(I({},Y),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:gc(r),documentId:C,id:L}}))}})}),yield Promise.all(p),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(e){return ee(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 r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let c=yl(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[dt("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(ue(e=>e?this.documentPaths$.pipe(ue(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(me(r=>r?.data?.docIamConfig??r?.data),qt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?pi.RESTRICTED:pi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:pi.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),pi.PUBLIC}}changeDocumentAccessType(e){return ee(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case pi.PUBLIC:r.features.all.restricted=!1;break;case pi.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),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(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(I(I({},this.uiState.value),e))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(un),Q(Fe),Q(jt),Q(y),Q(Is),Q(Tm),Q(Em))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zn=(()=>{let o=class o{constructor(e,i,r,a){this.analyticsService=e,this.authService=i,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>ee(this,null,function*(){return{}})},this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new cn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(c){this.loggingService.catch("Error in UsersService getUserById:",c);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}resolveUsers(e,i=!1){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;"),this.userDataProvider$.getValue()){let r={},a=[],s={};if(e?.forEach(c=>{let p=this.getUserById(c);p?r[c]=p:this.userByIdCalled$.getValue()[c]?i&&a.push(c):(a.push(c),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[c]:!0})))}),a.length>0){let c=this.userDataProvider$.getValue();if(c){let p={};try{let u,C=new Promise((E,D)=>{u=setTimeout(()=>{D(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});p=yield Promise.race([c.get(a).finally(()=>{clearTimeout(u)}),C]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:a})}catch(u){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",u,{userIds:a})}finally{a?.forEach(u=>{p[u]||(p[u]={userId:u,name:`User ${u}`})})}Object.entries(p).forEach(([u,C])=>{C&&(r[u]=p?.[u],s[u]=p?.[u])})}}return Object.keys(s).length>0&&this.userById$.next(I(I({},this.userById$.getValue()),s)),r}else return{}}catch(r){return this.loggingService.catch("Error in UsersService resolveUsers:",r),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>ee(this,null,function*(){let i=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers(i)})))}getUsersFromCentralDb(i){return ee(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e)}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(lt),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var kse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Rse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",i),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",i),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zp=class{static getFirestoreProdDbName(o,t){return t?.storeDbId??(this.isTestingDb(t?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(t){return mt.error("Error in isTestingDb:",t),!1}}};var Gp=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let i=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield hc(()=>i?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(i){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",i);return}})}deleteAttachment(r){return ee(this,arguments,function*({attachmentId:e,metadata:i}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield hc(()=>a?.delete({attachmentId:e,metadata:i,event:qa.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",i)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(Ke))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Yv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.notificationActionTypeMap={[Ut.NEWLY_ADDED]:qa.COMMENT_ANNOTATION_ADD,[Ut.ADDED]:qa.COMMENT_ADD,[Ut.UPDATED]:qa.COMMENT_UPDATE,[Ut.DELETED]:qa.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let r of e){if(r?.from?.userId&&i.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&i.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&i.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&i.add(s?.userId)}if(r?.assignedTo?.userId&&i.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&i.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&i.add(a.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.comments)for(let i of e?.comments){if(i?.from?.userId){let a=this.usersService.getUserById(i?.from?.userId);a&&(i.from=a)}i?.to&&(i.to=i?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(i?.taggedUserContacts?.filter((a,s,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(pm(`{{${a.userId}}}`),"g");i.commentText=i.commentText?.replaceAll(s,a.text),i.commentHtml=i.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let i=this.usersService.getUserById(e?.assignedTo?.userId);i&&(e.assignedTo=i)}if(e?.subscribedUsers)for(let i of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let i of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let i of Object.keys(e?.subscribedUsers))e.subscribedUsers[i].user={userId:e?.subscribedUsers[i].user.userId};if(e?.unsubscribedUsers)for(let i of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[i].user={userId:e?.unsubscribedUsers[i].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(i=>this.formatCommentThreadData(i))),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable();return i&&e?.comments?.forEach(a=>{let s=i?.comments?.[a?.commentId];if(s){a.commentHtml=s?.commentHtml,a.commentText=s?.commentText;let c=s?.attachments;r&&c&&a.attachments?.forEach(p=>{let u=p?.attachmentId;c?.[u]&&(p.name=c?.[u]?.name,p.url=c?.[u]?.url)})}}),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),e}}mergeLocationWithCommentAnnotations(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return r?!_o(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentAnnotationData({data:e,actionType:i}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!i)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.notificationActionTypeMap?.[i];if(!a)return{originalData:e,strippedData:null};let s={},c=null;if(e&&e.annotationId){let p=e.annotationId;if(s[p]={annotationId:p,metadata:hv(e.metadata??{}),comments:{}},e.comments?.forEach(E=>{if(E.commentId){let D;r&&(D={},E.attachments?.forEach(L=>{D[L.attachmentId]={attachmentId:L.attachmentId,name:L.name,url:L.url}})),s[p].comments[E.commentId]=I(I(I({commentId:E.commentId},E?.commentHtml&&{commentHtml:E?.commentHtml}),E?.commentText&&{commentText:E?.commentText}),D&&{attachments:D})}}),!this.isCommentsDataChanged(s[p],p))return{strippedData:null,originalData:e};let C=new ko;Object.assign(C,e),C.comments=e.comments?.map(E=>{let D=new yc;if(Object.assign(D,E),D.isCommentResolverUsed=!0,r){let L=D.attachments?.map($=>($.isAttachmentResolverUsed=!0,delete $?.name,delete $?.url,$));D.attachments=L}return delete D?.commentHtml,delete D?.commentText,D})||[],c=C}return{strippedData:s,originalData:c,eventType:a}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let i=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];i.forEach(r=>{if(r?.text){let a=new RegExp(pm(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),i.forEach(r=>{r?.text&&(r.text="")})}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),e}}handleCommentEncryption(s){return ee(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let c=d6(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:Xn.cloudFunction?.[c]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find($=>$?.commentId===D);L&&(r.targetAnnotationData=L)}}let u=zp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),C={path:i??"",data:e??{},dbId:u??"",notificationData:r||void 0,notificationURL:Xn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga()},E=yield Pp(C,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(c){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",c)}})}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn),Q(je),Q(Uo),Q(jt),Q(Is),Q(Gp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Nse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(e?.length)for(let r of e)r?.user?.userId&&i.add(r?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e=T(I({},e),{user:i}))}return e}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Fse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",i),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",i),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let i=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var KP=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",i),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",i),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",i),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",i),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",i),e}}resolveUsersFromHuddleMessages(e){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let i=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers(i);for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",i),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Bse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromLiveStateCustom(e){try{let i=new Set;return e?.updatedBy&&i.add(e?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let i=this.usersService.getUserById(e?.updatedBy?.userId);i&&(e.updatedBy=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let i=new Set;for(let r of e)r?.updatedBy?.userId&&i.add(r?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(e){try{let i=new Set;return e?.default?.singleEditorMode?.editor?.userId&&i.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);i&&(e.default.singleEditorMode.editor=i)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(e.default.singleEditorMode.requestEditorAccess.user=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),e}}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),e}}mergeLiveStateCustomsWithUsers(e){try{for(let i of e)if(i?.updatedBy?.userId){let r=this.usersService.getUserById(i?.updatedBy?.userId);r&&(i.updatedBy=r)}return e}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Vse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromMultiThreads(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Kv=(()=>{let o=class o{constructor(e,i,r){this.authService=e,this.loggingService=i,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId),r?.transcription?.from?.userId&&i.add(r?.transcription?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.transcription?.from?.userId){let i=this.usersService.getUserById(e?.transcription?.from?.userId);i&&(e.transcription.from=i)}return e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",i),e}}formatRecorderData(e,i){try{return e.transcription=e?.transcription?T(I({},e.transcription),{lastUpdated:i}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",i),e}}encryptRecorderAnnotation(e){return ee(this,null,function*(){try{return yield Pp(e,this.authService.getUser()?.userId??"")}catch(i){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",i);return}})}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZP=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=i,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}getUserIdsToResolveFromNotifications(e){try{let i=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&i.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let c of s)i.add(c)}break}}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=i?.comments?.[r]?.commentText,s=i?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",i),e}}mergeLocationWithNotification(e,i){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:i}=e;if(i?.actionUser?.userId){let r=this.usersService.getUserById(i?.actionUser?.userId);r&&(i.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(i.displayHeadlineMessageTemplateData.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(i.displayHeadlineMessageTemplateData.recipientUser=r)}switch(i?.notificationSource){case"comment":i?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(i?.notificationSourceData);break}return e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",i),e}}formatNotification(e,i){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,i);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let i=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&i.push(r.notification.targetAnnotationId)}),i}catch(i){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",i),[]}}handleNotificationEncryption(i){return ee(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Pp(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(i){return new(i||o)(Q(Yv),Q(Kv),Q(y),Q(zn),Q(je),Q(Is))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromPresenceUsers(e){try{let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",i),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",i),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var $se=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&i.add(a?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(a){return ee(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{let s=d6(this.authService.getFirebaseConfig()?.firebaseOptions),c=yr(this.functions,br({url:Xn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=zp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",C={path:i??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},E=yield Pp(C,u);yield c({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.reactions?.length){for(let i of e?.reactions)if(i?.from?.userId){let r=this.usersService.getUserById(i?.from?.userId);r&&(i.from=r)}}}return e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),e}}isReactionDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return r?!_o(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let i={};if(e&&e.annotationId){let r=e.annotationId;if(i[r]={annotationId:r,metadata:hv(e.metadata??{}),icon:e.icon},!this.isReactionDataChanged(i[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:i,originalData:e}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return i&&i.icon&&(e.icon=i.icon),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn),Q(je),Q(Uo),Q(jt),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Hse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromSelections(e){try{let i=new Set;for(let r of e)r?.user?.userId&&i.add(r.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e.user=i)}return e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zse=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromTags(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&i.add(a.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e?.to?.length&&(e.to=e.to.map(i=>{if(i?.userId){let r=this.usersService.getUserById(i?.userId);r&&(i=r)}return i})),e}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),e}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(Q(y),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Zv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E,D,L,$,Y,ce,Ce,Ie,$e,Ye){this.areaUtilsService=e,this.arrowUtilsService=i,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=c,this.liveStateUtilsService=p,this.loggingService=u,this.multiThreadUtilsService=C,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=$,this.selectionUtilsService=Y,this.tagUtilsService=ce,this.usersService=Ce,this.docService=Ie,this.commentAnnotationsResolverService=$e,this.reactionAnnotationsResolverService=Ye}getFirestorePath({feature:e,properties:i,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=i;c||(c=r?.organizationId);let u=new WP({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){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"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${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"documentAccessType":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`: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 i?.documentId&&u?.documentUsers?`${u?.documentUsers}`:void 0;case"allFolderUsers":return i?.folderId&&u?.folderUsers?`${u?.folderUsers}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.organizationUsers?`${u?.organizationUsers}`:void 0;case"commentViews":return i?.documentId&&i?.id&&u?.commentViews?`${u?.commentViews}/${i?.id}`:void 0;case"allCommentViews":return i?.documentId&&u?.commentViews?`${u?.commentViews}`: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}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"allUserNotifications":return i?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:e,properties:i,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:c,organizationId:p}=i;p||(p=r?.organizationId);let u=new xm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"allComments":return!s&&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"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!s&&i?.documentId&&i?.id&&u?.comment?`${u?.comment}${i?.id}`:void 0;case"allMultiThreads":return!s&&i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"multiThread":return!s&&i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&i?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!s&&i?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocuments":return!s&&u?.docs&&i?.documentId?`${u?.docs}/${i?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&i?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!s&&i?.id&&u?.area?`${u?.area}${i?.id}`:void 0;case"documentUserAccess":return!s&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!s&&i?.documentId&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!s&&i?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!s&&i?.id&&u?.reaction?`${u?.reaction}${i?.id}`:void 0;case"allReactions":return!s&&i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!s&&i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}${i?.id}`:void 0;case"allRecorders":return!s&&i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!s&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentIam":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"commentViews":return!s&&i?.documentId&&i?.id&&u?.views?`${u?.views}comment/${i?.id}`:void 0;case"allDocumentViews":return!s&&i?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!s&&i?.documentId&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}`:void 0;case"allCommentViews":return!s&&i?.documentId&&u?.views?`${u?.views}comment/`:void 0;case"allLocationViews":return!s&&i?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&i?.id&&i?.user&&u?.views?`${u?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!s&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!s&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!s&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/location`:void 0;case"location":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!s&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!s&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!s&&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;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return ee(this,arguments,function*({data:e,feature:i}){try{if(e&&e?.length>0)switch(i){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,a)}})}formatResponse(c){return ee(this,arguments,function*({feature:e,data:i,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(i)));break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(i)));break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i)));break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(i)));break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(i)));break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(i)));break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(i)));break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers(p,a):this.usersService.resolveUsers(p,a))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(i&&typeof i=="object"){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:i,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):i;case"allArrows":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):i;case"allCursors":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):i;case"allDocNotifications":return i&&typeof i=="object"?i?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):i;case"allUserNotifications":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):i;case"allPresence":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):i;case"allRecorders":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):i;case"allHuddleAttendees":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):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((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):i;default:return i}return i}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),i}}mergeCommentAnnotationsWithData$({data:e,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(me(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(me(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:i}){try{return this.usersService.getUserById$().pipe(me(()=>{let r=this.mergeUsersWithData({feature:e,data:i?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:i?.operation??null}:{data:r,operation:i?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(i)}}mergeLocationMetadataWithData$({data:e,feature:i}){try{return this.docService.getLocationMetadata$().pipe(me(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:i,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,r),se(e)}}handleDataStripping({feature:e,data:i,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(i);default:return{originalData:i,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:i,strippedData:null}}}formatData({feature:e,data:i,properties:r,offset:a,isRealtimeDb:s}){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()+a;switch(e){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return s?i:{metadata:i};case"cursor":return this.cursorUtilsService.formatCursorUserData(i);case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":return this.arrowUtilsService.formatArrowData(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.recorderUtilsService.formatRecorderData(i,c);case"notificationViewsTimestamp":return{views:{[r.user??""]:i}};case"documentUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"documentDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"documentMetadataViews":return s?i:{metadata:i};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(i);case"locationMetadataViews":return s?i:{metadata:i};case"locationUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"locationDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"locationViews":return s?i:{location:i};case"docNotificationViews":return s?i:{views:i.views};case"userNotificationViews":return s?i:{views:i.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(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(s){return ee(this,arguments,function*({feature:e,data:i,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:i});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:i,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(i.type==="removed")return!Object.keys(r??{}).includes(i.doc.id);if(r?.[i.doc.id]){let a=i.doc.data(),s=r?.[i.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return ee(this,arguments,function*({feature:e,data:i}){try{return yield this.formatResponse({feature:e,data:i})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),i}})}addMetadata(e,i){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(I({},e),{metadata:e?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return ee(this,arguments,function*({feature:e,data:i,observablesCache:r,eventType:a,id:s,operation:c=null}){try{let C={comment:"allComments",reaction:"allReactions"}[e];if(!C)return null;let E=i?.metadata?.documentId,D=i?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(C)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let $=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&$?.data?.[s]&&(delete $?.data?.[s],r[L]?.subject&&r[L].subject.next({data:$?.data,operation:c})):r[L]?.subject?.next({data:T(I({},$?.data),{[i?.annotationId]:i}),operation:c})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(s){return ee(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:i,extraData:r,eventType:a})}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",c),e}})}handleReactionEncryption(a){return ee(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:i,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(i){return new(i||o)(Q(kse),Q(Rse),Q(Yv),Q(Nse),Q(Fse),Q(KP),Q(Bse),Q(y),Q(Vse),Q(ZP),Q(jse),Q($se),Q(Kv),Q(Hse),Q(zse),Q(zn),Q(lt),Q(Is),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Gse=(()=>{let o=class o{constructor(e,i,r){this.configService=e,this.authService=i,this.loggingService=r,this.firestore$=new ve(null);try{Mn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Ne(([a,s])=>!!a&&!!s),et(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(SP(zp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||SP("DocumentIdDb");if(e){let i=HS(e,"generateDocumentId");return jv(i).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(Q(jt),Q(je),Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var En=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E){this.authService=e,this.commonDbUtilsService=i,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=c,this.docService=p,this.usersService=u,this.commentAnnotationsResolverService=C,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let L=on(D,".info/serverTimeOffset");this.offsetListener=yu(L,$=>{let Y=$.val();this.offset=Y})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){Mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ne(([i,r])=>!!i),et(1),gn(([i,r])=>{e({db:i,firestore:r})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(e,i,r,a,s,c){return ee(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(C=>ee(this,[C],function*({db:p,firestore:u}){let E;i?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,$;try{D&&(L=on(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&u&&E&&($=jv(u,`${E}`))}catch{this.loggingService.catch("Error in docRef")}yield r({dbRef:L,firestoreRef:$,data:a,firestorePath:E}),c&&c({firestoreAvailable:!!u})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return ee(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,u=>ee(this,null,function*(){if(u.dbRef){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Vf(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:c?.actionType});if(e==="comment"){let $=null;E&&($=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:c?.targetAnnotationData?.commentId})),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:c}))}else if(e==="reaction"){let $=null;E&&($=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield x$(u.firestoreRef,C)}}catch(C){this.loggingService.catch(`Error in setData for ${e}`,C)}}),i,s,a))}catch(u){this.loggingService.catch(`Error in setData for ${e}`,u)}})}updateData(p){return ee(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,u=>ee(this,null,function*(){if(u.dbRef&&!r?.skipRtdb){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield d5(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:c?.actionType});if(e==="comment"){let $=null;E&&($=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:c?.targetAnnotationData?.commentId})),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:c}))}else if(e==="reaction"){let $=null;E&&($=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&($?.isSuccess||$===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield x$(u.firestoreRef,C,{merge:!0})}}catch(C){this.loggingService.catch(`Error in updateDoc for ${e}`,C)}}),i,s,a))}catch(u){this.loggingService.catch(`Error in updateData for ${e}`,u)}})}deleteData(s){return ee(this,arguments,function*({feature:e,properties:i,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.performDatabaseOperation(e,i,c=>ee(this,null,function*(){c.dbRef&&(yield c5(c.dbRef));try{if(c.firestoreRef&&!i?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield mse(c.firestoreRef)}catch(p){this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=On()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),On()||"noDocumentId"}}queryData(r){return ee(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();return!e||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,i):yield this.handleRtdbQuery(e,i)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,i){return ee(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=HS(this.firestore,r);i?.useCollectionGroup&&(a=b$(this.firestore,r));let s=i?.firestoreQuery??[],c=E$(a,...s);if(i?.getCount){let p=yield pse(c).catch(u=>(this.loggingService.catch(`Error in getCountFromServer for ${e}`,u),null));return p?p.data().count:0}else{let p=yield use(c).catch(E=>(this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let u=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:u})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,i){return ee(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=on(this.db,r),s=i?.rtdbQuery??[],c=XL(a,...s),p=yield YL(c).catch(C=>(this.loggingService.catch(`Error in get for ${e}`,C),null));if(!p)return[];let u=p.val();return u?i?.skipObjectValues?u:Object.values(u??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return ee(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();if(i?.skipFirestore&&(a=!1),!e||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{let c=yield gse(jv(this.firestore,s)).catch(u=>(this.loggingService.catch(`Error in getDoc for ${e}`,u),null));if(!c)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return i?.field?p?.[i.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{let c=yield YL(on(this.db,s)).catch(u=>(this.loggingService.catch(`Error in get for ${e}`,u),null));if(!c)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return i?.field?p?.[i.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:i}){let r=this.shouldUseFirestore();i?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(i)}`;return Mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ne(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),ue(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleFirestoreListener(e,i,c).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s)return this.handleRealtimeDbListener(e,i,s);return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Pg(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,i,r){let a=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(i)}`;return a?new Lt(c=>{let p=i.isCollection?this.setupCollectionListener(r,a,e,c,i):this.setupDocumentListener(r,a,e,c,i);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(ue(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),ue(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),ue(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),qt(Vi)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,i,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=HS(e,i);if(s?.useCollectionGroup&&(p=b$(e,i)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=E$(p,...E)}let u=!0,C=[];return I$(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),L=null,$=!1;E?.docChanges()?.length?E.docChanges().forEach(Y=>{["allComments","allReactions"].includes(r)&&!u&&Y.type!=="removed"&&C.push(Y.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:Y,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||($=!0,Object.assign(D,this.handleCollectionChange(Y,D)),Y.type==="removed"&&(L||(L={type:Y.type,ids:[]}),L.ids.push(Y.doc.id)))}):$=!0,$&&(["allComments","allReactions"].includes(r)&&C?.length&&(this.commonDbUtilsService.resolveAnnotations({data:C,feature:r}),C=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),u=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,i){switch(e.type){case"added":case"modified":i[e.doc.id]=e.doc.data();break;case"removed":delete i?.[e.doc.id];break}return i}setupDocumentListener(e,i,r,a,s){let c=jv(e,i);return I$(c,p=>{try{let u=p.data()||{};s?.field&&(u=u?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:u,subscriber:a,operation:null})}catch(u){this.handleListenerError(u,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,i,r){this.loggingService.catch(`Firestore listener error for ${i}:`,e),r.error(e)}handleRealtimeDbListener(e,i,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=on(r,a);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];s=XL(s,...c)}return Bf(s).pipe(Vn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),me(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((u,[C,E])=>(u[C]=this.commonDbUtilsService.addMetadata(E,i),u),{}):this.commonDbUtilsService.addMetadata(c,i))),ue(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),ue(c=>this.usersService.getUserById$().pipe(me(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(Zv),Q(y),Q(Gse),Q(un),Q(jt),Q(lt),Q(zn),Q(Is),Q(Tm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vi=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.analyticsService=e,this.authService=i,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=c,this.commonDbService=p,this.usersService=u,this.db=bi(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new Xe,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Mi.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(ue(C=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),me(()=>C)))).subscribe(C=>ee(this,null,function*(){this.user=C,C&&this.documentPaths?C?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(C),this.setLoggedInUser(C),yield this.moveGlobalContactUserFromEmailToUserIdPath(C),this.updateUserInGlobalContactsIfAvailable(C),C?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(C?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),C=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",C)}),this.databaseService.getDb().pipe(Ne(C=>!!C),et(1)).subscribe(C=>{C&&(this.db=C)},C=>{this.loggingService.catch("Error in ContactService constructor getDb: ",C)}),this.getOrganizationGroups$().subscribe(C=>{this.authService.setOrganizationUserGroups(C)}),Mn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([C,E,D])=>{E?D?.merge?this.userContacts$.next([...C||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(C||[])}),this.getUserContacts$().subscribe(C=>{try{C?.forEach(E=>{let D=E?.userSnippylyId||um(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(i){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",i)}}checkIfUserGlobalContact(e){return ee(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}return!1}catch(i){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",i),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUser: ",i)}}migrateLoggedInUserFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let i=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let c=r.contacts[s];if(c?.userId){let p=Nt(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}})}}}}catch(i){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",i)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(i){this.loggingService.catch("Error in ContactService addGlobalContact: ",i)}}updateUserInGlobalContactsIfAvailable(e){return ee(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Do;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",i)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.email),skipFirestore:!0}}))}}}catch(i){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",i)}})}setLoggedInUserPrivateContacts(e,i){try{if(e?.userId&&this.documentPaths?.logins){let r,a=i?.filter(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Nt(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Nt(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return ee(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let i=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});i&&Object.keys(i??{}).forEach(r=>ee(this,null,function*(){let a=i[r];a?.email&&a?.userId&&Nt(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(i){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",i)}})}checkToSetLoggedInUserInGroupContacts(){return ee(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(et(1)).subscribe(i=>ee(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(i);if(!a||a===pi.PUBLIC)r=!0;else if(a===pi.RESTRICTED){let s=Nt(this.user?.userId);if(i?.users?.[s]&&(r=!0),this.user?.email){let c=Nt(this.user?.email);i?.users?.[c]&&(r=!0)}}if(r){let s=new Hp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,i){try{let r=i?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>ee(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Nt(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return ee(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in ContactService removeGroupContacts: ",i)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let i={};e.forEach(r=>{r?.userId?(!r?.email||!i[r.email])&&(i[r.userId]=r):r?.email&&(!r?.userId||!i[r.userId])&&(i[r.email]=r)}),e=Object.values(i??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:i,documentId:r,veltFolderId:a}=e||{};return i&&r?Mn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$()]).pipe(me(([s,c,p,u,C,E,D])=>{let L={},$=!1;E&&!E?.merge&&($=!0);let Y=Ye=>D.some(Re=>Ye.includes(Re)),ce=Y([Mi.ALL,Mi.ORGANIZATION])?Object.keys(s?.[i]||{}):[],Ce=a?Y([Mi.ALL,Mi.FOLDER])?Object.keys(c?.[i]?.[a]||{}):[]:[],Ie=Y([Mi.ALL,Mi.DOCUMENT])?Object.keys(p?.[i]?.[r]||{}):[];if([...ce,...Ce||[],...Ie].forEach(Ye=>{let Re=u?.[Ye];Re&&(L[Ye]=Re)}),C){let{merge:Ye,options:Re}=E||{},{organizationId:_e,documentId:Ee,folderId:Oe}=Re||{},ye=Oe?yl(Oe):void 0;(!_e||_e===i)&&(!Ee||Ee===r)&&(!ye||ye===a)&&(Ye||(L={}),C.forEach(he=>{he?.userId&&(L[he.userId]=he)}))}return Object.values(L??{})})):this.userContacts$.asObservable().pipe(me(s=>s))}catch(i){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",i),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Ne(e=>!!e),ue(e=>this.docService.getDocumentPaths$().pipe(Ne(i=>!!i),gn(i=>{this.documentPaths=i}),me(()=>e))),ue(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let i=[];return i.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(me(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(me(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Nt(e?.userId)}}).pipe(me(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),oo(...i).pipe(ro(this.authService.getUser$().pipe(Ne(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(i){this.loggingService.catch("Error in ContactService addUserContact: ",i)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(ue(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(me(i=>i?.data),gn(i=>{i?this.users=Object.values(i??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(ue(e=>e?.organizationId?this.userById$.pipe(me(i=>{let r={};return Object.values(i||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(me(i=>{let r={};return i.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(me(i=>i.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(i=>i.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(i=>i.email===e)}getUserByUserId$(e){return this.users$.pipe(me(i=>i.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?.organizationId?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),i?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0}}).pipe(me(a=>a?.data),me(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!i)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0}}).pipe(me(s=>s?.data)),a.pipe(me(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let c=Object.values(s??{});this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(ue(e=>e?se(e).pipe(ue(i=>this.docService.getDocumentPaths$().pipe(Ne(r=>!!r),gn(r=>{this.documentPaths=r}),me(()=>i))),ue(i=>(this.setUserDocumentContacts([]),i?this.documentPaths?this.docService.getDocumentIds$().pipe(ue(r=>{let a=r?.length>0?r.map(p=>p.documentId):[this.documentPaths?.documentId??""];if(a.some(p=>!p)||!this.documentPaths)return se();let s=se([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.documentPaths?.veltFolderId&&this.documentPaths?.allDocuments)s=this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},c),{firestoreQuery:[Ui(dt("metadata.apiKey","==",this.configService?.getApiKey()),dt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId),dt("metadata.organizationId","==",this.documentPaths?.organizationId))]})}).pipe(me(p=>p?.data));else{let p=[];for(let u=0;u<a.length;u+=j.LISTENER_BATCH_SIZE)p.push(a.slice(u,u+j.LISTENER_BATCH_SIZE));s=Mn(p.map(u=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},c),{firestoreQuery:[Ui(dt("metadata.apiKey","==",this.configService?.getApiKey()),dt("metadata.documentId","in",u),dt("metadata.organizationId","==",this.documentPaths?.organizationId),...this.documentPaths?.veltFolderId?[dt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId)]:[])]})}).pipe(Gr()))).pipe(me(u=>ua(u)?.data))}return s.pipe(me(p=>{if(p){typeof p=="object"&&(p?.undefined&&delete p.undefined,p?.null&&delete p.null);let u=Object.values(p??{});this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):se():se())),ue(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,i){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),i){let s={};s[i]={},e.forEach(c=>{s[i][c.user.userId]=c,this.userById$.next(T(I({},this.userById$.value),{[c.user.userId]:c.user}))}),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[i]:s[i]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{this.userFolderContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,veltFolderId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndFolderId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{this.userDocumentContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,documentId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndDocumentId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Mi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Mi.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let i=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(ue(e=>e?.organizationId?se(e).pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(Ne(r=>!!r),me(()=>i))),ue(i=>{if(this.setUserOrganizationGroups([]),!i)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(me(a=>a?.data),me(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",i)}}onContactSelected(e){try{if(e?.userId){let i=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case pi.RESTRICTED:if(!i){let a={contact:e,isOrganizationContact:r,isDocumentContact:i,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let i={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(i)}}catch(i){this.loggingService.catch("Error in ContactService onContactSelected: ",i)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereLabel: ",i)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereDescription: ",i)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(ue(()=>this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Mi.ALL,Mi.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(i){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",i)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(i=>e.includes(i))}updateContactList(e,i){return ee(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:i}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers(r);let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(i)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:i,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:i,organizationId:r})}return this}catch(i){return this.loggingService.catch("Error in ContactService convert: ",i),this}}getContactList$(){try{return this.authService.getUser$().pipe(ue(e=>e?Mn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(me(([i,r,a,s,c])=>{let p={};p.organizationUsers=i?.map(C=>this.convertToClientUser(C)),p.folderUsers=r?.map(C=>this.convertToClientUser(C)),p.documentUsers=a?.map(C=>this.convertToClientUser(C)),p.updatedContactList=c?.map(C=>this.convertToClientUser(C));let u=[];return s?.forEach(C=>{let E=this.convertToClientUserGroup(C,p.organizationUsers||[]);E&&u.push(E)}),p.userGroups=u,p}),qt(Vi)):se(null)),Vn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,i){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return i?.forEach(s=>{if(s?.userId){let c=Nt(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUser: ",i),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(jt),Q(un),Q(lt),Q(y),Q(En),Q(zn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Wse=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){mt.catch("Error in File utils getFileName: ",o);return}},B$=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){mt.catch("Error in File utils getFileExtension: ",o);return}},qse=(n,o)=>{try{let t=n.slice(0,-1,n.type);return new File([t],o+"."+B$(n),{type:n.type})}catch(t){mt.catch("Error in File utils updateFile: ",t);return}},Yse=n=>new Promise((o,t)=>{let e=new FileReader;e.readAsDataURL(n),e.onload=()=>{o(e.result)},e.onerror=i=>{t(i)}}),Kse={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Wp=(()=>{let o=class o{constructor(e,i,r,a){this.authService=e,this.configService=i,this.loggingService=r,this.attachmentResolverService=a,this.storage=Ly();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=Ly(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:i}){try{let r=new Hv;r.name=i.name;let a=qse(i,`${r.attachmentId}_${Wse(i)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=i.size,r.type=B$(i),r?.type&&(r.mimeType=Kse[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:i,resolve:r,reject:a}){try{let s=By(this.storage,e.bucketPath),c=EB(s,i,{cacheControl:"public,max-age=3600"});c.on("state_changed",p=>{let u=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{IB(c.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(c){return ee(this,arguments,function*({file:e,attachment:i,metadata:r,resolve:a,reject:s}){try{r.attachmentId=i.attachmentId;let p={attachmentId:i.attachmentId,name:i.name,file:e,metadata:r,mimeType:i.mimeType},u=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:qa.ATTACHMENT_ADD});u&&u.data?.url?(i.url=u.data?.url,a(i)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:i,useAttachmentResolver:r,metadata:a}){return new Promise((s,c)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:i});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:i,attachment:p,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:p,file:i,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}})}uploadChunk(e,i,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${i.name}`,p=By(this.storage,c),u=EB(p,i,{cacheControl:"public,max-age=3600"});u.on("state_changed",C=>{let E=C.bytesTransferred/C.totalBytes*100},C=>{s(C)},()=>{IB(u.snapshot.ref).then(C=>{a(C)}).catch(C=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,C),s(C)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let i=new XMLHttpRequest;i.responseType="blob",i.onload=()=>{let r=i.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},i.onerror=()=>{window.open(e.url,"_blank")},i.open("GET",e.url),i.send()}}catch(i){this.loggingService.catch("Error in StorageService downloadAttachment: ",i)}}deleteAttachment({attachment:e,metadata:i,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:i}).then(()=>{a(null)}).catch(c=>{s(c)});else{let c=By(this.storage,e.bucketPath);bB(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((i,r)=>{let a=By(this.storage,e);bB(a).then(()=>{i(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(i){return new(i||o)(Q(je),Q(jt),Q(y),Q(Gp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var hn=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u){this.analyticsService=e,this.authService=i,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=u,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Ne(C=>!!C),et(1)).subscribe(C=>{C&&(this.db=C,this.getUser(),this.getDocumentPaths())},C=>{this.loggingService.catch("Error in CommentService getDb subscription: ",C)}),this.getRole$().pipe(et(1)).subscribe(C=>{this.authService?.getUser()&&!C&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(C=>{C?.accessType&&this.contactService.setDocumentAccessType(C.accessType)})}catch(C){this.loggingService.catch("Error in IamService constructor: ",C)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Ne(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let i=e||new DP;this.documentIAM$.next(i)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(Vn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(me(e=>!!e),qt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(me(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(me(e=>e?.features),ue(e=>this.getRole$().pipe(me(i=>(i===po.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(i){return this.loggingService.catch("Error in IamService hasRole: ",i),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(i){return this.loggingService.catch("Error in IamService hasRoleAny: ",i),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(ue(()=>this.documentIAM$.pipe(Ne(i=>!!i),ue(()=>this.workspaceIAM$.pipe(me(()=>e===this.getRole()))))))}catch(i){return this.loggingService.catch("Error in IamService hasRole$: ",i),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(ue(()=>this.configService.getSF$()),ue(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),ue(()=>this.documentIAM$.pipe(Ne(e=>!!e))),ue(()=>this.workspaceIAM$),me(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return po.ADMIN;if(!e&&this.user?.isAdmin)return po.ADMIN;let i=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?pi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||pi.PUBLIC:null){case pi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||po.COMMENTER;break;case pi.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||null;break;default:break}return i}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(me(e=>e===po.ADMIN),qt())}isUserAdmin(){try{return this.getRole()===po.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,i){try{if(e||i){let r;return e&&(r=this.documentIAM$.value?.users?.[Nt(e)]),!r&&i&&(r=this.documentIAM$.value?.users?.[Nt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,i){try{if(e||i){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Nt(e)]),!r&&i&&(r=this.workspaceIAM$.value?.users?.[Nt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(i){return new(i||o)(Q(Ke),Q(je),Q(vi),Q(un),Q(lt),Q(jt),Q(y),Q(En))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jn=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,u,C,E,D,L,$,Y,ce,Ce){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=u,this.databaseService=C,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=$,this.notificationUtilsService=Y,this.usersService=ce,this.functions=Ce,this.db=bi(),this.notificationsDb=bi(void 0,Xn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}});try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Ne(Ie=>!!Ie),et(1)).subscribe(Ie=>{Ie&&(this.db=Ie,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},Ie=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Ie)}),this.authService.getUser$().subscribe(Ie=>{Ie?(this.subscribeGetNotificationsForYou(),this.getDocumentIds()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach($e=>{this.notificationsByDocumentIdSubscription[$e]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Ie=>{if(Ie){let $e=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Ie||{}).forEach(Ye=>{let Re=$e?.[Ye]?.notifications;Re?.length&&Re.forEach(_e=>{this.notificationUtilsService.mergeLocationWithNotification({notification:_e},Ie)?.notification})}),this.notificationsByDocumentIdMap$.next($e)}})}catch(Ie){this.loggingService.catch("Error in NotificationService constructor: ",Ie)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in NotificationService setCommentService: ",i)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.getDocumentIdsByLastNotificationTimestamp().pipe(Ai(),me(([e,i])=>{let r=e?.map(u=>u.documentId),a=i?.map(u=>u.documentId),s=r?.filter(u=>!a?.includes(u)),c=a?.map(u=>({documentId:u,timestamp:i?.find(C=>C.documentId===u)?.timestamp})).filter(u=>!r?.includes(u.documentId)),p=a?.map(u=>{let C=i?.find(E=>E.documentId===u)?.timestamp;return{documentId:u,timestamp:C}}).filter(u=>{let C=e?.find(E=>E.documentId===u.documentId)?.timestamp;return C&&u.timestamp&&C!==u.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(u=>{this.removeNotificationsForDocumentId(u)}),i&&!i?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(ue(i=>this.docService.getOrganizationConfig$().pipe(me(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||i?.organizationId;return s&&c&&(a=new xm({apiKey:s,organizationId:c})),{user:i,documentPaths:a}}))),ue(i=>{let{user:r,documentPaths:a}=i;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Ui(dt("timestamp",">=",p)),Ka("timestamp","desc"),$v(e)]}}).pipe(me(u=>u?.data),me(u=>{let C=[];return Object.keys(u||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?u[E]?.timestamp??0:u[E],L=this.commonDbService.shouldUseFirestore()?u[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let $=L.id,Y=u[E]?.metadata?.documentId,ce=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),Ce=ce?.[Y]??{documentMetadata:null,notifications:[]},Ie=Ce.notifications??[],$e=Ie?.findIndex(Ye=>Ye.id===$);$e!==-1&&(Ie.splice($e,1),this.notificationsByDocumentIdMap$.next(T(I({},ce),{[Y]:T(I({},Ce),{notifications:Ie})})))}C.push({documentId:E,timestamp:D})}),C}),Vn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),se([]))))}return se(null)}))}catch(i){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",i),se([])}}fetchNotificationsForDocumentIds(e,i=15){return ee(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:Xn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),c={};e.forEach(L=>{if(L?.documentId){let $=this.getAllowedDocumentMetadataByDocumentId(L.documentId);$&&(c[L.documentId]=$)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:i,documentMetadataByDocumentId:c},u=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),C=(yield r({veltData:u}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield roe(C,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),$=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Y=[],ce=[];Object.keys(D).forEach((Ce,Ie)=>{let $e=D[Ce].documentMetadata;if($e){let Re=this.allowedDocumentMetadataMap$.value||{};(!Re?.[Ce]||!_o(Re?.[Ce],$e))&&this.allowedDocumentMetadataMap$.next(T(I({},Re),{[Ce]:$e}))}let Ye=D[Ce].notifications||[];Ye.forEach(Re=>{Re.notification=this.getClientNotificationObject(Re)}),this.setNotificationForDocumentIdInCache(Ce,$e,Ye),L&&Y.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ye,shouldAwait:!0,forceResolve:!0})),$&&ce.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ye,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(Y).then(()=>{Object.keys(D).forEach(Ce=>{let Ie=D?.[Ce]?.documentMetadata||{},$e=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[Ce]?.notifications||[]});$e.forEach(Ye=>{Ye.notification=this.getClientNotificationObject(Ye)}),this.setNotificationForDocumentIdInCache(Ce,Ie,$e)})}),$&&Promise.all(ce).then(()=>{Object.keys(D).forEach(Ce=>{let Ie=D?.[Ce]?.documentMetadata||{},$e=D?.[Ce]?.notifications?.reduce((Ye,Re)=>(Ye[Re.notificationId]=Re,Ye),{});$e=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:$e}),$e=Object.values($e??{}),$e.forEach(Ye=>{Ye.notification=this.getClientNotificationObject(Ye)}),this.setNotificationForDocumentIdInCache(Ce,Ie,$e)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,i,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);i||(i=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),u=p?.[e]?.notifications||[],C=this.docService.getLocationMetadatas(),E=r?.map($=>{let Y=$.notification;return Y.metadata&&(Y.metadata.documentName=i?.documentName||Y.metadata.documentName,Y.metadata.organizationMetadata=c||Y.metadata.organizationMetadata,Y.metadata.documentMetadata=i||Y.metadata.documentMetadata),C&&(Y=this.notificationUtilsService.mergeLocationWithNotification({notification:Y},C)?.notification),Y})?.filter($=>!!$)||[],D=new Map(u.map($=>[$.id,$]));E.forEach($=>{D.set($.id,$)});let L=Array.from(D.values()).sort(($,Y)=>(Y.timestamp||0)-($.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:i}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let i=this.notificationsByDocumentIdMap$.getValue();delete i?.[e],this.notificationsByDocumentIdMap$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",i)}}getNotificationsForDocumentId$(e,i=50){try{return this.authService.getUser$().pipe(me(r=>({user:r})),ue(r=>this.maxNotificationDays$.pipe(me(()=>r))),ue(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let c=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;c.setDate(c.getDate()-p);let u=c.getTime();return bo(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[ZL("timestamp"),QL(u),KL(i)],firestoreQuery:[Ka("timestamp","desc"),dt("timestamp",">=",u),dt("notification.actionUser.userId","!=",a.userId),$v(i)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(ue(C=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:C,operation:null}})),me(C=>C?.data??[]),me(C=>(C.sort((E,D)=>D.timestamp-E.timestamp),C)),Vn(C=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",C),se([]))),me(C=>(C.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),C)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,i=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-i),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.databaseService.getDb().pipe(ue(e=>this.authService.getUser$().pipe(me(i=>({db:e,user:i})))),ue(e=>this.maxNotificationDays$.pipe(me(()=>e))),ue(e=>{let{db:i,user:r}=e,a=this.configService.getApiKey();if(i&&r?.organizationId&&a){let s=Nt(r?.userId),c=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;c.setDate(c.getDate()-p);let u=c.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[ZL("timestamp"),QL(u),KL(50)],firestoreQuery:[Ka("timestamp","desc"),dt("timestamp",">=",u),dt("notification.actionUser.userId","!=",r.userId),$v(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(ue(C=>C?.data?se(C).pipe(me(E=>E?.data),me(E=>{let D=Object.values(E||{});return D.forEach($=>{$.notification=this.getClientNotificationObject($)}),D.sort(($,Y)=>Y.timestamp-$.timestamp),D.map($=>$.notification).filter($=>!!$)}),ue(E=>{let D={data:E?.reduce((L,$)=>(L[$.id]={notification:$},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(me(L=>Object.values(L?.data||{}).map($=>$?.notification)))})):se(null)))}return se(null)}),ue(e=>{let i=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(i).pipe(me(()=>e))}),ue(e=>this.allowedDocumentMetadataMap$.pipe(me(()=>e))),me(e=>(e?.length&&(e=e.map(i=>{if(i?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(i.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),i.metadata.documentName=a?.documentName||i.metadata.documentName,i.metadata.organizationMetadata=s||i.metadata.organizationMetadata,i.metadata.documentMetadata=a||i.metadata.documentMetadata}return i})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(e):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=Cn(e)),i&&typeof i=="object"){let s=Jo(i);r=Cn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return qn(this.afAuth).pipe(Ne(s=>!!s),ue(s=>this.isFeatureAllowed({firebaseUser:s})),ue(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(me(c=>(s.featureAllowed=c,s))):se(s)),ue(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(ue(c=>this.docService.getDocumentPaths$().pipe(me(p=>(this.documentPaths=p,c.documentPaths=p,c)))),ue(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),me(i=>T(I({},e),{config:i})),ue(i=>this.authService.getUser$().pipe(me(r=>T(I({},i),{user:r})))),ue(i=>Ji(i.config,i.user,ke.NOTIFICATION)?se(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ue(i=>{if(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=on(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return Bf(a).pipe(Vn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),me(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(C=>{let E=s?.raw[C];E?.id&&c.push(E)}),c.forEach(C=>{C.id&&p.set(C.id,C)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let u=[];s?.processed&&Object.keys(s?.processed||{}).forEach(C=>{let E=s?.processed[C];E?.id&&u.push(E)}),this.processedNotifications$.next(u),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let i=this.notificationViews$.getValue(),r;e?.email&&(r=Nt(e?.email));let a;e?.userId&&(a=Nt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let u=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(u=!0);let C={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:u,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(C.id);if(E?.metadata&&(C.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),C?.notificationSource==="comment"&&C?.targetAnnotationId){let D=this.commentService?.getAnnotationById(C.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(C.notificationSourceData=Hn(D))}s.set(p.id,C)}}),s.forEach((p,u)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!i?.notification?.[u]?.views?.[e?.userSnippylyId],s.set(u,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:i,metadata:r,views:a,notification:s}){try{let c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let u=null;c?.email&&(u=Nt(c?.email));let C=null;c?.userId&&(C=Nt(c?.userId));let E=!1,D=!0;(u&&p.notifyUsers?.[u]||C&&p.notifyUsersByUserId?.[C])&&(E=!0),C&&a?.[C]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let $=this.commentService?.getAnnotationById(L.targetAnnotationId);$||s?.notificationSourceData&&($=s?.notificationSourceData),$||i?.annotationData&&($=i.annotationData),$&&(L.notificationSourceData=Hn($))}return i?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=i?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(me(e=>e?Object.keys(e??{}).map(i=>{let r=e[i].notifications||[],a=r.filter(c=>c.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:i,notifications:e[i]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[i]?.documentMetadata}}).filter(i=>i.notifications?.length>0).sort((i,r)=>r.latestNotificationTimestamp-i.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(me(e=>{let i=null;return e?(i=[],e.forEach(r=>{r.notifications.forEach(a=>{i?.push(a)})}),i?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let i=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=i?.documentId?new xm({apiKey:a,documentId:i.documentId,organizationId:i?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),u=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(u))}catch(i){return this.loggingService.catch("Error in NotificationService processNotificationData: ",i),null}}updateNotificationDatabase(e){try{let i=on(this.notificationsDb),r=this.processNotificationData(e);o5(i,JSON.parse(JSON.stringify(r)))}catch(i){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",i)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(){return this.authService.getUser$().pipe(ue(e=>e?e.organizationId?this.getAllNotifications$().pipe(ue(i=>this.notificationsForYou$.pipe(me(r=>{let a=new Map;return(i||[]).forEach(s=>{s.id&&a.set(s.id,s)}),(r||[]).forEach(s=>{s.id&&!a.has(s.id)&&a.set(s.id,s)}),Array.from(a.values()).sort((s,c)=>(c.timestamp||0)-(s.timestamp||0))})))):this.notificationsByIdMap$.asObservable().pipe(me(i=>Array.from(i.values())),me(i=>i.sort((r,a)=>a.timestamp-r.timestamp)),Mg()):se(null)))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(i){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",i);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(i){this.loggingService.catch("Error in NotificationService setNotificationViews: ",i)}}getNotificationHeadlineMessage(e){try{let i=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,c=r.replace(s,(p,u)=>(u==="actionUser"||u==="recipientUser")&&a[u]?i?.email&&a[u].email===i?.email||i?.userId&&a[u]?.userId===i?.userId?"You":a[u].name||a[u].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[u]?a[u]:p);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",i),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let i=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);i=i?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(i)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",i),""}}setHistoryPanelVisibility(e,i=!1,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,i=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return ee(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let c=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(c)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let c=r?.[s]?.notifications||[],p=c.find(u=>u.id===a.id);p&&(p.isUnread=!1),r[s].notifications=c}}),this.notificationsByDocumentIdMap$.next(r)}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",i)}})}setAllNotificationsAsRead(e){return ee(this,null,function*(){try{if(e?.tabId==="for-you"){let i=this.notificationsForYou$.value||[];this.setNotificationsAsRead(i)}else this.getNotifications$().pipe(et(1)).subscribe(i=>{i&&this.setNotificationsAsRead(i)})}catch(i){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",i)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(me(e=>e?.filter(r=>r?.isUnread)?.length??null),ue(e=>this.getNotifications$().pipe(me(i=>{let r=i?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return ee(this,null,function*(){try{let i=this.authService.getUser();if(i&&e?.id){let r=Nt(i?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:c,documentId:p}=a;if(s&&c&&p&&r){let u=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:c,documentId:p,apiKey:s}});u?.notificationId&&(u?.views?.[r]||(u.views||(u.views={}),u.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:c,documentId:p,apiKey:s},data:u})));let C=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:c}});C?.notificationId&&(this.getReadNotificationsOnForYouTab()?C?.views?.[r]||(C.views||(C.views={}),C.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:c},data:C})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:c}}))}}}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",i)}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(i){this.loggingService.catch("Error in NotificationService setMaxDays: ",i)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setTabConfig: ",i)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}markNotificationAsReadById(e){return ee(this,null,function*(){try{this.getNotifications$().pipe(et(1)).subscribe(i=>{if(i){let r=i.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(i){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",i)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(i){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(Q(Si),Q(Ke),Q(je),Q(jt),Q(En),Q(Zv),Q(Yv),Q(Is),Q(un),Q(lt),Q(Fe),Q(hn),Q(y),Q(ZP),Q(zn),Q(Uo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(j.CommentAnnotationStatusMap),this._customPriorityMap=new ve(j.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(j.CommentCategoryMap);try{let i=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);i&&this._customPriorityMap.next(JSON.parse(i));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(i){this.loggingService.catch("Error in CustomFilterService constructor: ",i)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",i)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r}),this._customPriorityMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",i)}}setCustomCategories(e){try{let i={};e.forEach(r=>{i[r.id]=r}),this._customCategoryMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",i)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let i=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(i)return i.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let i=Object.entries(this._customStatusMap.value),r=i.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=i.find(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=i.find(([c,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(i){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",i),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=j.CommentAnnotationPriorityMap[e.priority])}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",i)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(i=>j.CommentCategoryMap[i]))}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",i)}return e}};o.\u0275fac=function(i){return new(i||o)(Q(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ic=(()=>{let o=class o{constructor(e,i,r){this.domService=e,this.loggingService=i,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,i){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return i&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${i}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(i=>{let r=e[i];if(r.svg)this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${i}" />`;this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[i]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(i){this.loggingService.catch("Error in EmojiService setEmojiList: ",i)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
196
196
  <path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
197
197
  <path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
198
198
  <path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>